"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["9346"],{75632:function(e,t,s){s.d(t,{H:function(){return i}});s(12977);const i=(e,t,s,i,r)=>e.connection.subscribeMessage(r,{type:"template/start_preview",flow_id:t,flow_type:s,user_input:i})},96521:function(e,t,s){s.a(e,async function(e,i){try{s.r(t);s(35748),s(35058),s(65315),s(37089),s(5934),s(95013);var r=s(69868),o=s(84922),a=s(11991),l=s(51849),n=s(75632),_=s(99264),h=s(44017),p=(s(94124),e([_]));_=(p.then?(await p)():p)[0];let d,u,c,w,b,v,y,f,g=e=>e;class m extends o.WF{disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub.then(e=>e()),this._unsub=void 0)}willUpdate(e){e.has("stepData")&&this._debouncedSubscribePreview()}render(){var e;return this._error?(0,o.qy)(d||(d=g`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):(0,o.qy)(u||(u=g`<entity-preview-row .hass="${0}" .stateObj="${0}"></entity-preview-row> ${0} ${0} `),this.hass,this._preview,null!==(e=this._listeners)&&void 0!==e&&e.time?(0,o.qy)(c||(c=g` <p> ${0} </p> `),this.hass.localize("ui.dialogs.helper_settings.template.time")):o.s6,this._listeners?this._listeners.all?(0,o.qy)(w||(w=g` <p class="all_listeners"> ${0} </p> `),this.hass.localize("ui.dialogs.helper_settings.template.all_listeners")):this._listeners.domains.length||this._listeners.entities.length?(0,o.qy)(b||(b=g` <p> ${0} </p> <ul> ${0} ${0} </ul> `),this.hass.localize("ui.dialogs.helper_settings.template.listeners"),this._listeners.domains.sort().map(e=>(0,o.qy)(v||(v=g` <li> <b>${0}</b>: ${0} </li> `),this.hass.localize("ui.dialogs.helper_settings.template.domain"),e)),this._listeners.entities.sort().map(e=>(0,o.qy)(y||(y=g` <li> <b>${0}</b>: ${0} </li> `),this.hass.localize("ui.dialogs.helper_settings.template.entity"),e))):this._listeners.time?o.s6:(0,o.qy)(f||(f=g`<p class="all_listeners"> ${0} </p>`),this.hass.localize("ui.dialogs.helper_settings.template.no_listeners")):o.s6)}async _subscribePreview(){if(this._unsub&&((await this._unsub)(),this._unsub=void 0),"config_flow"===this.flowType||"options_flow"===this.flowType)try{this._unsub=(0,n.H)(this.hass,this.flowId,this.flowType,this.stepData,this._setPreview),await this._unsub,(0,h.r)(this,"set-flow-errors",{errors:{}})}catch(e){"string"==typeof e.message?this._error=e.message:(this._error=void 0,(0,h.r)(this,"set-flow-errors",e.message)),this._unsub=void 0,this._preview=void 0}}constructor(...e){super(...e),this._setPreview=e=>{if("error"in e)return this._error=e.error,void(this._preview=void 0);this._error=void 0,this._listeners=e.listeners;const t=(new Date).toISOString();this._preview={entity_id:`${this.stepId}.___flow_preview___`,last_changed:t,last_updated:t,context:{id:"",parent_id:null,user_id:null},attributes:e.attributes,state:e.state}},this._debouncedSubscribePreview=(0,l.s)(()=>{this._subscribePreview()},250)}}(0,r.__decorate)([(0,a.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,r.__decorate)([(0,a.MZ)({attribute:!1})],m.prototype,"flowType",void 0),(0,r.__decorate)([(0,a.MZ)({attribute:!1})],m.prototype,"stepId",void 0),(0,r.__decorate)([(0,a.MZ)({attribute:!1})],m.prototype,"flowId",void 0),(0,r.__decorate)([(0,a.MZ)({attribute:!1})],m.prototype,"stepData",void 0),(0,r.__decorate)([(0,a.wk)()],m.prototype,"_preview",void 0),(0,r.__decorate)([(0,a.wk)()],m.prototype,"_listeners",void 0),(0,r.__decorate)([(0,a.wk)()],m.prototype,"_error",void 0),m=(0,r.__decorate)([(0,a.EM)("flow-preview-template")],m),i()}catch(d){i(d)}})}}]);
//# sourceMappingURL=9346.5eb647ebd8e94b61.js.map