iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
17 lines • 45.3 kB
JavaScript
/*! For license information please see 91863.f4b5dc84696ef926.js.LICENSE.txt */
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[91863],{1054:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701),i(62953);var o=i(40445),s=i(5124),a=i(67576),r=i(89784),n=i(1087),l=i(63004),d=i(76760),h=(i(405),i(26300)),c=t([h]);h=(c.then?(await c)():c)[0];let u,p,g,v,m,_=t=>t;const y="M13,3A9,9 0 0,0 4,12H1L4.89,15.89L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3Z";class b extends s.WF{willUpdate(t){t.has("value")&&(this._localValue=this.value)}render(){var t,e,i,o,a,n,l,d,h,c;const m="auto"===(null===(t=this._localValue)||void 0===t?void 0:t.rows),b="full"===(null===(e=this._localValue)||void 0===e?void 0:e.columns),f=b||void 0!==this.columnMin&&this.columnMin===this.columnMax,w=m||void 0!==this.rowMin&&this.rowMin===this.rowMax,C=null!==(i=this.rowMin)&&void 0!==i?i:1,x=null!==(o=this.rowMax)&&void 0!==o?o:this.rows,$=Math.ceil((null!==(a=this.columnMin)&&void 0!==a?a:1)/this.step)*this.step,M=Math.ceil((null!==(n=this.columnMax)&&void 0!==n?n:this.columns)/this.step)*this.step,E=m?C:null===(l=this._localValue)||void 0===l?void 0:l.rows,k=null===(d=this._localValue)||void 0===d?void 0:d.columns;return(0,s.qy)(u||(u=_` <div class="grid"> <ha-grid-layout-slider aria-label="${0}" id="columns" .min="${0}" .max="${0}" .range="${0}" .value="${0}" .step="${0}" -changed="${0}" -moved="${0}" .disabled="${0}" tooltip-mode="${0}"></ha-grid-layout-slider> <ha-grid-layout-slider aria-label="${0}" id="rows" .min="${0}" .max="${0}" .range="${0}" vertical .value="${0}" -changed="${0}" -moved="${0}" .disabled="${0}" tooltip-mode="${0}"></ha-grid-layout-slider> ${0} <div class="preview"> <table> ${0} </table> <div class="preview-card" style="${0}"></div> </div> </div> `),this.hass.localize("ui.components.grid-size-picker.columns"),$,M,this.columns,b?this.columns:null===(h=this.value)||void 0===h?void 0:h.columns,this.step,this._valueChanged,this._sliderMoved,f,f?"never":"always",this.hass.localize("ui.components.grid-size-picker.rows"),C,x,this.rows,m?C:null===(c=this.value)||void 0===c?void 0:c.rows,this._valueChanged,this._sliderMoved,w,w?"never":"always",this.isDefault?s.s6:(0,s.qy)(p||(p=_` <ha-icon-button ="${0}" class="reset" .path="${0}" label="${0}" title="${0}"> </ha-icon-button> `),this._reset,y,this.hass.localize("ui.components.grid-size-picker.reset_default"),this.hass.localize("ui.components.grid-size-picker.reset_default")),Array(this.rows).fill(0).map((t,e)=>{const i=e+1;return(0,s.qy)(g||(g=_` <tr> ${0} </tr> `),Array(this.columns).fill(0).map((t,e)=>{const o=e+1;return o%this.step!==0||this.columns>24&&o%3!=0?s.s6:(0,s.qy)(v||(v=_` <td data-row="${0}" data-column="${0}" ="${0}"></td> `),i,o,this._cellClick)}))}),(0,r.W)({"--rows":E,"--columns":b?this.columns:k,"--total-columns":this.columns}))}_cellClick(t){var e;const i=t.currentTarget,o=Number(i.getAttribute("data-row")),s=Number(i.getAttribute("data-column")),a=(0,l.O)(o,this.rowMin,this.rowMax);let r=(0,l.O)(s,this.columnMin,this.columnMax);"full"===(null!==(e=this.value)&&void 0!==e?e:d.bF).columns&&r===this.columns&&(r="full"),(0,n.r)(this,"value-changed",{value:{rows:a,columns:r}})}_valueChanged(t){var e;t.stopPropagation();const i=t.currentTarget.id,o=null!==(e=this.value)&&void 0!==e?e:d.bF;let s=t.detail.value;"columns"===i&&"full"===o.columns&&s===this.columns&&(s="full");const a=Object.assign(Object.assign({},o),{},{[i]:s});(0,n.r)(this,"value-changed",{value:a})}_reset(t){t.stopPropagation(),(0,n.r)(this,"value-changed",{value:{rows:void 0,columns:void 0}})}_sliderMoved(t){var e;t.stopPropagation();const i=t.currentTarget.id,o=null!==(e=this.value)&&void 0!==e?e:d.bF;void 0!==t.detail.value&&(this._localValue=Object.assign(Object.assign({},o),{},{[i]:t.detail.value}))}constructor(...t){super(...t),this.rows=8,this.columns=12,this.step=1,this._localValue={rows:1,columns:1}}}b.styles=[(0,s.AH)(m||(m=_`.grid{display:grid;grid-template-areas:"reset column-slider" "row-slider preview";grid-template-rows:auto auto;grid-template-columns:auto 1fr;gap:var(--ha-space-2)}#columns{grid-area:column-slider}#rows{grid-area:row-slider}.reset{grid-area:reset;--ha-icon-button-size:36px}.preview{position:relative;grid-area:preview}.preview table,.preview td,.preview tr{border:2px dotted var(--divider-color);border-collapse:collapse}.preview table{width:100%}.preview tr{height:30px}.preview td{cursor:pointer}.preview-card{position:absolute;top:0;left:0;background-color:var(--primary-color);opacity:.3;border-radius:var(--ha-border-radius-md);height:calc(var(--rows,1) * 30px);width:calc(var(--columns,1) * 100% / var(--total-columns,12));pointer-events:none;transition:width ease-in-out 180ms,height ease-in-out 180ms}`))],(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"value",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"rows",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"columns",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"rowMin",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"rowMax",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"columnMin",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"columnMax",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"isDefault",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"step",void 0),(0,o.Cg)([(0,a.wk)()],b.prototype,"_localValue",void 0),b=(0,o.Cg)([(0,a.EM)("ha-grid-size-picker")],b),e()}catch(u){e(u)}})},62647:function(t,e,i){var o=i(40445),s=i(9866),a=i(5124),r=i(67576);let n,l=t=>t;class d extends s.A{static get styles(){return[s.A.styles,(0,a.AH)(n||(n=l`:host{font-size:var(--ha-font-size-m);--wa-color-brand-on-quiet:var(
--ha-tab-active-text-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--wa-color-brand-on-quiet);opacity:.8;color:inherit;--wa-space-l:16px}:host([active]:not([disabled])){opacity:1} (hover:hover){:host(:hover:not([disabled]):not([active])) .tab{color:var(--wa-color-brand-on-quiet)}}`))]}}d=(0,o.Cg)([(0,r.EM)("ha-tab-group-tab")],d)},66289:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),s=i(42814),a=i(5124),r=i(67576),n=i(36356),l=t([s]);s=(l.then?(await l)():l)[0];let d,h=t=>t;class c extends s.A{connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeyDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeyDown,!0)}handleClick(t){this._dragScrollController.scrolled||super.handleClick(t)}static get styles(){return[s.A.styles,(0,a.AH)(d||(d=h`:host{--track-width:2px;--track-color:var(--ha-tab-track-color, var(--divider-color));--indicator-color:var(
--ha-tab-indicator-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--indicator-color)}.tab-group-top ::slotted(ha-tab-group-tab[active]){border-block-end:solid var(--track-width) var(--indicator-color);margin-block-end:calc(-1 * var(--track-width))}.tab-group-start ::slotted(ha-tab-group-tab[active]){border-inline-end:solid var(--track-width) var(--indicator-color);margin-inline-end:calc(-1 * var(--track-width))}.tab-group-end ::slotted(ha-tab-group-tab[active]){border-inline-start:solid var(--track-width) var(--indicator-color);margin-inline-start:calc(-1 * var(--track-width))}.scroll-button::part(base):hover{background-color:transparent}`))]}constructor(...t){super(...t),this._dragScrollController=new n.q(this,{selector:".nav"}),this.tabTag="ha-tab-group-tab",this.tabOnly=!0,this._handleKeyDown=t=>{(t.altKey||t.metaKey)&&t.stopPropagation()}}}(0,o.Cg)([(0,r.MZ)({attribute:"tab-tag"})],c.prototype,"tabTag",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"tab-only",type:Boolean})],c.prototype,"tabOnly",void 0),c=(0,o.Cg)([(0,r.EM)("ha-tab-group")],c),e()}catch(d){e(d)}})},83892:function(t,e,i){i.d(e,{x:function(){return v}});i(18111),i(13579),i(27495),i(42762),i(62953);var o=i(40445),s=i(92070),a=i(5124),r=i(67576);let n,l,d,h,c,u,p,g=t=>t;class v extends a.WF{_onSlotChange(t){return e=>{const i=e.target.assignedNodes({flatten:!0}).some(t=>{var e;return t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&""!==(null===(e=t.textContent)||void 0===e?void 0:e.trim())});"start"===t?this._hasStart=i:this._hasEnd=i}}render(){return this._renderBase(this._renderInner())}_renderBase(t){return(0,a.qy)(n||(n=g`<div part="base" class="base" id="item">${0}</div>`),t)}_renderInner(){const t=this._slotController.test("content");return(0,a.qy)(l||(l=g` <div part="start" class="start" ?hidden="${0}"> <slot name="start" ="${0}"></slot> </div> <div part="content" class="content"> ${0} </div> <div part="end" class="end" ?hidden="${0}"> <slot name="end" ="${0}"></slot> </div> `),!this._hasStart,this._onSlotChange("start"),t?(0,a.qy)(d||(d=g`<slot name="content"></slot>`)):this._renderDefaultContent(),!this._hasEnd,this._onSlotChange("end"))}_renderDefaultContent(){var t,e;const i=this._slotController.test("headline"),o=this._slotController.test("supporting-text"),s=i||void 0!==this.headline,r=o||void 0!==this.supportingText;return(0,a.qy)(h||(h=g` ${0} ${0} `),s?(0,a.qy)(c||(c=g`<div part="headline" class="headline"> <slot name="headline">${0}</slot> </div>`),null!==(t=this.headline)&&void 0!==t?t:a.s6):a.s6,r?(0,a.qy)(u||(u=g`<div part="supporting-text" class="supporting"> <slot name="supporting-text">${0}</slot> </div>`),null!==(e=this.supportingText)&&void 0!==e?e:a.s6):a.s6)}constructor(...t){super(...t),this.disabled=!1,this._slotController=new s.X(this,"headline","supporting-text","content"),this._hasStart=!1,this._hasEnd=!1}}v.styles=(0,a.AH)(p||(p=g`:host{display:block;color:var(--primary-text-color);font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal)}:host([disabled]){color:var(--disabled-text-color);pointer-events:none}.base{position:relative;display:flex;flex-direction:row;align-items:center;gap:var(--ha-row-item-gap,var(--ha-space-4));padding-block:var(--ha-row-item-padding-block,var(--ha-space-3));padding-inline:var(--ha-row-item-padding-inline,var(--ha-space-4));min-height:var(--ha-row-item-min-height,48px);box-sizing:border-box}.content{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;justify-content:center}.end,.start{display:flex;align-items:center;flex:0 0 auto}.end[hidden],.start[hidden]{display:none}.headline{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.supporting{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`)),(0,o.Cg)([(0,r.MZ)({type:String})],v.prototype,"headline",void 0),(0,o.Cg)([(0,r.MZ)({type:String,attribute:"supporting-text"})],v.prototype,"supportingText",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],v.prototype,"disabled",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_hasStart",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_hasEnd",void 0),v=(0,o.Cg)([(0,r.EM)("ha-row-item")],v)},405:function(t,e,i){i(18111),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var o=i(40445),s=i(26183),a=i(5124),r=i(67576),n=i(6412),l=i(89784),d=i(1087);let h,c,u,p,g,v=t=>t;const m=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","PageUp","PageDown","Home","End"]);class _ extends a.WF{get _range(){var t;return null!==(t=this.range)&&void 0!==t?t:this.max}_valueToPercentage(t){return this._boundedValue(t)/this._range}_percentageToValue(t){return this._range*t}_steppedValue(t){return Math.round(t/this.step)*this.step}_boundedValue(t){return Math.min(Math.max(t,this.min),this.max)}firstUpdated(t){super.firstUpdated(t),this.setupListeners(),this.setAttribute("role","slider"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}updated(t){if(super.updated(t),t.has("value")){var e;const t=this._steppedValue(null!==(e=this.value)&&void 0!==e?e:0);this.setAttribute("aria-valuenow",t.toString()),this.setAttribute("aria-valuetext",t.toString())}if(t.has("min")&&this.setAttribute("aria-valuemin",this.min.toString()),t.has("max")&&this.setAttribute("aria-valuemax",this.max.toString()),t.has("vertical")){const t=this.vertical?"vertical":"horizontal";this.setAttribute("aria-orientation",t)}}connectedCallback(){super.connectedCallback(),this.setupListeners()}disconnectedCallback(){super.disconnectedCallback(),this.destroyListeners()}setupListeners(){if(this.slider&&!this._mc){var t;let e;this._mc=new s.mS(this.slider,{touchAction:null!==(t=this.touchAction)&&void 0!==t?t:this.vertical?"pan-x":"pan-y"}),this._mc.add(new s.uq({threshold:10,direction:s.ge,enable:!0})),this._mc.add(new s.Cx({event:"singletap"})),this._mc.on("panstart",()=>{this.disabled||(this.pressed=!0,this._showTooltip(),e=this.value)}),this._mc.on("pancancel",()=>{this.disabled||(this.pressed=!1,this._hideTooltip(),this.value=e)}),this._mc.on("panmove",t=>{if(this.disabled)return;const e=this._getPercentageFromEvent(t);this.value=this._percentageToValue(e);const i=this._steppedValue(this._boundedValue(this.value));(0,d.r)(this,"slider-moved",{value:i})}),this._mc.on("panend",t=>{if(this.disabled)return;this.pressed=!1,this._hideTooltip();const e=this._getPercentageFromEvent(t),i=this._percentageToValue(e);this.value=this._steppedValue(this._boundedValue(i)),(0,d.r)(this,"slider-moved",{value:void 0}),(0,d.r)(this,"value-changed",{value:this.value})}),this._mc.on("singletap",t=>{if(this.disabled)return;const e=this._getPercentageFromEvent(t),i=this._percentageToValue(e);this.value=this._steppedValue(this._boundedValue(i)),(0,d.r)(this,"value-changed",{value:this.value})}),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("keyup",this._handleKeyUp)}}destroyListeners(){this._mc&&(this._mc.destroy(),this._mc=void 0),this.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("keyup",this._handleKeyUp)}get _tenPercentStep(){return Math.max(this.step,(this.max-this.min)/10)}_handleKeyDown(t){var e,i,o,s;if(m.has(t.code)){switch(t.preventDefault(),t.code){case"ArrowRight":case"ArrowUp":this.value=this._boundedValue((null!==(e=this.value)&&void 0!==e?e:0)+this.step);break;case"ArrowLeft":case"ArrowDown":this.value=this._boundedValue((null!==(i=this.value)&&void 0!==i?i:0)-this.step);break;case"PageUp":this.value=this._steppedValue(this._boundedValue((null!==(o=this.value)&&void 0!==o?o:0)+this._tenPercentStep));break;case"PageDown":this.value=this._steppedValue(this._boundedValue((null!==(s=this.value)&&void 0!==s?s:0)-this._tenPercentStep));break;case"Home":this.value=this.min;break;case"End":this.value=this.max}(0,d.r)(this,"slider-moved",{value:this.value})}}_handleKeyUp(t){m.has(t.code)&&(t.preventDefault(),(0,d.r)(this,"value-changed",{value:this.value}))}_showTooltip(){null!=this._tooltipTimeout&&window.clearTimeout(this._tooltipTimeout),this.tooltipVisible=!0}_hideTooltip(t){t?this._tooltipTimeout=window.setTimeout(()=>{this.tooltipVisible=!1},t):this.tooltipVisible=!1}_renderTooltip(){var t;if("never"===this.tooltipMode)return a.s6;const e=this.vertical?"left":"top",i="always"===this.tooltipMode||this.tooltipVisible&&"interaction"===this.tooltipMode,o=this._boundedValue(this._steppedValue(null!==(t=this.value)&&void 0!==t?t:0));return(0,a.qy)(h||(h=v` <span aria-hidden="true" class="tooltip ${0}"> ${0} </span> `),(0,n.H)({visible:i,[e]:!0}),o)}render(){var t;return(0,a.qy)(c||(c=v` <div class="container${0}" style="${0}"> <div id="slider" class="slider"> <div class="track"> <div class="background"></div> <div class="active" style="${0}"></div> </div> ${0} ${0} ${0} </div> </div> `),(0,n.H)({pressed:this.pressed}),(0,l.W)({"--value":`${this._valueToPercentage(null!==(t=this.value)&&void 0!==t?t:0)}`}),(0,l.W)({"--min":""+this.min/this._range,"--max":""+(1-this.max/this._range)}),Array(this._range/this.step).fill(0).map((t,e)=>{const i=e/(this._range/this.step);return this.min>=e*this.step||e*this.step>this.max?a.s6:(0,a.qy)(u||(u=v` <div class="dot" style="${0}"></div> `),(0,l.W)({"--value":`${i}`}))}),void 0!==this.value?(0,a.qy)(p||(p=v`<div class="handle"></div>`)):a.s6,this._renderTooltip())}constructor(...t){super(...t),this.disabled=!1,this.vertical=!1,this.tooltipMode="interaction",this.step=1,this.min=1,this.max=4,this.pressed=!1,this.tooltipVisible=!1,this._getPercentageFromEvent=t=>{if(this.vertical){const e=t.center.y,i=t.target.getBoundingClientRect().top,o=t.target.clientHeight;return Math.max(Math.min(1,(e-i)/o),0)}const e=t.center.x,i=t.target.getBoundingClientRect().left,o=t.target.clientWidth;return Math.max(Math.min(1,(e-i)/o),0)}}}_.styles=(0,a.AH)(g||(g=v`:host{display:block;--grid-layout-slider:36px;height:var(--grid-layout-slider);width:100%;outline:0;transition:box-shadow 180ms ease-in-out}:host(:focus-visible){box-shadow:0 0 0 2px var(--primary-color)}:host([vertical]){width:var(--grid-layout-slider);height:100%}.container{position:relative;height:100%;width:100%}.slider{position:relative;height:100%;width:100%;transform:translateZ(0);overflow:visible;cursor:pointer}.slider *{pointer-events:none;user-select:none}.track{position:absolute;inset:0;margin:auto;height:16px;width:100%;border-radius:var(--ha-border-radius-md);overflow:hidden}:host([vertical]) .track{width:16px;height:100%}.background{position:absolute;inset:0;background:var(--disabled-color);opacity:.4}.active{position:absolute;background:var(--primary-color);top:0;right:calc(var(--max) * 100%);bottom:0;left:calc(var(--min) * 100%)}:host([vertical]) .active{top:calc(var(--min) * 100%);right:0;bottom:calc(var(--max) * 100%);left:0}.handle{position:absolute;top:0;height:100%;width:16px;transform:translate(-50%,0);background:var(--card-background-color);left:calc(var(--value,0%) * 100%);transition:left 180ms ease-in-out,top 180ms ease-in-out}:host([vertical]) .handle{transform:translate(0,-50%);left:0;top:calc(var(--value,0%) * 100%);height:16px;width:100%}.dot{position:absolute;top:0;bottom:0;opacity:.6;margin:auto;width:4px;height:4px;flex-shrink:0;transform:translate(-50%,0);background:var(--card-background-color);left:calc(var(--value,0%) * 100%);border-radius:2px}:host([vertical]) .dot{transform:translate(0,-50%);left:0;right:0;bottom:inherit;top:calc(var(--value,0%) * 100%)}.handle::after{position:absolute;inset:0;width:4px;border-radius:2px;height:100%;margin:auto;background:var(--primary-color);content:""}:host([vertical]) .handle::after{height:4px;width:100%}:host([disabled]) .slider{cursor:not-allowed}:host([disabled]) .track{opacity:.5}:host([disabled]) .handle::after{background:var(--disabled-color)}:host([disabled]) .active{background:var(--disabled-color)}.tooltip{position:absolute;background-color:var(--clear-background-color);color:var(--primary-text-color);font-size:var(--control-slider-tooltip-font-size);border-radius:var(--ha-border-radius-lg);padding:.2em .4em;opacity:0;white-space:nowrap;box-shadow:0 2px 5px rgba(0,0,0,.2);transition:opacity 180ms ease-in-out,left 180ms ease-in-out,bottom 180ms ease-in-out;--handle-spacing:calc(2 * var(--handle-margin) + var(--handle-size));--slider-tooltip-margin:0px;--slider-tooltip-range:100%;--slider-tooltip-offset:0px;--slider-tooltip-position:calc(
min(
max(
var(--value) * var(--slider-tooltip-range) +
var(--slider-tooltip-offset),
0%
),
100%
)
)}.tooltip.start{--slider-tooltip-offset:calc(-0.5 * (var(--handle-spacing)))}.tooltip.end{--slider-tooltip-offset:calc(0.5 * (var(--handle-spacing)))}.tooltip.cursor{--slider-tooltip-range:calc(100% - var(--handle-spacing));--slider-tooltip-offset:calc(0.5 * (var(--handle-spacing)))}.tooltip.show-handle{--slider-tooltip-range:calc(100% - var(--handle-spacing));--slider-tooltip-offset:calc(0.5 * (var(--handle-spacing)))}.tooltip.visible{opacity:1}.tooltip.top{transform:translate3d(-50%,-100%,0);top:var(--slider-tooltip-margin);left:50%}.tooltip.bottom{transform:translate3d(-50%,100%,0);bottom:var(--slider-tooltip-margin);left:50%}.tooltip.left{transform:translate3d(-100%,-50%,0);top:50%;left:var(--slider-tooltip-margin)}.tooltip.right{transform:translate3d(100%,-50%,0);top:50%;right:var(--slider-tooltip-margin)}:host(:not([vertical])) .tooltip.bottom,:host(:not([vertical])) .tooltip.top{left:var(--slider-tooltip-position)}:host([vertical]) .tooltip.left,:host([vertical]) .tooltip.right{top:var(--slider-tooltip-position)}.pressed .handle{transition:none}.pressed .tooltip{transition:opacity 180ms ease-in-out}`)),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],_.prototype,"disabled",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],_.prototype,"vertical",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"touch-action"})],_.prototype,"touchAction",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"tooltip-mode"})],_.prototype,"tooltipMode",void 0),(0,o.Cg)([(0,r.MZ)({type:Number})],_.prototype,"value",void 0),(0,o.Cg)([(0,r.MZ)({type:Number})],_.prototype,"step",void 0),(0,o.Cg)([(0,r.MZ)({type:Number})],_.prototype,"min",void 0),(0,o.Cg)([(0,r.MZ)({type:Number})],_.prototype,"max",void 0),(0,o.Cg)([(0,r.MZ)({type:Number})],_.prototype,"range",void 0),(0,o.Cg)([(0,r.wk)()],_.prototype,"pressed",void 0),(0,o.Cg)([(0,r.wk)()],_.prototype,"tooltipVisible",void 0),(0,o.Cg)([(0,r.P)("#slider")],_.prototype,"slider",void 0),_=(0,o.Cg)([(0,r.EM)("ha-grid-layout-slider")],_)},97962:function(t,e,i){i.a(t,async function(t,e){try{i(44114),i(3362),i(62953);var o=i(40445),s=i(5124),a=i(67576),r=i(66289),n=(i(62647),i(42678)),l=i(8349),d=i(63277),h=i(9346),c=i(91828),u=t([r,h,c,d,l]);[r,h,c,d,l]=u.then?(await u)():u;let p,g,v,m,_,y,b=t=>t;const f=["config","visibility","layout"];class w extends d.U{async getConfigElement(){const t=await(0,l.dY)(this.configElementType);if(t&&t.getConfigElement)return t.getConfigElement()}async getConfigForm(){const t=await(0,l.dY)(this.configElementType);if(t&&t.getConfigForm)return t.getConfigForm()}_configChanged(t){t.stopPropagation(),this.value=t.detail.value}get _showLayoutTab(){return!!this.sectionConfig&&(void 0===this.sectionConfig.type||"grid"===this.sectionConfig.type)}renderConfigElement(){const t=["config"];if(this.showVisibilityTab&&t.push("visibility"),this._showLayoutTab&&t.push("layout"),1===t.length)return super.renderConfigElement();let e=s.s6;switch(this._currTab){case"config":e=(0,s.qy)(p||(p=b`${0}`),super.renderConfigElement());break;case"visibility":e=(0,s.qy)(g||(g=b` <hui-card-visibility-editor .hass="${0}" .config="${0}" .entityId="${0}" -changed="${0}"></hui-card-visibility-editor> `),this.hass,this.value,this.value?(0,n.r)(this.value):void 0,this._configChanged);break;case"layout":e=(0,s.qy)(v||(v=b` <hui-card-layout-editor .hass="${0}" .config="${0}" .sectionConfig="${0}" -changed="${0}"> </hui-card-layout-editor> `),this.hass,this.value,this.sectionConfig,this._configChanged)}return(0,s.qy)(m||(m=b` <ha-tab-group -tab-show="${0}"> ${0} </ha-tab-group> ${0} `),this._handleTabChanged,t.map(t=>(0,s.qy)(_||(_=b` <ha-tab-group-tab slot="nav" .active="${0}" panel="${0}"> ${0} </ha-tab-group-tab> `),this._currTab===t,t,this.hass.localize(`ui.panel.lovelace.editor.edit_card.tab_${t}`))),e)}_handleTabChanged(t){const e=t.detail.name;e!==this._currTab&&(this._currTab=e)}constructor(...t){super(...t),this.showVisibilityTab=!1,this._currTab=f[0]}}w.styles=[(0,s.AH)(y||(y=b`ha-tab-group{margin-bottom:16px}ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}`))],(0,o.Cg)([(0,a.MZ)({type:Boolean,attribute:"show-visibility-tab"})],w.prototype,"showVisibilityTab",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],w.prototype,"sectionConfig",void 0),(0,o.Cg)([(0,a.wk)()],w.prototype,"_currTab",void 0),w=(0,o.Cg)([(0,a.EM)("hui-card-element-editor")],w),e()}catch(p){e(p)}})},9346:function(t,e,i){i.a(t,async function(t,e){try{i(3362),i(62953);var o=i(40445),s=i(5124),a=i(67576),r=i(89784),n=i(22786),l=i(1087),d=i(38962),h=i(18350),c=i(29823),u=(i(70947),i(1054)),p=i(26300),g=(i(2846),i(70759)),v=(i(67094),i(59646)),m=i(10763),_=i(14503),y=i(76760),b=t([d,h,c,u,p,g,v,m]);[d,h,c,u,p,g,v,m]=b.then?(await b)():b;let f,w,C,x,$,M=t=>t;const E="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",k="M3 6V8H14V6H3M3 10V12H14V10H3M20 10.1C19.9 10.1 19.7 10.2 19.6 10.3L18.6 11.3L20.7 13.4L21.7 12.4C21.9 12.2 21.9 11.8 21.7 11.6L20.4 10.3C20.3 10.2 20.2 10.1 20 10.1M18.1 11.9L12 17.9V20H14.1L20.2 13.9L18.1 11.9M3 14V16H10V14H3Z";class A extends s.WF{render(){var t,e;const i=this._configGridOptions(this.config),o=this._mergedOptions(i,this._defaultGridOptions),a=o,n=this._computeCardGridSize(a),l=12*(null!==(t=this.sectionConfig.column_span)&&void 0!==t?t:1);return(0,s.qy)(f||(f=M` ${0} <div class="header"> <ha-dropdown slot="icons" -select="${0}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"> </ha-icon-button> <ha-dropdown-item value="toggle_yaml" .disabled="${0}"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> </div> ${0} `),this._defaultGridOptions&&0===Object.keys(this._defaultGridOptions).length?(0,s.qy)(w||(w=M` <ha-alert alert-type="info"> ${0} </ha-alert> `),this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.no_grid_support")):s.s6,this._handleAction,this.hass.localize("ui.common.menu"),E,!this._uiAvailable,this.hass.localize("ui.panel.lovelace.editor.edit_view.edit_"+(this._yamlMode?"ui":"yaml")),k,this._yamlMode?(0,s.qy)(C||(C=M` <ha-yaml-editor .defaultValue="${0}" -changed="${0}"></ha-yaml-editor> `),i,this._yamlChanged):(0,s.qy)(x||(x=M` <ha-grid-size-picker style="${0}" .columns="${0}" .hass="${0}" .value="${0}" .isDefault="${0}" -changed="${0}" .rowMin="${0}" .rowMax="${0}" .columnMin="${0}" .columnMax="${0}" .step="${0}"></ha-grid-size-picker> <ha-md-list-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> <ha-switch slot="end" ="${0}" .checked="${0}" name="auto-height"></ha-switch> </ha-md-list-item> <ha-md-list-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> <ha-switch slot="end" ="${0}" .checked="${0}" name="full-width"></ha-switch> </ha-md-list-item> <ha-md-list-item> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> <ha-switch slot="end" ="${0}" .checked="${0}" name="precise-mode"></ha-switch> </ha-md-list-item> `),(0,r.W)({"max-width":250*(null!==(e=this.sectionConfig.column_span)&&void 0!==e?e:1)+40+"px"}),l,this.hass,n,this._isDefault(i),this._gridSizeChanged,a.min_rows,a.max_rows,a.min_columns,a.max_columns,this._preciseMode?1:3,this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.auto_height"),this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.auto_height_helper"),this._autoHeightChanged,"auto"===o.rows,this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.full_width"),this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.full_width_helper"),this._fullWidthChanged,"full"===o.columns,this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.precise_mode"),this.hass.localize("ui.panel.lovelace.editor.edit_card.layout.precise_mode_helper"),this._preciseModeChanged,this._preciseMode))}firstUpdated(t){super.firstUpdated(t);try{this._cardElement=document.createElement("hui-card"),this._cardElement.hass=this.hass,this._cardElement.preview=!0,this._cardElement.config=this.config,this._cardElement.addEventListener("card-updated",t=>{t.stopPropagation(),this._updateDefaultGridOptions()}),this._cardElement.load(),this._updateDefaultGridOptions()}catch(e){console.error(e)}}_updateDefaultGridOptions(){this._cardElement?this._defaultGridOptions=this._cardElement.getElementGridOptions():this._defaultGridOptions=void 0}updated(t){super.updated(t),this._cardElement&&(t.has("hass")&&(this._cardElement.hass=this.hass),t.has("config")&&(this._cardElement.config=this.config))}willUpdate(t){if(super.willUpdate(t),t.has("config")){const t=this.config.grid_options;if(!t)return void(this._preciseMode=!!this._defaultGridOptions&&(0,y.Z8)(this._defaultGridOptions));const e=(0,y.Z8)(t);!this._preciseMode&&e&&(this._preciseMode=e)}}async _handleAction(t){"toggle_yaml"===t.detail.item.value&&(this._yamlMode=!this._yamlMode)}_gridSizeChanged(t){t.stopPropagation();const e=t.detail.value;this._updateGridOptions(Object.assign(Object.assign({},this.config.grid_options),{},{columns:e.columns,rows:e.rows}))}_yamlChanged(t){t.stopPropagation();const e=t.detail.value;this._updateGridOptions(e)}_fullWidthChanged(t){t.stopPropagation();const e=t.target.checked;let i;const o=Object.assign(Object.assign({},y.bF),this._defaultGridOptions);if(e)i="full";else if("full"===o.columns){var s,a;const t=12*(null!==(s=this.sectionConfig.column_span)&&void 0!==s?s:1);i=null!==(a=o.max_columns)&&void 0!==a?a:t}else i=void 0;this._updateGridOptions(Object.assign(Object.assign({},this.config.grid_options),{},{columns:i}))}_autoHeightChanged(t){t.stopPropagation();const e=t.target.checked;let i;const o=Object.assign(Object.assign({},y.bF),this._defaultGridOptions);if(e)i="auto";else if("auto"===o.rows){var s;i=null!==(s=o.min_rows)&&void 0!==s?s:1}else i=void 0;this._updateGridOptions(Object.assign(Object.assign({},this.config.grid_options),{},{rows:i}))}_preciseModeChanged(t){var e;if(t.stopPropagation(),this._preciseMode=t.target.checked,this._preciseMode)return;const i=null===(e=this.config.grid_options)||void 0===e?void 0:e.columns;if("number"==typeof i&&i%3!=0){const t=3*Math.ceil(i/3);this._updateGridOptions(Object.assign(Object.assign({},this.config.grid_options),{},{columns:t}))}}_updateGridOptions(t){const e=Object.assign(Object.assign({},this.config),{},{grid_options:Object.assign({},t)});if(e.grid_options){for(const[t,i]of Object.entries(e.grid_options))void 0===i&&delete e.grid_options[t];0===Object.keys(e.grid_options).length&&delete e.grid_options}e.layout_options&&delete e.layout_options,(0,l.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this._yamlMode=!1,this._uiAvailable=!0,this._preciseMode=!1,this._mergedOptions=(0,n.A)((t,e)=>Object.assign(Object.assign(Object.assign({},y.bF),e),t)),this._computeCardGridSize=(0,n.A)(y.Ns),this._isDefault=(0,n.A)(t=>void 0===(null==t?void 0:t.columns)&&void 0===(null==t?void 0:t.rows)),this._configGridOptions=t=>t.grid_options?t.grid_options:t.layout_options?(0,y.l6)(t.layout_options):{}}}A.styles=[_.RF,(0,s.AH)($||($=M`.header{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-end}.header ha-dropdown{--mdc-theme-text-primary-on-background:var(--primary-text-color);margin-top:-8px}.disabled{opacity:.5;pointer-events:none}ha-grid-size-picker{display:block;margin:16px auto;direction:ltr}ha-yaml-editor{display:block;margin:16px 0}`))],(0,o.Cg)([(0,a.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],A.prototype,"config",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],A.prototype,"sectionConfig",void 0),(0,o.Cg)([(0,a.wk)()],A.prototype,"_defaultGridOptions",void 0),(0,o.Cg)([(0,a.wk)()],A.prototype,"_yamlMode",void 0),(0,o.Cg)([(0,a.wk)()],A.prototype,"_uiAvailable",void 0),(0,o.Cg)([(0,a.wk)()],A.prototype,"_preciseMode",void 0),A=(0,o.Cg)([(0,a.EM)("hui-card-layout-editor")],A),e()}catch(f){e(f)}})},91828:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),s=i(35211),a=i(5124),r=i(67576),n=i(1087),l=i(82747),d=i(13898),h=i(30461),c=t([d,h]);[d,h]=c.then?(await c)():c;let u,p,g=t=>t;class v extends a.WF{willUpdate(t){t.has("entityId")&&this._contextProvider.setValue(this.entityId?{mode:"current",entityId:this.entityId}:void 0)}render(){var t;const e=null!==(t=this.config.visibility)&&void 0!==t?t:[];return(0,a.qy)(u||(u=g` <ha-visibility-status .hass="${0}" .conditions="${0}"></ha-visibility-status> <ha-card-conditions-editor .hass="${0}" .conditions="${0}" -changed="${0}"> </ha-card-conditions-editor> `),this.hass,e,this.hass,e,this._valueChanged)}_valueChanged(t){var e;t.stopPropagation();const i=t.detail.value,o=Object.assign(Object.assign({},this.config),{},{visibility:i});0===(null===(e=o.visibility)||void 0===e?void 0:e.length)&&delete o.visibility,(0,n.r)(this,"value-changed",{value:o})}constructor(...t){super(...t),this._contextProvider=new s.DT(this,{context:l.$,initialValue:void 0})}}v.styles=(0,a.AH)(p||(p=g`ha-visibility-status{margin-bottom:var(--ha-space-3)}`)),(0,o.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"config",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"entityId",void 0),v=(0,o.Cg)([(0,r.EM)("hui-card-visibility-editor")],v),e()}catch(u){e(u)}})},30461:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),s=i(35211),a=i(5124),r=i(67576),n=i(87047),l=i(38962),d=(i(67094),i(83892)),h=i(14487),c=i(82747),u=t([l,h,n]);[l,h,n]=u.then?(await u)():u;let p,g,v=t=>t;const m={visible:"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",hidden:"M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",invalid:"M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"};class _ extends a.WF{willUpdate(t){var e;(super.willUpdate(t),t.has("conditions")||t.has("hass"))&&this._listeners.setup(null!==(e=this.conditions)&&void 0!==e?e:[],this.hass,()=>this._evaluate());(t.has("hass")||t.has("conditions")||t.has("_entityContext"))&&this._evaluate()}render(){var t,e,i,o;return(0,a.qy)(p||(p=v` <ha-alert .alertType="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> <div class="headline"> ${0} </div> <div class="supporting"> ${0} </div> </ha-alert> `),"visible"===this.state?"success":"hidden"===this.state?"warning":"error",m[this.state],null===(t=this.hass)||void 0===t?void 0:t.localize(`ui.panel.lovelace.editor.condition-editor.visibility_status.${this.state}.headline`),null===(e=this.hass)||void 0===e?void 0:e.localize(`ui.panel.lovelace.editor.condition-editor.visibility_status.${this.state}.supporting${0===(null!==(i=null===(o=this.conditions)||void 0===o?void 0:o.length)&&void 0!==i?i:0)?"_empty":""}`))}_evaluate(){var t;const e=null!==(t=this.conditions)&&void 0!==t?t:[];let i;if(0===e.length)i="visible";else if((0,h.db)(e)){var o;const t="current"===(null===(o=this._entityContext)||void 0===o?void 0:o.mode)?{entity_id:this._entityContext.entityId}:{};i=(0,h.XH)(e,this.hass,t)?"visible":"hidden"}else i="invalid";i!==this.state&&(this.state=i)}constructor(...t){super(...t),this.conditions=[],this.state="visible",this._listeners=new n.x(this)}}_.styles=[d.x.styles,(0,a.AH)(g||(g=v`ha-alert{display:block;--mdc-icon-size:24px}.headline{font-weight:var(--ha-font-weight-medium);margin-bottom:var(--ha-space-1)}`))],(0,o.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],_.prototype,"conditions",void 0),(0,o.Cg)([(0,r.wk)(),(0,s.Fg)({context:c.$,subscribe:!0})],_.prototype,"_entityContext",void 0),(0,o.Cg)([(0,r.MZ)()],_.prototype,"state",void 0),_=(0,o.Cg)([(0,r.EM)("ha-visibility-status")],_),e()}catch(p){e(p)}})},39039:function(t,e,i){i.d(e,{r:function(){return o}});i(16280);class o extends Error{constructor(t,e,i){super(t),this.name="GUISupportError",this.warnings=e,this.errors=i}}},91322:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{m:function(){return O}});i(18111),i(7588),i(61701),i(3362),i(62953);var s=i(40445),a=i(5124),r=i(67576),n=i(74985),l=i(1087),d=i(78978),h=i(19459),c=i(38962),u=i(65829),p=i(10763),g=i(39039),v=t([c,u,p]);[c,u,p]=v.then?(await v)():v;let m,_,y,b,f,w,C,x,$,M,E,k,A=t=>t;class O extends a.WF{get value(){return this._config}set value(t){this._config&&(0,h.b)(t,this._config,{compareSymbols:!0})||(this._config=t,this._errors=void 0,this._setConfig())}_setConfig(){if(!this._errors&&!this._yamlError)try{this._updateConfigElement()}catch(t){this._errors=[t.message]}this.updateComplete.then(()=>{var t;(0,l.r)(this,"config-changed",{config:this.value,error:null===(t=this._errors)||void 0===t?void 0:t.join(", "),guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})})}get hasWarning(){return void 0!==this._warnings&&this._warnings.length>0}get hasError(){return this._yamlError||void 0!==this._errors&&this._errors.length>0}get GUImode(){return this._guiMode}set GUImode(t){this._guiMode=t,this.updateComplete.then(()=>{(0,l.r)(this,"GUImode-changed",{guiMode:t,guiModeAvailable:!(this.hasWarning||this.hasError||!1===this._guiSupported)})})}toggleMode(){var t;this.GUImode||(null===(t=this._yamlEditor)||void 0===t||t.disableCodeEditorFullscreen());this.GUImode=!this.GUImode}focusYamlEditor(){var t;null!==(t=this._configElement)&&void 0!==t&&t.focusYamlEditor&&this._configElement.focusYamlEditor(),this._yamlEditor&&this._yamlEditor.focus()}async getConfigElement(){}async getConfigForm(){}renderConfigElement(){return(0,a.qy)(m||(m=A`${0}`),this._configElement)}_renderSubElement(){return(0,a.qy)(_||(_=A` <hui-sub-element-editor .hass="${0}" .config="${0}" -back="${0}" -changed="${0}"> </hui-sub-element-editor> `),this.hass,this._subElementEditorConfig,this._goBack,this._subElementChanged)}_subElementChanged(t){var e,i;t.stopPropagation();const o=t.detail.config;this._subElementEditorConfig=Object.assign(Object.assign({},this._subElementEditorConfig),{},{elementConfig:o}),null===(e=(i=this._subElementEditorConfig).saveElementConfig)||void 0===e||e.call(i,o)}_goBack(t){t.stopPropagation(),this._subElementEditorConfig=void 0}async _editSubElement(t){t.stopPropagation(),await Promise.all([i.e(92769),i.e(3283),i.e(80131),i.e(70183),i.e(67218),i.e(98470),i.e(99788),i.e(58303),i.e(21543),i.e(66283),i.e(46601),i.e(94956),i.e(26092),i.e(39005),i.e(8851),i.e(59704),i.e(25322),i.e(55392),i.e(71572),i.e(55076),i.e(36332),i.e(77563),i.e(15862),i.e(99143),i.e(97500),i.e(12009),i.e(66990),i.e(20282),i.e(87857),i.e(81804),i.e(92363),i.e(53387)]).then(i.bind(i,81287)),this._subElementEditorConfig={type:t.detail.type,elementConfig:t.detail.config,context:t.detail.context,saveElementConfig:t.detail.saveConfig}}render(){var t;return(0,a.qy)(y||(y=A` <div class="wrapper"> ${0} ${0} ${0} ${0} </div> `),this.GUImode?(0,a.qy)(b||(b=A` <div class="gui-editor" -sub-element="${0}"> ${0} </div> `),this._editSubElement,this._loading?(0,a.qy)(f||(f=A` <ha-spinner class="center margin-bot"></ha-spinner> `)):(0,n.P)(this._subElementEditorConfig?this._renderSubElement():this.renderConfigElement())):(0,a.qy)(w||(w=A` <div class="yaml-editor"> <ha-yaml-editor .defaultValue="${0}" autofocus .inDialog="${0}" -changed="${0}" ="${0}" dir="ltr"></ha-yaml-editor> </div> `),this._config,this.inDialog,this._handleYAMLChanged,this._ignoreKeydown),!1===this._guiSupported&&!1===this._loading?(0,a.qy)(C||(C=A` <ha-alert alert-type="info" .title="${0}"> ${0} <br> ${0} </ha-alert> `),this.hass.localize("ui.errors.config.visual_editor_not_supported"),this.hass.localize("ui.errors.config.visual_editor_not_supported_reason_type"),this.hass.localize("ui.errors.config.edit_in_yaml_supported")):a.s6,null!==(t=this._errors)&&void 0!==t&&t.length?(0,a.qy)(x||(x=A` <ha-alert alert-type="error" .title="${0}"> <ul> ${0} </ul> </ha-alert> `),this.hass.localize("ui.errors.config.configuration_error"),this._errors.map(t=>(0,a.qy)($||($=A`<li>${0}</li>`),t))):a.s6,this.hasWarning?(0,a.qy)(M||(M=A` <ha-alert alert-type="warning" .title="${0}"> <ul> ${0} </ul> ${0} </ha-alert> `),this.hass.localize("ui.errors.config.visual_editor_not_supported"),this._warnings.map(t=>(0,a.qy)(E||(E=A`<li>${0}</li>`),t)),this.hass.localize("ui.errors.config.edit_in_yaml_supported")):a.s6)}updated(t){super.updated(t),this._configElement&&t.has("hass")&&(this._configElement.hass=this.hass),this._configElement&&"lovelace"in this._configElement&&t.has("lovelace")&&(this._configElement.lovelace=this.lovelace),this._configElement&&t.has("context")&&(this._configElement.context=this.context)}_handleUIConfigChanged(t){if(t.stopPropagation(),!this.GUImode)return;const e=t.detail.config;Object.keys(e).forEach(t=>{void 0===e[t]&&delete e[t]}),this.value=e}_handleYAMLChanged(t){t.stopPropagation(),t.detail.isValid?(this._config=t.detail.value,this._errors=void 0,this._yamlError=!1):this._yamlError=!0,this._setConfig()}async unloadConfigElement(){this._configElement=void 0,this._guiSupported=void 0}async loadConfigElement(){if(this._configElement)return;let t=await this.getConfigElement();if(!t){const e=await this.getConfigForm();if(e){await i.e(15106).then(i.bind(i,15737)),t=document.createElement("hui-form-editor");const{schema:o,assertConfig:s,computeLabel:a,computeHelper:r}=e;t.schema=o,a&&(t.computeLabel=a),r&&(t.computeHelper=r),s&&(t.assertConfig=s)}}t?(t.hass=this.hass,"lovelace"in t&&(t.lovelace=this.lovelace),t.context=this.context,t.addEventListener("config-changed",t=>this._handleUIConfigChanged(t)),this._guiSupported=!0):this._guiSupported=!1,this._configElement=t}async _updateConfigElement(){if(!this.value)return;const t=++this._loadCount;try{if(this._errors=void 0,this._warnings=void 0,await this.loadConfigElement(),this._configElement)try{this._configElement.setConfig(this.value)}catch(i){const t=(0,d._)(this.hass,i);throw new g.r("Config is not supported",t.warnings,t.errors)}else this._guiSupported=!1,this.GUImode=!1}catch(i){if(t!==this._loadCount)return;var e;if(i instanceof g.r)this._warnings=null!==(e=i.warnings)&&void 0!==e?e:[i.message],this._errors=i.errors||void 0;else this._errors=[i.message];this.GUImode=!1}finally{this._loading=!1}}_ignoreKeydown(t){t.stopPropagation()}constructor(...t){super(...t),this.inDialog=!1,this._guiMode=!0,this._loading=!1,this._yamlError=!1,this._loadCount=0}}O.styles=(0,a.AH)(k||(k=A`:host{display:flex}.wrapper{width:100%}.gui-editor,.yaml-editor{padding:8px 0px}ha-code-editor{--code-mirror-max-height:calc(100vh - 245px)}ha-spinner{display:block;margin:auto}`)),(0,s.Cg)([(0,r.MZ)({attribute:!1})],O.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],O.prototype,"lovelace",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],O.prototype,"context",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,attribute:"in-dialog"})],O.prototype,"inDialog",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_config",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_configElement",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_subElementEditorConfig",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_guiMode",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_errors",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_warnings",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_guiSupported",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_loading",void 0),(0,s.Cg)([(0,r.wk)()],O.prototype,"_yamlError",void 0),(0,s.Cg)([(0,r.P)("ha-yaml-editor")],O.prototype,"_yamlEditor",void 0),o()}catch(m){o(m)}})},63277:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{U:function(){return l}});i(16280),i(3362);var s=i(40445),a=i(67576),r=i(91322),n=t([r]);r=(n.then?(await n)():n)[0];class l extends r.m{get configElementType(){return this.value?this.value.type:void 0}async loadConfigElement(){if(this._configElementType!==this.configElementType){if(this.unloadConfigElement(),!this.configElementType)throw new Error(this.hass.localize("ui.errors.config.no_type_provided"));this._configElementType=this.configElementType}return super.loadConfigElement()}}(0,s.Cg)([(0,a.wk)()],l.prototype,"_configElementType",void 0),o()}catch(l){o(l)}})},74985:function(t,e,i){i.d(e,{P:function(){return n}});i(88454),i(29452),i(62953);var o=i(5055),s=i(42017),a=i(63937);const r=t=>(0,a.ps)(t)?t._$litType$.h:t.strings,n=(0,s.u$)(class extends s.WL{render(t){return[t]}update(t,[e]){const i=(0,a.qb)(this.it)?r(this.it):null,s=(0,a.qb)(e)?r(e):null;if(null!==i&&(null===s||i!==s)){const e=(0,a.cN)(t).pop();let s=this.et.get(i);if(void 0===s){const t=document.createDocumentFragment();s=(0,o.XX)(o.s6,t),s.setConnected(!1),this.et.set(i,s)}(0,a.mY)(s,[e]),(0,a.Dx)(s,void 0,e)}if(null!==s){if(null===i||i!==s){const e=this.et.get(s);if(void 0!==e){const i=(0,a.cN)(e).pop();(0,a.Jz)(t),(0,a.Dx)(t,void 0,i),(0,a.mY)(t,[i])}}this.it=e}else this.it=void 0;return this.render(e)}constructor(t){super(t),this.et=new WeakMap}})}}]);