@mux/mux-player 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- var et=(e,a,t)=>{if(!a.has(e))throw TypeError("Cannot "+t)};var d=(e,a,t)=>(et(e,a,"read from private field"),t?t.call(e):a.get(e)),h=(e,a,t)=>{if(a.has(e))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(e):a.set(e,t)},A=(e,a,t,i)=>(et(e,a,"write to private field"),i?i.call(e,t):a.set(e,t),t);var p=(e,a,t)=>(et(e,a,"access private method"),t);var ne=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class e extends ne{}globalThis.DocumentFragment=e}var fe=class extends ne{},tt=class extends ne{},ui={get(e){},define(e,a,t){},upgrade(e){},whenDefined(e){return Promise.resolve(fe)}},ve,at=class{constructor(a,t={}){h(this,ve,void 0);A(this,ve,t==null?void 0:t.detail)}get detail(){return d(this,ve)}initCustomEvent(){}};ve=new WeakMap;function ci(e,a){return new fe}var Ft={document:{createElement:ci},DocumentFragment,customElements:ui,CustomEvent:at,EventTarget:ne,HTMLElement:fe,HTMLVideoElement:tt},Yt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",g=Yt?Ft:globalThis,C=Yt?Ft.document:globalThis.document;import{MediaController as gr}from"media-chrome";import fr,{MediaError as gt,Attributes as c}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as Ye,addTextTrack as vr,removeTextTrack as yr}from"@mux/playback-core";import{VideoEvents as ki}from"@mux/mux-video";var hi="en",q={code:hi};var Zt="en";function u(e,a=!0){var r,n;let t=a&&(n=(r=q)==null?void 0:r[e])!=null?n:e,i=a?q.code:Zt;return new it(t,i)}var it=class{constructor(a,t=(i=>(i=q.code)!=null?i:Zt)()){this.message=a,this.locale=t}format(a){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function Wt(e){let a="";return Object.entries(e).forEach(([t,i])=>{i!=null&&(a+=`${bi(t)}: ${i}; `)}),a?a.trim():void 0}function bi(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function zt(e){return e.replace(/[-_]([a-z])/g,(a,t)=>t.toUpperCase())}function V(e){if(e==null)return;let a=+e;return Number.isNaN(a)?void 0:a}function Oe(e){let a=pi(e).toString();return a?"?"+a:""}function pi(e){let a={};for(let t in e)e[t]!=null&&(a[t]=e[t]);return new URLSearchParams(a)}function Z(e){let a=(e!=null?e:"").split(".")[1];if(!a)return{};let t=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var rt=(e,a)=>!e||!a?!1:e.contains(a)?!0:rt(e,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var nt="mux.com",gi=()=>{try{return"1.3.0"}catch{}return"UNKNOWN"},fi=gi(),Ie=()=>fi,ot=(e,{token:a,domain:t=nt}={})=>`https://stream.${t}/${e}.m3u8${Oe(!!a?{token:a}:{redundant_streams:!0})}`,Gt=(e,{token:a,thumbnailTime:t,domain:i=nt}={})=>{let r=a==null?t:void 0,{aud:n}=Z(a);if(!(a&&n!=="t"))return`https://image.${i}/${e}/thumbnail.jpg${Oe({token:a,time:r})}`},Xt=(e,{token:a,domain:t=nt}={})=>{let{aud:i}=Z(a);if(!(a&&i!=="s"))return`https://image.${t}/${e}/storyboard.vtt${Oe({token:a})}`};function st(e){if(e&&/^media-theme-[\w-]+$/.test(e))return e}var vi={crossorigin:"crossOrigin",playsinline:"playsInline"};function Jt(e){var a;return(a=vi[e])!=null?a:zt(e)}var Qt=e=>{var t,i;let{media:a}=e;return(i=(t=a==null?void 0:a._hls)==null?void 0:t.liveSyncPosition)!=null?i:a!=null&&a.seekable.length?a==null?void 0:a.seekable.end(a.seekable.length-1):void 0},lt=e=>{let a=Qt(e);if(a==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}e.currentTime=a},yi=1,Ei=5,qt=3,jt=.5,ea=e=>{var n;let{streamType:a}=e,t=Qt(e),i=(n=e.media)==null?void 0:n.currentTime;if(t==null||i==null)return!1;let r=t-i;return a===Me.LL_LIVE||a===Me.LL_DVR?r<=yi*(qt+jt):a===Me.LIVE||a===Me.DVR?r<=Ei*(qt+jt):!1},j,G,x,Pe=class{constructor(a,t){h(this,j,void 0);h(this,G,void 0);h(this,x,[]);A(this,j,a),A(this,G,t)}[Symbol.iterator](){return d(this,x).values()}get length(){return d(this,x).length}get value(){var a;return(a=d(this,x).join(" "))!=null?a:""}set value(a){var t;a!==this.value&&(A(this,x,[]),this.add(...(t=a==null?void 0:a.split(" "))!=null?t:[]))}toString(){return this.value}item(a){return d(this,x)[a]}values(){return d(this,x).values()}keys(){return d(this,x).keys()}forEach(a){d(this,x).forEach(a)}add(...a){var t,i;a.forEach(r=>{this.contains(r)||d(this,x).push(r)}),!(this.value===""&&!((t=d(this,j))!=null&&t.hasAttribute(`${d(this,G)}`)))&&((i=d(this,j))==null||i.setAttribute(`${d(this,G)}`,`${this.value}`))}remove(...a){var t;a.forEach(i=>{d(this,x).splice(d(this,x).indexOf(i),1)}),(t=d(this,j))==null||t.setAttribute(`${d(this,G)}`,`${this.value}`)}contains(a){return d(this,x).includes(a)}toggle(a,t){return typeof t!="undefined"?t?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,t){this.remove(a),this.add(t)}};j=new WeakMap,G=new WeakMap,x=new WeakMap;var ta=`[mux-player ${Ie()}]`;function X(...e){console.warn(ta,...e)}function O(...e){console.error(ta,...e)}function Re(e){var t;let a=(t=e.message)!=null?t:"";if(e.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${u("Read more: ")}
2
- ${i}${e.file}`}X(a)}var T={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},J={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ia=Object.freeze({length:0,start(e){let a=e>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let a=e>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Ti=ki.filter(e=>e!=="error"),Ai=Object.values(T).filter(e=>![T.PLAYSINLINE].includes(e)),xi=Object.values(J);function ra(e){e.querySelectorAll(":scope > track").forEach(a=>{var t;(t=e.media)==null||t.append(a.cloneNode())}),Ti.forEach(a=>{var t;(t=e.media)==null||t.addEventListener(a,i=>{e.dispatchEvent(new Event(i.type))})})}var dt=class extends g.HTMLElement{static get observedAttributes(){return[...Ai,...xi]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(i=>{var r;(r=this.media)==null||r.append(i.cloneNode())});let a=i=>{for(let r of i)r.type==="childList"&&(r.removedNodes.forEach(n=>{var m,b;let o=(m=this.media)==null?void 0:m.querySelector(`track[src="${n.src}"]`);o&&((b=this.media)==null||b.removeChild(o))}),r.addedNodes.forEach(n=>{var o;(o=this.media)==null||o.append(n.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,t,i){var r,n;switch(a){case J.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case J.VOLUME:{let o=(r=V(i))!=null?r:1;this.media&&(this.media.volume=o);return}case J.PLAYBACKRATE:{let o=(n=V(i))!=null?n:1;this.media&&(this.media.playbackRate=o,this.media.defaultPlaybackRate=o);return}}}play(){var a,t;return(t=(a=this.media)==null?void 0:a.play())!=null?t:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var t;return(t=this.media)==null?void 0:t.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,t;return(t=(a=this.media)==null?void 0:a.paused)!=null?t:!0}get duration(){var a,t;return(t=(a=this.media)==null?void 0:a.duration)!=null?t:NaN}get ended(){var a,t;return(t=(a=this.media)==null?void 0:a.ended)!=null?t:!1}get buffered(){var a,t;return(t=(a=this.media)==null?void 0:a.buffered)!=null?t:ia}get seekable(){var a,t;return(t=(a=this.media)==null?void 0:a.seekable)!=null?t:ia}get readyState(){var a,t;return(t=(a=this.media)==null?void 0:a.readyState)!=null?t:0}get videoWidth(){var a,t;return(t=(a=this.media)==null?void 0:a.videoWidth)!=null?t:0}get videoHeight(){var a,t;return(t=(a=this.media)==null?void 0:a.videoHeight)!=null?t:0}get currentTime(){var a,t;return(t=(a=this.media)==null?void 0:a.currentTime)!=null?t:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,t;return(t=(a=this.media)==null?void 0:a.volume)!=null?t:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,t;return(t=(a=this.media)==null?void 0:a.playbackRate)!=null?t:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=V(this.getAttribute(J.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(J.PLAYBACKRATE,`${a}`):this.removeAttribute(J.PLAYBACKRATE)}get crossOrigin(){return ye(this,T.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(T.CROSSORIGIN,`${a}`)}get autoplay(){return ye(this,T.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(T.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(T.AUTOPLAY)}get loop(){return ye(this,T.LOOP)!=null}set loop(a){a?this.setAttribute(T.LOOP,""):this.removeAttribute(T.LOOP)}get muted(){var a,t;return(t=(a=this.media)==null?void 0:a.muted)!=null?t:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return ye(this,T.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(T.MUTED,""):this.removeAttribute(T.MUTED)}get playsInline(){return ye(this,T.PLAYSINLINE)!=null}set playsInline(a){O("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(T.PRELOAD,a):this.removeAttribute(T.PRELOAD)}};function ye(e,a){return e.media?e.media.getAttribute(a):e.getAttribute(a)}var mt=dt;import{MediaTheme as Qi}from"media-chrome";import{TemplateInstance as la,NodeTemplatePart as De,createProcessor as Li,AttributeTemplatePart as ct}from"@github/template-parts";var Ee=new WeakMap,ke=class{constructor(a,t){this.element=a;this.type=t;this.element.addEventListener(this.type,this);let i=Ee.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let t=Ee.get(this.element);t&&t.delete(this.type)}}static for(a){Ee.has(a.element)||Ee.set(a.element,new Map);let t=a.attributeName.slice(2),i=Ee.get(a.element);return i&&i.has(t)?i.get(t):new ke(a.element,t)}};function wi(e,a){return e instanceof ct&&e.attributeName.startsWith("on")?(ke.for(e).set(a),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),!0):!1}function $i(e,a){return a instanceof Te&&e instanceof De?(a.renderInto(e),!0):!1}function Si(e,a){return a instanceof DocumentFragment&&e instanceof De?(a.childNodes.length&&e.replace(...a.childNodes),!0):!1}function Ci(e,a){if(e instanceof ct){let t=e.attributeNamespace,i=e.element.getAttributeNS(t,e.attributeName);return String(a)!==i&&(e.value=String(a)),!0}return e.value=String(a),!0}function Oi(e,a){if(typeof a=="boolean"&&e instanceof ct){let t=e.attributeNamespace,i=e.element.hasAttributeNS(t,e.attributeName);return a!==i&&(e.booleanValue=a),!0}return!1}function Mi(e,a){return a===!1&&e instanceof De?(e.replace(""),!0):!1}function Pi(e,a){Oi(e,a)||wi(e,a)||Mi(e,a)||$i(e,a)||Si(e,a)||Ci(e,a)}var ut=new WeakMap,na=new WeakMap,oa=new WeakMap,Te=class{constructor(a,t,i){this.strings=a;this.values=t;this.processor=i}get template(){if(ut.has(this.strings))return ut.get(this.strings);{let a=document.createElement("template"),t=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<t?`{{ ${n} }}`:""),""),ut.set(this.strings,a),a}}renderInto(a){let t=this.template;if(na.get(a)!==t){na.set(a,t);let r=new la(t,this.values,this.processor);oa.set(a,r),a instanceof De?a.replace(...r.children):a.appendChild(r);return}let i=oa.get(a);i&&i.update(this.values)}},sa=new Map,Ii=Li(Pi);function l(e,...a){let t=[""],i=[],r,n=!1,o=(m,b=[])=>{t[t.length-1]=t[t.length-1]+m[0],b.forEach((f,v)=>{(r=f==null?void 0:f.$static$)!==void 0?(r.forEach(S=>{o(S.strings,S.values)}),t[t.length-1]=t[t.length-1]+m[v+1],n=!0):(i.push(f),t.push(m[v+1]))})};if(o(e,a),n){let m=t.join("$$html$$");e=sa.get(m),e===void 0&&(t.raw=t,sa.set(m,e=t)),a=i}return new Te(e,a,Ii)}function _e(e,a){e.renderInto(a)}function y(e,a){let t=document.createElement("template");return t.innerHTML=e,new la(t,a)}var ht=(...e)=>({$static$:e.map(a=>a instanceof Te?a:/\w-/.test(a)?{strings:[a]}:{strings:[]})});var ma=`
1
+ var et=(e,a,t)=>{if(!a.has(e))throw TypeError("Cannot "+t)};var d=(e,a,t)=>(et(e,a,"read from private field"),t?t.call(e):a.get(e)),h=(e,a,t)=>{if(a.has(e))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(e):a.set(e,t)},A=(e,a,t,i)=>(et(e,a,"write to private field"),i?i.call(e,t):a.set(e,t),t);var p=(e,a,t)=>(et(e,a,"access private method"),t);var ne=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class e extends ne{}globalThis.DocumentFragment=e}var fe=class extends ne{},tt=class extends ne{},ui={get(e){},define(e,a,t){},upgrade(e){},whenDefined(e){return Promise.resolve(fe)}},ve,at=class{constructor(a,t={}){h(this,ve,void 0);A(this,ve,t==null?void 0:t.detail)}get detail(){return d(this,ve)}initCustomEvent(){}};ve=new WeakMap;function hi(e,a){return new fe}var Ft={document:{createElement:hi},DocumentFragment,customElements:ui,CustomEvent:at,EventTarget:ne,HTMLElement:fe,HTMLVideoElement:tt},Yt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",g=Yt?Ft:globalThis,O=Yt?Ft.document:globalThis.document;import{MediaController as vr}from"media-chrome";import yr,{MediaError as pt,Attributes as m}from"@mux/mux-video";import{StreamTypes as $,PlaybackTypes as Ye,addTextTrack as Er,removeTextTrack as kr,CmcdTypeValues as ai}from"@mux/playback-core";import{VideoEvents as Ti}from"@mux/mux-video";var bi="en",J={code:bi};var Zt="en";function u(e,a=!0){var r,n;let t=a&&(n=(r=J)==null?void 0:r[e])!=null?n:e,i=a?J.code:Zt;return new it(t,i)}var it=class{constructor(a,t=(i=>(i=J.code)!=null?i:Zt)()){this.message=a,this.locale=t}format(a){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function Wt(e){let a="";return Object.entries(e).forEach(([t,i])=>{i!=null&&(a+=`${pi(t)}: ${i}; `)}),a?a.trim():void 0}function pi(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function zt(e){return e.replace(/[-_]([a-z])/g,(a,t)=>t.toUpperCase())}function _(e){if(e==null)return;let a=+e;return Number.isNaN(a)?void 0:a}function Oe(e){let a=gi(e).toString();return a?"?"+a:""}function gi(e){let a={};for(let t in e)e[t]!=null&&(a[t]=e[t]);return new URLSearchParams(a)}function z(e){let a=(e!=null?e:"").split(".")[1];if(!a)return{};let t=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var rt=(e,a)=>!e||!a?!1:e.contains(a)?!0:rt(e,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var nt="mux.com",fi=()=>{try{return"1.4.0"}catch{}return"UNKNOWN"},vi=fi(),Re=()=>vi,ot=(e,{token:a,domain:t=nt}={})=>`https://stream.${t}/${e}.m3u8${Oe(!!a?{token:a}:{redundant_streams:!0})}`,Gt=(e,{token:a,thumbnailTime:t,domain:i=nt}={})=>{let r=a==null?t:void 0,{aud:n}=z(a);if(!(a&&n!=="t"))return`https://image.${i}/${e}/thumbnail.jpg${Oe({token:a,time:r})}`},Xt=(e,{token:a,domain:t=nt}={})=>{let{aud:i}=z(a);if(!(a&&i!=="s"))return`https://image.${t}/${e}/storyboard.vtt${Oe({token:a})}`};function st(e){if(e&&/^media-theme-[\w-]+$/.test(e))return e}var yi={crossorigin:"crossOrigin",playsinline:"playsInline"};function Jt(e){var a;return(a=yi[e])!=null?a:zt(e)}var Qt=e=>{var t,i;let{media:a}=e;return(i=(t=a==null?void 0:a._hls)==null?void 0:t.liveSyncPosition)!=null?i:a!=null&&a.seekable.length?a==null?void 0:a.seekable.end(a.seekable.length-1):void 0},lt=e=>{let a=Qt(e);if(a==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}e.currentTime=a},Ei=1,ki=5,qt=3,jt=.5,ea=e=>{var n;let{streamType:a}=e,t=Qt(e),i=(n=e.media)==null?void 0:n.currentTime;if(t==null||i==null)return!1;let r=t-i;return a===Me.LL_LIVE||a===Me.LL_DVR?r<=Ei*(qt+jt):a===Me.LIVE||a===Me.DVR?r<=ki*(qt+jt):!1},Q,ee,x,Pe=class{constructor(a,t){h(this,Q,void 0);h(this,ee,void 0);h(this,x,[]);A(this,Q,a),A(this,ee,t)}[Symbol.iterator](){return d(this,x).values()}get length(){return d(this,x).length}get value(){var a;return(a=d(this,x).join(" "))!=null?a:""}set value(a){var t;a!==this.value&&(A(this,x,[]),this.add(...(t=a==null?void 0:a.split(" "))!=null?t:[]))}toString(){return this.value}item(a){return d(this,x)[a]}values(){return d(this,x).values()}keys(){return d(this,x).keys()}forEach(a){d(this,x).forEach(a)}add(...a){var t,i;a.forEach(r=>{this.contains(r)||d(this,x).push(r)}),!(this.value===""&&!((t=d(this,Q))!=null&&t.hasAttribute(`${d(this,ee)}`)))&&((i=d(this,Q))==null||i.setAttribute(`${d(this,ee)}`,`${this.value}`))}remove(...a){var t;a.forEach(i=>{d(this,x).splice(d(this,x).indexOf(i),1)}),(t=d(this,Q))==null||t.setAttribute(`${d(this,ee)}`,`${this.value}`)}contains(a){return d(this,x).includes(a)}toggle(a,t){return typeof t!="undefined"?t?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,t){this.remove(a),this.add(t)}};Q=new WeakMap,ee=new WeakMap,x=new WeakMap;var ta=`[mux-player ${Re()}]`;function q(...e){console.warn(ta,...e)}function M(...e){console.error(ta,...e)}function Ie(e){var t;let a=(t=e.message)!=null?t:"";if(e.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${u("Read more: ")}
2
+ ${i}${e.file}`}q(a)}var T={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},te={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ia=Object.freeze({length:0,start(e){let a=e>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let a=e>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Ai=Ti.filter(e=>e!=="error"),xi=Object.values(T).filter(e=>![T.PLAYSINLINE].includes(e)),wi=Object.values(te);function ra(e){e.querySelectorAll(":scope > track").forEach(a=>{var t;(t=e.media)==null||t.append(a.cloneNode())}),Ai.forEach(a=>{var t;(t=e.media)==null||t.addEventListener(a,i=>{e.dispatchEvent(new Event(i.type))})})}var dt=class extends g.HTMLElement{static get observedAttributes(){return[...xi,...wi]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(i=>{var r;(r=this.media)==null||r.append(i.cloneNode())});let a=i=>{for(let r of i)r.type==="childList"&&(r.removedNodes.forEach(n=>{var c,b;let o=(c=this.media)==null?void 0:c.querySelector(`track[src="${n.src}"]`);o&&((b=this.media)==null||b.removeChild(o))}),r.addedNodes.forEach(n=>{var o;(o=this.media)==null||o.append(n.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,t,i){var r,n;switch(a){case te.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case te.VOLUME:{let o=(r=_(i))!=null?r:1;this.media&&(this.media.volume=o);return}case te.PLAYBACKRATE:{let o=(n=_(i))!=null?n:1;this.media&&(this.media.playbackRate=o,this.media.defaultPlaybackRate=o);return}}}play(){var a,t;return(t=(a=this.media)==null?void 0:a.play())!=null?t:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var t;return(t=this.media)==null?void 0:t.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,t;return(t=(a=this.media)==null?void 0:a.paused)!=null?t:!0}get duration(){var a,t;return(t=(a=this.media)==null?void 0:a.duration)!=null?t:NaN}get ended(){var a,t;return(t=(a=this.media)==null?void 0:a.ended)!=null?t:!1}get buffered(){var a,t;return(t=(a=this.media)==null?void 0:a.buffered)!=null?t:ia}get seekable(){var a,t;return(t=(a=this.media)==null?void 0:a.seekable)!=null?t:ia}get readyState(){var a,t;return(t=(a=this.media)==null?void 0:a.readyState)!=null?t:0}get videoWidth(){var a,t;return(t=(a=this.media)==null?void 0:a.videoWidth)!=null?t:0}get videoHeight(){var a,t;return(t=(a=this.media)==null?void 0:a.videoHeight)!=null?t:0}get currentTime(){var a,t;return(t=(a=this.media)==null?void 0:a.currentTime)!=null?t:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,t;return(t=(a=this.media)==null?void 0:a.volume)!=null?t:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,t;return(t=(a=this.media)==null?void 0:a.playbackRate)!=null?t:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=_(this.getAttribute(te.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(te.PLAYBACKRATE,`${a}`):this.removeAttribute(te.PLAYBACKRATE)}get crossOrigin(){return ye(this,T.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(T.CROSSORIGIN,`${a}`)}get autoplay(){return ye(this,T.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(T.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(T.AUTOPLAY)}get loop(){return ye(this,T.LOOP)!=null}set loop(a){a?this.setAttribute(T.LOOP,""):this.removeAttribute(T.LOOP)}get muted(){var a,t;return(t=(a=this.media)==null?void 0:a.muted)!=null?t:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return ye(this,T.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(T.MUTED,""):this.removeAttribute(T.MUTED)}get playsInline(){return ye(this,T.PLAYSINLINE)!=null}set playsInline(a){M("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(T.PRELOAD,a):this.removeAttribute(T.PRELOAD)}};function ye(e,a){return e.media?e.media.getAttribute(a):e.getAttribute(a)}var mt=dt;import{MediaTheme as er}from"media-chrome";import{TemplateInstance as la,NodeTemplatePart as De,createProcessor as Li,AttributeTemplatePart as ut}from"@github/template-parts";var Ee=new WeakMap,ke=class{constructor(a,t){this.element=a;this.type=t;this.element.addEventListener(this.type,this);let i=Ee.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let t=Ee.get(this.element);t&&t.delete(this.type)}}static for(a){Ee.has(a.element)||Ee.set(a.element,new Map);let t=a.attributeName.slice(2),i=Ee.get(a.element);return i&&i.has(t)?i.get(t):new ke(a.element,t)}};function $i(e,a){return e instanceof ut&&e.attributeName.startsWith("on")?(ke.for(e).set(a),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),!0):!1}function Ci(e,a){return a instanceof Te&&e instanceof De?(a.renderInto(e),!0):!1}function Si(e,a){return a instanceof DocumentFragment&&e instanceof De?(a.childNodes.length&&e.replace(...a.childNodes),!0):!1}function Oi(e,a){if(e instanceof ut){let t=e.attributeNamespace,i=e.element.getAttributeNS(t,e.attributeName);return String(a)!==i&&(e.value=String(a)),!0}return e.value=String(a),!0}function Mi(e,a){if(typeof a=="boolean"&&e instanceof ut){let t=e.attributeNamespace,i=e.element.hasAttributeNS(t,e.attributeName);return a!==i&&(e.booleanValue=a),!0}return!1}function Pi(e,a){return a===!1&&e instanceof De?(e.replace(""),!0):!1}function Ri(e,a){Mi(e,a)||$i(e,a)||Pi(e,a)||Ci(e,a)||Si(e,a)||Oi(e,a)}var ct=new WeakMap,na=new WeakMap,oa=new WeakMap,Te=class{constructor(a,t,i){this.strings=a;this.values=t;this.processor=i}get template(){if(ct.has(this.strings))return ct.get(this.strings);{let a=document.createElement("template"),t=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<t?`{{ ${n} }}`:""),""),ct.set(this.strings,a),a}}renderInto(a){let t=this.template;if(na.get(a)!==t){na.set(a,t);let r=new la(t,this.values,this.processor);oa.set(a,r),a instanceof De?a.replace(...r.children):a.appendChild(r);return}let i=oa.get(a);i&&i.update(this.values)}},sa=new Map,Ii=Li(Ri);function s(e,...a){let t=[""],i=[],r,n=!1,o=(c,b=[])=>{t[t.length-1]=t[t.length-1]+c[0],b.forEach((f,v)=>{(r=f==null?void 0:f.$static$)!==void 0?(r.forEach(S=>{o(S.strings,S.values)}),t[t.length-1]=t[t.length-1]+c[v+1],n=!0):(i.push(f),t.push(c[v+1]))})};if(o(e,a),n){let c=t.join("$$html$$");e=sa.get(c),e===void 0&&(t.raw=t,sa.set(c,e=t)),a=i}return new Te(e,a,Ii)}function _e(e,a){e.renderInto(a)}function y(e,a){let t=document.createElement("template");return t.innerHTML=e,new la(t,a)}var ht=(...e)=>({$static$:e.map(a=>a instanceof Te?a:/\w-/.test(a)?{strings:[a]}:{strings:[]})});var ma=`
3
3
  :host {
4
4
  cursor: pointer;
5
5
  }
