iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 34.6 kB
JavaScript
export const __webpack_ids__=["45991"];export const __webpack_modules__={50602:function(e,t,i){i.a(e,(async function(e,a){try{i.d(t,{SL:()=>s,l4:()=>u,sJ:()=>l,uf:()=>h});var o=i(16485),n=i(20382),r=i(34618),d=e([o]);o=(d.then?(await d)():d)[0];const s=e=>l(e.attributes),l=(e,t)=>!!e.unit_of_measurement||!!e.state_class||(t||[]).includes(e.device_class||""),c=e=>{switch(e.number_format){case n.y4.comma_decimal:return["en-US","en"];case n.y4.decimal_comma:return["de","es","it"];case n.y4.space_comma:return["fr","sv","cs"];case n.y4.system:return;default:return e.language}},h=(e,t,i)=>{const a=t?c(t):void 0;return Number.isNaN=Number.isNaN||function e(t){return"number"==typeof t&&e(t)},t?.number_format===n.y4.none||Number.isNaN(Number(e))?Number.isNaN(Number(e))||""===e||t?.number_format!==n.y4.none?"string"==typeof e?e:`${(0,r.N)(e,i?.maximumFractionDigits).toString()}${"currency"===i?.style?` ${i.currency}`:""}`:new Intl.NumberFormat("en-US",p(e,{...i,useGrouping:!1})).format(Number(e)):new Intl.NumberFormat(a,p(e,i)).format(Number(e))},u=(e,t)=>{const i=t?.display_precision;return null!=i?{maximumFractionDigits:i,minimumFractionDigits:i}:Number.isInteger(Number(e?.attributes?.step))&&Number.isInteger(Number(e?.state))?{maximumFractionDigits:0}:void 0},p=(e,t)=>{const i={maximumFractionDigits:2,...t};if("string"!=typeof e)return i;if(!t||void 0===t.minimumFractionDigits&&void 0===t.maximumFractionDigits){const t=e.indexOf(".")>-1?e.split(".")[1].length:0;i.minimumFractionDigits=t,i.maximumFractionDigits=t}return i};a()}catch(e){a(e)}}))},34618:function(e,t,i){i.d(t,{N:()=>a});const a=(e,t=2)=>Math.round(e*10**t)/10**t},87865:function(e,t,i){i.d(t,{v:()=>a});const a=async(e,t)=>{if(navigator.clipboard)try{return void await navigator.clipboard.writeText(e)}catch{}const i=t??document.body,a=document.createElement("textarea");a.value=e,i.appendChild(a),a.select(),document.execCommand("copy"),i.removeChild(a)}},54977:function(e,t,i){var a=i(44249),o=i(57243),n=i(15093);(0,a.Z)([(0,n.Mo)("ha-card")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)()],key:"header",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"raised",value:()=>!1},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{background:var(--ha-card-background,var(--card-background-color,#fff));-webkit-backdrop-filter:var(--ha-card-backdrop-filter,none);backdrop-filter:var(--ha-card-backdrop-filter,none);box-shadow:var(--ha-card-box-shadow,none);box-sizing:border-box;border-radius:var(--ha-card-border-radius,12px);border-width:var(--ha-card-border-width,1px);border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0));color:var(--primary-text-color);display:block;transition:all .3s ease-out;position:relative}:host([raised]){border:none;box-shadow:var(--ha-card-box-shadow,0px 2px 1px -1px rgba(0,0,0,.2),0px 1px 1px 0px rgba(0,0,0,.14),0px 1px 3px 0px rgba(0,0,0,.12))}.card-header,:host ::slotted(.card-header){color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:var(--ha-card-header-font-size, 24px);letter-spacing:-.012em;line-height:48px;padding:12px 16px 16px;display:block;margin-block-start:0px;margin-block-end:0px;font-weight:400}:host ::slotted(.card-content:not(:first-child)),slot:not(:first-child)::slotted(.card-content){padding-top:0px;margin-top:-8px}:host ::slotted(.card-content){padding:16px}:host ::slotted(.card-actions){border-top:1px solid var(--divider-color,#e8e8e8);padding:5px 16px}`},{kind:"method",key:"render",value:function(){return o.dy` ${this.header?o.dy`<h1 class="card-header">${this.header}</h1>`:o.Ld} <slot></slot> `}}]}}),o.oi)},68325:function(e,t,i){var a=i(44249),o=i(72621),n=(i(92745),i(9359),i(70104),i(57243)),r=i(15093),d=i(27486),s=i(36522),l=i(49976);i(65981);const c={key:"Mod-s",run:e=>((0,s.B)(e.dom,"editor-save"),!0)},h=e=>{const t=document.createElement("ha-icon");return t.icon=e.label,t};(0,a.Z)([(0,r.Mo)("ha-code-editor")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",key:"codemirror",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"mode",value:()=>"yaml"},{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({attribute:"read-only",type:Boolean})],key:"readOnly",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"linewrap",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,attribute:"autocomplete-entities"})],key:"autocompleteEntities",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,attribute:"autocomplete-icons"})],key:"autocompleteIcons",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"error",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_value",value:()=>""},{kind:"field",key:"_loadedCodeMirror",value:void 0},{kind:"field",key:"_iconList",value:void 0},{kind:"set",key:"value",value:function(e){this._value=e}},{kind:"get",key:"value",value:function(){return this.codemirror?this.codemirror.state.doc.toString():this._value}},{kind:"get",key:"hasComments",value:function(){if(!this.codemirror||!this._loadedCodeMirror)return!1;const e=this._loadedCodeMirror.highlightingFor(this.codemirror.state,[this._loadedCodeMirror.tags.comment]);return!!this.renderRoot.querySelector(`span.${e}`)}},{kind:"method",key:"connectedCallback",value:function(){(0,o.Z)(a,"connectedCallback",this,3)([]),this.hasUpdated&&this.requestUpdate(),this.addEventListener("keydown",l.U),this.codemirror&&!1!==this.autofocus&&this.codemirror.focus()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(a,"disconnectedCallback",this,3)([]),this.removeEventListener("keydown",l.U),this.updateComplete.then((()=>{this.codemirror.destroy(),delete this.codemirror}))}},{kind:"method",key:"scheduleUpdate",value:async function(){this._loadedCodeMirror??=await Promise.all([i.e("83895"),i.e("93505"),i.e("51403"),i.e("84729")]).then(i.bind(i,2765)),(0,o.Z)(a,"scheduleUpdate",this,3)([])}},{kind:"method",key:"update",value:function(e){if((0,o.Z)(a,"update",this,3)([e]),!this.codemirror)return void this._createCodeMirror();const t=[];e.has("mode")&&t.push({effects:[this._loadedCodeMirror.langCompartment.reconfigure(this._mode),this._loadedCodeMirror.foldingCompartment.reconfigure(this._getFoldingExtensions())]}),e.has("readOnly")&&t.push({effects:this._loadedCodeMirror.readonlyCompartment.reconfigure(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly))}),e.has("linewrap")&&t.push({effects:this._loadedCodeMirror.linewrapCompartment.reconfigure(this.linewrap?this._loadedCodeMirror.EditorView.lineWrapping:[])}),e.has("_value")&&this._value!==this.value&&t.push({changes:{from:0,to:this.codemirror.state.doc.length,insert:this._value}}),t.length>0&&this.codemirror.dispatch(...t),e.has("error")&&this.classList.toggle("error-state",this.error)}},{kind:"get",key:"_mode",value:function(){return this._loadedCodeMirror.langs[this.mode]}},{kind:"method",key:"_createCodeMirror",value:function(){if(!this._loadedCodeMirror)throw new Error("Cannot create editor before CodeMirror is loaded");const e=[this._loadedCodeMirror.lineNumbers(),this._loadedCodeMirror.history(),this._loadedCodeMirror.drawSelection(),this._loadedCodeMirror.EditorState.allowMultipleSelections.of(!0),this._loadedCodeMirror.rectangularSelection(),this._loadedCodeMirror.crosshairCursor(),this._loadedCodeMirror.highlightSelectionMatches(),this._loadedCodeMirror.highlightActiveLine(),this._loadedCodeMirror.indentationMarkers({thickness:0,activeThickness:1,colors:{activeLight:"var(--secondary-text-color)",activeDark:"var(--secondary-text-color)"}}),this._loadedCodeMirror.keymap.of([...this._loadedCodeMirror.defaultKeymap,...this._loadedCodeMirror.searchKeymap,...this._loadedCodeMirror.historyKeymap,...this._loadedCodeMirror.tabKeyBindings,c]),this._loadedCodeMirror.langCompartment.of(this._mode),this._loadedCodeMirror.haTheme,this._loadedCodeMirror.haSyntaxHighlighting,this._loadedCodeMirror.readonlyCompartment.of(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly)),this._loadedCodeMirror.linewrapCompartment.of(this.linewrap?this._loadedCodeMirror.EditorView.lineWrapping:[]),this._loadedCodeMirror.EditorView.updateListener.of(this._onUpdate),this._loadedCodeMirror.foldingCompartment.of(this._getFoldingExtensions())];if(!this.readOnly){const t=[];this.autocompleteEntities&&this.hass&&t.push(this._entityCompletions.bind(this)),this.autocompleteIcons&&t.push(this._mdiCompletions.bind(this)),t.length>0&&e.push(this._loadedCodeMirror.autocompletion({override:t,maxRenderedOptions:10}))}this.codemirror=new this._loadedCodeMirror.EditorView({state:this._loadedCodeMirror.EditorState.create({doc:this._value,extensions:e}),parent:this.renderRoot})}},{kind:"field",key:"_getStates",value:()=>(0,d.Z)((e=>{if(!e)return[];return Object.keys(e).map((t=>({type:"variable",label:t,detail:e[t].attributes.friendly_name,info:`State: ${e[t].state}`})))}))},{kind:"method",key:"_entityCompletions",value:function(e){const t=e.matchBefore(/[a-z_]{3,}\.\w*/);if(!t||t.from===t.to&&!e.explicit)return null;const i=this._getStates(this.hass.states);return i&&i.length?{from:Number(t.from),options:i,validFor:/^[a-z_]{3,}\.\w*$/}:null}},{kind:"field",key:"_getIconItems",value(){return async()=>{if(!this._iconList){let e;e=(await i.e("25016").then(i.t.bind(i,58134,19))).default,this._iconList=e.map((e=>({type:"variable",label:`mdi:${e.name}`,detail:e.keywords.join(", "),info:h})))}return this._iconList}}},{kind:"method",key:"_mdiCompletions",value:async function(e){const t=e.matchBefore(/mdi:\S*/);if(!t||t.from===t.to&&!e.explicit)return null;const i=await this._getIconItems();return{from:Number(t.from),options:i,validFor:/^mdi:\S*$/}}},{kind:"field",key:"_onUpdate",value(){return e=>{e.docChanged&&(this._value=e.state.doc.toString(),(0,s.B)(this,"value-changed",{value:this._value}))}}},{kind:"field",key:"_getFoldingExtensions",value(){return()=>"yaml"===this.mode?[this._loadedCodeMirror.foldGutter(),this._loadedCodeMirror.foldingOnIndent]:[]}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host(.error-state) .cm-gutters{border-color:var(--error-state-color,red)}`}]}}),n.fl)},41307:function(e,t,i){var a=i(44249),o=i(72621),n=i(57243),r=i(15093),d=i(35359),s=i(36522),l=i(76320);i(37583);(0,a.Z)([(0,r.Mo)("ha-expansion-panel")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"expanded",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"outlined",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({attribute:"left-chevron",type:Boolean,reflect:!0})],key:"leftChevron",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({attribute:"no-collapse",type:Boolean,reflect:!0})],key:"noCollapse",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)()],key:"header",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"secondary",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_showContent",value(){return this.expanded}},{kind:"field",decorators:[(0,r.IO)(".container")],key:"_container",value:void 0},{kind:"method",key:"render",value:function(){const e=this.noCollapse?n.Ld:n.dy` <ha-svg-icon .path="${"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"}" class="summary-icon ${(0,d.$)({expanded:this.expanded})}"></ha-svg-icon> `;return n.dy` <div class="top ${(0,d.$)({expanded:this.expanded})}"> <div id="summary" class="${(0,d.$)({noCollapse:this.noCollapse})}" ="${this._toggleContainer}" ="${this._toggleContainer}" ="${this._focusChanged}" ="${this._focusChanged}" role="button" tabindex="${this.noCollapse?-1:0}" aria-expanded="${this.expanded}" aria-controls="sect1"> ${this.leftChevron?e:n.Ld} <slot name="leading-icon"></slot> <slot name="header"> <div class="header"> ${this.header} <slot class="secondary" name="secondary">${this.secondary}</slot> </div> </slot> ${this.leftChevron?n.Ld:e} <slot name="icons"></slot> </div> </div> <div class="container ${(0,d.$)({expanded:this.expanded})}" ="${this._handleTransitionEnd}" role="region" aria-labelledby="summary" aria-hidden="${!this.expanded}" tabindex="-1"> ${this._showContent?n.dy`<slot></slot>`:""} </div> `}},{kind:"method",key:"willUpdate",value:function(e){(0,o.Z)(i,"willUpdate",this,3)([e]),e.has("expanded")&&(this._showContent=this.expanded,setTimeout((()=>{this._container.style.overflow=this.expanded?"initial":"hidden"}),300))}},{kind:"method",key:"_handleTransitionEnd",value:function(){this._container.style.removeProperty("height"),this._container.style.overflow=this.expanded?"initial":"hidden",this._showContent=this.expanded}},{kind:"method",key:"_toggleContainer",value:async function(e){if(e.defaultPrevented)return;if("keydown"===e.type&&"Enter"!==e.key&&" "!==e.key)return;if(e.preventDefault(),this.noCollapse)return;const t=!this.expanded;(0,s.B)(this,"expanded-will-change",{expanded:t}),this._container.style.overflow="hidden",t&&(this._showContent=!0,await(0,l.y)());const i=this._container.scrollHeight;this._container.style.height=`${i}px`,t||setTimeout((()=>{this._container.style.height="0px"}),0),this.expanded=t,(0,s.B)(this,"expanded-changed",{expanded:this.expanded})}},{kind:"method",key:"_focusChanged",value:function(e){this.noCollapse||this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host{display:block}.top{display:flex;align-items:center;border-radius:var(--ha-card-border-radius,12px)}.top.expanded{border-bottom-left-radius:0px;border-bottom-right-radius:0px}.top.focused{background:var(--input-fill-color)}:host([outlined]){box-shadow:none;border-width:1px;border-style:solid;border-color:var(--outline-color);border-radius:var(--ha-card-border-radius,12px)}.summary-icon{transition:transform 150ms cubic-bezier(.4, 0, .2, 1);direction:var(--direction);margin-left:8px;margin-inline-start:8px;margin-inline-end:initial}::slotted([slot=leading-icon]),:host([left-chevron]) .summary-icon{margin-left:0;margin-right:8px;margin-inline-start:0;margin-inline-end:8px}#summary{flex:1;display:flex;padding:var(--expansion-panel-summary-padding,0 8px);min-height:48px;align-items:center;cursor:pointer;overflow:hidden;font-weight:500;outline:0}#summary.noCollapse{cursor:default}.summary-icon.expanded{transform:rotate(180deg)}.header,::slotted([slot=header]){flex:1}.container{padding:var(--expansion-panel-content-padding,0 8px);overflow:hidden;transition:height .3s cubic-bezier(.4, 0, .2, 1);height:0px}.container.expanded{height:auto}.secondary{display:block;color:var(--secondary-text-color);font-size:12px}`}]}}),n.oi)},65981:function(e,t,i){i.r(t),i.d(t,{HaIcon:()=>_});var a=i(44249),o=i(72621),n=i(57243),r=i(15093),d=i(36522),s=i(22381),l=i(80654),c=(i(92745),i(9359),i(31526),i(27608)),h=i(27486),u=i(37394);const p=JSON.parse('{"version":"7.4.47","parts":[{"file":"7a7139d465f1f41cb26ab851a17caa21a9331234"},{"start":"account-supervisor-circle-","file":"9561286c4c1021d46b9006596812178190a7cc1c"},{"start":"alpha-r-c","file":"eb466b7087fb2b4d23376ea9bc86693c45c500fa"},{"start":"arrow-decision-o","file":"4b3c01b7e0723b702940c5ac46fb9e555646972b"},{"start":"baby-f","file":"2611401d85450b95ab448ad1d02c1a432b409ed2"},{"start":"battery-hi","file":"89bcd31855b34cd9d31ac693fb073277e74f1f6a"},{"start":"blur-r","file":"373709cd5d7e688c2addc9a6c5d26c2d57c02c48"},{"start":"briefcase-account-","file":"a75956cf812ee90ee4f656274426aafac81e1053"},{"start":"calendar-question-","file":"3253f2529b5ebdd110b411917bacfacb5b7063e6"},{"start":"car-lig","file":"74566af3501ad6ae58ad13a8b6921b3cc2ef879d"},{"start":"cellphone-co","file":"7677f1cfb2dd4f5562a2aa6d3ae43a2e6997b21a"},{"start":"circle-slice-2","file":"70d08c50ec4522dd75d11338db57846588263ee2"},{"start":"cloud-co","file":"141d2bfa55ca4c83f4bae2812a5da59a84fec4ff"},{"start":"cog-s","file":"5a640365f8e47c609005d5e098e0e8104286d120"},{"start":"cookie-l","file":"dd85b8eb8581b176d3acf75d1bd82e61ca1ba2fc"},{"start":"currency-eur-","file":"15362279f4ebfc3620ae55f79d2830ad86d5213e"},{"start":"delete-o","file":"239434ab8df61237277d7599ebe066c55806c274"},{"start":"draw-","file":"5605918a592070803ba2ad05a5aba06263da0d70"},{"start":"emoticon-po","file":"a838cfcec34323946237a9f18e66945f55260f78"},{"start":"fan","file":"effd56103b37a8c7f332e22de8e4d67a69b70db7"},{"start":"file-question-","file":"b2424b50bd465ae192593f1c3d086c5eec893af8"},{"start":"flask-off-","file":"3b76295cde006a18f0301dd98eed8c57e1d5a425"},{"start":"food-s","file":"1c6941474cbeb1755faaaf5771440577f4f1f9c6"},{"start":"gamepad-u","file":"c6efe18db6bc9654ae3540c7dee83218a5450263"},{"start":"google-f","file":"df341afe6ad4437457cf188499cb8d2df8ac7b9e"},{"start":"head-c","file":"282121c9e45ed67f033edcc1eafd279334c00f46"},{"start":"home-pl","file":"27e8e38fc7adcacf2a210802f27d841b49c8c508"},{"start":"inbox-","file":"0f0316ec7b1b7f7ce3eaabce26c9ef619b5a1694"},{"start":"key-v","file":"ea33462be7b953ff1eafc5dac2d166b210685a60"},{"start":"leaf-circle-","file":"33db9bbd66ce48a2db3e987fdbd37fb0482145a4"},{"start":"lock-p","file":"b89e27ed39e9d10c44259362a4b57f3c579d3ec8"},{"start":"message-s","file":"7b5ab5a5cadbe06e3113ec148f044aa701eac53a"},{"start":"moti","file":"01024d78c248d36805b565e343dd98033cc3bcaf"},{"start":"newspaper-variant-o","file":"22a6ec4a4fdd0a7c0acaf805f6127b38723c9189"},{"start":"on","file":"c73d55b412f394e64632e2011a59aa05e5a1f50d"},{"start":"paw-ou","file":"3f669bf26d16752dc4a9ea349492df93a13dcfbf"},{"start":"pigg","file":"0c24edb27eb1c90b6e33fc05f34ef3118fa94256"},{"start":"printer-pos-sy","file":"41a55cda866f90b99a64395c3bb18c14983dcf0a"},{"start":"read","file":"c7ed91552a3a64c9be88c85e807404cf705b7edf"},{"start":"robot-vacuum-variant-o","file":"917d2a35d7268c0ea9ad9ecab2778060e19d90e0"},{"start":"sees","file":"6e82d9861d8fac30102bafa212021b819f303bdb"},{"start":"shoe-f","file":"e2fe7ce02b5472301418cc90a0e631f187b9f238"},{"start":"snowflake-m","file":"a28ba9f5309090c8b49a27ca20ff582a944f6e71"},{"start":"st","file":"7e92d03f095ec27e137b708b879dfd273bd735ab"},{"start":"su","file":"61c74913720f9de59a379bdca37f1d2f0dc1f9db"},{"start":"tag-plus-","file":"8f3184156a4f38549cf4c4fffba73a6a941166ae"},{"start":"timer-a","file":"baab470d11cfb3a3cd3b063ee6503a77d12a80d0"},{"start":"transit-d","file":"8561c0d9b1ac03fab360fd8fe9729c96e8693239"},{"start":"vector-arrange-b","file":"c9a3439257d4bab33d3355f1f2e11842e8171141"},{"start":"water-ou","file":"02dbccfb8ca35f39b99f5a085b095fc1275005a0"},{"start":"webc","file":"57bafd4b97341f4f2ac20a609d023719f23a619c"},{"start":"zip","file":"65ae094e8263236fa50486584a08c03497a38d93"}]}'),f=(0,h.Z)((async()=>{const e=(0,c.MT)("hass-icon-db","mdi-icon-store");{const t=await(0,c.U2)("_version",e);t?t!==p.version&&(await(0,c.ZH)(e),(0,c.t8)("_version",p.version,e)):(0,c.t8)("_version",p.version,e)}return e})),v=["mdi","hass","hassio","hademo"];let m=[];i(37583);const y={},b={},g=(0,s.D)((()=>(async e=>{const t=Object.keys(e),i=await Promise.all(Object.values(e));(await f())("readwrite",(a=>{i.forEach(((i,o)=>{Object.entries(i).forEach((([e,t])=>{a.put(t,e)})),delete e[t[o]]}))}))})(b)),2e3),k={};let _=(0,a.Z)([(0,r.Mo)("ha-icon")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",decorators:[(0,r.Cb)()],key:"icon",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_path",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_secondaryPath",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_viewBox",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_legacy",value:()=>!1},{kind:"method",key:"willUpdate",value:function(e){(0,o.Z)(a,"willUpdate",this,3)([e]),e.has("icon")&&(this._path=void 0,this._secondaryPath=void 0,this._viewBox=void 0,this._loadIcon())}},{kind:"method",key:"render",value:function(){return this.icon?this._legacy?n.dy` <iron-icon .icon="${this.icon}"></iron-icon>`:n.dy`<ha-svg-icon .path="${this._path}" .secondaryPath="${this._secondaryPath}" .viewBox="${this._viewBox}"></ha-svg-icon>`:n.Ld}},{kind:"method",key:"_loadIcon",value:async function(){if(!this.icon)return;const e=this.icon,[t,a]=this.icon.split(":",2);let o,n=a;if(!t||!n)return;if(!v.includes(t)){const i=l.g[t];return i?void(i&&"function"==typeof i.getIcon&&this._setCustomPath(i.getIcon(n),e)):void(this._legacy=!0)}if(this._legacy=!1,n in y){const e=y[n];let i;e.newName?(i=`Icon ${t}:${n} was renamed to ${t}:${e.newName}, please change your config, it will be removed in version ${e.removeIn}.`,n=e.newName):i=`Icon ${t}:${n} was removed from MDI, please replace this icon with an other icon in your config, it will be removed in version ${e.removeIn}.`,console.warn(i),(0,d.B)(this,"write_log",{level:"warning",message:i})}if(n in k)return void(this._path=k[n]);if("home-assistant"===n){const t=(await i.e("48348").then(i.bind(i,30511))).mdiHomeAssistant;return this.icon===e&&(this._path=t),void(k[n]=t)}try{o=await(e=>new Promise(((t,i)=>{if(m.push([e,t,i]),m.length>1)return;const a=f();(0,u.n)(1e3,(async()=>{(await a)("readonly",(e=>{for(const[t,i,a]of m)(0,c.RV)(e.get(t)).then((e=>i(e))).catch((e=>a(e)));m=[]}))})()).catch((e=>{for(const[,,t]of m)t(e);m=[]}))})))(n)}catch(e){o=void 0}if(o)return this.icon===e&&(this._path=o),void(k[n]=o);const r=(e=>{let t;for(const i of p.parts){if(void 0!==i.start&&e<i.start)break;t=i}return t.file})(n);if(r in b)return void this._setPath(b[r],n,e);const s=fetch(`/static/mdi/${r}.json`).then((e=>e.json()));b[r]=s,this._setPath(s,n,e),g()}},{kind:"method",key:"_setCustomPath",value:async function(e,t){const i=await e;this.icon===t&&(this._path=i.path,this._secondaryPath=i.secondaryPath,this._viewBox=i.viewBox)}},{kind:"method",key:"_setPath",value:async function(e,t,i){const a=await e;this.icon===i&&(this._path=a[t]),k[t]=a[t]}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host{fill:currentcolor}`}]}}),n.oi)},64889:function(e,t,i){var a=i(44249),o=i(72621),n=i(76848),r=i(57243),d=i(15093),s=i(36522),l=i(28008),c=(i(68325),i(72473)),h=i(87865);i(59826);(0,a.Z)([(0,d.Mo)("ha-yaml-editor")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"yamlSchema",value:()=>n.DEFAULT_SCHEMA},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"defaultValue",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"is-valid",type:Boolean})],key:"isValid",value:()=>!0},{kind:"field",decorators:[(0,d.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"auto-update",type:Boolean})],key:"autoUpdate",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:"read-only",type:Boolean})],key:"readOnly",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:"copy-clipboard",type:Boolean})],key:"copyClipboard",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:"has-extra-actions",type:Boolean})],key:"hasExtraActions",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_yaml",value:()=>""},{kind:"field",decorators:[(0,d.IO)("ha-code-editor")],key:"_codeEditor",value:void 0},{kind:"method",key:"setValue",value:function(e){try{this._yaml=(e=>{if("object"!=typeof e||null===e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0})(e)?"":(0,n.dump)(e,{schema:this.yamlSchema,quotingType:'"',noRefs:!0})}catch(t){console.error(t,e),alert(`There was an error converting to YAML: ${t}`)}}},{kind:"method",key:"firstUpdated",value:function(){void 0!==this.defaultValue&&this.setValue(this.defaultValue)}},{kind:"method",key:"willUpdate",value:function(e){(0,o.Z)(i,"willUpdate",this,3)([e]),this.autoUpdate&&e.has("value")&&this.setValue(this.value)}},{kind:"method",key:"focus",value:function(){this._codeEditor?.codemirror&&this._codeEditor?.codemirror.focus()}},{kind:"method",key:"render",value:function(){return void 0===this._yaml?r.Ld:r.dy` ${this.label?r.dy`<p>${this.label}${this.required?" *":""}</p>`:r.Ld} <ha-code-editor .hass="${this.hass}" .value="${this._yaml}" .readOnly="${this.readOnly}" mode="yaml" autocomplete-entities autocomplete-icons .error="${!1===this.isValid}" -changed="${this._onChange}" dir="ltr"></ha-code-editor> ${this.copyClipboard||this.hasExtraActions?r.dy` <div class="card-actions"> ${this.copyClipboard?r.dy` <ha-button ="${this._copyYaml}"> ${this.hass.localize("ui.components.yaml-editor.copy_to_clipboard")} </ha-button> `:r.Ld} <slot name="extra-actions"></slot> </div> `:r.Ld} `}},{kind:"method",key:"_onChange",value:function(e){let t;e.stopPropagation(),this._yaml=e.detail.value;let i,a=!0;if(this._yaml)try{t=(0,n.load)(this._yaml,{schema:this.yamlSchema})}catch(e){a=!1,i=`${this.hass.localize("ui.components.yaml-editor.error",{reason:e.reason})}${e.mark?` (${this.hass.localize("ui.components.yaml-editor.error_location",{line:e.mark.line+1,column:e.mark.column+1})})`:""}`}else t={};this.value=t,this.isValid=a,(0,s.B)(this,"value-changed",{value:t,isValid:a,errorMsg:i})}},{kind:"get",key:"yaml",value:function(){return this._yaml}},{kind:"method",key:"_copyYaml",value:async function(){this.yaml&&(await(0,h.v)(this.yaml),(0,c.C)(this,{message:this.hass.localize("ui.common.copied_clipboard")}))}},{kind:"get",static:!0,key:"styles",value:function(){return[l.Qx,r.iv`.card-actions{border-radius:var(--actions-border-radius,0px 0px var(--ha-card-border-radius,12px) var(--ha-card-border-radius,12px));border:1px solid var(--divider-color);padding:5px 16px}ha-code-editor{flex-grow:1}`]}}]}}),r.oi)},80654:function(e,t,i){i.d(t,{g:()=>r});const a=window;"customIconsets"in a||(a.customIconsets={});const o=a.customIconsets,n=window;"customIcons"in n||(n.customIcons={});const r=new Proxy(n.customIcons,{get:(e,t)=>e[t]??(o[t]?{getIcon:o[t]}:void 0)})},99309:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),o=(i(9359),i(31526),i(57243)),n=i(15093),r=i(27486),d=i(38495),s=i(92057),l=e([s]);s=(l.then?(await l)():l)[0];(0,a.Z)([(0,n.Mo)("assist-render-pipeline-events")],(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:"events",value:void 0},{kind:"field",key:"_processEvents",value:()=>(0,r.Z)((e=>{let t;return e.forEach((e=>{t=(0,d.eP)(t,e)})),t}))},{kind:"method",key:"render",value:function(){const e=this._processEvents(this.events);return e?o.dy` <assist-render-pipeline-run .hass="${this.hass}" .pipelineRun="${e}"></assist-render-pipeline-run> `:this.events.length?o.dy`<ha-alert alert-type="error">Error showing run</ha-alert> <ha-card> <ha-expansion-panel> <span slot="header">Raw</span> <pre>${JSON.stringify(this.events,null,2)}</pre> </ha-expansion-panel> </ha-card>`:o.dy`<ha-alert alert-type="warning">There were no events in this run.</ha-alert>`}}]}}),o.oi);t()}catch(e){t(e)}}))},92057:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),o=(i(92745),i(9359),i(1331),i(70104),i(57243)),n=i(15093),r=(i(54977),i(99426),i(59826),i(17170)),d=(i(41307),i(50602)),s=(i(64889),i(76131)),l=e([r,d]);[r,d]=l.then?(await l)():l;const c={pipeline:"Pipeline",language:"Language"},h={engine:"Engine"},u={engine:"Engine"},p={engine:"Engine",language:"Language",intent_input:"Input"},f={engine:"Engine",language:"Language",voice:"Voice",tts_input:"Input"},v={ready:0,wake_word:1,stt:2,intent:3,tts:4,done:5,error:6},m=(e,t)=>e.init_options?v[e.init_options.start_stage]<=v[t]&&v[t]<=v[e.init_options.end_stage]:t in e,y=(e,t,i)=>"error"in e&&i===t?o.dy` <ha-alert alert-type="error"> ${e.error.message} (${e.error.code}) </ha-alert> `:"",b=(e,t,i,a="-start")=>{const n=t.events.find((e=>e.type===`${i}`+a)),r=t.events.find((e=>e.type===`${i}-end`));if(!n)return"";if(!r)return"error"in t?o.dy`❌`:o.dy` <ha-spinner size="small"></ha-spinner> `;const s=new Date(r.timestamp).getTime()-new Date(n.timestamp).getTime(),l=(0,d.uf)(s/1e3,e.locale,{maximumFractionDigits:2});return o.dy`${l}s ✅`},g=(e,t)=>Object.entries(t).map((([t,i])=>o.dy` <div class="row"> <div>${i}</div> <div>${e[t]}</div> </div> `)),k=(e,t)=>{const i={};let a=!1;for(const o in e)o in t||"done"===o||(a=!0,i[o]=e[o]);return a?o.dy`<ha-expansion-panel> <span slot="header">Raw</span> <ha-yaml-editor readOnly="readOnly" autoUpdate .value="${i}"></ha-yaml-editor> </ha-expansion-panel>`:""};(0,a.Z)([(0,n.Mo)("assist-render-pipeline-run")],(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:"pipelineRun",value:void 0},{kind:"method",key:"render",value:function(){const e=this.pipelineRun&&["tts","intent","stt","wake_word"].find((e=>e in this.pipelineRun))||"ready",t=[],i=(this.pipelineRun.init_options&&"text"in this.pipelineRun.init_options.input?this.pipelineRun.init_options.input.text:void 0)||this.pipelineRun?.stt?.stt_output?.text||this.pipelineRun?.intent?.intent_input;return i&&t.push({from:"user",text:i}),this.pipelineRun?.intent?.intent_output?.response?.speech?.plain?.speech&&t.push({from:"hass",text:this.pipelineRun.intent.intent_output.response.speech.plain.speech}),o.dy` <ha-card> <div class="card-content"> <div class="row heading"> <div>Run</div> <div>${this.pipelineRun.stage}</div> </div> ${g(this.pipelineRun.run,c)} ${t.length>0?o.dy` <div class="messages"> ${t.map((({from:e,text:t})=>o.dy` <div class="${`message ${e}`}">${t}</div> `))} </div> <div style="clear:both"></div> `:""} </div> </ha-card> ${y(this.pipelineRun,"ready",e)} ${m(this.pipelineRun,"wake_word")?o.dy` <ha-card> <div class="card-content"> <div class="row heading"> <span>Wake word</span> ${b(this.hass,this.pipelineRun,"wake_word")} </div> ${this.pipelineRun.wake_word?o.dy` <div class="card-content"> ${g(this.pipelineRun.wake_word,u)} ${this.pipelineRun.wake_word.wake_word_output?o.dy`<div class="row"> <div>Model</div> <div> ${this.pipelineRun.wake_word.wake_word_output.ww_id} </div> </div> <div class="row"> <div>Timestamp</div> <div> ${this.pipelineRun.wake_word.wake_word_output.timestamp} </div> </div>`:""} ${k(this.pipelineRun.wake_word,h)} </div> `:""} </div> </ha-card> `:""} ${y(this.pipelineRun,"wake_word",e)} ${m(this.pipelineRun,"stt")?o.dy` <ha-card> <div class="card-content"> <div class="row heading"> <span>Speech-to-text</span> ${b(this.hass,this.pipelineRun,"stt","-vad-end")} </div> ${this.pipelineRun.stt?o.dy` <div class="card-content"> ${g(this.pipelineRun.stt,u)} <div class="row"> <div>Language</div> <div>${this.pipelineRun.stt.metadata.language}</div> </div> ${this.pipelineRun.stt.stt_output?o.dy`<div class="row"> <div>Output</div> <div>${this.pipelineRun.stt.stt_output.text}</div> </div>`:""} ${k(this.pipelineRun.stt,u)} </div> `:""} </div> </ha-card> `:""} ${y(this.pipelineRun,"stt",e)} ${m(this.pipelineRun,"intent")?o.dy` <ha-card> <div class="card-content"> <div class="row heading"> <span>Natural Language Processing</span> ${b(this.hass,this.pipelineRun,"intent")} </div> ${this.pipelineRun.intent?o.dy` <div class="card-content"> ${g(this.pipelineRun.intent,p)} ${this.pipelineRun.intent.intent_output?o.dy`<div class="row"> <div>Response type</div> <div> ${this.pipelineRun.intent.intent_output.response.response_type} </div> </div> ${"error"===this.pipelineRun.intent.intent_output.response.response_type?o.dy`<div class="row"> <div>Error code</div> <div> ${this.pipelineRun.intent.intent_output.response.data.code} </div> </div>`:""}`:""} <div class="row"> <div>Prefer handling locally</div> <div> ${this.pipelineRun.intent.prefer_local_intents} </div> </div> <div class="row"> <div>Processed locally</div> <div> ${this.pipelineRun.intent.processed_locally} </div> </div> ${k(this.pipelineRun.intent,p)} </div> `:""} </div> </ha-card> `:""} ${y(this.pipelineRun,"intent",e)} ${m(this.pipelineRun,"tts")?o.dy` <ha-card> <div class="card-content"> <div class="row heading"> <span>Text-to-speech</span> ${b(this.hass,this.pipelineRun,"tts")} </div> ${this.pipelineRun.tts?o.dy` <div class="card-content"> ${g(this.pipelineRun.tts,f)} ${k(this.pipelineRun.tts,f)} </div> `:""} </div> ${this.pipelineRun?.tts?.tts_output?o.dy` <div class="card-actions"> <ha-button ="${this._playTTS}"> Play Audio </ha-button> </div> `:""} </ha-card> `:""} ${y(this.pipelineRun,"tts",e)} <ha-card> <ha-expansion-panel> <span slot="header">Raw</span> <ha-yaml-editor read-only auto-update .value="${this.pipelineRun}"></ha-yaml-editor> </ha-expansion-panel> </ha-card> `}},{kind:"method",key:"_playTTS",value:function(){const e=this.pipelineRun.tts.tts_output.url,t=new Audio(e);t.addEventListener("error",(()=>{(0,s.showAlertDialog)(this,{title:"Error",text:"Error playing audio"})})),t.addEventListener("canplaythrough",(()=>{t.play()}))}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{display:block}ha-alert,ha-card{display:block;margin-bottom:16px}.row{display:flex;justify-content:space-between}.row>div:last-child{text-align:right}ha-expansion-panel{padding-left:8px;padding-inline-start:8px;padding-inline-end:initial}.card-content ha-expansion-panel{padding-left:0px;padding-inline-start:0px;padding-inline-end:initial;--expansion-panel-summary-padding:0px;--expansion-panel-content-padding:0px}.heading{font-weight:500;margin-bottom:16px}.messages{margin-top:8px}.message{font-size:18px;margin:8px 0;padding:8px;border-radius:15px;clear:both}.message.user{margin-left:24px;margin-inline-start:24px;margin-inline-end:initial;float:var(--float-end);text-align:right;border-bottom-right-radius:0px;background-color:var(--light-primary-color);color:var(--text-light-primary-color,var(--primary-text-color));direction:var(--direction)}.message.hass{margin-right:24px;margin-inline-end:24px;margin-inline-start:initial;float:var(--float-start);border-bottom-left-radius:0px;background-color:var(--primary-color);color:var(--text-primary-color);direction:var(--direction)}`}]}}),o.oi);t()}catch(e){t(e)}}))}};
//# sourceMappingURL=45991.39dbff0c152ed414.js.map