2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["238"],{67393:function(i,e,t){var a=t("44249"),n=(t("71695"),t("40251"),t("47021"),t("57243")),o=t("18869"),l=t("35359"),d=t("20552"),r=t("36522"),s=t("72621"),c=(t("52247"),t("19423"),t("83744")),h=t("88854");let p,m,f=i=>i;c.A.addInitializer((async i=>{await i.updateComplete;const e=i;e.dialog.prepend(e.scrim),e.scrim.style.inset=0,e.scrim.style.zIndex=0;const{getOpenAnimation:t,getCloseAnimation:a}=e;e.getOpenAnimation=()=>{var i,e;const a=t.call(void 0);return a.container=[...null!==(i=a.container)&&void 0!==i?i:[],...null!==(e=a.dialog)&&void 0!==e?e:[]],a.dialog=[],a},e.getCloseAnimation=()=>{var i,e;const t=a.call(void 0);return t.container=[...null!==(i=t.container)&&void 0!==i?i:[],...null!==(e=t.dialog)&&void 0!==e?e:[]],t.dialog=[],t}}));(0,a.Z)([(0,o.Mo)("ha-md-dialog")],(function(i,e){class a extends e{constructor(){super(),i(this),this.addEventListener("cancel",this._handleCancel),"function"!=typeof HTMLDialogElement&&(this.addEventListener("open",this._handleOpen),m||(m=t.e("854").then(t.bind(t,85893)))),void 0===this.animate&&(this.quick=!0),void 0===this.animate&&(this.quick=!0)}}return{F:a,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:"disable-cancel-action",type:Boolean})],key:"disableCancelAction",value(){return!1}},{kind:"field",key:"_polyfillDialogRegistered",value(){return!1}},{kind:"method",key:"_handleOpen",value:async function(i){var e;if(i.preventDefault(),this._polyfillDialogRegistered)return;this._polyfillDialogRegistered=!0,this._loadPolyfillStylesheet("/static/polyfills/dialog-polyfill.css");const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("dialog");(await m).default.registerDialog(t),this.removeEventListener("open",this._handleOpen),this.show()}},{kind:"method",key:"_loadPolyfillStylesheet",value:async function(i){const e=document.createElement("link");return e.rel="stylesheet",e.href=i,new Promise(((t,a)=>{var n;e.onload=()=>t(),e.onerror=()=>a(new Error(`Stylesheet failed to load: ${i}`)),null===(n=this.shadowRoot)||void 0===n||n.appendChild(e)}))}},{kind:"method",key:"_handleCancel",value:function(i){if(this.disableCancelAction){var e;i.preventDefault();const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("dialog .container");void 0!==this.animate&&(null==t||t.animate([{transform:"rotate(-1deg)","animation-timing-function":"ease-in"},{transform:"rotate(1.5deg)","animation-timing-function":"ease-out"},{transform:"rotate(0deg)","animation-timing-function":"ease-in"}],{duration:200,iterations:2}))}}},{kind:"field",static:!0,key:"styles",value(){return[...(0,s.Z)(a,"styles",this),(0,n.iv)(p||(p=f`:host{--md-dialog-container-color:var(--card-background-color);--md-dialog-headline-color:var(--primary-text-color);--md-dialog-supporting-text-color:var(--primary-text-color);--md-sys-color-scrim:#000000;--md-dialog-headline-weight:400;--md-dialog-headline-size:1.574rem;--md-dialog-supporting-text-size:1rem;--md-dialog-supporting-text-line-height:1.5rem}:host([type=alert]){min-width:320px}@media all and (max-width:450px),all and (max-height:500px){:host(:not([type=alert])){min-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));max-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));min-height:100%;max-height:100%;--md-dialog-container-shape:0}}::slotted(ha-dialog-header[slot=headline]){display:contents}.scroller{overflow:var(--dialog-content-overflow,auto)}slot[name=content]::slotted(*){padding:var(--dialog-content-padding,24px)}.scrim{z-index:10}`))]}}]}}),c.A);Object.assign(Object.assign({},h.I),{},{dialog:[[[{transform:"translateY(50px)"},{transform:"translateY(0)"}],{duration:500,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:0},{opacity:1}],{duration:50,easing:"linear",pseudoElement:"::before"}]]}),Object.assign(Object.assign({},h.G),{},{dialog:[[[{transform:"translateY(0)"},{transform:"translateY(50px)"}],{duration:150,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:"1"},{opacity:"0"}],{delay:100,duration:50,easing:"linear",pseudoElement:"::before"}]]});let u,g,v=i=>i;(0,a.Z)([(0,o.Mo)("ha-dialog-header")],(function(i,e){return{F:class extends e{constructor(...e){super(...e),i(this)}},d:[{kind:"method",key:"render",value:function(){return(0,n.dy)(u||(u=v` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> <div class="header-title"> <slot name="title"></slot> </div> <div class="header-subtitle"> <slot name="subtitle"></slot> </div> </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `))}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,n.iv)(g||(g=v`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:flex-start;padding:4px;box-sizing:border-box}.header-content{flex:1;padding:10px 4px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{font-size:22px;line-height:28px;font-weight:400}.header-subtitle{font-size:14px;line-height:20px;color:var(--secondary-text-color)}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:12px}}.header-navigation-icon{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}`))]}}]}}),n.oi);t("37583"),t("3035");var x=t("47750"),_=t("33990"),y=t("14463");let k,b,w,$,C,E,S,z,A,I,M=i=>i,O=((0,a.Z)([(0,o.Mo)("ha-textfield")],(function(i,e){class t extends e{constructor(...e){super(...e),i(this)}}return{F:t,d:[{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"iconTrailing",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,o.IO)("input")],key:"formElement",value:void 0},{kind:"method",key:"updated",value:function(i){(0,s.Z)(t,"updated",this,3)([i]),(i.has("invalid")||i.has("errorMessage"))&&(this.setCustomValidity(this.invalid?this.errorMessage||this.validationMessage||"Invalid":""),(this.invalid||this.validateOnInitialRender||i.has("invalid")&&void 0!==i.get("invalid"))&&this.reportValidity()),i.has("autocomplete")&&(this.autocomplete?this.formElement.setAttribute("autocomplete",this.autocomplete):this.formElement.removeAttribute("autocomplete")),i.has("autocorrect")&&(this.autocorrect?this.formElement.setAttribute("autocorrect",this.autocorrect):this.formElement.removeAttribute("autocorrect")),i.has("inputSpellcheck")&&(this.inputSpellcheck?this.formElement.setAttribute("spellcheck",this.inputSpellcheck):this.formElement.removeAttribute("spellcheck"))}},{kind:"method",key:"renderIcon",value:function(i,e=!1){const t=e?"trailing":"leading";return(0,n.dy)(k||(k=M` <span class="mdc-text-field__icon mdc-text-field__icon--${0}" tabindex="${0}"> <slot name="${0}Icon"></slot> </span> `),t,e?1:-1,t)}},{kind:"field",static:!0,key:"styles",value(){return[_.W,(0,n.iv)(b||(b=M`.mdc-text-field__input{width:var(--ha-textfield-input-width,100%)}.mdc-text-field:not(.mdc-text-field--with-leading-icon){padding:var(--text-field-padding,0px 16px)}.mdc-text-field__affix--suffix{padding-left:var(--text-field-suffix-padding-left,12px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,12px);padding-inline-end:var(--text-field-suffix-padding-right,0px);direction:ltr}.mdc-text-field--with-leading-icon{padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,16px);direction:var(--direction)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:var(--text-field-suffix-padding-left,0px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,0px)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--suffix{color:var(--secondary-text-color)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon{color:var(--secondary-text-color)}.mdc-text-field__icon--leading{margin-inline-start:16px;margin-inline-end:8px;direction:var(--direction)}.mdc-text-field__icon--trailing{padding:var(--textfield-icon-trailing-padding,12px)}.mdc-floating-label:not(.mdc-floating-label--float-above){text-overflow:ellipsis;width:inherit;padding-right:30px;padding-inline-end:30px;padding-inline-start:initial;box-sizing:border-box;direction:var(--direction)}input{text-align:var(--text-field-text-align,start)}::-ms-reveal{display:none}:host([no-spinner]) input::-webkit-inner-spin-button,:host([no-spinner]) input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}:host([no-spinner]) input[type=number]{-moz-appearance:textfield}.mdc-text-field__ripple{overflow:hidden}.mdc-text-field{overflow:var(--text-field-overflow)}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start);direction:var(--direction);text-align:var(--float-start)}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 48px - var(--text-field-suffix-padding-left,0px));inset-inline-start:calc(48px + var(--text-field-suffix-padding-left,0px))!important;inset-inline-end:initial!important;direction:var(--direction)}.mdc-text-field__input[type=number]{direction:var(--direction)}.mdc-text-field__affix--prefix{padding-right:var(--text-field-prefix-padding-right,2px);padding-inline-end:var(--text-field-prefix-padding-right,2px);padding-inline-start:initial}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--prefix{color:var(--mdc-text-field-label-ink-color)}#helper-text ha-markdown{display:inline-block}`)),"rtl"===y.E.document.dir?(0,n.iv)(w||(w=M`.mdc-floating-label,.mdc-text-field--with-leading-icon,.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label,.mdc-text-field__icon--leading,.mdc-text-field__input[type=number]{direction:rtl;--direction:rtl}`)):(0,n.iv)($||($=M``))]}}]}}),x.P),i=>i);(0,a.Z)([(0,o.Mo)("dialog-box")],(function(i,e){return{F:class extends e{constructor(...e){super(...e),i(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_closeState",value:void 0},{kind:"field",decorators:[(0,o.IO)("ha-textfield")],key:"_textField",value:void 0},{kind:"field",decorators:[(0,o.IO)("ha-md-dialog")],key:"_dialog",value:void 0},{kind:"field",key:"_closePromise",value:void 0},{kind:"field",key:"_closeResolve",value:void 0},{kind:"method",key:"showDialog",value:async function(i){this._closePromise&&await this._closePromise,this._params=i}},{kind:"method",key:"closeDialog",value:function(){var i,e;return!(null!==(i=this._params)&&void 0!==i&&i.confirmation||null!==(e=this._params)&&void 0!==e&&e.prompt)&&(!this._params||(this._dismiss(),!0))}},{kind:"method",key:"render",value:function(){if(!this._params)return n.Ld;const i=this._params.confirmation||this._params.prompt,e=this._params.title||this._params.confirmation&&this.hass.localize("ui.dialogs.generic.default_confirmation_title");return(0,n.dy)(C||(C=O` <ha-md-dialog open .disableCancelAction="${0}" @closed="${0}" type="alert" aria-labelledby="dialog-box-title" aria-describedby="dialog-box-description"> <div slot="headline"> <span .title="${0}" id="dialog-box-title"> ${0} ${0} </span> </div> <div slot="content" id="dialog-box-description"> ${0} ${0} </div> <div slot="actions"> ${0} <ha-button @click="${0}" ?dialogInitialFocus="${0}" class="${0}"> ${0} </ha-button> </div> </ha-md-dialog> `),i||!1,this._dialogClosed,e,this._params.warning?(0,n.dy)(E||(E=O`<ha-svg-icon .path="${0}" style="color:var(--warning-color)"></ha-svg-icon> `),"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16"):n.Ld,e,this._params.text?(0,n.dy)(S||(S=O` <p>${0}</p> `),this._params.text):"",this._params.prompt?(0,n.dy)(z||(z=O` <ha-textfield dialogInitialFocus value="${0}" .placeholder="${0}" .label="${0}" .type="${0}" .min="${0}" .max="${0}"></ha-textfield> `),(0,d.o)(this._params.defaultValue),this._params.placeholder,this._params.inputLabel?this._params.inputLabel:"",this._params.inputType?this._params.inputType:"text",this._params.inputMin,this._params.inputMax):"",i&&(0,n.dy)(A||(A=O` <ha-button @click="${0}" ?dialogInitialFocus="${0}"> ${0} </ha-button> `),this._dismiss,!this._params.prompt&&this._params.destructive,this._params.dismissText?this._params.dismissText:this.hass.localize("ui.dialogs.generic.cancel")),this._confirm,!this._params.prompt&&!this._params.destructive,(0,l.$)({destructive:this._params.destructive||!1}),this._params.confirmText?this._params.confirmText:this.hass.localize("ui.dialogs.generic.ok"))}},{kind:"method",key:"_cancel",value:function(){var i;null!==(i=this._params)&&void 0!==i&&i.cancel&&this._params.cancel()}},{kind:"method",key:"_dismiss",value:function(){this._closeState="canceled",this._cancel(),this._closeDialog()}},{kind:"method",key:"_confirm",value:function(){var i;(this._closeState="confirmed",this._params.confirm)&&this._params.confirm(null===(i=this._textField)||void 0===i?void 0:i.value);this._closeDialog()}},{kind:"method",key:"_closeDialog",value:function(){var i;(0,r.B)(this,"dialog-closed",{dialog:this.localName}),null===(i=this._dialog)||void 0===i||i.close(),this._closePromise=new Promise((i=>{this._closeResolve=i}))}},{kind:"method",key:"_dialogClosed",value:function(){var i;this._closeState||((0,r.B)(this,"dialog-closed",{dialog:this.localName}),this._cancel()),this._closeState=void 0,this._params=void 0,null===(i=this._closeResolve)||void 0===i||i.call(this),this._closeResolve=void 0}},{kind:"get",static:!0,key:"styles",value:function(){return(0,n.iv)(I||(I=O`:host([inert]){pointer-events:initial!important;cursor:initial!important}a{color:var(--primary-color)}p{margin:0;color:var(--primary-text-color)}.no-bottom-padding{padding-bottom:0}.secondary{color:var(--secondary-text-color)}.destructive{--mdc-theme-primary:var(--error-color)}ha-textfield{width:100%}`))}}]}}),n.oi)}}]);
|
|
//# sourceMappingURL=238.0b3e9a6b0717757c.js.map
|