iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
17 lines • 59.2 kB
JavaScript
export const __webpack_ids__=["93025"];export const __webpack_modules__={50875:function(e,t,i){i.d(t,{Eu:()=>s,hZ:()=>o,o9:()=>c});var a=i(27486),r=i(11259);const n=["#4269d0","#f4bd4a","#ff725c","#6cc5b0","#a463f2","#ff8ab7","#9c6b4e","#97bbf5","#01ab63","#9498a0","#094bad","#c99000","#d84f3e","#49a28f","#048732","#d96895","#8043ce","#7599d1","#7a4c31","#74787f","#6989f4","#ffd444","#ff957c","#8fe9d3","#62cc71","#ffadda","#c884ff","#badeff","#bf8b6d","#b6bac2","#927acc","#97ee3f","#bf3947","#9f5b00","#f48758","#8caed6","#f2b94f","#eff26e","#e43872","#d9b100","#9d7a00","#698cff","#d9d9d9","#00d27e","#d06800","#009f82","#c49200","#cbe8ff","#fecddf","#c27eb6","#8cd2ce","#c4b8d9","#f883b0","#a49100","#f48800","#27d0df","#a04a9b"];function s(e){return n[e%n.length]}function o(e,t){const i=t.getPropertyValue(`--graph-color-${e+1}`)||s(e);return(0,r.Rq)(i)}const c=(0,a.Z)((e=>n.map(((t,i)=>o(i,e)))),((e,t)=>e[0].getPropertyValue("--graph-color-1")===t[0].getPropertyValue("--graph-color-1")))},85746:function(e,t,i){i.d(t,{V:()=>r});var a=i(87733);const r=(e,t)=>(e=>{switch(e){case"de":case"lb":return!0;default:return!1}})(t)?(0,a.f)(e):e.toLocaleLowerCase(t)},13928:function(e,t,i){i.r(t),i.d(t,{HaIconNext:()=>o});var a=i(44249),r=i(15093),n=i(5111),s=i(37583);let o=(0,a.Z)([(0,r.Mo)("ha-icon-next")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)()],key:"path",value:()=>"rtl"===n.E.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}]}}),s.HaSvgIcon)},95975:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),r=i(72621),n=i(74760),s=i(57243),o=i(15093),c=i(94947),d=i(87733),l=e([c]);c=(l.then?(await l)():l)[0];(0,a.Z)([(0,o.Mo)("ha-relative-time")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"datetime",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"capitalize",value:()=>!1},{kind:"field",key:"_interval",value:void 0},{kind:"method",key:"disconnectedCallback",value:function(){(0,r.Z)(i,"disconnectedCallback",this,3)([]),this._clearInterval()}},{kind:"method",key:"connectedCallback",value:function(){(0,r.Z)(i,"connectedCallback",this,3)([]),this.datetime&&this._startInterval()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"firstUpdated",value:function(e){(0,r.Z)(i,"firstUpdated",this,3)([e]),this._updateRelative()}},{kind:"method",key:"update",value:function(e){(0,r.Z)(i,"update",this,3)([e]),this._updateRelative()}},{kind:"method",key:"_clearInterval",value:function(){this._interval&&(window.clearInterval(this._interval),this._interval=void 0)}},{kind:"method",key:"_startInterval",value:function(){this._clearInterval(),this._interval=window.setInterval((()=>this._updateRelative()),6e4)}},{kind:"method",key:"_updateRelative",value:function(){if(this.datetime){const e="string"==typeof this.datetime?(0,n.D)(this.datetime):this.datetime,t=(0,c.G)(e,this.hass.locale);this.innerHTML=this.capitalize?(0,d.f)(t):t}else this.innerHTML=this.hass.localize("ui.components.relative_time.never")}}]}}),s.fl);t()}catch(e){t(e)}}))},12994:function(e,t,i){var a=i(44249),r=i(57243),n=i(15093),s=i(28008);i(37583);(0,a.Z)([(0,n.Mo)("ha-timeline")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"label",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"raised",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,reflect:!0,type:Boolean})],key:"notEnabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({attribute:"last-item",type:Boolean})],key:"lastItem",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"icon",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"moreItems",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_showMore",value:()=>!1},{kind:"method",key:"render",value:function(){return r.dy` <div class="timeline-start"> ${this.label?"":r.dy` <ha-svg-icon .path="${this.icon||"M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,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"}"></ha-svg-icon> `} ${this.lastItem?"":r.dy`<div class="line"></div>`} </div> <div class="content"> <slot></slot> ${this.moreItems?r.dy` <div> ${this._showMore||1===this.moreItems.length?this.moreItems:r.dy` <button class="link" @click="${this._handleShowMore}"> Show ${this.moreItems.length} more items </button> `} </div> `:""} </div> `}},{kind:"method",key:"_handleShowMore",value:function(){this._showMore=!0}},{kind:"get",static:!0,key:"styles",value:function(){return[r.iv`:host{display:flex;flex-direction:row}:host(:not([lastItem])){min-height:50px}:host([label]){margin-top:-8px;font-style:italic;color:var(--timeline-label-color,var(--secondary-text-color))}.timeline-start{display:flex;flex-direction:column;align-items:center;margin-right:8px;margin-inline-end:8px;margin-inline-start:initial;width:24px}:host([notEnabled]) ha-svg-icon{opacity:.5}ha-svg-icon{color:var(--timeline-ball-color,var(--timeline-color,var(--secondary-text-color)));border-radius:50%}:host([raised]) ha-svg-icon{transform:scale(1.3)}.line{flex:1;width:2px;background-color:var(--timeline-line-color,var(--timeline-color,var(--secondary-text-color)));margin:4px 0}.content{margin-top:2px}:host(:not([lastItem])) .content{padding-bottom:16px}:host([label]) .content{margin-top:0;padding-top:6px}`,s.k1]}}]}}),r.oi)},81025:function(e,t,i){var a=i(44249),r=i(76848),n=i(57243),s=i(15093);i(68325),i(23334);(0,a.Z)([(0,s.Mo)("ha-trace-blueprint-config")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"method",key:"render",value:function(){return n.dy` <ha-code-editor .value="${(0,r.dump)(this.trace.blueprint_inputs||"").trimRight()}" read-only dir="ltr"></ha-code-editor> `}}]}}),n.oi)},79315:function(e,t,i){var a=i(44249),r=i(76848),n=i(57243),s=i(15093);i(68325),i(23334);(0,a.Z)([(0,s.Mo)("ha-trace-config")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"method",key:"render",value:function(){return n.dy` <ha-code-editor .value="${(0,r.dump)(this.trace.config).trimRight()}" read-only dir="ltr"></ha-code-editor> `}},{kind:"get",static:!0,key:"styles",value:function(){return[n.iv``]}}]}}),n.oi)},5327:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),r=i(57243),n=i(15093),s=(i(81929),i(82480)),o=e([s]);s=(o.then?(await o)():o)[0];(0,a.Z)([(0,n.Mo)("ha-trace-logbook")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"method",key:"render",value:function(){return this.logbookEntries.length?r.dy` <ha-logbook-renderer relative-time .hass="${this.hass}" .entries="${this.logbookEntries}" .narrow="${this.narrow}"></ha-logbook-renderer> <hat-logbook-note .hass="${this.hass}" .domain="${this.trace.domain}"></hat-logbook-note> `:r.dy`<div class="padded-box"> No Logbook entries found for this step. </div>`}},{kind:"get",static:!0,key:"styles",value:function(){return[r.iv`.padded-box{padding:16px}`]}}]}}),r.oi);t()}catch(e){t(e)}}))},81097:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),r=(i(92745),i(9359),i(70104),i(76848)),n=i(60738),s=i(57243),o=i(15093),c=i(35359),d=i(64214),l=(i(68325),i(23334),i(81929),i(75244)),h=i(82480),u=i(43770),g=i(17551),p=i(30635),f=e([h,g,d]);[h,g,d]=f.then?(await f)():f;const k=["step_config","changed_variables","logbook"];(0,a.Z)([(0,o.Mo)("ha-trace-path-details")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"selected",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"renderedNodes",value:()=>({})},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"trackedNodes",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_view",value:()=>"step_config"},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:p.we,subscribe:!0})],key:"_entityReg",value:void 0},{kind:"method",key:"render",value:function(){return s.dy` <div class="padded-box trace-info"> ${this._renderSelectedTraceInfo()} </div> <div class="tabs top"> ${k.map((e=>s.dy` <button .view="${e}" class="${(0,c.$)({active:this._view===e})}" @click="${this._showTab}"> ${this.hass.localize(`ui.panel.config.automation.trace.tabs.${e}`)} </button> `))} </div> ${"step_config"===this._view?this._renderSelectedConfig():"changed_variables"===this._view?this._renderChangedVars():this._renderLogbook()} `}},{kind:"method",key:"_renderSelectedTraceInfo",value:function(){const e=this.trace.trace;if(!this.selected?.path)return this.hass.localize("ui.panel.config.automation.trace.path.choose");const t=this.selected.path.split("/");if("default"===t[t.length-1]){const i=e[t.slice(0,t.length-1).join("/")];if(i&&"default"===i[0]?.result?.choice)return this.hass.localize("ui.panel.config.automation.trace.path.default_action_executed")}if(!(this.selected.path in e))return this.hass.localize("ui.panel.config.automation.trace.path.no_further_execution");const i=[];let a=!1;for(const t of Object.keys(this.trace.trace)){if(a){if(t in this.renderedNodes)break}else{if(t!==this.selected.path)continue;a=!0}const n=e[t],o=t.substring(this.selected.path.length+1).split("/");let c=this.selected.config;for(const e of o)["undefined","string"].includes(typeof c[e])||(c=c[e]);i.push(n.map(((e,i)=>{const{path:a,timestamp:o,result:l,error:h,changed_variables:u,...p}=e;return!1===l?.enabled?s.dy`${this.hass.localize("ui.panel.config.automation.trace.path.disabled_step")}`:s.dy` ${t===this.selected.path?c.alias?s.dy`<h2>${c.alias}</h2>`:s.Ld:s.dy`<h2> ${t.substring(this.selected.path.length+1)} </h2>`} ${1===n.length?s.Ld:s.dy`<h3> ${this.hass.localize("ui.panel.config.automation.trace.path.iteration",{number:i+1})} </h3>`} ${t.substring(this.selected.path.length+1).includes("condition")?s.dy`[${(0,g.m)(c,this.hass,this._entityReg)}]<br>`:s.Ld} ${this.hass.localize("ui.panel.config.automation.trace.path.executed",{time:(0,d.E8)(new Date(o),this.hass.locale,this.hass.config)})} <br> ${h?s.dy`<div class="error"> ${this.hass.localize("ui.panel.config.automation.trace.path.error",{error:h})} </div>`:s.Ld} ${l?s.dy`${this.hass.localize("ui.panel.config.automation.trace.path.result")} <pre>${(0,r.dump)(l)}</pre>`:s.Ld} ${0===Object.keys(p).length?s.Ld:s.dy`<pre>${(0,r.dump)(p)}</pre>`} ${c.entity_id&&t.substring(this.selected.path.length+1).includes("entity_id")?s.dy`<pre>entity: ${c.entity_id}</pre>`:s.Ld} `})))}return i}},{kind:"method",key:"_renderSelectedConfig",value:function(){if(!this.selected?.path)return s.Ld;const e=(0,l.nV)(this.trace.config,this.selected.path);return e?s.dy`<ha-code-editor .value="${(0,r.dump)(e).trimEnd()}" read-only dir="ltr"></ha-code-editor>`:this.hass.localize("ui.panel.config.automation.trace.path.unable_to_find_config")}},{kind:"method",key:"_renderChangedVars",value:function(){const e=this.trace.trace[this.selected.path];return void 0===e?s.dy`<div class="padded-box"> ${this.hass.localize("ui.panel.config.automation.trace.path.step_not_executed")} </div>`:s.dy` <div class="padded-box"> ${e.map(((t,i)=>s.dy` ${e.length>1?s.dy`<p> ${this.hass.localize("ui.panel.config.automation.trace.path.iteration",{number:i+1})} </p>`:""} ${0===Object.keys(t.changed_variables||{}).length?this.hass.localize("ui.panel.config.automation.trace.path.no_variables_changed"):s.dy`<pre>${(0,r.dump)(t.changed_variables).trimEnd()}</pre>`} `))} </div> `}},{kind:"method",key:"_renderLogbook",value:function(){const e=this.trace.trace,t=e[this.selected.path],i=Object.keys(this.trackedNodes),a=i.indexOf(this.selected.path);if(-1===a)return s.dy`<div class="padded-box"> ${this.hass.localize("ui.panel.config.automation.trace.path.step_not_executed")} </div>`;let r;if(a===i.length-1){const e=new Date(t[0].timestamp),i=this.logbookEntries.findIndex((t=>new Date(1e3*t.when)>=e));r=-1===i?[]:this.logbookEntries.slice(i)}else{const n=e[i[a+1]],s=new Date(t[0].timestamp),o=new Date(n[0].timestamp);r=[];for(const e of this.logbookEntries||[]){const t=new Date(1e3*e.when);if(t>=s){if(!(t<o))break;r.push(e)}}}return r.length?s.dy` <ha-logbook-renderer relative-time .hass="${this.hass}" .entries="${r}" .narrow="${this.narrow}"></ha-logbook-renderer> <hat-logbook-note .hass="${this.hass}" .domain="${this.trace.domain}"></hat-logbook-note> `:s.dy`<div class="padded-box"> ${this.hass.localize("ui.panel.config.automation.trace.path.no_logbook_entries")} </div>`}},{kind:"method",key:"_showTab",value:function(e){this._view=e.target.view}},{kind:"get",static:!0,key:"styles",value:function(){return[u.b,s.iv`.padded-box{margin:16px}:host(:not([narrow])) .trace-info{min-height:250px}pre{margin:0}.error{color:var(--error-color)}`]}}]}}),s.oi);t()}catch(e){t(e)}}))},57119:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),r=i(57243),n=i(15093),s=(i(81929),i(18156)),o=e([s]);s=(o.then?(await o)():o)[0];(0,a.Z)([(0,n.Mo)("ha-trace-timeline")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"selected",value:void 0},{kind:"method",key:"render",value:function(){return r.dy` <hat-trace-timeline .hass="${this.hass}" .trace="${this.trace}" .logbookEntries="${this.logbookEntries}" .selectedPath="${this.selected.path}" allow-pick> </hat-trace-timeline> <hat-logbook-note .hass="${this.hass}" .domain="${this.trace.domain}"></hat-logbook-note> `}},{kind:"get",static:!0,key:"styles",value:function(){return[r.iv`:host{display:block;padding:16px}`]}}]}}),r.oi);t()}catch(e){t(e)}}))},91298:function(e,t,i){var a=i(44249),r=(i(92745),i(9359),i(31526),i(70104),i(57243)),n=i(15093),s=i(35359),o=i(65786);(0,a.Z)([(0,n.Mo)("hat-graph-branch")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"selected",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"start",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"short",value:()=>!1},{kind:"field",decorators:[(0,n.SB)()],key:"_branches",value:()=>[]},{kind:"field",key:"_totalWidth",value:()=>0},{kind:"field",key:"_maxHeight",value:()=>0},{kind:"method",key:"_updateBranches",value:function(e){let t=0;const i=[],a=[];e.target.assignedElements().forEach((e=>{const r=e.clientWidth,n=e.clientHeight;a.push({x:r/2+t,height:n,start:e.hasAttribute("graph-start"),end:e.hasAttribute("graph-end"),track:e.hasAttribute("track")}),t+=r,i.push(n)})),this._totalWidth=t,this._maxHeight=Math.max(...i),this._branches=a.sort(((e,t)=>e.track&&!t.track?1:e.track&&t.track?0:-1))}},{kind:"method",key:"render",value:function(){return r.dy` <slot name="head"></slot> ${this.start?r.Ld:r.dy` <svg id="top" width="${this._totalWidth}"> ${this._branches.map((e=>e.start?"":r.YP` <path class="${(0,s.$)({track:e.track})}" d="
M ${this._totalWidth/2} 0
L ${e.x} ${o.Qs}
"/> `))} </svg> `} <div id="branches"> <svg id="lines" width="${this._totalWidth}" height="${this._maxHeight}"> ${this._branches.map((e=>e.end?"":r.YP` <path class="${(0,s.$)({track:e.track})}" d="
M ${e.x} ${e.height}
v ${this._maxHeight-e.height}
"/> `))} </svg> <slot @slotchange="${this._updateBranches}"></slot> </div> ${this.short?r.Ld:r.dy` <svg id="bottom" width="${this._totalWidth}"> ${this._branches.map((e=>e.end?"":r.YP` <path class="${(0,s.$)({track:e.track})}" d="
M ${e.x} 0
V ${o.N_}
L ${this._totalWidth/2} ${o.Qs+o.N_}
"/> `))} </svg> `} `}},{kind:"field",static:!0,key:"styles",value:()=>r.iv`:host{position:relative;display:flex;flex-direction:column;align-items:center}:host(:focus){outline:0}#branches{position:relative;display:flex;flex-direction:row;align-items:start}::slotted(*){z-index:1}::slotted([slot=head]){margin-bottom:calc(var(--hat-graph-branch-height)/ -2)}#lines{position:absolute}#top{height:var(--hat-graph-branch-height)}#bottom{height:calc(var(--hat-graph-branch-height) + var(--hat-graph-spacing))}path{stroke:var(--stroke-clr);stroke-width:2;fill:none}path.track{stroke:var(--track-clr)}:host([disabled]) path{stroke:var(--disabled-clr)}`}]}}),r.oi)},65786:function(e,t,i){i.d(t,{N_:()=>a,Qs:()=>n,TB:()=>r});const a=10,r=30,n=20},3953:function(e,t,i){var a=i(44249),r=i(57243),n=i(15093),s=i(18117),o=i(65786);(0,a.Z)([(0,n.Mo)("hat-graph-node")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"iconPath",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"error",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,reflect:!0,type:Boolean})],key:"notEnabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({attribute:"graph-start",reflect:!0,type:Boolean})],key:"graphStart",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"nofocus"})],key:"noFocus",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({reflect:!0,type:Number})],key:"badge",value:void 0},{kind:"method",key:"updated",value:function(e){e.has("noFocus")&&(this.hasAttribute("tabindex")||this.noFocus?void 0!==e.get("noFocus")&&this.noFocus&&this.removeAttribute("tabindex"):this.setAttribute("tabindex","0"))}},{kind:"method",key:"render",value:function(){const e=o.TB+(this.graphStart?2:o.N_+1),t=o.N_+o.TB;return r.dy` <svg class="${s.G?"safari":""}" width="${t}px" height="${e}px" viewBox="-${Math.ceil(t/2)} -${this.graphStart?Math.ceil(e/2):Math.ceil((o.TB+2*o.N_)/2)} ${t} ${e}"> ${this.graphStart?r.Ld:r.YP` <path class="connector" d="
M 0 ${-o.N_-o.TB/2}
L 0 0
" line-caps="round"/> `} <g class="node"> <circle cx="0" cy="0" r="${o.TB/2}"/> ${this.error?r.YP` <g class="error"> <circle cx="-12" cy="${-o.TB/2}" r="8"></circle> <path transform="translate(-18 -21) scale(.5)" class="exclamation" d="${"M10 3H14V14H10V3M10 21V17H14V21H10Z"}/"> </path></g> `:r.Ld} ${this.badge?r.YP` <g class="number"> <circle cx="12" cy="${-o.TB/2}" r="8"></circle> <text x="12" y="${-o.TB/2}" text-anchor="middle" alignment-baseline="middle">${this.badge>9?"9+":this.badge}</text> </g> `:r.Ld} <g style="pointer-events:none" transform="translate(-12 -12)"> ${this.iconPath?r.YP`<path class="icon" d="${this.iconPath}/"></path>`:r.YP`<foreignObject><span class="icon"><slot name="icon"></slot></span></foreignObject>`} </g> </g> </svg> `}},{kind:"field",static:!0,key:"styles",value:()=>r.iv`:host{display:flex;flex-direction:column;min-width:calc(var(--hat-graph-node-size) + var(--hat-graph-spacing));height:calc(var(--hat-graph-node-size) + var(--hat-graph-spacing) + 1px)}:host([graph-start]){height:calc(var(--hat-graph-node-size) + 2px)}:host([track]){--stroke-clr:var(--track-clr);--icon-clr:var(--default-icon-clr)}:host([active]) circle{--stroke-clr:var(--active-clr);--icon-clr:var(--default-icon-clr)}:host(:focus){outline:0}:host(:hover) circle{--stroke-clr:var(--hover-clr);--icon-clr:var(--default-icon-clr)}:host([notEnabled]) circle{--stroke-clr:var(--disabled-clr)}:host([notEnabled][active]) circle{--stroke-clr:var(--disabled-active-clr)}:host([notEnabled]:hover) circle{--stroke-clr:var(--disabled-hover-clr)}svg:not(.safari){width:100%;height:100%}circle,path.connector{stroke:var(--stroke-clr);stroke-width:2;fill:none}circle{fill:var(--background-clr);stroke:var(--circle-clr,var(--stroke-clr))}.error circle{fill:var(--error-color);stroke:none;stroke-width:0}.error .exclamation{fill:var(--text-primary-color)}.number circle{fill:var(--track-clr);stroke:none;stroke-width:0}.number text{font-size:10px;fill:var(--text-primary-color)}path.icon{fill:var(--icon-clr)}foreignObject{width:24px;height:24px}.icon{color:var(--icon-clr)}`}]}}),r.oi)},34936:function(e,t,i){var a=i(44249),r=i(57243),n=i(15093),s=i(65786);(0,a.Z)([(0,n.Mo)("hat-graph-spacer")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({reflect:!0,type:Boolean})],key:"disabled",value:()=>!1},{kind:"method",key:"render",value:function(){return r.dy` <svg viewBox="-${s.N_/2} 0 10 ${s.N_+s.TB+1}"> <path d="
M 0 ${s.N_+s.TB+1}
V 0
" line-caps="round"/> } </svg> `}},{kind:"field",static:!0,key:"styles",value:()=>r.iv`:host{display:flex;flex-direction:column;align-items:center}svg{width:var(--hat-graph-spacing);height:calc(var(--hat-graph-spacing) + var(--hat-graph-node-size) + 1px)}:host([track]){--stroke-clr:var(--track-clr)}:host-context([disabled]){--stroke-clr:var(--disabled-clr)}path{stroke:var(--stroke-clr);stroke-width:2;fill:none}`}]}}),r.oi)},81929:function(e,t,i){var a=i(44249),r=i(57243),n=i(15093);(0,a.Z)([(0,n.Mo)("hat-logbook-note")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"domain",value:()=>"automation"},{kind:"method",key:"render",value:function(){return"script"===this.domain?this.hass.localize("ui.panel.config.automation.trace.messages.not_all_entries_are_related_script_note"):this.hass.localize("ui.panel.config.automation.trace.messages.not_all_entries_are_related_automation_note")}},{kind:"field",static:!0,key:"styles",value:()=>r.iv`:host{display:block;text-align:center;font-style:italic;padding:16px;margin-top:8px}`}]}}),r.oi)},28639:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),r=i(72621),n=(i(9359),i(1331),i(70104),i(52924),i(57243)),s=i(15093),o=i(95262),c=i(36522),d=i(14473),l=i(68418),h=(i(23334),i(19467)),u=(i(91298),i(65786)),g=(i(3953),i(34936),i(41422)),p=e([h]);h=(p.then?(await p)():p)[0];const f="M4 2A2 2 0 0 0 2 4V12H4V8H6V12H8V4A2 2 0 0 0 6 2H4M4 4H6V6H4M22 15.5V14A2 2 0 0 0 20 12H16V22H20A2 2 0 0 0 22 20V18.5A1.54 1.54 0 0 0 20.5 17A1.54 1.54 0 0 0 22 15.5M20 20H18V18H20V20M20 16H18V14H20M5.79 21.61L4.21 20.39L18.21 2.39L19.79 3.61Z",k="M11,5H8L12,1L16,5H13V9.43C12.25,9.89 11.58,10.46 11,11.12V5M22,11L18,7V10C14.39,9.85 11.31,12.57 11,16.17C9.44,16.72 8.62,18.44 9.17,20C9.72,21.56 11.44,22.38 13,21.83C14.56,21.27 15.38,19.56 14.83,18C14.53,17.14 13.85,16.47 13,16.17C13.47,12.17 17.47,11.97 17.95,11.97V14.97L22,11M10.63,11.59C9.3,10.57 7.67,10 6,10V7L2,11L6,15V12C7.34,12.03 8.63,12.5 9.64,13.4C9.89,12.76 10.22,12.15 10.63,11.59Z",v="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",b="M21 13H14.4L19.1 17.7L17.7 19.1L13 14.4V21H11V14.3L6.3 19L4.9 17.6L9.4 13H3V11H9.6L4.9 6.3L6.3 4.9L11 9.6V3H13V9.4L17.6 4.8L19 6.3L14.3 11H21V13Z",m="M19.59,7L12,14.59L6.41,9H11V7H3V15H5V10.41L12,17.41L21,8.41",y="M20,5.41L18.59,4L7,15.59V9H5V19H15V17H8.41",_="M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29",$="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z",x="M19,19H5V5H15V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V11H19M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z",L="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",C="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",N="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",w="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",V="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",H="M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z",M="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",A="M12,5A2,2 0 0,1 14,7C14,7.24 13.96,7.47 13.88,7.69C17.95,8.5 21,11.91 21,16H3C3,11.91 6.05,8.5 10.12,7.69C10.04,7.47 10,7.24 10,7A2,2 0 0,1 12,5M22,19H2V17H22V19Z",I="M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16";(0,a.Z)([(0,s.Mo)("hat-script-graph")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"selected",value:void 0},{kind:"field",key:"hass",value:void 0},{kind:"field",key:"renderedNodes",value:()=>({})},{kind:"field",key:"trackedNodes",value:()=>({})},{kind:"method",key:"_selectNode",value:function(e,t){return()=>{(0,c.B)(this,"graph-node-selected",{config:e,path:t})}}},{kind:"method",key:"_renderTrigger",value:function(e,t){const i=`trigger/${t}`,a=this.trace&&i in this.trace.trace;return this.renderedNodes[i]={config:e,path:i},a&&(this.trackedNodes[i]=this.renderedNodes[i]),n.dy` <hat-graph-node graph-start ?track="${a}" @focus="${this._selectNode(e,i)}" ?active="${this.selected===i}" .iconPath="${b}" .notEnabled="${"enabled"in e&&!1===e.enabled}" .error="${this.trace.trace[i]?.some((e=>e.error))}" tabindex="${a?"0":"-1"}"></hat-graph-node> `}},{kind:"method",key:"_renderCondition",value:function(e,t){const i=`condition/${t}`;return this.renderedNodes[i]={config:e,path:i},this.trace&&i in this.trace.trace&&(this.trackedNodes[i]=this.renderedNodes[i]),this._renderConditionNode(e,i)}},{kind:"field",key:"_typeRenderers",value(){return{condition:this._renderConditionNode,and:this._renderConditionNode,or:this._renderConditionNode,not:this._renderConditionNode,service:this._renderServiceNode,wait_template:this._renderWaitNode,wait_for_trigger:this._renderWaitNode,repeat:this._renderRepeatNode,choose:this._renderChooseNode,if:this._renderIfNode,sequence:this._renderSequenceNode,parallel:this._renderParallelNode,other:this._renderOtherNode}}},{kind:"method",key:"_renderActionNode",value:function(e,t,i=!1,a=!1){const r=Object.keys(this._typeRenderers).find((t=>t in e))||"other";return this.renderedNodes[t]={config:e,path:t},this.trace&&t in this.trace.trace&&(this.trackedNodes[t]=this.renderedNodes[t]),this._typeRenderers[r].bind(this)(e,t,i,a)}},{kind:"method",key:"_renderChooseNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t],s=r?r.map((e=>void 0===e.result||"default"===e.result.choice?"default":e.result.choice)):[],c=s.includes("default");return n.dy` <hat-graph-branch tabindex="${void 0===r?"-1":"0"}" @focus="${this._selectNode(e,t)}" ?track="${void 0!==r}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}"> <hat-graph-node .graphStart="${i}" .iconPath="${k}" ?track="${void 0!==r}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" .error="${this.trace.trace[t]?.some((e=>e.error))}" slot="head" nofocus></hat-graph-node> ${e.choose?(0,o.r)(e.choose)?.map(((i,c)=>{const d=`${t}/choose/${c}`,l=s.includes(c);return this.renderedNodes[d]={config:i,path:d},l&&(this.trackedNodes[d]=this.renderedNodes[d]),n.dy` <div class="graph-container" ?track="${l}"> <hat-graph-node .iconPath="${!r||l?x:$}" @focus="${this._selectNode(i,d)}" ?track="${l}" ?active="${this.selected===d}" .notEnabled="${a||!1===e.enabled}"></hat-graph-node> ${null!==i.sequence?(0,o.r)(i.sequence).map(((t,i)=>this._renderActionNode(t,`${d}/sequence/${i}`,!1,a||!1===e.enabled))):""} </div> `})):""} <div ?track="${c}"> <hat-graph-spacer ?track="${c}"></hat-graph-spacer> ${null!==e.default?(0,o.r)(e.default)?.map(((i,r)=>this._renderActionNode(i,`${t}/default/${r}`,!1,a||!1===e.enabled))):""} </div> </hat-graph-branch> `}},{kind:"method",key:"_renderIfNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];let s=!1,c=!1;for(const e of r||[])if(s||"then"!==e.result?.choice||(s=!0),(c||"else"!==e.result?.choice)&&e.result||(c=!0),c&&s)break;return n.dy` <hat-graph-branch tabindex="${void 0===r?"-1":"0"}" @focus="${this._selectNode(e,t)}" ?track="${void 0!==r}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}"> <hat-graph-node .graphStart="${i}" .iconPath="${_}" ?track="${void 0!==r}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" slot="head" nofocus></hat-graph-node> ${e.else?n.dy`<div class="graph-container" ?track="${c}"> <hat-graph-node .iconPath="${m}" ?track="${c}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" nofocus></hat-graph-node>${(0,o.r)(e.else).map(((i,r)=>this._renderActionNode(i,`${t}/else/${r}`,!1,a||!1===e.enabled)))} </div>`:n.dy`<hat-graph-spacer ?track="${c}"></hat-graph-spacer>`} <div class="graph-container" ?track="${s}"> <hat-graph-node .iconPath="${y}" ?track="${s}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" nofocus></hat-graph-node> ${(0,o.r)(e.then??[]).map(((i,r)=>this._renderActionNode(i,`${t}/then/${r}`,!1,a||!1===e.enabled)))} </div> </hat-graph-branch> `}},{kind:"method",key:"_renderConditionNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];let s=!1,o=!1,c=!1;if(r)for(const e of r)if(e.result&&(s=!0,e.result.result?o=!0:c=!0),o&&c)break;return n.dy` <hat-graph-branch @focus="${this._selectNode(e,t)}" ?track="${s}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" tabindex="${void 0===r?"-1":"0"}" short> <hat-graph-node .graphStart="${i}" slot="head" ?track="${s}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" .iconPath="${f}" nofocus></hat-graph-node> <div style="${`width: ${u.TB+u.N_}px;`}" graph-start graph-end></div> <div ?track="${o}"></div> <hat-graph-node .iconPath="${N}" nofocus ?track="${c}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}"></hat-graph-node> </hat-graph-branch> `}},{kind:"method",key:"_renderRepeatNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t],s=this.trace?.trace[`${t}/repeat/sequence/0`]?.length;return n.dy` <hat-graph-branch tabindex="${void 0===r?"-1":"0"}" @focus="${this._selectNode(e,t)}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}"> <hat-graph-node .graphStart="${i}" .iconPath="${M}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" slot="head" nofocus></hat-graph-node> <hat-graph-node .iconPath="${v}" ?track="${s>1}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" nofocus .badge="${s>1?s:void 0}"></hat-graph-node> <div ?track="${r}"> ${(0,o.r)(e.repeat.sequence).map(((i,r)=>this._renderActionNode(i,`${t}/repeat/sequence/${r}`,!1,a||!1===e.enabled)))} </div> </hat-graph-branch> `}},{kind:"method",key:"_renderServiceNode",value:function(e,t,i=!1,a=!1){return n.dy` <hat-graph-node .graphStart="${i}" .iconPath="${e.action?void 0:A}" @focus="${this._selectNode(e,t)}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" .error="${this.trace.trace[t]?.some((e=>e.error))}" tabindex="${this.trace&&t in this.trace.trace?"0":"-1"}"> ${e.action?n.dy`<ha-service-icon slot="icon" .hass="${this.hass}" .service="${e.action}"></ha-service-icon>`:n.Ld} </hat-graph-node> `}},{kind:"method",key:"_renderWaitNode",value:function(e,t,i=!1,a=!1){return n.dy` <hat-graph-node .graphStart="${i}" .iconPath="${w}" @focus="${this._selectNode(e,t)}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" .error="${this.trace.trace[t]?.some((e=>e.error))}" tabindex="${this.trace&&t in this.trace.trace?"0":"-1"}"></hat-graph-node> `}},{kind:"method",key:"_renderSequenceNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];return n.dy` <hat-graph-branch tabindex="${void 0===r?"-1":"0"}" @focus="${this._selectNode(e,t)}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}"> <div class="graph-container" ?track="${t in this.trace.trace}"> <hat-graph-node .graphStart="${i}" .iconPath="${H}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" slot="head" nofocus></hat-graph-node> ${(0,o.r)(e.sequence).map(((i,r)=>this._renderActionNode(i,`${t}/sequence/${r}`,!1,a||!1===e.enabled)))} </div> </hat-graph-branch> `}},{kind:"method",key:"_renderParallelNode",value:function(e,t,i=!1,a=!1){const r=this.trace.trace[t];return n.dy` <hat-graph-branch tabindex="${void 0===r?"-1":"0"}" @focus="${this._selectNode(e,t)}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}"> <hat-graph-node .graphStart="${i}" .iconPath="${I}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .notEnabled="${a||!1===e.enabled}" slot="head" nofocus></hat-graph-node> ${(0,o.r)(e.parallel).map(((i,r)=>"sequence"in i?n.dy`<div ?track="${t in this.trace.trace}"> ${(0,o.r)(i.sequence).map(((i,n)=>this._renderActionNode(i,`${t}/parallel/${r}/sequence/${n}`,!1,a||!1===e.enabled)))} </div>`:this._renderActionNode(i,`${t}/parallel/${r}/sequence/0`,!1,a||!1===e.enabled)))} </hat-graph-branch> `}},{kind:"method",key:"_renderOtherNode",value:function(e,t,i=!1,a=!1){return n.dy` <hat-graph-node .graphStart="${i}" .iconPath="${g.du[(0,l.Pw)(e)]||V}" @focus="${this._selectNode(e,t)}" ?track="${t in this.trace.trace}" ?active="${this.selected===t}" .error="${this.trace.trace[t]?.some((e=>e.error))}" .notEnabled="${a||!1===e.enabled}"></hat-graph-node> `}},{kind:"method",key:"render",value:function(){const e="triggers"in this.trace.config?"triggers":"trigger",t="conditions"in this.trace.config?"conditions":"condition",i="actions"in this.trace.config?"actions":"action",a=Object.keys(this.trackedNodes),r=e in this.trace.config?(0,d.Kc)((0,o.r)(this.trace.config[e])).map(((e,t)=>this._renderTrigger(e,t))):void 0;try{return n.dy` <div class="parent graph-container"> ${r?n.dy`<hat-graph-branch start .short="${r.length<2}"> ${r} </hat-graph-branch>`:""} ${t in this.trace.config?n.dy`${(0,o.r)(this.trace.config[t])?.map(((e,t)=>this._renderCondition(e,t)))}`:""} ${i in this.trace.config?n.dy`${(0,o.r)(this.trace.config[i]).map(((e,t)=>this._renderActionNode(e,`action/${t}`)))}`:""} ${"sequence"in this.trace.config?n.dy`${(0,o.r)(this.trace.config.sequence).map(((e,t)=>this._renderActionNode(e,`sequence/${t}`,0===t)))}`:""} </div> <div class="actions"> <ha-icon-button .disabled="${0===a.length||a[0]===this.selected}" @click="${this._previousTrackedNode}" .path="${C}"></ha-icon-button> <ha-icon-button .disabled="${0===a.length||a[a.length-1]===this.selected}" @click="${this._nextTrackedNode}" .path="${L}"></ha-icon-button> </div> `}catch(e){return n.dy` <div class="error"> Error rendering graph. Please download trace and share with the developers. </div> `}}},{kind:"method",key:"willUpdate",value:function(e){(0,r.Z)(i,"willUpdate",this,3)([e]),e.has("trace")&&(this.renderedNodes={},this.trackedNodes={})}},{kind:"method",key:"updated",value:function(e){if((0,r.Z)(i,"updated",this,3)([e]),e.has("trace")){if(!this.selected||!(this.selected in this.trackedNodes)){const e=this.trackedNodes[Object.keys(this.trackedNodes)[0]];e&&(0,c.B)(this,"graph-node-selected",e)}if(this.trace){const e=Object.keys(this.trace.trace),t=Object.keys(this.renderedNodes).sort(((t,i)=>e.indexOf(t)-e.indexOf(i))),i={},a={};for(const e of t)a[e]=this.renderedNodes[e],e in this.trackedNodes&&(i[e]=this.trackedNodes[e]);this.renderedNodes=a,this.trackedNodes=i}}}},{kind:"method",key:"_previousTrackedNode",value:function(){const e=Object.keys(this.trackedNodes),t=e.indexOf(this.selected)-1;t>=0&&(0,c.B)(this,"graph-node-selected",this.trackedNodes[e[t]])}},{kind:"method",key:"_nextTrackedNode",value:function(){const e=Object.keys(this.trackedNodes),t=e.indexOf(this.selected)+1;t<e.length&&(0,c.B)(this,"graph-node-selected",this.trackedNodes[e[t]])}},{kind:"get",static:!0,key:"styles",value:function(){return n.iv`:host{display:flex;--stroke-clr:var(--stroke-color, var(--secondary-text-color));--active-clr:var(--active-color, var(--primary-color));--track-clr:var(--track-color, var(--accent-color));--hover-clr:var(--hover-color, var(--primary-color));--disabled-clr:var(--disabled-color, var(--disabled-text-color));--disabled-active-clr:rgba(var(--rgb-primary-color), 0.5);--disabled-hover-clr:rgba(var(--rgb-primary-color), 0.7);--default-trigger-color:3,169,244;--rgb-trigger-color:var(--trigger-color, var(--default-trigger-color));--background-clr:var(--background-color, white);--default-icon-clr:var(--icon-color, black);--icon-clr:var(--stroke-clr);--hat-graph-spacing:${u.N_}px;--hat-graph-node-size:${u.TB}px;--hat-graph-branch-height:${u.Qs}px}.graph-container{display:flex;flex-direction:column;align-items:center}.actions{display:flex;flex-direction:column}.parent{margin-left:8px;margin-top:16px}.error{padding:16px;max-width:300px}`}}]}}),n.oi);t()}catch(e){t(e)}}))},18156:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),r=i(72621),n=(i(92745),i(9359),i(31526),i(60738)),s=i(57243),o=i(15093),c=i(20552),d=i(64214),l=i(94947),h=i(36522),u=i(90122),g=i(30635),p=i(68418),f=i(56707),k=i(75244),v=(i(12994),e([l,f,d]));[l,f,d]=v.then?(await v)():v;const b="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",m="M12,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",y="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,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",_="M13,2.03V2.05L13,4.05C17.39,4.59 20.5,8.58 19.96,12.97C19.5,16.61 16.64,19.5 13,19.93V21.93C18.5,21.38 22.5,16.5 21.95,11C21.5,6.25 17.73,2.5 13,2.03M11,2.06C9.05,2.25 7.19,3 5.67,4.26L7.1,5.74C8.22,4.84 9.57,4.26 11,4.06V2.06M4.26,5.67C3,7.19 2.25,9.04 2.05,11H4.05C4.24,9.58 4.8,8.23 5.69,7.1L4.26,5.67M2.06,13C2.26,14.96 3.03,16.81 4.27,18.33L5.69,16.9C4.81,15.77 4.24,14.42 4.06,13H2.06M7.1,18.37L5.67,19.74C7.18,21 9.04,21.79 11,22V20C9.58,19.82 8.23,19.25 7.1,18.37M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z",$="M13,2.03V2.05L13,4.05C17.39,4.59 20.5,8.58 19.96,12.97C19.5,16.61 16.64,19.5 13,19.93V21.93C18.5,21.38 22.5,16.5 21.95,11C21.5,6.25 17.73,2.5 13,2.03M11,2.06C9.05,2.25 7.19,3 5.67,4.26L7.1,5.74C8.22,4.84 9.57,4.26 11,4.06V2.06M4.26,5.67C3,7.19 2.25,9.04 2.05,11H4.05C4.24,9.58 4.8,8.23 5.69,7.1L4.26,5.67M2.06,13C2.26,14.96 3.03,16.81 4.27,18.33L5.69,16.9C4.81,15.77 4.24,14.42 4.06,13H2.06M7.1,18.37L5.67,19.74C7.18,21 9.04,21.79 11,22V20C9.58,19.82 8.23,19.25 7.1,18.37M16.82,15.19L12.71,11.08C13.12,10.04 12.89,8.82 12.03,7.97C11.13,7.06 9.78,6.88 8.69,7.38L10.63,9.32L9.28,10.68L7.29,8.73C6.75,9.82 7,11.17 7.88,12.08C8.74,12.94 9.96,13.16 11,12.76L15.11,16.86C15.29,17.05 15.56,17.05 15.74,16.86L16.78,15.83C17,15.65 17,15.33 16.82,15.19Z",x="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9Z",L=2,C=1e3,N=(e,t)=>Math.abs(t.getTime()-e.getTime())>C;class w{constructor(e,t,i){this.hass=e,this.entries=t,this.lastReportedTime=void 0,this.lastReportedTime=new Date(i.timestamp.start)}setLastReportedTime(e){this.lastReportedTime=e}renderTime(e,t){this.entries.push(s.dy` <ha-timeline label> ${(0,l.G)(e,this.hass.locale,t,!1)} later </ha-timeline> `),this.lastReportedTime=t}maybeRenderTime(e){return N(e,this.lastReportedTime)?(this.renderTime(this.lastReportedTime,e),!0):(this.lastReportedTime=e,!1)}}class V{constructor(e,t,i){this.entries=e,this.timeTracker=t,this.logbookEntries=i,this.curIndex=void 0,this.pendingItems=[],this.curIndex=i.length>0&&"automation"===i[0].domain?1:0}get curItem(){return this.logbookEntries[this.curIndex]}get hasNext(){return this.curIndex<this.logbookEntries.length}maybeRenderItem(){const e=this.curItem;this.curIndex++;const t=new Date(1e3*e.when);if(0===this.pendingItems.length)return void this.pendingItems.push([t,e]);const i=this.pendingItems[this.pendingItems.length-1][0];N(i,t)&&(this._renderLogbookEntries(),this.timeTracker.renderTime(i,t)),this.pendingItems.push([t,e])}flush(){this.pendingItems.length>0&&this._renderLogbookEntries()}_renderLogbookEntries(){this.timeTracker.maybeRenderTime(this.pendingItems[0][0]);const e=[];let t,i;for(t=0;t<Math.min(this.pendingItems.length,L);t++)e.push(this._renderLogbookEntryHelper(this.pendingItems[t][1]));if(t<this.pendingItems.length)for(i=[];t<this.pendingItems.length;t++)i.push(this._renderLogbookEntryHelper(this.pendingItems[t][1]));this.entries.push(s.dy` <ha-timeline .icon="${y}" .moreItems="${i}"> ${e} </ha-timeline> `),this.timeTracker.setLastReportedTime(this.pendingItems[this.pendingItems.length-1][0]),this.pendingItems=[]}_renderLogbookEntryHelper(e){return s.dy`${e.name} (${e.entity_id}) ${e.message||`turned ${e.state}`}<br>`}}class H{constructor(e,t,i,a,r,n,s,o){this.hass=e,this.entityReg=t,this.labelReg=i,this.floorReg=a,this.entries=r,this.trace=n,this.logbookRenderer=s,this.timeTracker=o,this.curIndex=0,this.keys=void 0,this.keys=Object.keys(n.trace)}get curItem(){return this._getItem(this.curIndex)}get hasNext(){return this.curIndex<this.keys.length}renderItem(){this.curIndex=this._renderItem(this.curIndex)}_getItem(e){return this.trace.trace[this.keys[e]]}_renderItem(e,t,i){const a=this._getItem(e);if(i){let i=0;return a.forEach((a=>{i=this._renderIteration(e,a,t)})),i}return this._renderIteration(e,a[0],t)}_renderIteration(e,t,i){if((0,k.Zm)(t.path))return this._handleTrigger(e,t);const a=new Date(t.timestamp);for(;this.logbookRenderer.hasNext&&new Date(1e3*this.logbookRenderer.curItem.when)<a;)this.logbookRenderer.maybeRenderItem();this.logbookRenderer.flush(),this.timeTracker.maybeRenderTime(a);const r=t.path;let n;try{n=(0,k.nV)(this.trace.config,r)}catch(t){return this._renderEntry(r,this.hass.localize("ui.panel.config.automation.trace.messages.path_error",{path:r})),e+1}const s=r.split("/");if(!(2===s.length)&&!i)return this._renderEntry(r,r.replace(/\//g," ")),e+1;if(i||(i=(0,p.Pw)(n)),"choose"===i)return this._handleChoose(e);if("repeat"===i)return this._handleRepeat(e);if("if"===i)return this._handleIf(e);if("sequence"===i)return this._handleSequence(e);if("parallel"===i)return this._handleParallel(e);this._renderEntry(r,(0,f.Q)(this.hass,this.entityReg,this.labelReg,this.floorReg,n,i),void 0,!1===n.enabled);let o=e+1;for(;o<this.keys.length&&this.keys[o].split("/").length!==s.length;o++);return o}_handleTrigger(e,t){return this._renderEntry(t.path,this.hass.localize("ui.panel.config.automation.trace.messages.triggered_by",{triggeredBy:t.changed_variables.trigger?.alias?"alias":"other",alias:t.changed_variables.trigger?.alias,triggeredPath:"trigger"===t.path?"manual":"trigger",trigger:this.trace.trigger,time:(0,d.E8)(new Date(t.timestamp),this.hass.locale,this.hass.config)}),m),e+1}_handleChoose(e){const t=this.keys[e],i=t.split("/").length,a=this._getItem(e)[0],r="default"===a.result?.choice,n=this._getDataFromPath(this.keys[e]),s=!1===n.enabled,o=n.alias||this.hass.localize("ui.panel.config.automation.trace.messages.choose");if(r)this._renderEntry(t,this.hass.localize("ui.panel.config.automation.trace.messages.default_action_executed",{name:o}),void 0,s);else if(a.result){const i="default"!==a.result.choice?a.result.choice+1:void 0,r=this._getDataFromPath(`${this.keys[e]}/choose/${a.result.choice}`),n=r?`${r.alias||this.hass.localize("ui.panel.config.automation.trace.messages.option_executed",{option:i})}`:this.hass.localize("ui.panel.config.automation.trace.messages.error",{error:a.error});this._renderEntry(t,`${o}: ${n}`,void 0,s)}else this._renderEntry(t,this.hass.localize("ui.panel.config.automation.trace.messages.no_action_executed",{name:o}),void 0,s);let c;for(c=e+1;c<this.keys.length;c++){const e=this.keys[c].split("/");if(e.length<=i)return c;if(r&&"default"===e[i+1]||!r&&"sequence"===e[i+3])break}for(;c<this.keys.length;){const e=this.keys[c];if(e.split("/").length<=i)return c;c=this._renderItem(c,(0,p.Pw)(this._getDataFromPath(e)))}return c}_handleRepeat(e){const t=this.keys[e],i=t.split("/").length,a=this._getDataFromPath(this.keys[e]),r=!1===a.enabled,n=a.alias||(0,f.Q)(this.hass,this.entityReg,this.labelReg,this.floorReg,a);let s;for(this._renderEntry(t,n,void 0,r),s=e+1;s<this.keys.length;s++){const e=this.keys[s];if(e.split("/").length<=i)return s;s=this._renderItem(s,(0,p.Pw)(this._getDataFromPath(e)),!0)}return s}_handleIf(e){const t=this.keys[e],i=t.split("/").length,a=this._getItem(e)[0],r=this._getDataFromPath(this.keys[e]),n=!1===r.enabled,s=r.alias||this.hass.localize("ui.panel.config.automation.trace.messages.if");if(a.result?.choice){const i=this._getDataFromPath(`${this.keys[e]}/${a.result.choice}/`),r=i?i.alias||this.hass.localize("ui.panel.config.automation.trace.messages.action_executed",{action:a.result.choice}):this.hass.localize("ui.panel.config.automation.trace.messages.error",{error:a.error});this._renderEntry(t,`${s}: ${r}`,void 0,n)}else this._renderEntry(t,this.hass.localize("ui.panel.config.automation.trace.messages.no_action_executed",{name:s}),void 0,n);let o;for(o=e+1;o<this.keys.length;o++){const e=this.keys[o],t=this.keys[o].split("/");if(t.length<=i)return o;"condition"===t[i+1]||t.length<i+2||(o=this._renderItem(o,(0,p.Pw)(this._getDataFromPath(e))))}return o}_handleSequence(e){const t=this.keys[e],i=this._getDataFromPath(this.keys[e]);let a;for(this._renderEntry(t,i.alias||(0,f.Q)(this.hass,this.entityReg,this.labelReg,this.floorReg,i,"sequence"),void 0,!1===i.enabled),a=e+1;a<this.keys.length;a++){const e=this.keys[a];this._renderItem(a,(0,p.Pw)(this._getDataFromPath(e)))}return a}_handleParallel(e){const t=this.keys[e],i=t.split("/").length,a=this._getDataFromPath(this.keys[e]),r=!1===a.enabled,n=a.alias||this.hass.localize("ui.panel.config.automation.trace.messages.execute_in_parallel");let s;for(this._renderEntry(t,n,void 0,r),s=e+1;s<this.keys.length;s++){const e=this.keys[s];if(e.split("/").length<=i)return s;s=this._renderItem(s,(0,p.Pw)(this._getDataFromPath(e)))}return s}_renderEntry(e,t,i=x,a=!1){this.entries.push(s.dy` <ha-timeline .icon="${i}" data-path="${e}" .notEnabled="${a}"> ${t}${a?s.dy`<span class="disabled"> ${this.hass.localize("ui.panel.config.automation.trace.messages.disabled")}</span>`:""} </ha-timeline> `)}_getDataFromPath(e){return(0,k.nV)(this.trace.config,e)}}(0,a.Z)([(0,o.Mo)("hat-trace-timeline")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"trace",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"logbookEntries",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"selectedPath",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"allow-pick",type:Boolean})],key:"allowPick",value:()=>!1},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:g.we,subscribe:!0})],key:"_entityReg",value:void 0},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:g.TD,subscribe:!0})],key:"_labelReg",value:void 0},{kind:"field",decorators:[(0,o.SB)(),(0,n.F_)({context:g.WC,subscribe:!0})],key:"_floorReg",value:void 0},{kind:"method",key:"render",value:function(){if(!this.trace)return s.Ld;const e=[],t=new w(this.hass,e,this.trace),i=new V(e,t,this.logbookEntries||[]),a=new H(this.hass,this._entityReg,this._labelReg,this._floorReg,e,this.trace,i,t);for(;a.hasNext;)a.renderItem();for(;i.hasNext;)i.maybeRenderItem();i.flush();const r=()=>(0,d.E8)(new Date(this.trace.timestamp.finish),this.hass.locale,this.hass.config),n=()=>((new Date(this.trace.timestamp.finish).getTime()-new Date(this.trace.timestamp.start).getTime())/1e3).toFixed(2);let o;if("running"===this.trace.state)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.still_running"),icon:_};else if("debugged"===this.trace.state)o={description:this.hass.localize("ui.panel.config.automation.trace.messages.debu