Files
2026-01-30 23:31:00 -06:00

2 lines
14 KiB
JavaScript

export const ids=["7418"];export const modules={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(44249),o=i(72621),a=i(58795),r=i(57243),s=i(50778);(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:()=>"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),r.iv`: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}});const n={"HA-Frontend-Base":`${location.protocol}//${location.host}`},o=(e,t,i)=>e.callApi("POST","config/config_entries/flow",{handler:t,show_advanced_options:Boolean(e.userData?.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}});const n=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],o=(e,t)=>e.callWS({type:"schedule/create",...t})},80124:function(e,t,i){i.d(t,{rv:()=>r,eF:()=>o,mK:()=>a});i("13334");var n=i("90916");const o=(e,t)=>e.callWS({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 s}});var n=i(57243),o=i(79983),a=i(1275),r=i(43373);const s=(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?n.dy` <ha-markdown allow-svg breaks .content="${i}"></ha-markdown> `:t.reason},renderShowFormStepHeader:(e,t)=>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?n.dy` <ha-markdown allow-svg breaks .content="${i}"></ha-markdown> `:""},renderShowFormStepFieldLabel(e,t,i,n){if("expandable"===i.type)return e.localize(`component.${t.handler}.config.step.${t.step_id}.sections.${i.name}.name`);const o=n?.path?.[0]?`sections.${n.path[0]}.`:"";return e.localize(`component.${t.handler}.config.step.${t.step_id}.${o}data.${i.name}`)||i.name},renderShowFormStepFieldHelper(e,t,i,o){if("expandable"===i.type)return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.sections.${i.name}.description`);const a=o?.path?.[0]?`sections.${o.path[0]}.`:"",r=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.${a}data_description.${i.name}`,t.description_placeholders);return r?n.dy`<ha-markdown breaks .content="${r}"></ha-markdown>`:""},renderShowFormStepFieldError:(e,t,i)=>e.localize(`component.${t.translation_domain||t.translation_domain||t.handler}.config.error.${i}`,t.description_placeholders)||i,renderShowFormStepFieldLocalizeValue:(e,t,i)=>e.localize(`component.${t.handler}.selector.${i}`),renderShowFormStepSubmitButton:(e,t)=>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)=>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 n.dy` <p> ${e.localize("ui.panel.config.integrations.config_flow.external_step.description")} </p> ${i?n.dy` <ha-markdown allow-svg breaks .content="${i}"></ha-markdown> `:""} `},renderCreateEntryDescription(e,t){const i=e.localize(`component.${t.translation_domain||t.handler}.config.create_entry.${t.description||"default"}`,t.description_placeholders);return n.dy` ${i?n.dy` <ha-markdown allow-svg breaks .content="${i}"></ha-markdown> `:""} <p> ${e.localize("ui.panel.config.integrations.config_flow.created_config",{name:t.title})} </p> `},renderShowFormProgressHeader:(e,t)=>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?n.dy` <ha-markdown allow-svg breaks .content="${i}"></ha-markdown> `:""},renderMenuHeader:(e,t)=>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?n.dy` <ha-markdown allow-svg breaks .content="${i}"></ha-markdown> `:""},renderMenuOption:(e,t,i)=>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=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}});var n=i(11297);const o=()=>Promise.all([i.e("6379"),i.e("3397"),i.e("2174"),i.e("1206"),i.e("2517"),i.e("9894")]).then(i.bind(i,69817)),a=(e,t,i)=>{(0,n.B)(e,"show-dialog",{dialogTag:"dialog-data-entry-flow",dialogImport:o,dialogParams:{...t,flowConfig:i,dialogParentElement:e}})}},84084:function(e,t,i){i.r(t),i.d(t,{DialogHelperDetail:()=>k});var n=i("44249"),o=(i("92745"),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"));var p=i("1275"),h=i("32851"),m=i("80124"),u=i("18694"),f=i("66193"),g=i("85019"),_=i("56395"),y=i("11297");const $={input_boolean:{create:(e,t)=>e.callWS({type:"input_boolean/create",...t}),import:()=>i.e("3037").then(i.bind(i,50987))},input_button:{create:(e,t)=>e.callWS({type:"input_button/create",...t}),import:()=>i.e("3457").then(i.bind(i,41343))},input_text:{create:(e,t)=>e.callWS({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({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({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({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({type:"counter/create",...t}),import:()=>i.e("7014").then(i.bind(i,34026))},timer:{create:m.eF,import:()=>Promise.all([i.e("9570"),i.e("6239")]).then(i.bind(i,29241))},schedule:{create:h.AS,import:()=>Promise.all([i.e("5536"),i.e("5864")]).then(i.bind(i,77595))}};let k=(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:()=>!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:()=>!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:()=>!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 $&&await $[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;if(this._domain)e=o.dy` <div class="form" @value-changed="${this._valueChanged}"> ${this._error?o.dy`<div class="error">${this._error}</div>`:""} ${(0,l.h)(`ha-${this._domain}-form`,{hass:this.hass,item:this._item,new:!0})} </div> <mwc-button slot="primaryAction" @click="${this._createItem}" .disabled="${this._submitting}"> ${this.hass.localize("ui.panel.config.helpers.dialog.create")} </mwc-button> ${this._params?.domain?o.Ld:o.dy`<mwc-button slot="secondaryAction" @click="${this._goBack}" .disabled="${this._submitting}"> ${this.hass.localize("ui.common.back")} </mwc-button>`} `;else if(this._loading||void 0===this._helperFlows)e=o.dy`<ha-circular-progress indeterminate></ha-circular-progress>`;else{const t=[];for(const e of Object.keys($))t.push([e,this.hass.localize(`ui.panel.config.helpers.types.${e}`)||e]);for(const e of this._helperFlows)t.push([e,(0,p.Lh)(this.hass.localize,e)]);t.sort(((e,t)=>e[1].localeCompare(t[1]))),e=o.dy` <mwc-list innerRole="listbox" itemRoles="option" innerAriaLabel="${this.hass.localize("ui.panel.config.helpers.dialog.create_helper")}" rootTabbable dialogInitialFocus> ${t.map((([e,t])=>{const i=!(e in $)||(0,s.p)(this.hass,e);return o.dy` <ha-list-item .disabled="${!i}" hasmeta .domain="${e}" @request-selected="${this._domainPicked}" graphic="icon"> <img slot="graphic" loading="lazy" alt="" src="${(0,g.X1)({domain:e,type:"icon",useFallback:!0,darkOptimized:this.hass.themes?.darkMode})}" crossorigin="anonymous" referrerpolicy="no-referrer"> <span class="item-text"> ${t} </span> <ha-icon-next slot="meta"></ha-icon-next> </ha-list-item> ${i?"":o.dy` <simple-tooltip animation-delay="0">${this.hass.localize("ui.dialogs.helper_settings.platform_not_loaded",{platform:e})}</simple-tooltip> `} `}))} </mwc-list> `}return o.dy` <ha-dialog open @closed="${this.closeDialog}" class="${(0,r.$)({"button-left":!this._domain})}" scrimClickAction escapeKeyAction .hideActions="${!this._domain}" .heading="${(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} </ha-dialog> `}},{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{const e=await $[this._domain].create(this.hass,this._item);this._params?.dialogClosedCallback&&e.id&&this._params.dialogClosedCallback({flowFinished:!0,entityId:`${this._domain}.${e.id}`}),this.closeDialog()}catch(e){this._error=e.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 $){this._loading=!0;try{await $[t].import(),this._domain=t}finally{this._loading=!1}this._focusForm()}else(0,u.t)(this,{startFlowHandler:t,manifest:await(0,p.t4)(this.hass,t),dialogClosedCallback:this._params.dialogClosedCallback}),this.closeDialog()}},{kind:"method",key:"_focusForm",value:async function(){await this.updateComplete,(this._form?.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,o.iv`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}});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.0d28b76da2ef8d0e.js.map