UNPKG

iobroker.lovelace

Version:

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

28 lines 51.6 kB
export const __rspack_esm_id=76354;export const __rspack_esm_ids=[76354];export const __webpack_modules__={69093(t,e,i){i.d(e,{t:()=>s});var a=i(71727);const s=t=>(0,a.m)(t.entity_id)},47129(t,e,i){i.d(e,{a:()=>o});i(74423);var a=i(22675),s=i(71727);function o(t,e){const i=(0,s.m)(t.entity_id),o=void 0!==e?e:t?.state;if(["button","event","infrared","input_button","radio_frequency","scene"].includes(i))return o!==a.Hh;if(o===a.Hh||o===a.HV)return!1;if("off"===o&&"alert"!==i)return!1;switch(i){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}},82286(t,e,i){i.d(e,{$:()=>a});const a=(t,e)=>s(t.attributes,e),s=(t,e)=>0!==(t.supported_features&e)},81836(t,e,i){i.d(e,{d:()=>a,p:()=>s});const a=(t,e,i=1e3)=>t||window.setInterval(e,i),s=t=>{t&&clearInterval(t)}},58274(t,e,i){i.d(e,{m:()=>a});class a{get isInteracting(){return this._touchDragging||this._dragging}setStep(t){this._options.step=t}_getVolumeFromTouch(t){const e=this._options.getSlider();if(!e)return 0;const i=e.getBoundingClientRect(),a=Math.min(Math.max(t-i.left,0),i.width)/i.width*100;return this._roundVolumeValue(a)}_roundVolumeValue(t){return Math.min(Math.max(Math.round(t/this._options.step)*this._options.step,0),100)}_getSliderValue(){const t=this._options.getSlider();return t?Number(t.value):this._lastValue}_updateValue(t){this._lastValue=t,this._options.onValueUpdated?.(t);const e=this._options.getSlider();e&&(e.value=t)}_showTooltip(){const t=this._options.getSlider();t?.showTooltip?.()}_hideTooltip(){const t=this._options.getSlider();t?.hideTooltip?.()}constructor(t){this._touchStartX=0,this._touchStartY=0,this._touchStartValue=0,this._touchDragging=!1,this._touchScrolling=!1,this._dragging=!1,this._lastValue=0,this.handleInput=t=>{t.stopPropagation();const e=Number(t.target.value);this._dragging=!0,this._updateValue(e),this._options.onSetVolumeDebounced?.(e)},this.handleChange=t=>{t.stopPropagation();const e=Number(t.target.value);this._dragging=!1,this._updateValue(e),this._options.onSetVolume(e)},this.handleTouchStart=t=>{t.stopPropagation();const e=t.touches[0];this._touchStartX=e.clientX,this._touchStartY=e.clientY,this._touchStartValue=this._getSliderValue(),this._touchDragging=!1,this._touchScrolling=!1,this._showTooltip()},this.handleTouchMove=t=>{if(this._touchScrolling)return;const e=t.touches[0],i=e.clientX-this._touchStartX,a=e.clientY-this._touchStartY,s=Math.abs(i),o=Math.abs(a);if(!this._touchDragging){if(o>10&&o>2*s)return void(this._touchScrolling=!0);s>8&&(this._touchDragging=!0)}if(this._touchDragging){t.preventDefault();const i=this._getVolumeFromTouch(e.clientX);this._updateValue(i)}},this.handleTouchEnd=t=>{if(this._touchScrolling)return this._touchScrolling=!1,void this._hideTooltip();const e=t.changedTouches[0];if(this._touchDragging){const t=this._getVolumeFromTouch(e.clientX);this._updateValue(t),this._options.onSetVolume(t)}else{const t=this._getVolumeFromTouch(e.clientX)>this._touchStartValue?this._options.step:-this._options.step,i=this._roundVolumeValue(this._touchStartValue+t);this._updateValue(i),this._options.onSetVolume(i)}this._touchDragging=!1,this._dragging=!1,this._hideTooltip()},this.handleTouchCancel=()=>{this._touchDragging=!1,this._touchScrolling=!1,this._dragging=!1,this._updateValue(this._touchStartValue),this._hideTooltip()},this.handleWheel=t=>{t.preventDefault(),t.stopPropagation();const e=t.deltaY>0?-1:1,i=this._getSliderValue(),a=this._roundVolumeValue(i+e*this._options.step);this._updateValue(a),this._options.onSetVolume(a)},this._options=t}}},59174(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(35211),o=i(5124),r=i(22441),n=i(91450),l=i(22792),h=i(85694),d=i(44144),c=(i(47680),t([h]));h=(c.then?(await c)():c)[0];class p extends o.WF{render(){if(this.icon)return o.qy`<ha-icon .icon="${this.icon}"></ha-icon>`;if(!this.domain)return o.s6;if(!this._connection||!this._hassConfig)return this._renderFallback();const t=(0,h._4)(this._connection.connection,this._hassConfig.config,this.domain,this.deviceClass,this.state).then(t=>t?o.qy`<ha-icon .icon="${t}"></ha-icon>`:this._renderFallback());return o.qy`${(0,n.T)(t)}`}_renderFallback(){if(this.domain&&this.domain in h.l)return o.qy` <ha-svg-icon .path="${h.l[this.domain]}"></ha-svg-icon> `;if(this.brandFallback){const t=(0,d.MR)({domain:this.domain,type:"icon",darkOptimized:this._hassUi?.themes.darkMode},this._hassConfig?.auth.data.hassUrl);return o.qy` <img alt="" src="${t}" crossorigin="anonymous" referrerpolicy="no-referrer"> `}return o.qy`<ha-svg-icon .path="${h.lW}"></ha-svg-icon>`}}p.styles=o.AH`img{width:var(--mdc-icon-size,24px)}`,(0,a.Cg)([(0,r.MZ)()],p.prototype,"domain",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"deviceClass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"state",void 0),(0,a.Cg)([(0,r.MZ)()],p.prototype,"icon",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"brand-fallback",type:Boolean})],p.prototype,"brandFallback",void 0),(0,a.Cg)([(0,r.wk)(),(0,s.Fg)({context:l.WF,subscribe:!0})],p.prototype,"_hassConfig",void 0),(0,a.Cg)([(0,r.wk)(),(0,s.Fg)({context:l.Wq,subscribe:!0})],p.prototype,"_connection",void 0),(0,a.Cg)([(0,r.wk)(),(0,s.Fg)({context:l.EK,subscribe:!0})],p.prototype,"_hassUi",void 0),p=(0,a.Cg)([(0,r.EM)("ha-domain-icon")],p),e()}catch(t){e(t)}})},26300(t,e,i){i.a(t,async function(t,a){try{i.r(e),i.d(e,{HaIconButton:()=>d});var s=i(62826),o=i(5124),r=i(22441),n=i(63672),l=i(18350),h=(i(67094),t([l]));l=(h.then?(await h)():h)[0];class d extends o.WF{render(){return o.qy` <ha-button appearance="plain" variant="neutral" aria-label="${(0,n.J)(this.label)}" title="${(0,n.J)(this.hideTitle?void 0:this.label)}" aria-haspopup="${(0,n.J)(this.ariaHasPopup)}" .disabled="${this.disabled}" .iconTag="${this.path?"ha-svg-icon":"span"}" .href="${this.href}" .target="${this.target}" .rel="${this.rel}" .download="${this.download}"> ${this.path?o.qy`<ha-svg-icon aria-hidden="true" .path="${this.path}"></ha-svg-icon>`:o.qy`<span><slot></slot></span>`} </ha-button> `}constructor(...t){super(...t),this.disabled=!1,this.hideTitle=!1,this.selected=!1}}d.shadowRootOptions={mode:"open",delegatesFocus:!0},d.styles=o.AH`:host{display:inline-block;outline:0;--ha-button-height:var(--ha-icon-button-size, 48px)}ha-button{position:relative;isolation:isolate;--wa-form-control-padding-inline:var(
        --ha-icon-button-padding-inline,
        --ha-space-2
      );--wa-color-on-normal:currentColor;--wa-color-fill-quiet:transparent;--ha-button-label-overflow:visible}ha-button::after{content:"";position:absolute;inset:0;z-index:-1;border-radius:50%;background-color:currentColor;opacity:0;pointer-events:none}ha-button::part(base){width:var(--wa-form-control-height);aspect-ratio:1;outline-offset:-4px}ha-button::part(label){display:flex}:host([selected]) ha-button::after{opacity:.1}@media (hover:hover){:host(:hover:not([disabled])) ha-button::after{opacity:.1}}`,(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),(0,s.Cg)([(0,r.MZ)({type:String})],d.prototype,"path",void 0),(0,s.Cg)([(0,r.MZ)({type:String})],d.prototype,"label",void 0),(0,s.Cg)([(0,r.MZ)({type:String,attribute:"aria-haspopup"})],d.prototype,"ariaHasPopup",void 0),(0,s.Cg)([(0,r.MZ)({attribute:"hide-title",type:Boolean})],d.prototype,"hideTitle",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],d.prototype,"selected",void 0),(0,s.Cg)([(0,r.MZ)()],d.prototype,"href",void 0),(0,s.Cg)([(0,r.MZ)()],d.prototype,"target",void 0),(0,s.Cg)([(0,r.MZ)()],d.prototype,"rel",void 0),(0,s.Cg)([(0,r.MZ)()],d.prototype,"download",void 0),d=(0,s.Cg)([(0,r.EM)("ha-icon-button")],d),a()}catch(t){a(t)}})},14927(t,e,i){i.a(t,async function(t,a){try{i.d(e,{getLanguageOptions:()=>y});var s=i(74487),o=(i(18111),i(20116),i(61701),i(62826)),r=i(5124),n=i(22441),l=i(22786),h=i(1087),d=i(86198),c=i(52220),p=i(28684),u=i(18350),g=i(38508),_=t([s,u,g,d]);[s,u,g,d]=_.then?(await _)():_;const m="M7,10L12,15L17,10H7Z",v=[{name:"primary",weight:10},{name:"secondary",weight:8},{name:"search_labels.english",weight:5}],y=(t,e,i,a)=>{let s=[];const o={language:"en"};if(e){const e=p.P.translations;s=t.map(t=>{let i=e[t]?.nativeName;if(!i)try{i=new Intl.DisplayNames(t,{type:"language",fallback:"code"}).of(t)}catch(e){i=t}const s=(0,d.T)(t,a||{language:navigator.language}),r=(0,d.T)(t,o);return{id:t,primary:i,secondary:s!==i?s:void 0,search_labels:{english:r!==i?r:null}}})}else a&&(s=t.map(t=>{const e=(0,d.T)(t,a),i=(0,d.T)(t,o);return{id:t,primary:e,search_labels:{english:i!==e?i:null}}}));return!i&&a&&s.sort((t,e)=>(0,c.SH)(t.primary,e.primary,a.language)),s};class b extends r.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 r.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="${v}" @value-changed="${this._changed}" hide-clear-icon> ${this.buttonStyle?r.qy`<ha-button slot="field" .disabled="${this.disabled}" @click="${this._openPicker}" appearance="plain" variant="neutral"> ${this._getLanguageName(e)} <ha-svg-icon slot="end" .path="${m}"></ha-svg-icon> </ha-button>`:r.s6} </ha-generic-picker> `}_openPicker(t){t.stopPropagation(),this.genericPicker.open()}_changed(t){t.stopPropagation(),this.value=t.detail.value,(0,h.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=>r.qy`<span slot="headline">${this._getLanguageName(t)??t}</span> `,this._notFoundLabel=t=>{const e=r.qy`<b>‘${t}’</b>`;return this.hass?this.hass.localize("ui.components.language-picker.no_match",{term:e}):r.qy`No languages found for ${e}`}}}b.styles=r.AH`ha-generic-picker{width:100%;display:block}`,(0,o.Cg)([(0,n.MZ)()],b.prototype,"value",void 0),(0,o.Cg)([(0,n.MZ)()],b.prototype,"label",void 0),(0,o.Cg)([(0,n.MZ)({type:Array})],b.prototype,"languages",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],b.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],b.prototype,"required",void 0),(0,o.Cg)([(0,n.MZ)()],b.prototype,"helper",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"native-name",type:Boolean})],b.prototype,"nativeName",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"button-style"})],b.prototype,"buttonStyle",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"no-sort",type:Boolean})],b.prototype,"noSort",void 0),(0,o.Cg)([(0,n.wk)()],b.prototype,"_defaultLanguages",void 0),(0,o.Cg)([(0,n.P)("ha-generic-picker",!0)],b.prototype,"genericPicker",void 0),b=(0,o.Cg)([(0,n.EM)("ha-language-picker")],b),a()}catch(t){a(t)}})},2054(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(5124),o=i(22441),r=i(1087),n=i(44249),l=i(26300),h=t([l]);l=(h.then?(await h)():h)[0];const d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z";class c extends s.WF{connectedCallback(){super.connectedCallback(),this._attachNotifOnConnect&&(this._attachNotifOnConnect=!1,this._subscribeNotifications())}disconnectedCallback(){super.disconnectedCallback(),this._unsubNotifications&&(this._attachNotifOnConnect=!0,this._unsubNotifications(),this._unsubNotifications=void 0)}render(){if(!this._show)return s.s6;const t=this._hasNotifications&&(this.narrow||"always_hidden"===this.hass.dockedSidebar);return s.qy` <ha-icon-button .label="${this.hass.localize("ui.sidebar.sidebar_toggle")}" .path="${d}" @click="${this._toggleMenu}"></ha-icon-button> ${t?s.qy`<div class="dot"></div>`:""} `}willUpdate(t){if(super.willUpdate(t),!t.has("narrow")&&!t.has("hass"))return;const e=t.has("hass")?t.get("hass"):this.hass,i=t.has("narrow")?t.get("narrow"):this.narrow,a=!1===e?.kioskMode&&(i||"always_hidden"===e?.dockedSidebar),s=!1===this.hass.kioskMode&&(this.narrow||"always_hidden"===this.hass.dockedSidebar);this.hasUpdated&&a===s||(this._show=s||this._alwaysVisible,s?this._subscribeNotifications():this._unsubNotifications&&(this._unsubNotifications(),this._unsubNotifications=void 0))}_subscribeNotifications(){if(this._unsubNotifications)throw new Error("Already subscribed");this._unsubNotifications=(0,n.V)(this.hass.connection,t=>{this._hasNotifications=t.length>0})}_toggleMenu(){(0,r.r)(this,"hass-toggle-menu")}constructor(...t){super(...t),this.narrow=!1,this._hasNotifications=!1,this._show=!1,this._alwaysVisible=!1,this._attachNotifOnConnect=!1}}c.styles=s.AH`:host{position:relative}.dot{pointer-events:none;position:absolute;background-color:var(--accent-color);width:12px;height:12px;top:9px;right:7px;inset-inline-end:7px;inset-inline-start:initial;border-radius:var(--ha-border-radius-circle);border:2px solid var(--app-header-background-color)}`,(0,a.Cg)([(0,o.MZ)({type:Boolean})],c.prototype,"narrow",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,a.Cg)([(0,o.wk)()],c.prototype,"_hasNotifications",void 0),(0,a.Cg)([(0,o.wk)()],c.prototype,"_show",void 0),c=(0,a.Cg)([(0,o.EM)("ha-menu-button")],c),e()}catch(t){e(t)}})},70759(t,e,i){i.a(t,async function(t,e){try{var a=i(62826),s=i(60346),o=i(5124),r=i(22441),n=i(63091),l=t([s]);s=(l.then?(await l)():l)[0];class h extends s.A{connectedCallback(){super.connectedCallback(),this.dir=n.G.document.dir}static get styles(){return[s.A.styles,o.AH`:host{--track-size:var(--ha-slider-track-size, 4px);--marker-height:calc(var(--ha-slider-track-size, 4px) / 2);--marker-width:calc(var(--ha-slider-track-size, 4px) / 2);--wa-color-surface-default:var(--card-background-color);--wa-color-neutral-fill-normal:var(
            --ha-slider-track-color,
            var(--disabled-color)
          );--wa-tooltip-background-color:var(
            --ha-tooltip-background-color,
            var(--secondary-background-color)
          );--wa-tooltip-content-color:var(
            --ha-tooltip-text-color,
            var(--primary-text-color)
          );--wa-tooltip-font-family:var(
            --ha-tooltip-font-family,
            var(--ha-font-family-body)
          );--wa-tooltip-font-size:var(
            --ha-tooltip-font-size,
            var(--ha-font-size-s)
          );--wa-tooltip-font-weight:var(
            --ha-tooltip-font-weight,
            var(--ha-font-weight-normal)
          );--wa-tooltip-line-height:var(
            --ha-tooltip-line-height,
            var(--ha-line-height-condensed)
          );--wa-tooltip-padding:var(--ha-tooltip-padding, var(--ha-space-2));--wa-tooltip-border-radius:var(
            --ha-tooltip-border-radius,
            var(--ha-border-radius-sm)
          );--wa-tooltip-arrow-size:var(--ha-tooltip-arrow-size, 0px);--wa-tooltip-border-width:0px;--wa-z-index-tooltip:1000;min-width:100px;min-inline-size:100px;width:200px}#slider{padding-block:14px;margin-block:-14px}#thumb{border:none;background-color:var(--ha-slider-thumb-color,var(--primary-color));overflow:hidden}#thumb:after{content:"";border-radius:50%;position:absolute;width:calc(var(--thumb-width) * 2 + 8px);height:calc(var(--thumb-height) * 2 + 8px);left:calc(-50% - 4px);top:calc(-50% - 4px);cursor:pointer}#slider:focus-visible:not(.disabled) #thumb,#slider:focus-visible:not(.disabled) #thumb-max,#slider:focus-visible:not(.disabled) #thumb-min{outline:var(--wa-focus-ring)}#track:after{content:"";position:absolute;top:calc(-50% - 4px);left:0;width:100%;height:calc(var(--track-size) * 2 + 8px);cursor:pointer}#indicator{background-color:var(--ha-slider-indicator-color,var(--primary-color))}:host([size=medium]){--thumb-width:20px;--thumb-height:20px}:host([size=small]){--thumb-width:16px;--thumb-height:16px}`]}constructor(...t){super(...t),this.size="small",this.withTooltip=!0}}(0,a.Cg)([(0,r.MZ)({reflect:!0})],h.prototype,"size",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,attribute:"with-tooltip"})],h.prototype,"withTooltip",void 0),h=(0,a.Cg)([(0,r.EM)("ha-slider")],h),e()}catch(t){e(t)}})},67094(t,e,i){i.r(e),i.d(e,{HaSvgIcon:()=>r});var a=i(62826),s=i(5124),o=i(22441);class r extends s.WF{render(){return s.JW` <svg viewBox="${this.viewBox||"0 0 24 24"}" preserveAspectRatio="xMidYMid meet" focusable="false" role="img" aria-hidden="true"> <g> ${this.path?s.JW`<path class="primary-path" d="${this.path}"></path>`:s.s6} ${this.secondaryPath?s.JW`<path class="secondary-path" d="${this.secondaryPath}"></path>`:s.s6} </g> </svg>`}}r.styles=s.AH`:host{display:var(--ha-icon-display,inline-flex);align-items:center;justify-content:center;position:relative;vertical-align:middle;fill:var(--icon-primary-color,currentcolor);width:var(--mdc-icon-size,24px);height:var(--mdc-icon-size,24px)}svg{width:100%;height:100%;pointer-events:none;display:block}path.primary-path{opacity:var(--icon-primary-opactity, 1)}path.secondary-path{fill:var(--icon-secondary-color,currentcolor);opacity:var(--icon-secondary-opactity, .5)}`,(0,a.Cg)([(0,o.MZ)()],r.prototype,"path",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],r.prototype,"secondaryPath",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],r.prototype,"viewBox",void 0),r=(0,a.Cg)([(0,o.EM)("ha-svg-icon")],r)},27330(t,e,i){i.d(e,{L:()=>h,p:()=>l});var a=i(62826),s=i(5124),o=i(22441),r=i(6412);const n={passive:!0},l=s.AH`:host{display:block}.top-app-bar{box-sizing:border-box;color:var(--app-header-text-color,#fff);background-color:var(--app-header-background-color,var(--primary-color));position:fixed;top:0;inset-inline-end:0;width:var(--ha-top-app-bar-width,100%);z-index:4;padding-top:var(--safe-area-inset-top);padding-right:var(--safe-area-inset-right);transition:box-shadow var(--ha-animation-duration-normal) ease,width var(--ha-animation-duration-normal) ease,padding-left var(--ha-animation-duration-normal) ease,padding-right var(--ha-animation-duration-normal) ease}:host([narrow]) .top-app-bar{padding-left:var(--safe-area-inset-left)}.top-app-bar.scrolled:not(.pane-header){box-shadow:var(--ha-box-shadow-s)}.row{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--header-height);border-bottom:var(--app-header-border-bottom)}.section{display:flex;align-items:center;box-sizing:border-box;min-width:0;height:100%;padding:0 var(--ha-space-3)}#navigation{flex:1 1 auto}.section.center{flex:1 1 auto;justify-content:center;text-align:center}.section.end{flex:none;justify-content:flex-end}.title{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-normal);line-height:var(--header-height);padding-inline-start:var(--ha-space-6)}:host([narrow]) .title{padding-inline-start:var(--ha-space-2)}.top-app-bar-fixed-adjust{padding-top:calc(var(--header-height,0px) + var(--safe-area-inset-top,0px));padding-bottom:var(--safe-area-inset-bottom);padding-right:var(--safe-area-inset-right)}:host([narrow]) .top-app-bar-fixed-adjust{padding-left:var(--safe-area-inset-left)}`;class h extends s.WF{get scrollTarget(){return this._scrollTarget||window}set scrollTarget(t){const e=this.scrollTarget;this._unregisterListeners(),this._scrollTarget=t,this._updateBarPosition(),this.requestUpdate("scrollTarget",e),this.isConnected&&(this._registerListeners(),this._syncScrollState())}_isPaneHeader(){return!1}render(){return s.qy`${this._renderHeader()}${this._renderContent()}`}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this._updateBarPosition(),this._registerListeners(),this._syncScrollState())}_renderHeader(){const t=s.qy`<span class="title"> <slot name="title"></slot> </span>`,e=this._isPaneHeader();return s.qy` <header class="top-app-bar ${(0,r.H)({"pane-header":e})}"> <div class="row"> ${e?s.qy`<section class="section" id="title"> <slot name="navigationIcon"></slot> ${t} </section>`:s.s6} <section class="section" id="navigation"> ${e?s.s6:s.qy`<slot name="navigationIcon"></slot> ${this.centerTitle?s.s6:t}`} </section> ${!e&&this.centerTitle?s.qy`<section class="section center">${t}</section>`:s.s6} <section class="section end" id="actions" role="toolbar"> <slot name="actionItems"></slot> </section> </div> </header> `}_renderContent(){return s.qy`<div class="top-app-bar-fixed-adjust"> <slot></slot> </div>`}firstUpdated(t){super.firstUpdated(t),this._updateBarPosition(),this._registerListeners(),this._syncScrollState()}disconnectedCallback(){super.disconnectedCallback(),this._unregisterListeners()}_updateBarPosition(){this._barElement&&(this._barElement.style.position=this.scrollTarget===window?"":"absolute")}_registerListeners(){this.scrollTarget.addEventListener("scroll",this._syncScrollState,n)}_unregisterListeners(){this.scrollTarget.removeEventListener("scroll",this._syncScrollState)}constructor(...t){super(...t),this.narrow=!1,this.centerTitle=!1,this._syncScrollState=()=>{const t=this.scrollTarget instanceof Window?this.scrollTarget.pageYOffset:this.scrollTarget.scrollTop;this._barElement?.classList.toggle("scrolled",t>0)}}}h.styles=l,(0,a.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],h.prototype,"narrow",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"center-title",type:Boolean})],h.prototype,"centerTitle",void 0),(0,a.Cg)([(0,o.P)(".top-app-bar")],h.prototype,"_barElement",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"scrollTarget",null),h=(0,a.Cg)([(0,o.EM)("ha-top-app-bar-fixed")],h)},24786(t,e,i){i.a(t,async function(t,e){try{i(18111),i(22489),i(61701);var a=i(62826),s=i(35211),o=i(5124),r=i(22441),n=i(89784),l=i(1087),h=i(71727),d=i(74705),c=i(69093),p=i(28978),u=i(82286),g=i(22792),_=i(22675),m=i(53756),v=i(95350),y=i(53072),b=i(74281),f=(i(75064),i(38508)),w=(i(67094),t([b,f]));[b,f]=w.then?(await w)():w;const x="M21,16H3V4H21M21,2H3C1.89,2 1,2.89 1,4V16A2,2 0 0,0 3,18H10V20H8V22H16V20H14V18H21A2,2 0 0,0 23,16V4C23,2.89 22.1,2 21,2Z";class $ extends o.WF{render(){return o.qy` <ha-generic-picker .value="${this.value}" .getItems="${this._getPlayerItems}" .rowRenderer="${this._playerRowRenderer}" .searchFn="${this._playerSearchFn}" .searchKeys="${m.t}" .notFoundLabel="${this._notFoundPlayerLabel}" .popoverPlacement="${"top-end"}" .hideClearIcon="${!0}" @value-changed="${this._valueChanged}"> <slot name="field" slot="field" @click="${this.open}"></slot> </ha-generic-picker> `}open(t){this._picker?.open(t,{selectedValue:this.value})}_isMediaPlayerItem(t){return"stateObj"in t&&void 0!==t.stateObj}_valueChanged(t){t.stopPropagation(),t.detail.value&&(0,l.r)(this,"value-changed",{value:t.detail.value})}constructor(...t){super(...t),this._getPlayerItems=()=>{const t=this._i18n.localize("ui.components.media-browser.web-browser"),e=this._i18n.language||"en",i=this._i18n.translationMetadata.translations[e]?.isRTL||!1;return[{id:y.H1,primary:t,icon_path:x,search_labels:{entityName:t,friendlyName:t,deviceName:null,areaName:null,domainName:null,entityId:y.H1}},...Object.values(this._states).filter(this._filterPlayerEntities).map(t=>{const e=(0,p.u)(t),[a,s,o]=(0,d.Cf)(t,[{type:"entity"},{type:"device"},{type:"area"}],this._entities,this._devices,this._areas,this._floors),r=t.entity_id,n=(0,v.p$)(this._i18n.localize,(0,h.m)(r)),l=a||s||r,c=[o,a?s:void 0].filter(Boolean).join(i?" ◂ ":" ▸ ");return{id:r,primary:l,secondary:c,disabled:t.state===_.Hh,domain_name:n,sorting_label:[l,c].filter(Boolean).join("_"),search_labels:{entityName:a||null,deviceName:s||null,areaName:o||null,domainName:n||null,friendlyName:e||null,entityId:r},stateObj:t}})]},this._filterPlayerEntities=t=>"media_player"===(0,c.t)(t)&&(0,u.$)(t,y.vj.BROWSE_MEDIA)&&!this._entities[t.entity_id]?.hidden,this._playerRowRenderer=(t,e)=>{const i=this._isMediaPlayerItem(t)?t.stateObj:void 0;return o.qy` <div style="${(0,n.W)({width:"100%",borderTop:0===e?void 0:"1px solid var(--divider-color)"})}"> <ha-combo-box-item type="button" compact="compact" .disabled="${!!t.disabled}"> ${t.icon_path?o.qy` <ha-svg-icon slot="start" style="margin:0 4px" .path="${t.icon_path}"></ha-svg-icon> `:o.qy` <state-badge slot="start" .stateObj="${i}"></state-badge> `} <span slot="headline">${t.primary}</span> ${t.secondary?o.qy`<span slot="supporting-text">${t.secondary}</span>`:o.s6} ${i&&this._hassConfig.userData?.showEntityIdPicker?o.qy` <span slot="supporting-text" class="code"> ${i.entity_id} </span> `:o.s6} </ha-combo-box-item> </div> `},this._playerSearchFn=(t,e)=>{const i=e.findIndex(e=>e.id===t);if(-1===i)return e;const[a]=e.splice(i,1);return e.unshift(a),e},this._notFoundPlayerLabel=t=>this._i18n.localize("ui.components.entity.entity-picker.no_match",{term:o.qy`<b>${t}</b>`})}}$.styles=o.AH`ha-generic-picker{--ha-generic-picker-width:min(360px, calc(100vw - 32px))}`,(0,a.Cg)([(0,r.MZ)()],$.prototype,"value",void 0),(0,a.Cg)([(0,s.Fg)({context:g.iN,subscribe:!0})],$.prototype,"_states",void 0),(0,a.Cg)([(0,s.Fg)({context:g.X1,subscribe:!0})],$.prototype,"_entities",void 0),(0,a.Cg)([(0,s.Fg)({context:g.xJ,subscribe:!0})],$.prototype,"_devices",void 0),(0,a.Cg)([(0,s.Fg)({context:g.wn,subscribe:!0})],$.prototype,"_areas",void 0),(0,a.Cg)([(0,s.Fg)({context:g.rf,subscribe:!0})],$.prototype,"_floors",void 0),(0,a.Cg)([(0,s.Fg)({context:g.D5,subscribe:!0})],$.prototype,"_i18n",void 0),(0,a.Cg)([(0,s.Fg)({context:g.WF,subscribe:!0})],$.prototype,"_hassConfig",void 0),(0,a.Cg)([(0,r.P)("ha-generic-picker")],$.prototype,"_picker",void 0),$=(0,a.Cg)([(0,r.EM)("ha-media-player-picker")],$),e()}catch(t){e(t)}})},22675(t,e,i){i.d(e,{HV:()=>o,Hh:()=>s});var a=i(23832);const s="unavailable",o="unknown",r=[s,o,"off"];(0,a.g)(r)},44249(t,e,i){i.d(e,{V:()=>a});const a=(t,e)=>{const i=new s,a=t.subscribeMessage(t=>e(i.processMessage(t)),{type:"persistent_notification/subscribe"});return()=>{a.then(t=>t?.())}};class s{processMessage(t){if("removed"===t.type)for(const e of Object.keys(t.notifications))delete this.notifications[e];else this.notifications={...this.notifications,...t.notifications};return Object.values(this.notifications)}constructor(){this.notifications={}}}},54706(t,e,i){i.d(e,{E:()=>o});i(74423),i(18111),i(13579);var a=i(62826),s=i(22441);const o=t=>{class e extends t{connectedCallback(){super.connectedCallback(),this._checkSubscribed()}disconnectedCallback(){if(super.disconnectedCallback(),this.__unsubs){for(;this.__unsubs.length;){const t=this.__unsubs.pop();t instanceof Promise?t.then(t=>t()):t()}this.__unsubs=void 0}}updated(t){if(super.updated(t),t.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const e of t.keys())if(this.hassSubscribeRequiredHostProps.includes(e))return void this._checkSubscribed()}hassSubscribe(){return[]}_checkSubscribed(){void 0===this.__unsubs&&this.isConnected&&void 0!==this.hass&&!this.hassSubscribeRequiredHostProps?.some(t=>void 0===this[t])&&(this.__unsubs=this.hassSubscribe())}}return(0,a.Cg)([(0,s.MZ)({attribute:!1})],e.prototype,"hass",void 0),e}},24367(t,e,i){i.d(e,{L:()=>s,z:()=>o});var a=i(23832);const s=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],o=(0,a.g)(s)},12895(t,e,i){var a=i(62826),s=i(5124),o=i(22441);class r extends s.WF{firstUpdated(t){super.firstUpdated(t),this.addEventListener("mouseover",()=>this.classList.add("hovering"),{capture:!0}),this.addEventListener("mouseout",()=>this.classList.remove("hovering"))}updated(t){super.updated(t),t.has("text")&&this.animating&&(this.animating=!1),t.has("active")&&this.active&&this.offsetWidth<this.scrollWidth&&(this.animating=!0)}render(){return this.text?s.qy` <div class="marquee-inner" @animationiteration="${this._onIteration}"> <span>${this.text}</span> ${this.animating?s.qy` <span>${this.text}</span> `:""} </div> `:s.s6}_onIteration(){this.active||(this.animating=!1)}constructor(...t){super(...t),this.active=!1,this.animating=!1}}r.styles=s.AH`:host{display:flex;position:relative;align-items:center;height:1.2em;contain:strict}.marquee-inner{position:absolute;left:0;right:0;text-overflow:ellipsis;overflow:hidden}:host(.hovering) .marquee-inner{text-overflow:initial;overflow:initial}:host([animating]) .marquee-inner{left:initial;right:initial;animation:marquee 10s linear infinite}:host([animating]) .marquee-inner span{padding-right:16px;padding-inline-end:16px;padding-inline-start:initial}@keyframes marquee{0%{transform:translateX(0%)}100%{transform:translateX(-50%)}}`,(0,a.Cg)([(0,o.MZ)()],r.prototype,"text",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],r.prototype,"active",void 0),(0,a.Cg)([(0,o.MZ)({reflect:!0,type:Boolean})],r.prototype,"animating",void 0),r=(0,a.Cg)([(0,o.EM)("hui-marquee")],r)},76704(t,e,i){i.d(e,{A:()=>o,B:()=>s});var a=i(53072);const s="Unsupported Media";class o{pause(){this.buffering=!1,this.player.pause()}play(){this.player.play()}setVolume(t){this.player.volume=t,this.onChange()}remove(){this._removed=!0,this.onChange=void 0,this.player&&this.player.pause()}static idleStateObj(){const t=(new Date).toISOString();return{state:"idle",entity_id:a.H1,last_changed:t,last_updated:t,attributes:{},context:{id:"",user_id:null,parent_id:null}}}toStateObj(){const t=o.idleStateObj();return t.state=this.buffering?"buffering":this.player.paused||this.player.ended?"paused":"playing",t.attributes={media_title:this.item.title,entity_picture:this.item.thumbnail,volume_level:this.player.volume,supported_features:a.vj.PLAY|a.vj.PAUSE|a.vj.VOLUME_SET},this.player.duration&&(t.attributes.media_duration=this.player.duration,t.attributes.media_position=this.player.currentTime,t.attributes.media_position_updated_at=t.last_updated),t}constructor(t,e,i,a,o){this.hass=t,this.item=e,this.resolved=i,this.onChange=o,this.buffering=!0,this._removed=!1,this._handleChange=()=>{this._removed||this.onChange()};const r=new Audio(this.resolved.url);if(""===r.canPlayType(i.mime_type))throw new Error(s);r.autoplay=!0,r.volume=a,r.addEventListener("play",this._handleChange),r.addEventListener("playing",()=>{this.buffering=!1,this._handleChange()}),r.addEventListener("pause",this._handleChange),r.addEventListener("ended",this._handleChange),r.addEventListener("canplaythrough",this._handleChange),this.player=r}}},64401(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701);var a=i(62826),s=i(5124),o=i(22441),r=i(6412),n=i(91450),l=i(1087),h=i(71727),d=i(74705),c=i(82286),p=i(9899),u=i(81836),g=i(58274),_=i(18350),m=i(59174),v=i(29823),y=i(26300),b=i(70759),f=i(65829),w=i(93367),x=(i(67094),i(24786)),$=i(53072),C=i(65063),M=i(54706),V=(i(12895),i(76704)),k=t([_,m,v,y,b,f,w,x]);[_,m,v,y,b,f,w,x]=k.then?(await k)():k;const H="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",I="M21,16H3V4H21M21,2H3C1.89,2 1,2.89 1,4V16A2,2 0 0,0 3,18H10V20H8V22H16V20H14V18H21A2,2 0 0,0 23,16V4C23,2.89 22.1,2 21,2Z",P="M14,19H18V5H14M6,19H10V5H6V19Z",S="M8,5.14V19.14L19,12.14L8,5.14Z",q="M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5",L="M18,18H6V6H18V18Z",A="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z";class T extends((0,M.E)(s.WF)){connectedCallback(){super.connectedCallback();const t=this._stateObj;t&&this._showProgressBar&&"playing"===t.state&&!this._progressInterval&&(this._progressInterval=(0,u.d)(this._progressInterval,()=>this._updateProgressBar()))}disconnectedCallback(){super.disconnectedCallback(),this._progressInterval=(0,u.p)(this._progressInterval),this._tearDownBrowserPlayer()}showResolvingNewMediaPicked(){this._tearDownBrowserPlayer(),this._newMediaExpected=!0,this._debouncedResetMediaExpected()}hideResolvingNewMediaPicked(){this._newMediaExpected=!1}playItem(t,e){if(this.entityId!==$.H1)throw Error("Only browser supported");this._tearDownBrowserPlayer();try{this._browserPlayer=new V.A(this.hass,t,e,this._browserPlayerVolume,()=>this.requestUpdate("_browserPlayer"))}catch(t){if(t.message!==V.B)throw t;(0,C.showAlertDialog)(this,{text:this.hass.localize("ui.components.media-browser.media_not_supported")})}this._newMediaExpected=!1}render(){if(this._newMediaExpected)return s.qy` <div class="controls-progress buffering"> ${(0,n.T)(new Promise(t=>{setTimeout(t,500)}).then(()=>s.qy`<ha-spinner></ha-spinner>`))} </div> `;const t=this.entityId===$.H1,e=this._stateObj;if(!e)return this._renderChoosePlayer(e,this._volumeValue);const i=this.narrow?"playing"===e.state&&((0,c.$)(e,$.vj.PAUSE)||(0,c.$)(e,$.vj.STOP))||("paused"===e.state||"idle"===e.state)&&(0,c.$)(e,$.vj.PLAY)||"on"===e.state&&((0,c.$)(e,$.vj.PLAY)||(0,c.$)(e,$.vj.PAUSE))?[{icon:"on"===e.state?q:"playing"!==e.state?S:(0,c.$)(e,$.vj.PAUSE)?P:L,action:"playing"!==e.state?"media_play":(0,c.$)(e,$.vj.PAUSE)?"media_pause":"media_stop"}]:void 0:(0,$.Un)(e,!0),a=(0,$.mm)(e),o=(0,$.Xm)(e.attributes.media_duration),l=(0,$.HN)(e.attributes.media_title||e.attributes.media_content_id),h=e.attributes.entity_picture_local||e.attributes.entity_picture;return s.qy` <div class="${(0,r.H)({info:!0,pointer:!t,app:"app"===this._browserPlayer?.item.media_class})}" @click="${this._openMoreInfo}"> ${h?s.qy`<img alt="" src="${this.hass.hassUrl(h)}">`:""} <div class="media-info"> <hui-marquee .text="${l||a||("playing"!==e.state&&"on"!==e.state?this.hass.localize("ui.card.media_player.nothing_playing"):"")}" .active="${this._marqueeActive}" @mouseover="${this._marqueeMouseOver}" @mouseleave="${this._marqueeMouseLeave}"></hui-marquee> <span class="secondary"> ${l?a:""} </span> </div> </div> <div class="controls-progress ${"buffering"===e.state?"buffering":""}"> ${"buffering"===e.state?s.qy`<ha-spinner></ha-spinner> `:s.qy` <div class="controls"> ${void 0===i?"":i.map(t=>s.qy` <ha-icon-button .label="${this.hass.localize(`ui.card.media_player.${t.action}`)}" .path="${t.icon}" action="${t.action}" @click="${this._handleControlClick}"> </ha-icon-button> `)} </div> ${e.attributes.media_duration===1/0?s.s6:this.narrow?s.qy`<ha-slider class="progress-slider" min="0" max="${e.attributes.media_duration||0}" step="1" .value="${(0,$.$6)(e)}" .withTooltip="${!1}" size="small" aria-label="${this.hass.localize("ui.card.media_player.track_position")}" ?disabled="${t||!(0,c.$)(e,$.vj.SEEK)}" @change="${this._handleMediaSeekChanged}"></ha-slider>`:s.qy` <div class="progress"> <div id="CurrentProgress"></div> <ha-slider class="progress-slider" min="0" max="${e.attributes.media_duration||0}" step="1" .value="${(0,$.$6)(e)}" .withTooltip="${!1}" size="small" aria-label="${this.hass.localize("ui.card.media_player.track_position")}" ?disabled="${t||!(0,c.$)(e,$.vj.SEEK)}" @change="${this._handleMediaSeekChanged}"></ha-slider> <div>${o}</div> </div> `} `} </div> ${this._renderChoosePlayer(e,this._volumeValue)} `}_renderChoosePlayer(t,e){const i=this.entityId===$.H1;return s.qy` <div class="choose-player ${i?"browser":""}"> ${!this.narrow&&t&&(0,c.$)(t,$.vj.VOLUME_SET)?s.qy` <ha-dropdown class="volume-menu" placement="top" .distance="${8}"> <ha-icon-button slot="trigger" .path="${A}"></ha-icon-button> <div class="volume-slider-container" @touchstart="${this._volumeController.handleTouchStart}" @touchmove="${this._volumeController.handleTouchMove}" @touchend="${this._volumeController.handleTouchEnd}" @touchcancel="${this._volumeController.handleTouchCancel}" @wheel="${this._volumeController.handleWheel}"> <ha-slider class="volume-slider" labeled min="0" max="100" .step="${this._volumeStep}" .value="${e}" @input="${this._volumeController.handleInput}" @change="${this._volumeController.handleChange}"> </ha-slider> </div> </ha-dropdown> `:""} <ha-media-player-picker class="player-menu" .value="${this.entityId}" @value-changed="${this._handlePlayerSelect}"> <ha-button slot="field"> <span slot="start">${this._renderIcon(i,t)}</span> ${i?this.hass.localize("ui.components.media-browser.web-browser"):t?(()=>{const{primary:e,secondary:i}=(0,d.Bj)(this.hass,t);return s.qy`<div class="player-label"> <div>${e}</div> ${i?s.qy`<div class="player-secondary"> ${i} </div>`:s.s6} </div>`})():this.entityId} <ha-svg-icon slot="end" .path="${H}"></ha-svg-icon> </ha-button> </ha-media-player-picker> </div> `}_renderIcon(t,e){return t?s.qy`<ha-svg-icon .path="${I}"></ha-svg-icon>`:e?s.qy` <ha-state-icon .stateObj="${e}"></ha-state-icon> `:s.qy` <ha-domain-icon .domain="${(0,h.m)(this.entityId)}"></ha-domain-icon> `}willUpdate(t){if(super.willUpdate(t),t.has("entityId")&&this._tearDownBrowserPlayer(),!t.has("hass")||this.entityId===$.H1)return;const e=t.get("hass");e&&e.states[this.entityId]===this.hass.states[this.entityId]||(this._newMediaExpected=!1),t.has("hass")&&this._updateVolumeValueFromState(this._stateObj)}updated(t){if(super.updated(t),this.entityId===$.H1){if(!t.has("_browserPlayer"))return}else{const e=t.get("hass");if(e&&e.states[this.entityId]===this._stateObj)return}const e=this._stateObj;this.entityId===$.H1&&this._updateVolumeValueFromState(e),this._updateProgressBar(),this._syncVolumeSlider(),this._showProgressBar&&"playing"===e?.state?this._progressInterval=(0,u.d)(this._progressInterval,()=>this._updateProgressBar()):!this._progressInterval||this._showProgressBar&&"playing"===e?.state||(this._progressInterval=(0,u.p)(this._progressInterval))}get _stateObj(){return this.entityId===$.H1?this._browserPlayer?this._browserPlayer.toStateObj():V.A.idleStateObj():this.hass.states[this.entityId]}_tearDownBrowserPlayer(){this._browserPlayer&&(this._browserPlayer.remove(),this._browserPlayer=void 0)}_openMoreInfo(){this.entityId!==$.H1&&(0,l.r)(this,"hass-more-info",{entityId:this.entityId})}get _showProgressBar(){if(!this.hass)return!1;const t=this._stateObj;return t&&("playing"===t.state||"paused"===t.state)&&"media_duration"in t.attributes&&"media_position"in t.attributes}_updateProgressBar(){const t=this._stateObj;if(!this._progressBar||!t)return;if(!t.attributes.media_duration)return this._progressBar.value=0,void(this._currentProgress&&(this._currentProgress.innerHTML=""));const e=(0,$.$6)(t);this._progressBar.max=t.attributes.media_duration,this._progressBar.value=e,this._currentProgress&&(this._currentProgress.innerHTML=(0,$.Xm)(e))}_updateVolumeValueFromState(t){if(!t)return;const e=t.attributes.volume_level;"number"==typeof e&&Number.isFinite(e)&&(this._volumeValue=Math.round(100*e))}_syncVolumeSlider(){this._volumeSlider&&!this._volumeController.isInteracting&&(this._volumeSlider.value=this._volumeValue)}_handleControlClick(t){const e=t.currentTarget.getAttribute("action");this._browserPlayer?"media_pause"===e?this._browserPlayer.pause():"media_play"===e&&this._browserPlayer.play():(0,$.ce)(this.hass,this._stateObj,t.currentTarget.getAttribute("action"))}_handleMediaSeekChanged(t){if(this.entityId===$.H1||!this._stateObj)return;const e=t.target.value;this.hass.callService("media_player","media_seek",{entity_id:this._stateObj.entity_id,seek_position:e})}_marqueeMouseOver(){this._marqueeActive||(this._marqueeActive=!0)}_marqueeMouseLeave(){this._marqueeActive&&(this._marqueeActive=!1)}_handlePlayerSelect(t){t.stopPropagation();const{value:e}=t.detail;e&&(0,l.r)(this,"player-picked",{entityId:e})}_setVolume(t){const e=t/100;if(this._browserPlayer)return this._browserPlayerVolume=e,void this._browserPlayer.setVolume(e);(0,$.QI)(this.hass,this.entityId,e)}constructor(...t){super(...t),this.narrow=!1,this._marqueeActive=!1,this._newMediaExpected=!1,this._volumeValue=0,this._browserPlayerVolume=.8,this._volumeStep=2,this._debouncedVolumeSet=(0,p.s)(t=>{this._setVolume(t)},100),this._volumeController=new g.m({getSlider:()=>this._volumeSlider,step:this._volumeStep,onSetVolume:t=>this._setVolume(t),onSetVolumeDebounced:t=>this._debouncedVolumeSet(t),onValueUpdated:t=>{this._volumeValue=t}}),this._debouncedResetMediaExpected=(0,p.s)(()=>{this._newMediaExpected=!1},2e3)}}T.styles=s.AH`:host{display:flex;height:100px;box-sizing:border-box;background:var(--ha-card-background,var(--card-background-color,#fff));border-top:1px solid var(--divider-color);margin-right:var(--safe-area-inset-right);transition:width var(--ha-animation-duration-normal) ease,margin-left var(--ha-animation-duration-normal) ease,margin-right var(--ha-animation-duration-normal) ease}:host([narrow]){margin-left:var(--safe-area-inset-left)}@media (prefers-reduced-motion:reduce){:host{transition:1ms}}ha-slider{width:100%;min-width:100%;--ha-slider-thumb-color:var(--primary-color);--ha-slider-indicator-color:var(--primary-color)}.info{flex:1;display:flex;align-items:center;width:100%;margin-right:16px;margin-inline-end:16px;margin-inline-start:initial;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.pointer{cursor:pointer}.progress,.secondary{color:var(--secondary-text-color)}.player-label{display:flex;flex-direction:column;align-items:flex-start;gap:var(--ha-space-1);max-width:120px}.player-label>div{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.player-secondary{font-size:var(--ha-font-size-s);color:color-mix(in srgb,currentColor 70%,transparent)}.choose-player{flex:1;display:flex;justify-content:flex-end;align-items:center;padding:16px;gap:var(--ha-space-2)}.controls{height:48px;padding-bottom:4px}.controls-progress{flex:2;display:flex;align-items:center;justify-content:center;flex-direction:column;direction:ltr}.progress{display:flex;width:100%;align-items:center}.progress>div:first-child{margin-right:var(--ha-space-2)}.progress>div:last-child{margin-left:var(--ha-space-2)}.progress ha-slider{margin:0 4px}ha-dropdown.volume-menu::part(menu){width:220px;max-width:220px;overflow:visible;padding:15px 15px}.volume-slider-container{width:100%}@media (pointer:coarse){.volume-slider{pointer-events:none}}.media-info{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding-left:16px;padding-inline-start:16px;padding-inline-end:initial;width:100%}hui-marquee{font-size:1.2em;margin:0px 0 4px}img{height:100%}.app img{height:68px;margin:16px 0 16px 16px}:host([narrow]){height:57px}:host([narrow]) .controls-progress{flex:unset;min-width:48px}:host([narrow]) .controls-progress.buffering{flex:1}:host([narrow]) .media-info{padding-left:8px;padding-inline-start:8px;padding-inline-end:initial}:host([narrow]) .controls{display:flex;padding-bottom:0;--mdc-icon-size:30px}:host([narrow]) .choose-player{padding-left:0;padding-right:8px;padding-inline-start:0;padding-inline-end:8px;min-width:48px;flex:unset;justify-content:center}:host([narrow]) .choose-player.browser{justify-content:flex-end}:host([narrow]) ha-slider{position:absolute;top:-6px;left:0;right:0}`,(0,a.Cg)([(0,o.MZ)({attribute:!1})],T.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],T.prototype,"entityId",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],T.prototype,"narrow",void 0),(0,a.Cg)([(0,o.P)(".progress-slider")],T.prototype,"_progressBar",void 0),(0,a.Cg)([(0,o.P)("#CurrentProgress")],T.prototype,"_currentProgress",void 0),(0,a.Cg)([(0,o.P)(".volume-slider")],T.prototype,"_volumeSlider",void 0),(0,a.Cg)([(0,o.wk)()],T.prototype,"_marqueeActive",void 0),(0,a.Cg)([(0,o.wk)()],T.prototype,"_newMediaExpected",void 0),(0,a.Cg)([(0,o.wk)()],T.prototype,"_browserPlayer",void 0),T=(0,a.Cg)([(0,o.EM)("ha-bar-media-player")],T),e()}catch(t){e(t)}})},68965(t,e,i){i.a(t,async function(t,a){try{i.r(e);i(74423),i(18111),i(61701);var s=i(62826),o=i(5124),r=i(22441),n=i(93905),l=i(1087),h=i(91926),d=i(29823),c=(i(70947),i(26300)),p=i(90248),u=i(2054),g=(i(27330),i(19262)),_=i(45098),m=i(10897),v=i(53072),y=i(17022),b=i(65063),f=i(14503),w=i(64401),x=i(75484),$=t([d,c,p,u,g,_,w]);[d,c,p,u,g,_,w]=$.then?(await $)():$;const C="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M5,5V19H19V5H5M11,7H13A2,2 0 0,1 15,9V17H13V13H11V17H9V9A2,2 0 0,1 11,7M11,9V11H13V9H11Z",M="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",V="M10,4V8H14V4H10M16,4V8H20V4H16M16,10V14H20V10H16M16,16V20H20V16H16M14,20V16H10V20H14M8,20V16H4V20H8M8,14V10H4V14H8M8,8V4H4V8H8M10,14H14V10H10V14M4,2H20A2,2 0 0,1 22,4V20A2,2 0 0,1 20,22H4C2.92,22 2,21.1 2,20V4A2,2 0 0,1 4,2Z",k="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z",H=(t,e)=>{let i=`/media-browser/${t}`;for(const t of e.slice(1))i+="/"+encodeURIComponent(`${t.media_content_type},${t.media_content_id}`);return i};class I extends o.WF{render(){return o.qy` <ha-top-app-bar-fixed .narrow="${this.narrow}"> ${this._navigateIds.length>1?o.qy` <ha-icon-button-arrow-prev slot="navigationIcon" @click="${this._goBack}"></ha-icon-button-arrow-prev> `:o.qy` <ha-menu-button slot="navigationIcon" .hass="${this.hass}" .narrow="${this.narrow}"></ha-menu-button> `} <h1 class="page-title" slot="title"> ${this._currentItem?this._currentItem.title:this.hass.localize("ui.components.media-browser.media-player-browser")} </h1> <ha-media-manage-button slot="actionItems" .hass="${this.hass}" .currentItem="${this._currentItem}" @media-refresh="${this._refreshMedia}"></ha-media-manage-button> <ha-dropdown slot="actionItems" @wa-select="${this._handleMenuAction}"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${M}"></ha-icon-button> <ha-dropdown-item value="auto" class="${"auto"===this._preferredLayout?"selected_menu_item":""}"> ${this.hass.localize("ui.components.media-browser.auto")} <ha-svg-icon slot="icon" .path="${C}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="grid" class="${"grid"===this._preferredLayout?"selected_menu_item":""}"> ${this.hass.localize("ui.components.media-browser.grid")} <ha-svg-icon slot="icon" .path="${V}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="list" class="${"list"===this._preferredLayout?"selected_menu_item":""}"> ${this.hass.localize("ui.components.media-browser.list")} <ha-svg-icon slot="icon" .path="${k}"></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> <ha-media-player-browse .hass="${this.hass}" .entityId="${this._entityId}" .navigateIds="${this._navigateIds}" .preferredLayout="${this._preferredLayout}" @media-picked="${this._mediaPicked}" @media-browsed="${this._mediaBrowsed}"></ha-media-player-browse> </ha-top-app-bar-fixed> <ha-bar-media-player .hass="${this.hass}" .entityId="${this._entityId}" .narrow="${this.narrow}" @player-picked="${this._playerPicked}"></ha-bar-media-player> `}_handleMenuAction(t){const e=t.detail.item.value;["auto","grid","list"].includes(e)&&(this._preferredLayout=e)}willUpdate(t){if(super.willUpdate(t),this.hasUpdated||this._entityId===v.H1||this._entityId in this.hass.states||(this._entityId=v.H1),!t.has("route"))return;if(""===this.route.path)return void(0,h.oo)(`/media-browser/${this._entityId}`,{replace:!0});const[e,...i]=this.route.path.substring(1).split("/");if(e!==this._entityId){if(e!==v.H1&&void 0===this.hass.states[e])return(0,h.oo)(`/media-browser/${v.H1}`,{replace:!0}),void(0,b.showAlertDialog)(this,{text:this.hass.localize("ui.panel.media-browser.error.player_not_exist",{name:e})});this._entityId=e}this._navigateIds=[{media_content_type:void 0,media_content_id:void 0},...i.map(t=>{const e=decodeURIComponent(t),i=e.indexOf(",");return{media_content_type:e.substring(0,i),media_content_id:e.substring(i+1)}})],this._currentItem=void 0}_goBack(){(0,h.oo)(H(this._entityId,this._navigateIds.slice(0,-1)))}_mediaBrowsed(t){t.detail.ids!==this._navigateIds?(0,h.oo)(H(this._entityId,t.detail.ids),{replace:t.detail.replace}):this._currentItem=t.detail.current}async _mediaPicked(t){const e=t.detail.item;if(this._entityId!==v.H1){this._player.showResolvingNewMediaPicked();try{await(0,v.ie)(this.hass,this._entityId,e.media_content_id,e.media_content_type)}catch(t){this._player.hideResolvingNewMediaPicked()}return}if((0,m.j4)(e.media_content_id))return void(0,l.r)(this,"hass-more-info",{entityId:(0,m.vc)(e.media_content_id)});let i;this._player.showResolvingNewMediaPicked();try{i=await(0,y.A1)(this.hass,e.media_content_id)}catch(t){return(0,b.showAlertDialog)(this,{title:this.hass.localize("ui.components.media-browser.media_browsing_error"),text:t.message}),void this._player.hideResolvingNewMediaPicked()}i.mime_type.startsWith("audio/")?this._player.playItem(e,i):((0,x.M)(this,{sourceUrl:i.url,sourceType:i.mime_type,title:e.title,can_play:e.can_play}),this._player.hideResolvingNewMediaPicked())}_playerPicked(t){const e=t.detail.entityId;e!==this._entityId&&(0,h.oo)(H(e,this._navigateIds))}_refreshMedia(){this._browser.refresh()}static get styles(){return[f.RF,o.AH`ha-media-manage-button{--mdc-theme-primary:var(--app-header-text-color)}ha-media-player-browse{height:calc(100vh - (100px + var(--header-height,0px) + var(--safe-area-inset-top,0px) + var(--safe-area-inset-bottom,0px)))}.page-title{font-size:inherit;margin:inherit;line-height:inherit}:host([narrow]) ha-media-player-browse{height:calc(100vh - (68px + var(--header-height,0px) + var(--safe-area-inset-top,0px) + var(--safe-area-inset-bottom,0px)))}.selected_menu_item{color:var(--primary-color)}.selected_menu_item ha-svg-icon{color:currentColor}ha-bar-media-player{position:fixed;bottom:var(--safe-area-inset-bottom,0px);width:calc(var(--ha-top-app-bar-width,100%) - var(--safe-area-inset-right,0px))}:host([narrow]) ha-bar-media-player{width:calc(var(--ha-top-app-bar-width,100%) - var(--safe-area-inset-left,0px) - var(--safe-area-inset-right,0px))}`]}constructor(...t){super(...t),this.narrow=!1,this._preferredLayout="auto",this._navigateIds=[{media_content_id:void 0,media_content_type:void 0}],this._entityId=v.H1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],I.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],I.prototype,"narrow",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],I.prototype,"route",void 0),(0,s.Cg)([(0,r.wk)()],I.prototype,"_currentItem",void 0),(0,s.Cg)([(0,r.wk)(),(0,n.I)({key:"mediaBrowserPreferredLayout",state:!0,subscribe:!1})],I.prototype,"_preferredLayout",void 0),(0,s.Cg)([(0,r.wk)(),(0,n.I)({key:"mediaBrowseEntityId",state:!0,subscribe:!1})],I.prototype,"_entityId",void 0),(0,s.Cg)([(0,r.P)("ha-media-player-browse")],I.prototype,"_browser",void 0),(0,s.Cg)([(0,r.P)("ha-bar-media-player")],I.prototype,"_player",void 0),I=(0,s.Cg)([(0,r.EM)("ha-panel-media-browser")],I),a()}catch(t){a(t)}})},75484(t,e,i){i.d(e,{M:()=>s});var a=i(1087);const s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"hui-dialog-web-browser-play-media",dialogImport:()=>i.e(3249).then(i.bind(i,42856)),dialogParams:e})}}};