UNPKG

iobroker.lovelace

Version:

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

1 lines 28.1 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[68507],{81836:function(t,e,i){i.d(e,{d:function(){return a},p:function(){return s}});const a=(t,e,i=1e3)=>t||window.setInterval(e,i),s=t=>{t&&clearInterval(t)}},58274:function(t,e,i){i.d(e,{m:function(){return 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){var e,i;this._lastValue=t,null===(e=(i=this._options).onValueUpdated)||void 0===e||e.call(i,t);const a=this._options.getSlider();a&&(a.value=t)}_showTooltip(){var t;const e=this._options.getSlider();null==e||null===(t=e.showTooltip)||void 0===t||t.call(e)}_hideTooltip(){var t;const e=this._options.getSlider();null==e||null===(t=e.hideTooltip)||void 0===t||t.call(e)}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=>{var e,i;t.stopPropagation();const a=Number(t.target.value);this._dragging=!0,this._updateValue(a),null===(e=(i=this._options).onSetVolumeDebounced)||void 0===e||e.call(i,a)},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}}},28732:function(t,e,i){var a=i(40445),s=i(27686),o=i(7731),n=i(5124),r=i(67576);let l,h,u,d=t=>t;class c extends s.J{renderRipple(){return this.noninteractive?"":super.renderRipple()}static get styles(){return[o.R,(0,n.AH)(l||(l=d`:host{padding-left:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-inline-start:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-right:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px));padding-inline-end:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px))}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:48px}span.material-icons:first-of-type{margin-inline-start:0px!important;margin-inline-end:var(--mdc-list-item-graphic-margin,16px)!important;direction:var(--direction)!important}span.material-icons:last-of-type{margin-inline-start:auto!important;margin-inline-end:0px!important;direction:var(--direction)!important}.mdc-deprecated-list-item__meta{display:var(--mdc-list-item-meta-display);align-items:center;flex-shrink:0}:host([graphic=icon]:not([twoline])) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,20px)!important}:host([multiline-secondary]){height:auto}:host([multiline-secondary]) .mdc-deprecated-list-item__text{padding:8px 0}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text{text-overflow:initial;white-space:normal;overflow:auto;display:inline-block;margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text{margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text::before{display:none}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text::before{display:none}:host([disabled]){color:var(--disabled-text-color)}:host([noninteractive]){pointer-events:unset}`)),"rtl"===document.dir?(0,n.AH)(h||(h=d`span.material-icons:first-of-type,span.material-icons:last-of-type{direction:rtl!important;--direction:rtl}`)):(0,n.AH)(u||(u=d``))]}}c=(0,a.Cg)([(0,r.EM)("ha-list-item")],c)},35046:function(t,e,i){i(62953);var a=i(40445),s=i(5124),o=i(67576);let n,r,l=t=>t;class h extends s.WF{firstUpdated(t){super.firstUpdated(t),this._setupAnimation()}updated(t){super.updated(t),t.has("text")&&this._setupAnimation()}disconnectedCallback(){super.disconnectedCallback(),this._animationFrame&&cancelAnimationFrame(this._animationFrame),this._pauseTimeout&&(clearTimeout(this._pauseTimeout),this._pauseTimeout=void 0)}render(){return(0,s.qy)(n||(n=l` <div class="marquee-container" @mouseenter="${0}" @mouseleave="${0}" @touchstart="${0}" @touchend="${0}"> <span class="marquee-text"><slot></slot></span> </div> `),this._handleMouseEnter,this._handleMouseLeave,this._handleMouseEnter,this._handleMouseLeave)}_setupAnimation(){this._container&&this._textSpan&&(this._position=0,this._direction="left",this._maxOffset=Math.max(0,this._textSpan.offsetWidth-this._container.offsetWidth),this._textSpan.style.transform="translateX(0px)",this._animationFrame&&cancelAnimationFrame(this._animationFrame),this._pauseTimeout&&(clearTimeout(this._pauseTimeout),this._pauseTimeout=void 0),this._animate())}_handleMouseEnter(){this.pauseOnHover&&this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0),this.pauseOnHover&&this._pauseTimeout&&(clearTimeout(this._pauseTimeout),this._pauseTimeout=void 0)}_handleMouseLeave(){!this.pauseOnHover||this._animationFrame||this._pauseTimeout||this._animate()}constructor(...t){super(...t),this.speed=15,this.pauseDuration=1e3,this.pauseOnHover=!1,this._direction="left",this._position=0,this._maxOffset=0,this._animate=()=>{if(!this._container||!this._textSpan)return;const t=this.speed*(1/60);let e=!1;"left"===this._direction?(this._position-=t,this._position<=-this._maxOffset&&(this._position=-this._maxOffset,this._direction="right",e=!0)):(this._position+=t,this._position>=0&&(this._position=0,this._direction="left",e=!0)),this._textSpan.style.transform=`translateX(${this._position}px)`,e?this._pauseTimeout=window.setTimeout(()=>{this._pauseTimeout=void 0,this._animationFrame=requestAnimationFrame(this._animate)},this.pauseDuration):this._animationFrame=requestAnimationFrame(this._animate)}}}h.styles=(0,s.AH)(r||(r=l`:host{display:block;overflow:hidden;width:100%}.marquee-container{width:100%;white-space:nowrap;overflow:hidden;user-select:none;cursor:default}.marquee-text{display:inline-block;vertical-align:middle;will-change:transform;font-size:1em;pointer-events:none}`)),(0,a.Cg)([(0,o.MZ)({type:Number})],h.prototype,"speed",void 0),(0,a.Cg)([(0,o.MZ)({type:Number,attribute:"pause-duration"})],h.prototype,"pauseDuration",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:"pause-on-hover"})],h.prototype,"pauseOnHover",void 0),(0,a.Cg)([(0,o.P)(".marquee-container")],h.prototype,"_container",void 0),(0,a.Cg)([(0,o.P)(".marquee-text")],h.prototype,"_textSpan",void 0),(0,a.Cg)([(0,o.Ls)({passive:!0})],h.prototype,"_handleMouseEnter",null),h=(0,a.Cg)([(0,o.EM)("ha-marquee-text")],h)},36358:function(t,e,i){i.d(e,{g:function(){return s}});i(3362),i(62953);var a=i(1087);const s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"dialog-join-media-players",dialogImport:()=>i.e(59671).then(i.bind(i,93725)),dialogParams:e})}},95287:function(t,e,i){i.d(e,{O:function(){return s}});i(3362),i(62953);var a=i(1087);const s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"dialog-media-player-browse",dialogImport:()=>Promise.all([i.e(39763),i.e(32450),i.e(46095),i.e(7305),i.e(92769),i.e(34995),i.e(3283),i.e(80131),i.e(70183),i.e(56704),i.e(3469),i.e(62574),i.e(26092),i.e(39005),i.e(8851),i.e(91845),i.e(57296),i.e(93152)]).then(i.bind(i,93565)),dialogParams:e})}},70294:function(t,e,i){i.a(t,async function(t,a){try{i.r(e);i(18111),i(20116),i(61701),i(3362),i(62953);var s=i(40445),o=i(5124),n=i(67576),r=i(6412),l=i(63672),h=i(1087),u=i(47129),d=i(82286),c=i(9899),p=i(81836),m=i(58274),_=(i(34296),i(18350)),g=i(29823),v=(i(70947),i(26300)),b=(i(28732),i(35046),i(606)),y=(i(67094),i(34127)),f=i(36358),$=i(95287),V=i(22675),S=i(53072),x=i(29986),O=t([_,g,v,b,y]);[_,g,v,b,y]=O.then?(await O)():O;let w,j,C,M,T,H,k,P,q,A,L,E,D,z,I,U,F,Z,N,X,B,R,W,G,Y,J,K,Q,tt=t=>t;const et="M19,3H5C3.89,3 3,3.89 3,5V9H5V5H19V19H5V15H3V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10.08,15.58L11.5,17L16.5,12L11.5,7L10.08,8.41L12.67,11H3V13H12.67L10.08,15.58Z",it="M12 3V13.55C11.41 13.21 10.73 13 10 13C7.79 13 6 14.79 6 17S7.79 21 10 21 14 19.21 14 17V7H18V3H12Z",at="M12 3V13.55C11.41 13.21 10.73 13 10 13C7.79 13 6 14.79 6 17S7.79 21 10 21 14 19.21 14 17V7H18V3H12Z",st="M4,6H2V20A2,2 0 0,0 4,22H18V20H4V6M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M12,14.5V5.5L18,10L12,14.5Z",ot="M14,10A3,3 0 0,0 11,13A3,3 0 0,0 14,16A3,3 0 0,0 17,13A3,3 0 0,0 14,10M14,18A5,5 0 0,1 9,13A5,5 0 0,1 14,8A5,5 0 0,1 19,13A5,5 0 0,1 14,18M14,2A2,2 0 0,1 16,4A2,2 0 0,1 14,6A2,2 0 0,1 12,4A2,2 0 0,1 14,2M19,0H9A2,2 0 0,0 7,2V18A2,2 0 0,0 9,20H19A2,2 0 0,0 21,18V2A2,2 0 0,0 19,0M5,22H17V24H5A2,2 0 0,1 3,22V4H5",nt="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",rt="M3,9H7L12,4V20L7,15H3V9M14,11H22V13H14V11Z",lt="M12,4L9.91,6.09L12,8.18M4.27,3L3,4.27L7.73,9H3V15H7L12,20V13.27L16.25,17.53C15.58,18.04 14.83,18.46 14,18.7V20.77C15.38,20.45 16.63,19.82 17.68,18.96L19.73,21L21,19.73L12,10.73M19,12C19,12.94 18.8,13.82 18.46,14.64L19.97,16.15C20.62,14.91 21,13.5 21,12C21,7.72 18,4.14 14,3.23V5.29C16.89,6.15 19,8.83 19,12M16.5,12C16.5,10.23 15.5,8.71 14,7.97V10.18L16.45,12.63C16.5,12.43 16.5,12.21 16.5,12Z",ht="M3,9H7L12,4V20L7,15H3V9M14,11H17V8H19V11H22V13H19V16H17V13H14V11Z";class ut extends o.WF{connectedCallback(){super.connectedCallback(),this._syncProgressInterval()}disconnectedCallback(){super.disconnectedCallback(),this._clearProgressInterval()}firstUpdated(t){this._positionSlider&&(this._positionSlider.valueFormatter=t=>this._formatDuration(t))}_formatDuration(t){return(0,S.Xm)(t)}_renderVolumeControl(){if(!this.stateObj)return o.s6;const t=(0,d.$)(this.stateObj,S.vj.VOLUME_MUTE),e=(0,d.$)(this.stateObj,S.vj.VOLUME_SET);return(0,o.qy)(w||(w=tt`${0}`),((0,d.$)(this.stateObj,S.vj.VOLUME_SET)||(0,d.$)(this.stateObj,S.vj.VOLUME_STEP))&&(0,u.a)(this.stateObj)?(0,o.qy)(j||(j=tt` <div class="volume"> ${0} ${0} ${0} </div> `),t?(0,o.qy)(C||(C=tt` <ha-icon-button .path="${0}" .label="${0}" @click="${0}"></ha-icon-button> `),this.stateObj.attributes.is_volume_muted?lt:nt,this.hass.localize("ui.card.media_player."+(this.stateObj.attributes.is_volume_muted?"media_volume_unmute":"media_volume_mute")),this._toggleMute):"",(0,d.$)(this.stateObj,S.vj.VOLUME_STEP)&&!e?(0,o.qy)(M||(M=tt` <ha-icon-button action="volume_down" .path="${0}" .label="${0}" @click="${0}"></ha-icon-button> <ha-icon-button action="volume_up" .path="${0}" .label="${0}" @click="${0}"></ha-icon-button> `),rt,this.hass.localize("ui.card.media_player.media_volume_down"),this._handleClick,ht,this.hass.localize("ui.card.media_player.media_volume_up"),this._handleClick):o.s6,e?(0,o.qy)(T||(T=tt` ${0} <div class="volume-slider-container" @touchstart="${0}" @touchmove="${0}" @touchend="${0}" @touchcancel="${0}" @pointerdown="${0}" @pointerup="${0}" @wheel="${0}"> <ha-slider class="volume-slider" labeled id="input" .value="${0}" .step="${0}" @input="${0}" @change="${0}"></ha-slider> </div> `),t?o.s6:(0,o.qy)(H||(H=tt`<ha-svg-icon .path="${0}"></ha-svg-icon>`),nt),this._handleVolumePointerDown,this._volumeController.handleTouchMove,this._handleVolumePointerUp,this._handleVolumePointerUp,this._handleVolumePointerDown,this._handleVolumePointerUp,this._volumeController.handleWheel,100*Number(this.stateObj.attributes.volume_level),this._volumeStep,this._handleVolumeInput,this._handleVolumeChange):o.s6):o.s6)}_renderSourceControl(){if(!this.stateObj||!(0,d.$)(this.stateObj,S.vj.SELECT_SOURCE))return o.s6;const t=this.stateObj.attributes.source_list||[];return(0,o.qy)(k||(k=tt`<ha-tooltip for="source-button"> ${0} </ha-tooltip> <ha-dropdown @wa-select="${0}"> <ha-icon-button id="source-button" slot="trigger" .label="${0}" .path="${0}"> </ha-icon-button> ${0} </ha-dropdown>`),this.hass.localize("ui.card.media_player.source"),this._handleSourceChange,this.hass.localize("ui.card.media_player.source"),et,t.map(t=>{var e;return(0,o.qy)(P||(P=tt`<ha-dropdown-item .value="${0}" .selected="${0}"> ${0} </ha-dropdown-item>`),t,t===(null===(e=this.stateObj)||void 0===e?void 0:e.attributes.source),this.hass.formatEntityAttributeValue(this.stateObj,"source",t))}))}_renderSoundMode(){var t;return this.stateObj&&(0,d.$)(this.stateObj,S.vj.SELECT_SOUND_MODE)&&null!==(t=this.stateObj.attributes.sound_mode_list)&&void 0!==t&&t.length?(0,o.qy)(q||(q=tt`<ha-tooltip for="sound-mode-button"> ${0} </ha-tooltip> <ha-dropdown @wa-select="${0}"> <ha-icon-button slot="trigger" id="sound-mode-button" .path="${0}" hide-title> </ha-icon-button> ${0} </ha-dropdown>`),this.hass.localize("ui.card.media_player.sound_mode"),this._handleSoundModeChange,at,this.stateObj.attributes.sound_mode_list.map(t=>{var e;return(0,o.qy)(A||(A=tt`<ha-dropdown-item .value="${0}" .selected="${0}"> ${0} </ha-dropdown-item>`),t,t===(null===(e=this.stateObj)||void 0===e?void 0:e.attributes.sound_mode),this.hass.formatEntityAttributeValue(this.stateObj,"sound_mode",t))})):o.s6}_renderGrouping(){if(!this.stateObj||this.stateObj.state===V.Hh||!(0,d.$)(this.stateObj,S.vj.GROUPING))return o.s6;const t=this.stateObj.attributes.group_members,e=t&&(null==t?void 0:t.length)>1;return(0,o.qy)(L||(L=tt`<ha-icon-button @click="${0}" .title="${0}" id="grouping-button"> <div class="grouping"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </div> </ha-icon-button> <ha-tooltip for="grouping-button"> ${0} </ha-tooltip>`),this._showGroupMediaPlayers,this.hass.localize("ui.card.media_player.join"),ot,e?(0,o.qy)(E||(E=tt`<span class="badge">${0}</span>`),(null==t?void 0:t.length)||4):o.s6,this.hass.localize("ui.card.media_player.join"))}_renderEmptyCover(t,e){return(0,o.qy)(D||(D=tt` <div class="cover-container"> <div class="cover-image empty-cover" role="img" aria-label="${0}"> ${0} </div> </div> `),t,e?(0,o.qy)(z||(z=tt`<ha-svg-icon .path="${0}"></ha-svg-icon>`),e):t)}render(){if(!this.stateObj)return o.s6;if(this.stateObj.state===V.Hh)return this._renderEmptyCover(this.hass.formatEntityState(this.stateObj));const t=this.stateObj,e=(0,S.Un)(t,!0),i=t.attributes.entity_picture_local||t.attributes.entity_picture||"",a=i?this.hass.hassUrl(i):"",s=new x.A(this.hass,this.stateObj),n=Math.max(Math.floor(s.currentProgress||0),0),h=Math.max(t.attributes.media_duration||0,0),c=this._formatDuration(n),p=this._formatDuration(h),m=(0,S.HN)(t.attributes.media_title),_=(0,S.mm)(t),g=null==e?void 0:e.find(t=>"turn_on"===t.action),v=null==e?void 0:e.find(t=>"turn_off"===t.action);return(0,o.qy)(I||(I=tt` ${0} ${0} ${0} <div class="bottom-controls"> ${0} ${0} <div class="controls-row"> ${0} ${0} ${0} ${0} ${0} ${0} </div> </div> `),a?(0,o.qy)(U||(U=tt`<div class="cover-container"> <img class="${0}" src="${0}" alt="${0}"> </div>`),(0,r.H)({"cover-image":!0,"cover-image--playing":"playing"===t.state}),a,(0,l.J)(m)):this._renderEmptyCover(this.hass.formatEntityState(this.stateObj),it),m||_?(0,o.qy)(F||(F=tt`<div class="media-info-row"> ${0} ${0} </div>`),m?(0,o.qy)(Z||(Z=tt`<ha-marquee-text class="media-title" speed="30" pause-on-hover> ${0} </ha-marquee-text>`),m):o.s6,_?(0,o.qy)(N||(N=tt`<ha-marquee-text class="media-artist" speed="30" pause-on-hover> ${0} </ha-marquee-text>`),_):o.s6):o.s6,h&&h>0?(0,o.qy)(X||(X=tt` <div class="position-bar"> <ha-slider id="position-slider" min="0" max="${0}" step="1" .value="${0}" aria-label="${0}" @change="${0}" ?disabled="${0}"> <span class="position-time" slot="reference">${0}</span> <span class="position-time" slot="reference">${0}</span> </ha-slider> </div> `),h,n,this.hass.localize("ui.card.media_player.track_position"),this._handleMediaSeekChanged,!(0,u.a)(t)||!(0,d.$)(t,S.vj.SEEK),c,p):o.s6,e&&e.length>0?(0,o.qy)(B||(B=tt`<div class="main-controls"> ${0} ${0} ${0} </div>`),["repeat_set","media_previous_track"].map(t=>{const i=null==e?void 0:e.find(e=>e.action===t);return i?(0,o.qy)(R||(R=tt`<ha-icon-button action="${0}" @click="${0}" .path="${0}" .label="${0}"> </ha-icon-button>`),t,this._handleClick,i.icon,this.hass.localize(`ui.card.media_player.${i.action}`)):(0,o.qy)(W||(W=tt`<span class="spacer"></span>`))}),["media_play_pause","media_pause","media_play","media_stop"].map(t=>{const i=null==e?void 0:e.find(e=>e.action===t);return i?(0,o.qy)(G||(G=tt`<ha-button variant="brand" appearance="filled" size="medium" action="${0}" @click="${0}" class="center-control"> <ha-svg-icon .path="${0}" aria-label="${0}"></ha-svg-icon> </ha-button>`),t,this._handleClick,i.icon,this.hass.localize(`ui.card.media_player.${i.action}`)):o.s6}),["media_next_track","shuffle_set"].map(t=>{const i=null==e?void 0:e.find(e=>e.action===t);return i?(0,o.qy)(Y||(Y=tt`<ha-icon-button action="${0}" @click="${0}" .path="${0}" .label="${0}"> </ha-icon-button>`),t,this._handleClick,i.icon,this.hass.localize(`ui.card.media_player.${i.action}`)):(0,o.qy)(J||(J=tt`<span class="spacer"></span>`))})):o.s6,this._renderVolumeControl(),t.state!==V.Hh&&(0,d.$)(t,S.vj.BROWSE_MEDIA)?this._renderControlButton("browse_media",this.hass.localize("ui.card.media_player.browse_media"),st,this._showBrowseMedia):o.s6,this._renderGrouping(),this._renderSourceControl(),this._renderSoundMode(),g?this._renderControlButton("turn_on",this.hass.localize(`ui.card.media_player.${g.action}`),g.icon,this._handleClick,g.action):o.s6,v?this._renderControlButton("turn_off",this.hass.localize(`ui.card.media_player.${v.action}`),v.icon,this._handleClick,v.action):o.s6)}_renderControlButton(t,e,i,a,s){return(0,o.qy)(K||(K=tt` <ha-icon-button .id="${0}" hide-title action="${0}" @click="${0}" .label="${0}" .path="${0}"> </ha-icon-button> <ha-tooltip for="${0}"> ${0} </ha-tooltip> `),`media-control-row-button-${t}`,(0,l.J)(s),a,e,i,`media-control-row-button-${t}`,e)}_handleClick(t){(0,S.ce)(this.hass,this.stateObj,t.currentTarget.getAttribute("action"))}updated(t){super.updated(t),t.has("stateObj")&&this._syncProgressInterval()}_syncProgressInterval(){this._shouldUpdateProgress()?this._progressInterval=(0,p.d)(this._progressInterval,()=>this.requestUpdate()):this._clearProgressInterval()}_clearProgressInterval(){this._progressInterval=(0,p.p)(this._progressInterval)}_shouldUpdateProgress(){const t=this.stateObj;return!!t&&"playing"===t.state&&Number(t.attributes.media_duration)>0&&"media_position"in t.attributes&&"media_position_updated_at"in t.attributes}_toggleMute(){this.hass.callService("media_player","volume_mute",{entity_id:this.stateObj.entity_id,is_volume_muted:!this.stateObj.attributes.is_volume_muted})}_setVolume(t){this.hass.callService("media_player","volume_set",{entity_id:this.stateObj.entity_id,volume_level:t/100})}_handleSourceChange(t){const e=t.detail.item.value;e&&this.stateObj.attributes.source!==e&&this.hass.callService("media_player","select_source",{entity_id:this.stateObj.entity_id,source:e})}_handleSoundModeChange(t){const e=t.detail.item.value;e&&this.stateObj.attributes.sound_mode!==e&&this.hass.callService("media_player","select_sound_mode",{entity_id:this.stateObj.entity_id,sound_mode:e})}_showBrowseMedia(){(0,$.O)(this,{action:"play",entityId:this.stateObj.entity_id,mediaPickedCallback:t=>(0,S.ie)(this.hass,this.stateObj.entity_id,t.item.media_content_id,t.item.media_content_type)})}_showGroupMediaPlayers(){(0,f.g)(this,{entityId:this.stateObj.entity_id})}async _handleMediaSeekChanged(t){if(!this.stateObj)return;const e=t.target.value;this.hass.callService("media_player","media_seek",{entity_id:this.stateObj.entity_id,seek_position:e})}constructor(...t){super(...t),this._volumeStep=2,this._debouncedVolumeSet=(0,c.s)(t=>{this._setVolume(t)},100),this._volumeController=new m.m({getSlider:()=>this._volumeSlider,step:this._volumeStep,onSetVolume:t=>this._setVolume(t),onSetVolumeDebounced:t=>this._debouncedVolumeSet(t)}),this._handleVolumePointerDown=t=>{"touchstart"===t.type&&this._volumeController.handleTouchStart(t),this._volumeController.isInteracting||(0,h.r)(this,"slider-interaction-start")},this._handleVolumePointerUp=t=>{"touchend"!==t.type&&"touchcancel"!==t.type||this._volumeController.handleTouchEnd(t),setTimeout(()=>{(0,h.r)(this,"slider-interaction-stop")},100)},this._handleVolumeInput=t=>{this._volumeController.handleInput(t)},this._handleVolumeChange=t=>{this._volumeController.handleChange(t)}}}ut.styles=(0,o.AH)(Q||(Q=tt`:host{display:flex;flex-direction:column;gap:var(--ha-space-6);margin-top:0}.cover-container{display:flex;justify-content:center;align-items:center;height:320px;width:100%}.cover-image{width:240px;height:240px;max-width:100%;max-height:100%;object-fit:cover;border-radius:var(--ha-border-radius-sm);box-shadow:0 2px 8px rgba(0,0,0,.15);position:relative;display:flex;align-items:center;justify-content:center;transition:width .3s,height .3s}.cover-image--playing{width:320px;height:320px}@media (max-height:750px){.cover-container{height:120px}.cover-image{width:100px;height:100px}.cover-image--playing{width:120px;height:120px}}.empty-cover{background-color:var(--secondary-background-color);font-size:1.5em;color:var(--secondary-text-color)}.main-controls{display:flex;align-items:center;justify-content:space-between}.center-control{--ha-button-height:56px}.spacer{width:48px}.main-controls,.position-bar,.volume{direction:ltr}.position-bar ha-slider,.volume ha-slider{width:100%}.volume{display:flex;align-items:center;justify-content:center;gap:var(--ha-space-3);padding-inline:var(--ha-space-2)}.volume-slider-container{width:100%}.volume ha-svg-icon{padding:var(--ha-space-1);height:16px;width:16px}.volume ha-icon-button{--ha-icon-button-size:32px;--mdc-icon-size:16px}.badge{position:absolute;top:-10px;left:var(--ha-space-4);display:flex;justify-content:center;align-items:center;height:16px;min-width:var(--ha-space-2);border-radius:var(--ha-border-radius-md);font-weight:var(--ha-font-weight-normal);font-size:var(--ha-font-size-xs);background-color:var(--primary-color);padding:0 var(--ha-space-1);color:var(--text-primary-color)}.position-bar{display:flex;flex-direction:column}.position-bar ha-slider::part(references){color:var(--secondary-text-color)}.position-time{margin-top:var(--ha-space-2)}.media-info-row{display:flex;flex-direction:column;justify-content:space-between;margin:var(--ha-space-2) 0 var(--ha-space-2) var(--ha-space-2)}.media-title{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-bold);margin-bottom:var(--ha-space-1)}.media-artist{font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);color:var(--secondary-text-color)}.controls-row{display:flex;align-items:center;justify-content:space-around}.controls-row ha-icon-button{color:var(--secondary-text-color);background:var(--ha-color-fill-neutral-quiet-resting);border-radius:var(--ha-border-radius-circle)}.controls-row ha-svg-icon{color:var(--ha-color-on-neutral-quiet)}.grouping{position:relative}.bottom-controls{display:flex;flex-direction:column;gap:var(--ha-space-6);align-self:center;width:320px}`)),(0,s.Cg)([(0,n.MZ)({attribute:!1})],ut.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],ut.prototype,"stateObj",void 0),(0,s.Cg)([(0,n.P)("#position-slider")],ut.prototype,"_positionSlider",void 0),(0,s.Cg)([(0,n.P)(".volume-slider")],ut.prototype,"_volumeSlider",void 0),ut=(0,s.Cg)([(0,n.EM)("more-info-media_player")],ut),a()}catch(w){a(w)}})},29986:function(t,e,i){i.d(e,{A:function(){return o}});i(16280);var a=i(82286),s=i(53072);class o{get isOff(){return"off"===this.stateObj.state}get isIdle(){return"idle"===this.stateObj.state}get isMuted(){return this._attr.is_volume_muted}get isPaused(){return"paused"===this.stateObj.state}get isPlaying(){return"playing"===this.stateObj.state}get isMusic(){return"music"===this._attr.media_content_type}get isTVShow(){return"tvshow"===this._attr.media_content_type}get hasMediaControl(){return-1!==["playing","paused","unknown","on"].indexOf(this.stateObj.state)}get volumeSliderValue(){return 100*this._attr.volume_level}get showProgress(){return(this.isPlaying||this.isPaused)&&"media_duration"in this.stateObj.attributes&&"media_position"in this.stateObj.attributes&&"media_position_updated_at"in this.stateObj.attributes}get currentProgress(){let t=this._attr.media_position;return this.isPlaying&&(t+=(Date.now()-new Date(this._attr.media_position_updated_at).getTime())/1e3),t}get supportsPause(){return(0,a.$)(this.stateObj,1)}get supportsVolumeSet(){return(0,a.$)(this.stateObj,4)}get supportsVolumeMute(){return(0,a.$)(this.stateObj,8)}get supportsPreviousTrack(){return(0,a.$)(this.stateObj,16)}get supportsNextTrack(){return(0,a.$)(this.stateObj,32)}get supportsTurnOn(){return(0,a.$)(this.stateObj,128)}get supportsTurnOff(){return(0,a.$)(this.stateObj,256)}get supportsPlayMedia(){return(0,a.$)(this.stateObj,512)}get supportsVolumeButtons(){return(0,a.$)(this.stateObj,1024)}get supportsSelectSource(){return(0,a.$)(this.stateObj,2048)}get supportsSelectSoundMode(){return(0,a.$)(this.stateObj,65536)}get supportsPlay(){return(0,a.$)(this.stateObj,16384)}get primaryTitle(){return(0,s.HN)(this._attr.media_title)}get secondaryTitle(){if(this.isMusic)return this._attr.media_artist;if(this.isTVShow){let t=this._attr.media_series_title;return this._attr.media_season&&(t+=" S"+this._attr.media_season,this._attr.media_episode&&(t+="E"+this._attr.media_episode)),t}return this._attr.app_name?this._attr.app_name:""}get source(){return this._attr.source}get sourceList(){return this._attr.source_list}get soundMode(){return this._attr.sound_mode}get soundModeList(){return this._attr.sound_mode_list}mediaPlayPause(){this.callService("media_play_pause")}nextTrack(){this.callService("media_next_track")}playbackControl(){this.callService("media_play_pause")}previousTrack(){this.callService("media_previous_track")}setVolume(t){this.callService("volume_set",{volume_level:t})}togglePower(){this.isOff?this.turnOn():this.turnOff()}turnOff(){this.callService("turn_off")}turnOn(){this.callService("turn_on")}volumeDown(){this.callService("volume_down")}volumeMute(t){if(!this.supportsVolumeMute)throw new Error("Muting volume not supported");this.callService("volume_mute",{is_volume_muted:t})}volumeUp(){this.callService("volume_up")}selectSource(t){this.callService("select_source",{source:t})}selectSoundMode(t){this.callService("select_sound_mode",{sound_mode:t})}callService(t,e={}){e.entity_id=this.stateObj.entity_id,this.hass.callService("media_player",t,e)}constructor(t,e){this.hass=t,this.stateObj=e,this._attr=e.attributes}}}}]);