export const __rspack_esm_id="29160";export const __rspack_esm_ids=["29160"];export const __webpack_modules__={84334(e,t,s){s.d(t,{H:()=>r,R:()=>i});const i=(e,t,s)=>e.subscribeMessage(e=>t(e),{type:"render_template",...s}),r=(e,t,s,i,r)=>e.connection.subscribeMessage(r,{type:"template/start_preview",flow_id:t,flow_type:s,user_input:i})},36315(e,t,s){s.a(e,async function(e,i){try{s.r(t);s(18111),s(61701);var r=s(62826),o=s(96196),l=s(44457),a=s(9899),n=s(84334),_=s(7986),p=s(1087),h=(s(38962),e([_]));_=(h.then?(await h)():h)[0];class u 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(){return this._error?o.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:o.qy`<entity-preview-row .hass="${this.hass}" .stateObj="${this._preview}"></entity-preview-row> ${this._listeners?.time?o.qy` <p> ${this.hass.localize("ui.dialogs.helper_settings.template.time")} </p> `:o.s6} ${this._listeners?this._listeners.all?o.qy` <p class="all_listeners"> ${this.hass.localize("ui.dialogs.helper_settings.template.all_listeners")} </p> `:this._listeners.domains.length||this._listeners.entities.length?o.qy` <p> ${this.hass.localize("ui.dialogs.helper_settings.template.listeners")} </p> <ul> ${this._listeners.domains.sort().map(e=>o.qy` <li> <b>${this.hass.localize("ui.dialogs.helper_settings.template.domain")}</b>: ${e} </li> `)} ${this._listeners.entities.sort().map(e=>o.qy` <li> <b>${this.hass.localize("ui.dialogs.helper_settings.template.entity")}</b>: ${e} </li> `)} </ul> `:this._listeners.time?o.s6:o.qy`<p class="all_listeners"> ${this.hass.localize("ui.dialogs.helper_settings.template.no_listeners")} </p>`: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,p.r)(this,"set-flow-errors",{errors:{}})}catch(e){"string"==typeof e.message?this._error=e.message:(this._error=void 0,(0,p.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,a.s)(()=>{this._subscribePreview()},250)}}(0,r.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,r.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"flowType",void 0),(0,r.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"stepId",void 0),(0,r.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"flowId",void 0),(0,r.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"stepData",void 0),(0,r.Cg)([(0,l.wk)()],u.prototype,"_preview",void 0),(0,r.Cg)([(0,l.wk)()],u.prototype,"_listeners",void 0),(0,r.Cg)([(0,l.wk)()],u.prototype,"_error",void 0),u=(0,r.Cg)([(0,l.EM)("flow-preview-template")],u),i()}catch(e){i(e)}})}};
//# sourceMappingURL=29160.0a2be71a32068ffe.js.map