/*! For license information please see 5624.7412d4b8fe54f98f.js.LICENSE.txt */
"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([["5624"],{90842:function(e,t,i){i.d(t,{t:function(){return n}});i(92745),i(77439),i(19423),i(39527),i(41360),i(88972);class s{constructor(e=window.localStorage){this.storage=void 0,this._storage={},this._listeners={},this.storage=e,e===window.localStorage&&window.addEventListener("storage",(e=>{e.key&&this.hasKey(e.key)&&(this._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,this._listeners[e.key]&&this._listeners[e.key].forEach((t=>t(e.oldValue?JSON.parse(e.oldValue):e.oldValue,this._storage[e.key]))))}))}addFromStorage(e){if(!this._storage[e]){const t=this.storage.getItem(e);t&&(this._storage[e]=JSON.parse(t))}}subscribeChanges(e,t){return this._listeners[e]?this._listeners[e].push(t):this._listeners[e]=[t],()=>{this.unsubscribeChanges(e,t)}}unsubscribeChanges(e,t){if(!(e in this._listeners))return;const i=this._listeners[e].indexOf(t);-1!==i&&this._listeners[e].splice(i,1)}hasKey(e){return e in this._storage}getValue(e){return this._storage[e]}setValue(e,t){const i=this._storage[e];this._storage[e]=t;try{void 0===t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify(t))}catch(s){}finally{this._listeners[e]&&this._listeners[e].forEach((e=>e(i,t)))}}}const a={},n=e=>t=>{const i=e.storage||"localStorage";let n;i&&i in a?n=a[i]:(n=new s(window[i]),a[i]=n);const o=String(t.key),l=e.key||String(t.key),r=t.initializer?t.initializer():void 0;n.addFromStorage(l);const d=!1!==e.subscribe?e=>n.subscribeChanges(l,((i,s)=>{e.requestUpdate(t.key,i)})):void 0,h=()=>n.hasKey(l)?e.deserializer?e.deserializer(n.getValue(l)):n.getValue(l):r;return{kind:"method",placement:"prototype",key:t.key,descriptor:{set(i){((i,s)=>{let a;e.state&&(a=h()),n.setValue(l,e.serializer?e.serializer(s):s),e.state&&i.requestUpdate(t.key,a)})(this,i)},get(){return h()},enumerable:!0,configurable:!0},finisher(i){if(e.state&&e.subscribe){const e=i.prototype.connectedCallback,t=i.prototype.disconnectedCallback;i.prototype.connectedCallback=function(){e.call(this),this[`__unbsubLocalStorage${o}`]=null==d?void 0:d(this)},i.prototype.disconnectedCallback=function(){var e;t.call(this),null===(e=this[`__unbsubLocalStorage${o}`])||void 0===e||e.call(this),this[`__unbsubLocalStorage${o}`]=void 0}}e.state&&i.createProperty(t.key,Object.assign({noAccessor:!0},e.stateOptions))}}}},54993:function(e,t,i){var s=i(73577),a=i(72621),n=(i(71695),i(47021),i(27323)),o=i(33990),l=i(88540),r=i(57243),d=i(50778);let h,u=e=>e;(0,s.Z)([(0,d.Mo)("ha-textarea")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({type:Boolean,reflect:!0})],key:"autogrow",value(){return!1}},{kind:"method",key:"updated",value:function(e){(0,a.Z)(i,"updated",this,3)([e]),this.autogrow&&e.has("value")&&(this.mdcRoot.dataset.value=this.value+'="')}},{kind:"field",static:!0,key:"styles",value(){return[o.W,l.W,(0,r.iv)(h||(h=u`:host([autogrow]) .mdc-text-field{position:relative;min-height:74px;min-width:178px;max-height:200px}:host([autogrow]) .mdc-text-field:after{content:attr(data-value);margin-top:23px;margin-bottom:9px;line-height:1.5rem;min-height:42px;padding:0px 32px 0 16px;letter-spacing:var(
--mdc-typography-subtitle1-letter-spacing,
.009375em
);visibility:hidden;white-space:pre-wrap}:host([autogrow]) .mdc-text-field__input{position:absolute;height:calc(100% - 32px)}:host([autogrow]) .mdc-text-field.mdc-text-field--no-label:after{margin-top:16px;margin-bottom:16px}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start) top}@media only screen and (min-width:459px){:host([mobile-multiline]) .mdc-text-field__input{white-space:nowrap;max-height:16px}}`))]}}]}}),n.O)},40137:function(e,t,i){i.r(t),i.d(t,{TTSTryDialog:function(){return y}});var s=i(73577),a=(i(71695),i(19423),i(40251),i(47021),i(57243)),n=i(50778),o=i(90842),l=i(11297),r=(i(20095),i(44118)),d=(i(54993),i(421)),h=i(4557);i(90977);let u,c,g,p,m=e=>e;let y=(0,s.Z)([(0,n.Mo)("dialog-tts-try")],(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.SB)()],key:"_loadingExample",value(){return!1}},{kind:"field",decorators:[(0,n.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_valid",value(){return!1}},{kind:"field",decorators:[(0,n.IO)("#message")],key:"_messageInput",value:void 0},{kind:"field",decorators:[(0,o.t)({key:"ttsTryMessages",state:!1,subscribe:!1})],key:"_messages",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._valid=Boolean(this._defaultMessage)}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,(0,l.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"get",key:"_defaultMessage",value:function(){var e,t;const i=null===(e=this._params.language)||void 0===e?void 0:e.substring(0,2),s=this.hass.locale.language.substring(0,2);return i&&null!==(t=this._messages)&&void 0!==t&&t[i]?this._messages[i]:i===s?this.hass.localize("ui.dialogs.tts-try.message_example"):""}},{kind:"method",key:"render",value:function(){return this._params?(0,a.dy)(u||(u=m` ${0} `),this.closeDialog,(0,r.i)(this.hass,this.hass.localize("ui.dialogs.tts-try.header")),this.hass.localize("ui.dialogs.tts-try.message"),this.hass.localize("ui.dialogs.tts-try.message_placeholder"),this._defaultMessage,this._inputChanged,!this._defaultMessage,this._loadingExample?(0,a.dy)(c||(c=m` `)):(0,a.dy)(g||(g=m` `),Boolean(this._defaultMessage),this.hass.localize("ui.dialogs.tts-try.play"),this._playExample,!this._valid,"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M10,16.5L16,12L10,7.5V16.5Z")):a.Ld}},{kind:"method",key:"_inputChanged",value:async function(){var e;this._valid=Boolean(null===(e=this._messageInput)||void 0===e?void 0:e.value)}},{kind:"method",key:"_playExample",value:async function(){var e;const t=null===(e=this._messageInput)||void 0===e?void 0:e.value;if(!t)return;const i=this._params.engine,s=this._params.language,a=this._params.voice;s&&(this._messages=Object.assign(Object.assign({},this._messages),{},{[s.substring(0,2)]:t})),this._loadingExample=!0;const n=new Audio;let o;n.play();try{o=(await(0,d.aT)(this.hass,{platform:i,message:t,language:s,options:{voice:a}})).path}catch(l){return this._loadingExample=!1,void(0,h.Ys)(this,{text:`Unable to load example. ${l.error||l.body||l}`,warning:!0})}n.src=o,n.addEventListener("canplaythrough",(()=>n.play())),n.addEventListener("playing",(()=>{this._loadingExample=!1})),n.addEventListener("error",(()=>{(0,h.Ys)(this,{title:"Error playing audio."}),this._loadingExample=!1}))}},{kind:"get",static:!0,key:"styles",value:function(){return(0,a.iv)(p||(p=m`ha-dialog{--mdc-dialog-max-width:500px}ha-select,ha-textarea{width:100%}ha-select{margin-top:8px}.loading{height:36px}`))}}]}}),a.oi)},27323:function(e,t,i){i.d(t,{O:function(){return p}});i(71695),i(47021);var s=i(9065),a=i(1105),n=i(57243),o=i(50778),l=i(35359),r=i(20552),d=i(91928);let h,u,c=e=>e;const g={fromAttribute(e){return null!==e&&(""===e||e)},toAttribute(e){return"boolean"==typeof e?e?"":null:e}};class p extends a.P{constructor(){super(...arguments),this.rows=2,this.cols=20,this.charCounter=!1}render(){const e=this.charCounter&&-1!==this.maxLength,t=e&&"internal"===this.charCounter,i=e&&!t,s=!!this.helper||!!this.validationMessage||i,a={"mdc-text-field--disabled":this.disabled,"mdc-text-field--no-label":!this.label,"mdc-text-field--filled":!this.outlined,"mdc-text-field--outlined":this.outlined,"mdc-text-field--end-aligned":this.endAligned,"mdc-text-field--with-internal-counter":t};return(0,n.dy)(h||(h=c` ${0} `),(0,l.$)(a),this.renderRipple(),this.outlined?this.renderOutline():this.renderLabel(),this.renderInput(),this.renderCharCounter(t),this.renderLineRipple(),this.renderHelperText(s,i))}renderInput(){const e=this.label?"label":void 0,t=-1===this.minLength?void 0:this.minLength,i=-1===this.maxLength?void 0:this.maxLength,s=this.autocapitalize?this.autocapitalize:void 0;return(0,n.dy)(u||(u=c` `),(0,r.o)(e),(0,d.a)(this.value),this.rows,this.cols,this.disabled,this.placeholder,this.required,this.readOnly,(0,r.o)(t),(0,r.o)(i),(0,r.o)(""===this.name?void 0:this.name),(0,r.o)(this.inputMode),(0,r.o)(s),this.handleInputChange,this.onInputBlur)}}(0,s.gn)([(0,o.IO)("textarea")],p.prototype,"formElement",void 0),(0,s.gn)([(0,o.Cb)({type:Number})],p.prototype,"rows",void 0),(0,s.gn)([(0,o.Cb)({type:Number})],p.prototype,"cols",void 0),(0,s.gn)([(0,o.Cb)({converter:g})],p.prototype,"charCounter",void 0)},88540:function(e,t,i){i.d(t,{W:function(){return a}});let s;const a=(0,i(57243).iv)(s||(s=(e=>e)`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`))}}]);
//# sourceMappingURL=5624.7412d4b8fe54f98f.js.map