export const __rspack_esm_id="84813";export const __rspack_esm_ids=["84813"];export const __webpack_modules__={72828(e,t,s){s.a(e,async function(e,i){try{s.r(t),s.d(t,{FlowPreviewGeneric:()=>u});var r=s(62826),o=s(96196),_=s(44457),a=s(51840),n=s(7986),p=s(9899),h=s(1087),d=(s(38962),e([n]));n=(d.then?(await d)():d)[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>`}async _subscribePreview(){if(this._unsub&&((await this._unsub)(),this._unsub=void 0),"config_flow"===this.flowType||"options_flow"===this.flowType||"config_subentries_flow"===this.flowType){this._error=void 0;try{this._unsub=(0,a.Q)(this.hass,this.domain,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(e.error)return this._error=e.error,void(this._preview=void 0);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},...e}},this._debouncedSubscribePreview=(0,p.s)(()=>{this._subscribePreview()},250)}}(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"flowType",void 0),(0,r.Cg)([(0,_.MZ)()],u.prototype,"domain",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"stepId",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"flowId",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"stepData",void 0),(0,r.Cg)([(0,_.wk)()],u.prototype,"_preview",void 0),(0,r.Cg)([(0,_.wk)()],u.prototype,"_error",void 0),u=(0,r.Cg)([(0,_.EM)("flow-preview-generic")],u),i()}catch(e){i(e)}})}};
//# sourceMappingURL=84813.a0e5e0a3ad55e503.js.map