6
6
  media-time-display {
7
7
  color: inherit;
8
8
  }
9
- `,ua=C.createElement("template");ua.innerHTML=`
9
+ `,ca=O.createElement("template");ca.innerHTML=`
10
10
  <style>
11
11
  ${ma}
12
12
  </style>
13
13
  <media-time-display show-duration></media-time-display>
14
- `;var da=["Enter"," "],Ae,se,Ne,oe=class extends g.HTMLElement{constructor(){var t,i;super();h(this,se);h(this,Ae,void 0);this.attachShadow({mode:"open"}),(t=this.shadowRoot)==null||t.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(i=this.shadowRoot)==null?void 0:i.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var t,i,r;(t=this.timeDisplayEl)!=null&&t.hasAttribute("remaining")?(i=this.timeDisplayEl)==null||i.removeAttribute("remaining"):(r=this.timeDisplayEl)==null||r.setAttribute("remaining","")}connectedCallback(){let t=i=>{let{key:r}=i;if(!da.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",i=>{let{metaKey:r,altKey:n,key:o}=i;if(r||n||!da.includes(o)){this.removeEventListener("keyup",t);return}this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),A(this,Ae,setInterval(p(this,se,Ne).bind(this),200)),requestAnimationFrame(()=>p(this,se,Ne).call(this))}disconnectedCallback(){clearInterval(d(this,Ae))}attributeChangedCallback(t,i,r){var n,o;t==="hide-duration"&&p(this,se,Ne).call(this),["remaining","disabled","aria-disabled"].includes(t)&&i!==r&&(r==null?(n=this.timeDisplayEl)==null||n.removeAttribute(t):(o=this.timeDisplayEl)==null||o.setAttribute(t,r))}};Ae=new WeakMap,se=new WeakSet,Ne=function(){var i,r,n,o;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(i=this.timeDisplayEl)!=null&&i.hasAttribute("show-duration")&&((r=this.timeDisplayEl)==null||r.removeAttribute("show-duration")):(n=this.timeDisplayEl)!=null&&n.hasAttribute("show-duration")||(o=this.timeDisplayEl)==null||o.setAttribute("show-duration","")},oe.styles=ma,oe.template=ua;g.customElements.get("mxp-time-display")||(g.customElements.define("mxp-time-display",oe),g.MxpTimeDisplay=oe);var ca=`:host(:not([audio])) {
14
+ `;var da=["Enter"," "],Ae,se,Ne,oe=class extends g.HTMLElement{constructor(){var t,i;super();h(this,se);h(this,Ae,void 0);this.attachShadow({mode:"open"}),(t=this.shadowRoot)==null||t.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(i=this.shadowRoot)==null?void 0:i.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var t,i,r;(t=this.timeDisplayEl)!=null&&t.hasAttribute("remaining")?(i=this.timeDisplayEl)==null||i.removeAttribute("remaining"):(r=this.timeDisplayEl)==null||r.setAttribute("remaining","")}connectedCallback(){let t=i=>{let{key:r}=i;if(!da.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",i=>{let{metaKey:r,altKey:n,key:o}=i;if(r||n||!da.includes(o)){this.removeEventListener("keyup",t);return}this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),A(this,Ae,setInterval(p(this,se,Ne).bind(this),200)),requestAnimationFrame(()=>p(this,se,Ne).call(this))}disconnectedCallback(){clearInterval(d(this,Ae))}attributeChangedCallback(t,i,r){var n,o;t==="hide-duration"&&p(this,se,Ne).call(this),["remaining","disabled","aria-disabled"].includes(t)&&i!==r&&(r==null?(n=this.timeDisplayEl)==null||n.removeAttribute(t):(o=this.timeDisplayEl)==null||o.setAttribute(t,r))}};Ae=new WeakMap,se=new WeakSet,Ne=function(){var i,r,n,o;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(i=this.timeDisplayEl)!=null&&i.hasAttribute("show-duration")&&((r=this.timeDisplayEl)==null||r.removeAttribute("show-duration")):(n=this.timeDisplayEl)!=null&&n.hasAttribute("show-duration")||(o=this.timeDisplayEl)==null||o.setAttribute("show-duration","")},oe.styles=ma,oe.template=ca;g.customElements.get("mxp-time-display")||(g.customElements.define("mxp-time-display",oe),g.MxpTimeDisplay=oe);var ua=`:host(:not([audio])) {
15
15
  --secondary-color: transparent;
16
16
  }
17
17
 
@@ -111,57 +111,87 @@ media-controller {
111
111
 
112
112
  :host media-time-range {
113
113
  color: var(--_primary-color);
114
+ --media-range-thumb-opacity: 0;
114
115
  }
115
116
 
116
117
  :host(:not([audio])) media-time-range {
117
118
  --media-range-padding-left: var(--mux-time-range-padding, 10px);
118
119
  --media-range-padding-right: var(--mux-time-range-padding, 10px);
119
- width: 100%;
120
+ --media-range-padding: 0;
120
121
  z-index: 10;
121
122
  height: 10px;
122
- bottom: -2px;
123
+ bottom: -3px;
123
124
  background: linear-gradient(
124
125
  180deg,
125
126
  transparent,
126
127
  transparent 3px,
127
- var(--media-control-background) 3px,
128
- var(--media-control-background) 8px,
129
- transparent 8px,
128
+ var(--media-control-background, rgba(20, 20, 30, 0.7)) 3px,
129
+ var(--media-control-background, rgba(20, 20, 30, 0.7)) 7px,
130
+ transparent 7px,
130
131
  transparent
131
132
  );
133
+ width: 100%;
134
+ }
135
+
136
+ media-control-bar {
137
+ --media-control-padding: 9px 7px;
138
+ }
139
+
140
+ .size-small media-control-bar {
141
+ --media-control-padding: 9px 5px;
142
+ }
143
+
144
+ .size-extra-small media-control-bar {
145
+ --media-control-padding: 4px 3px;
132
146
  }
133
147
 
134
148
  media-control-bar :is([role='button'], [role='switch'], button) {
135
149
  line-height: 0;
136
- --media-control-padding: 10px 7px;
137
150
  }
138
151
 
139
- .size-extra-small media-control-bar [role='button'],
140
- .size-extra-small media-control-bar [role='switch'] {
141
- height: auto;
142
- padding: 4.4% 3.2%;
152
+ media-control-bar :is(media-text-display, mxp-time-display):first-child {
153
+ --media-control-padding: 9px 5px 9px 10px;
143
154
  }
144
155
 
145
156
  .spacer {
146
157
  flex-grow: 1;
147
- height: 100%;
148
158
  background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
149
159
  }
150
160
 
151
161
  /* Add a small space on the right to have the play button and
152
162
  * fullscreen button aligned in relation to the progress bar. */
153
- .size-large .padding-2 {
163
+ media-control-bar:not([slot])::after {
164
+ content: '';
154
165
  width: 2px;
155
166
  height: 100%;
156
167
  background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
157
168
  }
158
169
 
170
+ media-control-bar[slot='top-chrome'] {
171
+ min-height: 42px;
172
+ pointer-events: none;
173
+ }
174
+
175
+ :host([title]) media-control-bar[slot='top-chrome']::before {
176
+ content: '';
177
+ position: absolute;
178
+ width: 100%;
179
+ padding-bottom: min(160px, 25%);
180
+ background: linear-gradient(rgb(0 0 0 / 0.4), transparent);
181
+ }
182
+
183
+ media-control-bar[slot='top-chrome'] > * {
184
+ --media-control-background: transparent;
185
+ --media-control-hover-background: transparent;
186
+ position: relative;
187
+ }
188
+
159
189
  media-controller::part(vertical-layer) {
160
190
  transition: background-color 1s;
161
191
  }
162
192
 
163
193
  media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
164
- background-color: var(--controls-backdrop-color, var(--controls, rgba(0, 0, 0, 0.6)));
194
+ background-color: var(--controls-backdrop-color, var(--controls, transparent));
165
195
  transition: background-color 0.25s;
166
196
  }
167
197
 
@@ -174,13 +204,18 @@ media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer)
174
204
  flex-flow: row;
175
205
  align-items: center;
176
206
  justify-content: center;
207
+ filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));
208
+ paint-order: stroke;
209
+ stroke: rgba(102, 102, 102, 1);
210
+ stroke-width: 0.3px;
211
+ text-shadow: 0 0 2px rgb(0 0 0 / 0.25), 0 0 6px rgb(0 0 0 / 0.25);
177
212
  }
