(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["14558"],{34370:function(i,a,e){var t=e(51613).default;e(18111),e(7588),e(52811),e(1480),e(94003),e(26099),e(23500),i.exports=function i(a){return Object.freeze(a),Object.getOwnPropertyNames(a).forEach(function(e){!a.hasOwnProperty(e)||null===a[e]||"object"!==t(a[e])&&"function"!=typeof a[e]||Object.isFrozen(a[e])||i(a[e])}),a}},69293:function(i,a,e){"use strict";e.a(i,async function(i,t){try{e.r(a),e.d(a,{HuiDialogSuggestBadge:function(){return E}});var s,n,o,r,l,h,c=e(61397),d=e(50264),g=e(72153),u=e(44734),f=e(43080),p=e(69683),v=e(6454),m=(e(28706),e(62062),e(18111),e(61701),e(94003),e(26099),e(40445)),_=e(34370),y=e.n(_),b=e(96196),C=e(77845),w=e(1087),A=e(10763),k=e(18350),x=e(14503),z=e(92255),j=e(43908),O=e(82360),P=e(75196),D=i([A,k,j]);[A,k,j]=D.then?(await D)():D;var E=function(i){function a(){var i;(0,u.A)(this,a);for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return(i=(0,p.A)(this,a,[].concat(t)))._saving=!1,i}return(0,v.A)(a,i),(0,f.A)(a,[{key:"showDialog",value:function(i){this._params=i,this._badgeConfig=i.badgeConfig,Object.isFrozen(this._badgeConfig)||(this._badgeConfig=y()(this._badgeConfig)),this._yamlEditor&&this._yamlEditor.setValue(this._badgeConfig)}},{key:"closeDialog",value:function(){this._params=void 0,this._badgeConfig=void 0,(0,w.r)(this,"dialog-closed",{dialog:this.localName})}},{key:"_renderPreview",value:function(){var i=this;return this._badgeConfig?(0,b.qy)(s||(s=(0,g.A)([' <div class="element-preview"> '," </div> "])),this._badgeConfig.map(function(a){return(0,b.qy)(n||(n=(0,g.A)([' <hui-badge .hass="','" .config="','" preview></hui-badge> '])),i.hass,a)})):b.s6}},{key:"render",value:function(){return this._params?(0,b.qy)(o||(o=(0,g.A)([' <ha-dialog open scrimClickAction @closed="','" .heading="','"> <div> '," ",' </div> <ha-button appearance="plain" slot="primaryAction" @click="','" dialogInitialFocus> '," </ha-button> "," </ha-dialog> "])),this.closeDialog,this.hass.localize("ui.panel.lovelace.editor.suggest_badge.header"),this._renderPreview(),this._params.yaml&&this._badgeConfig?(0,b.qy)(r||(r=(0,g.A)([' <div class="editor"> <ha-yaml-editor .hass="','" .defaultValue="','"></ha-yaml-editor> </div> '])),this.hass,this._badgeConfig):b.s6,this.closeDialog,this._params.yaml?this.hass.localize("ui.common.close"):this.hass.localize("ui.common.cancel"),this._params.yaml?b.s6:(0,b.qy)(l||(l=(0,g.A)([' <ha-button slot="primaryAction" @click="','" .loading="','"> '," </ha-button> "])),this._save,this._saving,this.hass.localize("ui.panel.lovelace.editor.suggest_badge.add"))):b.s6}},{key:"_computeNewConfig",value:function(i,a){var e=(0,P.$P)(a).viewIndex,t=this._badgeConfig;return(0,O.En)(i,[e],t)}},{key:"_save",value:(e=(0,d.A)((0,c.A)().m(function i(){var a,e,t,s;return(0,c.A)().w(function(i){for(;;)switch(i.n){case 0:if(null!==(a=this._params)&&void 0!==a&&a.lovelaceConfig&&null!==(e=this._params)&&void 0!==e&&e.path&&null!==(t=this._params)&&void 0!==t&&t.saveConfig&&this._badgeConfig){i.n=1;break}return i.a(2);case 1:return this._saving=!0,s=this._computeNewConfig(this._params.lovelaceConfig,this._params.path),i.n=2,this._params.saveConfig(s);case 2:this._saving=!1,(0,z.f)(this,this.hass),this.closeDialog();case 3:return i.a(2)}},i,this)})),function(){return e.apply(this,arguments)})}],[{key:"styles",get:function(){return[x.nA,(0,b.AH)(h||(h=(0,g.A)(["@media all and (max-width:450px),all and (max-height:500px){ha-dialog{max-height:100%;height:100%}}@media all and (min-width:850px){ha-dialog{width:845px}}ha-dialog{max-width:845px;--dialog-z-index:6}.hidden{display:none}.element-preview{position:relative;display:flex;align-items:flex-start;flex-wrap:wrap;justify-content:center;gap:var(--ha-space-2);margin:0}.editor{padding-top:16px}"])))]}}]);var e}(b.WF);(0,m.Cg)([(0,C.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,m.Cg)([(0,C.wk)()],E.prototype,"_params",void 0),(0,m.Cg)([(0,C.wk)()],E.prototype,"_badgeConfig",void 0),(0,m.Cg)([(0,C.wk)()],E.prototype,"_saving",void 0),(0,m.Cg)([(0,C.P)("ha-yaml-editor")],E.prototype,"_yamlEditor",void 0),E=(0,m.Cg)([(0,C.EM)("hui-dialog-suggest-badge")],E),t()}catch(F){t(F)}})},92255:function(i,a,e){"use strict";e.d(a,{f:function(){return s}});var t=e(81619),s=function(i,a){return(0,t.P)(i,{message:a.localize("ui.common.successfully_saved")})}},94003:function(i,a,e){"use strict";var t=e(46518),s=e(79039),n=e(20034),o=e(44576),r=e(15652),l=Object.isFrozen;t({target:"Object",stat:!0,forced:r||s(function(){l(1)})},{isFrozen:function(i){return!n(i)||(!(!r||"ArrayBuffer"!==o(i))||!!l&&l(i))}})}}]);
//# sourceMappingURL=14558.24e32e706f25937a.js.map