UNPKG

iobroker.lovelace

Version:

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

40 lines 149 kB
export const __rspack_esm_id=72091;export const __rspack_esm_ids=[72091];export const __webpack_modules__={36312(t,e,s){s.d(e,{x:()=>i});s(74423);const i=(t,e)=>t&&t.components.includes(e)},62384(t,e,s){s.d(e,{v:()=>i});s(74423);const i=(t,e,s,i)=>{const[a,o,n]=t.split(".",3);return Number(a)>e||Number(a)===e&&(void 0===i?Number(o)>=s:Number(o)>s)||void 0!==i&&Number(a)===e&&Number(o)===s&&Number(n)>=i}},46190(t,e,s){s.d(e,{FD:()=>l,Is:()=>i,JF:()=>a,gt:()=>o,jj:()=>r,oL:()=>c,yd:()=>n});s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const i=["alert","button","climate","cover","configurator","event","input_button","input_select","input_number","input_text","humidifier","lawn_mower","lock","media_player","number","scene","script","select","timer","text","update","vacuum","water_heater"],a=["sensor","binary_sensor","calendar","camera","device_tracker","image","weather"],o=["assist_satellite","conversation","stt","tts"],n=["automation","button","cover","date","datetime","fan","group","humidifier","input_boolean","input_button","input_datetime","input_number","input_select","input_text","light","lock","media_player","number","scene","script","select","switch","text","time","vacuum","valve"],r=["closed","locked","off"],l=new Set(["fan","input_boolean","light","switch","group","automation","humidifier","valve"]),c=new Set(["camera","image","media_player"])},66033(t,e,s){s.d(e,{L:()=>i});const i=(t,e)=>{const s=t.floor_id;return{area:t,floor:(s?e[s]:void 0)||null}}},28455(t,e,s){s.d(e,{EX:()=>a,jI:()=>o,ln:()=>i});const i=(t,e,s,i,a)=>{const n=e[t.entity_id];return n?o(n,e,s,i,a):{entity:null,device:null,area:null,floor:null}},a=(t,e,s)=>{const i=e[t];if(!i)return;const a=i.device_id,o=a?s[a]:void 0;return i.area_id||o?.area_id||void 0},o=(t,e,s,i,a)=>{const o=e[t.entity_id],n=t?.device_id,r=n?s[n]:void 0,l=t?.area_id||r?.area_id,c=l?i[l]:void 0,d=c?.floor_id;return{entity:o,device:r||null,area:c||null,floor:(d?a[d]:void 0)||null}}},47129(t,e,s){s.d(e,{a:()=>o});s(74423);var i=s(22675),a=s(71727);function o(t,e){const s=(0,a.m)(t.entity_id),o=void 0!==e?e:t?.state;if(["button","event","infrared","input_button","radio_frequency","scene"].includes(s))return o!==i.Hh;if(o===i.Hh||o===i.HV)return!1;if("off"===o&&"alert"!==s)return!1;switch(s){case"alarm_control_panel":return"disarmed"!==o;case"alert":return"idle"!==o;case"cover":case"valve":return"closed"!==o;case"device_tracker":case"person":return"not_home"!==o;case"lawn_mower":return!["docked","paused"].includes(o);case"lock":return"locked"!==o;case"media_player":return"standby"!==o;case"vacuum":return!["idle","docked","paused"].includes(o);case"plant":return"problem"===o;case"group":return["on","home","open","locked","problem"].includes(o);case"timer":return"active"===o;case"camera":return"streaming"===o}return!0}},52658(t,e,s){s.d(e,{ZK:()=>p,gf:()=>h,mT:()=>g,Se:()=>d,mg:()=>u});s(44114),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);var i=s(22675),a=s(68287),o=s(86030),n=s(80880);var r=s(71727),l=s(47129);const c=new Set(["alarm_control_panel","alert","automation","binary_sensor","calendar","camera","climate","cover","device_tracker","fan","group","humidifier","input_boolean","lawn_mower","light","lock","media_player","person","plant","remote","schedule","script","siren","sun","switch","timer","update","vacuum","valve","water_heater","weather"]),d=(t,e)=>{if((void 0!==e?e:t?.state)===i.Hh)return"var(--state-unavailable-color)";const s=u(t,e);return s?(0,o.B)(s):void 0},h=(t,e,s)=>{const i=void 0!==s?s:e.state,a=(0,l.a)(e,s);return p(t,e.attributes.device_class,i,a)},p=(t,e,s,i)=>{const a=[],o=(0,n.Y)(s,"_"),r=i?"active":"inactive";return e&&a.push(`--state-${t}-${e}-${o}-color`),a.push(`--state-${t}-${o}-color`,`--state-${t}-${r}-color`,`--state-${r}-color`),a},u=(t,e)=>{const s=void 0!==e?e:t?.state,i=(0,r.m)(t.entity_id),o=t.attributes.device_class;if("sensor"===i&&"battery"===o){const t=(t=>{const e=Number(t);if(!isNaN(e))return e>=70?"--state-sensor-battery-high-color":e>=30?"--state-sensor-battery-medium-color":"--state-sensor-battery-low-color"})(s);if(t)return[t]}if("group"===i){const s=(0,a.z)(t);if(s&&c.has(s))return h(s,t,e)}if(c.has(i))return h(i,t,e)},g=t=>{if(t.attributes.brightness&&"plant"!==(0,r.m)(t.entity_id)){return`brightness(${(t.attributes.brightness+245)/5}%)`}return""}},86198(t,e,s){s.a(t,async function(t,i){try{s.d(e,{T:()=>r});var a=s(74487),o=s(22786),n=t([a]);a=(n.then?(await n)():n)[0];const r=(t,e)=>{try{return l(e)?.of(t)??t}catch{return t}},l=(0,o.A)(t=>new Intl.DisplayNames(t.language,{type:"language",fallback:"code"}));i()}catch(t){i(t)}})},20058(t,e,s){s.a(t,async function(t,i){try{s.d(e,{QL:()=>h,ZQ:()=>p,ZV:()=>d,ty:()=>l,x:()=>r});var a=s(74487),o=(s(74423),s(18111),s(61701),s(46927)),n=t([a]);a=(n.then?(await n)():n)[0];const r=t=>l(t.attributes),l=(t,e)=>!!t.unit_of_measurement||!!t.state_class||(e||[]).includes(t.device_class||""),c=t=>{switch(t.number_format){case o.jG.comma_decimal:return["en-US","en"];case o.jG.decimal_comma:return["de","es","it"];case o.jG.space_comma:return["fr","sv","cs"];case o.jG.quote_decimal:return["de-CH"];case o.jG.system:return;default:return t.language}},d=(t,e,s)=>h(t,e,s).map(t=>t.value).join(""),h=(t,e,s)=>{const i=e?c(e):void 0;return e?.number_format===o.jG.none||Number.isNaN(Number(t))?Number.isNaN(Number(t))||""===t||e?.number_format!==o.jG.none?[{type:"literal",value:t}]:new Intl.NumberFormat("en-US",u(t,{...s,useGrouping:!1})).formatToParts(Number(t)):new Intl.NumberFormat(i,u(t,s)).formatToParts(Number(t))},p=(t,e)=>{const s=e?.display_precision;return null!=s?{maximumFractionDigits:s,minimumFractionDigits:s}:Number.isInteger(Number(t?.attributes?.step))&&Number.isInteger(Number(t?.state))?{maximumFractionDigits:0}:void 0},u=(t,e)=>{const s={maximumFractionDigits:2,...e};if("string"!=typeof t)return s;if(!e||void 0===e.minimumFractionDigits&&void 0===e.maximumFractionDigits){const e=t.indexOf(".")>-1?t.split(".")[1].length:0;s.minimumFractionDigits=e,s.maximumFractionDigits=e}return s};i()}catch(t){i(t)}})},80880(t,e,s){s.d(e,{Y:()=>i});const i=(t,e="_")=>{const s="àáâäæãåāăąабçćčđďдèéêëēėęěеёэфğǵгḧхîïíīįìıİийкłлḿмñńǹňнôöòóœøōõőоṕпŕřрßśšşșсťțтûüùúūǘůűųувẃẍÿýыžźżз·",i=`aaaaaaaaaaabcccdddeeeeeeeeeeefggghhiiiiiiiiijkllmmnnnnnoooooooooopprrrsssssstttuuuuuuuuuuvwxyyyzzzz${e}`,a=new RegExp(s.split("").join("|"),"g"),o={ж:"zh",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ю:"iu",я:"ia"};let n;return""===t?n="":(n=t.toString().toLowerCase().replace(a,t=>i.charAt(s.indexOf(t))).replace(/[а-я]/g,t=>o[t]||"").replace(/(\d),(?=\d)/g,"$1").replace(/[^a-z0-9]+/g,e).replace(new RegExp(`(${e})\\1+`,"g"),"$1").replace(new RegExp(`^${e}+`),"").replace(new RegExp(`${e}+$`),""),""===n&&(n="unknown")),n}},19459(t,e,s){s.d(e,{b:()=>i});s(45367),s(92731),s(69479),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const i=(t,e,s)=>{if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;let a,o;if(Array.isArray(t)){if(o=t.length,o!==e.length)return!1;for(a=o;0!==a--;)if(!i(t[a],e[a],s))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a of t.entries())if(!e.has(a[0]))return!1;for(a of t.entries())if(!i(a[1],e.get(a[0]),s))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a of t.entries())if(!e.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(o=t.length,o!==e.length)return!1;for(a=o;0!==a--;)if(t[a]!==e[a])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const n=Object.keys(t);if(o=n.length,o!==Object.keys(e).length)return!1;for(a=o;0!==a--;)if(!Object.prototype.hasOwnProperty.call(e,n[a]))return!1;for(a=o;0!==a--;){const o=n[a];if(!i(t[o],e[o],s))return!1}if(s?.compareSymbols){const a=Object.getOwnPropertySymbols(t),o=Object.getOwnPropertySymbols(e);if(a.length!==o.length)return!1;for(const o of a){if(!Object.prototype.hasOwnProperty.call(e,o))return!1;if(!i(t[o],e[o],s))return!1}}return!0}return t!=t&&e!=e}},34296(t,e,s){var i=s(62826),a=s(96229),o=s(26069),n=s(91735),r=s(42034),l=s(5124),c=s(22441);class d extends a.k{renderOutline(){return this.filled?l.qy`<span class="filled"></span>`:super.renderOutline()}getContainerClasses(){return{...super.getContainerClasses(),active:this.active}}renderPrimaryContent(){return l.qy` <span class="leading icon" aria-hidden="true"> ${this.renderLeadingIcon()} </span> <span class="label">${this.label}</span> <span class="touch"></span> <span class="trailing leading icon" aria-hidden="true"> ${this.renderTrailingIcon()} </span> `}renderTrailingIcon(){return l.qy`<slot name="trailing-icon"></slot>`}constructor(...t){super(...t),this.filled=!1,this.active=!1}}d.styles=[n.R,r.R,o.R,l.AH`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-assist-chip-container-shape:var(
          --ha-assist-chip-container-shape,
          16px
        );--md-assist-chip-outline-color:var(--outline-color);--md-assist-chip-label-text-weight:400}.filled{display:flex;pointer-events:none;border-radius:inherit;inset:0;position:absolute;background-color:var(--ha-assist-chip-filled-container-color)}::slotted([slot=icon]),::slotted([slot=trailing-icon]){display:flex;--mdc-icon-size:var(--md-input-chip-icon-size, 18px);font-size:var(--_label-text-size)!important}.trailing.icon ::slotted(*),.trailing.icon svg{margin-inline-end:unset;margin-inline-start:var(--_icon-label-space)}::before{background:var(--ha-assist-chip-container-color,transparent);opacity:var(--ha-assist-chip-container-opacity, 1)}:where(.active)::before{background:var(--ha-assist-chip-active-container-color);opacity:var(--ha-assist-chip-active-container-opacity)}.label{font-family:var(--ha-font-family-body)}`],(0,i.Cg)([(0,c.MZ)({type:Boolean,reflect:!0})],d.prototype,"filled",void 0),(0,i.Cg)([(0,c.MZ)({type:Boolean})],d.prototype,"active",void 0),d=(0,i.Cg)([(0,c.EM)("ha-assist-chip")],d)},66086(t,e,s){s.a(t,async function(t,e){try{s(74423),s(18111),s(22489),s(61701);var i=s(62826),a=s(5124),o=s(22441),n=s(22786),r=s(1087),l=s(65522),c=s(55931),d=s(66033),h=s(49852),p=s(2514),u=s(65063),g=s(34023),_=(s(75064),s(38508)),v=s(26300),m=(s(67094),t([_,v]));[_,v]=m.then?(await m)():m;const y="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",f="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z",b="___ADD_NEW___";class w extends a.WF{willUpdate(t){this._pendingAreaId&&t.has("hass")&&this.hass.areas!==t.get("hass")?.areas&&this.hass.areas[this._pendingAreaId]&&(this._setValue(this._pendingAreaId),this._pendingAreaId=void 0)}async open(){await this.updateComplete,await(this._picker?.open())}render(){const t=this.label??this.hass.localize("ui.components.area-picker.area"),e=this._computeValueRenderer(this.hass.areas);let s=t;if(this.value&&t){const t=this.hass.areas[this.value];if(t){const{floor:e}=(0,d.L)(t,this.hass.floors);e&&(s=void 0)}}return a.qy` <ha-generic-picker .hass="${this.hass}" .autofocus="${this.autofocus}" .label="${s}" .helper="${this.helper}" .notFoundLabel="${this._notFoundLabel}" .emptyLabel="${this.hass.localize("ui.components.area-picker.no_areas")}" .disabled="${this.disabled}" .required="${this.required}" .value="${this.value}" .getItems="${this._getItems}" .getAdditionalItems="${this._getAdditionalItems}" .valueRenderer="${e}" .addButtonLabel="${this.addButtonLabel}" .searchKeys="${h.P}" .unknownItemText="${this.hass.localize("ui.components.area-picker.unknown")}" @value-changed="${this._valueChanged}"> </ha-generic-picker> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;if(e){if(e.startsWith(b)){this.hass.loadFragmentTranslation("config");const t=e.substring(b.length);return void(0,g.J)(this,{suggestedName:t,createEntry:async t=>{try{const e=await(0,p.L3)(this.hass,t);this.hass.areas[e.area_id]?this._setValue(e.area_id):this._pendingAreaId=e.area_id}catch(t){(0,u.showAlertDialog)(this,{title:this.hass.localize("ui.components.area-picker.failed_create_area"),text:t.message})}}})}this._setValue(e)}else this._setValue(void 0)}_setValue(t){this.value=t,(0,r.r)(this,"value-changed",{value:t}),(0,r.r)(this,"change")}constructor(...t){super(...t),this.noAdd=!1,this.disabled=!1,this.required=!1,this._getAreasMemoized=(0,n.A)(h.j),this._computeValueRenderer=(0,n.A)(t=>t=>{const e=this.hass.areas[t];if(!e)return a.qy` <ha-svg-icon slot="start" .path="${f}"></ha-svg-icon> <span slot="headline">${e}</span> `;const{floor:s}=(0,d.L)(e,this.hass.floors),i=e?(0,l.A)(e):void 0,o=s?(0,c.X)(s):void 0,n=e.icon;return a.qy` ${n?a.qy`<ha-icon slot="start" .icon="${n}"></ha-icon>`:a.qy`<ha-svg-icon slot="start" .path="${f}"></ha-svg-icon>`} <span slot="headline">${i}</span> ${o?a.qy`<span slot="supporting-text">${o}</span>`:a.s6} `}),this._getItems=()=>this._getAreasMemoized(this.hass.areas,this.hass.floors,this.hass.devices,this.hass.entities,this.hass.states,this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeAreas),this._allAreaNames=(0,n.A)(t=>Object.values(t).map(t=>(0,l.A)(t)?.toLowerCase()).filter(Boolean)),this._getAdditionalItems=t=>{if(this.noAdd)return[];const e=this._allAreaNames(this.hass.areas);return t&&!e.includes(t.toLowerCase())?[{id:b+t,primary:this.hass.localize("ui.components.area-picker.add_new_suggestion",{name:t}),icon_path:y}]:[{id:b,primary:this.hass.localize("ui.components.area-picker.add_new"),icon_path:y}]},this._notFoundLabel=t=>this.hass.localize("ui.components.area-picker.no_match",{term:a.qy`<b>‘${t}’</b>`})}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)()],w.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],w.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)()],w.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)()],w.prototype,"placeholder",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,attribute:"no-add"})],w.prototype,"noAdd",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"include-domains"})],w.prototype,"includeDomains",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"exclude-domains"})],w.prototype,"excludeDomains",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"include-device-classes"})],w.prototype,"includeDeviceClasses",void 0),(0,i.Cg)([(0,o.MZ)({type:Array,attribute:"exclude-areas"})],w.prototype,"excludeAreas",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"deviceFilter",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"entityFilter",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],w.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],w.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"add-button-label"})],w.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,o.P)("ha-generic-picker")],w.prototype,"_picker",void 0),(0,i.Cg)([(0,o.wk)()],w.prototype,"_pendingAreaId",void 0),w=(0,i.Cg)([(0,o.EM)("ha-area-picker")],w),e()}catch(t){e(t)}})},99611(t,e,s){s.a(t,async function(t,e){try{s(18111),s(13579),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);var i=s(62826),a=s(1126),o=s(35211),n=s(5124),r=s(22441),l=s(1087),c=s(60353),d=s(22792),h=s(59992),p=s(14503),u=s(22348),g=t([a]);a=(g.then?(await g)():g)[0];const _=300,v=new Set(["ha-control-slider","ha-slider","ha-control-switch","ha-control-circular-slider","ha-hs-color-picker","ha-map","ha-more-info-control-select-container","ha-filter-chip"]),m=new Set(["volume-slider-container","forecast"]);class y extends((0,h.V)(n.WF)){get scrollableElement(){return this._bodyElement}connectedCallback(){super.connectedCallback(),this.addEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.addEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0})}updated(t){super.updated(t),t.has("open")&&(this._drawerOpen=this.open)}render(){return n.qy` <wa-drawer id="drawer" placement="bottom" .open="${this._drawerOpen}" .lightDismiss="${!this.preventScrimClose}" .ariaLabelledby="${this.ariaLabelledBy}" .ariaDescribedby="${this.ariaDescribedBy}" @keydown="${this._handleKeyDown}" @wa-show="${this._handleShow}" @wa-after-show="${this._handleAfterShow}" @wa-hide="${this._handleHide}" @wa-after-hide="${this._handleAfterHide}" @click="${this._handleCloseAction}" without-header @touchstart="${this._handleTouchStart}"> <div class="handle-wrapper" aria-hidden="true"> <div class="handle"></div> </div> <slot name="header"></slot> <div class="content-wrapper"> <div id="body" class="body ha-scrollbar"> <slot></slot> </div> ${this.renderScrollableFades()} </div> <slot name="footer"></slot> </wa-drawer> `}_startResizing(t){document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd),this._gestureRecognizer.start(t)}_animateSnapBack(){this.style.setProperty("--dialog-transition",`transform ${_}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},_)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.removeEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0}),this._unregisterResizeHandlers(),this._isDragging=!1}static get styles(){return[...super.styles,p.dp,n.AH`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${_}ms;--hide-duration:${_}ms}wa-drawer::part(dialog){max-height:min(var(--ha-bottom-sheet-max-height,90vh),calc(100vh - max(var(--safe-area-inset-top),48px)));max-height:min(var(--ha-bottom-sheet-max-height,90dvh),calc(100dvh - max(var(--safe-area-inset-top),48px)));align-items:center;transform:var(--dialog-transform);transition:var(--dialog-transition)}@media (prefers-reduced-motion:reduce){wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:1ms;--hide-duration:1ms}wa-drawer::part(dialog){transition:1ms}}wa-drawer::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));background-color:var(--ha-bottom-sheet-scrim-color,var(--mdc-dialog-scrim-color,none))}wa-drawer::part(body){max-width:var(--ha-bottom-sheet-max-width);width:100%;position:relative;border-top-left-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));border-top-right-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));background-color:var(--ha-bottom-sheet-surface-background,var(--ha-dialog-surface-background,var(--card-background-color,var(--ha-color-surface-default))));-webkit-backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));padding:var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left))}:host([flexcontent]) wa-drawer::part(body){display:flex;flex-direction:column}:host([prevent-scrim-close]) .handle-wrapper{display:none}.handle-wrapper{position:absolute;top:0;inset-inline-start:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;pointer-events:none;z-index:1}.handle-wrapper .handle{height:16px;width:200px;display:flex;justify-content:center;align-items:center}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--ha-bottom-sheet-handle-color,var(--divider-color));width:40px}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{padding:var(--ha-bottom-sheet-content-padding,0);box-sizing:border-box}:host([flexcontent]) .body{flex:1;max-width:100%;display:flex;flex-direction:column;padding:var(--ha-bottom-sheet-content-padding,var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)));box-sizing:border-box}slot[name=footer]{display:block;padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%;box-sizing:border-box}:host([flexcontent]) slot[name=footer]{flex-shrink:0}`]}constructor(...t){super(...t),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new c.u,this._isDragging=!1,this._escapePressed=!1,this._handleShow=async()=>{this._drawerOpen=!0,this.open=!0,(0,l.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{const t=this._autofocusElement;this._hassConfig?.auth.external&&(0,u.V)(this._hassConfig.auth.external)?t&&(t.id||(t.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})):t?.focus()})},this._handleAfterShow=()=>{(0,l.r)(this,"after-show")},this._handleSliderInteractionStart=()=>{this._sliderInteractionActive=!0},this._handleSliderInteractionStop=()=>{this._sliderInteractionActive=!1},this._handleAfterHide=t=>{if(this._sliderInteractionActive)return this._drawerOpen=!0,void(this.open=!0);t.eventPhase===Event.AT_TARGET&&(this.open=!1,this._drawerOpen=!1,(0,l.r)(this,"closed"))},this._handleHide=t=>{if(t.eventPhase!==Event.AT_TARGET)return;const e=t.detail.source===t.target.drawer;if(this._sliderInteractionActive)return t.preventDefault(),this._drawerOpen=!0,this.open=!0,void(this._escapePressed=!1);this.preventScrimClose&&this._escapePressed&&e&&t.preventDefault(),this._escapePressed=!1},this._handleKeyDown=t=>{"Escape"===t.key&&(this._escapePressed=!0,this.preventScrimClose&&t.preventDefault(),t.stopPropagation(),t.currentTarget.open=!1)},this._handleCloseAction=t=>{t.composedPath().some(t=>t instanceof HTMLElement&&("close"===t.getAttribute("data-dialog")||"close"===t.getAttribute("data-drawer")))&&(this._drawerOpen=!1)},this._handleTouchStart=t=>{if(this.preventScrimClose)return;const e=t.composedPath();for(const t of e){if(t===this._drawer)break;if(t instanceof HTMLElement&&(t.scrollTop>0||v.has(t.localName)||Array.from(t.classList).some(t=>m.has(t))))return}t.stopPropagation(),this._startResizing(t.touches[0].clientY)},this._handleTouchMove=t=>{const e=t.touches[0].clientY,s=this._gestureRecognizer.move(e);s<0&&(t.preventDefault(),this._isDragging=!0,requestAnimationFrame(()=>{this._isDragging&&this.style.setProperty("--dialog-transform",`translateY(${-1*s}px)`)}))},this._handleTouchEnd=()=>{this._unregisterResizeHandlers(),this._isDragging=!1;const t=this._gestureRecognizer.end();if(t.isSwipe)return void(t.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const e=this._drawer.shadowRoot?.querySelector('[part="body"]'),s=e?.offsetHeight||0;s>0&&t.delta<0&&Math.abs(t.delta)>.5*s?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,i.Cg)([(0,r.MZ)({attribute:"aria-labelledby"})],y.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"aria-describedby"})],y.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean})],y.prototype,"open",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],y.prototype,"flexContent",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],y.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,r.wk)()],y.prototype,"_drawerOpen",void 0),(0,i.Cg)([(0,r.wk)()],y.prototype,"_sliderInteractionActive",void 0),(0,i.Cg)([(0,r.wk)(),(0,o.Fg)({context:d.WF,subscribe:!0})],y.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,r.P)("#drawer")],y.prototype,"_drawer",void 0),(0,i.Cg)([(0,r.P)("#body")],y.prototype,"_bodyElement",void 0),(0,i.Cg)([(0,r.P)("[autofocus]")],y.prototype,"_autofocusElement",void 0),y=(0,i.Cg)([(0,r.EM)("ha-bottom-sheet")],y),e()}catch(t){e(t)}})},70947(t,e,s){var i=s(62826),a=s(50759),o=(s(38625),s(5124)),n=s(22441);s(67094);class r extends a.A{renderCheckboxIcon(){return o.qy` <ha-svg-icon id="check" part="checkmark" .path="${this.checked?"M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z":"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"}"></ha-svg-icon> `}static get styles(){return[a.A.styles,o.AH`:host{min-height:var(--ha-space-10)}#check{visibility:visible;flex-shrink:0}#icon ::slotted(*){color:var(--ha-color-on-neutral-normal)}:host([variant=danger]) #icon ::slotted(*){color:var(--ha-color-on-danger-quiet)}:host([selected]){font-weight:var(--ha-font-weight-medium);color:var(--primary-color);background-color:var(--ha-color-fill-primary-quiet-resting);--icon-primary-color:var(--primary-color)}:host([selected]:hover){background-color:var(--ha-color-fill-primary-quiet-hover)}`]}constructor(...t){super(...t),this.selected=!1}}(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],r.prototype,"selected",void 0),r=(0,i.Cg)([(0,n.EM)("ha-dropdown-item")],r)},29823(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(52254),o=s(5124),n=s(22441),r=t([a]);a=(r.then?(await r)():r)[0];class l extends a.A{get anchorElement(){return this.popup?.anchor}set anchorElement(t){this.popup&&(this.popup.anchor&&"ha-icon-button"===this.popup.anchor.localName&&(this.popup.anchor.selected=!1),this.popup.anchor=t)}getTrigger(){return this.anchorElement?this.anchorElement:super.getTrigger()}async showMenu(){await super.showMenu();const t=this.getTrigger();t&&"ha-icon-button"===t.localName&&(t.selected=!0)}async hideMenu(){const t=this.getTrigger();t&&"ha-icon-button"===t.localName&&(t.selected=!1),await super.hideMenu()}static get styles(){return[a.A.styles,o.AH`:host{font-size:var(--ha-dropdown-font-size, var(--ha-font-size-m));--wa-color-surface-raised:var(
            --card-background-color,
            var(--ha-dialog-surface-background, var(--mdc-theme-surface, #fff)),
          )}#menu{padding:var(--ha-space-1)}wa-popup::part(popup){z-index:200}`]}constructor(...t){super(...t),this.dropdownTag="ha-dropdown",this.dropdownItemTag="ha-dropdown-item"}}(0,i.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"dropdownTag",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"dropdownItemTag",void 0),l=(0,i.Cg)([(0,n.EM)("ha-dropdown")],l),e()}catch(t){e(t)}})},38508(t,e,s){s.a(t,async function(t,e){try{s(18111),s(13579);var i=s(62826),a=s(61366),o=s(35211),n=s(5124),r=s(22441),l=s(63672),c=s(91335),d=s(1087),h=s(22792),p=s(17894),u=s(22348),g=s(99611),_=s(18350),v=(s(75064),s(3449),s(49639)),m=s(88285),y=(s(67094),t([a,g,_,v,m]));[a,g,_,v,m]=y.then?(await y)():y;const f="M3 16H10V14H3M18 14V10H16V14H12V16H16V20H18V16H22V14M14 6H3V8H14M14 10H3V12H14V10Z";class b extends((0,p.c)(n.WF)){willUpdate(t){t.has("value")&&this._setUnknownValue()}setFieldValue(t){this._comboBox?this._comboBox.setFieldValue(t):this._initialFieldValue=t}render(){const t=this.useTopLabel&&this.value?void 0:this.label;return n.qy`<div class="container"> ${this.useTopLabel&&this.label?n.qy`<label ?disabled="${this.disabled}">${this.label}</label>`:n.s6} <div id="picker"> <slot name="field"> ${this.addButtonLabel&&!this.value?n.qy`<ha-button size="small" appearance="filled" @click="${this.open}" .disabled="${this.disabled}"> <ha-svg-icon .path="${f}" slot="start"></ha-svg-icon> ${this.addButtonLabel} </ha-button>`:n.qy`<ha-picker-field type="button" class="${this._opened?"opened":""}" compact="compact" .unknown="${this._unknownValue}" .unknownItemText="${this.unknownItemText}" aria-label="${(0,l.J)(this.label)}" @click="${this.open}" @clear="${this._clear}" .icon="${this.icon}" .image="${this.image}" .label="${t}" .placeholder="${this.placeholder}" .value="${this.value}" .valueRenderer="${this.valueRenderer}" .required="${this.required}" .disabled="${this.disabled}" .invalid="${this.invalid}" .hideClearIcon="${this.hideClearIcon}"> <slot name="start"></slot> </ha-picker-field>`} </slot> </div> ${this._pickerWrapperOpen||this._opened?this._openedNarrow?n.qy` <ha-bottom-sheet flexcontent .open="${this._pickerWrapperOpen}" @wa-after-show="${this._dialogOpened}" @closed="${this._hidePicker}" role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox(!0)} </ha-bottom-sheet> `:n.qy` <wa-popover .open="${this._pickerWrapperOpen}" style="--body-width:${this._popoverWidth}px" without-arrow distance="-4" .placement="${this.popoverPlacement}" .for="${this.popoverAnchor?null:"picker"}" .anchor="${this.popoverAnchor??null}" auto-size="vertical" auto-size-padding="16" @wa-after-show="${this._dialogOpened}" @wa-after-hide="${this._hidePicker}" trap-focus role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox()} </wa-popover> `:n.s6} </div> ${this._renderHelper()}`}_renderComboBox(t=!1){return this._opened?n.qy` <ha-picker-combo-box id="combo-box" .allowCustomValue="${this.allowCustomValue}" .label="${this.searchLabel}" .value="${this._selectedValue??this.value}" @value-changed="${this._valueChanged}" .rowRenderer="${this.rowRenderer}" .notFoundLabel="${this.notFoundLabel}" .emptyLabel="${this.emptyLabel}" .getItems="${this.getItems}" .getAdditionalItems="${this.getAdditionalItems}" .searchFn="${this.searchFn}" .mode="${t?"dialog":"popover"}" .sections="${this.sections}" .sectionTitleFunction="${this.sectionTitleFunction}" .selectedSection="${this.selectedSection}" .searchKeys="${this.searchKeys}" .customValueLabel="${this.customValueLabel}" .noSort="${this.noSort}"></ha-picker-combo-box> `:n.s6}_renderHelper(){const t=this.invalid&&this.errorMessage,e=!t&&this.helper;return t||e?n.qy`<ha-input-helper-text .disabled="${this.disabled}"> ${t?this.errorMessage:this.helper} </ha-input-helper-text>`:n.s6}refreshItems(){this._comboBox?.refreshItems()}_hidePicker(t){t.stopPropagation(),this._newValue&&((0,d.r)(this,"value-changed",{value:this._newValue}),this._newValue=void 0),this._opened=!1,this._pickerWrapperOpen=!1,this._selectedValue=void 0,this._unsubscribeTinyKeys?.(),(0,d.r)(this,"picker-closed")}_valueChanged(t){t.stopPropagation();const e=t.detail.value;e&&(this._pickerWrapperOpen=!1,this._newValue=e)}_clear(t){t.stopPropagation(),this._setValue(void 0)}_setValue(t){this.value=t,(0,d.r)(this,"value-changed",{value:t})}async open(t,e){t?.stopPropagation(),this.disabled||(this._selectedValue=e?.selectedValue,this._openedNarrow=this._narrow,this._popoverWidth=this._containerElement?.offsetWidth||250,this._pickerWrapperOpen=!0,this._unsubscribeTinyKeys=(0,c.Tc)(this,{Escape:this._handleEscClose}))}connectedCallback(){super.connectedCallback(),this._handleResize(),window.addEventListener("resize",this._handleResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize),this._unsubscribeTinyKeys?.()}static get styles(){return[n.AH`.container{position:relative;display:block;max-width:100%}label[disabled]{color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}label{display:block;margin:0 0 8px}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}:host([invalid]) ha-input-helper-text{color:var(--mdc-theme-error,var(--error-color,#b00020))}wa-popover{--wa-space-l:0}wa-popover::part(dialog)::backdrop{background:0 0}wa-popover::part(body){width:var(--ha-generic-picker-width,max(var(--body-width),250px));max-width:var(--ha-generic-picker-max-width,var(--ha-generic-picker-width,max(var(--body-width),250px)));max-height:500px;height:70vh;overflow:hidden}@media (max-height:1000px){wa-popover::part(body){max-height:400px}}ha-bottom-sheet{--ha-bottom-sheet-height:90vh;--ha-bottom-sheet-height:calc(100dvh - var(--ha-space-12));--ha-bottom-sheet-max-height:var(--ha-bottom-sheet-height);--ha-bottom-sheet-max-width:600px;--ha-bottom-sheet-padding:0;--ha-bottom-sheet-surface-background:var(--card-background-color);--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-content-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}`]}constructor(...t){super(...t),this.popoverPlacement="bottom",this.useTopLabel=!1,this.noSort=!1,this._opened=!1,this._pickerWrapperOpen=!1,this._popoverWidth=0,this._openedNarrow=!1,this._unknownValue=!1,this._narrow=!1,this.invalid=!1,this._setUnknownValue=()=>{const t=this.getItems();!this.allowCustomValue&&void 0!==this.value&&null!==this.value&&""!==this.value&&t?this._unknownValue=!t.some(t=>"string"!=typeof t&&t.id===this.value):this._unknownValue=!1},this._dialogOpened=()=>{this._opened=!0,(0,d.r)(this,"picker-opened"),requestAnimationFrame(()=>{this._initialFieldValue&&(this._comboBox?.setFieldValue(this._initialFieldValue),this._initialFieldValue=void 0),this._hassConfig?.auth.external&&(0,u.V)(this._hassConfig.auth.external)?this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:"combo-box"}}):this._comboBox?.focus()})},this._handleResize=()=>{this._narrow=window.matchMedia("(max-width: 870px)").matches||window.matchMedia("(max-height: 500px)").matches,!this._openedNarrow&&this._pickerWrapperOpen&&(this._popoverWidth=this._containerElement?.offsetWidth||250)},this._handleEscClose=t=>{t.stopPropagation()}}}b.shadowRootOptions={...n.WF.shadowRootOptions,delegatesFocus:!0},(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"allow-custom-value"})],b.prototype,"allowCustomValue",void 0),(0,i.Cg)([(0,r.MZ)({type:String,attribute:"search-label"})],b.prototype,"searchLabel",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"getItems",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"getAdditionalItems",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"rowRenderer",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"searchFn",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"searchKeys",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"notFoundLabel",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"empty-label"})],b.prototype,"emptyLabel",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"popover-placement"})],b.prototype,"popoverPlacement",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"add-button-label"})],b.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"sections",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"sectionTitleFunction",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"selected-section"})],b.prototype,"selectedSection",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"popoverAnchor",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"use-top-label"})],b.prototype,"useTopLabel",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"custom-value-label"})],b.prototype,"customValueLabel",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"no-sort"})],b.prototype,"noSort",void 0),(0,i.Cg)([(0,r.P)(".container")],b.prototype,"_containerElement",void 0),(0,i.Cg)([(0,r.P)("ha-picker-combo-box")],b.prototype,"_comboBox",void 0),(0,i.Cg)([(0,r.wk)(),(0,o.Fg)({context:h.WF,subscribe:!0})],b.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_opened",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_pickerWrapperOpen",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_popoverWidth",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_openedNarrow",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_unknownValue",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_selectedValue",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"error-message"})],b.prototype,"errorMessage",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],b.prototype,"invalid",void 0),b=(0,i.Cg)([(0,r.EM)("ha-generic-picker")],b),e()}catch(t){e(t)}})},3449(t,e,s){var i=s(62826),a=s(5124),o=s(22441);class n extends a.WF{render(){return a.qy`<slot></slot>`}constructor(...t){super(...t),this.disabled=!1}}n.styles=a.AH`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:var(--ha-font-size-s);padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px;letter-spacing:var(
        --mdc-typography-caption-letter-spacing,
        .0333333333em
      );line-height:normal}:host([disabled]){color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}`,(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0),n=(0,i.Cg)([(0,o.EM)("ha-input-helper-text")],n)},14927(t,e,s){s.a(t,async function(t,i){try{s.r(e),s.d(e,{HaLanguagePicker:()=>f,getLanguageOptions:()=>y});var a=s(74487),o=(s(18111),s(20116),s(61701),s(62826)),n=s(5124),r=s(22441),l=s(22786),c=s(1087),d=s(86198),h=s(52220),p=s(28684),u=s(18350),g=s(38508),_=t([a,u,g,d]);[a,u,g,d]=_.then?(await _)():_;const v="M7,10L12,15L17,10H7Z",m=[{name:"primary",weight:10},{name:"secondary",weight:8},{name:"search_labels.english",weight:5}],y=(t,e,s,i)=>{let a=[];const o={language:"en"};if(e){const e=p.P.translations;a=t.map(t=>{let s=e[t]?.nativeName;if(!s)try{s=new Intl.DisplayNames(t,{type:"language",fallback:"code"}).of(t)}catch(e){s=t}const a=(0,d.T)(t,i||{language:navigator.language}),n=(0,d.T)(t,o);return{id:t,primary:s,secondary:a!==s?a:void 0,search_labels:{english:n!==s?n:null}}})}else i&&(a=t.map(t=>{const e=(0,d.T)(t,i),s=(0,d.T)(t,o);return{id:t,primary:e,search_labels:{english:s!==e?s:null}}}));return!s&&i&&a.sort((t,e)=>(0,h.SH)(t.primary,e.primary,i.language)),a};class f extends n.WF{firstUpdated(t){super.firstUpdated(t),this._computeDefaultLanguageOptions()}_computeDefaultLanguageOptions(){this._defaultLanguages=Object.keys(p.P.translations)}render(){const t=this.label??(this.hass?.localize("ui.components.language-picker.language")||"Language"),e=this.value??(this.required&&!this.disabled?this._getItems()[0].id:this.value);return n.qy` <ha-generic-picker .hass="${this.hass}" .autofocus="${this.autofocus}" .notFoundLabel="${this._notFoundLabel}" .emptyLabel="${this.hass?.localize("ui.components.language-picker.no_languages")||"No languages available"}" .label="${t}" .value="${e}" .valueRenderer="${this._valueRenderer}" .disabled="${this.disabled}" .helper="${this.helper}" .getItems="${this._getItems}" .searchKeys="${m}" @value-changed="${this._changed}" hide-clear-icon> ${this.buttonStyle?n.qy`<ha-button slot="field" .disabled="${this.disabled}" @click="${this._openPicker}" appearance="plain" variant="neutral"> ${this._getLanguageName(e)} <ha-svg-icon slot="end" .path="${v}"></ha-svg-icon> </ha-button>`:n.s6} </ha-generic-picker> `}_openPicker(t){t.stopPropagation(),this.genericPicker.open()}_changed(t){t.stopPropagation(),this.value=t.detail.value,(0,c.r)(this,"value-changed",{value:this.value})}constructor(...t){super(...t),this.disabled=!1,this.required=!1,this.nativeName=!1,this.buttonStyle=!1,this.noSort=!1,this._defaultLanguages=[],this._getLanguagesOptions=(0,l.A)(y),this._getItems=()=>this._getLanguagesOptions(this.languages??this._defaultLanguages,this.nativeName,this.noSort,this.hass?.locale),this._getLanguageName=t=>this._getItems().find(e=>e.id===t)?.primary,this._valueRenderer=t=>n.qy`<span slot="headline">${this._getLanguageName(t)??t}</span> `,this._notFoundLabel=t=>{const e=n.qy`<b>‘${t}’</b>`;return this.hass?this.hass.localize("ui.components.language-picker.no_match",{term:e}):n.qy`No languages found for ${e}`}}}f.styles=n.AH`ha-generic-picker{width:100%;display:block}`,(0,o.Cg)([(0,r.MZ)()],f.prototype,"value",void 0),(0,o.Cg)([(0,r.MZ)()],f.prototype,"label",void 0),(0,o.Cg)([(0,r.MZ)({type:Array})],f.prototype,"languages",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],f.prototype,"disabled",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],f.prototype,"required",void 0),(0,o.Cg)([(0,r.MZ)()],f.prototype,"helper",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"native-name",type:Boolean})],f.prototype,"nativeName",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,attribute:"button-style"})],f.prototype,"buttonStyle",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"no-sort",type:Boolean})],f.prototype,"noSort",void 0),(0,o.Cg)([(0,r.wk)()],f.prototype,"_defaultLanguages",void 0),(0,o.Cg)([(0,r.P)("ha-generic-picker",!0)],f.prototype,"genericPicker",void 0),f=(0,o.Cg)([(0,r.EM)("ha-language-picker")],f),i()}catch(t){i(t)}})},88285(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(35211),o=s(5124),n=s(22441),r=s(63672),l=s(1087),c=s(22792),d=s(17894),h=(s(75064),s(47680),s(26300)),p=t([h]);h=(p.then?(await p)():p)[0];const u="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",g="M7,10L12,15L17,10H7Z";class _ extends((0,d.c)(o.WF)){async focus(){await this.updateComplete,await(this.item?.focus())}render(){const t=!!this.value,e=!(!this.value||this.required||this.disabled||this.hideClearIcon),s=this.placeholder??this.label,i=this.label&&t?o.qy`<span slot="overline">${this.label}${this.required?" *":""}</span>`:o.s6,a=t?this.valueRenderer?this.valueRenderer(this.value??""):o.qy`<span slot="headline">${this.value}</span>`:s?o.qy`<span slot="headline" class="placeholder"> ${s}${this.required?" *":""} </span>`:o.s6;return o.qy` <ha-combo-box-item aria-label="${(0,r.J)(this.label||this.placeholder)}" .disabled="${this.disabled}" type="button" compact="compact"> ${this.image?o.qy`<img alt="${this.label??""}" slot="start" .src="${this.image}" crossorigin="anonymous" referrerpolicy="no-referrer">`:this.icon?o.qy`<ha-icon slot="start" .icon="${this.icon}"></ha-icon>`:o.qy`<slot name="start"></slot>`} ${i}${a} ${this.unknown?o.qy`<div slot="supporting-text" class="unknown"> ${this.unknownItemText||this._i18n?.localize("ui.components.combo-box.unknown_item")} </div>`:o.s6} ${e?o.qy` <ha-icon-button class="clear" slot="end" @click="${this._clear}" .path="${u}"></ha-icon-button> `:o.s6} <ha-svg-icon class="arrow" slot="end" .path="${g}"></ha-svg-icon> </ha-combo-box-item> `}_clear(t){t.stopPropagation(),(0,l.r)(this,"clear")}static get styles(){return[o.AH`ha-combo-box-item[disabled]{background-color:var(--ha-color-form-background-disabled);--md-list-item-disabled-opacity:0.5;opacity:.5;cursor:not-allowed}ha-combo-box-item{position:relative;background-color:var(--ha-color-form-background);border-radius:var(--ha-border-radius-sm);border-end-end-radius:0;border-end-start-radius:0;--md-list-item-one-line-container-height:56px;--md-list-item-two-line-container-height:56px;--md-list-item-top-space:0px;--md-list-item-bottom-space:0px;--md-list-item-leading-space:var(--ha-space-4);--md-list-item-trailing-space:var(--ha-space-2);--ha-md-list-item-gap:var(--ha-space-2);--md-focus-ring-width:0px;--md-focus-ring-duration:0s}ha-combo-box-item:after{display:block;content:"";position:absolute;pointer-events:none;bottom:0;left:0;right:0;height:1px;width:100%;background-color:var(--ha-color-border-neutral-loud);transform:height 180ms ease-in-out,background-color 180ms ease-in-out}ha-combo-box-item:focus:after{height:2px;background-color:var(--mdc-theme-primary)}:host([unknown]) ha-combo-box-item{background-color:var(--ha-color-fill-warning-quiet-resting)}:host([invalid]) ha-combo-box-item:after{height:2px;background-color:var(--mdc-theme-error,var(--error-color,#b00020))}.clear{margin:0 -8px;--ha-icon-button-size:32px;--ha-icon-button-padding-inline:var(--ha-space-1)}.arrow{--mdc-icon-size:20px;width:32px}.placeholder{color:var(--secondary-text-color)}:host([invalid]) .placeholder{color:var(--mdc-theme-error,var(--error-color,#b00020))}.unknown{color:var(--ha-color-on-warning-normal)}`]}constructor(...t){super(...t),this.invalid=!1}}(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],_.prototype,"invalid",void 0),(0,i.Cg)([(0,n.P)("ha-combo-box-item",!0)],_.prototype,"item",void 0),(0,i.Cg)([(0,n.wk)(),(0,a.Fg)({context:c.D5,subscribe:!0})],_.prototype,"_i18n",void 0),_=(0,i.Cg)([(0,n.EM)("ha-picker-field")],_),e()}catch(t){e(t)}})},2226(t,e,s){s(18111),s(61701);var i=s(62826),a=s(35211),o=s(5124),n=s(22441),r=s(6412),l=s(63672),c=s(89784),d=s(1087),h=s(15638),p=s(22792);s(64013),s(92677);class u extends o.WF{render(){const t=this.maxColumns??3,e=Math.min(t,this.options.length);return o.qy` <ha-radio-group class="list" style="${(0,c.W)({"--columns":e})}" .value="${this.value}" @change="${this._radioChanged}"> ${this.options.map(t=>this._renderOption(t))} </ha-radio-group> `}_renderOption(t){const e=1===this.maxColumns&&!this.stackedImage,s=1===this.maxColumns&&this.stackedImage,i=t.disabled||this.disabled||!1,a=t.value===this.value,n=this._ui?.themes.darkMode||!1,c=!!this._i18n&&(0,h.qC)(this._i18n.language,this._i18n.translationMetadata.translations),d="object"==typeof t.image?n&&t.image.src_dark||t.image.src:t.image,p="object"==typeof t.image&&(c&&t.image.flip_rtl);return o.qy` <label class="option ${(0,r.H)({horizontal:e,stacked:s,selected:a})}" ?disabled="${i}"> <div class="content"> <ha-radio-option aria-describedby="${(0,l.J)(t.description?`desc-${t.value}`:void 0)}" aria-labelledby="${`label-${t.value}`}" .value="${t.value}" .disabled="${i}"></ha-radio-option> <div class="text"> <span id="${`label-${t.value}`}" class="label">${t.label}</span> ${t.description?o.qy`<span class="description" id="desc-${t.value}">${t.description}</span>`:o.s6} </div> </div> ${d?o.qy` <img class="${p?"flipped":""}" alt="" src="${d}"> `:o.s6} </label> `}_radioChanged(t){t.stopPropagation();const e=t.currentTarget.value;this.disabled||void 0===e||e===(this.value??"")||(0,d.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.options=[],this.stackedImage=!1}}u.styles=o.AH`.list::part(form-control-input){display:grid;grid-template-columns:repeat(var(--columns,1),minmax(0,1fr));gap:var(--ha-space-3)}.option{position:relative;display:block;border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:12px;gap:var(--ha-space-2);overflow:hidden;cursor:pointer}.option .content{position:relative;display:flex;flex-direction:row;gap:var(--ha-space-2);min-width:0;width:100%}.option .content ha-radio-option{--ha-radio-option-control-margin:0;margin:0;flex:none}.option .content .text{display:flex;flex-direction:column;gap:var(--ha-space-1);min-width:0;flex:1;justify-content:center}.option .content .text .label{color:var(--primary-text-color);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.option .content .text .description{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed)}img{position:relative;max-width:var(--ha-select-box-image-size,96px);max-height:var(--ha-select-box-image-size,96px);margin:auto}.flipped{transform:scaleX(-1)}.option.horizontal{flex-direction:row;align-items:flex-start}.option.horizontal img{margin:0}.option.stacked{align-items:stretch}.option.stacked img{max-width:100%;max-height:var(--ha-select-box-image-size,96px);margin:0}.option:before{content:"";display:block;inset:0;position:absolute;background-color:transparent;pointer-events:none;opacity:.2;transition:background-color 180ms ease-in-out,opacity 180ms ease-in-out}.option:hover:before{background-color:var(--divider-color)}.option.selected:before{background-color:var(--primary-color)}.option[disabled]{cursor:not-allowed}.option[disabled] .content,.option[disabled] img{opacity:.5}.option[disabled]:before{background-color:var(--disabled-color);opacity:.05}`,(0,i.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"options",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"value",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,attribute:"max_columns"})],u.prototype,"maxColumns",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"stacked_image"})],u.prototype,"stackedImage",void 0),(0,i.Cg)([(0,n.wk)(),(0,a.Fg)({context:p.D5,subscribe:!0})],u.prototype,"_i18n",void 0),(0,i.Cg)([(0,n.wk)(),(0,a.Fg)({context:p.EK,subscribe:!0})],u.prototype,"_ui",void 0),u=(0,i.Cg)([(0,n.EM)("ha-select-box")],u)},606(t,e,s){s.a(t,async function(t,e){try{s(74423),s(18111),s(61701);var i=s(62826),a=s(5124),o=s(22441),n=s(63672),r=s(22786),l=s(1087),c=s(29823),d=(s(70947),s(3449),s(88285)),h=(s(67094),t([c,d]));[c,d]=h.then?(await h)():h;class p extends a.WF{render(){return this.disabled?a.qy`${this._renderField()}${this._renderHelper()}`:a.qy` <ha-dropdown placement="bottom" @wa-select="${this._handleSelect}" @wa-show="${this._handleShow}" @wa-hide="${this._handleHide}"> ${this._renderField()} ${this.options?this.options.map(t=>{const e=["string","number"].includes(typeof t);return a.qy` <ha-dropdown-item .value="${e?t:t.value}" .disabled="${!e&&(t.disabled??!1)}" .selected="${this.value===(e?t:t.value)}"> ${t.iconPath?a.qy`<ha-svg-icon slot="icon" .path="${t.iconPath}"></ha-svg-icon>`:a.s6} <div class="content"> ${e?t:t.label||t.value} ${t.secondary?a.qy`<div class="secondary">${t.secondary}</div>`:a.s6} </div> </ha-dropdown-item> `}):a.qy`<slot></slot>`} </ha-dropdown> ${this._renderHelper()} `}_renderField(){const t=this._getValueLabel(this.options,this.value);return a.qy` <ha-picker-field slot="trigger" type="button" class="${this._opened?"opened":""}" compact="compact" aria-label="${(0,n.J)(this.label)}" @clear="${this._clearValue}" .label="${this.label}" .value="${t}" .required="${this.required}" .disabled="${this.disabled}" .hideClearIcon="${!this.clearable||this.required||this.disabled||!String(this.value)}"> </ha-picker-field> `}_renderHelper(){return this.helper?a.qy`<ha-input-helper-text .disabled="${this.disabled}">${this.helper}</ha-input-helper-text>`:a.s6}_handleSelect(t){t.stopPropagation();const e=t.detail.item.value;e!==this.value&&(0,l.r)(this,"selected",{value:e})}_clearValue(){!this.disabled&&this.value&&(0,l.r)(this,"selected",{value:void 0})}_handleShow(){this.style.setProperty("--select-menu-width",`${this._triggerField.offsetWidth}px`),this._opened=!0}_handleHide(){this._opened=!1}constructor(...t){super(...t),this.clearable=!1,this.required=!1,this.disabled=!1,this._opened=!1,this._getValueLabel=(0,r.A)((t,e)=>{const s=void 0!==e?String(e):void 0;if(!t||!s)return s;for(const e of t){const t=["string","number"].includes(typeof e);if(t&&e===s||!t&&String(e.value)===s)return t?e:e.label||e.value}return s})}}p.styles=a.AH`:host{position:relative}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}ha-dropdown-item .content{display:flex;gap:var(--ha-space-1);flex-direction:column}ha-dropdown-item .secondary{font-size:var(--ha-font-size-s);color:var(--ha-color-text-secondary)}ha-dropdown::part(menu){min-width:var(--select-menu-width)}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}`,(0,i.Cg)([(0,o.MZ)({type:Boolean})],p.prototype,"clearable",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"options",void 0),(0,i.Cg)([(0,o.MZ)()],p.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],p.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)()],p.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],p.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,i.Cg)([(0,o.wk)()],p.prototype,"_opened",void 0),(0,i.Cg)([(0,o.P)("ha-picker-field")],p.prototype,"_triggerField",void 0),p=(0,i.Cg)([(0,o.EM)("ha-select")],p),e()}catch(t){e(t)}})},58933(t,e,s){s.a(t,async function(t,e){try{s(18111),s(61701),s(13579);var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(9899),l=s(52069),c=s(606),d=t([c]);c=(d.then?(await d)():d)[0];const h="__NONE_OPTION__";class p extends a.WF{render(){if(!this._voices)return a.s6;const t=this.value??(this.required?this._voices[0]?.voice_id:h),e=(this._voices||[]).map(t=>({value:t.voice_id,label:t.name}));return this.required&&this.value||e.unshift({value:h,label:this.hass.localize("ui.components.tts-voice-picker.none")}),a.qy` <ha-select .label="${this.label||this.hass.localize("ui.components.tts-voice-picker.voice")}" .value="${t}" .required="${this.required}" .disabled="${this.disabled}" @selected="${this._changed}" .options="${e}"> </ha-select> `}willUpdate(t){super.willUpdate(t),this.hasUpdated?(t.has("language")||t.has("engineId"))&&this._debouncedUpdateVoices():this._updateVoices()}async _updateVoices(){if(!this.engineId||!this.language)return void(this._voices=void 0);this._voices=(await(0,l.z3)(this.hass,this.engineId,this.language)).voices;if(this.value&&this._voices?.some(t=>t.voice_id===this.value))return;const t=this.required&&this._voices?.length?this._voices[0].voice_id:void 0;t!==this.value&&(this.value=t,(0,n.r)(this,"value-changed",{value:this.value}))}_changed(t){const e=t.detail.value;!this.hass||""===e||e===this.value||void 0===this.value&&e===h||(this.value=e===h?void 0:e,(0,n.r)(this,"value-changed",{value:this.value}))}constructor(...t){super(...t),this.disabled=!1,this.required=!1,this._debouncedUpdateVoices=(0,r.s)(()=>this._updateVoices(),500)}}p.styles=a.AH`ha-select{width:100%;text-align:start;display:block}`,(0,i.Cg)([(0,o.MZ)()],p.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)()],p.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"engineId",void 0),(0,i.Cg)([(0,o.MZ)()],p.prototype,"language",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],p.prototype,"required",void 0),(0,i.Cg)([(0,o.wk)()],p.prototype,"_voices",void 0),p=(0,i.Cg)([(0,o.EM)("ha-tts-voice-picker")],p),e()}catch(t){e(t)}})},28170(t,e,s){s.d(e,{o:()=>l});var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(83892);class l extends r.x{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role",this.defaultRole),(0,n.r)(this,"ha-list-item-register",{item:this})}disconnectedCallback(){super.disconnectedCallback(),(0,n.r)(this,"ha-list-item-unregister",{item:this})}activate(){this.click()}constructor(...t){super(...t),this.interactive=!1,this.defaultRole="listitem"}}l.styles=[r.x.styles,a.AH`:host{--ha-list-item-focus-radius:var(--ha-border-radius-sm);--ha-list-item-focus-width:2px;--ha-list-item-focus-width-start:var(--ha-space-2);--ha-list-item-focus-offset:-2px;--ha-list-item-focus-background:var(--ha-color-fill-neutral-quiet-hover)}:host(:focus){outline:0}.base{border-radius:var(--ha-list-item-focus-radius);outline:var(--ha-list-item-focus-width) solid transparent;outline-offset:var(--ha-list-item-focus-offset);transition:outline-color var(--ha-animation-duration-fast) ease-out,background-color var(--ha-animation-duration-fast) ease-out}@keyframes ha-list-item-focus-in{from{outline-width:var(--ha-list-item-focus-width-start);outline-offset:calc(-1 * var(--ha-list-item-focus-width-start))}to{outline-width:var(--ha-list-item-focus-width);outline-offset:var(--ha-list-item-focus-offset)}}:host(:focus-visible) .base{outline-color:var(--ha-color-focus);background-color:var(--ha-list-item-focus-background);animation:ha-list-item-focus-in var(--ha-animation-duration-normal) ease-in}`],(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],l.prototype,"interactive",void 0),l=(0,i.Cg)([(0,o.EM)("ha-list-item-base")],l)},1671(t,e,s){var i=s(62826),a=s(5124),o=s(22441),n=s(63672),r=(s(54276),s(28170));class l extends r.o{activate(){this._item?.click()}_renderBase(t){return void 0!==this.href?a.qy`<a part="base" class="base interactive" id="item" href="${(0,n.J)(this.disabled?void 0:this.href)}" target="${(0,n.J)(this.target)}" rel="${(0,n.J)(this.rel)}" download="${(0,n.J)(this.download)}" tabindex="-1" aria-disabled="${this.disabled?"true":"false"}"> ${this._renderRipple()}${t} </a>`:a.qy`<button part="base" class="base interactive" id="item" type="button" ?disabled="${this.disabled}" tabindex="-1"> ${this._renderRipple()}${t} </button>`}_renderRipple(){return a.qy`<ha-ripple part="ripple" for="item" ?disabled="${this.disabled}"></ha-ripple>`}constructor(...t){super(...t),this.interactive=!0}}l.styles=[r.o.styles,a.AH`:host{cursor:pointer;--ha-ripple-color:var(--primary-text-color)}:host([disabled]){cursor:default}.base.interactive{width:100%;border:none;background:0 0;color:inherit;font:inherit;text-align:inherit;text-decoration:none;appearance:none;cursor:inherit}:host([disabled]) .base.interactive{color:var(--disabled-text-color)}`],(0,i.Cg)([(0,o.MZ)({type:String})],l.prototype,"href",void 0),(0,i.Cg)([(0,o.MZ)({type:String})],l.prototype,"target",void 0),(0,i.Cg)([(0,o.MZ)({type:String})],l.prototype,"rel",void 0),(0,i.Cg)([(0,o.MZ)({type:String})],l.prototype,"download",void 0),(0,i.Cg)([(0,o.P)("#item")],l.prototype,"_item",void 0),l=(0,i.Cg)([(0,o.EM)("ha-list-item-button")],l)},83892(t,e,s){s.d(e,{x:()=>r});s(18111),s(13579);var i=s(62826),a=s(92070),o=s(5124),n=s(22441);class r extends o.WF{_onSlotChange(t){return e=>{const s=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&""!==t.textContent?.trim());"start"===t?this._hasStart=s:this._hasEnd=s}}render(){return this._renderBase(this._renderInner())}_renderBase(t){return o.qy`<div part="base" class="base" id="item">${t}</div>`}_renderInner(){const t=this._slotController.test("content");return o.qy` <div part="start" class="start" ?hidden="${!this._hasStart}"> <slot name="start" @slotchange="${this._onSlotChange("start")}"></slot> </div> <div part="content" class="content"> ${t?o.qy`<slot name="content"></slot>`:this._renderDefaultContent()} </div> <div part="end" class="end" ?hidden="${!this._hasEnd}"> <slot name="end" @slotchange="${this._onSlotChange("end")}"></slot> </div> `}_renderDefaultContent(){const t=this._slotController.test("headline"),e=this._slotController.test("supporting-text"),s=t||void 0!==this.headline,i=e||void 0!==this.supportingText;return o.qy` ${s?o.qy`<div part="headline" class="headline"> <slot name="headline">${this.headline??o.s6}</slot> </div>`:o.s6} ${i?o.qy`<div part="supporting-text" class="supporting"> <slot name="supporting-text">${this.supportingText??o.s6}</slot> </div>`:o.s6} `}constructor(...t){super(...t),this.disabled=!1,this._slotController=new a.X(this,"headline","supporting-text","content"),this._hasStart=!1,this._hasEnd=!1}}r.styles=o.AH`:host{display:block;color:var(--primary-text-color);font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal)}:host([disabled]){color:var(--disabled-text-color);pointer-events:none}.base{position:relative;display:flex;flex-direction:row;align-items:center;gap:var(--ha-row-item-gap,var(--ha-space-4));padding-block:var(--ha-row-item-padding-block,var(--ha-space-3));padding-inline:var(--ha-row-item-padding-inline,var(--ha-space-4));min-height:var(--ha-row-item-min-height,48px);box-sizing:border-box}.content{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;justify-content:center}.end,.start{display:flex;align-items:center;flex:0 0 auto}.end[hidden],.start[hidden]{display:none}.headline{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.supporting{color:var(--secondary-text-color);font-size:var(--ha-font-size-s);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`,(0,i.Cg)([(0,n.MZ)({type:String})],r.prototype,"headline",void 0),(0,i.Cg)([(0,n.MZ)({type:String,attribute:"supporting-text"})],r.prototype,"supportingText",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],r.prototype,"disabled",void 0),(0,i.Cg)([(0,n.wk)()],r.prototype,"_hasStart",void 0),(0,i.Cg)([(0,n.wk)()],r.prototype,"_hasEnd",void 0),r=(0,i.Cg)([(0,n.EM)("ha-row-item")],r)},50723(t,e,s){s.d(e,{N:()=>d});s(74423),s(18111),s(22489),s(7588);var i=s(62826),a=s(5124),o=s(22441),n=s(91335);s(44114);const r=t=>{const e=[];let s=t;for(;s;){e.push(s);const t=s.parentNode;if(t instanceof ShadowRoot)s=t.host;else if(t)s=t;else{const t=s.getRootNode();s=t instanceof ShadowRoot?t.host:null}}return e.reverse()},l=(t,e)=>{if(t===e)return 0;const s=r(t),i=r(e);let a=0;for(;a<s.length&&a<i.length&&s[a]===i[a];)a++;return 0===a?0:a===s.length?-1:a===i.length?1:s[a].compareDocumentPosition(i[a])&Node.DOCUMENT_POSITION_FOLLOWING?-1:1};var c=s(1087);class d extends a.WF{connectedCallback(){super.connectedCallback(),this.hasAttribute("ha-list")||this.setAttribute("ha-list",""),!this.hasAttribute("role")&&this.hostRole&&this.setAttribute("role",this.hostRole),this._unbindKeys=(0,n.Tc)(this,{ArrowDown:this._onForward,ArrowUp:this._onBack,Home:this._onHome,End:this._onEnd,Enter:this._onActivate,Space:this._onActivate}),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("ha-list-item-register",this._onItemRegister),this.addEventListener("ha-list-item-unregister",this._onItemUnregister)}disconnectedCallback(){super.disconnectedCallback(),this._unbindKeys?.(),this._unbindKeys=void 0,this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("ha-list-item-register",this._onItemRegister),this.removeEventListener("ha-list-item-unregister",this._onItemUnregister)}focus(t){this.items.length?this.focusItemAtIndex(this._activeItemIndex>=0?this._activeItemIndex:0):super.focus(t)}focusItemAtIndex(t){t<0||this.setActiveItemIndex(t,!0)}getActiveItemIndex(){return this._activeItemIndex}setActiveItemIndex(t,e=!1){this._hasFocusableItem?(this._activeItemIndex=Math.max(0,Math.min(this.items.length-1,t)),this._isFocusable(this._activeItemIndex)||(this._activeItemIndex=this._firstFocusableIndex),this._applyActive(e)):this._activeItemIndex=-1}updateListItems(){this._recomputeFocusableIndexes(),(this._activeItemIndex>=this.items.length||!this._hasFocusableItem||this._activeItemIndex<0)&&(this._activeItemIndex=this._firstFocusableIndex),this._applyActive(!1)}_recomputeFocusableIndexes(){let t=-1,e=-1;for(let s=0;s<this.items.length;s++)this._isFocusable(s)&&(-1===t&&(t=s),e=s);this._firstFocusableIndex=t,this._lastFocusableIndex=e,this._hasFocusableItem=-1!==t}render(){return a.qy`<div part="base" class="base"> <slot></slot> </div>`}_isFocusable(t){const e=this.items[t];return!!e&&e.interactive&&!e.disabled}_applyActive(t){this.items.forEach((t,e)=>{t.interactive&&!t.disabled?t.tabIndex=e===this._activeItemIndex?0:-1:t.removeAttribute("tabindex")}),t&&this._activeItemIndex>=0&&this.items[this._activeItemIndex]?.focus()}_moveFocus(t,e){!this._hasFocusableItem||e<0||e===this._activeItemIndex||(t.preventDefault(),this._activeItemIndex=e,this._applyActive(!0))}_stepIndex(t,e){const s=this.items.length;if(!s||!this._hasFocusableItem)return t;let i=t;for(let a=0;a<s;a++){if(i+=e,i<0||i>=s){if(!this.wrapFocus)return t;i=(i+s)%s}if(this._isFocusable(i))return i}return t}constructor(...t){super(...t),this.wrapFocus=!1,this.ariaLabel=null,this.items=[],this.hostRole="list",this._activeItemIndex=-1,this._firstFocusableIndex=-1,this._lastFocusableIndex=-1,this._hasFocusableItem=!1,this._onItemRegister=t=>{t.stopPropagation();const e=t.detail.item;if(this.items.includes(e))return;const s=[...this.items,e];s.sort(l),this.items=s,this.updateListItems()},this._onItemUnregister=t=>{t.stopPropagation();const e=t.detail.item;this.items.includes(e)&&(this.items=this.items.filter(t=>t!==e),this.updateListItems())},this._onFocusIn=t=>{const e=t.composedPath();for(let t=0;t<this.items.length;t++)if(e.includes(this.items[t]))return void(t!==this._activeItemIndex&&(this._activeItemIndex=t,this._applyActive(!1)))},this._onForward=t=>{this._moveFocus(t,this._stepIndex(this._activeItemIndex,1))},this._onBack=t=>{this._moveFocus(t,this._stepIndex(this._activeItemIndex,-1))},this._onHome=t=>{this._moveFocus(t,this._firstFocusableIndex)},this._onEnd=t=>{this._moveFocus(t,this._lastFocusableIndex)},this._onActivate=t=>{if(!this._isFocusable(this._activeItemIndex))return;t.preventDefault();const e=this.items[this._activeItemIndex];e.activate(),(0,c.r)(this,"ha-list-activated",{index:this._activeItemIndex,item:e})}}}d.styles=a.AH`:host{display:block}.base{display:flex;flex-direction:column;gap:var(--ha-list-gap,0);padding:var(--ha-list-padding,0);margin:0;list-style:none}`,(0,i.Cg)([(0,o.MZ)({type:Boolean,attribute:"wrap-focus"})],d.prototype,"wrapFocus",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"aria-label",reflect:!0})],d.prototype,"ariaLabel",void 0),d=(0,i.Cg)([(0,o.EM)("ha-list-base")],d)},16386(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(65686),o=s(5124),n=s(22441),r=t([a]);a=(r.then?(await r)():r)[0];class l extends a.A{updated(t){if(super.updated(t),t.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-progress-ring-size","16px");break;case"small":this.style.setProperty("--ha-progress-ring-size","28px");break;case"medium":this.style.setProperty("--ha-progress-ring-size","48px");break;case"large":this.style.setProperty("--ha-progress-ring-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}static get styles(){return[a.A.styles,o.AH`:host{--indicator-color:var(
            --ha-progress-ring-indicator-color,
            var(--primary-color)
          );--track-color:var(
            --ha-progress-ring-divider-color,
            var(--divider-color)
          );--track-width:4px;--speed:3.5s;--size:var(--ha-progress-ring-size, 48px)}`]}}(0,i.Cg)([(0,n.MZ)()],l.prototype,"size",void 0),l=(0,i.Cg)([(0,n.EM)("ha-progress-ring")],l),e()}catch(t){e(t)}})},64013(t,e,s){var i=s(62826),a=s(97086),o=s(5124),n=s(22441);class r extends a.A{static get styles(){return[a.A.styles,o.AH`:host{--wa-form-control-required-content:var(
            --ha-radio-group-required-marker,
            var(--ha-input-required-marker, "*")
          );--wa-form-control-required-content-offset:var(
            --ha-radio-group-required-marker-offset,
            0.1rem
          )}`]}constructor(){super(),this.radioTag="ha-radio-option"}}r=(0,i.Cg)([(0,n.EM)("ha-radio-group")],r)},92677(t,e,s){var i=s(62826),a=s(17010),o=s(5124),n=s(22441);class r extends a.A{static get styles(){return[a.A.styles,o.AH`:host{--wa-form-control-activated-color:var(
            --ha-radio-option-active-color,
            var(--ha-color-fill-primary-loud-resting)
          );--wa-form-control-height:var(--ha-radio-option-height, 40px);--wa-form-control-toggle-size:var(
            --ha-radio-option-toggle-size,
            20px
          );--wa-form-control-border-width:var(
            --ha-radio-option-border-width,
            var(--ha-border-width-md)
          );--wa-form-control-border-color:var(
            --ha-radio-option-border-color,
            var(--ha-color-border-neutral-normal)
          );--wa-form-control-background-color:var(
            --ha-radio-option-background-color,
            var(--wa-form-control-background-color)
          );--checked-icon-color:var(
            --ha-radio-option-checked-icon-color,
            var(--wa-form-control-activated-color)
          );--checked-icon-scale:var(--ha-radio-option-checked-icon-scale, 0.7)}:host([appearance=default]) .control{margin:var(--ha-radio-option-control-margin,var(--ha-space-3) var(--ha-space-2) var(--ha-space-3) var(--ha-space-3))}:host(:not([aria-checked=true],[aria-disabled=true]):hover) .control{border-color:var(--ha-radio-option-border-color-hover,var(--ha-radio-option-border-color,var(--ha-color-border-neutral-loud)));background-color:var(--ha-radio-option-background-color-hover,var(--ha-color-fill-neutral-quiet-hover))}:host([aria-checked=true]) .control{background-color:var(--ha-radio-option-checked-background-color,var(--ha-color-fill-primary-normal-resting));color:var(--checked-icon-color);border-color:var(--checked-icon-color)}[part~=label]{display:inline-flex;align-items:center;cursor:pointer}:host([disabled]) [part~=label]{cursor:not-allowed}`]}}r=(0,i.Cg)([(0,n.EM)("ha-radio-option")],r)},61037(t,e,s){var i=s(62826),a=s(22441),o=s(5124),n=s(14503),r=s(14782),l=s(44144);class c extends o.WF{render(){return o.qy` <img class="logo" alt="${r.aK[this.voiceAssistantId].name}" src="${(0,l.MR)({domain:r.aK[this.voiceAssistantId].domain,type:"icon",darkOptimized:this.hass.themes?.darkMode},this.hass.auth.data.hassUrl)}" crossorigin="anonymous" referrerpolicy="no-referrer"> `}static get styles(){return[n.RF,o.AH`:host{display:inline}.logo{position:relative;vertical-align:middle;height:24px}`]}}(0,i.Cg)([(0,a.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,i.Cg)([(0,a.MZ)({attribute:!1})],c.prototype,"voiceAssistantId",void 0),c=(0,i.Cg)([(0,a.EM)("voice-assistant-brand-icon")],c)},49852(t,e,s){s.d(e,{P:()=>c,j:()=>l});s(74423),s(18111),s(81148),s(22489),s(61701),s(13579);var i=s(65522),a=s(71727),o=s(55931),n=s(66033),r=s(58594);const l=(t,e,s,l,c,d,h,p,u,g,_,v="")=>{let m,y,f={};const b=Object.values(t),w=Object.values(s),C=Object.values(l);(d||h||p||u||g)&&(f=(0,r.g2)(C),m=w,y=C.filter(t=>t.area_id),d&&(m=m.filter(t=>{const e=f[t.id];return!(!e||!e.length)&&f[t.id].some(t=>d.includes((0,a.m)(t.entity_id)))}),y=y.filter(t=>d.includes((0,a.m)(t.entity_id)))),h&&(m=m.filter(t=>{const e=f[t.id];return!e||!e.length||C.every(t=>!h.includes((0,a.m)(t.entity_id)))}),y=y.filter(t=>!h.includes((0,a.m)(t.entity_id)))),p&&(m=m.filter(t=>{const e=f[t.id];return!(!e||!e.length)&&f[t.id].some(t=>{const e=c[t.entity_id];return!!e&&(e.attributes.device_class&&p.includes(e.attributes.device_class))})}),y=y.filter(t=>{const e=c[t.entity_id];return e.attributes.device_class&&p.includes(e.attributes.device_class)})),u&&(m=m.filter(t=>u(t))),g&&(m=m.filter(t=>{const e=f[t.id];return!(!e||!e.length)&&f[t.id].some(t=>{const e=c[t.entity_id];return!!e&&g(e)})}),y=y.filter(t=>{const e=c[t.entity_id];return!!e&&g(e)})));let $,x=b;m&&($=m.filter(t=>t.area_id).map(t=>t.area_id)),y&&($=($??[]).concat(y.filter(t=>t.area_id).map(t=>t.area_id))),$&&(x=x.filter(t=>$.includes(t.area_id))),_&&(x=x.filter(t=>!_.includes(t.area_id)));return x.map(t=>{const{floor:s}=(0,n.L)(t,e),a=s?(0,o.X)(s):void 0,r=(0,i.A)(t);return{id:`${v}${t.area_id}`,primary:r||t.area_id,secondary:a,icon:t.icon||void 0,icon_path:t.icon?void 0:"M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z",search_labels:{areaId:t.area_id,aliases:t.aliases.join(" ")}}})},c=[{name:"primary",weight:10},{name:"search_labels.aliases",weight:8},{name:"secondary",weight:6},{name:"search_labels.domain",weight:4},{name:"search_labels.areaId",weight:2}]},69150(t,e,s){s.d(e,{$$:()=>_,AH:()=>a,NH:()=>p,QC:()=>i,Uc:()=>n,Zr:()=>u,ds:()=>g,hJ:()=>r,mp:()=>c,nx:()=>l,u6:()=>d,vU:()=>o,zn:()=>h});const i=(t,e,s)=>"run-start"===e.type?t={init_options:s,stage:"ready",run:e.data,events:[e],started:new Date(e.timestamp)}:t?((t="wake_word-start"===e.type?{...t,stage:"wake_word",wake_word:{...e.data,done:!1}}:"wake_word-end"===e.type?{...t,wake_word:{...t.wake_word,...e.data,done:!0}}:"stt-start"===e.type?{...t,stage:"stt",stt:{...e.data,done:!1}}:"stt-end"===e.type?{...t,stt:{...t.stt,...e.data,done:!0}}:"intent-start"===e.type?{...t,stage:"intent",intent:{...e.data,done:!1}}:"intent-end"===e.type?{...t,intent:{...t.intent,...e.data,done:!0}}:"tts-start"===e.type?{...t,stage:"tts",tts:{...e.data,done:!1}}:"tts-end"===e.type?{...t,tts:{...t.tts,...e.data,done:!0}}:"run-end"===e.type?{...t,finished:new Date(e.timestamp),stage:"done"}:"error"===e.type?{...t,finished:new Date(e.timestamp),stage:"error",error:e.data}:{...t}).events=[...t.events,e],t):void console.warn("Received unexpected event before receiving session",e),a=(t,e,s)=>{let a;const n=o(t,t=>{a=i(a,t,s),"run-end"!==t.type&&"error"!==t.type||n.then(t=>t()),a&&e(a)},s);return n},o=(t,e,s)=>t.connection.subscribeMessage(e,{...s,type:"assist_pipeline/run"}),n=(t,e)=>t.callWS({type:"assist_pipeline/pipeline_debug/list",pipeline_id:e}),r=(t,e,s)=>t.callWS({type:"assist_pipeline/pipeline_debug/get",pipeline_id:e,pipeline_run_id:s}),l=t=>t.callWS({type:"assist_pipeline/pipeline/list"}),c=(t,e)=>t.callWS({type:"assist_pipeline/pipeline/get",pipeline_id:e}),d=(t,e)=>t.callWS({type:"assist_pipeline/pipeline/create",...e}),h=(t,e,s)=>t.callWS({type:"assist_pipeline/pipeline/update",pipeline_id:e,...s}),p=(t,e)=>t.callWS({type:"assist_pipeline/pipeline/set_preferred",pipeline_id:e}),u=(t,e)=>t.callWS({type:"assist_pipeline/pipeline/delete",pipeline_id:e}),g=t=>t.callWS({type:"assist_pipeline/language/list"}),_=t=>t.callWS({type:"assist_pipeline/device/list"})},71117(t,e,s){s.d(e,{Gu:()=>a,Pd:()=>u,Sb:()=>_,Up:()=>g,Ut:()=>o,cn:()=>h,dq:()=>c,eN:()=>l,p1:()=>v,p7:()=>i,q3:()=>r,qF:()=>m,ql:()=>p,vO:()=>n,yG:()=>d});const i=({hass:t,...e})=>t.callApi("POST","cloud/login",e),a=t=>t.callApi("POST","cloud/logout"),o=(t,e)=>t.callApi("POST","cloud/forgot_password",{email:e}),n=(t,e,s)=>t.callApi("POST","cloud/register",{email:e,password:s}),r=(t,e)=>t.callApi("POST","cloud/resend_confirm",{email:e}),l=t=>t.callWS({type:"cloud/status"}),c=(t,e)=>t.callWS({type:"cloud/cloudhook/create",webhook_id:e}),d=(t,e)=>t.callWS({type:"cloud/cloudhook/delete",webhook_id:e}),h=t=>t.callWS({type:"cloud/remote/connect"}),p=t=>t.callWS({type:"cloud/remote/disconnect"}),u=t=>t.callWS({type:"cloud/subscription"}),g=(t,e)=>t.callWS({type:"cloud/update_prefs",...e}),_=t=>t.callWS({type:"cloud/remove_data"}),v=(t,e,s)=>t.callWS({type:"cloud/google_assistant/entities/update",entity_id:e,disable_2fa:s}),m=t=>t.callApi("GET","cloud/support_package")},87225(t,e,s){s.d(e,{GS:()=>o,I8:()=>r,YQ:()=>h,bn:()=>c,fg:()=>l,oW:()=>n,ob:()=>d});s(74423);var i=s(71727),a=s(68246);const o=[{groups:{dynamicGroups:{},time_location:{icon:"M15,12H16.5V16.25L19.36,17.94L18.61,19.16L15,17V12M23,16A7,7 0 0,1 16,23C13,23 10.4,21.08 9.42,18.4L8,17.9L2.66,19.97L2.5,20A0.5,0.5 0 0,1 2,19.5V4.38C2,4.15 2.15,3.97 2.36,3.9L8,2L14,4.1L19.34,2H19.5A0.5,0.5 0 0,1 20,2.5V10.25C21.81,11.5 23,13.62 23,16M9,16C9,12.83 11.11,10.15 14,9.29V6.11L8,4V15.89L9,16.24C9,16.16 9,16.08 9,16M16,11A5,5 0 0,0 11,16A5,5 0 0,0 16,21A5,5 0 0,0 21,16A5,5 0 0,0 16,11Z",members:{sun:{},time:{},zone:{}}},helpers:{},template:{},trigger:{},other:{}}},{titleKey:"ui.panel.config.automation.editor.conditions.groups.generic.label",generic:!0,groups:{device:{},entity:{icon:"M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",members:{state:{},numeric_state:{}}}}},{titleKey:"ui.panel.config.automation.editor.conditions.groups.custom_integrations.label",groups:{customDynamicGroups:{}}}],n={and:{},or:{},not:{}},r=["and","or","not"],l=["ha-automation-condition-and","ha-automation-condition-not","ha-automation-condition-or"],c=(t,e)=>t.connection.subscribeMessage(e,{type:"condition_platforms/subscribe"}),d=t=>t.includes(".")?(0,i.m)(t):t,h=t=>t.includes(".")?(0,a.Y)(t):"_"},88433(t,e,s){if(s.d(e,{RW:()=>n,ZE:()=>a,e1:()=>r,vc:()=>o}),66649!=s.j)var i=s(44537);var a=function(t){return t[t.CONTROL=1]="CONTROL",t}({});const o=(t,e,s)=>t.callWS({type:"conversation/agent/list",language:e,country:s}),n=(t,e,s,a)=>t.callWS({type:"conversation/agent/homeassistant/debug",sentences:(0,i.e)(e),language:s,device_id:a}),r=(t,e,s)=>t.callWS({type:"conversation/agent/homeassistant/language_scores",language:e,country:s})},14782(t,e,s){s.d(e,{Gw:()=>n,Ow:()=>l,YH:()=>o,aK:()=>a,hB:()=>c,ij:()=>r});s(18111),s(22489);var i=s(59241);const a={conversation:{domain:"assist_pipeline",name:"Assist"},"cloud.alexa":{domain:"alexa",name:"Amazon Alexa"},"cloud.google_assistant":{domain:"google_assistant",name:"Google Assistant"}},o=(t,e,s)=>t.callWS({type:"homeassistant/expose_new_entities/set",assistant:e,expose_new:s}),n=(t,e)=>t.callWS({type:"homeassistant/expose_new_entities/get",assistant:e}),r=(t,e,s,i)=>t.callWS({type:"homeassistant/expose_entity",assistants:e,entity_ids:s,should_expose:i}),l=t=>t.callWS({type:"homeassistant/expose_entity/list"}),c=(t,e)=>{const s=(0,i.Ox)(t)[e];return Object.keys(a).filter(t=>s?.options?.[t]?.should_expose)}},48250(t,e,s){s.d(e,{Bp:()=>a,aI:()=>i,gg:()=>l,oT:()=>o,wE:()=>n,x0:()=>r});const i=async(t,e)=>(await t.sendMessagePromise({type:"frontend/get_user_data",key:e})).value,a=async(t,e,s)=>t.sendMessagePromise({type:"frontend/set_user_data",key:e,value:s}),o=(t,e,s)=>t.subscribeMessage(s,{type:"frontend/subscribe_user_data",key:e}),n=async(t,e)=>(await t.sendMessagePromise({type:"frontend/get_system_data",key:e})).value,r=async(t,e,s)=>t.sendMessagePromise({type:"frontend/set_system_data",key:e,value:s}),l=(t,e,s)=>t.subscribeMessage(s,{type:"frontend/subscribe_system_data",key:e})},68287(t,e,s){s.d(e,{z:()=>a});s(18111),s(61701),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);var i=s(71727);const a=t=>{const e=t.attributes.entity_id||[],s=[...new Set(e.map(t=>(0,i.m)(t)))];return 1===s.length?s[0]:void 0}},88360(t,e,s){s.d(e,{j:()=>a});var i=s(1087);const a=(t,e)=>{(0,i.r)(t,"haptic",e)}},22130(t,e,s){s.r(e),s.d(e,{fetchAddonInfo:()=>b,fetchHassioAddonChangelog:()=>l,fetchHassioAddonDocumentation:()=>d,fetchHassioAddonInfo:()=>r,fetchHassioAddonLogs:()=>c,fetchHassioAddonsInfo:()=>n,installHassioAddon:()=>v,rebuildLocalAddon:()=>w,reloadHassioAddons:()=>o,restartHassioAddon:()=>y,setHassioAddonOption:()=>h,setHassioAddonSecurity:()=>_,startHassioAddon:()=>u,stopHassioAddon:()=>g,uninstallHassioAddon:()=>f,updateHassioAddon:()=>m,validateHassioAddonOption:()=>p});s(18111),s(20116);var i=s(35541),a=s(47351);const o=async t=>{await t.callWS({type:"supervisor/api",endpoint:"/addons/reload",method:"post"})},n=async t=>t.callWS({type:"supervisor/api",endpoint:"/addons",method:"get"}),r=async(t,e)=>t({type:"supervisor/api",endpoint:`/addons/${e}/info`,method:"get"}),l=async(t,e)=>t.callApi("GET",`hassio/addons/${e}/changelog`),c=async(t,e)=>t.callApi("GET",`hassio/addons/${e}/logs`),d=async(t,e)=>t.callApi("GET",`hassio/addons/${e}/documentation`),h=async(t,e,s)=>{const i=await t({type:"supervisor/api",endpoint:`/addons/${e}/options`,method:"post",data:s});if("error"===i.result)throw Error((0,a.VR)(i));return i},p=async(t,e,s)=>t({type:"supervisor/api",endpoint:`/addons/${e}/options/validate`,method:"post",data:s}),u=async(t,e)=>t({type:"supervisor/api",endpoint:`/addons/${e}/start`,method:"post",timeout:null}),g=async(t,e)=>t({type:"supervisor/api",endpoint:`/addons/${e}/stop`,method:"post",timeout:null}),_=async(t,e,s)=>{await t({type:"supervisor/api",endpoint:`/addons/${e}/security`,method:"post",data:s})},v=async(t,e)=>{await t({type:"supervisor/api",endpoint:`/addons/${e}/install`,method:"post",timeout:null})},m=async(t,e,s)=>{await t.callWS({type:"hassio/update/addon",addon:e,backup:s})},y=async(t,e)=>{await t({type:"supervisor/api",endpoint:`/addons/${e}/restart`,method:"post",timeout:null})},f=async(t,e,s)=>{await t({type:"supervisor/api",endpoint:`/addons/${e}/uninstall`,method:"post",timeout:null,data:{remove_config:s}})},b=(t,e,s)=>(0,i.X)(t,e.addon?.addons.find(t=>t.slug===s)?`/addons/${s}/info`:`/store/addons/${s}`),w=async(t,e)=>t({type:"supervisor/api",endpoint:`/addons/${e}/rebuild`,method:"post",timeout:null})},47351(t,e,s){s.d(e,{PS:()=>i,Tv:()=>n,VR:()=>a,lE:()=>r});s(74423),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const i=t=>t.data,a=t=>"object"==typeof t?"object"==typeof t.body?t.body.message||"Unknown error, see supervisor logs":t.body||t.message||"Unknown error, see supervisor logs":t,o=new Set([502,503,504]),n=t=>!!(t&&t.status_code&&o.has(t.status_code))||!(!t||!t.message||!t.message.includes("ERR_CONNECTION_CLOSED")&&!t.message.includes("ERR_CONNECTION_RESET")),r=async(t,e)=>t({type:"supervisor/api",endpoint:`/${e}/stats`,method:"get"})},97078(t,e,s){s.d(e,{w:()=>i});const i=(t,e,s)=>t.callService("select","select_option",{option:s},{entity_id:e})},99037(t,e,s){s.d(e,{T:()=>i});const i=(t,e,s)=>t.callWS({type:"stt/engine/list",language:e,country:s})},35541(t,e,s){s.d(e,{X:()=>o});var i=s(62384),a=s(47351);const o=async(t,e,s)=>(0,i.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:e,method:s?.method||"get",timeout:s?.timeout??null,data:s?.data}):(0,a.PS)(await t.callApi((s.method||"get").toUpperCase(),`hassio${e}`,s?.data))},46927(t,e,s){if(s.d(e,{$W:()=>d,Hg:()=>o,Wj:()=>n,Yk:()=>h,jG:()=>a,mo:()=>c,ow:()=>r,zt:()=>l}),66649!=s.j)var i=s(48250);var a=function(t){return t.language="language",t.system="system",t.comma_decimal="comma_decimal",t.decimal_comma="decimal_comma",t.quote_decimal="quote_decimal",t.space_comma="space_comma",t.none="none",t}({}),o=function(t){return t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24",t}({}),n=function(t){return t.local="local",t.server="server",t}({}),r=function(t){return t.language="language",t.system="system",t.DMY="DMY",t.MDY="MDY",t.YMD="YMD",t}({}),l=function(t){return t.language="language",t.monday="monday",t.tuesday="tuesday",t.wednesday="wednesday",t.thursday="thursday",t.friday="friday",t.saturday="saturday",t.sunday="sunday",t}({});const c=(t,e)=>(0,i.oT)(t.connection,"language",e),d=(t,e)=>(0,i.Bp)(t.connection,"language",e),h=async(t,e,s,i,a)=>(await t.callWS({type:"frontend/get_translations",language:e,category:s,integration:i,config_flow:a})).resources},52069(t,e,s){s.d(e,{EF:()=>n,S_:()=>i,Xv:()=>r,ni:()=>o,u1:()=>l,z3:()=>c});const i=(t,e)=>t.callApi("POST","tts_get_url",e),a="media-source://tts/",o=t=>t.startsWith(a),n=t=>t.substring(19),r=(t,e,s)=>t.callWS({type:"tts/engine/list",language:e,country:s}),l=(t,e)=>t.callWS({type:"tts/engine/get",engine_id:e}),c=(t,e,s)=>t.callWS({type:"tts/engine/voices",engine_id:e,language:s})},8164(t,e,s){s.d(e,{d:()=>i});const i=t=>t.callWS({type:"wyoming/info"})},37046(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(18350),l=(s(67094),s(69075)),c=(s(61037),t([r]));r=(c.then?(await c)():c)[0];const d="M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",h="M8,7A2,2 0 0,1 10,9V14A2,2 0 0,1 8,16A2,2 0 0,1 6,14V9A2,2 0 0,1 8,7M14,14C14,16.97 11.84,19.44 9,19.92V22H7V19.92C4.16,19.44 2,16.97 2,14H4A4,4 0 0,0 8,18A4,4 0 0,0 12,14H14M21.41,9.41L17.17,13.66L18.18,10H14A2,2 0 0,1 12,8V4A2,2 0 0,1 14,2H20A2,2 0 0,1 22,4V8C22,8.55 21.78,9.05 21.41,9.41Z",p="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z";class u extends a.WF{render(){return a.qy`<div class="content"> <img src="${`/static/images/logo_nabu_casa${this.hass.themes?.darkMode?"_dark":""}.png`}" alt="Nabu Casa logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.cloud.title")} </h1> <div class="features"> <div class="feature speech"> <div class="logos"> <div class="round-icon"> <ha-svg-icon .path="${h}"></ha-svg-icon> </div> </div> <h2> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.features.speech.title")} <span class="no-wrap"></span> </h2> <p> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.features.speech.text")} </p> </div> <div class="feature access"> <div class="logos"> <div class="round-icon"> <ha-svg-icon .path="${d}"></ha-svg-icon> </div> </div> <h2> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.features.remote_access.title")} <span class="no-wrap"></span> </h2> <p> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.features.remote_access.text")} </p> </div> <div class="feature"> <div class="logos"> <voice-assistant-brand-icon .voiceAssistantId="${"cloud.google_assistant"}" .hass="${this.hass}"> </voice-assistant-brand-icon> <voice-assistant-brand-icon .voiceAssistantId="${"cloud.alexa"}" .hass="${this.hass}"> </voice-assistant-brand-icon> </div> <h2> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.features.assistants.title")} </h2> <p> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.features.assistants.text")} </p> </div> </div> </div> <div class="footer side-by-side"> <ha-button href="https://www.nabucasa.com" target="_blank" rel="noreferrer noopener" appearance="plain"> <ha-svg-icon .path="${p}" slot="start"></ha-svg-icon> nabucasa.com </ha-button> <ha-button @click="${this._signUp}">${this.hass.localize("ui.panel.config.cloud.register.headline")}</ha-button> </div>`}_signUp(){(0,n.r)(this,"cloud-step",{step:"SIGNUP"})}}u.styles=[l.s,a.AH`:host{display:flex}.features{display:flex;flex-direction:column;grid-gap:var(--ha-space-4);padding:16px}.feature{display:flex;flex-direction:column;align-items:center;text-align:center;margin-bottom:16px}.feature .logos{margin-bottom:16px;display:flex;gap:var(--ha-space-4)}.feature .logos>*{width:40px;height:40px}.round-icon{border-radius:var(--ha-border-radius-circle);color:#6e41ab;background-color:#e8dcf7;display:flex;align-items:center;justify-content:center;font-size:var(--ha-font-size-2xl)}.access .round-icon{color:#00aef8;background-color:#cceffe}.feature h2{font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-normal);margin-top:0;margin-bottom:8px}.feature p{font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);margin:0}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"hass",void 0),u=(0,i.Cg)([(0,o.EM)("cloud-step-intro")],u),e()}catch(t){e(t)}})},87019(t,e,s){s.a(t,async function(t,e){try{s(69112);var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(91926),l=s(38962),c=s(18350),d=(s(67094),s(91485)),h=s(71117),p=s(68893),u=s(65063),g=s(69075),_=t([l,c,d]);[l,c,d]=_.then?(await _)():_;class v extends a.WF{render(){return a.qy`<div class="content"> <img src="${`/static/images/logo_nabu_casa${this.hass.themes?.darkMode?"_dark":""}.png`}" alt="Nabu Casa logo"> <h1>${this.hass.localize("ui.panel.config.cloud.login.sign_in")}</h1> ${this._error?a.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:""} <ha-input autofocus id="email" name="email" .label="${this.hass.localize("ui.panel.config.cloud.register.email_address")}" .disabled="${this._requestInProgress}" type="email" autocomplete="email" required @keydown="${this._keyDown}" .validationMessage="${this.hass.localize("ui.panel.config.cloud.register.email_error_msg")}"></ha-input> <ha-input id="password" type="password" password-toggle name="password" .label="${this.hass.localize("ui.panel.config.cloud.register.password")}" .disabled="${this._requestInProgress}" autocomplete="new-password" minlength="8" required @keydown="${this._keyDown}" .validationMessage="${this.hass.localize("ui.panel.config.cloud.register.password_error_msg")}"></ha-input> </div> <div class="footer"> <ha-button @click="${this._handleLogin}" .disabled="${this._requestInProgress}">${this.hass.localize("ui.panel.config.cloud.login.sign_in")}</ha-button> </div>`}_keyDown(t){"Enter"===t.key&&this._handleLogin()}async _handleLogin(){const t=this._emailField,e=this._passwordField,s=t.value,i=e.value;if(!t.reportValidity())return e.reportValidity(),void t.focus();if(!e.reportValidity())return void e.focus();this._requestInProgress=!0;const a=async(e,s)=>{try{await(0,h.p7)({hass:this.hass,email:e,...s?{code:s}:{password:i},check_connection:this._checkConnection})}catch(s){const i=s&&s.body&&s.body.code;if("mfarequired"===i){const t=await(0,u.an)(this,{title:this.hass.localize("ui.panel.config.cloud.login.totp_code_prompt_title"),inputLabel:this.hass.localize("ui.panel.config.cloud.login.totp_code"),inputType:"text",defaultValue:"",confirmText:this.hass.localize("ui.panel.config.cloud.login.submit")});if(null!==t&&""!==t)return void await a(e,t.trim())}if("alreadyconnectederror"===i)return void(0,p.o)(this,{details:JSON.parse(s.body.message),logInHereAction:()=>{this._checkConnection=!1,a(e)},closeDialog:()=>{this._requestInProgress=!1}});if("usernotfound"===i&&e!==e.toLowerCase())return void await a(e.toLowerCase());if("PasswordChangeRequired"===i)return(0,u.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.cloud.login.alert_password_change_required")}),(0,r.oo)("/config/cloud/forgot-password"),void(0,n.r)(this,"closed");switch(this._requestInProgress=!1,i){case"UserNotConfirmed":this._error=this.hass.localize("ui.panel.config.cloud.login.alert_email_confirm_necessary");break;case"mfarequired":this._error=this.hass.localize("ui.panel.config.cloud.login.alert_mfa_code_required");break;case"mfaexpiredornotstarted":this._error=this.hass.localize("ui.panel.config.cloud.login.alert_mfa_expired_or_not_started");break;case"invalidtotpcode":this._error=this.hass.localize("ui.panel.config.cloud.login.alert_totp_code_invalid");break;default:this._error=s&&s.body&&s.body.message?s.body.message:"Unknown error"}t.focus()}};await a(s)}constructor(...t){super(...t),this._requestInProgress=!1,this._checkConnection=!0}}v.styles=[g.s,a.AH`:host{display:block}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_requestInProgress",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_error",void 0),(0,i.Cg)([(0,o.wk)()],v.prototype,"_checkConnection",void 0),(0,i.Cg)([(0,o.P)("#email",!0)],v.prototype,"_emailField",void 0),(0,i.Cg)([(0,o.P)("#password",!0)],v.prototype,"_passwordField",void 0),v=(0,i.Cg)([(0,o.EM)("cloud-step-signin")],v),e()}catch(t){e(t)}})},47594(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(38962),l=s(18350),c=(s(67094),s(91485)),d=s(71117),h=s(69075),p=t([r,l,c]);[r,l,c]=p.then?(await p)():p;class u extends a.WF{render(){return a.qy`<div class="content"> <img src="${`/static/images/logo_nabu_casa${this.hass.themes?.darkMode?"_dark":""}.png`}" alt="Nabu Casa logo"> <h1> ${this.hass.localize("ui.panel.config.cloud.register.create_account")} </h1> ${this._error?a.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:""} ${"VERIFY"===this._state?a.qy`<p> ${this.hass.localize("ui.panel.config.cloud.register.confirm_email",{email:this._email})} </p>`:a.qy`<ha-input autofocus id="email" name="email" .label="${this.hass.localize("ui.panel.config.cloud.register.email_address")}" .disabled="${this._requestInProgress}" type="email" autocomplete="email" required @keydown="${this._keyDown}" .validationMessage="${this.hass.localize("ui.panel.config.cloud.register.email_error_msg")}"></ha-input> <ha-input id="password" type="password" password-toggle name="password" .label="${this.hass.localize("ui.panel.config.cloud.register.password")}" .disabled="${this._requestInProgress}" autocomplete="new-password" minlength="8" required @keydown="${this._keyDown}" .validationMessage="${this.hass.localize("ui.panel.config.cloud.register.password_error_msg")}"></ha-input>`} </div> <div class="footer side-by-side"> ${"VERIFY"===this._state?a.qy`<ha-button @click="${this._handleResendVerifyEmail}" .disabled="${this._requestInProgress}" appearance="plain">${this.hass.localize("ui.panel.config.cloud.register.resend_confirm_email")}</ha-button><ha-button @click="${this._login}" .disabled="${this._requestInProgress}">${this.hass.localize("ui.panel.config.cloud.register.clicked_confirm")}</ha-button>`:a.qy`<ha-button @click="${this._signIn}" .disabled="${this._requestInProgress}" appearance="plain">${this.hass.localize("ui.panel.config.cloud.login.sign_in")}</ha-button> <ha-button @click="${this._handleRegister}" .disabled="${this._requestInProgress}">${this.hass.localize("ui.common.next")}</ha-button>`} </div>`}_signIn(){(0,n.r)(this,"cloud-step",{step:"SIGNIN"})}_keyDown(t){"Enter"===t.key&&this._handleRegister()}async _handleRegister(){const t=this._emailField,e=this._passwordField;let s=!1;if(t.reportValidity()||(s=!0,t.focus()),e.reportValidity()||(s||e.focus(),s=!0),s)return;const i=t.value.toLowerCase(),a=e.value;this._requestInProgress=!0;try{await(0,d.vO)(this.hass,i,a),this._email=i,this._password=a,this._verificationEmailSent()}catch(t){this._password="",this._error=t&&t.body&&t.body.message?t.body.message:"Unknown error"}finally{this._requestInProgress=!1}}async _handleResendVerifyEmail(){if(this._email)try{await(0,d.q3)(this.hass,this._email),this._verificationEmailSent()}catch(t){this._error=t&&t.body&&t.body.message?t.body.message:"Unknown error"}}_verificationEmailSent(){this._state="VERIFY",setTimeout(()=>this._login(),5e3)}async _login(){if(this._email&&this._password)try{await(0,d.p7)({hass:this.hass,email:this._email,password:this._password}),(0,n.r)(this,"cloud-step",{step:"DONE"})}catch(t){"usernotconfirmed"===t?.body?.code?this._verificationEmailSent():this._error="Something went wrong. Please try again."}}constructor(...t){super(...t),this._requestInProgress=!1}}u.styles=[h.s,a.AH`.content{width:100%}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_requestInProgress",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_email",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_password",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_error",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_state",void 0),(0,i.Cg)([(0,o.P)("#email",!0)],u.prototype,"_emailField",void 0),(0,i.Cg)([(0,o.P)("#password",!0)],u.prototype,"_passwordField",void 0),u=(0,i.Cg)([(0,o.EM)("cloud-step-signup")],u),e()}catch(t){e(t)}})},69075(t,e,s){s.d(e,{s:()=>a});var i=s(5124);const a=[s(14503).RF,i.AH`:host{align-items:center;text-align:center;min-height:400px;display:flex;flex-direction:column;justify-content:space-between;height:100%;padding:24px;box-sizing:border-box}.content{flex:1}.content img{width:120px}@media all and (max-width:450px),all and (max-height:500px){:host{min-height:100%;height:auto}.content img{margin-top:68px;margin-bottom:68px}}.footer{display:flex;width:100%;flex-direction:row;justify-content:flex-end}.footer.full-width{flex-direction:column}.footer.full-width ha-button{width:100%}.footer.centered{justify-content:center}.footer.side-by-side{justify-content:space-between}`]},85027(t,e,s){s.a(t,async function(t,i){try{s.r(e),s.d(e,{HaVoiceAssistantSetupDialog:()=>E,STEP:()=>I});s(74423),s(44114),s(18111),s(22489),s(20116),s(61701);var a=s(62826),o=s(5124),n=s(22441),r=s(22786),l=s(1087),c=s(71727),d=s(86198),h=(s(34296),s(72554)),p=s(29823),u=(s(70947),s(14927)),g=s(62351),_=s(88433),v=s(22675),m=s(14503),y=s(83051),f=s(56396),b=s(11944),w=s(35613),C=s(63095),$=s(37184),x=s(16923),k=s(16487),A=s(62187),S=t([h,p,y,f,b,w,C,$,x,k,A,d,u]);[h,p,y,f,b,w,C,$,x,k,A,d,u]=S.then?(await S)():S;const z="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",M="M7,10L12,15L17,10H7Z";var I=function(t){return t[t.INIT=0]="INIT",t[t.UPDATE=1]="UPDATE",t[t.CHECK=2]="CHECK",t[t.WAKEWORD=3]="WAKEWORD",t[t.AREA=4]="AREA",t[t.PIPELINE=5]="PIPELINE",t[t.SUCCESS=6]="SUCCESS",t[t.CLOUD=7]="CLOUD",t[t.LOCAL=8]="LOCAL",t[t.CHANGE_WAKEWORD=9]="CHANGE_WAKEWORD",t}({});class E extends o.WF{async showDialog(t){this._params=t,this._open=!0,await this._fetchAssistConfiguration(),this._step=1}closeDialog(){this._open=!1}willUpdate(t){t.has("_step")&&5===this._step&&this._getLanguages()}_dialogClosed(){this._open=!1,this._params=void 0,this._assistConfiguration=void 0,this._previousSteps=[],this._nextStep=void 0,this._step=0,this._language=void 0,this._languages=[],this._localOption=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return o.s6;const t=this._findDomainEntityId(this._params.deviceId,this.hass.entities,"assist_satellite"),e=t?this.hass.states[t]:void 0,s=8===this._step||1===this._step&&!this._previousSteps.length;return o.qy` <ha-dialog .open="${this._open}" header-title="Voice Satellite setup" prevent-scrim-close @closed="${this._dialogClosed}"> ${s?o.qy`<span slot="headerNavigationIcon"></span>`:this._previousSteps.length?o.qy`<ha-icon-button slot="headerNavigationIcon" .label="${this.hass.localize("ui.common.back")??"Back"}" .path="${z}" @click="${this._goToPreviousStep}"></ha-icon-button>`:o.s6} ${3===this._step||4===this._step?o.qy`<ha-button @click="${this._goToNextStep}" class="skip-btn" slot="headerActionItems">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.skip")}</ha-button>`:5===this._step&&this._language?o.qy`<ha-dropdown slot="headerActionItems" @wa-select="${this._handlePickLanguage}"> <ha-assist-chip .label="${(0,d.T)(this._language,this.hass.locale)}" slot="trigger"> <ha-svg-icon slot="trailing-icon" .path="${M}"></ha-svg-icon></ha-assist-chip> ${(0,u.getLanguageOptions)(this._languages,!1,!1,this.hass.locale).map(t=>o.qy`<ha-dropdown-item .value="${t.id}" .selected="${this._language===t.id}"> ${t.primary} </ha-dropdown-item>`)} </ha-dropdown>`:o.s6} <div class="content" @next-step="${this._goToNextStep}" @prev-step="${this._goToPreviousStep}"> ${1===this._step?o.qy`<ha-voice-assistant-setup-step-update .hass="${this.hass}" .updateEntityId="${this._findDomainEntityId(this._params.deviceId,this.hass.entities,"update")}"></ha-voice-assistant-setup-step-update>`:this._error?o.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:e?.state===v.Hh?o.qy`<ha-alert alert-type="error">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.not_available")}</ha-alert>`:2===this._step?o.qy`<ha-voice-assistant-setup-step-check .hass="${this.hass}" .assistEntityId="${t}"></ha-voice-assistant-setup-step-check>`:3===this._step?o.qy`<ha-voice-assistant-setup-step-wake-word .hass="${this.hass}" .assistConfiguration="${this._assistConfiguration}" .assistEntityId="${t}" .deviceEntities="${this._deviceEntities(this._params.deviceId,this.hass.entities)}"></ha-voice-assistant-setup-step-wake-word>`:9===this._step?o.qy` <ha-voice-assistant-setup-step-change-wake-word .hass="${this.hass}" .assistConfiguration="${this._assistConfiguration}" .assistEntityId="${t}"></ha-voice-assistant-setup-step-change-wake-word> `:4===this._step?o.qy` <ha-voice-assistant-setup-step-area .hass="${this.hass}" .deviceId="${this._params.deviceId}"></ha-voice-assistant-setup-step-area> `:5===this._step?o.qy`<ha-voice-assistant-setup-step-pipeline .hass="${this.hass}" .languages="${this._languages}" .language="${this._language}" .assistConfiguration="${this._assistConfiguration}" .assistEntityId="${t}" @language-changed="${this._languageChanged}"></ha-voice-assistant-setup-step-pipeline>`:7===this._step?o.qy`<ha-voice-assistant-setup-step-cloud .hass="${this.hass}"></ha-voice-assistant-setup-step-cloud>`:8===this._step?o.qy`<ha-voice-assistant-setup-step-local .hass="${this.hass}" .language="${this._language}" .localOption="${this._localOption}" .assistConfiguration="${this._assistConfiguration}"></ha-voice-assistant-setup-step-local>`:6===this._step?o.qy`<ha-voice-assistant-setup-step-success .hass="${this.hass}" .assistConfiguration="${this._assistConfiguration}" .assistEntityId="${t}" .deviceId="${this._params.deviceId}"></ha-voice-assistant-setup-step-success>`:o.s6} </div> </ha-dialog> `}async _getLanguages(){if(this._languages.length)return;const t=await(0,_.e1)(this.hass);this._languages=Object.entries(t.languages).filter(([t,e])=>e.cloud>0||e.full_local>0||e.focused_local>0).map(([t,e])=>t),this._language=t.preferred_language&&this._languages.includes(t.preferred_language)?t.preferred_language:void 0}async _fetchAssistConfiguration(){try{this._assistConfiguration=await(0,g.Vy)(this.hass,this._findDomainEntityId(this._params.deviceId,this.hass.entities,"assist_satellite"))}catch(t){this._error=t.message}}_handlePickLanguage(t){this._language=t.detail.item.value}_languageChanged(t){t.detail.value&&(this._language=t.detail.value)}_goToPreviousStep(){this._previousSteps.length&&(this._step=this._previousSteps.pop())}async _goToNextStep(t){t?.detail?.updateConfig&&await this._fetchAssistConfiguration(),t?.detail?.nextStep&&(this._nextStep=t.detail.nextStep),t?.detail?.noPrevious||this._previousSteps.push(this._step),t?.detail?.step?(this._step=t.detail.step,8===t.detail.step&&(this._localOption=t.detail.option)):this._nextStep?(this._step=this._nextStep,this._nextStep=void 0):this._step+=1}static get styles(){return[m.nA,o.AH`ha-dialog{--dialog-content-padding:0}@media all and (max-width:450px),all and (max-height:500px){.content{height:calc(100vh - 56px)}}.skip-btn{margin-top:6px}ha-alert{margin:24px;display:block}ha-dropdown{height:48px;display:flex;align-items:center;margin-right:12px;margin-inline-end:12px;margin-inline-start:initial}`]}constructor(...t){super(...t),this._open=!1,this._step=0,this._languages=[],this._previousSteps=[],this._deviceEntities=(0,r.A)((t,e)=>Object.values(e).filter(e=>e.device_id===t)),this._findDomainEntityId=(0,r.A)((t,e,s)=>{const i=this._deviceEntities(t,e);return i.find(t=>(0,c.m)(t.entity_id)===s)?.entity_id})}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_params",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_open",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_step",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_assistConfiguration",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_error",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_language",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_languages",void 0),(0,a.Cg)([(0,n.wk)()],E.prototype,"_localOption",void 0),E=(0,a.Cg)([(0,n.EM)("ha-voice-assistant-setup-dialog")],E),i()}catch(t){i(t)}})},83051(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(66086),l=s(58594),c=s(65063),d=s(69075),h=t([r]);r=(h.then?(await h)():h)[0];class p extends a.WF{render(){const t=this.hass.devices[this.deviceId];return a.qy`<div class="content"> <img src="/static/images/voice-assistant/area.png" alt="Casita ioBroker logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.area.title")} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.area.secondary")} </p> <ha-area-picker .hass="${this.hass}" .value="${t.area_id}"></ha-area-picker> </div> <div class="footer"> <ha-button @click="${this._setArea}">${this.hass.localize("ui.common.next")}</ha-button> </div>`}async _setArea(){const t=this.shadowRoot.querySelector("ha-area-picker").value;t?(await(0,l.FB)(this.hass,this.deviceId,{area_id:t}),this._nextStep()):(0,c.showAlertDialog)(this,{text:this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.area.no_selection")})}_nextStep(){(0,n.r)(this,"next-step")}}p.styles=[d.s,a.AH`ha-area-picker{display:block;width:100%;margin-bottom:24px;text-align:initial}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"deviceId",void 0),p=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-area")],p),e()}catch(t){e(t)}})},56396(t,e,s){s.a(t,async function(t,e){try{s(18111),s(61701);var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=(s(1671),s(50723),s(62351)),l=s(69075),c=s(85027),d=t([c]);c=(d.then?(await d)():d)[0];class h extends a.WF{render(){return a.qy`<div class="padding content"> <img src="/static/images/voice-assistant/change-wake-word.png" alt="Casita ioBroker logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.change_wake_word.title")} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.change_wake_word.secondary")} </p> </div> <ha-list-base> ${this.assistConfiguration.available_wake_words.map(t=>a.qy`<ha-list-item-button @click="${this._wakeWordPicked}" .value="${t.id}"> ${t.wake_word} <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-button>`)} </ha-list-base>`}async _wakeWordPicked(t){if(!this.assistEntityId)return;const e=t.currentTarget.value;await(0,r.g5)(this.hass,this.assistEntityId,[e]),this._nextStep()}_nextStep(){(0,n.r)(this,"next-step",{step:c.STEP.WAKEWORD,updateConfig:!0})}}h.styles=[l.s,a.AH`:host{padding:0}.padding{padding:24px}ha-list-base{width:100%;text-align:initial;margin-bottom:24px}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"assistConfiguration",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"assistEntityId",void 0),h=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-change-wake-word")],h),e()}catch(t){e(t)}})},11944(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(18350),l=s(65829),c=s(62351),d=s(36918),h=s(69075),p=t([r,l]);[r,l]=p.then?(await p)():p;class u extends a.WF{willUpdate(t){super.willUpdate(t),this.hasUpdated?"success"===this._status&&t.has("hass")&&"idle"===this.hass.states[this.assistEntityId]?.state&&this._nextStep():this._testConnection()}render(){return a.qy`<div class="content"> ${"timeout"===this._status?a.qy`<img src="/static/images/voice-assistant/error.png" alt="Casita ioBroker error logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.check.failed_title")} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.check.failed_secondary")} </p> <div class="footer"> <ha-button appearance="plain" href="${(0,d.o)(this.hass,"/voice_control/troubleshooting/#i-dont-get-a-voice-response")}"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.check.help")}</ha-button> <ha-button @click="${this._testConnection}">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.check.retry")}</ha-button> </div>`:a.qy`<img src="/static/images/voice-assistant/hi.png" alt="Casita ioBroker hi logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.check.title")} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.check.secondary")} </p> ${this._showLoader?a.qy`<ha-spinner></ha-spinner>`:a.s6}`} </div>`}async _testConnection(){this._status=void 0,this._showLoader=!1;const t=setTimeout(()=>{this._showLoader=!0},3e3),e=await(0,c.tl)(this.hass,this.assistEntityId);clearTimeout(t),this._showLoader=!1,this._status=e.status}_nextStep(){(0,n.r)(this,"next-step",{noPrevious:!0})}constructor(...t){super(...t),this._showLoader=!1}}u.styles=h.s,(0,i.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"assistEntityId",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_status",void 0),(0,i.Cg)([(0,o.wk)()],u.prototype,"_showLoader",void 0),u=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-check")],u),e()}catch(t){e(t)}})},35613(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(5124),o=s(22441),n=s(37046),r=s(87019),l=s(47594),c=s(1087),d=s(85027),h=t([n,r,l,d]);[n,r,l,d]=h.then?(await h)():h;class p extends a.WF{render(){return"SIGNUP"===this._state?a.qy`<cloud-step-signup .hass="${this.hass}" @cloud-step="${this._cloudStep}"></cloud-step-signup>`:"SIGNIN"===this._state?a.qy`<cloud-step-signin .hass="${this.hass}" @cloud-step="${this._cloudStep}"></cloud-step-signin>`:a.qy`<cloud-step-intro .hass="${this.hass}" @cloud-step="${this._cloudStep}"></cloud-step-intro>`}_cloudStep(t){"DONE"!==t.detail.step?this._state=t.detail.step:(0,c.r)(this,"next-step",{step:d.STEP.PIPELINE,noPrevious:!0})}constructor(...t){super(...t),this._state="INTRO"}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,i.Cg)([(0,o.wk)()],p.prototype,"_state",void 0),p=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-cloud")],p),e()}catch(t){e(t)}})},63095(t,e,s){s.a(t,async function(t,e){try{s(74423),s(18111),s(22489),s(20116),s(61701),s(13579);var i=s(62826),a=s(5124),o=s(22441),n=s(36312),r=s(1087),l=s(71727),c=s(65829),d=s(69150),h=s(26571),p=s(88433),u=s(59241),g=s(22130),_=s(99037),v=s(52069),m=s(8164),y=s(36918),f=s(69075),b=s(85027),w=t([c,b]);[c,b]=w.then?(await w)():w;const C="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z";class $ extends a.WF{render(){return a.qy`<div class="content"> ${"INSTALLING"===this._state?a.qy`<img src="/static/images/voice-assistant/update.png" alt="Casita ioBroker loading logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.title")} </h1> <p> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.secondary")} </p> <ha-spinner></ha-spinner> <p> ${this._detailState||"Installation can take several minutes"} </p>`:"ERROR"===this._state?a.qy`<img src="/static/images/voice-assistant/error.png" alt="Casita ioBroker error logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.failed_title")} </h1> <p>${this._error}</p> <p> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.failed_secondary")} </p> <ha-button appearance="plain" size="small" @click="${this._prevStep}">${this.hass.localize("ui.common.back")}</ha-button> <ha-button href="${(0,y.o)(this.hass,"/voice_control/voice_remote_local_assistant/")}" target="_blank" rel="noreferrer noopener" size="small" appearance="plain"> <ha-svg-icon .path="${C}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.common.learn_more")}</ha-button>`:"NOT_SUPPORTED"===this._state?a.qy`<img src="/static/images/voice-assistant/error.png" alt="Casita ioBroker error logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.not_supported_title")} </h1> <p> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.not_supported_secondary")} </p> <ha-button appearance="plain" size="small" @click="${this._prevStep}">${this.hass.localize("ui.common.back")}</ha-button> <ha-button href="${(0,y.o)(this.hass,"/voice_control/voice_remote_local_assistant/")}" target="_blank" rel="noreferrer noopener" appearance="plain" size="small"> <ha-svg-icon .path="${C}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.common.learn_more")}</ha-button>`:a.s6} </div>`}willUpdate(t){super.willUpdate(t),this.hasUpdated||this._checkLocal()}_prevStep(){(0,r.r)(this,"prev-step")}_nextStep(){(0,r.r)(this,"next-step",{step:b.STEP.SUCCESS,noPrevious:!0})}async _checkLocal(){if(await this._findLocalEntities(),this._localTts&&this._localStt)try{if(this._localTts.length&&this._localStt.length)return void await this._pickOrCreatePipelineExists();if(!(0,n.x)(this.hass.config,"hassio"))return void(this._state="NOT_SUPPORTED");this._state="INSTALLING";const{addons:t}=await(0,g.fetchHassioAddonsInfo)(this.hass),e=t.find(t=>t.slug===this._ttsAddonName),s=t.find(t=>t.slug===this._sttAddonName);this._localTts.length||(e||(this._detailState=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.state.installing_${this._ttsProviderName}`),await(0,g.installHassioAddon)(this.hass.callWS,this._ttsAddonName)),e&&"started"===e.state||(this._detailState=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.state.starting_${this._ttsProviderName}`),await(0,g.startHassioAddon)(this.hass.callWS,this._ttsAddonName)),this._detailState=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.state.setup_${this._ttsProviderName}`),await this._setupConfigEntry("tts")),this._localStt.length||(s||(this._detailState=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.state.installing_${this._sttProviderName}`),await(0,g.installHassioAddon)(this.hass.callWS,this._sttAddonName)),s&&"started"===s.state||(this._detailState=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.state.starting_${this._sttProviderName}`),await(0,g.startHassioAddon)(this.hass.callWS,this._sttAddonName)),this._detailState=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.state.setup_${this._sttProviderName}`),await this._setupConfigEntry("stt")),this._detailState=this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.state.creating_pipeline"),await this._findEntitiesAndCreatePipeline()}catch(t){this._state="ERROR",this._error=t.message}}get _sttProviderName(){return"focused_local"===this.localOption?"speech-to-phrase":"faster-whisper"}get _sttAddonName(){return"focused_local"===this.localOption?"core_speech-to-phrase":"core_whisper"}get _sttHostName(){return"focused_local"===this.localOption?"core-speech-to-phrase":"core-whisper"}async _findLocalEntities(){const t=Object.values(this.hass.entities).filter(t=>"wyoming"===t.platform);if(!t.length)return this._localStt=[],void(this._localTts=[]);const e=await(0,m.d)(this.hass),s=Object.values(await(0,u.G3)(this.hass,t.map(t=>t.entity_id)));this._localTts=s.filter(t=>"tts"===(0,l.m)(t.entity_id)&&t.config_entry_id&&e.info[t.config_entry_id]?.tts.some(t=>t.name===this._ttsProviderName)),this._localStt=s.filter(t=>"stt"===(0,l.m)(t.entity_id)&&t.config_entry_id&&e.info[t.config_entry_id]?.asr.some(t=>t.name===this._sttProviderName))}async _setupConfigEntry(t){const e=await this._findConfigFlowInProgress(t);if(e){if("create_entry"===(await(0,h.jm)(this.hass,e.flow_id,{})).type)return}return this._createConfigEntry(t)}async _findConfigFlowInProgress(t){return(await(0,h.t2)(this.hass.connection)).find(e=>"wyoming"===e.handler&&"hassio"===e.context.source&&(e.context.configuration_url&&e.context.configuration_url.includes("tts"===t?this._ttsAddonName:this._sttAddonName)||e.context.title_placeholders.name&&e.context.title_placeholders.name.toLowerCase().includes("tts"===t?this._ttsProviderName:this._sttProviderName)))}async _createConfigEntry(t){const e=await(0,h.t1)(this.hass,"wyoming"),s=await(0,h.jm)(this.hass,e.flow_id,{host:"tts"===t?this._ttsHostName:this._sttHostName,port:"tts"===t?this._ttsPort:this._sttPort});if("create_entry"!==s.type)throw new Error(`${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.errors.failed_create_entry",{app:"tts"===t?this._ttsProviderName:this._sttProviderName})}${"errors"in s?`: ${s.errors.base}`:""}`)}async _pickOrCreatePipelineExists(){if(!this._localStt?.length||!this._localTts?.length)return;const t=await(0,d.nx)(this.hass);t.preferred_pipeline&&t.pipelines.sort(e=>e.id===t.preferred_pipeline?-1:0);const e=this._localTts.map(t=>t.entity_id),s=this._localStt.map(t=>t.entity_id);let i=t.pipelines.find(t=>"conversation.home_assistant"===t.conversation_engine&&t.tts_engine&&e.includes(t.tts_engine)&&t.stt_engine&&s.includes(t.stt_engine)&&t.language.split("-")[0]===this.language.split("-")[0]);i||(i=await this._createPipeline(this._localTts[0].entity_id,this._localStt[0].entity_id)),await this.hass.callService("select","select_option",{option:i.name},{entity_id:this.assistConfiguration?.pipeline_entity_id}),this._nextStep()}async _createPipeline(t,e){const s=await(0,d.nx)(this.hass),i=(await(0,p.vc)(this.hass,this.language||this.hass.config.language,this.hass.config.country||void 0)).agents.find(t=>"conversation.home_assistant"===t.id);if(!i?.supported_languages.length)throw new Error("Conversation agent does not support requested language.");const a=(await(0,v.Xv)(this.hass,this.language,this.hass.config.country||void 0)).providers.find(e=>e.engine_id===t);if(!a?.supported_languages?.length)throw new Error("TTS engine does not support requested language.");const o=await(0,v.z3)(this.hass,t,a.supported_languages[0]);if(!o.voices?.length)throw new Error("No voice available for requested language.");const n=(await(0,_.T)(this.hass,this.language,this.hass.config.country||void 0)).providers.find(t=>t.engine_id===e);if(!n?.supported_languages?.length)throw new Error("STT engine does not support requested language.");let r=this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.${this.localOption}_pipeline`),l=1;for(;s.pipelines.find(t=>t.name===r);)r=`${this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.local.${this.localOption}_pipeline`)} ${l}`,l++;return(0,d.u6)(this.hass,{name:r,language:this.language.split("-")[0],conversation_engine:"conversation.home_assistant",conversation_language:i.supported_languages[0],stt_engine:e,stt_language:n.supported_languages[0],tts_engine:t,tts_language:a.supported_languages[0],tts_voice:o.voices[0].voice_id,wake_word_entity:null,wake_word_id:null})}async _findEntitiesAndCreatePipeline(t=0){if(await this._findLocalEntities(),!this._localTts?.length||!this._localStt?.length){if(t>3)throw new Error(this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.local.errors.could_not_find_entities"));return await new Promise(t=>{setTimeout(t,2e3)}),this._findEntitiesAndCreatePipeline(t+1)}const e=await this._createPipeline(this._localTts[0].entity_id,this._localStt[0].entity_id);await this.hass.callService("select","select_option",{option:e.name},{entity_id:this.assistConfiguration?.pipeline_entity_id}),this._nextStep()}constructor(...t){super(...t),this._state="INTRO",this._ttsProviderName="piper",this._ttsAddonName="core_piper",this._ttsHostName="core-piper",this._ttsPort=10200,this._sttPort=10300}}$.styles=[f.s,a.AH`ha-spinner{margin-top:24px;margin-bottom:24px}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"assistConfiguration",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"localOption",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],$.prototype,"language",void 0),(0,i.Cg)([(0,o.wk)()],$.prototype,"_state",void 0),(0,i.Cg)([(0,o.wk)()],$.prototype,"_detailState",void 0),(0,i.Cg)([(0,o.wk)()],$.prototype,"_error",void 0),(0,i.Cg)([(0,o.wk)()],$.prototype,"_localTts",void 0),(0,i.Cg)([(0,o.wk)()],$.prototype,"_localStt",void 0),$=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-local")],$),e()}catch(t){e(t)}})},37184(t,e,s){s.a(t,async function(t,e){try{s(44114),s(18111),s(20116);var i=s(62826),a=s(5124),o=s(22441),n=s(22786),r=s(36312),l=s(1087),c=s(71727),d=s(86198),h=(s(2226),s(69150)),p=s(71117),u=s(88433),g=s(99037),_=s(52069),v=s(36918),m=s(69075),y=s(85027),f=t([d,y]);[d,y]=f.then?(await f)():f;const b=["cloud","focused_local","full_local"],w={cloud:0,focused_local:0,full_local:0};class C extends a.WF{willUpdate(t){if(super.willUpdate(t),this.hasUpdated||this._fetchData(),(t.has("language")||t.has("_languageScores"))&&this.language&&this._languageScores){const t=this.language;this._value&&0===this._languageScores[t]?.[this._value]&&(this._value=void 0),this._value||(this._value=this._getOptions(this._languageScores[t]||w,this.hass.localize).supportedOptions[0]?.value)}}render(){if(!this._cloudChecked||!this._languageScores)return a.s6;if(!this.language){const t=(0,d.T)(this.hass.config.language,this.hass.locale);return a.qy`<div class="content"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.unsupported_language.header")} </h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.unsupported_language.secondary",{language:t})} <ha-language-picker .hass="${this.hass}" .label="${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.unsupported_language.language_picker")}" .languages="${this.languages}" @value-changed="${this._languageChanged}"></ha-language-picker> <a href="${(0,v.o)(this.hass,"/voice_control/contribute-voice/")}">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.unsupported_language.contribute",{language:t})}</a> </div>`}const t=this._languageScores[this.language]||w,e=this._getOptions(t,this.hass.localize),s=this._value?"full_local"===this._value?"low":"high":"",i=this._value?t[this._value]>2?"high":t[this._value]>1?"ready":t[this._value]>0?"low":"":"";return a.qy`<div class="content"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.title")} </h1> <div class="bar-header"> <span>${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.performance.header")}</span><span>${s?this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.pipeline.performance.${s}`):""}</span> </div> <div class="perf-bar ${s}"> <div class="segment"></div> <div class="segment"></div> <div class="segment"></div> </div> <div class="bar-header"> <span>${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.commands.header")}</span><span>${i?this.hass.localize(`ui.panel.config.voice_assistants.satellite_wizard.pipeline.commands.${i}`):""}</span> </div> <div class="perf-bar ${i}"> <div class="segment"></div> <div class="segment"></div> <div class="segment"></div> </div> <ha-select-box max_columns="1" .options="${e.supportedOptions}" .value="${this._value}" @value-changed="${this._valueChanged}"></ha-select-box> ${e.unsupportedOptions.length?a.qy`<h3> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.pipeline.unsupported")} </h3> <ha-select-box max_columns="1" .options="${e.unsupportedOptions}" disabled="disabled"></ha-select-box>`:a.s6} </div> <div class="footer"> <ha-button @click="${this._createPipeline}" .disabled="${!this._value}">${this.hass.localize("ui.common.next")}</ha-button> </div>`}async _fetchData(){await this._hasCloud()&&await this._createCloudPipeline(!1)||(this._cloudChecked=!0,this._languageScores=(await(0,u.e1)(this.hass)).languages)}async _hasCloud(){if(!(0,r.x)(this.hass.config,"cloud"))return!1;const t=await(0,p.eN)(this.hass);return!(!t.logged_in||!t.active_subscription)}async _createCloudPipeline(t){let e,s;for(const t of Object.values(this.hass.entities))if("cloud"===t.platform){const i=(0,c.m)(t.entity_id);if("tts"===i)e=t.entity_id;else{if("stt"!==i)continue;s=t.entity_id}if(e&&s)break}try{const i=await(0,h.nx)(this.hass);i.preferred_pipeline&&i.pipelines.sort(t=>t.id===i.preferred_pipeline?-1:0);let a=i.pipelines.find(i=>"conversation.home_assistant"===i.conversation_engine&&i.tts_engine===e&&i.stt_engine===s&&(!t||i.language.split("-")[0]===this.language.split("-")[0]));if(!a){const t=(await(0,u.vc)(this.hass,this.language||this.hass.config.language,this.hass.config.country||void 0)).agents.find(t=>"conversation.home_assistant"===t.id);if(!t?.supported_languages.length)return!1;const o=(await(0,_.Xv)(this.hass,this.language||this.hass.config.language,this.hass.config.country||void 0)).providers.find(t=>t.engine_id===e);if(!o?.supported_languages?.length)return!1;const n=await(0,_.z3)(this.hass,e,o.supported_languages[0]),r=(await(0,g.T)(this.hass,this.language||this.hass.config.language,this.hass.config.country||void 0)).providers.find(t=>t.engine_id===s);if(!r?.supported_languages?.length)return!1;let l="ioBroker Cloud",c=1;for(;i.pipelines.find(t=>t.name===l);)l=`ioBroker Cloud ${c}`,c++;a=await(0,h.u6)(this.hass,{name:l,language:(this.language||this.hass.config.language).split("-")[0],conversation_engine:"conversation.home_assistant",conversation_language:t.supported_languages[0],stt_engine:s,stt_language:r.supported_languages[0],tts_engine:e,tts_language:o.supported_languages[0],tts_voice:n.voices[0].voice_id,wake_word_entity:null,wake_word_id:null})}return await this.hass.callService("select","select_option",{option:a.name},{entity_id:this.assistConfiguration?.pipeline_entity_id}),(0,l.r)(this,"next-step",{step:y.STEP.SUCCESS,noPrevious:!0}),!0}catch(t){return!1}}_valueChanged(t){this._value=t.detail.value}async _setupCloud(){await this._hasCloud()?this._createCloudPipeline(!0):(0,l.r)(this,"next-step",{step:y.STEP.CLOUD})}_createPipeline(){"cloud"===this._value?this._setupCloud():"focused_local"===this._value?this._setupLocalFocused():this._setupLocalFull()}_setupLocalFocused(){(0,l.r)(this,"next-step",{step:y.STEP.LOCAL,option:this._value})}_setupLocalFull(){(0,l.r)(this,"next-step",{step:y.STEP.LOCAL,option:this._value})}_languageChanged(t){t.detail.value&&(0,l.r)(this,"language-changed",{value:t.detail.value})}constructor(...t){super(...t),this.languages=[],this._cloudChecked=!1,this._getOptions=(0,n.A)((t,e)=>{const s=[],i=[];return b.forEach(a=>{t[a]>0?s.push({label:e(`ui.panel.config.voice_assistants.satellite_wizard.pipeline.options.${a}.label`),description:e(`ui.panel.config.voice_assistants.satellite_wizard.pipeline.options.${a}.description`),value:a}):i.push({label:e(`ui.panel.config.voice_assistants.satellite_wizard.pipeline.options.${a}.label`),value:a})}),{supportedOptions:s,unsupportedOptions:i}})}}C.styles=[m.s,a.AH`:host{text-align:left}.perf-bar{width:100%;height:10px;display:flex;gap:var(--ha-space-1);margin:8px 0}.segment{flex-grow:1;background-color:var(--disabled-color);transition:background-color .3s}.segment:first-child{border-radius:var(--ha-border-radius-sm) var(--ha-border-radius-square) var(--ha-border-radius-square) var(--ha-border-radius-sm)}.segment:last-child{border-radius:var(--ha-border-radius-square) var(--ha-border-radius-sm) var(--ha-border-radius-sm) var(--ha-border-radius-square)}.perf-bar.high .segment{background-color:var(--success-color)}.perf-bar.ready .segment:nth-child(-n+2){background-color:var(--warning-color)}.perf-bar.low .segment:first-child{background-color:var(--error-color)}.bar-header{display:flex;justify-content:space-between;margin:8px 0;margin-top:16px}ha-select-box{display:block}ha-select-box:first-of-type{margin-top:32px}.footer{margin-top:16px}ha-language-picker{display:block;margin-top:16px;margin-bottom:16px}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],C.prototype,"assistConfiguration",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],C.prototype,"deviceId",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],C.prototype,"assistEntityId",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],C.prototype,"language",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],C.prototype,"languages",void 0),(0,i.Cg)([(0,o.wk)()],C.prototype,"_cloudChecked",void 0),(0,i.Cg)([(0,o.wk)()],C.prototype,"_value",void 0),(0,i.Cg)([(0,o.wk)()],C.prototype,"_languageScores",void 0),C=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-pipeline")],C),e()}catch(t){e(t)}})},16923(t,e,s){s.a(t,async function(t,e){try{s(74423),s(18111),s(20116),s(61701);var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(57237),l=s(37981),c=s(606),d=s(58933),h=s(91485),p=s(69150),u=s(62351),g=s(71117),_=s(58594),v=s(97078),m=s(53732),y=s(78157),f=s(17733),b=s(69075),w=s(85027),C=t([c,d,h,y,w]);[c,d,h,y,w]=C.then?(await C)():C;const $="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",x="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z",k="M8,5.14V19.14L19,12.14L8,5.14Z";class A extends a.WF{willUpdate(t){if(super.willUpdate(t),t.has("assistConfiguration"))this._setTtsSettings();else if(t.has("hass")&&this.assistConfiguration){const e=t.get("hass");if(e){const t=e.states[this.assistConfiguration.pipeline_entity_id],s=this.hass.states[this.assistConfiguration.pipeline_entity_id];t.state!==s.state&&this._setTtsSettings()}}}render(){const t=this.assistConfiguration?this.hass.states[this.assistConfiguration.pipeline_entity_id]:void 0,e=this.hass.devices[this.deviceId];return a.qy`<div class="content"> <img src="/static/images/voice-assistant/heart.png" alt="Casita ioBroker logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.title")} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.secondary")} </p> ${this._error?a.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:a.s6} <div class="rows"> <div class="row"> <ha-input .label="${this.hass.localize("ui.panel.config.integrations.config_flow.device_name")}" .placeholder="${(0,l.T)(e,this.hass.localize,this.hass.states)}" .value="${this._deviceName??(0,l.xn)(e)}" @change="${this._deviceNameChanged}"></ha-input> </div> ${this.assistConfiguration&&this.assistConfiguration.available_wake_words.length>1?a.qy`<div class="row"> <ha-select .label="${this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.detail.form.wake_word_id")}" .value="${this.assistConfiguration.active_wake_words[0]}" @selected="${this._wakeWordPicked}" .options="${this.assistConfiguration.available_wake_words.map(t=>({value:t.id,label:t.wake_word}))}"></ha-select> <ha-button appearance="plain" size="small" @click="${this._testWakeWord}"> <ha-svg-icon slot="start" .path="${x}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.test_wakeword")} </ha-button> </div>`:a.s6} ${t?a.qy`<div class="row"> <ha-select .label="${this.hass.localize("ui.panel.config.voice_assistants.assistants.pipeline.devices.pipeline")}" @closed="${r.d}" .value="${t?.state}" @selected="${this._pipelinePicked}" .options="${t?.attributes.options.map(e=>({value:e,label:this.hass.formatEntityState(t,e)}))}"> </ha-select> <ha-button appearance="plain" size="small" @click="${this._openPipeline}"> <ha-svg-icon slot="start" .path="${$}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.edit_pipeline")} </ha-button> </div>`:a.s6} ${this._ttsSettings?a.qy`<div class="row"> <ha-tts-voice-picker .hass="${this.hass}" .engineId="${this._ttsSettings.engine}" .language="${this._ttsSettings.language}" .value="${this._ttsSettings.voice}" @value-changed="${this._voicePicked}" @closed="${r.d}"></ha-tts-voice-picker> <ha-button appearance="plain" size="small" @click="${this._testTts}"> <ha-svg-icon slot="start" .path="${k}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.try_tts")} </ha-button> </div>`:a.s6} </div> </div> <div class="footer"> <ha-button @click="${this._done}">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.done")}</ha-button> </div>`}async _getPipeline(){if(!this.assistConfiguration?.pipeline_entity_id)return[void 0,void 0];const t=this.hass.states[this.assistConfiguration?.pipeline_entity_id].state,e=await(0,p.nx)(this.hass);let s;return s="preferred"===t?e.pipelines.find(t=>t.id===e.preferred_pipeline):e.pipelines.find(e=>e.name===t),[s,e.preferred_pipeline]}_deviceNameChanged(t){this._deviceName=t.target.value}async _wakeWordPicked(t){const e=t.detail.value;this.assistConfiguration&&(this.assistConfiguration.active_wake_words=[e]),await(0,u.g5)(this.hass,this.assistEntityId,[e])}_pipelinePicked(t){const e=this.hass.states[this.assistConfiguration.pipeline_entity_id],s=t.detail.value;s!==e.state&&e.attributes.options.includes(s)&&(0,v.w)(this.hass,e.entity_id,s)}async _setTtsSettings(){const[t]=await this._getPipeline();this._ttsSettings=t?{engine:t.tts_engine,voice:t.tts_voice,language:t.tts_language}:void 0}async _voicePicked(t){const[e]=await this._getPipeline();e&&await(0,p.zn)(this.hass,e.id,{...e,tts_voice:t.detail.value})}async _testTts(){const[t]=await this._getPipeline();if(t){if(t.language!==this.hass.locale.language)try{const e=await(0,f.sC)(null,t.language,!1);return void this._announce(e.data["ui.dialogs.tts-try.message_example"])}catch(t){}this._announce(this.hass.localize("ui.dialogs.tts-try.message_example"))}}async _announce(t){this.assistEntityId&&await(0,u.ew)(this.hass,this.assistEntityId,{message:t,preannounce:!1})}_testWakeWord(){(0,n.r)(this,"next-step",{step:w.STEP.WAKEWORD,nextStep:w.STEP.SUCCESS,updateConfig:!0})}async _openPipeline(){const[t]=await this._getPipeline();if(!t)return;const e=await(0,g.eN)(this.hass);(0,m.L)(this,{cloudActiveSubscription:e.logged_in&&e.active_subscription,pipeline:t,updatePipeline:async e=>{await(0,p.zn)(this.hass,t.id,e)},hideWakeWord:!0})}async _done(){if(this._deviceName)try{(0,_.FB)(this.hass,this.deviceId,{name_by_user:this._deviceName})}catch(t){return void(this._error=this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.success.failed_rename",{error:t.message||t}))}(0,n.r)(this,"closed")}}A.styles=[b.s,a.AH`ha-tts-voice-picker{display:block}.footer{margin-top:24px}.rows{gap:var(--ha-space-4);display:flex;flex-direction:column}.row{display:flex;justify-content:space-between;align-items:center}.row>:first-child{flex:1;margin-right:4px}.row ha-button{width:82px}ha-select{display:block;text-align:start}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],A.prototype,"assistConfiguration",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],A.prototype,"deviceId",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],A.prototype,"assistEntityId",void 0),(0,i.Cg)([(0,o.wk)()],A.prototype,"_ttsSettings",void 0),(0,i.Cg)([(0,o.wk)()],A.prototype,"_error",void 0),A=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-success")],A),e()}catch(t){e(t)}})},16487(t,e,s){s.a(t,async function(t,e){try{var i=s(62826),a=s(5124),o=s(22441),n=s(1087),r=s(65829),l=s(16386),c=s(22675),d=s(24247),h=s(69075),p=t([r,l,d]);[r,l,d]=p.then?(await p)():p;class u extends a.WF{willUpdate(t){if(super.willUpdate(t),this.updateEntityId){if(t.has("hass")&&this.updateEntityId){const e=t.get("hass");if(e){const t=e.states[this.updateEntityId],s=this.hass.states[this.updateEntityId];if(t?.state===c.Hh&&s?.state!==c.Hh||"on"!==t?.state&&"on"===s?.state)return void this._tryUpdate(!1)}}t.has("updateEntityId")&&this._tryUpdate(!0)}else this._nextStep()}render(){if(!this.updateEntityId||!(this.updateEntityId in this.hass.states))return a.s6;const t=this.hass.states[this.updateEntityId],e=t&&(0,d.RJ)(t);return a.qy`<div class="content"> <img src="/static/images/voice-assistant/update.png" alt="Casita ioBroker loading logo"> <h1> ${t&&("unavailable"===t.state||(0,d.Jy)(t))?this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.update.title"):this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.update.checking")} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.update.secondary")} </p> ${e?a.qy` <ha-progress-ring .value="${t.attributes.update_percentage}"></ha-progress-ring> `:a.qy`<ha-spinner></ha-spinner>`} <p> ${t?.state===c.Hh?"Restarting voice assistant":e?`Installing ${t.attributes.update_percentage}%`:""} </p> </div>`}async _tryUpdate(t){if(clearTimeout(this._refreshTimeout),!this.updateEntityId)return;const e=this.hass.states[this.updateEntityId];e&&"on"===this.hass.states[e.entity_id].state&&(0,d.VK)(e)?(this._updated=!0,await this.hass.callService("update","install",{},{entity_id:e.entity_id})):t?(await this.hass.callService("homeassistant","update_entity",{},{entity_id:this.updateEntityId}),this._refreshTimeout=window.setTimeout(()=>{this._nextStep()},1e4)):this._nextStep()}_nextStep(){(0,n.r)(this,"next-step",{noPrevious:!0,updateConfig:this._updated})}constructor(...t){super(...t),this._updated=!1}}u.styles=[h.s,a.AH`ha-progress-ring,ha-spinner{margin-top:24px;margin-bottom:24px}`],(0,i.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"updateEntityId",void 0),u=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-update")],u),e()}catch(t){e(t)}})},62187(t,e,s){s.a(t,async function(t,e){try{s(74423),s(18111),s(20116);var i=s(62826),a=s(5124),o=s(22441),n=s(22786),r=s(1087),l=s(71727),c=s(18350),d=(s(76538),s(65829)),h=s(62351),p=s(69075),u=s(85027),g=t([c,d,u]);[c,d,u]=g.then?(await g)():g;class _ extends a.WF{disconnectedCallback(){super.disconnectedCallback(),this._stopListeningWakeWord()}willUpdate(t){super.willUpdate(t),t.has("assistConfiguration")&&this.assistConfiguration&&!this.assistConfiguration.available_wake_words.length&&this._nextStep(),t.has("assistEntityId")&&(this._detected=!1,this._muteSwitchEntity=this.deviceEntities?.find(t=>"switch"===(0,l.m)(t.entity_id)&&t.entity_id.includes("mute"))?.entity_id,this._muteSwitchEntity||this._startTimeOut(),this._listenWakeWord())}_startTimeOut(){this._timeout=window.setTimeout(()=>{this._timeout=void 0,this._timedout=!0},15e3)}render(){if(!this.assistEntityId)return a.s6;return"idle"!==this.hass.states[this.assistEntityId].state?a.qy`<ha-spinner></ha-spinner>`:a.qy`<div class="content"> ${this._detected?a.qy`<img src="/static/images/voice-assistant/ok-nabu.png" alt="Casita ioBroker logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.title_2",{wakeword:this._activeWakeWord(this.assistConfiguration)})} </h1> <p class="secondary"> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.secondary_2")} </p>`:a.qy` <img src="/static/images/voice-assistant/sleep.png" alt="Casita ioBroker logo"> <h1> ${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.title",{wakeword:this._activeWakeWord(this.assistConfiguration)})} </h1> <p class="secondary">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.secondary")}</p> `} ${this._timedout?a.qy`<ha-alert alert-type="warning">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.time_out")}</ha-alert>`:this._muteSwitchEntity&&"on"===this.hass.states[this._muteSwitchEntity].state?a.qy`<ha-alert alert-type="warning" .title="${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.muted")}">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.muted_description")}</ha-alert>`:a.s6} </div> ${this.assistConfiguration&&this.assistConfiguration.available_wake_words.length>1?a.qy`<div class="footer centered"> <ha-button appearance="plain" size="small" @click="${this._changeWakeWord}">${this.hass.localize("ui.panel.config.voice_assistants.satellite_wizard.wake_word.change_wake_word")}</ha-button> </div>`:a.s6}`}async _listenWakeWord(){const t=this.assistEntityId;t&&(await this._stopListeningWakeWord(),this._sub=(0,h.ds)(this.hass,t,()=>{this._timedout=!1,clearTimeout(this._timeout),this._stopListeningWakeWord(),this._detected?this._nextStep():(this._detected=!0,this._listenWakeWord())}))}async _stopListeningWakeWord(){try{(await this._sub)?.()}catch(t){}this._sub=void 0}_nextStep(){(0,r.r)(this,"next-step")}_changeWakeWord(){(0,r.r)(this,"next-step",{step:u.STEP.CHANGE_WAKEWORD})}constructor(...t){super(...t),this._detected=!1,this._timedout=!1,this._activeWakeWord=(0,n.A)(t=>{if(!t)return"";const e=t.active_wake_words[0];return t.available_wake_words.find(t=>t.id===e)?.wake_word})}}_.styles=p.s,(0,i.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"assistConfiguration",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"assistEntityId",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"deviceEntities",void 0),(0,i.Cg)([(0,o.wk)()],_.prototype,"_muteSwitchEntity",void 0),(0,i.Cg)([(0,o.wk)()],_.prototype,"_detected",void 0),(0,i.Cg)([(0,o.wk)()],_.prototype,"_timedout",void 0),_=(0,i.Cg)([(0,o.EM)("ha-voice-assistant-setup-step-wake-word")],_),e()}catch(t){e(t)}})},17894(t,e,s){s.d(e,{c:()=>o});var i=s(62826),a=s(22441);const o=t=>{class e extends t{constructor(...t){super(...t),this.disabled=!1,this.required=!1,this.unknown=!1,this.hideClearIcon=!1}}return(0,i.Cg)([(0,a.MZ)({type:Boolean})],e.prototype,"disabled",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean})],e.prototype,"required",void 0),(0,i.Cg)([(0,a.MZ)()],e.prototype,"icon",void 0),(0,i.Cg)([(0,a.MZ)()],e.prototype,"image",void 0),(0,i.Cg)([(0,a.MZ)()],e.prototype,"label",void 0),(0,i.Cg)([(0,a.MZ)()],e.prototype,"placeholder",void 0),(0,i.Cg)([(0,a.MZ)()],e.prototype,"helper",void 0),(0,i.Cg)([(0,a.MZ)()],e.prototype,"value",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],e.prototype,"unknown",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"unknown-item-text"})],e.prototype,"unknownItemText",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"hide-clear-icon",type:Boolean})],e.prototype,"hideClearIcon",void 0),(0,i.Cg)([(0,a.MZ)({attribute:!1})],e.prototype,"valueRenderer",void 0),e}},68893(t,e,s){s.d(e,{o:()=>a});var i=s(1087);const a=(t,e)=>new Promise(a=>{const o=e.closeDialog,n=e.logInHereAction;(0,i.r)(t,"show-dialog",{dialogTag:"dialog-cloud-already-connected",dialogImport:()=>s.e(88028).then(s.bind(s,59959)),dialogParams:{...e,closeDialog:()=>{o?.(),a(!1)},logInHereAction:()=>{n?.(),a(!0)}}})})},53732(t,e,s){s.d(e,{L:()=>o});var i=s(1087);const a=()=>Promise.all([s.e(72130),s.e(85010),s.e(43935),s.e(34310),s.e(79662),s.e(81969)]).then(s.bind(s,43528)),o=(t,e)=>{(0,i.r)(t,"show-dialog",{dialogTag:"dialog-voice-assistant-pipeline-detail",dialogImport:a,dialogParams:e})}},4397(t,e,s){s.r(e),s.d(e,{HuiErrorCard:()=>r});var i=s(62826),a=s(5124),o=s(22441);s(76776),s(67094);const n={warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z"};class r extends a.WF{getCardSize(){return 1}getGridOptions(){return{columns:6,rows:this.preview?"auto":1,min_rows:1,min_columns:6}}setConfig(t){this._config=t,this.severity=t.severity||"error"}render(){const t=this._config?.error||"warning"===this.severity&&this.hass?.localize("ui.errors.config.configuration_warning")||this.hass?.localize("ui.errors.config.configuration_error"),e=void 0===this.hass||this.hass?.user?.is_admin||this.preview,s=this.preview;return a.qy` <ha-card class="${this.severity} ${e?"":"no-title"}"> <div class="header"> <div class="icon"> <slot name="icon"> <ha-svg-icon .path="${n[this.severity]}"></ha-svg-icon> </slot> </div> ${e?a.qy`<div class="title"><slot>${t}</slot></div>`:a.s6} </div> ${s&&this._config?.message?a.qy`<div class="message">${this._config.message}</div>`:a.s6} </ha-card> `}constructor(...t){super(...t),this.preview=!1,this.severity="error"}}r.styles=a.AH`ha-card{height:100%;border-width:0}ha-card::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.header{display:flex;align-items:center;gap:var(--ha-space-2);padding:16px}.message{padding:0 16px 16px 16px}.no-title{justify-content:center}.title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:var(--ha-font-weight-bold)}ha-card.warning .icon{color:var(--warning-color)}ha-card.warning::after{background-color:var(--warning-color)}ha-card.error .icon{color:var(--error-color)}ha-card.error::after{background-color:var(--error-color)}`,(0,i.Cg)([(0,o.MZ)({attribute:!1})],r.prototype,"hass",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],r.prototype,"preview",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"severity"})],r.prototype,"severity",void 0),(0,i.Cg)([(0,o.wk)()],r.prototype,"_config",void 0),r=(0,i.Cg)([(0,o.EM)("hui-error-card")],r)},784(t,e,s){s.d(e,{LX:()=>r,pY:()=>l,xP:()=>a});s(18111),s(13579);var i=s(20939);function a(t,e){if(e.has("_config"))return!0;if(!e.has("hass"))return!1;const s=e.get("hass");return!s||(s.connected!==t.hass.connected||s.themes!==t.hass.themes||s.locale!==t.hass.locale||s.localize!==t.hass.localize||s.formatEntityState!==t.hass.formatEntityState||s.formatEntityAttributeName!==t.hass.formatEntityAttributeName||s.formatEntityAttributeValue!==t.hass.formatEntityAttributeValue||s.config.state!==t.hass.config.state)}function o(t,e,s){return t.states[s]!==e.states[s]}function n(t,e,s){const i=t.entities[s],a=e.entities[s];return i?.display_precision!==a?.display_precision}function r(t,e){if(a(t,e))return!0;if(!e.has("hass"))return!1;const s=e.get("hass"),i=t.hass;return o(s,i,t._config.entity)||n(s,i,t._config.entity)}function l(t,e){if(a(t,e))return!0;if(!e.has("hass"))return!1;const s=e.get("hass"),r=t.hass;return(0,i.L)(t._config.entities,!1).some(t=>"entity"in t&&(o(s,r,t.entity)||n(s,r,t.entity)))}},85979(t,e,s){s.a(t,async function(t,i){try{s.d(e,{j:()=>d});var a=s(62826),o=s(58888),n=s(5124),r=s(22441),l=s(38962),c=(s(4397),t([l]));l=(c.then?(await c)():c)[0];const d=(t,e)=>t.config.state!==o.m2?t.localize("ui.card.common.entity_not_found"):t.localize("ui.panel.lovelace.warning.starting");class h extends n.WF{render(){return n.qy`<hui-error-card .hass="${this.hass}" severity="warning"><slot></slot></hui-error-card>`}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],h.prototype,"hass",void 0),h=(0,a.Cg)([(0,r.EM)("hui-warning")],h),i()}catch(t){i(t)}})},78157(t,e,s){s.a(t,async function(t,i){try{s.r(e);s(74423),s(18111),s(61701);var a=s(62826),o=s(5124),n=s(22441),r=s(606),l=s(22675),c=s(88360),d=s(97078),h=s(784),p=s(79757),u=s(85979),g=t([r,p,u]);[r,p,u]=g.then?(await g)():g;class _ extends o.WF{setConfig(t){if(!t||!t.entity)throw new Error("Entity must be specified");this._config=t}shouldUpdate(t){return(0,h.LX)(this,t)||t.has("_selectedEntityRow")}willUpdate(t){super.willUpdate(t),this.hass&&this._config&&t.get("hass")&&this.hass.states[this._config.entity]!==t.get("hass").states[this._config.entity]&&(this._selectedEntityRow=void 0)}render(){if(!this.hass||!this._config)return o.s6;const t=this.hass.states[this._config.entity];if(!t)return o.qy` <hui-warning .hass="${this.hass}"> ${(0,u.j)(this.hass,this._config.entity)} </hui-warning> `;const e=this.hass.formatEntityName(t,this._config.name);return o.qy` <hui-generic-entity-row .hass="${this.hass}" .config="${this._config}" hide-name> <ha-select .label="${e}" .value="${this._selectedEntityRow||t.state}" .options="${t.attributes.options?.map(e=>({value:e,label:this.hass.formatEntityState(t,e)}))}" .disabled="${t.state===l.Hh}" @selected="${this._handleAction}"> </ha-select> </hui-generic-entity-row> `}_handleAction(t){const e=this.hass.states[this._config.entity],s=t.detail.value;s!==e.state&&e.attributes.options.includes(s)&&((0,c.j)(this,"light"),this._selectedEntityRow=s,(0,d.w)(this.hass,e.entity_id,s).catch(t=>{}).finally(()=>setTimeout(()=>{this.hass.states[this._config.entity]===e&&(this._selectedEntityRow=void 0)},2e3)))}}_.styles=o.AH`hui-generic-entity-row{display:flex;align-items:center}ha-select{width:100%;--ha-select-min-width:0}`,(0,a.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],_.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)()],_.prototype,"_selectedEntityRow",void 0),_=(0,a.Cg)([(0,n.EM)("hui-select-entity-row")],_),i()}catch(t){i(t)}})},86030(t,e,s){s.d(e,{B:()=>i,a:()=>a});s(18111),s(18237);function i(t){return Array.isArray(t)?t.reverse().reduce((t,e)=>`var(${e}${t?`, ${t}`:""})`,void 0):`var(${t})`}function a(t,e){if(Array.isArray(t))for(const s of t){const t=a(s,e);if(t)return t}else if(t.endsWith("-color"))return e.getPropertyValue(t).trim()||void 0}},37619(t,e,s){s.d(e,{X:()=>o,s:()=>a});s(69112),s(33110);let i=!1;const a=t=>{i=t},o=(t,e)=>{const s=t.sendMessagePromise(e);return i&&console.log(`⬆️ Sent #${e.id}`,e),i&&s.then(t=>console.log(`⬇️ Received #${e.id}`,t&&"object"==typeof t?JSON.parse(JSON.stringify(t)):t),t=>console.error(`❌ Error #${e.id}`,t)),s}}};