"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["84813"],{72828:function(e,t,r){r.a(e,async function(e,i){try{r.r(t),r.d(t,{FlowPreviewGeneric:function(){return C}});var s,n,o=r(61397),a=r(50264),u=r(72153),h=r(44734),c=r(43080),p=r(69683),_=r(6454),v=r(25460),w=(r(28706),r(69085),r(40445)),d=r(96196),f=r(77845),l=r(51840),b=r(7986),y=r(9899),g=r(1087),k=(r(38962),e([b]));b=(k.then?(await k)():k)[0];var C=function(e){function t(){var e;(0,h.A)(this,t);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return(e=(0,p.A)(this,t,[].concat(i)))._setPreview=function(t){if(t.error)return e._error=t.error,void(e._preview=void 0);var r=(new Date).toISOString();e._preview=Object.assign({entity_id:"".concat(e.stepId,".___flow_preview___"),last_changed:r,last_updated:r,context:{id:"",parent_id:null,user_id:null}},t)},e._debouncedSubscribePreview=(0,y.s)(function(){e._subscribePreview()},250),e}return(0,_.A)(t,e),(0,c.A)(t,[{key:"disconnectedCallback",value:function(){(0,v.A)(t,"disconnectedCallback",this,3)([]),this._unsub&&(this._unsub.then(function(e){return e()}),this._unsub=void 0)}},{key:"willUpdate",value:function(e){e.has("stepData")&&this._debouncedSubscribePreview()}},{key:"render",value:function(){return this._error?(0,d.qy)(s||(s=(0,u.A)(['<ha-alert alert-type="error">',"</ha-alert>"])),this._error):(0,d.qy)(n||(n=(0,u.A)(['<entity-preview-row .hass="','" .stateObj="','"></entity-preview-row>'])),this.hass,this._preview)}},{key:"_subscribePreview",value:(r=(0,a.A)((0,o.A)().m(function e(){var t;return(0,o.A)().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this._unsub){e.n=2;break}return e.n=1,this._unsub;case 1:(0,e.v)(),this._unsub=void 0;case 2:if("config_flow"===this.flowType||"options_flow"===this.flowType||"config_subentries_flow"===this.flowType){e.n=3;break}return e.a(2);case 3:return this._error=void 0,e.p=4,this._unsub=(0,l.Q)(this.hass,this.domain,this.flowId,this.flowType,this.stepData,this._setPreview),e.n=5,this._unsub;case 5:(0,g.r)(this,"set-flow-errors",{errors:{}}),e.n=7;break;case 6:e.p=6,"string"==typeof(t=e.v).message?this._error=t.message:(this._error=void 0,(0,g.r)(this,"set-flow-errors",t.message)),this._unsub=void 0,this._preview=void 0;case 7:return e.a(2)}},e,this,[[4,6]])})),function(){return r.apply(this,arguments)})}]);var r}(d.WF);(0,w.Cg)([(0,f.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,w.Cg)([(0,f.MZ)({attribute:!1})],C.prototype,"flowType",void 0),(0,w.Cg)([(0,f.MZ)()],C.prototype,"domain",void 0),(0,w.Cg)([(0,f.MZ)({attribute:!1})],C.prototype,"stepId",void 0),(0,w.Cg)([(0,f.MZ)({attribute:!1})],C.prototype,"flowId",void 0),(0,w.Cg)([(0,f.MZ)({attribute:!1})],C.prototype,"stepData",void 0),(0,w.Cg)([(0,f.wk)()],C.prototype,"_preview",void 0),(0,w.Cg)([(0,f.wk)()],C.prototype,"_error",void 0),C=(0,w.Cg)([(0,f.EM)("flow-preview-generic")],C),i()}catch(A){i(A)}})}}]);
//# sourceMappingURL=84813.c29fb873d024ec20.js.map