"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([["7418"],{90916:function(e,t,i){i.d(t,{Z:function(){return o}});const n=e=>e<10?`0${e}`:e;function o(e){const t=Math.floor(e/3600),i=Math.floor(e%3600/60),o=Math.floor(e%3600%60);return t>0?`${t}:${n(i)}:${n(o)}`:i>0?`${i}:${n(o)}`:o>0?""+o:null}},90977:function(e,t,i){var n=i(73577),o=i(72621),a=(i(71695),i(47021),i(58795)),r=i(57243),s=i(50778);let l,d=e=>e;(0,n.Z)([(0,s.Mo)("ha-circular-progress")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:"aria-label",type:String})],key:"ariaLabel",value(){return"Loading"}},{kind:"field",decorators:[(0,s.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,o.Z)(i,"updated",this,3)([e]),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--md-circular-progress-size","16px");break;case"small":this.style.setProperty("--md-circular-progress-size","28px");break;case"medium":this.style.setProperty("--md-circular-progress-size","48px");break;case"large":this.style.setProperty("--md-circular-progress-size","68px")}}},{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(i,"styles",this),(0,r.iv)(l||(l=d`:host{--md-sys-color-primary:var(--primary-color);--md-circular-progress-size:48px}`))]}}]}}),a.B)},79983:function(e,t,i){i.d(t,{D4:function(){return a},D7:function(){return d},Ky:function(){return o},XO:function(){return r},d4:function(){return l},oi:function(){return s}});i(56587),i(1275);const n={"HA-Frontend-Base":`${location.protocol}//${location.host}`},o=(e,t,i)=>{var o;return e.callApi("POST","config/config_entries/flow",{handler:t,show_advanced_options:Boolean(null===(o=e.userData)||void 0===o?void 0:o.showAdvanced),entry_id:i},n)},a=(e,t)=>e.callApi("GET",`config/config_entries/flow/${t}`,void 0,n),r=(e,t,i)=>e.callApi("POST",`config/config_entries/flow/${t}`,i,n),s=(e,t)=>e.callApi("DELETE",`config/config_entries/flow/${t}`),l=(e,t)=>e.callApi("GET","config/config_entries/flow_handlers"+(t?`?type=${t}`:"")),d=e=>e.sendMessagePromise({type:"config_entries/flow/progress"})},32851:function(e,t,i){i.d(t,{AS:function(){return o},KY:function(){return n}});i(19423);const n=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],o=(e,t)=>e.callWS(Object.assign({type:"schedule/create"},t))},80124:function(e,t,i){i.d(t,{rv:()=>r,eF:()=>o,mK:()=>a});i("19423"),i("13334");var n=i("90916");const o=(e,t)=>e.callWS(Object.assign({type:"timer/create"},t)),a=e=>{if(!e.attributes.remaining)return;let t=function(e){const t=e.split(":").map(Number);return 3600*t[0]+60*t[1]+t[2]}(e.attributes.remaining);if("active"===e.state){const i=(new Date).getTime(),n=new Date(e.attributes.finishes_at).getTime();t=Math.max((n-i)/1e3,0)}return t},r=(e,t,i)=>{if(!t)return null;if("idle"===t.state||0===i)return e.formatEntityState(t);let o=(0,n.Z)(i||0)||"0";return"paused"===t.state&&(o=`${o} (${e.formatEntityState(t)})`),o}},18694:function(e,t,i){i.d(t,{t:function(){return _}});i(63721),i(71695),i(40251),i(47021);var n=i(57243),o=i(79983),a=i(1275),r=i(43373);let s,l,d,c,h,p,u,m,f,g=e=>e;const _=(e,t)=>(0,r.w)(e,t,{flowType:"config_flow",showDevices:!0,createFlow:async(e,i)=>{const[n]=await Promise.all([(0,o.Ky)(e,i,t.entryId),e.loadFragmentTranslation("config"),e.loadBackendTranslation("config",i),e.loadBackendTranslation("selector",i),e.loadBackendTranslation("title",i)]);return n},fetchFlow:async(e,t)=>{const i=await(0,o.D4)(e,t);return await e.loadFragmentTranslation("config"),await e.loadBackendTranslation("config",i.handler),await e.loadBackendTranslation("selector",i.handler),i},handleFlowStep:o.XO,deleteFlow:o.oi,renderAbortDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.abort.${t.reason}`,t.description_placeholders);return i?(0,n.dy)(s||(s=g` `),i):t.reason},renderShowFormStepHeader(e,t){return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.title`,t.description_placeholders)||e.localize(`component.${t.handler}.title`)},renderShowFormStepDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.description`,t.description_placeholders);return i?(0,n.dy)(l||(l=g` `),i):""},renderShowFormStepFieldLabel(e,t,i,n){var o;if("expandable"===i.type)return e.localize(`component.${t.handler}.config.step.${t.step_id}.sections.${i.name}.name`);const a=null!=n&&null!==(o=n.path)&&void 0!==o&&o[0]?`sections.${n.path[0]}.`:"";return e.localize(`component.${t.handler}.config.step.${t.step_id}.${a}data.${i.name}`)||i.name},renderShowFormStepFieldHelper(e,t,i,o){var a;if("expandable"===i.type)return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.sections.${i.name}.description`);const r=null!=o&&null!==(a=o.path)&&void 0!==a&&a[0]?`sections.${o.path[0]}.`:"",s=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.${r}data_description.${i.name}`,t.description_placeholders);return s?(0,n.dy)(d||(d=g``),s):""},renderShowFormStepFieldError(e,t,i){return e.localize(`component.${t.translation_domain||t.translation_domain||t.handler}.config.error.${i}`,t.description_placeholders)||i},renderShowFormStepFieldLocalizeValue(e,t,i){return e.localize(`component.${t.handler}.selector.${i}`)},renderShowFormStepSubmitButton(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.submit`)||e.localize("ui.panel.config.integrations.config_flow."+(!1===t.last_step?"next":"submit"))},renderExternalStepHeader(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize("ui.panel.config.integrations.config_flow.external_step.open_site")},renderExternalStepDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.${t.step_id}.description`,t.description_placeholders);return(0,n.dy)(c||(c=g`
${0}
${0} `),e.localize("ui.panel.config.integrations.config_flow.external_step.description"),i?(0,n.dy)(h||(h=g` `),i):"")},renderCreateEntryDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.create_entry.${t.description||"default"}`,t.description_placeholders);return(0,n.dy)(p||(p=g` ${0} ${0}
`),i?(0,n.dy)(u||(u=g` `),i):"",e.localize("ui.panel.config.integrations.config_flow.created_config",{name:t.title}))},renderShowFormProgressHeader(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize(`component.${t.handler}.title`)},renderShowFormProgressDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.progress.${t.progress_action}`,t.description_placeholders);return i?(0,n.dy)(m||(m=g` `),i):""},renderMenuHeader(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize(`component.${t.handler}.title`)},renderMenuDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.description`,t.description_placeholders);return i?(0,n.dy)(f||(f=g` `),i):""},renderMenuOption(e,t,i){return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.menu_options.${i}`,t.description_placeholders)},renderLoadingDescription(e,t,i,n){if("loading_flow"!==t&&"loading_step"!==t)return"";const o=(null==n?void 0:n.handler)||i;return e.localize(`ui.panel.config.integrations.config_flow.loading.${t}`,{integration:o?(0,a.Lh)(e.localize,o):e.localize("ui.panel.config.integrations.config_flow.loading.fallback_title")})}})},43373:function(e,t,i){i.d(t,{w:function(){return a}});i(71695),i(19423),i(40251),i(47021);var n=i(11297);const o=()=>Promise.all([i.e("6379"),i.e("6931"),i.e("2174"),i.e("1206"),i.e("2517"),i.e("9045")]).then(i.bind(i,22975)),a=(e,t,i)=>{(0,n.B)(e,"show-dialog",{dialogTag:"dialog-data-entry-flow",dialogImport:o,dialogParams:Object.assign(Object.assign({},t),{},{flowConfig:i,dialogParentElement:e})})}},84084:function(e,t,i){i.r(t),i.d(t,{DialogHelperDetail:()=>B});var n=i("73577"),o=(i("71695"),i("92745"),i("61893"),i("40251"),i("47021"),i("31622"),i("14394"),i("57243")),a=i("50778"),r=i("35359"),s=i("49672"),l=i("38653");i("90977");var d=i("44118"),c=(i("74064"),i("79983"));i("19423");var h=i("1275"),p=i("32851"),u=i("80124"),m=i("18694"),f=i("66193"),g=i("85019"),_=i("56395"),y=i("11297");let $,k,w,b,v,z,S,F,x,C=e=>e;const D={input_boolean:{create:(e,t)=>e.callWS(Object.assign({type:"input_boolean/create"},t)),import:()=>i.e("3037").then(i.bind(i,50987))},input_button:{create:(e,t)=>e.callWS(Object.assign({type:"input_button/create"},t)),import:()=>i.e("3457").then(i.bind(i,41343))},input_text:{create:(e,t)=>e.callWS(Object.assign({type:"input_text/create"},t)),import:()=>Promise.all([i.e("3215"),i.e("8193")]).then(i.bind(i,15861))},input_number:{create:(e,t)=>e.callWS(Object.assign({type:"input_number/create"},t)),import:()=>Promise.all([i.e("3215"),i.e("8456")]).then(i.bind(i,59795))},input_datetime:{create:(e,t)=>e.callWS(Object.assign({type:"input_datetime/create"},t)),import:()=>Promise.all([i.e("3215"),i.e("9857")]).then(i.bind(i,71403))},input_select:{create:(e,t)=>e.callWS(Object.assign({type:"input_select/create"},t)),import:()=>Promise.all([i.e("1552"),i.e("925")]).then(i.bind(i,38344))},counter:{create:(e,t)=>e.callWS(Object.assign({type:"counter/create"},t)),import:()=>i.e("7014").then(i.bind(i,34026))},timer:{create:u.eF,import:()=>Promise.all([i.e("9570"),i.e("6239")]).then(i.bind(i,29241))},schedule:{create:p.AS,import:()=>Promise.all([i.e("5536"),i.e("5864")]).then(i.bind(i,77595))}};let B=(0,n.Z)([(0,a.Mo)("dialog-helper-detail")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_item",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_opened",value(){return!1}},{kind:"field",decorators:[(0,a.SB)()],key:"_domain",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_submitting",value(){return!1}},{kind:"field",decorators:[(0,a.IO)(".form")],key:"_form",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_helperFlows",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_loading",value(){return!1}},{kind:"field",key:"_params",value:void 0},{kind:"method",key:"showDialog",value:async function(e){this._params=e,this._domain=e.domain,this._item=void 0,this._domain&&this._domain in D&&await D[this._domain].import(),this._opened=!0,await this.updateComplete,this.hass.loadFragmentTranslation("config");const t=await(0,c.d4)(this.hass,["helper"]);await this.hass.loadBackendTranslation("title",t,!0),this._helperFlows=t}},{kind:"method",key:"closeDialog",value:function(){this._opened=!1,this._error=void 0,this._domain=void 0,this._params=void 0,(0,y.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"render",value:function(){if(!this._opened)return o.Ld;let e;var t;if(this._domain)e=(0,o.dy)($||($=C` ${0} ${0}
${0} ${0} `),this._valueChanged,this._error?(0,o.dy)(k||(k=C`${0}
`),this._error):"",(0,l.h)(`ha-${this._domain}-form`,{hass:this.hass,item:this._item,new:!0}),this._createItem,this._submitting,this.hass.localize("ui.panel.config.helpers.dialog.create"),null!==(t=this._params)&&void 0!==t&&t.domain?o.Ld:(0,o.dy)(w||(w=C` ${0} `),this._goBack,this._submitting,this.hass.localize("ui.common.back")));else if(this._loading||void 0===this._helperFlows)e=(0,o.dy)(b||(b=C``));else{const t=[];for(const e of Object.keys(D))t.push([e,this.hass.localize(`ui.panel.config.helpers.types.${e}`)||e]);for(const e of this._helperFlows)t.push([e,(0,h.Lh)(this.hass.localize,e)]);t.sort(((e,t)=>e[1].localeCompare(t[1]))),e=(0,o.dy)(v||(v=C` ${0} `),this.hass.localize("ui.panel.config.helpers.dialog.create_helper"),t.map((([e,t])=>{var i;const n=!(e in D)||(0,s.p)(this.hass,e);return(0,o.dy)(z||(z=C`
${0} ${0} `),!n,e,this._domainPicked,(0,g.X1)({domain:e,type:"icon",useFallback:!0,darkOptimized:null===(i=this.hass.themes)||void 0===i?void 0:i.darkMode}),t,n?"":(0,o.dy)(S||(S=C` ${0} `),this.hass.localize("ui.dialogs.helper_settings.platform_not_loaded",{platform:e})))})))}return(0,o.dy)(F||(F=C` ${0} `),this.closeDialog,(0,r.$)({"button-left":!this._domain}),!this._domain,(0,d.i)(this.hass,this._domain?this.hass.localize("ui.panel.config.helpers.dialog.create_platform",{platform:(0,_.X)(this._domain)&&this.hass.localize(`ui.panel.config.helpers.types.${this._domain}`)||this._domain}):this.hass.localize("ui.panel.config.helpers.dialog.create_helper")),e)}},{kind:"method",key:"_valueChanged",value:function(e){this._item=e.detail.value}},{kind:"method",key:"_createItem",value:async function(){if(this._domain&&this._item){this._submitting=!0,this._error="";try{var e;const t=await D[this._domain].create(this.hass,this._item);null!==(e=this._params)&&void 0!==e&&e.dialogClosedCallback&&t.id&&this._params.dialogClosedCallback({flowFinished:!0,entityId:`${this._domain}.${t.id}`}),this.closeDialog()}catch(t){this._error=t.message||"Unknown error"}finally{this._submitting=!1}}}},{kind:"method",key:"_domainPicked",value:async function(e){if(!(e=>!(!e.detail.selected||"property"!==e.detail.source||(e.currentTarget.selected=!1,0)))(e))return;const t=e.currentTarget.domain;if(t in D){this._loading=!0;try{await D[t].import(),this._domain=t}finally{this._loading=!1}this._focusForm()}else(0,m.t)(this,{startFlowHandler:t,manifest:await(0,h.t4)(this.hass,t),dialogClosedCallback:this._params.dialogClosedCallback}),this.closeDialog()}},{kind:"method",key:"_focusForm",value:async function(){var e;await this.updateComplete,(null===(e=this._form)||void 0===e?void 0:e.lastElementChild).focus()}},{kind:"method",key:"_goBack",value:function(){this._domain=void 0,this._item=void 0,this._error=void 0}},{kind:"get",static:!0,key:"styles",value:function(){return[f.yu,(0,o.iv)(x||(x=C`ha-dialog.button-left{--justify-action-buttons:flex-start}ha-dialog{--dialog-content-padding:0;--dialog-scroll-divider-color:transparent;--mdc-dialog-max-height:60vh}@media all and (min-width:550px){ha-dialog{--mdc-dialog-min-width:500px}}ha-icon-next{width:24px}.form{padding:24px}`))]}}]}}),o.oi)},85019:function(e,t,i){i.d(t,{X1:function(){return n},u4:function(){return o},zC:function(){return a}});i(88044);const n=e=>`https://brands.home-assistant.io/${e.brand?"brands/":""}${e.useFallback?"_/":""}${e.domain}/${e.darkOptimized?"dark_":""}${e.type}.png`,o=e=>e.split("/")[4],a=e=>e.startsWith("https://brands.home-assistant.io/")}}]);
//# sourceMappingURL=7418.1549720fcd8397ba.js.map