@mux/mux-player 2.2.0 → 2.3.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,5 +1,5 @@
1
- var Le=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(Le(t,a,"read from private field"),e?e.call(t):a.get(t)),b=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},A=(t,a,e,r)=>(Le(t,a,"write to private field"),r?r.call(t,e):a.set(t,e),e);var f=(t,a,e)=>(Le(t,a,"access private method"),e);var W=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends W{}globalThis.DocumentFragment=t}var z=class extends W{},we=class extends W{},Dt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(z)}},J,Oe=class{constructor(a,e={}){b(this,J,void 0);A(this,J,e==null?void 0:e.detail)}get detail(){return u(this,J)}initCustomEvent(){}};J=new WeakMap;function Vt(t,a){return new z}var at={document:{createElement:Vt},DocumentFragment,customElements:Dt,CustomEvent:Oe,EventTarget:W,HTMLElement:z,HTMLVideoElement:we},it=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=it?at:globalThis,T=it?at.document:globalThis.document;import{MediaController as ma}from"media-chrome";import"media-chrome/dist/experimental/index.js";import ua,{MediaError as ve,Attributes as d}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as ke,addTextTrack as ca,removeTextTrack as pa,CmcdTypeValues as Ot}from"@mux/playback-core";import{VideoEvents as Ft}from"@mux/mux-video";var Ht="en",B={code:Ht};var rt="en";function l(t,a=!0){var i,o;let e=a&&(o=(i=B)==null?void 0:i[t])!=null?o:t,r=a?B.code:rt;return new Re(e,r)}var Re=class{constructor(a,e=(r=>(r=B.code)!=null?r:rt)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,r)=>{var i;return(i=a[r])!=null?i:""})}toString(){return this.message}};function ot(t){let a="";return Object.entries(t).forEach(([e,r])=>{r!=null&&(a+=`${le(e)}: ${r}; `)}),a?a.trim():void 0}function le(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function me(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function O(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function Me(t){let a=Bt(t).toString();return a?"?"+a:""}function Bt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function N(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(e).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}var Se=(t,a)=>!t||!a?!1:t.contains(a)?!0:Se(t,a.getRootNode().host);import{StreamTypes as _e}from"@mux/playback-core";var nt="mux.com",Ut=()=>{try{return"2.2.0"}catch{}return"UNKNOWN"},$t=Ut(),ce=()=>$t,st=(t,{token:a,customDomain:e=nt,thumbnailTime:r}={})=>{let i=a==null?r:void 0,{aud:o}=N(a);if(!(a&&o!=="t"))return`https://image.${e}/${t}/thumbnail.webp${Me({token:a,time:i})}`},dt=(t,{token:a,customDomain:e=nt}={})=>{let{aud:r}=N(a);if(!(a&&r!=="s"))return`https://image.${e}/${t}/storyboard.vtt${Me({token:a,format:"webp"})}`},X=t=>{if(!!t){if([_e.LIVE,_e.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return _e.LIVE}};var Kt={crossorigin:"crossOrigin",playsinline:"playsInline"};function lt(t){var a;return(a=Kt[t])!=null?a:me(t)}var U,$,k,ue=class{constructor(a,e){b(this,U,void 0);b(this,$,void 0);b(this,k,[]);A(this,U,a),A(this,$,e)}[Symbol.iterator](){return u(this,k).values()}get length(){return u(this,k).length}get value(){var a;return(a=u(this,k).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(A(this,k,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,k)[a]}values(){return u(this,k).values()}keys(){return u(this,k).keys()}forEach(a){u(this,k).forEach(a)}add(...a){var e,r;a.forEach(i=>{this.contains(i)||u(this,k).push(i)}),!(this.value===""&&!((e=u(this,U))!=null&&e.hasAttribute(`${u(this,$)}`)))&&((r=u(this,U))==null||r.setAttribute(`${u(this,$)}`,`${this.value}`))}remove(...a){var e;a.forEach(r=>{u(this,k).splice(u(this,k).indexOf(r),1)}),(e=u(this,U))==null||e.setAttribute(`${u(this,$)}`,`${this.value}`)}contains(a){return u(this,k).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};U=new WeakMap,$=new WeakMap,k=new WeakMap;var mt=`[mux-player ${ce()}]`;function I(...t){console.warn(mt,...t)}function L(...t){console.error(mt,...t)}function Pe(t){var e;let a=(e=t.message)!=null?e:"";if(t.context&&(a+=` ${t.context}`),t.file){let r="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${l("Read more: ")}
2
- ${r}${t.file}`}I(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},K={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ct=Object.freeze({length:0,start(t){let a=t>>>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(t){let a=t>>>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}}),Yt=Ft.filter(t=>t!=="error"),Wt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Zt=Object.values(K);function pt(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),Yt.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,r=>{t.dispatchEvent(new Event(r.type))})})}var Ne=class extends c.HTMLElement{static get observedAttributes(){return[...Wt,...Zt]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(r=>{var i;(i=this.media)==null||i.append(r.cloneNode())});let a=r=>{for(let i of r)i.type==="childList"&&(i.removedNodes.forEach(o=>{var m,h;let s=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);s&&((h=this.media)==null||h.removeChild(s))}),i.addedNodes.forEach(o=>{var s;(s=this.media)==null||s.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,r){var i,o;switch(a){case K.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case K.VOLUME:{let s=(i=O(r))!=null?i:1;this.media&&(this.media.volume=s);return}case K.PLAYBACKRATE:{let s=(o=O(r))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:ct}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:ct}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=O(this.getAttribute(K.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(K.PLAYBACKRATE,`${a}`):this.removeAttribute(K.PLAYBACKRATE)}get crossOrigin(){return Q(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return Q(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return Q(this,y.LOOP)!=null}set loop(a){a?this.setAttribute(y.LOOP,""):this.removeAttribute(y.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return Q(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return Q(this,y.PLAYSINLINE)!=null}set playsInline(a){L("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(y.PRELOAD,a):this.removeAttribute(y.PRELOAD)}};function Q(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ie=Ne;import"media-chrome/dist/media-theme-element.js";var bt=`:host {
1
+ var Ce=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var u=(t,a,e)=>(Ce(t,a,"read from private field"),e?e.call(t):a.get(t)),h=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},C=(t,a,e,i)=>(Ce(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var g=(t,a,e)=>(Ce(t,a,"access private method"),e);var W=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends W{}globalThis.DocumentFragment=t}var z=class extends W{},xe=class extends W{},Bt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(z)}},X,Le=class{constructor(a,e={}){h(this,X,void 0);C(this,X,e==null?void 0:e.detail)}get detail(){return u(this,X)}initCustomEvent(){}};X=new WeakMap;function Ut(t,a){return new z}var rt={document:{createElement:Ut},DocumentFragment,customElements:Bt,CustomEvent:Le,EventTarget:W,HTMLElement:z,HTMLVideoElement:xe},ot=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=ot?rt:globalThis,T=ot?rt.document:globalThis.document;import{MediaController as ha}from"media-chrome";import{Attributes as He}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Mt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ga,{MediaError as fe,Attributes as d}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as ye,addTextTrack as fa,removeTextTrack as ya,CmcdTypeValues as St}from"@mux/playback-core";import{VideoEvents as Zt}from"@mux/mux-video";var $t="en",B={code:$t};var nt="en";function l(t,a=!0){var r,o;let e=a&&(o=(r=B)==null?void 0:r[t])!=null?o:t,i=a?B.code:nt;return new Re(e,i)}var Re=class{constructor(a,e=(i=>(i=B.code)!=null?i:nt)()){this.message=a,this.locale=e}format(a){return this.message.replace(/\{(\w+)\}/g,(e,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function st(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${se(e)}: ${i}; `)}),a?a.trim():void 0}function se(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function de(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function R(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function we(t){let a=Kt(t).toString();return a?"?"+a:""}function Kt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function P(t){let a=(t!=null?t:"").split(".")[1];if(!a)return{};let e=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var Oe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Oe(t,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var dt="mux.com",Ft=()=>{try{return"2.3.0"}catch{}return"UNKNOWN"},Yt=Ft(),me=()=>Yt,lt=(t,{token:a,customDomain:e=dt,thumbnailTime:i}={})=>{let r=a==null?i:void 0,{aud:o}=P(a);if(!(a&&o!=="t"))return`https://image.${e}/${t}/thumbnail.webp${we({token:a,time:r})}`},mt=(t,{token:a,customDomain:e=dt}={})=>{let{aud:i}=P(a);if(!(a&&i!=="s"))return`https://image.${e}/${t}/storyboard.vtt${we({token:a,format:"webp"})}`},J=t=>{if(t){if([Me.LIVE,Me.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Me.LIVE}};var Wt={crossorigin:"crossOrigin",playsinline:"playsInline"};function ut(t){var a;return(a=Wt[t])!=null?a:de(t)}var U,$,E,le=class{constructor(a,e){h(this,U,void 0);h(this,$,void 0);h(this,E,[]);C(this,U,a),C(this,$,e)}[Symbol.iterator](){return u(this,E).values()}get length(){return u(this,E).length}get value(){var a;return(a=u(this,E).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(C(this,E,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,E)[a]}values(){return u(this,E).values()}keys(){return u(this,E).keys()}forEach(a){u(this,E).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,E).push(r)}),!(this.value===""&&!((e=u(this,U))!=null&&e.hasAttribute(`${u(this,$)}`)))&&((i=u(this,U))==null||i.setAttribute(`${u(this,$)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,E).splice(u(this,E).indexOf(i),1)}),(e=u(this,U))==null||e.setAttribute(`${u(this,$)}`,`${this.value}`)}contains(a){return u(this,E).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};U=new WeakMap,$=new WeakMap,E=new WeakMap;var ct=`[mux-player ${me()}]`;function N(...t){console.warn(ct,...t)}function x(...t){console.error(ct,...t)}function Se(t){var e;let a=(e=t.message)!=null?e:"";if(t.context&&(a+=` ${t.context}`),t.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${l("Read more: ")}
2
+ ${i}${t.file}`}N(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},K={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},bt=Object.freeze({length:0,start(t){let a=t>>>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(t){let a=t>>>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}}),jt=Zt.filter(t=>t!=="error"),Gt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),qt=Object.values(K);function ht(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),jt.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var _e=class extends c.HTMLElement{static get observedAttributes(){return[...Gt,...qt]}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(o=>{var m,p;let s=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);s&&((p=this.media)==null||p.removeChild(s))}),r.addedNodes.forEach(o=>{var s;(s=this.media)==null||s.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,i){var r,o;switch(a){case K.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case K.VOLUME:{let s=(r=R(i))!=null?r:1;this.media&&(this.media.volume=s);return}case K.PLAYBACKRATE:{let s=(o=R(i))!=null?o:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:bt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:bt}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=R(this.getAttribute(K.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(K.PLAYBACKRATE,`${a}`):this.removeAttribute(K.PLAYBACKRATE)}get crossOrigin(){return Q(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return Q(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return Q(this,y.LOOP)!=null}set loop(a){a?this.setAttribute(y.LOOP,""):this.removeAttribute(y.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return Q(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return Q(this,y.PLAYSINLINE)!=null}set playsInline(a){x("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(y.PRELOAD,a):this.removeAttribute(y.PRELOAD)}};function Q(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Pe=_e;import"media-chrome/dist/media-theme-element.js";var gt=`:host {
3
3
  --media-control-display: var(--controls);
4
4
  --media-loading-indicator-display: var(--loading-indicator);
5
5
  --media-dialog-display: var(--dialog);
@@ -17,6 +17,7 @@ ${r}${t.file}`}I(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"l
17
17
  --media-fullscreen-button-display: var(--fullscreen-button);
18
18
  --media-cast-button-display: var(--cast-button);
19
19
  --media-playback-rate-button-display: var(--playback-rate-button);
20
+ --media-playback-rate-selectmenu-display: var(--playback-rate-selectmenu);
20
21
  --media-volume-range-display: var(--volume-range);
21
22
  --media-time-range-display: var(--time-range);
22
23
  --media-time-display-display: var(--time-display);
@@ -74,6 +75,10 @@ media-poster-image:not([src]):not([placeholdersrc]) {
74
75
  --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button));
75
76
  --media-cast-button-display: var(--cast-button, var(--top-cast-button));
76
77
  --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button));
78
+ --media-playback-rate-selectmenu-display: var(
79
+ --captions-selectmenu,
80
+ var(--media-playback-rate-button-display, var(--top-playback-rate-selectmenu))
81
+ );
77
82
  --media-volume-range-display: var(--volume-range, var(--top-volume-range));
78
83
  --media-time-range-display: var(--time-range, var(--top-time-range));
79
84
  --media-time-display-display: var(--time-display, var(--top-time-display));
@@ -101,6 +106,10 @@ media-poster-image:not([src]):not([placeholdersrc]) {
101
106
  --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button));
102
107
  --media-cast-button-display: var(--cast-button, var(--center-cast-button));
103
108
  --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button));
109
+ --media-playback-rate-selectmenu-display: var(
110
+ --playback-rate-selectmenu,
111
+ var(--media-playback-rate-button-display, var(--center-playback-rate-selectmenu))
112
+ );
104
113
  --media-volume-range-display: var(--volume-range, var(--center-volume-range));
105
114
  --media-time-range-display: var(--time-range, var(--center-time-range));
106
115
  --media-time-display-display: var(--time-display, var(--center-time-display));
@@ -127,13 +136,17 @@ media-poster-image:not([src]):not([placeholdersrc]) {
127
136
  --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button));
128
137
  --media-cast-button-display: var(--cast-button, var(--bottom-cast-button));
129
138
  --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button));
139
+ --media-playback-rate-selectmenu-display: var(
140
+ --playback-rate-selectmenu,
141
+ var(--media-playback-rate-button-display, var(--bottom-playback-rate-selectmenu))
142
+ );
130
143
  --media-volume-range-display: var(--volume-range, var(--bottom-volume-range));
131
144
  --media-time-range-display: var(--time-range, var(--bottom-time-range));
132
145
  --media-time-display-display: var(--time-display, var(--bottom-time-display));
133
146
  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));
134
147
  --media-title-display-display: var(--title-display, var(--bottom-title-display));
135
148
  }
136
- `;var gt=`
149
+ `;var yt=`
137
150
  :host {
138
151
  z-index: 100;
139
152
  display: var(--media-dialog-display, flex);
@@ -185,17 +198,17 @@ media-poster-image:not([src]):not([placeholdersrc]) {
185
198
  text-align: center;
186
199
  line-height: 1.4;
187
200
  }
188
- `,ft=T.createElement("template");ft.innerHTML=`
201
+ `,vt=T.createElement("template");vt.innerHTML=`
189
202
  <style>
190
- ${gt}
203
+ ${yt}
191
204
  </style>
192
205
 
193
206
  <div class="dialog">
194
207
  <slot></slot>
195
208
  </div>
196
- `;var D=class extends c.HTMLElement{constructor(){var e;super();this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),ht(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),qt(this))}attributeChangedCallback(e,r,i){e==="open"&&r!==i&&(i!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&ht(this)}};D.styles=gt,D.template=ft,D.observedAttributes=["open"];function ht(t){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(t.dispatchEvent(a),a.defaultPrevented)return;let e=t.querySelector("[autofocus]:not([disabled])");!e&&t.tabIndex>=0&&(e=t),e||(e=yt(t.shadowRoot)),t._previouslyFocusedElement=T.activeElement,T.activeElement instanceof HTMLElement&&T.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function yt(t){let e=["button","input","keygen","select","textarea"].map(function(i){return i+":not([disabled])"});e.push('[tabindex]:not([disabled]):not([tabindex=""])');let r=t==null?void 0:t.querySelector(e.join(", "));if(!r&&"attachShadow"in Element.prototype){let i=(t==null?void 0:t.querySelectorAll("*"))||[];for(let o=0;o<i.length&&!(i[o].tagName&&i[o].shadowRoot&&(r=yt(i[o].shadowRoot),r));o++);}return r}function qt(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}c.customElements.get("media-dialog")||(c.customElements.define("media-dialog",D),c.MediaDialog=D);var De=D;var vt=T.createElement("template");vt.innerHTML=`
209
+ `;var I=class extends c.HTMLElement{constructor(){var e;super();this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),ft(this)}close(){this.hasAttribute("open")&&(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),Xt(this))}attributeChangedCallback(e,i,r){e==="open"&&i!==r&&(r!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&ft(this)}};I.styles=yt,I.template=vt,I.observedAttributes=["open"];function ft(t){let a=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(t.dispatchEvent(a),a.defaultPrevented)return;let e=t.querySelector("[autofocus]:not([disabled])");!e&&t.tabIndex>=0&&(e=t),e||(e=Et(t.shadowRoot)),t._previouslyFocusedElement=T.activeElement,T.activeElement instanceof HTMLElement&&T.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function Et(t){let e=["button","input","keygen","select","textarea"].map(function(r){return r+":not([disabled])"});e.push('[tabindex]:not([disabled]):not([tabindex=""])');let i=t==null?void 0:t.querySelector(e.join(", "));if(!i&&"attachShadow"in Element.prototype){let r=(t==null?void 0:t.querySelectorAll("*"))||[];for(let o=0;o<r.length&&!(r[o].tagName&&r[o].shadowRoot&&(i=Et(r[o].shadowRoot),i));o++);}return i}function Xt(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}c.customElements.get("media-dialog")||(c.customElements.define("media-dialog",I),c.MediaDialog=I);var Ne=I;var kt=T.createElement("template");kt.innerHTML=`
197
210
  <style>
198
- ${De.styles}
211
+ ${Ne.styles}
199
212
 
200
213
  .close {
201
214
  background: none;
@@ -224,85 +237,86 @@ media-poster-image:not([src]):not([placeholdersrc]) {
224
237
  </svg>
225
238
  </button>
226
239
  </slot>
227
- `;var ee=class extends De{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ee.template=vt;c.customElements.get("mxp-dialog")||(c.customElements.define("mxp-dialog",ee),c.MxpDialog=ee);import{TemplateInstance as Gt,ChildNodePart as be,AttrPart as he}from"media-chrome/dist/media-theme-element.js";var te=new WeakMap,ae=class{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let r=te.get(this.element);r&&r.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 e=te.get(this.element);e&&e.delete(this.type)}}static for(a){te.has(a.element)||te.set(a.element,new Map);let e=a.attributeName.slice(2),r=te.get(a.element);return r&&r.has(e)?r.get(e):new ae(a.element,e)}};function zt(t,a){return t instanceof he&&t.attributeName.startsWith("on")?(ae.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function Jt(t,a){return a instanceof pe&&t instanceof be?(a.renderInto(t),!0):!1}function Xt(t,a){return a instanceof DocumentFragment&&t instanceof be?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Qt(t,a){if(t instanceof he){let e=t.attributeNamespace,r=t.element.getAttributeNS(e,t.attributeName);return String(a)!==r&&(t.value=String(a)),!0}return t.value=String(a),!0}function ea(t,a){if(t instanceof he&&a instanceof Element){let e=t.element;return e[t.attributeName]!==a&&(t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),e[t.attributeName]=a),!0}return!1}function ta(t,a){if(typeof a=="boolean"&&t instanceof he){let e=t.attributeNamespace,r=t.element.hasAttributeNS(e,t.attributeName);return a!==r&&(t.booleanValue=a),!0}return!1}function aa(t,a){return a===!1&&t instanceof be?(t.replace(""),!0):!1}function ia(t,a){ea(t,a)||ta(t,a)||zt(t,a)||aa(t,a)||Jt(t,a)||Xt(t,a)||Qt(t,a)}var Ve=new Map,kt=new WeakMap,Et=new WeakMap,pe=class{constructor(a,e,r){this.strings=a;this.values=e;this.processor=r;this.stringsKey=this.strings.join("")}get template(){if(Ve.has(this.stringsKey))return Ve.get(this.stringsKey);{let a=T.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((r,i,o)=>r+i+(o<e?`{{ ${o} }}`:""),""),Ve.set(this.stringsKey,a),a}}renderInto(a){var i;let e=this.template;if(kt.get(a)!==e){kt.set(a,e);let o=new Gt(e,this.values,this.processor);Et.set(a,o),a instanceof be?a.replace(...o.children):a.appendChild(o);return}let r=Et.get(a);(i=r==null?void 0:r.update)==null||i.call(r,this.values)}},ra={processCallback(t,a,e){var r;if(!!e){for(let[i,o]of a)if(i in e){let s=(r=e[i])!=null?r:"";ia(o,s)}}}};function R(t,...a){return new pe(t,a,ra)}function Tt(t,a){t.renderInto(a)}import{StreamTypes as oa,toMuxVideoURL as Ct}from"@mux/playback-core";var At=t=>R`
240
+ `;var ee=class extends Ne{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ee.template=kt;c.customElements.get("mxp-dialog")||(c.customElements.define("mxp-dialog",ee),c.MxpDialog=ee);import{TemplateInstance as Jt,ChildNodePart as ce,AttrPart as pe}from"media-chrome/dist/media-theme-element.js";var te=new WeakMap,De=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=te.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 e=te.get(this.element);e&&e.delete(this.type)}}static for(a){te.has(a.element)||te.set(a.element,new Map);let e=a.attributeName.slice(2),i=te.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function Qt(t,a){return t instanceof pe&&t.attributeName.startsWith("on")?(De.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function ea(t,a){return a instanceof ue&&t instanceof ce?(a.renderInto(t),!0):!1}function ta(t,a){return a instanceof DocumentFragment&&t instanceof ce?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function aa(t,a){if(t instanceof pe){let e=t.attributeNamespace,i=t.element.getAttributeNS(e,t.attributeName);return String(a)!==i&&(t.value=String(a)),!0}return t.value=String(a),!0}function ia(t,a){if(t instanceof pe&&a instanceof Element){let e=t.element;return e[t.attributeName]!==a&&(t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),e[t.attributeName]=a),!0}return!1}function ra(t,a){if(typeof a=="boolean"&&t instanceof pe){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function oa(t,a){return a===!1&&t instanceof ce?(t.replace(""),!0):!1}function na(t,a){ia(t,a)||ra(t,a)||Qt(t,a)||oa(t,a)||ea(t,a)||ta(t,a)||aa(t,a)}var Ie=new Map,Tt=new WeakMap,At=new WeakMap,ue=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(Ie.has(this.stringsKey))return Ie.get(this.stringsKey);{let a=T.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,o)=>i+r+(o<e?`{{ ${o} }}`:""),""),Ie.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(Tt.get(a)!==e){Tt.set(a,e);let o=new Jt(e,this.values,this.processor);At.set(a,o),a instanceof ce?a.replace(...o.children):a.appendChild(o);return}let i=At.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},sa={processCallback(t,a,e){var i;if(e){for(let[r,o]of a)if(r in e){let s=(i=e[r])!=null?i:"";na(o,s)}}}};function O(t,...a){return new ue(t,a,sa)}function Ct(t,a){t.renderInto(a)}import{StreamTypes as da,toMuxVideoURL as xt}from"@mux/playback-core";var Lt=t=>O`
228
241
  <style>
229
- ${bt}
242
+ ${gt}
230
243
  </style>
231
- ${sa(t)}
232
- `,na=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return X(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},sa=t=>{var a,e,r,i,o,s,m,h,x,E,_,g,v,C,P,p,de,G,Y,$e,Ke,Fe,Ye,We,Ze,je,qe,Ge,ze,Je,Xe,Qe,et,tt;return R`
244
+ ${ca(t)}
245
+ `,la=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return J(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},ma={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",SELECTMENU:"selectmenu",LISTBOX:"listbox",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},ua=Object.values(ma).join(", "),ca=t=>{var a,e,i,r,o,s,m,p,L,k,v,f,A,_,b,H,G,q,$e,Ke,Fe,Ye,We,Ze,je,Ge,qe,ze,Xe,Je,Qe,et,tt,at,it;return O`
233
246
  <media-theme
234
247
  template="${t.themeTemplate||!1}"
235
248
  defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
236
- hotkeys="${na(t)||!1}"
249
+ hotkeys="${la(t)||!1}"
237
250
  nohotkeys="${t.noHotKeys||!t.hasSrc||t.isDialogOpen||!1}"
238
- noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(oa.LIVE))&&t.targetLiveWindow!==0}"
251
+ noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(da.LIVE))&&t.targetLiveWindow!==0}"
239
252
  novolumepref="${t.novolumepref||!1}"
240
253
  disabled="${!t.hasSrc||t.isDialogOpen}"
241
- audio="${(r=t.audio)!=null?r:!1}"
242
- style="${(i=ot({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?i:!1}"
254
+ audio="${(i=t.audio)!=null?i:!1}"
255
+ style="${(r=st({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
243
256
  defaultsubtitles="${!t.defaultHiddenCaptions}"
244
257
  forwardseekoffset="${(o=t.forwardSeekOffset)!=null?o:!1}"
245
258
  backwardseekoffset="${(s=t.backwardSeekOffset)!=null?s:!1}"
246
259
  playbackrates="${(m=t.playbackRates)!=null?m:!1}"
247
- defaultshowremainingtime="${(h=t.defaultShowRemainingTime)!=null?h:!1}"
248
- hideduration="${(x=t.hideDuration)!=null?x:!1}"
249
- title="${(E=t.title)!=null?E:!1}"
250
- exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, controller, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display, control-bar"
260
+ defaultshowremainingtime="${(p=t.defaultShowRemainingTime)!=null?p:!1}"
261
+ defaultduration="${(L=t.defaultDuration)!=null?L:!1}"
262
+ hideduration="${(k=t.hideDuration)!=null?k:!1}"
263
+ title="${(v=t.title)!=null?v:!1}"
264
+ exportparts="${ua}"
251
265
  >
252
266
  <mux-video
253
267
  slot="media"
254
- target-live-window="${(_=t.targetLiveWindow)!=null?_:!1}"
255
- stream-type="${(g=X(t.streamType))!=null?g:!1}"
256
- crossorigin="${(v=t.crossOrigin)!=null?v:""}"
268
+ target-live-window="${(f=t.targetLiveWindow)!=null?f:!1}"
269
+ stream-type="${(A=J(t.streamType))!=null?A:!1}"
270
+ crossorigin="${(_=t.crossOrigin)!=null?_:""}"
257
271
  playsinline
258
- autoplay="${(C=t.autoplay)!=null?C:!1}"
259
- muted="${(P=t.muted)!=null?P:!1}"
260
- loop="${(p=t.loop)!=null?p:!1}"
261
- preload="${(de=t.preload)!=null?de:!1}"
262
- debug="${(G=t.debug)!=null?G:!1}"
263
- prefer-cmcd="${(Y=t.preferCmcd)!=null?Y:!1}"
264
- disable-cookies="${($e=t.disableCookies)!=null?$e:!1}"
265
- prefer-playback="${(Ke=t.preferPlayback)!=null?Ke:!1}"
272
+ autoplay="${(b=t.autoplay)!=null?b:!1}"
273
+ muted="${(H=t.muted)!=null?H:!1}"
274
+ loop="${(G=t.loop)!=null?G:!1}"
275
+ preload="${(q=t.preload)!=null?q:!1}"
276
+ debug="${($e=t.debug)!=null?$e:!1}"
277
+ prefer-cmcd="${(Ke=t.preferCmcd)!=null?Ke:!1}"
278
+ disable-cookies="${(Fe=t.disableCookies)!=null?Fe:!1}"
279
+ prefer-playback="${(Ye=t.preferPlayback)!=null?Ye:!1}"
266
280
  start-time="${t.startTime!=null?t.startTime:!1}"
267
- beacon-collection-domain="${(Fe=t.beaconCollectionDomain)!=null?Fe:!1}"
268
- player-software-name="${(Ye=t.playerSoftwareName)!=null?Ye:!1}"
269
- player-software-version="${(We=t.playerSoftwareVersion)!=null?We:!1}"
270
- env-key="${(Ze=t.envKey)!=null?Ze:!1}"
271
- custom-domain="${(je=t.customDomain)!=null?je:!1}"
272
- src="${t.src?t.src:t.playbackId?Ct(t):!1}"
273
- cast-src="${t.src?t.src:t.playbackId?Ct(t):!1}"
281
+ beacon-collection-domain="${(We=t.beaconCollectionDomain)!=null?We:!1}"
282
+ player-software-name="${(Ze=t.playerSoftwareName)!=null?Ze:!1}"
283
+ player-software-version="${(je=t.playerSoftwareVersion)!=null?je:!1}"
284
+ env-key="${(Ge=t.envKey)!=null?Ge:!1}"
285
+ custom-domain="${(qe=t.customDomain)!=null?qe:!1}"
286
+ src="${t.src?t.src:t.playbackId?xt(t):!1}"
287
+ cast-src="${t.src?t.src:t.playbackId?xt(t):!1}"
274
288
  exportparts="video"
275
289
  >
276
- ${t.storyboard?R`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:R``}
290
+ ${t.storyboard?O`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:O``}
277
291
  </mux-video>
278
292
  <slot name="poster" slot="poster">
279
293
  <media-poster-image
280
294
  part="poster"
281
295
  exportparts="poster, img"
282
- src="${t.poster===""?!1:(qe=t.poster)!=null?qe:!1}"
283
- placeholdersrc="${(Ge=t.placeholder)!=null?Ge:!1}"
296
+ src="${t.poster===""?!1:(ze=t.poster)!=null?ze:!1}"
297
+ placeholdersrc="${(Xe=t.placeholder)!=null?Xe:!1}"
284
298
  ></media-poster-image>
285
299
  </slot>
286
300
  <mxp-dialog
287
301
  no-auto-hide
288
- open="${(ze=t.isDialogOpen)!=null?ze:!1}"
302
+ open="${(Je=t.isDialogOpen)!=null?Je:!1}"
289
303
  onclose="${t.onCloseErrorDialog}"
290
304
  oninitfocus="${t.onInitFocusDialog}"
291
305
  >
292
- ${(Je=t.dialog)!=null&&Je.title?R`<h3>${t.dialog.title}</h3>`:R``}
306
+ ${(Qe=t.dialog)!=null&&Qe.title?O`<h3>${t.dialog.title}</h3>`:O``}
293
307
  <p>
294
- ${(Xe=t.dialog)==null?void 0:Xe.message}
295
- ${(Qe=t.dialog)!=null&&Qe.linkUrl?R`<a
308
+ ${(et=t.dialog)==null?void 0:et.message}
309
+ ${(tt=t.dialog)!=null&&tt.linkUrl?O`<a
296
310
  href="${t.dialog.linkUrl}"
297
311
  target="_blank"
298
312
  rel="external noopener"
299
- aria-label="${(et=t.dialog.linkText)!=null?et:""} ${l("(opens in a new window)")}"
300
- >${(tt=t.dialog.linkText)!=null?tt:t.dialog.linkUrl}</a
301
- >`:R``}
313
+ aria-label="${(at=t.dialog.linkText)!=null?at:""} ${l("(opens in a new window)")}"
314
+ >${(it=t.dialog.linkText)!=null?it:t.dialog.linkUrl}</a
315
+ >`:O``}
302
316
  </p>
303
317
  </mxp-dialog>
304
318
  </media-theme>
305
- `};import{MediaError as ge}from"@mux/mux-video";function fe(t,a,e,r,i){var m,h,x;let o={},s={};switch(t.code){case ge.MEDIA_ERR_NETWORK:{switch(o.title=l("Network Error",i),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=l("Video is not currently available",i),o.message=l("The live stream or video file are not yet ready.",i),s.message=l("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",i),s.file="412-not-playable.md";break}case 404:{o.title=l("Video does not exist",i),o.message="",s.message=l("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",i),s.file="404-not-found.md";break}case 403:{if(o.title=l("Invalid playback URL",i),o.message=l("The video URL or playback-token are formatted with incorrect or incomplete information.",i),s.message=l("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",i),s.file="missing-signed-tokens.md",!r)break;let{exp:E,aud:_,sub:g}=N(r),v=Date.now()>E*1e3,C=g!==e,P=_!=="v",p={timeStyle:"medium",dateStyle:"medium"};if(v){o.title=l("Video URL has expired",i),o.message=l("The video\u2019s secured playback-token has expired.",i),s.message=l("The video\u2019s secured playback-token has expired.",i),s.context=l("Expired at: {expiredDate}. Current time: {currentDate}.",i).format({expiredDate:new Intl.DateTimeFormat(B.code,p).format(E*1e3),currentDate:new Intl.DateTimeFormat(B.code,p).format(Date.now())}),s.file="403-expired-token.md";break}if(C){o.title=l("Video URL is formatted incorrectly",i),o.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),s.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),s.context=l("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",i).format({playbackId:e,tokenPlaybackId:g}),s.file="403-playback-id-mismatch.md";break}if(P){o.title=l("Video URL is formatted incorrectly",i),o.message=l("The playback-token is formatted with incorrect information.",i),s.message=l("The playback-token is formatted with incorrect information.",i),s.context=l("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",i).format({tokenType:_}),s.file="403-incorrect-aud-value.md";break}s.message=l("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",i),s.file="403-malformatted-token.md";break}}break}case ge.MEDIA_ERR_DECODE:{let{message:E}=t;o={title:l("Media Error",i),message:E},s.file="media-decode-error.md";break}case ge.MEDIA_ERR_SRC_NOT_SUPPORTED:{let E=(x=(h=t.data)==null?void 0:h.response)==null?void 0:x.code;if(E>=400&&E<500){t.code=ge.MEDIA_ERR_NETWORK,t.data={response:{code:E}},{dialog:o,devlog:s}=fe(t,a,e,r);break}o={title:l("Source Not Supported",i),message:t.message},s.file="media-src-not-supported.md";break}default:o={title:l("Error",i),message:t.message};break}return a&&(o={title:l("Your device appears to be offline",i),message:l("Check your internet connection and try reloading this video.",i)}),{dialog:o,devlog:s}}var xt=`<template id="media-theme-gerwig">
319
+ `};import{MediaError as be}from"@mux/mux-video";function he(t,a,e,i,r){var m,p,L;let o={},s={};switch(t.code){case be.MEDIA_ERR_NETWORK:{switch(o.title=l("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=l("Video is not currently available",r),o.message=l("The live stream or video file are not yet ready.",r),s.message=l("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),s.file="412-not-playable.md";break}case 404:{o.title=l("Video does not exist",r),o.message="",s.message=l("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),s.file="404-not-found.md";break}case 403:{if(o.title=l("Invalid playback URL",r),o.message=l("The video URL or playback-token are formatted with incorrect or incomplete information.",r),s.message=l("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),s.file="missing-signed-tokens.md",!i)break;let{exp:k,aud:v,sub:f}=P(i),A=Date.now()>k*1e3,_=f!==e,b=v!=="v",H={timeStyle:"medium",dateStyle:"medium"};if(A){o.title=l("Video URL has expired",r),o.message=l("The video\u2019s secured playback-token has expired.",r),s.message=l("The video\u2019s secured playback-token has expired.",r),s.context=l("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(B.code,H).format(k*1e3),currentDate:new Intl.DateTimeFormat(B.code,H).format(Date.now())}),s.file="403-expired-token.md";break}if(_){o.title=l("Video URL is formatted incorrectly",r),o.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),s.context=l("Specified playback ID: {playbackId} and the playback ID encoded in the playback-token: {tokenPlaybackId}",r).format({playbackId:e,tokenPlaybackId:f}),s.file="403-playback-id-mismatch.md";break}if(b){o.title=l("Video URL is formatted incorrectly",r),o.message=l("The playback-token is formatted with incorrect information.",r),s.message=l("The playback-token is formatted with incorrect information.",r),s.context=l("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:v}),s.file="403-incorrect-aud-value.md";break}s.message=l("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),s.file="403-malformatted-token.md";break}}break}case be.MEDIA_ERR_DECODE:{let{message:k}=t;o={title:l("Media Error",r),message:k},s.file="media-decode-error.md";break}case be.MEDIA_ERR_SRC_NOT_SUPPORTED:{let k=(L=(p=t.data)==null?void 0:p.response)==null?void 0:L.code;if(k>=400&&k<500){t.code=be.MEDIA_ERR_NETWORK,t.data={response:{code:k}},{dialog:o,devlog:s}=he(t,a,e,i);break}o={title:l("Source Not Supported",r),message:t.message},s.file="media-src-not-supported.md";break}default:o={title:l("Error",r),message:t.message};break}return a&&(o={title:l("Your device appears to be offline",r),message:l("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:s}}var Rt=`<template id="media-theme-gerwig">
306
320
  <style>
307
321
  @keyframes pre-play-hide {
308
322
  0% {
@@ -345,6 +359,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
345
359
  }
346
360
 
347
361
  :host([audio]) {
362
+ --_secondary-color: var(--media-secondary-color, black);
348
363
  --media-preview-time-border-radius: 3px;
349
364
  --media-preview-time-margin: 0 0 5px;
350
365
  --media-preview-time-text-shadow: none;
@@ -368,6 +383,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
368
383
 
369
384
  :host([audio]) media-control-bar {
370
385
  width: 100%;
386
+ background-color: var(--media-control-background);
371
387
  }
372
388
 
373
389
  /*
@@ -375,10 +391,11 @@ media-poster-image:not([src]):not([placeholdersrc]) {
375
391
  * Borrowed here, so the captions don't move too fast.
376
392
  */
377
393
  media-controller ::slotted([slot='media']) {
394
+ --media-webkit-text-track-transform: translateY(0) scale(0.98);
378
395
  --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;
379
396
  }
380
397
  media-controller:is([mediapaused], :not([userinactive])) ::slotted([slot='media']) {
381
- --media-webkit-text-track-transform: translateY(-50px);
398
+ --media-webkit-text-track-transform: translateY(-50px) scale(0.98);
382
399
  --media-webkit-text-track-transition: transform 0.15s ease;
383
400
  }
384
401
 
@@ -697,7 +714,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
697
714
  opacity: 1;
698
715
  }
699
716
 
700
- media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
717
+ media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {
701
718
  opacity: 0;
702
719
  transition-delay: 400ms;
703
720
  }
@@ -785,6 +802,19 @@ media-poster-image:not([src]):not([placeholdersrc]) {
785
802
  media-mute-button[mediavolumelevel='off'] .muted {
786
803
  opacity: 1;
787
804
  }
805
+
806
+ /**
807
+ * Our defaults for these buttons are to hide them at small sizes
808
+ * users can override this with CSS
809
+ */
810
+ media-controller:not([breakpointsm]):not([audio]) {
811
+ --bottom-play-button: none;
812
+ --bottom-seek-backward-button: none;
813
+ --bottom-seek-forward-button: none;
814
+ --bottom-time-display: none;
815
+ --bottom-playback-rate-selectmenu: none;
816
+ --bottom-pip-button: none;
817
+ }
788
818
  </style>
789
819
 
790
820
  <template partial="TitleDisplay">
@@ -946,7 +976,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
946
976
  />
947
977
  </svg>
948
978
  </media-captions-button>
949
- <media-captions-listbox slot="listbox" part="bottom captions listbox">
979
+ <media-captions-listbox slot="listbox" exportparts="option" part="bottom captions listbox">
950
980
  <div slot="select-indicator">
951
981
  <style>
952
982
  .listbox-indicator {
@@ -1025,7 +1055,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1025
1055
  d="M16.0072 0H2.0291C0.9185 0 0.0181 0.9003 0.0181 2.011V5.5009C0.357 5.5016 0.6895 5.5275 1.0181 5.5669V2.011C1.0181 1.4536 1.4716 1 2.029 1H16.0072C16.5646 1 17.0181 1.4536 17.0181 2.011V11.9891C17.0181 12.5465 16.5646 13 16.0072 13H8.4358C8.4746 13.3286 8.4999 13.6611 8.4999 13.9999H16.0071C17.1177 13.9999 18.018 13.0996 18.018 11.989V2.011C18.0181 0.9003 17.1178 0 16.0072 0ZM0 6.4999V7.4999C3.584 7.4999 6.5 10.4159 6.5 13.9999H7.5C7.5 9.8642 4.1357 6.4999 0 6.4999ZM0 8.7499V9.7499C2.3433 9.7499 4.25 11.6566 4.25 13.9999H5.25C5.25 11.1049 2.895 8.7499 0 8.7499ZM0.0181 11V14H3.0181C3.0181 12.3431 1.675 11 0.0181 11Z"
1026
1056
  />
1027
1057
  </svg>
1028
- <svg viewBox="0 0 18 14" aria-hidden="true" slot="exist">
1058
+ <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">
1029
1059
  <path
1030
1060
  d="M15.9891 0H2.01103C0.900434 0 3.35947e-05 0.9003 3.35947e-05 2.011V5.5009C0.338934 5.5016 0.671434 5.5275 1.00003 5.5669V2.011C1.00003 1.4536 1.45353 1 2.01093 1H15.9891C16.5465 1 17 1.4536 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H8.41773C8.45653 13.3286 8.48183 13.6611 8.48183 13.9999H15.989C17.0996 13.9999 17.9999 13.0996 17.9999 11.989V2.011C18 0.9003 17.0997 0 15.9891 0ZM-0.0180664 6.4999V7.4999C3.56593 7.4999 6.48193 10.4159 6.48193 13.9999H7.48193C7.48193 9.8642 4.11763 6.4999 -0.0180664 6.4999ZM-0.0180664 8.7499V9.7499C2.32523 9.7499 4.23193 11.6566 4.23193 13.9999H5.23193C5.23193 11.1049 2.87693 8.7499 -0.0180664 8.7499ZM3.35947e-05 11V14H3.00003C3.00003 12.3431 1.65693 11 3.35947e-05 11Z"
1031
1061
  />
@@ -1042,13 +1072,17 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1042
1072
 
1043
1073
  <template partial="PlaybackRateSelect">
1044
1074
  <media-playback-rate-selectmenu
1045
- rates="{{playbackrates}}"
1046
1075
  part="bottom playback-rate selectmenu"
1047
1076
  disabled="{{disabled}}"
1048
1077
  aria-disabled="{{disabled}}"
1049
1078
  >
1050
1079
  <media-playback-rate-button slot="button" part="bottom playback-rate button"></media-playback-rate-button>
1051
- <media-playback-rate-listbox slot="listbox" part="bottom playback-rate listbox"></media-playback-rate-listbox>
1080
+ <media-playback-rate-listbox
1081
+ slot="listbox"
1082
+ rates="{{playbackrates}}"
1083
+ exportparts="option"
1084
+ part="bottom playback-rate listbox"
1085
+ ></media-playback-rate-listbox>
1052
1086
  </media-playback-rate-selectmenu>
1053
1087
  </template>
1054
1088
 
@@ -1088,7 +1122,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1088
1122
  />
1089
1123
  </svg>
1090
1124
  </media-audio-track-button>
1091
- <media-audio-track-listbox slot="listbox" part="bottom audio-track listbox">
1125
+ <media-audio-track-listbox slot="listbox" exportparts="option" part="bottom audio-track listbox">
1092
1126
  <div slot="select-indicator">
1093
1127
  <style>
1094
1128
  .listbox-indicator {
@@ -1123,7 +1157,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1123
1157
  />
1124
1158
  </svg>
1125
1159
  </media-rendition-button>
1126
- <media-rendition-listbox slot="listbox" part="bottom rendition listbox">
1160
+ <media-rendition-listbox slot="listbox" exportparts="option" part="bottom rendition listbox">
1127
1161
  <div slot="select-indicator">
1128
1162
  <style>
1129
1163
  .listbox-indicator {
@@ -1150,6 +1184,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1150
1184
  </template>
1151
1185
 
1152
1186
  <media-controller
1187
+ part="controller"
1153
1188
  defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
1154
1189
  breakpoints="sm:470"
1155
1190
  gesturesdisabled="{{disabled}}"
@@ -1159,13 +1194,14 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1159
1194
  audio="{{audio}}"
1160
1195
  noautoseektolive="{{noautoseektolive}}"
1161
1196
  defaultsubtitles="{{defaultsubtitles}}"
1197
+ defaultduration="{{defaultduration ?? false}}"
1162
1198
  exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
1163
1199
  style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}"
1164
1200
  >
1165
1201
  <slot name="media" slot="media"></slot>
1166
1202
  <slot name="poster" slot="poster"></slot>
1167
1203
 
1168
- <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
1204
+ <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
1169
1205
 
1170
1206
  <template if="!audio">
1171
1207
  <!-- Pre-playback UI -->
@@ -1214,16 +1250,11 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1214
1250
  </template>
1215
1251
  {{>TimeRange}}
1216
1252
  <media-control-bar part="control-bar bottom">
1217
- <template if="breakpointsm">
1218
- {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}}
1219
- </template>
1220
- {{>MuteButton}} {{>VolumeRange}}
1253
+ {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}}
1254
+ {{>VolumeRange}}
1221
1255
  <div class="spacer"></div>
1222
- {{>RenditionSelect}}
1223
- <template if="breakpointsm"> {{>PlaybackRateSelect}} </template>
1224
- {{>AudioTrackSelect}} {{>CaptionsMenuButton}} {{>AirplayButton}} {{>CastButton}}
1225
- <template if="breakpointsm"> {{>PipButton}} </template>
1226
- {{>FullscreenButton}}
1256
+ {{>RenditionSelect}} {{>PlaybackRateSelect}} {{>AudioTrackSelect}} {{>CaptionsMenuButton}} {{>AirplayButton}}
1257
+ {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
1227
1258
  </media-control-bar>
1228
1259
  </template>
1229
1260
 
@@ -1234,15 +1265,12 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1234
1265
  </media-control-bar>
1235
1266
  <template if="targetlivewindow > 0">{{>TimeRange}}</template>
1236
1267
  <media-control-bar part="control-bar bottom">
1237
- <template if="breakpointsm">
1238
- {{>PlayButton}}
1239
- <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
1240
- </template>
1268
+ {{>PlayButton}}
1269
+ <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template>
1241
1270
  {{>MuteButton}} {{>VolumeRange}}
1242
1271
  <div class="spacer"></div>
1243
1272
  {{>RenditionSelect}} {{>AudioTrackSelect}} {{>CaptionsMenuButton}} {{>AirplayButton}} {{>CastButton}}
1244
- <template if="breakpointsm">{{>PipButton}}</template>
1245
- {{>FullscreenButton}}
1273
+ {{>PipButton}} {{>FullscreenButton}}
1246
1274
  </media-control-bar>
1247
1275
  </template>
1248
1276
  </template>
@@ -1258,7 +1286,6 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1258
1286
  {{>MuteButton}}
1259
1287
  <template if="breakpointsm">{{>VolumeRange}}</template>
1260
1288
  {{>TimeDisplay}} {{>TimeRange}}
1261
- <div class="spacer"></div>
1262
1289
  <template if="breakpointsm">{{>PlaybackRateSelect}}</template>
1263
1290
  {{>AirplayButton}} {{>CastButton}}
1264
1291
  </media-control-bar>
@@ -1274,7 +1301,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1274
1301
  <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
1275
1302
  </template>
1276
1303
  <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template>
1277
- <div class="spacer"></div>
1304
+ <template if="!targetlivewindow"><div class="spacer"></div></template>
1278
1305
  {{>AirplayButton}} {{>CastButton}}
1279
1306
  </media-control-bar>
1280
1307
  </template>
@@ -1283,5 +1310,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
1283
1310
  <slot></slot>
1284
1311
  </media-controller>
1285
1312
  </template>
1286
- `;import{MediaThemeElement as la}from"media-chrome/dist/media-theme-element.js";var He=T.createElement("template");"innerHTML"in He&&(He.innerHTML=xt);var Lt,wt,ye=class extends la{};ye.template=(wt=(Lt=He.content)==null?void 0:Lt.children)==null?void 0:wt[0];c.customElements.get("media-theme-gerwig")||c.customElements.define("media-theme-gerwig",ye);var ba="gerwig";var M={SRC:"src",POSTER:"poster"},n={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-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",STORYBOARD_SRC:"storyboard-src",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",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",NO_VOLUME_PREF:"no-volume-pref"},Be=["audio","backwardseekoffset","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function ha(t,a){var r;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(n.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ga(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(n.NOHOTKEYS),hotKeys:t.getAttribute(n.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,renditionOrder:t.renditionOrder,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(d.TARGET_LIVE_WINDOW),streamType:X(t.getAttribute(d.STREAM_TYPE)),primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,accentColor:t.accentColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:fa(t),playbackRates:t.getAttribute(n.PLAYBACK_RATES),customDomain:(r=t.getAttribute(d.CUSTOM_DOMAIN))!=null?r:void 0,title:t.getAttribute(n.TITLE),novolumepref:t.hasAttribute(n.NO_VOLUME_PREF),extraPlaylistParams:{redundant_streams:!0},...a}}function ga(t){var e,r;let a=t.theme;if(a){let i=(r=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:r.call(e,a);if(i&&i instanceof HTMLTemplateElement)return i;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let o=c.customElements.get(a);if(o!=null&&o.template)return o.template}}function fa(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function Rt(t){let a=t.hasAttribute(n.TITLE)?{video_title:t.getAttribute(n.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,r)=>{let i=t.getAttribute(r);return i!==null&&(e[r.replace(/^metadata-/,"").replace(/-/g,"_")]=i),e},a)}var ya=Object.values(d),va=Object.values(M),ka=Object.values(n),Ea=ce(),Ta="mux-player",Mt={dialog:void 0,isDialogOpen:!1},re,oe,S,ne,F,V,j,Ee,St,se,Ue,H,q,Te,_t,Ce,Pt,Ae,Nt,xe,It,ie=class extends Ie{constructor(){super();b(this,V);b(this,Ee);b(this,se);b(this,H);b(this,Te);b(this,Ce);b(this,Ae);b(this,xe);b(this,re,!1);b(this,oe,{});b(this,S,!0);b(this,ne,new ue(this,"hotkeys"));b(this,F,{...Mt,onCloseErrorDialog:()=>f(this,se,Ue).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Se(this,T.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),f(this,Ee,St).call(this),this.isConnected&&f(this,V,j).call(this)}static get observedAttributes(){var e;return[...(e=Ie.observedAttributes)!=null?e:[],...va,...ya,...ka]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,r;return(r=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:r.querySelector("media-controller")}connectedCallback(){var r;let e=(r=this.shadowRoot)==null?void 0:r.querySelector("mux-video");e&&(e.metadata=Rt(this))}attributeChangedCallback(e,r,i){switch(f(this,V,j).call(this),super.attributeChangedCallback(e,r,i),e){case n.HOTKEYS:u(this,ne).value=i;break;case n.THUMBNAIL_TIME:{i!=null&&this.tokens.thumbnail&&I(l("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case n.THUMBNAIL_TOKEN:{let{aud:s}=N(i);i&&s!=="t"&&I(l("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:s}));break}case n.STORYBOARD_TOKEN:{let{aud:s}=N(i);i&&s!=="s"&&I(l("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:s}));break}case d.PLAYBACK_ID:{i!=null&&i.includes("?token")&&L(l("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:i}));break}case d.STREAM_TYPE:i&&![w.LIVE,w.ON_DEMAND,w.UNKNOWN].includes(i)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=i.includes("dvr")?Number.POSITIVE_INFINITY:0:Pe({file:"invalid-stream-type.md",message:l("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=i===w.LIVE?0:Number.NaN}[d.PLAYBACK_ID,M.SRC,n.PLAYBACK_TOKEN].includes(e)&&r!==i&&A(this,F,{...u(this,F),...Mt}),f(this,H,q).call(this,{[lt(e)]:i})}get preferCmcd(){var e;return(e=this.getAttribute(d.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ot.includes(e)?this.setAttribute(d.PREFER_CMCD,e):I(`Invalid value for preferCmcd. Must be one of ${Ot.join()}`):this.removeAttribute(d.PREFER_CMCD))}get hasPlayed(){var e,r;return(r=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?r:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute("media-time-is-live")}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(n.THEME))!=null?e:ba}set theme(e){this.setAttribute(n.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let r={};for(let i of e.getAttributeNames()){if(Be.includes(i))continue;let o=e.getAttribute(i);r[me(i)]=o===""?!0:o}return r}set themeProps(e){var i,o;f(this,V,j).call(this);let r={...this.themeProps,...e};for(let s in r){if(Be.includes(s))continue;let m=e==null?void 0:e[s];typeof m=="boolean"||m==null?(i=this.mediaTheme)==null||i.toggleAttribute(le(s),Boolean(m)):(o=this.mediaTheme)==null||o.setAttribute(le(s),m)}}get playbackId(){var e;return(e=this.getAttribute(d.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(d.PLAYBACK_ID,e):this.removeAttribute(d.PLAYBACK_ID)}get src(){var e,r;return this.playbackId?(e=Z(this,M.SRC))!=null?e:void 0:(r=this.getAttribute(M.SRC))!=null?r:void 0}set src(e){e?this.setAttribute(M.SRC,e):this.removeAttribute(M.SRC)}get poster(){var r;let e=this.getAttribute(M.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return st(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(M.POSTER,e):this.removeAttribute(M.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(n.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(n.STORYBOARD_SRC,e):this.removeAttribute(n.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.LIVE,w.UNKNOWN].includes(this.streamType)))return dt(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(n.AUDIO)}set audio(e){if(!e){this.removeAttribute(n.AUDIO);return}this.setAttribute(n.AUDIO,"")}get hotkeys(){return u(this,ne)}get nohotkeys(){return this.hasAttribute(n.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(n.NOHOTKEYS);return}this.setAttribute(n.NOHOTKEYS,"")}get thumbnailTime(){return O(this.getAttribute(n.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(n.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(n.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(n.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Z(this,n.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(n.PLACEHOLDER,`${e}`)}get primaryColor(){var r,i;let e=this.getAttribute(n.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=c.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_primary-color"))==null?void 0:i.trim(),e))return e}set primaryColor(e){this.setAttribute(n.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var r,i;let e=this.getAttribute(n.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=c.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_secondary-color"))==null?void 0:i.trim(),e))return e}set secondaryColor(e){this.setAttribute(n.SECONDARY_COLOR,`${e}`)}get accentColor(){var r,i;let e=this.getAttribute(n.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(i=(r=c.getComputedStyle(this.mediaTheme))==null?void 0:r.getPropertyValue("--_accent-color"))==null?void 0:i.trim(),e))return e}set accentColor(e){this.setAttribute(n.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(n.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(n.PLAYBACK_RATES))return this.getAttribute(n.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,r)=>e-r)}set playbackRates(e){if(!e){this.removeAttribute(n.PLAYBACK_RATES);return}this.setAttribute(n.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=O(this.getAttribute(n.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(n.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=O(this.getAttribute(n.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(n.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(n.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_NAME))!=null?e:Ta}get playerSoftwareVersion(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_VERSION))!=null?e:Ea}get beaconCollectionDomain(){var e;return(e=this.getAttribute(d.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(d.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(d.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(d.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(d.MAX_RESOLUTION,e):this.removeAttribute(d.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(d.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(d.MIN_RESOLUTION,e):this.removeAttribute(d.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(d.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(d.RENDITION_ORDER,e):this.removeAttribute(d.RENDITION_ORDER))}get customDomain(){var e;return(e=this.getAttribute(d.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(d.CUSTOM_DOMAIN,e):this.removeAttribute(d.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Z(this,d.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(d.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(n.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(n.NO_VOLUME_PREF,""):this.removeAttribute(n.NO_VOLUME_PREF)}get debug(){return Z(this,d.DEBUG)!=null}set debug(e){e?this.setAttribute(d.DEBUG,""):this.removeAttribute(d.DEBUG)}get disableCookies(){return Z(this,d.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(d.DISABLE_COOKIES,""):this.removeAttribute(d.DISABLE_COOKIES)}get streamType(){var e,r,i;return(i=(r=this.getAttribute(d.STREAM_TYPE))!=null?r:(e=this.media)==null?void 0:e.streamType)!=null?i:w.UNKNOWN}set streamType(e){this.setAttribute(d.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,r,i;return(i=(r=this.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?r:(e=this.mediaController)==null?void 0:e.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?i:w.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(n.DEFAULT_STREAM_TYPE,e):this.removeAttribute(n.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,r;return this.hasAttribute(n.TARGET_LIVE_WINDOW)?+this.getAttribute(n.TARGET_LIVE_WINDOW):(r=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?r:Number.NaN}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(n.TARGET_LIVE_WINDOW):this.setAttribute(n.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return O(Z(this,d.START_TIME))}set startTime(e){this.setAttribute(d.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(d.PREFER_PLAYBACK);if(e===ke.MSE||e===ke.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===ke.MSE||e===ke.NATIVE?this.setAttribute(d.PREFER_PLAYBACK,e):this.removeAttribute(d.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(f(this,V,j).call(this),!this.media){L("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Rt(this),...e}}async addCuePoints(e){var r;if(f(this,V,j).call(this),!this.media){L("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(r=this.media)==null?void 0:r.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,r;return(r=(e=this.media)==null?void 0:e.cuePoints)!=null?r:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(n.PLAYBACK_TOKEN),r=this.getAttribute(n.THUMBNAIL_TOKEN),i=this.getAttribute(n.STORYBOARD_TOKEN);return{...u(this,oe),...e!=null?{playback:e}:{},...r!=null?{thumbnail:r}:{},...i!=null?{storyboard:i}:{}}}set tokens(e){A(this,oe,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(n.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(n.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(n.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(n.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(n.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(n.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,r,i,o){var m;let s=(m=this.media)==null?void 0:m.nativeEl;if(!!s)return ca(s,e,r,i,o)}removeTextTrack(e){var i;let r=(i=this.media)==null?void 0:i.nativeEl;if(!!r)return pa(r,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};re=new WeakMap,oe=new WeakMap,S=new WeakMap,ne=new WeakMap,F=new WeakMap,V=new WeakSet,j=function(){var e,r,i;if(!u(this,re)){A(this,re,!0),f(this,H,q).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof c.HTMLElement))throw""}catch{L("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ua))throw""}catch{L("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ma))throw""}catch{L("<media-controller> failed to upgrade!")}pt(this),f(this,Te,_t).call(this),f(this,Ce,Pt).call(this),f(this,Ae,Nt).call(this),A(this,S,(r=(e=this.mediaController)==null?void 0:e.hasAttribute("userinactive"))!=null?r:!0),f(this,xe,It).call(this),(i=this.media)==null||i.addEventListener("streamtypechange",()=>{f(this,H,q).call(this)})}},Ee=new WeakSet,St=function(){var e,r;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(r=window==null?void 0:window.CSS)==null||r.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},se=new WeakSet,Ue=function(e){Object.assign(u(this,F),e),f(this,H,q).call(this)},H=new WeakSet,q=function(e={}){Tt(At(ha(this,{...u(this,F),...e})),this.shadowRoot)},Te=new WeakSet,_t=function(){let e=i=>{var m,h;if(!(i!=null&&i.startsWith("theme-")))return;let o=i.replace(/^theme-/,"");if(Be.includes(o))return;let s=this.getAttribute(i);s!=null?(m=this.mediaTheme)==null||m.setAttribute(o,s):(h=this.mediaTheme)==null||h.removeAttribute(o)};new MutationObserver(i=>{for(let{attributeName:o}of i)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Ce=new WeakSet,Pt=function(){var r;let e=i=>{let{detail:o}=i;if(o instanceof ve||(o=new ve(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){I(o),o.data&&I(`${o.name} data:`,o.data);return}let{dialog:s,devlog:m}=fe(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&Pe(m),L(o),o.data&&L(`${o.name} data:`,o.data),f(this,se,Ue).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(i={})=>{var s,m,h;if(!(((s=this.media)==null?void 0:s.error)instanceof ve))return i;let{devlog:o}=fe((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(h=this.media)==null?void 0:h.error.code,player_error_message:o.message?String(o.message):i.player_error_message,player_error_context:o.context?String(o.context):i.player_error_context}}),(r=this.media)==null||r.addEventListener("error",i=>{var s,m;let{detail:o}=i;if(!o){let{message:h,code:x}=(m=(s=this.media)==null?void 0:s.error)!=null?m:{};o=new ve(h,x)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Ae=new WeakSet,Nt=function(){var r,i,o,s;let e=()=>f(this,H,q).call(this);(i=(r=this.media)==null?void 0:r.textTracks)==null||i.addEventListener("addtrack",e),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",e)},xe=new WeakSet,It=function(){var E,_;let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(!/Firefox/i.test(navigator.userAgent))return;let i,o=new WeakMap,s=()=>this.streamType===w.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,m=(g,v,C=!1)=>{if(s())return;Array.from(g&&g.activeCues||[]).forEach(p=>{if(!(!p.snapToLines||p.line<-5||p.line>=0&&p.line<10))if(!v||this.paused){let de=p.text.split(`
1287
- `).length,G=e?-2:-3;this.streamType===w.LIVE&&(G=e?-1:-2);let Y=G-de;if(p.line===Y&&!C)return;o.has(p)||o.set(p,p.line),p.line=Y-1,p.line=Y}else setTimeout(()=>{p.line=o.get(p)||"auto"},500)})},h=()=>{var g,v;m(i,(v=(g=this.mediaController)==null?void 0:g.hasAttribute("userinactive"))!=null?v:!1)},x=()=>{var C,P;let v=Array.from(((P=(C=this.mediaController)==null?void 0:C.media)==null?void 0:P.textTracks)||[]).filter(p=>["subtitles","captions"].includes(p.kind)&&p.mode==="showing")[0];v!==i&&(i==null||i.removeEventListener("cuechange",h)),i=v,i==null||i.addEventListener("cuechange",h),m(i,u(this,S))};if(x(),(E=this.textTracks)==null||E.addEventListener("change",x),(_=this.textTracks)==null||_.addEventListener("addtrack",x),navigator.userAgent.includes("Chrome/")){let g=()=>{m(i,u(this,S),!0),this.paused||window.requestAnimationFrame(g)};this.addEventListener("playing",()=>{g()})}this.addEventListener("userinactivechange",()=>{var v,C;let g=(C=(v=this.mediaController)==null?void 0:v.hasAttribute("userinactive"))!=null?C:!0;u(this,S)!==g&&(A(this,S,g),m(i,u(this,S)))})};function Z(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}c.customElements.get("mux-player")||(c.customElements.define("mux-player",ie),c.MuxPlayerElement=ie);var Li=ie;export{ve as MediaError,Li as default,Z as getVideoAttribute};
1313
+ `;import{MediaThemeElement as ba}from"media-chrome/dist/media-theme-element.js";var Ve=T.createElement("template");"innerHTML"in Ve&&(Ve.innerHTML=Rt);var wt,Ot,ge=class extends ba{};ge.template=(Ot=(wt=Ve.content)==null?void 0:wt.children)==null?void 0:Ot[0];c.customElements.get("media-theme-gerwig")||c.customElements.define("media-theme-gerwig",ge);var va="gerwig";var M={SRC:"src",POSTER:"poster"},n={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-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",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref"},Be=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function Ea(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(n.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:ka(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(n.NOHOTKEYS),hotKeys:t.getAttribute(n.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,renditionOrder:t.renditionOrder,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(d.TARGET_LIVE_WINDOW),streamType:J(t.getAttribute(d.STREAM_TYPE)),primaryColor:t.getAttribute(n.PRIMARY_COLOR),secondaryColor:t.getAttribute(n.SECONDARY_COLOR),accentColor:t.getAttribute(n.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Ta(t),playbackRates:t.getAttribute(n.PLAYBACK_RATES),customDomain:(i=t.getAttribute(d.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(n.TITLE),novolumepref:t.hasAttribute(n.NO_VOLUME_PREF),...a,extraSourceParams:t.extraSourceParams}}function ka(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let o=c.customElements.get(a);if(o!=null&&o.template)return o.template}}function Ta(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function _t(t){let a=t.hasAttribute(n.TITLE)?{video_title:t.getAttribute(n.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var Aa=Object.values(d),Ca=Object.values(M),xa=Object.values(n),La=me(),Ra="mux-player",Pt={dialog:void 0,isDialogOpen:!1},wa={redundant_streams:!0},ie,re,D,oe,Y,S,F,ve,Nt,ne,Ue,V,j,Ee,It,ke,Dt,Te,Vt,Ae,Ht,ae=class extends Pe{constructor(){super();h(this,S);h(this,ve);h(this,ne);h(this,V);h(this,Ee);h(this,ke);h(this,Te);h(this,Ae);h(this,ie,!1);h(this,re,{});h(this,D,!0);h(this,oe,new le(this,"hotkeys"));h(this,Y,{...Pt,onCloseErrorDialog:()=>g(this,ne,Ue).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Oe(this,T.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),g(this,ve,Nt).call(this),this.isConnected&&g(this,S,F).call(this)}static get observedAttributes(){var e;return[...(e=Pe.observedAttributes)!=null?e:[],...Ca,...Aa,...xa]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=_t(this))}attributeChangedCallback(e,i,r){switch(g(this,S,F).call(this),super.attributeChangedCallback(e,i,r),e){case n.HOTKEYS:u(this,oe).value=r;break;case n.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&N(l("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case n.THUMBNAIL_TOKEN:{let{aud:s}=P(r);r&&s!=="t"&&N(l("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:s}));break}case n.STORYBOARD_TOKEN:{let{aud:s}=P(r);r&&s!=="s"&&N(l("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:s}));break}case d.PLAYBACK_ID:{r!=null&&r.includes("?token")&&x(l("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case d.STREAM_TYPE:r&&![w.LIVE,w.ON_DEMAND,w.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Se({file:"invalid-stream-type.md",message:l("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):this.targetLiveWindow=r===w.LIVE?0:Number.NaN}[d.PLAYBACK_ID,M.SRC,n.PLAYBACK_TOKEN].includes(e)&&i!==r&&C(this,Y,{...u(this,Y),...Pt}),g(this,V,j).call(this,{[ut(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(d.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?St.includes(e)?this.setAttribute(d.PREFER_CMCD,e):N(`Invalid value for preferCmcd. Must be one of ${St.join()}`):this.removeAttribute(d.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Mt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Mt.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(n.THEME))!=null?e:va}set theme(e){this.setAttribute(n.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Be.includes(r))continue;let o=e.getAttribute(r);i[de(r)]=o===""?!0:o}return i}set themeProps(e){var r,o;g(this,S,F).call(this);let i={...this.themeProps,...e};for(let s in i){if(Be.includes(s))continue;let m=e==null?void 0:e[s];typeof m=="boolean"||m==null?(r=this.mediaTheme)==null||r.toggleAttribute(se(s),!!m):(o=this.mediaTheme)==null||o.setAttribute(se(s),m)}}get playbackId(){var e;return(e=this.getAttribute(d.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(d.PLAYBACK_ID,e):this.removeAttribute(d.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=Z(this,M.SRC))!=null?e:void 0:(i=this.getAttribute(M.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(M.SRC,e):this.removeAttribute(M.SRC)}get poster(){var i;let e=this.getAttribute(M.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return lt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(M.POSTER,e):this.removeAttribute(M.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(n.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(n.STORYBOARD_SRC,e):this.removeAttribute(n.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[w.LIVE,w.UNKNOWN].includes(this.streamType)))return mt(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard})}get audio(){return this.hasAttribute(n.AUDIO)}set audio(e){if(!e){this.removeAttribute(n.AUDIO);return}this.setAttribute(n.AUDIO,"")}get hotkeys(){return u(this,oe)}get nohotkeys(){return this.hasAttribute(n.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(n.NOHOTKEYS);return}this.setAttribute(n.NOHOTKEYS,"")}get thumbnailTime(){return R(this.getAttribute(n.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(n.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(n.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(n.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Z(this,n.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(n.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(n.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(n.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(n.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(n.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(n.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=c.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(n.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(n.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(n.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(n.PLAYBACK_RATES))return this.getAttribute(n.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(n.PLAYBACK_RATES);return}this.setAttribute(n.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=R(this.getAttribute(n.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(n.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=R(this.getAttribute(n.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(n.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(n.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(n.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return R(this.getAttribute(n.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(n.DEFAULT_DURATION):this.setAttribute(n.DEFAULT_DURATION,`${e}`)}get playerSoftwareName(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_NAME))!=null?e:Ra}get playerSoftwareVersion(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_VERSION))!=null?e:La}get beaconCollectionDomain(){var e;return(e=this.getAttribute(d.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(d.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(d.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(d.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(d.MAX_RESOLUTION,e):this.removeAttribute(d.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(d.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(d.MIN_RESOLUTION,e):this.removeAttribute(d.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(d.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(d.RENDITION_ORDER,e):this.removeAttribute(d.RENDITION_ORDER))}get extraSourceParams(){return this.hasAttribute(n.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(n.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):wa}set extraSourceParams(e){e==null?this.removeAttribute(n.EXTRA_SOURCE_PARAMS):this.setAttribute(n.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(d.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(d.CUSTOM_DOMAIN,e):this.removeAttribute(d.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Z(this,d.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(d.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(n.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(n.NO_VOLUME_PREF,""):this.removeAttribute(n.NO_VOLUME_PREF)}get debug(){return Z(this,d.DEBUG)!=null}set debug(e){e?this.setAttribute(d.DEBUG,""):this.removeAttribute(d.DEBUG)}get disableCookies(){return Z(this,d.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(d.DISABLE_COOKIES,""):this.removeAttribute(d.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(d.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:w.UNKNOWN}set streamType(e){this.setAttribute(d.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(n.DEFAULT_STREAM_TYPE))!=null?r:w.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(n.DEFAULT_STREAM_TYPE,e):this.removeAttribute(n.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(n.TARGET_LIVE_WINDOW)?+this.getAttribute(n.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(n.TARGET_LIVE_WINDOW):this.setAttribute(n.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return R(Z(this,d.START_TIME))}set startTime(e){this.setAttribute(d.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(d.PREFER_PLAYBACK);if(e===ye.MSE||e===ye.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===ye.MSE||e===ye.NATIVE?this.setAttribute(d.PREFER_PLAYBACK,e):this.removeAttribute(d.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(g(this,S,F).call(this),!this.media){x("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={..._t(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(g(this,S,F).call(this),!this.media){x("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(g(this,S,F).call(this),!this.media){x("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(i=this.media)==null?void 0:i.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,i;return(i=(e=this.media)==null?void 0:e.cuePoints)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(n.PLAYBACK_TOKEN),i=this.getAttribute(n.THUMBNAIL_TOKEN),r=this.getAttribute(n.STORYBOARD_TOKEN);return{...u(this,re),...e!=null?{playback:e}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(e){C(this,re,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(n.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(n.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(n.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(n.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(n.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(n.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let s=(m=this.media)==null?void 0:m.nativeEl;if(s)return fa(s,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return ya(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};ie=new WeakMap,re=new WeakMap,D=new WeakMap,oe=new WeakMap,Y=new WeakMap,S=new WeakSet,F=function(){var e,i,r;if(!u(this,ie)){C(this,ie,!0),g(this,V,j).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof c.HTMLElement))throw""}catch{x("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ga))throw""}catch{x("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ha))throw""}catch{x("<media-controller> failed to upgrade!")}ht(this),g(this,Ee,It).call(this),g(this,ke,Dt).call(this),g(this,Te,Vt).call(this),C(this,D,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(He.USER_INACTIVE))!=null?i:!0),g(this,Ae,Ht).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>{g(this,V,j).call(this)})}},ve=new WeakSet,Nt=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},ne=new WeakSet,Ue=function(e){Object.assign(u(this,Y),e),g(this,V,j).call(this)},V=new WeakSet,j=function(e={}){Ct(Lt(Ea(this,{...u(this,Y),...e})),this.shadowRoot)},Ee=new WeakSet,It=function(){let e=r=>{var m,p;if(!(r!=null&&r.startsWith("theme-")))return;let o=r.replace(/^theme-/,"");if(Be.includes(o))return;let s=this.getAttribute(r);s!=null?(m=this.mediaTheme)==null||m.setAttribute(o,s):(p=this.mediaTheme)==null||p.removeAttribute(o)};new MutationObserver(r=>{for(let{attributeName:o}of r)e(o)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},ke=new WeakSet,Dt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof fe||(o=new fe(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){N(o),o.data&&N(`${o.name} data:`,o.data);return}let{dialog:s,devlog:m}=he(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&Se(m),x(o),o.data&&x(`${o.name} data:`,o.data),g(this,ne,Ue).call(this,{isDialogOpen:!0,dialog:s})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var s,m,p;if(!(((s=this.media)==null?void 0:s.error)instanceof fe))return r;let{devlog:o}=he((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(p=this.media)==null?void 0:p.error.code,player_error_message:o.message?String(o.message):r.player_error_message,player_error_context:o.context?String(o.context):r.player_error_context}}),(i=this.media)==null||i.addEventListener("error",r=>{var s,m;let{detail:o}=r;if(!o){let{message:p,code:L}=(m=(s=this.media)==null?void 0:s.error)!=null?m:{};o=new fe(p,L)}o!=null&&o.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Te=new WeakSet,Vt=function(){var i,r,o,s;let e=()=>g(this,V,j).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(s=(o=this.media)==null?void 0:o.textTracks)==null||s.addEventListener("removetrack",e)},Ae=new WeakSet,Ht=function(){var L,k;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,o=()=>this.streamType===w.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,s=(v,f,A=!1)=>{if(o())return;Array.from(v&&v.activeCues||[]).forEach(b=>{if(!(!b.snapToLines||b.line<-5||b.line>=0&&b.line<10))if(!f||this.paused){let H=b.text.split(`
1314
+ `).length,G=-3;this.streamType===w.LIVE&&(G=-2);let q=G-H;if(b.line===q&&!A)return;r.has(b)||r.set(b,b.line),b.line=q}else setTimeout(()=>{b.line=r.get(b)||"auto"},500)})},m=()=>{var v,f;s(i,(f=(v=this.mediaController)==null?void 0:v.hasAttribute(He.USER_INACTIVE))!=null?f:!1)},p=()=>{var A,_;let f=Array.from(((_=(A=this.mediaController)==null?void 0:A.media)==null?void 0:_.textTracks)||[]).filter(b=>["subtitles","captions"].includes(b.kind)&&b.mode==="showing")[0];f!==i&&(i==null||i.removeEventListener("cuechange",m)),i=f,i==null||i.addEventListener("cuechange",m),s(i,u(this,D))};p(),(L=this.textTracks)==null||L.addEventListener("change",p),(k=this.textTracks)==null||k.addEventListener("addtrack",p),this.addEventListener("userinactivechange",()=>{var f,A;let v=(A=(f=this.mediaController)==null?void 0:f.hasAttribute(He.USER_INACTIVE))!=null?A:!0;u(this,D)!==v&&(C(this,D,v),s(i,u(this,D)))})};function Z(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}c.customElements.get("mux-player")||(c.customElements.define("mux-player",ae),c.MuxPlayerElement=ae);var Ni=ae;export{fe as MediaError,Ni as default,Z as getVideoAttribute};