mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-09 19:09:41 +00:00
2 lines
38 KiB
JavaScript
2 lines
38 KiB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["1695"],{16520:function(e,t,i){i(35748),i(5934),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(75907),r=i(44017),d=i(54337);i(86160);let l,p,h,c,u=e=>e;class _ extends s.WF{render(){const e=this.noCollapse?s.s6:(0,s.qy)(l||(l=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)(p||(p=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> ${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)(h||(h=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,d.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}}_.styles=(0,s.AH)(c||(c=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}.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.__decorate)([(0,n.MZ)({type:Boolean,reflect:!0})],_.prototype,"expanded",void 0),(0,a.__decorate)([(0,n.MZ)({type:Boolean,reflect:!0})],_.prototype,"outlined",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:"left-chevron",type:Boolean,reflect:!0})],_.prototype,"leftChevron",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:"no-collapse",type:Boolean,reflect:!0})],_.prototype,"noCollapse",void 0),(0,a.__decorate)([(0,n.MZ)()],_.prototype,"header",void 0),(0,a.__decorate)([(0,n.MZ)()],_.prototype,"secondary",void 0),(0,a.__decorate)([(0,n.wk)()],_.prototype,"_showContent",void 0),(0,a.__decorate)([(0,n.P)(".container")],_.prototype,"_container",void 0),_=(0,a.__decorate)([(0,n.EM)("ha-expansion-panel")],_)},6345:function(e,t,i){i.a(e,async function(e,t){try{i(35748),i(5934),i(95013);var a=i(69868),s=i(90227),n=i(84922),o=i(11991),r=i(44017),d=i(29752),l=i(50809),p=i(91197),h=(i(94124),i(17372)),c=i(59435),u=e([h,c]);[h,c]=u.then?(await u)():u;let _,g,v,m,y,f,w=e=>e;const b=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=b(e)?"":(0,s.Bh)(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())}render(){return void 0===this._yaml?n.s6:(0,n.qy)(_||(_=w` ${0} <ha-code-editor .hass="${0}" .value="${0}" .readOnly="${0}" .disableFullscreen="${0}" mode="yaml" autocomplete-entities autocomplete-icons .error="${0}" @value-changed="${0}" @blur="${0}" dir="ltr"></ha-code-editor> ${0} ${0} `),this.label?(0,n.qy)(g||(g=w`<p>${0}${0}</p>`),this.label,this.required?" *":""):n.s6,this.hass,this._yaml,this.readOnly,this.disableFullscreen,!1===this.isValid,this._onChange,this._onBlur,this._showingError?(0,n.qy)(v||(v=w`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):n.s6,this.copyClipboard||this.hasExtraActions?(0,n.qy)(m||(m=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.hass.localize("ui.components.yaml-editor.copy_to_clipboard")):n.s6):n.s6)}_onChange(e){let t;e.stopPropagation(),this._yaml=e.detail.value;let i,a=!0;if(this._yaml)try{t=(0,s.Hh)(this._yaml,{schema:this.yamlSchema})}catch(n){a=!1,i=`${this.hass.localize("ui.components.yaml-editor.error",{reason:n.reason})}${n.mark?` (${this.hass.localize("ui.components.yaml-editor.error_location",{line:n.mark.line+1,column:n.mark.column+1})})`:""}`}else t={};this._error=null!=i?i:"",a&&(this._showingError=!1),this.value=t,this.isValid=a,(0,r.r)(this,"value-changed",{value:t,isValid:a,errorMsg:i})}_onBlur(){this.showErrors&&this._error&&(this._showingError=!0)}get yaml(){return this._yaml}async _copyYaml(){this.yaml&&(await(0,d.l)(this.yaml),(0,p.P)(this,{message:this.hass.localize("ui.common.copied_clipboard")}))}static get styles(){return[l.RF,(0,n.AH)(f||(f=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.required=!1,this.copyClipboard=!1,this.hasExtraActions=!1,this.showErrors=!0,this._yaml="",this._error="",this._showingError=!1}}(0,a.__decorate)([(0,o.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,a.__decorate)([(0,o.MZ)()],$.prototype,"value",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:!1})],$.prototype,"yamlSchema",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:!1})],$.prototype,"defaultValue",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:"is-valid",type:Boolean})],$.prototype,"isValid",void 0),(0,a.__decorate)([(0,o.MZ)()],$.prototype,"label",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:"auto-update",type:Boolean})],$.prototype,"autoUpdate",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:"read-only",type:Boolean})],$.prototype,"readOnly",void 0),(0,a.__decorate)([(0,o.MZ)({type:Boolean,attribute:"disable-fullscreen"})],$.prototype,"disableFullscreen",void 0),(0,a.__decorate)([(0,o.MZ)({type:Boolean})],$.prototype,"required",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:"copy-clipboard",type:Boolean})],$.prototype,"copyClipboard",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:"has-extra-actions",type:Boolean})],$.prototype,"hasExtraActions",void 0),(0,a.__decorate)([(0,o.MZ)({attribute:"show-errors",type:Boolean})],$.prototype,"showErrors",void 0),(0,a.__decorate)([(0,o.wk)()],$.prototype,"_yaml",void 0),(0,a.__decorate)([(0,o.wk)()],$.prototype,"_error",void 0),(0,a.__decorate)([(0,o.wk)()],$.prototype,"_showingError",void 0),(0,a.__decorate)([(0,o.P)("ha-code-editor")],$.prototype,"_codeEditor",void 0),$=(0,a.__decorate)([(0,o.EM)("ha-yaml-editor")],$),t()}catch(_){t(_)}})},9853:function(e,t,i){i.d(t,{a:function(){return n}});i(35748),i(5934),i(95013);var a=i(44017);const s=()=>i.e("5234").then(i.bind(i,72761)),n=(e,t)=>{(0,a.r)(e,"show-dialog",{addHistory:!1,dialogTag:"dialog-tts-try",dialogImport:s,dialogParams:t})}},26723:function(e,t,i){i(35748),i(5934),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(65940);i(60921);let r,d,l=e=>e;class p extends s.WF{async focus(){var e;await this.updateComplete;const t=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector("ha-form");null==t||t.focus()}render(){return(0,s.qy)(r||(r=l` <div class="section"> <div class="intro"> <h3> ${0} </h3> <p> ${0} </p> </div> <ha-form .schema="${0}" .data="${0}" .hass="${0}" .computeLabel="${0}"></ha-form> </div> `),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.config.title"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.config.description"),this._schema(this.supportedLanguages),this.data,this.hass,this._computeLabel)}constructor(...e){super(...e),this._schema=(0,o.A)(e=>[{name:"",type:"grid",schema:[{name:"name",required:!0,selector:{text:{}}},e?{name:"language",required:!0,selector:{language:{languages:e}}}:{name:"",type:"constant"}]}]),this._computeLabel=e=>e.name?this.hass.localize(`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${e.name}`):""}}p.styles=(0,s.AH)(d||(d=l`.section{border:1px solid var(--divider-color);border-radius:var(--ha-border-radius-md);box-sizing:border-box;padding:16px}.intro{margin-bottom:16px}h3{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);margin-top:0;margin-bottom:4px}p{color:var(--secondary-text-color);font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));margin-top:0;margin-bottom:0}`)),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],p.prototype,"data",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1,type:Array})],p.prototype,"supportedLanguages",void 0),p=(0,a.__decorate)([(0,n.EM)("assist-pipeline-detail-config")],p)},34962:function(e,t,i){i(79827),i(35748),i(99342),i(12977),i(18223),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(65940),r=i(44017);i(60921);let d,l,p=e=>e;class h extends s.WF{render(){var e,t;return(0,s.qy)(d||(d=p` <div class="section"> <div class="intro"> <h3> ${0} </h3> <p> ${0} </p> </div> <ha-form .schema="${0}" .data="${0}" .hass="${0}" .computeLabel="${0}" .computeHelper="${0}" @supported-languages-changed="${0}"></ha-form> </div> `),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.conversation.title"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.conversation.description"),this._schema(null===(e=this.data)||void 0===e?void 0:e.conversation_engine,null===(t=this.data)||void 0===t?void 0:t.language,this._supportedLanguages),this.data,this.hass,this._computeLabel,this._computeHelper,this._supportedLanguagesChanged)}_supportedLanguagesChanged(e){var t,i,a;this._supportedLanguages=e.detail.value,"*"!==this._supportedLanguages&&null!==(t=this._supportedLanguages)&&void 0!==t&&t.includes((null===(i=this.data)||void 0===i?void 0:i.conversation_language)||"")&&null!==(a=this.data)&&void 0!==a&&a.conversation_language||setTimeout(()=>{const e=Object.assign({},this.data);var t,i;"*"===this._supportedLanguages?e.conversation_language="*":e.conversation_language=null!==(t=null===(i=this._supportedLanguages)||void 0===i?void 0:i[0])&&void 0!==t?t:null;(0,r.r)(this,"value-changed",{value:e})},0)}constructor(...e){super(...e),this._schema=(0,o.A)((e,t,i)=>{const a=[{name:"",type:"grid",schema:[{name:"conversation_engine",required:!0,selector:{conversation_agent:{language:t}}}]}];return"*"!==i&&null!=i&&i.length&&a[0].schema.push({name:"conversation_language",required:!0,selector:{language:{languages:i,no_sort:!0}}}),"conversation.home_assistant"!==e&&a.push({name:"prefer_local_intents",default:!0,selector:{boolean:{}}}),a}),this._computeLabel=e=>e.name?this.hass.localize(`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${e.name}`):"",this._computeHelper=e=>e.name?this.hass.localize(`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${e.name}_description`):""}}h.styles=(0,s.AH)(l||(l=p`.section{border:1px solid var(--divider-color);border-radius:var(--ha-border-radius-md);box-sizing:border-box;padding:16px}.intro{margin-bottom:16px}h3{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);margin-top:0;margin-bottom:4px}p{color:var(--secondary-text-color);font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));margin-top:0;margin-bottom:0}`)),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],h.prototype,"data",void 0),(0,a.__decorate)([(0,n.wk)()],h.prototype,"_supportedLanguages",void 0),h=(0,a.__decorate)([(0,n.EM)("assist-pipeline-detail-conversation")],h)},35284:function(e,t,i){i(35748),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(65940);i(60921);let r,d,l=e=>e;class p extends s.WF{render(){var e;return(0,s.qy)(r||(r=l` <div class="section"> <div class="intro"> <h3> ${0} </h3> <p> ${0} </p> </div> <ha-form .schema="${0}" .data="${0}" .hass="${0}" .computeLabel="${0}" @supported-languages-changed="${0}"></ha-form> </div> `),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.stt.title"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.stt.description"),this._schema(null===(e=this.data)||void 0===e?void 0:e.language,this._supportedLanguages),this.data,this.hass,this._computeLabel,this._supportedLanguagesChanged)}_supportedLanguagesChanged(e){this._supportedLanguages=e.detail.value}constructor(...e){super(...e),this._schema=(0,o.A)((e,t)=>[{name:"",type:"grid",schema:[{name:"stt_engine",selector:{stt:{language:e}}},null!=t&&t.length?{name:"stt_language",required:!0,selector:{language:{languages:t,no_sort:!0}}}:{name:"",type:"constant"}]}]),this._computeLabel=e=>e.name?this.hass.localize(`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${e.name}`):""}}p.styles=(0,s.AH)(d||(d=l`.section{border:1px solid var(--divider-color);border-radius:var(--ha-border-radius-md);box-sizing:border-box;padding:16px}.intro{margin-bottom:16px}h3{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);margin-top:0;margin-bottom:4px}p{color:var(--secondary-text-color);font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));margin-top:0;margin-bottom:0}`)),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],p.prototype,"data",void 0),(0,a.__decorate)([(0,n.wk)()],p.prototype,"_supportedLanguages",void 0),p=(0,a.__decorate)([(0,n.EM)("assist-pipeline-detail-stt")],p)},556:function(e,t,i){i.a(e,async function(e,t){try{i(35748),i(5934),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(65940),r=i(17372),d=(i(60921),i(9853)),l=e([r]);r=(l.then?(await l)():l)[0];let p,h,c,u=e=>e;class _ extends s.WF{render(){var e,t;return(0,s.qy)(p||(p=u` <div class="section"> <div class="content"> <div class="intro"> <h3> ${0} </h3> <p> ${0} </p> </div> <ha-form .schema="${0}" .data="${0}" .hass="${0}" .computeLabel="${0}" @supported-languages-changed="${0}"></ha-form> </div> ${0} </div> `),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.tts.title"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.tts.description"),this._schema(null===(e=this.data)||void 0===e?void 0:e.language,this._supportedLanguages),this.data,this.hass,this._computeLabel,this._supportedLanguagesChanged,null!==(t=this.data)&&void 0!==t&&t.tts_engine?(0,s.qy)(h||(h=u`<div class="footer"> <ha-button @click="${0}"> ${0} </ha-button> </div>`),this._preview,this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.try_tts")):s.s6)}async _preview(){if(!this.data)return;const e=this.data.tts_engine,t=this.data.tts_language||void 0,i=this.data.tts_voice||void 0;e&&(0,d.a)(this,{engine:e,language:t,voice:i})}_supportedLanguagesChanged(e){this._supportedLanguages=e.detail.value}constructor(...e){super(...e),this._schema=(0,o.A)((e,t)=>[{name:"",type:"grid",schema:[{name:"tts_engine",selector:{tts:{language:e}}},null!=t&&t.length?{name:"tts_language",required:!0,selector:{language:{languages:t,no_sort:!0}}}:{name:"",type:"constant"},{name:"tts_voice",selector:{tts_voice:{}},context:{language:"tts_language",engineId:"tts_engine"},required:!0}]}]),this._computeLabel=e=>e.name?this.hass.localize(`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${e.name}`):""}}_.styles=(0,s.AH)(c||(c=u`.section{border:1px solid var(--divider-color);border-radius:var(--ha-border-radius-md)}.content{padding:16px}.intro{margin-bottom:16px}h3{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);margin-top:0;margin-bottom:4px}p{color:var(--secondary-text-color);font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));margin-top:0;margin-bottom:0}.footer{border-top:1px solid var(--divider-color);padding:8px 16px}`)),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],_.prototype,"data",void 0),(0,a.__decorate)([(0,n.wk)()],_.prototype,"_supportedLanguages",void 0),_=(0,a.__decorate)([(0,n.EM)("assist-pipeline-detail-tts")],_),t()}catch(p){t(p)}})},83236:function(e,t,i){i(35748),i(65315),i(37089),i(59023),i(12977),i(5934),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(65940),r=i(44017);i(60921);let d,l,p=e=>e;class h extends s.WF{willUpdate(e){var t,i,a,s;e.has("data")&&(null===(t=e.get("data"))||void 0===t?void 0:t.wake_word_entity)!==(null===(i=this.data)||void 0===i?void 0:i.wake_word_entity)&&(null!==(a=e.get("data"))&&void 0!==a&&a.wake_word_entity&&null!==(s=this.data)&&void 0!==s&&s.wake_word_id&&(0,r.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.data),{},{wake_word_id:void 0})}),this._fetchWakeWords())}render(){return(0,s.qy)(d||(d=p` <div class="section"> <div class="content"> <div class="intro"> <h3> ${0} </h3> <p> ${0} </p> <ha-alert alert-type="info"> ${0} </ha-alert> </div> <ha-form .schema="${0}" .data="${0}" .hass="${0}" .computeLabel="${0}"></ha-form> </div> </div> `),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.wakeword.title"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.wakeword.description"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.wakeword.note"),this._schema(this._wakeWords),this.data,this.hass,this._computeLabel)}async _fetchWakeWords(){var e,t;if(this._wakeWords=void 0,null===(e=this.data)||void 0===e||!e.wake_word_entity)return;const i=this.data.wake_word_entity,a=await(s=this.hass,n=i,s.callWS({type:"wake_word/info",entity_id:n}));var s,n,o;this.data.wake_word_entity===i&&(this._wakeWords=a.wake_words,!this.data||null!==(t=this.data)&&void 0!==t&&t.wake_word_id&&this._wakeWords.some(e=>e.id===this.data.wake_word_id)||(0,r.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.data),{},{wake_word_id:null===(o=this._wakeWords[0])||void 0===o?void 0:o.id})}))}constructor(...e){super(...e),this._schema=(0,o.A)(e=>[{name:"",type:"grid",schema:[{name:"wake_word_entity",selector:{entity:{domain:"wake_word"}}},null!=e&&e.length?{name:"wake_word_id",required:!0,selector:{select:{mode:"dropdown",sort:!0,options:e.map(e=>({value:e.id,label:e.name}))}}}:{name:"",type:"constant"}]}]),this._computeLabel=e=>e.name?this.hass.localize(`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${e.name}`):""}}h.styles=(0,s.AH)(l||(l=p`.section{border:1px solid var(--divider-color);border-radius:var(--ha-border-radius-md)}.content{padding:16px}.intro{margin-bottom:16px}h3{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);margin-top:0;margin-bottom:4px}p{color:var(--secondary-text-color);font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));margin-top:0;margin-bottom:0}a{color:var(--primary-color)}`)),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],h.prototype,"data",void 0),(0,a.__decorate)([(0,n.wk)()],h.prototype,"_wakeWords",void 0),h=(0,a.__decorate)([(0,n.EM)("assist-pipeline-detail-wakeword")],h)},6858:function(e,t,i){i.a(e,async function(e,t){try{i(35748),i(65315),i(22416),i(36874),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=i(65940),r=i(156),d=i(70838),l=e([d]);d=(l.then?(await l)():l)[0];let p,h,c,u=e=>e;class _ extends s.WF{render(){const e=this._processEvents(this.events);return e?(0,s.qy)(c||(c=u` <assist-render-pipeline-run .hass="${0}" .pipelineRun="${0}"></assist-render-pipeline-run> `),this.hass,e):this.events.length?(0,s.qy)(p||(p=u`<ha-alert alert-type="error">Error showing run</ha-alert> <ha-card> <ha-expansion-panel> <span slot="header">Raw</span> <pre>${0}</pre> </ha-expansion-panel> </ha-card>`),JSON.stringify(this.events,null,2)):(0,s.qy)(h||(h=u`<ha-alert alert-type="warning">There were no events in this run.</ha-alert>`))}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.__decorate)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],_.prototype,"events",void 0),_=(0,a.__decorate)([(0,n.EM)("assist-render-pipeline-events")],_),t()}catch(p){t(p)}})},70838:function(e,t,i){i.a(e,async function(e,t){try{i(35748),i(99342),i(65315),i(84136),i(37089),i(95013);var a=i(69868),s=i(84922),n=i(11991),o=(i(70490),i(94124),i(17372)),r=i(96635),d=(i(16520),i(8868)),l=i(6345),p=i(15241),h=e([o,r,l,d]);[o,r,l,d]=h.then?(await h)():h;let c,u,_,g,v,m,y,f,w,b,$,x,k,L,z,R,q,M,W,C,A,E,Z,O=e=>e;const P={pipeline:"Pipeline",language:"Language"},T={engine:"Engine"},H={engine:"Engine"},F={engine:"Engine",language:"Language",intent_input:"Input"},B={engine:"Engine",language:"Language",voice:"Voice",tts_input:"Input"},S={ready:0,wake_word:1,stt:2,intent:3,tts:4,done:5,error:6},j=(e,t)=>e.init_options?S[e.init_options.start_stage]<=S[t]&&S[t]<=S[e.init_options.end_stage]:t in e,V=(e,t,i)=>"error"in e&&i===t?(0,s.qy)(c||(c=O` <ha-alert alert-type="error"> ${0} (${0}) </ha-alert> `),e.error.message,e.error.code):"",D=(e,t,i,a="-start")=>{const n=t.events.find(e=>e.type===`${i}`+a),o=t.events.find(e=>e.type===`${i}-end`);if(!n)return"";if(!o)return"error"in t?(0,s.qy)(u||(u=O`❌`)):(0,s.qy)(_||(_=O` <ha-spinner size="small"></ha-spinner> `));const r=new Date(o.timestamp).getTime()-new Date(n.timestamp).getTime(),l=(0,d.ZV)(r/1e3,e.locale,{maximumFractionDigits:2});return(0,s.qy)(g||(g=O`${0}s ✅`),l)},U=(e,t)=>Object.entries(t).map(([t,i])=>(0,s.qy)(v||(v=O` <div class="row"> <div>${0}</div> <div>${0}</div> </div> `),i,e[t])),I=(e,t)=>{const i={};let a=!1;for(const s in e)s in t||"done"===s||(a=!0,i[s]=e[s]);return a?(0,s.qy)(m||(m=O`<ha-expansion-panel> <span slot="header">Raw</span> <ha-yaml-editor readOnly="readOnly" autoUpdate .value="${0}"></ha-yaml-editor> </ha-expansion-panel>`),i):""};class N extends s.WF{render(){var e,t,i,a;const n=this.pipelineRun&&["tts","intent","stt","wake_word"].find(e=>e in this.pipelineRun)||"ready",o=[],r=(this.pipelineRun.init_options&&"text"in this.pipelineRun.init_options.input?this.pipelineRun.init_options.input.text:void 0)||(null===(e=this.pipelineRun)||void 0===e||null===(e=e.stt)||void 0===e||null===(e=e.stt_output)||void 0===e?void 0:e.text)||(null===(t=this.pipelineRun)||void 0===t||null===(t=t.intent)||void 0===t?void 0:t.intent_input);return r&&o.push({from:"user",text:r}),null!==(i=this.pipelineRun)&&void 0!==i&&null!==(i=i.intent)&&void 0!==i&&null!==(i=i.intent_output)&&void 0!==i&&null!==(i=i.response)&&void 0!==i&&null!==(i=i.speech)&&void 0!==i&&null!==(i=i.plain)&&void 0!==i&&i.speech&&o.push({from:"hass",text:this.pipelineRun.intent.intent_output.response.speech.plain.speech}),(0,s.qy)(y||(y=O` <ha-card> <div class="card-content"> <div class="row heading"> <div>Run</div> <div>${0}</div> </div> ${0} ${0} </div> </ha-card> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <ha-card> <ha-expansion-panel> <span slot="header">Raw</span> <ha-yaml-editor read-only auto-update .value="${0}"></ha-yaml-editor> </ha-expansion-panel> </ha-card> `),this.pipelineRun.stage,U(this.pipelineRun.run,P),o.length>0?(0,s.qy)(f||(f=O` <div class="messages"> ${0} </div> <div style="clear:both"></div> `),o.map(({from:e,text:t})=>(0,s.qy)(w||(w=O` <div class="${0}">${0}</div> `),`message ${e}`,t))):"",V(this.pipelineRun,"ready",n),j(this.pipelineRun,"wake_word")?(0,s.qy)(b||(b=O` <ha-card> <div class="card-content"> <div class="row heading"> <span>Wake word</span> ${0} </div> ${0} </div> </ha-card> `),D(this.hass,this.pipelineRun,"wake_word"),this.pipelineRun.wake_word?(0,s.qy)($||($=O` <div class="card-content"> ${0} ${0} ${0} </div> `),U(this.pipelineRun.wake_word,H),this.pipelineRun.wake_word.wake_word_output?(0,s.qy)(x||(x=O`<div class="row"> <div>Model</div> <div> ${0} </div> </div> <div class="row"> <div>Timestamp</div> <div> ${0} </div> </div>`),this.pipelineRun.wake_word.wake_word_output.ww_id,this.pipelineRun.wake_word.wake_word_output.timestamp):"",I(this.pipelineRun.wake_word,T)):""):"",V(this.pipelineRun,"wake_word",n),j(this.pipelineRun,"stt")?(0,s.qy)(k||(k=O` <ha-card> <div class="card-content"> <div class="row heading"> <span>Speech-to-text</span> ${0} </div> ${0} </div> </ha-card> `),D(this.hass,this.pipelineRun,"stt","-vad-end"),this.pipelineRun.stt?(0,s.qy)(L||(L=O` <div class="card-content"> ${0} <div class="row"> <div>Language</div> <div>${0}</div> </div> ${0} ${0} </div> `),U(this.pipelineRun.stt,H),this.pipelineRun.stt.metadata.language,this.pipelineRun.stt.stt_output?(0,s.qy)(z||(z=O`<div class="row"> <div>Output</div> <div>${0}</div> </div>`),this.pipelineRun.stt.stt_output.text):"",I(this.pipelineRun.stt,H)):""):"",V(this.pipelineRun,"stt",n),j(this.pipelineRun,"intent")?(0,s.qy)(R||(R=O` <ha-card> <div class="card-content"> <div class="row heading"> <span>Natural Language Processing</span> ${0} </div> ${0} </div> </ha-card> `),D(this.hass,this.pipelineRun,"intent"),this.pipelineRun.intent?(0,s.qy)(q||(q=O` <div class="card-content"> ${0} ${0} <div class="row"> <div>Prefer handling locally</div> <div> ${0} </div> </div> <div class="row"> <div>Processed locally</div> <div> ${0} </div> </div> ${0} </div> `),U(this.pipelineRun.intent,F),this.pipelineRun.intent.intent_output?(0,s.qy)(M||(M=O`<div class="row"> <div>Response type</div> <div> ${0} </div> </div> ${0}`),this.pipelineRun.intent.intent_output.response.response_type,"error"===this.pipelineRun.intent.intent_output.response.response_type?(0,s.qy)(W||(W=O`<div class="row"> <div>Error code</div> <div> ${0} </div> </div>`),this.pipelineRun.intent.intent_output.response.data.code):""):"",this.pipelineRun.intent.prefer_local_intents,this.pipelineRun.intent.processed_locally,I(this.pipelineRun.intent,F)):""):"",V(this.pipelineRun,"intent",n),j(this.pipelineRun,"tts")?(0,s.qy)(C||(C=O` <ha-card> <div class="card-content"> <div class="row heading"> <span>Text-to-speech</span> ${0} </div> ${0} </div> ${0} </ha-card> `),D(this.hass,this.pipelineRun,"tts"),this.pipelineRun.tts?(0,s.qy)(A||(A=O` <div class="card-content"> ${0} ${0} </div> `),U(this.pipelineRun.tts,B),I(this.pipelineRun.tts,B)):"",null!==(a=this.pipelineRun)&&void 0!==a&&null!==(a=a.tts)&&void 0!==a&&a.tts_output?(0,s.qy)(E||(E=O` <div class="card-actions"> <ha-button @click="${0}"> Play Audio </ha-button> </div> `),this._playTTS):""):"",V(this.pipelineRun,"tts",n),this.pipelineRun)}_playTTS(){const e=this.pipelineRun.tts.tts_output.url,t=new Audio(e);t.addEventListener("error",()=>{(0,p.K$)(this,{title:"Error",text:"Error playing audio"})}),t.addEventListener("canplaythrough",()=>{t.play()})}}N.styles=(0,s.AH)(Z||(Z=O`: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:var(--ha-font-weight-medium);margin-bottom:16px}.messages{margin-top:8px}.message{font-size:var(--ha-font-size-l);margin:8px 0;padding:8px;border-radius:var(--ha-border-radius-xl);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)}`)),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],N.prototype,"hass",void 0),(0,a.__decorate)([(0,n.MZ)({attribute:!1})],N.prototype,"pipelineRun",void 0),N=(0,a.__decorate)([(0,n.EM)("assist-render-pipeline-run")],N),t()}catch(c){t(c)}})},38018:function(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{DialogVoiceAssistantPipelineDetail:function(){return z}});i(35748),i(65315),i(22416),i(59023),i(12977),i(5934),i(56660),i(95013);var s=i(69868),n=i(84922),o=i(11991),r=i(65940),d=i(44017),l=i(63211),p=i(88341),h=i(17372),c=(i(87348),i(60921),i(77510),i(156)),u=i(50809),_=(i(26723),i(34962),i(35284),i(556)),g=(i(83236),i(6858)),v=e([h,_,g]);[h,_,g]=v.then?(await v)():v;let m,y,f,w,b,$,x=e=>e;const k="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",L="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z";class z extends n.WF{showDialog(e){if(this._params=e,this._error=void 0,this._cloudActive=this._params.cloudActiveSubscription,this._params.pipeline)return this._data=Object.assign({prefer_local_intents:!1},this._params.pipeline),void(this._hideWakeWord=this._params.hideWakeWord||!this._data.wake_word_entity);let t,i;if(this._hideWakeWord=!0,this._cloudActive)for(const a of Object.values(this.hass.entities))if("cloud"===a.platform)if("stt"===(0,p.m)(a.entity_id)){if(t=a.entity_id,i)break}else if("tts"===(0,p.m)(a.entity_id)&&(i=a.entity_id,t))break;this._data={language:(this.hass.config.language||this.hass.locale.language).substring(0,2),stt_engine:t,tts_engine:i}}closeDialog(){this._params=void 0,this._data=void 0,this._hideWakeWord=!1,(0,d.r)(this,"dialog-closed",{dialog:this.localName})}firstUpdated(){this._getSupportedLanguages()}async _getSupportedLanguages(){const{languages:e}=await(0,c.ds)(this.hass);this._supportedLanguages=e}render(){var e,t,i;if(!this._params||!this._data)return n.s6;const a=null!==(e=this._params.pipeline)&&void 0!==e&&e.id?this._params.pipeline.name:this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.add_assistant_title");return(0,n.qy)(m||(m=x` <ha-dialog open @closed="${0}" scrimClickAction escapeKeyAction .heading="${0}"> <ha-dialog-header slot="heading"> <ha-icon-button slot="navigationIcon" dialogAction="cancel" .label="${0}" .path="${0}"></ha-icon-button> <span slot="title" .title="${0}">${0}</span> ${0} </ha-dialog-header> <div class="content"> ${0} <assist-pipeline-detail-config .hass="${0}" .data="${0}" .supportedLanguages="${0}" keys="name,language" @value-changed="${0}" ?dialogInitialFocus="${0}"></assist-pipeline-detail-config> <assist-pipeline-detail-conversation .hass="${0}" .data="${0}" keys="conversation_engine,conversation_language,prefer_local_intents" @value-changed="${0}"></assist-pipeline-detail-conversation> ${0} <assist-pipeline-detail-stt .hass="${0}" .data="${0}" keys="stt_engine,stt_language" @value-changed="${0}"></assist-pipeline-detail-stt> <assist-pipeline-detail-tts .hass="${0}" .data="${0}" keys="tts_engine,tts_language,tts_voice" @value-changed="${0}"></assist-pipeline-detail-tts> ${0} </div> <ha-button slot="primaryAction" @click="${0}" .loading="${0}" dialogInitialFocus> ${0} </ha-button> </ha-dialog> `),this.closeDialog,a,this.hass.localize("ui.common.close"),k,a,a,this._hideWakeWord&&!this._params.hideWakeWord&&this._hasWakeWorkEntities(this.hass.states)?(0,n.qy)(y||(y=x`<ha-button-menu slot="actionItems" @action="${0}" @closed="${0}" menu-corner="END" corner="BOTTOM_END"> <ha-icon-button .path="${0}" slot="trigger"></ha-icon-button> <ha-list-item> ${0} </ha-list-item></ha-button-menu>`),this._handleShowWakeWord,l.d,L,this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.add_streaming_wake_word")):n.s6,this._error?(0,n.qy)(f||(f=x`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):n.s6,this.hass,this._data,this._supportedLanguages,this._valueChanged,!(null!==(t=this._params.pipeline)&&void 0!==t&&t.id),this.hass,this._data,this._valueChanged,this._cloudActive||"cloud"!==this._data.tts_engine&&"cloud"!==this._data.stt_engine?n.s6:(0,n.qy)(w||(w=x` <ha-alert alert-type="warning"> ${0} <ha-button size="small" href="/config/cloud" slot="action"> ${0} </ha-button> </ha-alert> `),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_message"),this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_action")),this.hass,this._data,this._valueChanged,this.hass,this._data,this._valueChanged,this._hideWakeWord?n.s6:(0,n.qy)(b||(b=x`<assist-pipeline-detail-wakeword .hass="${0}" .data="${0}" keys="wake_word_entity,wake_word_id" @value-changed="${0}"></assist-pipeline-detail-wakeword>`),this.hass,this._data,this._valueChanged),this._updatePipeline,this._submitting,null!==(i=this._params.pipeline)&&void 0!==i&&i.id?this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.update_assistant_action"):this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.add_assistant_action"))}_handleShowWakeWord(){this._hideWakeWord=!1}_valueChanged(e){this._error=void 0;const t={};e.currentTarget.getAttribute("keys").split(",").forEach(i=>{t[i]=e.detail.value[i]}),this._data=Object.assign(Object.assign({},this._data),t)}async _updatePipeline(){this._submitting=!0;try{var e,t,i,a,s,n,o,r,d,l;const p=this._data,h={name:p.name,language:p.language,conversation_engine:p.conversation_engine,conversation_language:null!==(e=p.conversation_language)&&void 0!==e?e:null,prefer_local_intents:null===(t=p.prefer_local_intents)||void 0===t||t,stt_engine:null!==(i=p.stt_engine)&&void 0!==i?i:null,stt_language:null!==(a=p.stt_language)&&void 0!==a?a:null,tts_engine:null!==(s=p.tts_engine)&&void 0!==s?s:null,tts_language:null!==(n=p.tts_language)&&void 0!==n?n:null,tts_voice:null!==(o=p.tts_voice)&&void 0!==o?o:null,wake_word_entity:null!==(r=p.wake_word_entity)&&void 0!==r?r:null,wake_word_id:null!==(d=p.wake_word_id)&&void 0!==d?d:null};null!==(l=this._params.pipeline)&&void 0!==l&&l.id?await this._params.updatePipeline(h):this._params.createPipeline?await this._params.createPipeline(h):console.error("No createPipeline function provided"),this.closeDialog()}catch(p){this._error=(null==p?void 0:p.message)||"Unknown error"}finally{this._submitting=!1}}static get styles(){return[u.nA,(0,n.AH)($||($=x`.content>:not(:last-child){margin-bottom:16px;display:block}ha-alert{margin-bottom:16px;display:block}a{text-decoration:none}`))]}constructor(...e){super(...e),this._hideWakeWord=!1,this._submitting=!1,this._hasWakeWorkEntities=(0,r.A)(e=>Object.keys(e).some(e=>e.startsWith("wake_word.")))}}(0,s.__decorate)([(0,o.MZ)({attribute:!1})],z.prototype,"hass",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_params",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_data",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_hideWakeWord",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_cloudActive",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_error",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_submitting",void 0),(0,s.__decorate)([(0,o.wk)()],z.prototype,"_supportedLanguages",void 0),z=(0,s.__decorate)([(0,o.EM)("dialog-voice-assistant-pipeline-detail")],z),a()}catch(m){a(m)}})}}]);
|
|
//# sourceMappingURL=1695.5ece1f3e3afd34c8.js.map
|