UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 32.2 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[79662],{20058:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{QL:function(){return p},ZQ:function(){return h},ZV:function(){return c},ty:function(){return l},x:function(){return r}});var s=i(74487),n=(i(74423),i(18111),i(61701),i(46927)),o=e([s]);s=(o.then?(await o)():o)[0];const r=e=>l(e.attributes),l=(e,t)=>!!e.unit_of_measurement||!!e.state_class||(t||[]).includes(e.device_class||""),d=e=>{switch(e.number_format){case n.jG.comma_decimal:return["en-US","en"];case n.jG.decimal_comma:return["de","es","it"];case n.jG.space_comma:return["fr","sv","cs"];case n.jG.quote_decimal:return["de-CH"];case n.jG.system:return;default:return e.language}},c=(e,t,i)=>p(e,t,i).map(e=>e.value).join(""),p=(e,t,i)=>{const a=t?d(t):void 0;return(null==t?void 0:t.number_format)===n.jG.none||Number.isNaN(Number(e))?Number.isNaN(Number(e))||""===e||(null==t?void 0:t.number_format)!==n.jG.none?[{type:"literal",value:e}]:new Intl.NumberFormat("en-US",u(e,Object.assign(Object.assign({},i),{},{useGrouping:!1}))).formatToParts(Number(e)):new Intl.NumberFormat(a,u(e,i)).formatToParts(Number(e))},h=(e,t)=>{var i;const a=null==t?void 0:t.display_precision;return null!=a?{maximumFractionDigits:a,minimumFractionDigits:a}:Number.isInteger(Number(null==e||null===(i=e.attributes)||void 0===i?void 0:i.step))&&Number.isInteger(Number(null==e?void 0:e.state))?{maximumFractionDigits:0}:void 0},u=(e,t)=>{const i=Object.assign({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(r){a(r)}})},63130:function(e,t,i){i.d(t,{l:function(){return s}});i(3362);var a=i(50248);const s=async(e,t)=>{var i;if(navigator.clipboard)try{return void(await navigator.clipboard.writeText(e))}catch(o){}const s=t||(null===(i=(0,a.n)())||void 0===i?void 0:i.getRootNode())||document.body,n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",s.appendChild(n),n.select(),document.execCommand("copy"),s.removeChild(n)}},11382:function(e,t,i){i(3362),i(62953);var a=i(40445),s=i(5124),n=i(67576),o=i(6412),r=i(1087),l=i(12587);i(67094);let d,c,p,h,u=e=>e;class v extends s.WF{render(){const e=this.noCollapse?s.s6:(0,s.qy)(d||(d=u` <ha-svg-icon .path="${0}" class="summary-icon ${0}"></ha-svg-icon> `),"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",(0,o.H)({expanded:this.expanded}));return(0,s.qy)(c||(c=u` <div class="top ${0}"> <div id="summary" class="${0}" @click="${0}" @keydown="${0}" @focus="${0}" @blur="${0}" role="button" tabindex="${0}" aria-expanded="${0}" aria-controls="sect1" part="summary"> ${0} <slot name="leading-icon"></slot> <slot name="header"> <div class="header"> ${0} <slot class="secondary" name="secondary">${0}</slot> </div> </slot> <slot name="event"></slot> ${0} <slot name="icons"></slot> </div> </div> <div class="container ${0}" @transitionend="${0}" role="region" aria-labelledby="summary" aria-hidden="${0}" tabindex="-1"> ${0} </div> `),(0,o.H)({expanded:this.expanded}),(0,o.H)({noCollapse:this.noCollapse}),this._toggleContainer,this._toggleContainer,this._focusChanged,this._focusChanged,this.noCollapse?-1:0,this.expanded,this.leftChevron?e:s.s6,this.header,this.secondary,this.leftChevron?s.s6:e,(0,o.H)({expanded:this.expanded}),this._handleTransitionEnd,!this.expanded,this._showContent?(0,s.qy)(p||(p=u`<slot></slot>`)):"")}willUpdate(e){super.willUpdate(e),e.has("expanded")&&(this._showContent=this.expanded,setTimeout(()=>{this._container.style.overflow=this.expanded?"initial":"hidden"},300))}_handleTransitionEnd(){this._container.style.removeProperty("height"),this._container.style.overflow=this.expanded?"initial":"hidden",this._showContent=this.expanded}async _toggleContainer(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,r.r)(this,"expanded-will-change",{expanded:t}),this._container.style.overflow="hidden",t&&(this._showContent=!0,await(0,l.E)());const i=this._container.scrollHeight;this._container.style.height=`${i}px`,t||setTimeout(()=>{this._container.style.height="0px"},0),this.expanded=t,(0,r.r)(this,"expanded-changed",{expanded:this.expanded})}_focusChanged(e){this.noCollapse||this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}constructor(...e){super(...e),this.expanded=!1,this.outlined=!1,this.leftChevron=!1,this.noCollapse=!1,this._showContent=this.expanded}}v.styles=(0,s.AH)(h||(h=u`:host{display:block}.top{display:flex;align-items:center;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.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,var(--ha-border-radius-lg))}.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;border-radius:var(--ha-border-radius-circle)}#summary:focus-visible ha-svg-icon.summary-icon{background-color:var(--ha-color-fill-neutral-normal-active)}::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:var(--ha-font-weight-medium);outline:0}#summary.noCollapse{cursor:default}.summary-icon.expanded{transform:rotate(180deg)}.header,::slotted([slot=header]){flex:1;overflow-wrap:anywhere;color:var(--primary-text-color)}.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:var(--ha-font-size-s)}`)),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],v.prototype,"expanded",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],v.prototype,"outlined",void 0),(0,a.Cg)([(0,n.MZ)({attribute:"left-chevron",type:Boolean,reflect:!0})],v.prototype,"leftChevron",void 0),(0,a.Cg)([(0,n.MZ)({attribute:"no-collapse",type:Boolean,reflect:!0})],v.prototype,"noCollapse",void 0),(0,a.Cg)([(0,n.MZ)()],v.prototype,"header",void 0),(0,a.Cg)([(0,n.MZ)()],v.prototype,"secondary",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_showContent",void 0),(0,a.Cg)([(0,n.P)(".container")],v.prototype,"_container",void 0),v=(0,a.Cg)([(0,n.EM)("ha-expansion-panel")],v)},47680:function(e,t,i){i.r(t),i.d(t,{HaIcon:function(){return k}});i(74423),i(3362),i(62953);var a=i(40445),s=i(5124),n=i(67576),o=i(1087),r=i(9899),l=i(700),d=(i(44114),i(18111),i(7588),i(96167),i(95192)),c=i(7553);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"}]}');let h;const u=()=>(h||(h=v().catch(e=>{throw h=void 0,e})),h),v=async()=>{const e=(0,d.y$)("hass-icon-db","mdi-icon-store"),t=await(0,d.Jt)("_version",e);return t?t!==p.version&&(await(0,d.IU)(e),(0,d.hZ)("_version",p.version,e)):(0,d.hZ)("_version",p.version,e),e},f=["mdi","hass","hassio","hademo"];let g=[];i(67094);let m,b,y,_=e=>e;const w={},x={},$=(0,r.s)(()=>(async e=>{const t=Object.keys(e),i=await Promise.allSettled(Object.values(e));(await u())("readwrite",a=>{i.forEach((i,s)=>{"fulfilled"===i.status&&Object.entries(i.value).forEach(([e,t])=>{a.put(t,e)}),delete e[t[s]]})})})(x),2e3),C={},R={"home-assistant":()=>i.e(58781).then(i.bind(i,53580)).then(e=>e.mdiHomeAssistant),"music-assistant":()=>i.e(56009).then(i.bind(i,10576)).then(e=>e.mdiMusicAssistant),esphome:()=>i.e(88800).then(i.bind(i,45091)).then(e=>e.mdiEsphomeLogo)};class k extends s.WF{willUpdate(e){super.willUpdate(e),e.has("icon")&&(this._path=void 0,this._secondaryPath=void 0,this._viewBox=void 0,this._loadIcon())}render(){return this.icon?this._legacy?(0,s.qy)(m||(m=_` <iron-icon .icon="${0}"></iron-icon>`),this.icon):(0,s.qy)(b||(b=_`<ha-svg-icon .path="${0}" .secondaryPath="${0}" .viewBox="${0}"></ha-svg-icon>`),this._path,this._secondaryPath,this._viewBox):s.s6}async _loadIcon(){if(!this.icon)return;const e=this.icon,[t,i]=this.icon.split(":",2);let a,s=i;if(!t||!s)return;if(!f.includes(t)){const i=l.y[t];return i?void(i&&"function"==typeof i.getIcon&&this._setCustomPath(i.getIcon(s),e)):void(this._legacy=!0)}if(this._legacy=!1,s in w){const e=w[s];let i;e.newName?(i=`Icon ${t}:${s} was renamed to ${t}:${e.newName}, please change your config, it will be removed in version ${e.removeIn}.`,s=e.newName):i=`Icon ${t}:${s} 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,o.r)(this,"write_log",{level:"warning",message:i})}if(s in C)return void(this._path=C[s]);if(s in R){const t=await R[s]();return this.icon===e&&(this._path=t),void(C[s]=t)}try{a=await(e=>new Promise((t,i)=>{if(g.push([e,t,i]),g.length>1)return;const a=u();(0,c.h)(1e3,(async()=>{(await a)("readonly",e=>{for(const[t,i,a]of g)(0,d.Yd)(e.get(t)).then(e=>i(e)).catch(e=>a(e));g=[]})})()).catch(e=>{for(const[,,t]of g)t(e);g=[]})}))(s)}catch(h){a=void 0}if(a)return this.icon===e&&(this._path=a),void(C[s]=a);const n=(e=>{let t;for(const i of p.parts){if(void 0!==i.start&&e<i.start)break;t=i}return t.file})(s);if(n in x)return void this._setPath(x[n],s,e);const r=fetch(`/static/mdi/${n}.json`).then(e=>e.json());x[n]=r,this._setPath(r,s,e),r.catch(()=>{delete x[n]}),$()}async _setCustomPath(e,t){const i=await e;this.icon===t&&(this._path=i.path,this._secondaryPath=i.secondaryPath,this._viewBox=i.viewBox)}async _setPath(e,t,i){try{const a=await e;this.icon===i&&(this._path=a[t]),C[t]=a[t]}catch(a){}}constructor(...e){super(...e),this._legacy=!1}}k.styles=(0,s.AH)(y||(y=_`:host{fill:currentcolor}`)),(0,a.Cg)([(0,n.MZ)()],k.prototype,"icon",void 0),(0,a.Cg)([(0,n.wk)()],k.prototype,"_path",void 0),(0,a.Cg)([(0,n.wk)()],k.prototype,"_secondaryPath",void 0),(0,a.Cg)([(0,n.wk)()],k.prototype,"_viewBox",void 0),(0,a.Cg)([(0,n.wk)()],k.prototype,"_legacy",void 0),k=(0,a.Cg)([(0,n.EM)("ha-icon")],k)},10763:function(e,t,i){i.a(e,async function(e,t){try{i(3362),i(62953);var a=i(40445),s=i(53289),n=i(5124),o=i(67576),r=i(35211),l=i(1087),d=i(63130),c=i(14503),p=i(81619),h=i(18350),u=i(15717),v=i(22792),f=e([h,u]);[h,u]=f.then?(await f)():f;let g,m,b,y,_,w=e=>e;const x=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};class $ extends n.WF{setValue(e){try{this._yaml=x(e)?"":(0,s.dump)(e,{schema:this.yamlSchema,quotingType:'"',noRefs:!0})}catch(t){console.error(t,e),alert(`There was an error converting to YAML: ${t}`)}}firstUpdated(){void 0!==this.defaultValue&&this.setValue(this.defaultValue)}willUpdate(e){super.willUpdate(e),this.autoUpdate&&e.has("value")&&this.setValue(this.value)}focus(){var e,t;null!==(e=this._codeEditor)&&void 0!==e&&e.codemirror&&(null===(t=this._codeEditor)||void 0===t||t.codemirror.focus())}disableCodeEditorFullscreen(){this.disableFullscreen=!0,this._codeEditor&&(this._codeEditor.disableFullscreen=!0)}render(){return void 0===this._yaml?n.s6:(0,n.qy)(g||(g=w` ${0} <ha-code-editor .value="${0}" .readOnly="${0}" .disableFullscreen="${0}" .inDialog="${0}" mode="yaml" lint autocomplete-entities autocomplete-icons .error="${0}" @value-changed="${0}" @editor-save="${0}" dir="ltr"></ha-code-editor> ${0} `),this.label?(0,n.qy)(m||(m=w`<p>${0}${0}</p>`),this.label,this.required?" *":""):n.s6,this._yaml,this.readOnly,this.disableFullscreen,this.inDialog,!1===this.isValid,this._onChange,this._onEditorSave,this.copyClipboard||this.hasExtraActions?(0,n.qy)(b||(b=w` <div class="card-actions"> ${0} <slot name="extra-actions"></slot> </div> `),this.copyClipboard?(0,n.qy)(y||(y=w` <ha-button appearance="plain" @click="${0}"> ${0} </ha-button> `),this._copyYaml,this._i18n.localize("ui.components.yaml-editor.copy_to_clipboard")):n.s6):n.s6)}_onChange(e){var t;let i;e.stopPropagation(),this._yaml=e.detail.value;let a,n=!0,o=null;if(this._yaml)try{i=(0,s.Hh)(this._yaml,{schema:this.yamlSchema})}catch(r){n=!1,o=r,a=`${this._i18n.localize("ui.components.yaml-editor.error",{reason:r.reason})}${r.mark?` (${this._i18n.localize("ui.components.yaml-editor.error_location",{line:r.mark.line+1,column:r.mark.column+1})})`:""}`}else i={};null===(t=this._codeEditor)||void 0===t||t.setYamlError(o),this.value=i,this.isValid=n,(0,l.r)(this,"value-changed",{value:i,isValid:n,errorMsg:a})}get yaml(){return this._yaml}get codemirror(){var e;return null===(e=this._codeEditor)||void 0===e?void 0:e.codemirror}get hasComments(){var e,t;return null!==(e=null===(t=this._codeEditor)||void 0===t?void 0:t.hasComments)&&void 0!==e&&e}_onEditorSave(e){(0,l.r)(this,"editor-save"),e.stopPropagation()}async _copyYaml(){this.yaml&&(await(0,d.l)(this.yaml),(0,p.P)(this,{message:this._i18n.localize("ui.common.copied_clipboard")}))}static get styles(){return[c.RF,(0,n.AH)(_||(_=w`.card-actions{border-radius:var(--actions-border-radius,var(--ha-border-radius-square) var(--ha-border-radius-square) var(--ha-card-border-radius,var(--ha-border-radius-lg)) var(--ha-card-border-radius,var(--ha-border-radius-lg)));border:1px solid var(--divider-color);padding:5px 16px}ha-code-editor{flex-grow:1;min-height:0}`))]}constructor(...e){super(...e),this.yamlSchema=s.my,this.isValid=!0,this.autoUpdate=!1,this.readOnly=!1,this.disableFullscreen=!1,this.inDialog=!1,this.required=!1,this.copyClipboard=!1,this.hasExtraActions=!1,this._yaml=""}}(0,a.Cg)([(0,o.MZ)()],$.prototype,"value",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"yamlSchema",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"defaultValue",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"is-valid",type:Boolean})],$.prototype,"isValid",void 0),(0,a.Cg)([(0,o.MZ)()],$.prototype,"label",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"auto-update",type:Boolean})],$.prototype,"autoUpdate",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"read-only",type:Boolean})],$.prototype,"readOnly",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:"disable-fullscreen"})],$.prototype,"disableFullscreen",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:"in-dialog"})],$.prototype,"inDialog",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],$.prototype,"required",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"copy-clipboard",type:Boolean})],$.prototype,"copyClipboard",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"has-extra-actions",type:Boolean})],$.prototype,"hasExtraActions",void 0),(0,a.Cg)([(0,o.wk)()],$.prototype,"_yaml",void 0),(0,a.Cg)([(0,o.wk)(),(0,r.Fg)({context:v.D5,subscribe:!0})],$.prototype,"_i18n",void 0),(0,a.Cg)([(0,o.P)("ha-code-editor")],$.prototype,"_codeEditor",void 0),$=(0,a.Cg)([(0,o.EM)("ha-yaml-editor")],$),t()}catch(g){t(g)}})},700:function(e,t,i){i.d(t,{y:function(){return o}});const a=window;"customIconsets"in a||(a.customIconsets={});const s=a.customIconsets,n=window;"customIcons"in n||(n.customIcons={});const o=new Proxy(n.customIcons,{get:(e,t)=>{var i;return null!==(i=e[t])&&void 0!==i?i:s[t]?{getIcon:s[t]}:void 0}})},90056:function(e,t,i){i.a(e,async function(e,t){try{i(18111),i(7588),i(33110),i(62953);var a=i(40445),s=i(5124),n=i(67576),o=i(22786),r=i(69150),l=i(7724),d=e([l]);l=(d.then?(await d)():d)[0];let c,p,h,u=e=>e;class v extends s.WF{render(){const e=this._processEvents(this.events);return e?(0,s.qy)(h||(h=u` <assist-render-pipeline-run .hass="${0}" .pipelineRun="${0}" .chatLog="${0}"></assist-render-pipeline-run> `),this.hass,e,this.chatLog):this.events.length?(0,s.qy)(c||(c=u`<ha-alert alert-type="error">${0}</ha-alert> <ha-card> <ha-expansion-panel> <span slot="header">${0}</span> <pre>${0}</pre> </ha-expansion-panel> </ha-card>`),this.hass.localize("ui.panel.config.voice_assistants.debug.error.showing_run"),this.hass.localize("ui.panel.config.voice_assistants.debug.raw"),JSON.stringify(this.events,null,2)):(0,s.qy)(p||(p=u`<ha-alert alert-type="warning">${0}</ha-alert>`),this.hass.localize("ui.panel.config.voice_assistants.debug.no_events"))}constructor(...e){super(...e),this._processEvents=(0,o.A)(e=>{let t;return e.forEach(e=>{t=(0,r.QC)(t,e)}),t})}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"events",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"chatLog",void 0),v=(0,a.Cg)([(0,n.EM)("assist-render-pipeline-events")],v),t()}catch(c){t(c)}})},7724:function(e,t,i){i.a(e,async function(e,t){try{i(74423),i(44114),i(18111),i(22489),i(20116),i(61701);var a=i(40445),s=i(5124),n=i(67576),o=i(20058),r=i(38962),l=i(18350),d=(i(76776),i(11382),i(65829)),c=i(10763),p=i(65063),h=e([r,l,d,c,o]);[r,l,d,c,o]=h.then?(await h)():h;let u,v,f,g,m,b,y,_,w,x,$,C,R,k,q,E,z,M,Z,P,F,T,I,N,L,j,D,S=e=>e;const B=["pipeline","language"],O=["engine"],U=["engine"],A=["engine","language","intent_input"],H=["engine","language","voice","tts_input"],V={ready:0,wake_word:1,stt:2,intent:3,tts:4,done:5,error:6},G=(e,t)=>e.init_options?V[e.init_options.start_stage]<=V[t]&&V[t]<=V[e.init_options.end_stage]:t in e,W=(e,t,i)=>"error"in e&&i===t?(0,s.qy)(u||(u=S` <ha-alert alert-type="error"> ${0} (${0}) </ha-alert> `),e.error.message,e.error.code):"",Y=(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?(0,s.qy)(v||(v=S`❌`)):(0,s.qy)(f||(f=S` <ha-spinner size="small"></ha-spinner> `));const l=new Date(r.timestamp).getTime()-new Date(n.timestamp).getTime(),d=(0,o.ZV)(l/1e3,e.locale,{maximumFractionDigits:2});return(0,s.qy)(g||(g=S`${0}s ✅`),d)},J=(e,t,i)=>i.map(i=>{const a=e.localize(`ui.panel.config.voice_assistants.debug.stages.${i}`);return(0,s.qy)(m||(m=S` <div class="row"> <div>${0}</div> <div>${0}</div> </div> `),a,t[i])}),Q=(e,t,i)=>{const a={};let n=!1;for(const s in t)i.includes(s)||"done"===s||(n=!0,a[s]=t[s]);return n?(0,s.qy)(b||(b=S`<ha-expansion-panel class="yaml-expansion"> <span slot="header">${0}</span> <ha-yaml-editor readOnly="readOnly" autoUpdate .value="${0}"></ha-yaml-editor> </ha-expansion-panel>`),e.localize("ui.panel.config.voice_assistants.debug.raw"),a):""};class K extends s.WF{get _isPlaying(){return null!=this._audioElement&&!this._audioElement.paused}render(){var e;const t=this.pipelineRun&&["tts","intent","stt","wake_word"].find(e=>e in this.pipelineRun)||"ready";let i;if(this.chatLog)i=this.chatLog.content.filter(this.pipelineRun.finished?e=>"system"===e.role||e.created>=this.pipelineRun.started&&e.created<=this.pipelineRun.finished:e=>"system"===e.role||e.created>=this.pipelineRun.started);else{var a,n,o;i=[];const e=(this.pipelineRun.init_options&&"text"in this.pipelineRun.init_options.input?this.pipelineRun.init_options.input.text:void 0)||(null===(a=this.pipelineRun)||void 0===a||null===(a=a.stt)||void 0===a||null===(a=a.stt_output)||void 0===a?void 0:a.text)||(null===(n=this.pipelineRun)||void 0===n||null===(n=n.intent)||void 0===n?void 0:n.intent_input);e&&i.push({role:"user",content:e}),null!==(o=this.pipelineRun)&&void 0!==o&&null!==(o=o.intent)&&void 0!==o&&null!==(o=o.intent_output)&&void 0!==o&&null!==(o=o.response)&&void 0!==o&&null!==(o=o.speech)&&void 0!==o&&null!==(o=o.plain)&&void 0!==o&&o.speech&&i.push({role:"assistant",content:this.pipelineRun.intent.intent_output.response.speech.plain.speech})}return(0,s.qy)(y||(y=S` <ha-card> <div class="card-content"> <div class="row heading"> <div> ${0} </div> <div>${0}</div> </div> ${0} ${0} </div> </ha-card> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <ha-card> <ha-expansion-panel class="yaml-expansion"> <span slot="header">${0}</span> <ha-yaml-editor read-only auto-update .value="${0}"></ha-yaml-editor> </ha-expansion-panel> </ha-card> `),this.hass.localize("ui.panel.config.voice_assistants.debug.run"),this.pipelineRun.stage,J(this.hass,this.pipelineRun.run,B),i.length>0?(0,s.qy)(_||(_=S` <div class="messages"> ${0} </div> <div style="clear:both"></div> `),i.map(e=>{var t;return"system"===e.role?e.content?(0,s.qy)(w||(w=S` <ha-expansion-panel class="content-expansion ${0}"> <div slot="header">System</div> <pre>${0}</pre> </ha-expansion-panel> `),e.role,e.content):s.s6:"tool_result"===e.role?(0,s.qy)(x||(x=S` <ha-expansion-panel class="content-expansion ${0}"> <div slot="header"> Result for ${0} </div> <ha-yaml-editor read-only auto-update .value="${0}"></ha-yaml-editor> </ha-expansion-panel> `),e.role,e.tool_name,e):(0,s.qy)($||($=S` ${0} ${0} `),e.content?(0,s.qy)(C||(C=S` <div class="${0}"> ${0} </div> `),`message ${e.role}`,e.content):s.s6,"assistant"===e.role&&null!==(t=e.tool_calls)&&void 0!==t&&t.length?(0,s.qy)(R||(R=S` <ha-expansion-panel class="content-expansion assistant"> <span slot="header"> Call ${0} </span> <ha-yaml-editor read-only auto-update .value="${0}"></ha-yaml-editor> </ha-expansion-panel> `),1===e.tool_calls.length?e.tool_calls[0].tool_name:`${e.tool_calls.length} tools`,e.tool_calls):s.s6)})):"",W(this.pipelineRun,"ready",t),G(this.pipelineRun,"wake_word")?(0,s.qy)(k||(k=S` <ha-card> <div class="card-content"> <div class="row heading"> <span>${0}</span> ${0} </div> ${0} </div> </ha-card> `),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.wake_word"),Y(this.hass,this.pipelineRun,"wake_word"),this.pipelineRun.wake_word?(0,s.qy)(q||(q=S` <div class="card-content"> ${0} ${0} ${0} </div> `),J(this.hass,this.pipelineRun.wake_word,O),this.pipelineRun.wake_word.wake_word_output?(0,s.qy)(E||(E=S`<div class="row"> <div> ${0} </div> <div> ${0} </div> </div> <div class="row"> <div> ${0} </div> <div> ${0} </div> </div>`),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.model"),this.pipelineRun.wake_word.wake_word_output.ww_id,this.hass.localize("ui.panel.config.voice_assistants.debug.stages.timestamp"),this.pipelineRun.wake_word.wake_word_output.timestamp):"",Q(this.hass,this.pipelineRun.wake_word,O)):""):"",W(this.pipelineRun,"wake_word",t),G(this.pipelineRun,"stt")?(0,s.qy)(z||(z=S` <ha-card> <div class="card-content"> <div class="row heading"> <span>${0}</span> ${0} </div> ${0} </div> </ha-card> `),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.speech_to_text"),Y(this.hass,this.pipelineRun,"stt","-vad-end"),this.pipelineRun.stt?(0,s.qy)(M||(M=S` <div class="card-content"> ${0} <div class="row"> <div> ${0} </div> <div>${0}</div> </div> ${0} ${0} </div> `),J(this.hass,this.pipelineRun.stt,U),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.language"),this.pipelineRun.stt.metadata.language,this.pipelineRun.stt.stt_output?(0,s.qy)(Z||(Z=S`<div class="row"> <div> ${0} </div> <div>${0}</div> </div>`),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.output"),this.pipelineRun.stt.stt_output.text):"",Q(this.hass,this.pipelineRun.stt,U)):""):"",W(this.pipelineRun,"stt",t),G(this.pipelineRun,"intent")?(0,s.qy)(P||(P=S` <ha-card> <div class="card-content"> <div class="row heading"> <span>${0}</span> ${0} </div> ${0} </div> </ha-card> `),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.natural_language_processing"),Y(this.hass,this.pipelineRun,"intent"),this.pipelineRun.intent?(0,s.qy)(F||(F=S` <div class="card-content"> ${0} ${0} <div class="row"> <div> ${0} </div> <div> ${0} </div> </div> <div class="row"> <div> ${0} </div> <div> ${0} </div> </div> ${0} </div> `),J(this.hass,this.pipelineRun.intent,A),this.pipelineRun.intent.intent_output?(0,s.qy)(T||(T=S`<div class="row"> <div> ${0} </div> <div> ${0} </div> </div> ${0}`),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.response_type"),this.pipelineRun.intent.intent_output.response.response_type,"error"===this.pipelineRun.intent.intent_output.response.response_type?(0,s.qy)(I||(I=S`<div class="row"> <div> ${0} </div> <div> ${0} </div> </div>`),this.hass.localize("ui.panel.config.voice_assistants.debug.error.code"),this.pipelineRun.intent.intent_output.response.data.code):""):"",this.hass.localize("ui.panel.config.voice_assistants.debug.stages.prefer_local"),this.pipelineRun.intent.prefer_local_intents,this.hass.localize("ui.panel.config.voice_assistants.debug.stages.processed_locally"),this.pipelineRun.intent.processed_locally,Q(this.hass,this.pipelineRun.intent,A)):""):"",W(this.pipelineRun,"intent",t),G(this.pipelineRun,"tts")?(0,s.qy)(N||(N=S` <ha-card> <div class="card-content"> <div class="row heading"> <span>${0}</span> ${0} </div> ${0} </div> ${0} </ha-card> `),this.hass.localize("ui.panel.config.voice_assistants.debug.stages.text_to_speech"),Y(this.hass,this.pipelineRun,"tts"),this.pipelineRun.tts?(0,s.qy)(L||(L=S` <div class="card-content"> ${0} ${0} </div> `),J(this.hass,this.pipelineRun.tts,H),Q(this.hass,this.pipelineRun.tts,H)):"",null!==(e=this.pipelineRun)&&void 0!==e&&null!==(e=e.tts)&&void 0!==e&&e.tts_output?(0,s.qy)(j||(j=S` <div class="card-actions"> <ha-button .variant="${0}" @click="${0}"> ${0} </ha-button> </div> `),this._isPlaying?"danger":"brand",this._isPlaying?this._stopTTS:this._playTTS,this._isPlaying?this.hass.localize("ui.panel.config.voice_assistants.debug.stop_audio"):this.hass.localize("ui.panel.config.voice_assistants.debug.play_audio")):""):"",W(this.pipelineRun,"tts",t),this.hass.localize("ui.panel.config.voice_assistants.debug.raw"),this.pipelineRun)}_playTTS(){this._stopTTS();const e=this.pipelineRun.tts.tts_output.url;this._audioElement=new Audio(e),this._audioElement.addEventListener("error",()=>{(0,p.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.voice_assistants.debug.error.title"),text:this.hass.localize("ui.panel.config.voice_assistants.debug.error.playing_audio")})}),this._audioElement.addEventListener("play",()=>{this.requestUpdate()}),this._audioElement.addEventListener("ended",()=>{this.requestUpdate()}),this._audioElement.addEventListener("canplaythrough",()=>{this._audioElement.play()})}_stopTTS(){this._audioElement&&(this._audioElement.pause(),this._audioElement.currentTime=0,this._audioElement=void 0,this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this._stopTTS()}}K.styles=(0,s.AH)(D||(D=S`: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}.yaml-expansion{padding-left:8px;padding-inline-start:8px;padding-inline-end:initial}.card-content .yaml-expansion{padding-left:0px;padding-inline-start:0px;padding-inline-end:initial;--expansion-panel-summary-padding:0px;--expansion-panel-content-padding:0px}.heading{font-weight:var(--ha-font-weight-medium);margin-bottom:16px}.messages{margin-top:8px}.content-expansion{margin:8px 0;border-radius:var(--ha-border-radius-xl);clear:both;padding:0 8px;--input-fill-color:none;max-width:calc(100% - 24px);--expansion-panel-summary-padding:0px;--expansion-panel-content-padding:0px}.content-expansion [slot=header]{font-weight:var(--ha-font-weight-normal)}.system{background-color:var(--success-color)}.message{padding:8px}.content-expansion,.message{font-size:var(--ha-font-size-l);margin:8px 0;border-radius:var(--ha-border-radius-xl);clear:both}.messages pre{white-space:pre-wrap}.tool_result,.user{margin-left:24px;margin-inline-start:24px;margin-inline-end:initial;float:var(--float-end);border-bottom-right-radius:0px;background-color:var(--light-primary-color);color:var(--text-light-primary-color,var(--primary-text-color));direction:var(--direction)}.tool_result [slot=header]{color:var(--text-light-primary-color,var(--primary-text-color))}.content-expansion div[slot=header],.message.user{text-align:right}.assistant{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)}`)),(0,a.Cg)([(0,n.MZ)({attribute:!1})],K.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],K.prototype,"pipelineRun",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],K.prototype,"chatLog",void 0),K=(0,a.Cg)([(0,n.EM)("assist-render-pipeline-run")],K),t()}catch(u){t(u)}})}}]);