178
213
 
179
214
  .center-controls media-play-button {
180
215
  --media-control-background: transparent;
181
216
  --media-control-hover-background: transparent;
182
217
  padding: 0;
183
- width: max(30px, min(11%, 100px));
218
+ width: max(43px, min(10%, 55px));
184
219
  }
185
220
 
186
221
  .center-controls media-seek-backward-button,
@@ -188,8 +223,16 @@ media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer)
188
223
  --media-control-background: transparent;
189
224
  --media-control-hover-background: transparent;
190
225
  padding: 0;
191
- margin: 0 4%;
192
- width: min(7%, 70px);
226
+ margin: 0 2%;
227
+ width: max(33px, min(8%, 40px));
228
+ }
229
+
230
+ media-control-bar:not([slot]) media-seek-backward-button {
231
+ padding-right: 5px;
232
+ }
233
+
234
+ media-control-bar:not([slot]) media-seek-forward-button {
235
+ padding-left: 5px;
193
236
  }
194
237
 
195
238
  media-loading-indicator {
@@ -231,6 +274,7 @@ media-time-display {
231
274
 
232
275
  .title-display {
233
276
  font-size: 16px;
277
+ text-shadow: 0 0 2px rgb(0 0 0 / 0.6);
234
278
  }
235
279
 
236
280
  :host([audio]) .title-display {
@@ -286,7 +330,7 @@ media-time-display {
286
330
  {{value}}
287
331
  </text>
288
332
  </svg>
289
- `;var La=`<svg aria-hidden="true" viewBox="0 0 22 24" slot="forward">
333
+ `;var wa=`<svg aria-hidden="true" viewBox="0 0 22 24" slot="forward">
290
334
  <path d="M11 6V3l5.61 4L11 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 11 6Z"/>
291
335
  <text
292
336
  class="value"
@@ -296,21 +340,21 @@ media-time-display {
296
340
  {{value}}
297
341
  </text>
298
342
  </svg>
299
- `;var wa=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="high">
343
+ `;var La=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="high">
300
344
  <path d="m11.14 4.86-4 4a.49.49 0 0 1-.35.14H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V5.21a.5.5 0 0 0-.86-.35Zm2.74-1.56v1.52A7.52 7.52 0 0 1 19.47 12a7.52 7.52 0 0 1-5.59 7.18v1.52A9 9 0 0 0 21 12a9 9 0 0 0-7.12-8.7Zm3.56 8.7a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66a5.49 5.49 0 0 0 3.56-5.1Z"/>
301
345
  </svg>
302
346
  `;var $a=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="low">
303
347
  <path d="m11.14 4.853-4 4a.49.49 0 0 1-.35.14H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V5.203a.5.5 0 0 0-.86-.35Zm6.3 7.14a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66a5.49 5.49 0 0 0 3.56-5.1Z"/>
304
348
  </svg>
305
- `;var Sa=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="medium">
349
+ `;var Ca=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="medium">
306
350
  <path d="m11.14 4.853-4 4a.49.49 0 0 1-.35.14H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V5.203a.5.5 0 0 0-.86-.35Zm6.3 7.14a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66a5.49 5.49 0 0 0 3.56-5.1Z"/>
307
351
  </svg>
308
- `;var Ca=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="off">
352
+ `;var Sa=`<svg aria-hidden="true" viewBox="0 0 24 24" slot="off">
309
353
  <path d="m3 4.05 4.48 4.47-.33.33a.49.49 0 0 1-.36.15H3.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.48.48 0 0 0 .36.15.5.5 0 0 0 .5-.5v-5.75l4.67 4.66a7.71 7.71 0 0 1-2.79 1.47v1.52a9.32 9.32 0 0 0 3.87-1.91L20 21l1-1L4.06 3 3 4.05Zm5.36 5.36 2.39 2.39V17L8 14.26a1.74 1.74 0 0 0-1.24-.51H4.25v-3.5h2.54A1.74 1.74 0 0 0 8 9.74l.36-.33ZM19.47 12a7.19 7.19 0 0 1-.89 3.47l1.11 1.1A8.64 8.64 0 0 0 21 12a9 9 0 0 0-7.12-8.7v1.52A7.52 7.52 0 0 1 19.47 12ZM12 8.88V5.21a.5.5 0 0 0-.5-.5.48.48 0 0 0-.36.15L9.56 6.44 12 8.88ZM15.91 12a4.284 4.284 0 0 1-.07.72l1.22 1.22a5.2 5.2 0 0 0 .38-1.94 5.49 5.49 0 0 0-3.56-5.1v1.66A4 4 0 0 1 15.91 12Z"/>
310
354
  </svg>
311
- `;var Oa=()=>y(ha),Ma=()=>y(ba),Pa=()=>y(pa),Ia=()=>y(ga),Ra=()=>y(fa),Da=()=>y(va),_a=()=>y(ya),Na=()=>y(Ea),Va=()=>y(ka),Ha=()=>y(Ta),Ba=()=>y(Aa),Ka=e=>y(xa,e),Ua=e=>y(La,e),Fa=()=>y(wa),Ya=()=>y($a),Za=()=>y(Sa),Wa=()=>y(Ca);import{StreamTypes as L}from"@mux/playback-core";var H={LG:"large",SM:"small",XS:"extra-small"},He,za,Ve=class extends Qi{constructor(){super();h(this,He);p(this,He,za).call(this)}static get observedAttributes(){return["audio","has-open-dialog","has-src","nohotkeys","hotkeys","stream-type","player-size","default-hidden-captions","forward-seek-offset","backward-seek-offset","playbackrates","default-show-remaining-time","poster","placeholder","title"]}attributeChangedCallback(){this.render()}render(){var i,r,n;let t={hasSrc:this.hasAttribute("has-src"),isDialogOpen:this.hasAttribute("has-open-dialog"),audio:this.hasAttribute("audio"),nohotkeys:this.hasAttribute("nohotkeys"),hotkeys:this.getAttribute("hotkeys"),streamType:this.getAttribute("stream-type"),playerSize:this.getAttribute("player-size"),defaultHiddenCaptions:this.hasAttribute("default-hidden-captions"),forwardSeekOffset:this.getAttribute("forward-seek-offset"),backwardSeekOffset:this.getAttribute("backward-seek-offset"),playbackRates:this.getAttribute("playbackrates"),defaultShowRemainingTime:this.hasAttribute("default-show-remaining-time"),poster:this.getAttribute("poster"),placeholder:this.getAttribute("placeholder"),title:this.getAttribute("title")};t.nohotkeys=t.nohotkeys||!t.hasSrc||t.isDialogOpen,[L.LIVE,L.LL_LIVE,L.DVR,L.LL_DVR].includes(t.streamType)&&(t.hotkeys=t.hotkeys||"",t.hotkeys+=" noarrowleft noarrowright"),_e(l`
355
+ `;var Oa=()=>y(ha),Ma=()=>y(ba),Pa=()=>y(pa),Ra=()=>y(ga),Ia=()=>y(fa),Da=()=>y(va),_a=()=>y(ya),Na=()=>y(Ea),Va=()=>y(ka),Ha=()=>y(Ta),Ba=()=>y(Aa),Ka=e=>y(xa,e),Ua=e=>y(wa,e),Fa=()=>y(La),Ya=()=>y($a),Za=()=>y(Ca),Wa=()=>y(Sa);import{StreamTypes as L}from"@mux/playback-core";var N={LG:"large",SM:"small",XS:"extra-small"},He,za,Ve=class extends er{constructor(){super();h(this,He);p(this,He,za).call(this)}static get observedAttributes(){return["audio","has-open-dialog","has-src","nohotkeys","hotkeys","stream-type","player-size","default-hidden-captions","forward-seek-offset","backward-seek-offset","playbackrates","default-show-remaining-time","poster","placeholder","title"]}attributeChangedCallback(){this.render()}render(){var i,r,n;let t={hasSrc:this.hasAttribute("has-src"),isDialogOpen:this.hasAttribute("has-open-dialog"),audio:this.hasAttribute("audio"),nohotkeys:this.hasAttribute("nohotkeys"),hotkeys:this.getAttribute("hotkeys"),streamType:this.getAttribute("stream-type"),playerSize:this.getAttribute("player-size"),defaultHiddenCaptions:this.hasAttribute("default-hidden-captions"),forwardSeekOffset:this.getAttribute("forward-seek-offset"),backwardSeekOffset:this.getAttribute("backward-seek-offset"),playbackRates:this.getAttribute("playbackrates"),defaultShowRemainingTime:this.hasAttribute("default-show-remaining-time"),poster:this.getAttribute("poster"),placeholder:this.getAttribute("placeholder"),title:this.getAttribute("title")};t.nohotkeys=t.nohotkeys||!t.hasSrc||t.isDialogOpen,[L.LIVE,L.LL_LIVE,L.DVR,L.LL_DVR].includes(t.streamType)&&(t.hotkeys=t.hotkeys||"",t.hotkeys+=" noarrowleft noarrowright"),_e(s`
312
356
  <style>
313
- ${ca}
357
+ ${ua}
314
358
  </style>
315
359
  <media-controller
316
360
  gestures-disabled="${!t.hasSrc||t.isDialogOpen}"
@@ -328,238 +372,249 @@ media-time-display {
328
372
  placeholder-src="${(r=t.placeholder)!=null?r:!1}"
329
373
  ></media-poster-image>
330
374
  <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
331
- ${er(t)}
375
+ ${tr(t)}
332
376
  <slot></slot>
333
377
  </media-controller>
334
- `,this.shadowRoot),(n=this.shadowRoot)==null||n.querySelectorAll("*").forEach(o=>{if(!o.localName.includes("-"))return;let m=o.localName.match(/^([^-]+)-(.*)-(button|range|display)$/);if(!m)return;let[,,b,f]=m;b==="text"&&o.classList.contains("title-display")&&(b="title");let v=o.closest('[slot="top-chrome"]')?"top":o.closest('[slot="centered-chrome"]')?"center":"bottom";o.setAttribute("part",`${v} ${b} ${f}`)})}};He=new WeakSet,za=function(){var t,i;try{(t=window==null?void 0:window.CSS)==null||t.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}};g.customElements.get("media-theme-mux")||g.customElements.define("media-theme-mux",Ve);var er=e=>{let{streamType:a,playerSize:t,audio:i}=e;if(i)switch(a){case L.LIVE:case L.LL_LIVE:return ir(e);case L.DVR:case L.LL_DVR:return ar(e);case L.ON_DEMAND:default:return tr(e)}switch(a){case L.LIVE:case L.LL_LIVE:switch(t){case H.LG:return lr(e);case H.SM:return sr(e);case H.XS:return or(e)}case L.DVR:case L.LL_DVR:switch(t){case H.LG:return ur(e);case H.SM:return mr(e);case H.XS:return dr(e)}case L.ON_DEMAND:default:switch(t){case H.LG:return nr(e);case H.SM:return rr(e);case H.XS:return bt(e)}}},$=e=>l`
378
+ `,this.shadowRoot),(n=this.shadowRoot)==null||n.querySelectorAll("*").forEach(o=>{if(!o.localName.includes("-"))return;let c=o.localName.match(/^([^-]+)-(.*)-(button|range|display)$/);if(!c)return;let[,,b,f]=c;b==="text"&&o.classList.contains("title-display")&&(b="title");let v=o.closest('[slot="top-chrome"]')?"top":o.closest('[slot="centered-chrome"]')?"center":"bottom";o.setAttribute("part",`${v} ${b} ${f}`)})}};He=new WeakSet,za=function(){var t,i;try{(t=window==null?void 0:window.CSS)==null||t.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}};g.customElements.get("media-theme-mux")||g.customElements.define("media-theme-mux",Ve);var tr=e=>{let{streamType:a,playerSize:t,audio:i}=e;if(i)switch(a){case L.LIVE:case L.LL_LIVE:return rr(e);case L.DVR:case L.LL_DVR:return ir(e);case L.ON_DEMAND:default:return ar(e)}switch(a){case L.LIVE:case L.LL_LIVE:switch(t){case N.LG:return mr(e);case N.SM:return dr(e);case N.XS:return lr(e)}case L.DVR:case L.LL_DVR:switch(t){case N.LG:return hr(e);case N.SM:return ur(e);case N.XS:return cr(e)}case L.ON_DEMAND:default:switch(t){case N.LG:return sr(e);case N.SM:return or(e);case N.XS:return nr(e)}}},w=e=>s`
335
379
  <media-play-button disabled="${!e.hasSrc||e.isDialogOpen}" aria-disabled="${!e.hasSrc||e.isDialogOpen&&"true"}">
336
380
  ${Ba()}
337
381
  ${Na()}
338
- </media-play-button>`,le=({backwardSeekOffset:e,hasSrc:a,isDialogOpen:t})=>l`
382
+ </media-play-button>`,le=({backwardSeekOffset:e,hasSrc:a,isDialogOpen:t})=>s`
339
383
  <media-seek-backward-button seek-offset="${e}" disabled="${!a||t}" aria-disabled="${!a||t&&"true"}">
340
384
  ${Ka({value:e})}
341
- </media-seek-backward-button>`,de=({forwardSeekOffset:e,hasSrc:a,isDialogOpen:t})=>l`
385
+ </media-seek-backward-button>`,de=({forwardSeekOffset:e,hasSrc:a,isDialogOpen:t})=>s`
342
386
  <media-seek-forward-button seek-offset="${e}" disabled="${!a||t}" aria-disabled="${!a||t&&"true"}">
343
387
  ${Ua({value:e})}
344
- </media-seek-forward-button>`,M=({isDialogOpen:e})=>l`
388
+ </media-seek-forward-button>`,C=({isDialogOpen:e})=>s`
345
389
  <media-mute-button disabled="${e}" aria-disabled="${e&&"true"}">
346
390
  ${Fa()}
347
391
  ${Za()}
348
392
  ${Ya()}
349
393
  ${Wa()}
350
- </media-mute-button>`,Q=({defaultHiddenCaptions:e,isDialogOpen:a})=>l`
394
+ </media-mute-button>`,V=({defaultHiddenCaptions:e,isDialogOpen:a})=>s`
351
395
  <media-captions-button default-showing="${!e}" disabled="${a}" aria-disabled="${a&&"true"}">
352
396
  ${Ma()}
353
397
  ${Pa()}
354
- </media-captions-button>`,P=e=>l`
398
+ </media-captions-button>`,H=e=>s`
355
399
  <media-airplay-button disabled="${!e.hasSrc||e.isDialogOpen}" aria-disabled="${!e.hasSrc||e.isDialogOpen&&"true"}">
356
400
  ${Oa()}
357
- </media-airplay-button>`,ee=e=>l`
401
+ </media-airplay-button>`,me=e=>s`
358
402
  <media-pip-button disabled="${!e.hasSrc||e.isDialogOpen}" aria-disabled="${!e.hasSrc||e.isDialogOpen&&"true"}">
359
403
  ${Va()}
360
404
  ${Ha()}
361
- </media-pip-button>`,te=e=>l`
405
+ </media-pip-button>`,B=e=>s`
362
406
  <media-fullscreen-button disabled="${!e.hasSrc||e.isDialogOpen}" aria-disabled="${!e.hasSrc||e.isDialogOpen&&"true"}">
363
407
  ${Da()}
364
408
  ${_a()}
365
- </media-fullscreen-button>`,I=e=>l`
409
+ </media-fullscreen-button>`,K=e=>s`
366
410
  <media-cast-button disabled="${!e.hasSrc||e.isDialogOpen}" aria-disabled="${!e.hasSrc||e.isDialogOpen&&"true"}">
367
- ${Ia()}
368
411
  ${Ra()}
369
- </media-cast-button>`,Be=({playbackRates:e,isDialogOpen:a})=>l`
412
+ ${Ia()}
413
+ </media-cast-button>`,Be=({playbackRates:e,isDialogOpen:a})=>s`
370
414
  <media-playback-rate-button rates="${e!=null?e:!1}" disabled="${a}" aria-disabled="${a&&"true"}">
371
- </media-playback-rate-button>`,B=({isDialogOpen:e})=>l`
415
+ </media-playback-rate-button>`,U=({isDialogOpen:e})=>s`
372
416
  <media-volume-range disabled="${e}" aria-disabled="${e&&"true"}">
373
- </media-volume-range>`,me=e=>l`
417
+ </media-volume-range>`,j=e=>s`
374
418
  <media-time-range disabled="${!e.hasSrc||e.isDialogOpen}" aria-disabled="${!e.hasSrc||e.isDialogOpen&&"true"}">
375
- </media-time-range>`,Ke=({defaultShowRemainingTime:e,hasSrc:a,isDialogOpen:t})=>l`
419
+ </media-time-range>`,Ke=({defaultShowRemainingTime:e,hasSrc:a,isDialogOpen:t})=>s`
376
420
  <mxp-time-display remaining="${e}" disabled="${!a||t}" aria-disabled="${!a||t&&"true"}">
377
- </mxp-time-display>`,K=({title:e})=>l`
378
- <media-text-display part="title" class="title-display">${e}</media-text-display>`,tr=e=>l`
379
- ${e.title?`<media-control-bar>${K(e)}</media-control-bar>`:l``}
421
+ </mxp-time-display>`,F=({title:e})=>s`
422
+ <media-text-display part="title" class="title-display">${e}</media-text-display>`,ar=e=>s`
423
+ ${e.title?s`<media-control-bar>${F(e)}</media-control-bar>`:s``}
380
424
  <media-control-bar>
381
- ${$(e)}
425
+ ${w(e)}
382
426
  ${le(e)}
383
427
  ${de(e)}
384
428
  ${Ke(e)}
385
- ${me(e)}
386
- ${M(e)}
387
- ${B(e)}
429
+ ${j(e)}
430
+ ${C(e)}
431
+ ${U(e)}
388
432
  ${Be(e)}
389
- ${P(e)}
390
- ${I(e)}
433
+ ${H(e)}
434
+ ${K(e)}
391
435
  </media-control-bar>
392
- `,ar=e=>l`
393
- ${e.title?`<media-control-bar>${K(e)}</media-control-bar>`:l``}
436
+ `,ir=e=>s`
437
+ ${e.title?s`<media-control-bar>${F(e)}</media-control-bar>`:s``}
394
438
  <media-control-bar>
395
- ${$(e)}
439
+ ${w(e)}
396
440
  <slot name="seek-live"></slot>
397
441
  ${le(e)}
398
442
  ${de(e)}
399
443
  ${Ke(e)}
400
- ${me(e)}
401
- ${M(e)}
402
- ${B(e)}
444
+ ${j(e)}
445
+ ${C(e)}
446
+ ${U(e)}
403
447
  ${Be(e)}
404
- ${P(e)}
405
- ${I(e)}
448
+ ${H(e)}
449
+ ${K(e)}
406
450
  </media-control-bar>
407
- `,ir=e=>l`
408
- ${e.title?`<media-control-bar>${K(e)}</media-control-bar>`:l``}
451
+ `,rr=e=>s`
452
+ ${e.title?s`<media-control-bar>${F(e)}</media-control-bar>`:s``}
409
453
  <media-control-bar>
410
- ${$(e)}
454
+ ${w(e)}
411
455
  <slot name="seek-live"></slot>
412
- ${M(e)}
413
- ${B(e)}
414
- ${P(e)}
415
- ${I(e)}
416
- </media-control-bar>
417
- `,bt=e=>l`
418
- <media-control-bar slot="top-chrome">
419
- ${Q(e)}
456
+ ${C(e)}
457
+ ${U(e)}
420
458
  <div class="spacer"></div>
421
- ${P(e)}
422
- ${I(e)}
423
- ${ee(e)}
459
+ ${H(e)}
460
+ ${K(e)}
424
461
  </media-control-bar>
425
- <div slot="centered-chrome" class="center-controls">
426
- ${$(e)}
427
- </div>
462
+ `,nr=e=>s`
463
+ ${j(e)}
428
464
  <media-control-bar>
429
- ${M(e)}
465
+ ${w(e)}
466
+ ${C(e)}
430
467
  <div class="spacer"></div>
431
- ${te(e)}
468
+ ${V(e)}
469
+ ${B(e)}
432
470
  </media-control-bar>
433
- `,rr=e=>l`
471
+ `,or=e=>s`
434
472
  <media-control-bar slot="top-chrome">
435
- ${e.title?K(e):l``}
436
- <div class="spacer"></div>
437
- ${Q(e)}
438
- ${P(e)}
439
- ${I(e)}
440
- ${ee(e)}
473
+ ${e.title?F(e):s``}
441
474
  </media-control-bar>
442
475
  <div slot="centered-chrome" class="center-controls">
443
476
  ${le(e)}
444
- ${$(e)}
477
+ ${w(e)}
445
478
  ${de(e)}
446
479
  </div>
447
- ${me(e)}
480
+ ${j(e)}
448
481
  <media-control-bar>
449
482
  ${Ke(e)}
450
- ${M(e)}
451
- ${B(e)}
483
+ ${C(e)}
484
+ ${U(e)}
452
485
  <div class="spacer"></div>
453
486
  ${Be(e)}
454
- ${te(e)}
455
- <div class="padding-2"></div>
487
+ ${V(e)}
488
+ ${H(e)}
489
+ ${K(e)}
490
+ ${me(e)}
491
+ ${B(e)}
456
492
  </media-control-bar>
457
- `,nr=e=>l`
493
+ `,sr=e=>s`
458
494
  <media-control-bar slot="top-chrome">
459
- ${e.title?K(e):l``}
495
+ ${e.title?F(e):s``}
460
496
  </media-control-bar>
461
497
  <div slot="centered-chrome" class="center-controls">
462
- ${$(e)}
498
+ ${w(e)}
463
499
  </div>
464
- ${me(e)}
500
+ ${j(e)}
465
501
  <media-control-bar>
466
- ${$(e)}
502
+ ${w(e)}
467
503
  ${le(e)}
468
504
  ${de(e)}
469
505
  ${Ke(e)}
470
- ${M(e)}
471
- ${B(e)}
506
+ ${C(e)}
507
+ ${U(e)}
472
508
  <div class="spacer"></div>
473
509
  ${Be(e)}
474
- ${Q(e)}
475
- ${P(e)}
476
- ${I(e)}
477
- ${ee(e)}
478
- ${te(e)}
479
- <div class="padding-2"></div>
510
+ ${V(e)}
511
+ ${H(e)}
512
+ ${K(e)}
513
+ ${me(e)}
514
+ ${B(e)}
480
515
  </media-control-bar>
481
- `,or=bt,sr=e=>l`
516
+ `,lr=e=>s`
482
517
  <media-control-bar slot="top-chrome">
483
- ${e.title?K(e):l``}
518
+ <slot name="seek-live"></slot>
519
+ </media-control-bar>
520
+ <media-control-bar>
521
+ ${w(e)}
522
+ ${C(e)}
484
523
  <div class="spacer"></div>
485
- ${Q(e)}
486
- ${P(e)}
487
- ${I(e)}
488
- ${ee(e)}
524
+ ${V(e)}
525
+ ${B(e)}
526
+ </media-control-bar>
527
+ `,dr=e=>s`
528
+ <media-control-bar slot="top-chrome">
529
+ <slot name="seek-live"></slot>
530
+ ${e.title?F(e):s``}
489
531
  </media-control-bar>
490
532
  <div slot="centered-chrome" class="center-controls">
491
- ${$(e)}
533
+ ${w(e)}
492
534
  </div>
493
535
  <media-control-bar>
494
- ${M(e)}
495
- ${B(e)}
496
- <slot name="seek-live"></slot>
536
+ ${C(e)}
537
+ ${U(e)}
497
538
  <div class="spacer"></div>
498
- ${te(e)}
539
+ ${V(e)}
540
+ ${H(e)}
541
+ ${K(e)}
542
+ ${me(e)}
543
+ ${B(e)}
499
544
  </media-control-bar>
500
- `,lr=e=>l`
545
+ `,mr=e=>s`
501
546
  <media-control-bar slot="top-chrome">
502
- ${e.title?K(e):l``}
547
+ <slot name="seek-live"></slot>
548
+ ${e.title?F(e):s``}
503
549
  </media-control-bar>
504
550
  <div slot="centered-chrome" class="center-controls">
505
- ${$(e)}
551
+ ${w(e)}
506
552
  </div>
507
553
  <media-control-bar>
508
- ${M(e)}
554
+ ${w(e)}
555
+ ${C(e)}
556
+ ${U(e)}
557
+ <div class="spacer"></div>
558
+ ${V(e)}
559
+ ${H(e)}
560
+ ${K(e)}
561
+ ${me(e)}
509
562
  ${B(e)}
563
+ </media-control-bar>
564
+ `,cr=e=>s`
565
+ <media-control-bar slot="top-chrome">
510
566
  <slot name="seek-live"></slot>
567
+ </media-control-bar>
568
+ ${j(e)}
569
+ <media-control-bar>
570
+ ${w(e)}
571
+ ${C(e)}
511
572
  <div class="spacer"></div>
512
- ${Q(e)}
513
- ${P(e)}
514
- ${I(e)}
515
- ${ee(e)}
516
- ${te(e)}
573
+ ${V(e)}
574
+ ${B(e)}
517
575
  </media-control-bar>
518
- `,dr=bt,mr=e=>l`
576
+ `,ur=e=>s`
519
577
  <media-control-bar slot="top-chrome">
520
- ${e.title?K(e):l``}
521
- <div class="spacer"></div>
522
- ${Q(e)}
523
- ${P(e)}
524
- ${I(e)}
525
- ${ee(e)}
578
+ <slot name="seek-live"></slot>
579
+ ${e.title?F(e):s``}
526
580
  </media-control-bar>
527
581
  <div slot="centered-chrome" class="center-controls">
528
582
  ${le(e)}
529
- ${$(e)}
583
+ ${w(e)}
530
584
  ${de(e)}
531
585
  </div>
532
- ${me(e)}
586
+ ${j(e)}
533
587
  <media-control-bar>
534
- ${M(e)}
535
- ${B(e)}
536
- <slot name="seek-live"></slot>
588
+ ${C(e)}
589
+ ${U(e)}
537
590
  <div class="spacer"></div>
538
- ${te(e)}
539
- <div class="padding-2"></div>
591
+ ${V(e)}
592
+ ${H(e)}
593
+ ${K(e)}
594
+ ${me(e)}
595
+ ${B(e)}
540
596
  </media-control-bar>
541
- `,ur=e=>l`
597
+ `,hr=e=>s`
542
598
  <media-control-bar slot="top-chrome">
543
- ${e.title?K(e):l``}
599
+ <slot name="seek-live"></slot>
600
+ ${e.title?F(e):s``}
544
601
  </media-control-bar>
545
602
  <div slot="centered-chrome" class="center-controls">
546
- ${$(e)}
603
+ ${w(e)}
547
604
  </div>
548
- ${me(e)}
605
+ ${j(e)}
549
606
  <media-control-bar>
550
- ${$(e)}
607
+ ${w(e)}
551
608
  ${le(e)}
552
609
  ${de(e)}
553
- ${M(e)}
554
- ${B(e)}
555
- <slot name="seek-live"></slot>
610
+ ${C(e)}
611
+ ${U(e)}
556
612
  <div class="spacer"></div>
557
- ${Q(e)}
558
- ${P(e)}
559
- ${I(e)}
560
- ${ee(e)}
561
- ${te(e)}
562
- <div class="padding-2"></div>
613
+ ${V(e)}
614
+ ${H(e)}
615
+ ${K(e)}
616
+ ${me(e)}
617
+ ${B(e)}
563
618
  </media-control-bar>
564
619
  `;var ja=`
565
620
  :host {
@@ -613,7 +668,7 @@ media-time-display {
613
668
  text-align: center;
614
669
  line-height: 1.4;
615
670
  }
616
- `,Ga=C.createElement("template");Ga.innerHTML=`
671
+ `,Ga=O.createElement("template");Ga.innerHTML=`
617
672
  <style>
618
673
  ${ja}
619
674
  </style>
@@ -621,9 +676,9 @@ media-time-display {
621
676
  <div class="dialog">
622
677
  <slot></slot>
623
678
  </div>
624
- `;var W=class extends g.HTMLElement{constructor(){var t;super();this.attachShadow({mode:"open"}),(t=this.shadowRoot)==null||t.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),qa(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),cr(this))}attributeChangedCallback(t,i,r){t==="open"&&i!==r&&(r!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&qa(this)}};W.styles=ja,W.template=Ga,W.observedAttributes=["open"];function qa(e){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(e.dispatchEvent(a),a.defaultPrevented)return;let t=e.querySelector("[autofocus]:not([disabled])");!t&&e.tabIndex>=0&&(t=e),t||(t=Xa(e.shadowRoot)),e._previouslyFocusedElement=C.activeElement,C.activeElement instanceof HTMLElement&&C.activeElement.blur(),e.addEventListener("transitionend",()=>{t instanceof HTMLElement&&t.focus({preventScroll:!0})},{once:!0})}function Xa(e){let t=["button","input","keygen","select","textarea"].map(function(r){return r+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');let i=e==null?void 0:e.querySelector(t.join(", "));if(!i&&"attachShadow"in Element.prototype){let r=(e==null?void 0:e.querySelectorAll("*"))||[];for(let n=0;n<r.length&&!(r[n].tagName&&r[n].shadowRoot&&(i=Xa(r[n].shadowRoot),i));n++);}return i}function cr(e){e._previouslyFocusedElement instanceof HTMLElement&&e._previouslyFocusedElement.focus()}g.customElements.get("media-dialog")||(g.customElements.define("media-dialog",W),g.MediaDialog=W);var pt=W;var Ja=C.createElement("template");Ja.innerHTML=`
679
+ `;var G=class extends g.HTMLElement{constructor(){var t;super();this.attachShadow({mode:"open"}),(t=this.shadowRoot)==null||t.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),qa(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),br(this))}attributeChangedCallback(t,i,r){t==="open"&&i!==r&&(r!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&qa(this)}};G.styles=ja,G.template=Ga,G.observedAttributes=["open"];function qa(e){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(e.dispatchEvent(a),a.defaultPrevented)return;let t=e.querySelector("[autofocus]:not([disabled])");!t&&e.tabIndex>=0&&(t=e),t||(t=Xa(e.shadowRoot)),e._previouslyFocusedElement=O.activeElement,O.activeElement instanceof HTMLElement&&O.activeElement.blur(),e.addEventListener("transitionend",()=>{t instanceof HTMLElement&&t.focus({preventScroll:!0})},{once:!0})}function Xa(e){let t=["button","input","keygen","select","textarea"].map(function(r){return r+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');let i=e==null?void 0:e.querySelector(t.join(", "));if(!i&&"attachShadow"in Element.prototype){let r=(e==null?void 0:e.querySelectorAll("*"))||[];for(let n=0;n<r.length&&!(r[n].tagName&&r[n].shadowRoot&&(i=Xa(r[n].shadowRoot),i));n++);}return i}function br(e){e._previouslyFocusedElement instanceof HTMLElement&&e._previouslyFocusedElement.focus()}g.customElements.get("media-dialog")||(g.customElements.define("media-dialog",G),g.MediaDialog=G);var bt=G;var Ja=O.createElement("template");Ja.innerHTML=`
625
680
  <style>
626
- ${pt.styles}
681
+ ${bt.styles}
627
682
 
628
683
  .close {
629
684
  background: none;
@@ -652,7 +707,7 @@ media-time-display {
652
707
  </svg>
653
708
  </button>
654
709
  </slot>
655
- `;var xe=class extends pt{constructor(){var a,t;super(),(t=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||t.addEventListener("click",()=>{this.close()})}};xe.template=Ja;g.customElements.get("mxp-dialog")||(g.customElements.define("mxp-dialog",xe),g.MxpDialog=xe);var Qa=`:host {
710
+ `;var xe=class extends bt{constructor(){var a,t;super(),(t=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||t.addEventListener("click",()=>{this.close()})}};xe.template=Ja;g.customElements.get("mxp-dialog")||(g.customElements.define("mxp-dialog",xe),g.MxpDialog=xe);var Qa=`:host {
656
711
  display: inline-block;
657
712
  width: 100%;
658
713
  }
@@ -667,21 +722,36 @@ a {
667
722
  font-size: 0.9em;
668
723
  text-decoration: underline;
669
724
  }
670
- [part~='seek-live'] {
671
- height: 44px;
725
+
726
+ [audio] [part~='seek-live'] {
727
+ margin: 0;
728
+ height: 42px;
729
+ border-radius: 0;
672
730
  background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
673
- color: white;
731
+ }
732
+
733
+ [part~='seek-live'] {
734
+ margin-left: 10px;
735
+ margin-right: 5px;
736
+ align-self: center;
737
+ position: relative;
738
+ box-sizing: border-box;
739
+ padding: 4px 6px;
740
+ border-radius: 12px;
741
+ background-color: rgba(20, 20, 30, 0.7);
742
+ font-size: 0.75rem;
743
+ line-height: 1;
744
+ color: #fff;
674
745
  border: none;
675
746
  cursor: pointer;
676
747
  }
677
748
 
678
- [part~='seek-live']::before {
679
- content: '\u25CF ';
680
- color: rgb(118, 118, 118);
681
- padding-right: 5px;
749
+ [part~='seek-live'] svg {
750
+ width: 8px;
751
+ fill: rgb(118, 118, 118);
682
752
  }
683
- [part~='seek-live'][in-live-window]::before {
684
- color: #fb3c4d;
753
+ [part~='seek-live'][in-live-window] svg {
754
+ fill: #fb3c4d;
685
755
  }
686
756
 
687
757
  [part~='seek-live'][disabled] {
@@ -803,12 +873,12 @@ a {
803
873
  ::part(title display) {
804
874
  display: var(--media-controls, var(--media-title-display));
805
875
  }
806
- `;import{StreamTypes as ue}from"@mux/playback-core";var ti=e=>l`
876
+ `;import{StreamTypes as ce}from"@mux/playback-core";var ti=e=>s`
807
877
  <style>
808
878
  ${Qa}
809
879
  </style>
810
- ${pr(e)}
811
- `,ei=e=>[ue.LIVE,ue.LL_LIVE].includes(e.streamType),br=e=>[ue.LIVE,ue.LL_LIVE,ue.DVR,ue.LL_DVR].includes(e.streamType),pr=e=>{var a,t,i,r,n,o,m,b,f,v,S,Y,E,D,_,N,k,Ce,ge,re,yt,Et,kt,Tt,At,xt,Lt,wt,$t,St,Ct,Ot,Mt,Pt,It,Rt,Dt,_t,Nt,Vt,Ht,Bt,Kt;return l`
880
+ ${fr(e)}
881
+ `,ei=e=>[ce.LIVE,ce.LL_LIVE].includes(e.streamType),gr=e=>[ce.LIVE,ce.LL_LIVE,ce.DVR,ce.LL_DVR].includes(e.streamType),fr=e=>{var a,t,i,r,n,o,c,b,f,v,S,W,E,R,I,D,k,Se,ge,re,vt,yt,Et,kt,Tt,At,xt,wt,Lt,$t,Ct,St,Ot,Mt,Pt,Rt,It,Dt,_t,Nt,Vt,Ht,Bt,Kt;return s`
812
882
  <${ht((a=st(e.theme))!=null?a:"media-theme-mux")}
813
883
  has-src="${(t=e.hasSrc)!=null?t:!1}"
814
884
  has-open-dialog="${(i=e.isDialogOpen)!=null?i:!1}"
@@ -816,76 +886,78 @@ a {
816
886
  audio="${(n=e.audio)!=null?n:!1}"
817
887
  style="${(o=Wt({"--primary-color":e.primaryColor,"--secondary-color":e.secondaryColor}))!=null?o:!1}"
818
888
  class="size-${e.playerSize}${e.secondaryColor?" two-tone":""}"
819
- stream-type="${(m=e.streamType)!=null?m:!1}"
889
+ stream-type="${(c=e.streamType)!=null?c:!1}"
820
890
  player-size="${(b=e.playerSize)!=null?b:!1}"
821
891
  default-hidden-captions="${(f=e.defaultHiddenCaptions)!=null?f:!1}"
822
892
  forward-seek-offset="${(v=e.forwardSeekOffset)!=null?v:!1}"
823
893
  backward-seek-offset="${(S=e.backwardSeekOffset)!=null?S:!1}"
824
- playbackrates="${(Y=e.playbackRates)!=null?Y:!1}"
894
+ playbackrates="${(W=e.playbackRates)!=null?W:!1}"
825
895
  default-show-remaining-time="${(E=e.defaultShowRemainingTime)!=null?E:!1}"
826
- title="${(D=e.title)!=null?D:!1}"
827
- hotkeys="${(_=e.hotKeys)!=null?_:!1}"
828
- poster="${e.poster===""?!1:(N=e.poster)!=null?N:!1}"
896
+ title="${(R=e.title)!=null?R:!1}"
897
+ hotkeys="${(I=e.hotKeys)!=null?I:!1}"
898
+ poster="${e.poster===""?!1:(D=e.poster)!=null?D:!1}"
829
899
  placeholder="${(k=e.placeholder)!=null?k:!1}"
830
900
  exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, poster, seek-live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
831
901
  >
832
902
  <mux-video
833
903
  slot="media"
834
- crossorigin="${(Ce=e.crossOrigin)!=null?Ce:""}"
904
+ crossorigin="${(Se=e.crossOrigin)!=null?Se:""}"
835
905
  playsinline
836
906
  autoplay="${(ge=e.autoplay)!=null?ge:!1}"
837
907
  muted="${(re=e.muted)!=null?re:!1}"
838
- loop="${(yt=e.loop)!=null?yt:!1}"
839
- preload="${(Et=e.preload)!=null?Et:!1}"
840
- debug="${(kt=e.debug)!=null?kt:!1}"
841
- experimental-cmcd="${(Tt=e.experimentalCmcd)!=null?Tt:!1}"
908
+ loop="${(vt=e.loop)!=null?vt:!1}"
909
+ preload="${(yt=e.preload)!=null?yt:!1}"
910
+ debug="${(Et=e.debug)!=null?Et:!1}"
911
+ experimental-cmcd="${(kt=e.experimentalCmcd)!=null?kt:!1}"
912
+ prefer-cmcd="${(Tt=e.preferCmcd)!=null?Tt:!1}"
842
913
  disable-cookies="${(At=e.disableCookies)!=null?At:!1}"
843
914
  prefer-playback="${(xt=e.preferPlayback)!=null?xt:!1}"
844
915
  start-time="${e.startTime!=null?e.startTime:!1}"
845
- metadata-video-id="${(Lt=e.metadataVideoId)!=null?Lt:!1}"
846
- metadata-video-title="${($t=(wt=e.metadataVideoTitle)!=null?wt:e.title)!=null?$t:!1}"
847
- metadata-viewer-user-id="${(St=e.metadataViewerUserId)!=null?St:!1}"
848
- beacon-collection-domain="${(Ct=e.beaconCollectionDomain)!=null?Ct:!1}"
916
+ metadata-video-id="${(wt=e.metadataVideoId)!=null?wt:!1}"
917
+ metadata-video-title="${($t=(Lt=e.metadataVideoTitle)!=null?Lt:e.title)!=null?$t:!1}"
918
+ metadata-viewer-user-id="${(Ct=e.metadataViewerUserId)!=null?Ct:!1}"
919
+ beacon-collection-domain="${(St=e.beaconCollectionDomain)!=null?St:!1}"
849
920
  player-software-name="${(Ot=e.playerSoftwareName)!=null?Ot:!1}"
850
921
  player-software-version="${(Mt=e.playerSoftwareVersion)!=null?Mt:!1}"
851
922
  env-key="${(Pt=e.envKey)!=null?Pt:!1}"
852
- stream-type="${(It=e.streamType)!=null?It:!1}"
853
- custom-domain="${(Rt=e.customDomain)!=null?Rt:!1}"
923
+ stream-type="${(Rt=e.streamType)!=null?Rt:!1}"
924
+ custom-domain="${(It=e.customDomain)!=null?It:!1}"
854
925
  src="${e.src?e.src:e.playbackId?ot(e.playbackId,{domain:e.customDomain,token:e.tokens.playback}):!1}"
855
926
  cast-src="${e.src?e.src:e.playbackId?ot(e.playbackId,{domain:e.customDomain,token:e.tokens.playback}):!1}"
856
927
  cast-stream-type="${ei(e)?"live":!1}"
857
928
  exportparts="video"
858
929
  >
859
- ${e.storyboard?l`<track label="thumbnails" default kind="metadata" src="${e.storyboard}" />`:l``}
930
+ ${e.storyboard?s`<track label="thumbnails" default kind="metadata" src="${e.storyboard}" />`:s``}
860
931
  </mux-video>
861
- ${br(e)?l`<button
932
+ ${gr(e)?s`<button
862
933
  slot="seek-live"
863
934
  part="${ei(e)?"top":"bottom"} seek-live button"
864
935
  disabled="${e.inLiveWindow||!e.hasSrc||e.isDialogOpen}"
865
936
  aria-disabled="${(e.inLiveWindow||!e.hasSrc||e.isDialogOpen)&&"true"}"
866
937
  in-live-window="${e.inLiveWindow}"
867
- onclick="${function(di){var Ut;if((Ut=e.onSeekToLive)==null||Ut.call(e,di),e.paused){let mi=new CustomEvent("mediaplayrequest",{composed:!0,bubbles:!0});this.dispatchEvent(mi)}}}"
938
+ onclick="${function(mi){var Ut;if((Ut=e.onSeekToLive)==null||Ut.call(e,mi),e.paused){let ci=new CustomEvent("mediaplayrequest",{composed:!0,bubbles:!0});this.dispatchEvent(ci)}}}"
868
939
  >
940
+ <svg viewBox="0 0 8 8"><circle cx="4" cy="4" r="4"></circle></svg>
869
941
  Live
870
- </button>`:l``}
942
+ </button>`:s``}
871
943
  <mxp-dialog
872
944
  no-auto-hide
873
945
  open="${(Dt=e.isDialogOpen)!=null?Dt:!1}"
874
946
  onclose="${e.onCloseErrorDialog}"
875
947
  oninitfocus="${e.onInitFocusDialog}"
876
948
  >
877
- ${(_t=e.dialog)!=null&&_t.title?l`<h3>${e.dialog.title}</h3>`:l``}
949
+ ${(_t=e.dialog)!=null&&_t.title?s`<h3>${e.dialog.title}</h3>`:s``}
878
950
  <p>
879
951
  ${(Nt=e.dialog)==null?void 0:Nt.message}
880
- ${(Vt=e.dialog)!=null&&Vt.linkUrl?l`<a
952
+ ${(Vt=e.dialog)!=null&&Vt.linkUrl?s`<a
881
953
  href="${e.dialog.linkUrl}"
882
954
  target="_blank"
883
955
  rel="external noopener"
884
956
  aria-label="${(Ht=e.dialog.linkText)!=null?Ht:""} ${u("(opens in a new window)")}"
885
957
  >${(Bt=e.dialog.linkText)!=null?Bt:e.dialog.linkUrl}</a
886
- >`:l``}
958
+ >`:s``}
887
959
  </p>
888
960
  </mxp-dialog>
889
961
  </${ht((Kt=st(e.theme))!=null?Kt:"media-theme-mux")}>
890
- `};import{MediaError as Ue}from"@mux/mux-video";function Fe(e,a,t,i,r){var m,b,f;let n={},o={};switch(e.code){case Ue.MEDIA_ERR_NETWORK:{switch(n.title=u("Network Error",r),n.message=e.message,(m=e.data)==null?void 0:m.response.code){case 412:{n.title=u("Video is not currently available",r),n.message=u("The live stream or video file are not yet ready.",r),o.message=u("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),o.file="412-not-playable.md";break}case 404:{n.title=u("Video does not exist",r),n.message="",o.message=u("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),o.file="404-not-found.md";break}case 403:{if(n.title=u("Invalid playback URL",r),n.message=u("The video URL or playback-token are formatted with incorrect or incomplete information.",r),o.message=u("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),o.file="missing-signed-tokens.md",!i)break;let{exp:v,aud:S,sub:Y}=Z(i),E=Date.now()>v*1e3,D=Y!==t,_=S!=="v",N={timeStyle:"medium",dateStyle:"medium"};if(E){n.title=u("Video URL has expired",r),n.message=u("The video\u2019s secured playback-token has expired.",r),o.message=u("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(q.code,N).format(v*1e3),currentDate:new Intl.DateTimeFormat(q.code,N).format(Date.now())}),o.file="403-expired-token.md";break}if(D){n.title=u("Video URL is formatted incorrectly",r),n.message=u("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),o.message=u("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:t,tokenPlaybackId:Y}),o.file="403-playback-id-mismatch.md";break}if(_){n.title=u("Video URL is formatted incorrectly",r),n.message=u("The playback-token is formatted with incorrect information.",r),o.message=u("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:S}),o.file="403-incorrect-aud-value.md";break}o.message=u("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),o.file="403-malformatted-token.md";break}}break}case Ue.MEDIA_ERR_DECODE:{let{message:v}=e;n={title:u("Media Error",r),message:v},o.file="media-decode-error.md";break}case Ue.MEDIA_ERR_SRC_NOT_SUPPORTED:{let v=(f=(b=e.data)==null?void 0:b.response)==null?void 0:f.code;if(v>=400&&v<500){e.code=Ue.MEDIA_ERR_NETWORK,e.data={response:{code:v}},{dialog:n,devlog:o}=Fe(e,a,t,i);break}n={title:u("Source Not Supported",r),message:e.message},o.file="media-src-not-supported.md";break}default:n={title:u("Error",r),message:e.message};break}return a&&(n={title:u("Your device appears to be offline",r),message:u("Check your internet connection and try reloading this video.",r)}),{dialog:n,devlog:o}}var Er=Object.values(w),kr=700,Tr=300,ft={LG:"large",SM:"small",XS:"extra-small"};function Ze(e){let a=e.getBoundingClientRect();return a.width<Tr?ft.XS:a.width<kr?ft.SM:ft.LG}var U={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function Ar(e,a){var i,r;return{src:!e.playbackId&&e.src,playbackId:e.playbackId,hasSrc:!!e.playbackId||!!e.src,poster:e.poster,storyboard:e.storyboard,placeholder:e.getAttribute("placeholder"),theme:e.getAttribute("theme"),thumbnailTime:!e.tokens.thumbnail&&e.thumbnailTime,autoplay:e.autoplay,crossOrigin:e.crossOrigin,loop:e.loop,noHotKeys:e.hasAttribute(s.NOHOTKEYS),hotKeys:e.getAttribute(s.HOTKEYS),muted:e.muted,paused:e.paused,preload:e.preload,envKey:e.envKey,experimentalCmcd:e.experimentalCmcd,debug:e.debug,disableCookies:e.disableCookies,tokens:e.tokens,beaconCollectionDomain:e.beaconCollectionDomain,metadata:e.metadata,playerSoftwareName:e.playerSoftwareName,playerSoftwareVersion:e.playerSoftwareVersion,startTime:e.startTime,preferPlayback:e.preferPlayback,audio:e.audio,streamType:e.streamType,primaryColor:e.primaryColor,secondaryColor:e.secondaryColor,forwardSeekOffset:e.forwardSeekOffset,backwardSeekOffset:e.backwardSeekOffset,defaultHiddenCaptions:e.defaultHiddenCaptions,defaultShowRemainingTime:e.defaultShowRemainingTime,playbackRates:e.getAttribute(s.PLAYBACK_RATES),customDomain:(i=e.getAttribute(c.CUSTOM_DOMAIN))!=null?i:void 0,playerSize:Ze((r=e.mediaController)!=null?r:e),metadataVideoId:e.getAttribute(c.METADATA_VIDEO_ID),metadataVideoTitle:e.getAttribute(c.METADATA_VIDEO_TITLE),metadataViewerUserId:e.getAttribute(c.METADATA_VIEWER_USER_ID),title:e.getAttribute(s.TITLE),...a}}var xr=Object.values(c),Lr=Object.values(U),wr=Object.values(s),$r=Ie(),Sr="mux-player",ai={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},ie,we,F,$e,he,R,be,We,z,ce,pe,ze,Se,vt,qe,ii,je,ri,Ge,ni,Xe,oi,Je,si,Qe,li,Le=class extends mt{constructor(){super();h(this,be);h(this,z);h(this,pe);h(this,Se);h(this,qe);h(this,je);h(this,Ge);h(this,Xe);h(this,Je);h(this,Qe);h(this,ie,!1);h(this,we,{});h(this,F,!0);h(this,$e,new Pe(this,"hotkeys"));h(this,he,void 0);h(this,R,{...ai,onCloseErrorDialog:()=>p(this,z,ce).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:t=>{rt(this,C.activeElement)||t.preventDefault()},onSeekToLive:()=>lt(this)});this.attachShadow({mode:"open"}),this.isConnected&&p(this,be,We).call(this)}static get observedAttributes(){var t;return[...(t=mt.observedAttributes)!=null?t:[],...Lr,...xr,...wr]}get theme(){var t,i;return Array.from((i=(t=this.shadowRoot)==null?void 0:t.children)!=null?i:[]).find(({localName:r})=>r.startsWith("media-theme-"))}get mediaController(){var t,i;return(i=(t=this.theme)==null?void 0:t.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){p(this,Se,vt).call(this),p(this,qe,ii).call(this)}disconnectedCallback(){p(this,je,ri).call(this)}attributeChangedCallback(t,i,r){switch(d(this,ie)||p(this,be,We).call(this),super.attributeChangedCallback(t,i,r),t){case s.HOTKEYS:d(this,$e).value=r;break;case s.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&X(u("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:o}=Z(r);r&&o!=="t"&&X(u("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:o}));break}case s.STORYBOARD_TOKEN:{let{aud:o}=Z(r);r&&o!=="s"&&X(u("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:o}));break}case c.PLAYBACK_ID:{r!=null&&r.includes("?token")&&O(u("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!Er.includes(this.streamType)&&Re({file:"invalid-stream-type.md",message:u("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):Re({file:"invalid-stream-type.md",message:String(u("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[c.PLAYBACK_ID,U.SRC,s.PLAYBACK_TOKEN].includes(t)&&i!==r&&A(this,R,{...d(this,R),...ai}),p(this,pe,ze).call(this,{[Jt(t)]:r})}get experimentalCmcd(){return this.hasAttribute(c.EXPERIMENTAL_CMCD)}set experimentalCmcd(t){!!t!==this.experimentalCmcd&&(t?this.setAttribute(c.EXPERIMENTAL_CMCD,""):this.removeAttribute(c.EXPERIMENTAL_CMCD))}get hasPlayed(){var t,i;return(i=(t=this.mediaController)==null?void 0:t.hasAttribute("media-has-played"))!=null?i:!1}get inLiveWindow(){return d(this,R).inLiveWindow}get _hls(){var t;return(t=this.media)==null?void 0:t._hls}get mux(){var t;return(t=this.media)==null?void 0:t.mux}get playbackId(){var t;return(t=this.getAttribute(c.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t?this.setAttribute(c.PLAYBACK_ID,t):this.removeAttribute(c.PLAYBACK_ID)}get src(){var t,i;return this.playbackId?(t=ae(this,U.SRC))!=null?t:void 0:(i=this.getAttribute(U.SRC))!=null?i:void 0}set src(t){t?this.setAttribute(U.SRC,t):this.removeAttribute(U.SRC)}get poster(){var i;let t=this.getAttribute(U.POSTER);if(t!=null)return t;if(this.playbackId&&!this.audio)return Gt(this.playbackId,{domain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,token:this.tokens.thumbnail})}set poster(t){t||t===""?this.setAttribute(U.POSTER,t):this.removeAttribute(U.POSTER)}get storyboard(){if(this.playbackId&&!this.audio&&(!this.streamType||![w.LIVE,w.LL_LIVE,w.DVR,w.LL_DVR].includes(this.streamType)))return Xt(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(s.AUDIO)}set audio(t){if(!t){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return d(this,$e)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(t){if(!t){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return V(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(t){this.setAttribute(s.THUMBNAIL_TIME,`${t}`)}get title(){var t;return(t=this.getAttribute(s.TITLE))!=null?t:""}set title(t){t!==this.title&&(t?this.setAttribute(s.TITLE,t):this.removeAttribute("title"),super.title=t)}get placeholder(){var t;return(t=ae(this,s.PLACEHOLDER))!=null?t:""}set placeholder(t){this.setAttribute(s.PLACEHOLDER,`${t}`)}get primaryColor(){var t;return(t=this.getAttribute(s.PRIMARY_COLOR))!=null?t:void 0}set primaryColor(t){this.setAttribute(s.PRIMARY_COLOR,`${t}`)}get secondaryColor(){var t;return(t=this.getAttribute(s.SECONDARY_COLOR))!=null?t:void 0}set secondaryColor(t){this.setAttribute(s.SECONDARY_COLOR,`${t}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(t){t?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,i)=>t-i)}set playbackRates(t){if(!t){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,t.join(" "))}get forwardSeekOffset(){var t;return(t=V(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?t:10}set forwardSeekOffset(t){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${t}`)}get backwardSeekOffset(){var t;return(t=V(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?t:10}set backwardSeekOffset(t){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${t}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(t){t?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var t;return(t=this.getAttribute(c.PLAYER_SOFTWARE_NAME))!=null?t:Sr}get playerSoftwareVersion(){var t;return(t=this.getAttribute(c.PLAYER_SOFTWARE_VERSION))!=null?t:$r}get beaconCollectionDomain(){var t;return(t=this.getAttribute(c.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(c.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(c.BEACON_COLLECTION_DOMAIN))}get customDomain(){var t;return(t=this.getAttribute(c.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(c.CUSTOM_DOMAIN,t):this.removeAttribute(c.CUSTOM_DOMAIN))}get envKey(){var t;return(t=ae(this,c.ENV_KEY))!=null?t:void 0}set envKey(t){this.setAttribute(c.ENV_KEY,`${t}`)}get debug(){return ae(this,c.DEBUG)!=null}set debug(t){t?this.setAttribute(c.DEBUG,""):this.removeAttribute(c.DEBUG)}get disableCookies(){return ae(this,c.DISABLE_COOKIES)!=null}set disableCookies(t){t?this.setAttribute(c.DISABLE_COOKIES,""):this.removeAttribute(c.DISABLE_COOKIES)}get streamType(){return ae(this,c.STREAM_TYPE)}set streamType(t){this.setAttribute(c.STREAM_TYPE,`${t}`)}get startTime(){return V(ae(this,c.START_TIME))}set startTime(t){this.setAttribute(c.START_TIME,`${t}`)}get preferPlayback(){let t=this.getAttribute(c.PREFER_PLAYBACK);if(t===Ye.MSE||t===Ye.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===Ye.MSE||t===Ye.NATIVE?this.setAttribute(c.PREFER_PLAYBACK,t):this.removeAttribute(c.PREFER_PLAYBACK))}get metadata(){var t;return(t=this.media)==null?void 0:t.metadata}set metadata(t){if(d(this,ie)||p(this,be,We).call(this),!this.media){O("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata=t}get tokens(){let t=this.getAttribute(s.PLAYBACK_TOKEN),i=this.getAttribute(s.THUMBNAIL_TOKEN),r=this.getAttribute(s.STORYBOARD_TOKEN);return{...d(this,we),...t!=null?{playback:t}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(t){A(this,we,t!=null?t:{})}get playbackToken(){var t;return(t=this.getAttribute(s.PLAYBACK_TOKEN))!=null?t:void 0}set playbackToken(t){this.setAttribute(s.PLAYBACK_TOKEN,`${t}`)}get thumbnailToken(){var t;return(t=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?t:void 0}set thumbnailToken(t){this.setAttribute(s.THUMBNAIL_TOKEN,`${t}`)}get storyboardToken(){var t;return(t=this.getAttribute(s.STORYBOARD_TOKEN))!=null?t:void 0}set storyboardToken(t){this.setAttribute(s.STORYBOARD_TOKEN,`${t}`)}addTextTrack(t,i,r,n){var m;let o=(m=this.media)==null?void 0:m.nativeEl;if(!!o)return vr(o,t,i,r,n)}removeTextTrack(t){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(!!i)return yr(i,t)}get textTracks(){var t;return(t=this.media)==null?void 0:t.textTracks}};ie=new WeakMap,we=new WeakMap,F=new WeakMap,$e=new WeakMap,he=new WeakMap,R=new WeakMap,be=new WeakSet,We=function(){var t,i,r;if(!d(this,ie)){A(this,ie,!0),p(this,z,ce).call(this,{playerSize:Ze(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof g.HTMLElement))throw""}catch{O(`<${(t=this.theme)==null?void 0:t.localName}> failed to upgrade!`)}try{if(customElements.upgrade(this.media),!(this.media instanceof fr))throw""}catch{O("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof gr))throw""}catch{O("<media-controller> failed to upgrade!")}ra(this),p(this,Xe,oi).call(this),p(this,Je,si).call(this),p(this,Ge,ni).call(this),A(this,F,(r=(i=this.mediaController)==null?void 0:i.hasAttribute("user-inactive"))!=null?r:!0),p(this,Qe,li).call(this)}},z=new WeakSet,ce=function(t){Object.assign(d(this,R),t),p(this,pe,ze).call(this)},pe=new WeakSet,ze=function(t={}){_e(ti(Ar(this,{...d(this,R),...t})),this.shadowRoot)},Se=new WeakSet,vt=function(){var t,i;d(this,R).playerSize!=Ze((t=this.mediaController)!=null?t:this)&&p(this,z,ce).call(this,{playerSize:Ze((i=this.mediaController)!=null?i:this)})},qe=new WeakSet,ii=function(){var t;A(this,he,new ResizeObserver(()=>p(this,Se,vt).call(this))),d(this,he).observe((t=this.mediaController)!=null?t:this)},je=new WeakSet,ri=function(){var t;(t=d(this,he))==null||t.disconnect()},Ge=new WeakSet,ni=function(){var i,r,n,o,m;(i=this.mediaController)==null||i.addEventListener("mediaplayrequest",b=>{var f;((f=b.target)==null?void 0:f.localName)==="media-play-button"&&this.streamType&&[w.LIVE,w.LL_LIVE,w.DVR,w.LL_DVR].includes(this.streamType)&&this.hasPlayed&&lt(this)});let t=()=>{let b=ea(this),f=d(this,R).inLiveWindow;b!==f&&(p(this,z,ce).call(this,{inLiveWindow:b}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",t),(n=this.media)==null||n.addEventListener("waiting",t),(o=this.media)==null||o.addEventListener("timeupdate",t),(m=this.media)==null||m.addEventListener("emptied",t)},Xe=new WeakSet,oi=function(){var i;let t=r=>{let{detail:n}=r;if(n instanceof gt||(n=new gt(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){X(n),n.data&&X(`${n.name} data:`,n.data);return}let{dialog:o,devlog:m}=Fe(n,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&Re(m),O(n),n.data&&O(`${n.name} data:`,n.data),p(this,z,ce).call(this,{isDialogOpen:!0,dialog:o})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(r={})=>{var o,m,b;if(!((o=this.media)!=null&&o.error))return r;let{devlog:n}=Fe((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:n.message?String(n.message):r.player_error_message}}),(i=this.media)==null||i.addEventListener("error",r=>{var o,m;let{detail:n}=r;if(!n){let{message:b,code:f}=(m=(o=this.media)==null?void 0:o.error)!=null?m:{};n=new gt(b,f)}!(n!=null&&n.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Je=new WeakSet,si=function(){var i,r,n,o;let t=()=>p(this,pe,ze).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",t),(o=(n=this.media)==null?void 0:n.textTracks)==null||o.addEventListener("removetrack",t)},Qe=new WeakSet,li=function(){var v,S,Y;let t=this.mediaController,i=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(i)return;let r,n=new WeakMap,o=()=>this.streamType&&[w.LIVE,w.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,m=(E,D,_=!1)=>{if(o())return;Array.from(E&&E.activeCues||[]).forEach(k=>{if(!(!k.snapToLines||k.line<-5||k.line>=0&&k.line<10))if(!D||this.paused){let Ce=k.text.split(`
891
- `).length,ge=i?-2:-3;this.streamType&&[w.LIVE,w.LL_LIVE].includes(this.streamType)&&(ge=i?-1:-2);let re=ge-Ce;if(k.line===re&&!_)return;n.has(k)||n.set(k,k.line),k.line=re-1,k.line=re}else setTimeout(()=>{k.line=n.get(k)||"auto"},500)})},b=()=>{var E;m(r,(E=t==null?void 0:t.hasAttribute("user-inactive"))!=null?E:!1)},f=()=>{var _;let D=Array.from(((_=t==null?void 0:t.media)==null?void 0:_.textTracks)||[]).filter(N=>["subtitles","captions"].includes(N.kind)&&N.mode==="showing")[0];D!==r&&(r==null||r.removeEventListener("cuechange",b)),r=D,r==null||r.addEventListener("cuechange",b),m(r,d(this,F))};if(f(),(v=t==null?void 0:t.media)==null||v.textTracks.addEventListener("change",f),(S=t==null?void 0:t.media)==null||S.textTracks.addEventListener("addtrack",f),navigator.userAgent.includes("Chrome/")){let E=()=>{m(r,d(this,F),!0),this.paused||window.requestAnimationFrame(E)};(Y=t==null?void 0:t.media)==null||Y.addEventListener("playing",()=>{E()})}t==null||t.addEventListener("userinactivechange",()=>{let E=t==null?void 0:t.hasAttribute("user-inactive");d(this,F)!==E&&(A(this,F,E),m(r,d(this,F)))})};function ae(e,a){return e.media?e.media.getAttribute(a):e.getAttribute(a)}g.customElements.get("mux-player")||(g.customElements.define("mux-player",Le),g.MuxPlayerElement=Le);var po=Le;export{gt as MediaError,po as default,ae as getVideoAttribute};
962
+ `};import{MediaError as Ue}from"@mux/mux-video";function Fe(e,a,t,i,r){var c,b,f;let n={},o={};switch(e.code){case Ue.MEDIA_ERR_NETWORK:{switch(n.title=u("Network Error",r),n.message=e.message,(c=e.data)==null?void 0:c.response.code){case 412:{n.title=u("Video is not currently available",r),n.message=u("The live stream or video file are not yet ready.",r),o.message=u("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),o.file="412-not-playable.md";break}case 404:{n.title=u("Video does not exist",r),n.message="",o.message=u("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),o.file="404-not-found.md";break}case 403:{if(n.title=u("Invalid playback URL",r),n.message=u("The video URL or playback-token are formatted with incorrect or incomplete information.",r),o.message=u("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),o.file="missing-signed-tokens.md",!i)break;let{exp:v,aud:S,sub:W}=z(i),E=Date.now()>v*1e3,R=W!==t,I=S!=="v",D={timeStyle:"medium",dateStyle:"medium"};if(E){n.title=u("Video URL has expired",r),n.message=u("The video\u2019s secured playback-token has expired.",r),o.message=u("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(J.code,D).format(v*1e3),currentDate:new Intl.DateTimeFormat(J.code,D).format(Date.now())}),o.file="403-expired-token.md";break}if(R){n.title=u("Video URL is formatted incorrectly",r),n.message=u("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),o.message=u("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:t,tokenPlaybackId:W}),o.file="403-playback-id-mismatch.md";break}if(I){n.title=u("Video URL is formatted incorrectly",r),n.message=u("The playback-token is formatted with incorrect information.",r),o.message=u("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:S}),o.file="403-incorrect-aud-value.md";break}o.message=u("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),o.file="403-malformatted-token.md";break}}break}case Ue.MEDIA_ERR_DECODE:{let{message:v}=e;n={title:u("Media Error",r),message:v},o.file="media-decode-error.md";break}case Ue.MEDIA_ERR_SRC_NOT_SUPPORTED:{let v=(f=(b=e.data)==null?void 0:b.response)==null?void 0:f.code;if(v>=400&&v<500){e.code=Ue.MEDIA_ERR_NETWORK,e.data={response:{code:v}},{dialog:n,devlog:o}=Fe(e,a,t,i);break}n={title:u("Source Not Supported",r),message:e.message},o.file="media-src-not-supported.md";break}default:n={title:u("Error",r),message:e.message};break}return a&&(n={title:u("Your device appears to be offline",r),message:u("Check your internet connection and try reloading this video.",r)}),{dialog:n,devlog:o}}var Tr=Object.values($),Ar=700,xr=300,gt={LG:"large",SM:"small",XS:"extra-small"};function Ze(e){let a=e.getBoundingClientRect();return a.width<xr?gt.XS:a.width<Ar?gt.SM:gt.LG}var Y={SRC:"src",POSTER:"poster"},l={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",TITLE:"title",PLACEHOLDER:"placeholder"};function wr(e,a){var i,r;return{src:!e.playbackId&&e.src,playbackId:e.playbackId,hasSrc:!!e.playbackId||!!e.src,poster:e.poster,storyboard:e.storyboard,placeholder:e.getAttribute("placeholder"),theme:e.getAttribute("theme"),thumbnailTime:!e.tokens.thumbnail&&e.thumbnailTime,autoplay:e.autoplay,crossOrigin:e.crossOrigin,loop:e.loop,noHotKeys:e.hasAttribute(l.NOHOTKEYS),hotKeys:e.getAttribute(l.HOTKEYS),muted:e.muted,paused:e.paused,preload:e.preload,envKey:e.envKey,experimentalCmcd:e.experimentalCmcd,preferCmcd:e.preferCmcd,debug:e.debug,disableCookies:e.disableCookies,tokens:e.tokens,beaconCollectionDomain:e.beaconCollectionDomain,metadata:e.metadata,playerSoftwareName:e.playerSoftwareName,playerSoftwareVersion:e.playerSoftwareVersion,startTime:e.startTime,preferPlayback:e.preferPlayback,audio:e.audio,streamType:e.streamType,primaryColor:e.primaryColor,secondaryColor:e.secondaryColor,forwardSeekOffset:e.forwardSeekOffset,backwardSeekOffset:e.backwardSeekOffset,defaultHiddenCaptions:e.defaultHiddenCaptions,defaultShowRemainingTime:e.defaultShowRemainingTime,playbackRates:e.getAttribute(l.PLAYBACK_RATES),customDomain:(i=e.getAttribute(m.CUSTOM_DOMAIN))!=null?i:void 0,playerSize:Ze((r=e.mediaController)!=null?r:e),metadataVideoId:e.getAttribute(m.METADATA_VIDEO_ID),metadataVideoTitle:e.getAttribute(m.METADATA_VIDEO_TITLE),metadataViewerUserId:e.getAttribute(m.METADATA_VIEWER_USER_ID),title:e.getAttribute(l.TITLE),...a}}var Lr=Object.values(m),$r=Object.values(Y),Cr=Object.values(l),Sr=Re(),Or="mux-player",ii={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},ie,Le,Z,$e,he,P,be,We,X,ue,pe,ze,Ce,ft,qe,ri,je,ni,Ge,oi,Xe,si,Je,li,Qe,di,we=class extends mt{constructor(){super();h(this,be);h(this,X);h(this,pe);h(this,Ce);h(this,qe);h(this,je);h(this,Ge);h(this,Xe);h(this,Je);h(this,Qe);h(this,ie,!1);h(this,Le,{});h(this,Z,!0);h(this,$e,new Pe(this,"hotkeys"));h(this,he,void 0);h(this,P,{...ii,onCloseErrorDialog:()=>p(this,X,ue).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:t=>{rt(this,O.activeElement)||t.preventDefault()},onSeekToLive:()=>lt(this)});this.attachShadow({mode:"open"}),this.isConnected&&p(this,be,We).call(this)}static get observedAttributes(){var t;return[...(t=mt.observedAttributes)!=null?t:[],...$r,...Lr,...Cr]}get theme(){var t,i;return Array.from((i=(t=this.shadowRoot)==null?void 0:t.children)!=null?i:[]).find(({localName:r})=>r.startsWith("media-theme-"))}get mediaController(){var t,i;return(i=(t=this.theme)==null?void 0:t.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){p(this,Ce,ft).call(this),p(this,qe,ri).call(this)}disconnectedCallback(){p(this,je,ni).call(this)}attributeChangedCallback(t,i,r){switch(d(this,ie)||p(this,be,We).call(this),super.attributeChangedCallback(t,i,r),t){case l.HOTKEYS:d(this,$e).value=r;break;case l.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&q(u("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case l.THUMBNAIL_TOKEN:{let{aud:o}=z(r);r&&o!=="t"&&q(u("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:o}));break}case l.STORYBOARD_TOKEN:{let{aud:o}=z(r);r&&o!=="s"&&q(u("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:o}));break}case m.PLAYBACK_ID:{r!=null&&r.includes("?token")&&M(u("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!Tr.includes(this.streamType)&&Ie({file:"invalid-stream-type.md",message:u("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):Ie({file:"invalid-stream-type.md",message:String(u("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[m.PLAYBACK_ID,Y.SRC,l.PLAYBACK_TOKEN].includes(t)&&i!==r&&A(this,P,{...d(this,P),...ii}),p(this,pe,ze).call(this,{[Jt(t)]:r})}get experimentalCmcd(){return this.hasAttribute(m.EXPERIMENTAL_CMCD)}set experimentalCmcd(t){!!t!==this.experimentalCmcd&&(t?this.setAttribute(m.EXPERIMENTAL_CMCD,""):this.removeAttribute(m.EXPERIMENTAL_CMCD))}get preferCmcd(){var t;return(t=this.getAttribute(m.PREFER_CMCD))!=null?t:void 0}set preferCmcd(t){t!==this.preferCmcd&&(t?ai.includes(t)?this.setAttribute(m.PREFER_CMCD,t):q(`Invalid value for preferCmcd. Must be one of ${ai.join()}`):this.removeAttribute(m.PREFER_CMCD))}get hasPlayed(){var t,i;return(i=(t=this.mediaController)==null?void 0:t.hasAttribute("media-has-played"))!=null?i:!1}get inLiveWindow(){return d(this,P).inLiveWindow}get _hls(){var t;return(t=this.media)==null?void 0:t._hls}get mux(){var t;return(t=this.media)==null?void 0:t.mux}get playbackId(){var t;return(t=this.getAttribute(m.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t?this.setAttribute(m.PLAYBACK_ID,t):this.removeAttribute(m.PLAYBACK_ID)}get src(){var t,i;return this.playbackId?(t=ae(this,Y.SRC))!=null?t:void 0:(i=this.getAttribute(Y.SRC))!=null?i:void 0}set src(t){t?this.setAttribute(Y.SRC,t):this.removeAttribute(Y.SRC)}get poster(){var i;let t=this.getAttribute(Y.POSTER);if(t!=null)return t;if(this.playbackId&&!this.audio)return Gt(this.playbackId,{domain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,token:this.tokens.thumbnail})}set poster(t){t||t===""?this.setAttribute(Y.POSTER,t):this.removeAttribute(Y.POSTER)}get storyboard(){if(this.playbackId&&!this.audio&&(!this.streamType||![$.LIVE,$.LL_LIVE,$.DVR,$.LL_DVR].includes(this.streamType)))return Xt(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(l.AUDIO)}set audio(t){if(!t){this.removeAttribute(l.AUDIO);return}this.setAttribute(l.AUDIO,"")}get hotkeys(){return d(this,$e)}get nohotkeys(){return this.hasAttribute(l.NOHOTKEYS)}set nohotkeys(t){if(!t){this.removeAttribute(l.NOHOTKEYS);return}this.setAttribute(l.NOHOTKEYS,"")}get thumbnailTime(){return _(this.getAttribute(l.THUMBNAIL_TIME))}set thumbnailTime(t){this.setAttribute(l.THUMBNAIL_TIME,`${t}`)}get title(){var t;return(t=this.getAttribute(l.TITLE))!=null?t:""}set title(t){t!==this.title&&(t?this.setAttribute(l.TITLE,t):this.removeAttribute("title"),super.title=t)}get placeholder(){var t;return(t=ae(this,l.PLACEHOLDER))!=null?t:""}set placeholder(t){this.setAttribute(l.PLACEHOLDER,`${t}`)}get primaryColor(){var t;return(t=this.getAttribute(l.PRIMARY_COLOR))!=null?t:void 0}set primaryColor(t){this.setAttribute(l.PRIMARY_COLOR,`${t}`)}get secondaryColor(){var t;return(t=this.getAttribute(l.SECONDARY_COLOR))!=null?t:"rgb(0 0 0 / .65)"}set secondaryColor(t){this.setAttribute(l.SECONDARY_COLOR,`${t}`)}get defaultShowRemainingTime(){return this.hasAttribute(l.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(t){t?this.setAttribute(l.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(l.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(l.PLAYBACK_RATES))return this.getAttribute(l.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(t=>Number(t)).filter(t=>!Number.isNaN(t)).sort((t,i)=>t-i)}set playbackRates(t){if(!t){this.removeAttribute(l.PLAYBACK_RATES);return}this.setAttribute(l.PLAYBACK_RATES,t.join(" "))}get forwardSeekOffset(){var t;return(t=_(this.getAttribute(l.FORWARD_SEEK_OFFSET)))!=null?t:10}set forwardSeekOffset(t){this.setAttribute(l.FORWARD_SEEK_OFFSET,`${t}`)}get backwardSeekOffset(){var t;return(t=_(this.getAttribute(l.BACKWARD_SEEK_OFFSET)))!=null?t:10}set backwardSeekOffset(t){this.setAttribute(l.BACKWARD_SEEK_OFFSET,`${t}`)}get defaultHiddenCaptions(){return this.hasAttribute(l.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(t){t?this.setAttribute(l.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(l.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var t;return(t=this.getAttribute(m.PLAYER_SOFTWARE_NAME))!=null?t:Or}get playerSoftwareVersion(){var t;return(t=this.getAttribute(m.PLAYER_SOFTWARE_VERSION))!=null?t:Sr}get beaconCollectionDomain(){var t;return(t=this.getAttribute(m.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(m.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(m.BEACON_COLLECTION_DOMAIN))}get customDomain(){var t;return(t=this.getAttribute(m.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(m.CUSTOM_DOMAIN,t):this.removeAttribute(m.CUSTOM_DOMAIN))}get envKey(){var t;return(t=ae(this,m.ENV_KEY))!=null?t:void 0}set envKey(t){this.setAttribute(m.ENV_KEY,`${t}`)}get debug(){return ae(this,m.DEBUG)!=null}set debug(t){t?this.setAttribute(m.DEBUG,""):this.removeAttribute(m.DEBUG)}get disableCookies(){return ae(this,m.DISABLE_COOKIES)!=null}set disableCookies(t){t?this.setAttribute(m.DISABLE_COOKIES,""):this.removeAttribute(m.DISABLE_COOKIES)}get streamType(){return ae(this,m.STREAM_TYPE)}set streamType(t){this.setAttribute(m.STREAM_TYPE,`${t}`)}get startTime(){return _(ae(this,m.START_TIME))}set startTime(t){this.setAttribute(m.START_TIME,`${t}`)}get preferPlayback(){let t=this.getAttribute(m.PREFER_PLAYBACK);if(t===Ye.MSE||t===Ye.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===Ye.MSE||t===Ye.NATIVE?this.setAttribute(m.PREFER_PLAYBACK,t):this.removeAttribute(m.PREFER_PLAYBACK))}get metadata(){var t;return(t=this.media)==null?void 0:t.metadata}set metadata(t){if(d(this,ie)||p(this,be,We).call(this),!this.media){M("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata=t}get tokens(){let t=this.getAttribute(l.PLAYBACK_TOKEN),i=this.getAttribute(l.THUMBNAIL_TOKEN),r=this.getAttribute(l.STORYBOARD_TOKEN);return{...d(this,Le),...t!=null?{playback:t}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(t){A(this,Le,t!=null?t:{})}get playbackToken(){var t;return(t=this.getAttribute(l.PLAYBACK_TOKEN))!=null?t:void 0}set playbackToken(t){this.setAttribute(l.PLAYBACK_TOKEN,`${t}`)}get thumbnailToken(){var t;return(t=this.getAttribute(l.THUMBNAIL_TOKEN))!=null?t:void 0}set thumbnailToken(t){this.setAttribute(l.THUMBNAIL_TOKEN,`${t}`)}get storyboardToken(){var t;return(t=this.getAttribute(l.STORYBOARD_TOKEN))!=null?t:void 0}set storyboardToken(t){this.setAttribute(l.STORYBOARD_TOKEN,`${t}`)}addTextTrack(t,i,r,n){var c;let o=(c=this.media)==null?void 0:c.nativeEl;if(!!o)return Er(o,t,i,r,n)}removeTextTrack(t){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(!!i)return kr(i,t)}get textTracks(){var t;return(t=this.media)==null?void 0:t.textTracks}};ie=new WeakMap,Le=new WeakMap,Z=new WeakMap,$e=new WeakMap,he=new WeakMap,P=new WeakMap,be=new WeakSet,We=function(){var t,i,r;if(!d(this,ie)){A(this,ie,!0),p(this,X,ue).call(this,{playerSize:Ze(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof g.HTMLElement))throw""}catch{M(`<${(t=this.theme)==null?void 0:t.localName}> failed to upgrade!`)}try{if(customElements.upgrade(this.media),!(this.media instanceof yr))throw""}catch{M("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof vr))throw""}catch{M("<media-controller> failed to upgrade!")}ra(this),p(this,Xe,si).call(this),p(this,Je,li).call(this),p(this,Ge,oi).call(this),A(this,Z,(r=(i=this.mediaController)==null?void 0:i.hasAttribute("user-inactive"))!=null?r:!0),p(this,Qe,di).call(this)}},X=new WeakSet,ue=function(t){Object.assign(d(this,P),t),p(this,pe,ze).call(this)},pe=new WeakSet,ze=function(t={}){_e(ti(wr(this,{...d(this,P),...t})),this.shadowRoot)},Ce=new WeakSet,ft=function(){var t,i;d(this,P).playerSize!=Ze((t=this.mediaController)!=null?t:this)&&p(this,X,ue).call(this,{playerSize:Ze((i=this.mediaController)!=null?i:this)})},qe=new WeakSet,ri=function(){var t;A(this,he,new ResizeObserver(()=>p(this,Ce,ft).call(this))),d(this,he).observe((t=this.mediaController)!=null?t:this)},je=new WeakSet,ni=function(){var t;(t=d(this,he))==null||t.disconnect()},Ge=new WeakSet,oi=function(){var i,r,n,o,c;(i=this.mediaController)==null||i.addEventListener("mediaplayrequest",b=>{var f;((f=b.target)==null?void 0:f.localName)==="media-play-button"&&this.streamType&&[$.LIVE,$.LL_LIVE,$.DVR,$.LL_DVR].includes(this.streamType)&&this.hasPlayed&&lt(this)});let t=()=>{let b=ea(this),f=d(this,P).inLiveWindow;b!==f&&(p(this,X,ue).call(this,{inLiveWindow:b}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",t),(n=this.media)==null||n.addEventListener("waiting",t),(o=this.media)==null||o.addEventListener("timeupdate",t),(c=this.media)==null||c.addEventListener("emptied",t)},Xe=new WeakSet,si=function(){var i;let t=r=>{let{detail:n}=r;if(n instanceof pt||(n=new pt(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){q(n),n.data&&q(`${n.name} data:`,n.data);return}let{dialog:o,devlog:c}=Fe(n,!window.navigator.onLine,this.playbackId,this.playbackToken);c.message&&Ie(c),M(n),n.data&&M(`${n.name} data:`,n.data),p(this,X,ue).call(this,{isDialogOpen:!0,dialog:o})};this.addEventListener("error",t),this.media&&(this.media.errorTranslator=(r={})=>{var o,c,b;if(!((o=this.media)!=null&&o.error))return r;let{devlog:n}=Fe((c=this.media)==null?void 0:c.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:n.message?String(n.message):r.player_error_message}}),(i=this.media)==null||i.addEventListener("error",r=>{var o,c;let{detail:n}=r;if(!n){let{message:b,code:f}=(c=(o=this.media)==null?void 0:o.error)!=null?c:{};n=new pt(b,f)}!(n!=null&&n.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Je=new WeakSet,li=function(){var i,r,n,o;let t=()=>p(this,pe,ze).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",t),(o=(n=this.media)==null?void 0:n.textTracks)==null||o.addEventListener("removetrack",t)},Qe=new WeakSet,di=function(){var v,S,W;let t=this.mediaController,i=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(i)return;let r,n=new WeakMap,o=()=>this.streamType&&[$.LIVE,$.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,c=(E,R,I=!1)=>{if(o())return;Array.from(E&&E.activeCues||[]).forEach(k=>{if(!(!k.snapToLines||k.line<-5||k.line>=0&&k.line<10))if(!R||this.paused){let Se=k.text.split(`
963
+ `).length,ge=i?-2:-3;this.streamType&&[$.LIVE,$.LL_LIVE].includes(this.streamType)&&(ge=i?-1:-2);let re=ge-Se;if(k.line===re&&!I)return;n.has(k)||n.set(k,k.line),k.line=re-1,k.line=re}else setTimeout(()=>{k.line=n.get(k)||"auto"},500)})},b=()=>{var E;c(r,(E=t==null?void 0:t.hasAttribute("user-inactive"))!=null?E:!1)},f=()=>{var I;let R=Array.from(((I=t==null?void 0:t.media)==null?void 0:I.textTracks)||[]).filter(D=>["subtitles","captions"].includes(D.kind)&&D.mode==="showing")[0];R!==r&&(r==null||r.removeEventListener("cuechange",b)),r=R,r==null||r.addEventListener("cuechange",b),c(r,d(this,Z))};if(f(),(v=t==null?void 0:t.media)==null||v.textTracks.addEventListener("change",f),(S=t==null?void 0:t.media)==null||S.textTracks.addEventListener("addtrack",f),navigator.userAgent.includes("Chrome/")){let E=()=>{c(r,d(this,Z),!0),this.paused||window.requestAnimationFrame(E)};(W=t==null?void 0:t.media)==null||W.addEventListener("playing",()=>{E()})}t==null||t.addEventListener("userinactivechange",()=>{let E=t==null?void 0:t.hasAttribute("user-inactive");d(this,Z)!==E&&(A(this,Z,E),c(r,d(this,Z)))})};function ae(e,a){return e.media?e.media.getAttribute(a):e.getAttribute(a)}g.customElements.get("mux-player")||(g.customElements.define("mux-player",we),g.MuxPlayerElement=we);var vo=we;export{pt as MediaError,vo as default,ae as getVideoAttribute};