@mux/mux-player 1.6.0 → 1.7.0-canary.0-e7d6b3f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- var _e=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var l=(t,a,e)=>(_e(t,a,"read from private field"),e?e.call(t):a.get(t)),c=(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)},k=(t,a,e,i)=>(_e(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var p=(t,a,e)=>(_e(t,a,"access private method"),e);var z=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends z{}globalThis.DocumentFragment=t}var ae=class extends z{},Ne=class extends z{},ea={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(ae)}},ie,Ve=class{constructor(a,e={}){c(this,ie,void 0);k(this,ie,e==null?void 0:e.detail)}get detail(){return l(this,ie)}initCustomEvent(){}};ie=new WeakMap;function ta(t,a){return new ae}var pt={document:{createElement:ta},DocumentFragment,customElements:ea,CustomEvent:Ve,EventTarget:z,HTMLElement:ae,HTMLVideoElement:Ne},bt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",h=bt?pt:globalThis,E=bt?pt.document:globalThis.document;import{MediaController as Ra}from"media-chrome";import Ma,{MediaError as Je,Attributes as u}from"@mux/mux-video";import{StreamTypes as x,PlaybackTypes as we,addTextTrack as Pa,removeTextTrack as Ba,CmcdTypeValues as Ut}from"@mux/playback-core";import{VideoEvents as ua}from"@mux/mux-video";var aa="en",H={code:aa};var ht="en";function d(t,a=!0){var r,o;let e=a&&(o=(r=H)==null?void 0:r[t])!=null?o:t,i=a?H.code:ht;return new $e(e,i)}var $e=class{constructor(a,e=(i=>(i=H.code)!=null?i:ht)()){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 gt(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ia(e)}: ${i}; `)}),a?a.trim():void 0}function ia(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ft(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function M(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function be(t){let a=ra(t).toString();return a?"?"+a:""}function ra(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function _(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 He=(t,a)=>!t||!a?!1:t.contains(a)?!0:He(t,a.getRootNode().host);import{StreamTypes as he}from"@mux/playback-core";var Ke="mux.com",oa=()=>{try{return"1.6.0"}catch{}return"UNKNOWN"},na=oa(),fe=()=>na,Fe=(t,{token:a,domain:e=Ke}={})=>`https://stream.${e}/${t}.m3u8${be(!!a?{token:a}:{redundant_streams:!0})}`,kt=(t,{token:a,thumbnailTime:e,domain:i=Ke}={})=>{let r=a==null?e:void 0,{aud:o}=_(a);if(!(a&&o!=="t"))return`https://image.${i}/${t}/thumbnail.webp${be({token:a,time:r})}`},Et=(t,{token:a,domain:e=Ke}={})=>{let{aud:i}=_(a);if(!(a&&i!=="s"))return`https://image.${e}/${t}/storyboard.vtt${be({token:a,format:"webp"})}`};var sa={crossorigin:"crossOrigin",playsinline:"playsInline"};function Tt(t){var a;return(a=sa[t])!=null?a:ft(t)}var At=t=>{var e,i;let{media:a}=t;return(i=(e=a==null?void 0:a._hls)==null?void 0:e.liveSyncPosition)!=null?i:a!=null&&a.seekable.length?a==null?void 0:a.seekable.end(a.seekable.length-1):void 0},Ue=t=>{let a=At(t);if(a==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}t.currentTime=a},la=1,da=5,yt=3,vt=.5,xt=t=>{var o;let{streamType:a}=t,e=At(t),i=(o=t.media)==null?void 0:o.currentTime;if(e==null||i==null)return!1;let r=e-i;return a===he.LL_LIVE||a===he.LL_DVR?r<=la*(yt+vt):a===he.LIVE||a===he.DVR?r<=da*(yt+vt):!1},K,F,T,ge=class{constructor(a,e){c(this,K,void 0);c(this,F,void 0);c(this,T,[]);k(this,K,a),k(this,F,e)}[Symbol.iterator](){return l(this,T).values()}get length(){return l(this,T).length}get value(){var a;return(a=l(this,T).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(k(this,T,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return l(this,T)[a]}values(){return l(this,T).values()}keys(){return l(this,T).keys()}forEach(a){l(this,T).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||l(this,T).push(r)}),!(this.value===""&&!((e=l(this,K))!=null&&e.hasAttribute(`${l(this,F)}`)))&&((i=l(this,K))==null||i.setAttribute(`${l(this,F)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{l(this,T).splice(l(this,T).indexOf(i),1)}),(e=l(this,K))==null||e.setAttribute(`${l(this,F)}`,`${this.value}`)}contains(a){return l(this,T).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)}};K=new WeakMap,F=new WeakMap,T=new WeakMap;var wt=`[mux-player ${fe()}]`;function N(...t){console.warn(wt,...t)}function L(...t){console.error(wt,...t)}function ye(t){var e;let a=(e=t.message)!=null?e:"";if(t.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${d("Read more: ")}
2
- ${i}${t.file}`}N(a)}var v={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},U={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},St=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}}),ma=ua.filter(t=>t!=="error"),ca=Object.values(v).filter(t=>![v.PLAYSINLINE].includes(t)),pa=Object.values(U);function Ot(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),ma.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var Ye=class extends h.HTMLElement{static get observedAttributes(){return[...ca,...pa]}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,b;let n=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);n&&((b=this.media)==null||b.removeChild(n))}),r.addedNodes.forEach(o=>{var n;(n=this.media)==null||n.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,i){var r,o;switch(a){case U.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case U.VOLUME:{let n=(r=M(i))!=null?r:1;this.media&&(this.media.volume=n);return}case U.PLAYBACKRATE:{let n=(o=M(i))!=null?o:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);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 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:St}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:St}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=M(this.getAttribute(U.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(U.PLAYBACKRATE,`${a}`):this.removeAttribute(U.PLAYBACKRATE)}get crossOrigin(){return re(this,v.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(v.CROSSORIGIN,`${a}`)}get autoplay(){return re(this,v.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(v.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(v.AUTOPLAY)}get loop(){return re(this,v.LOOP)!=null}set loop(a){a?this.setAttribute(v.LOOP,""):this.removeAttribute(v.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 re(this,v.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(v.MUTED,""):this.removeAttribute(v.MUTED)}get playsInline(){return re(this,v.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(v.PRELOAD,a):this.removeAttribute(v.PRELOAD)}};function re(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ze=Ye;import"media-chrome/dist/media-theme-element.js";var Rt=`
1
+ var Se=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var l=(t,a,e)=>(Se(t,a,"read from private field"),e?e.call(t):a.get(t)),c=(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,i)=>(Se(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e);var b=(t,a,e)=>(Se(t,a,"access private method"),e);var j=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends j{}globalThis.DocumentFragment=t}var Q=class extends j{},Ce=class extends j{},Dt={get(t){},define(t,a,e){},upgrade(t){},whenDefined(t){return Promise.resolve(Q)}},X,Re=class{constructor(a,e={}){c(this,X,void 0);A(this,X,e==null?void 0:e.detail)}get detail(){return l(this,X)}initCustomEvent(){}};X=new WeakMap;function It(t,a){return new Q}var Xe={document:{createElement:It},DocumentFragment,customElements:Dt,CustomEvent:Re,EventTarget:j,HTMLElement:Q,HTMLVideoElement:Ce},et=typeof window=="undefined"||typeof globalThis.customElements=="undefined",p=et?Xe:globalThis,v=et?Xe.document:globalThis.document;import{MediaController as sa}from"media-chrome";import"media-chrome/dist/media-captions-menu-button.js";import la,{MediaError as $e,Attributes as u}from"@mux/mux-video";import{StreamTypes as R,PlaybackTypes as Te,addTextTrack as da,removeTextTrack as ua,CmcdTypeValues as St}from"@mux/playback-core";import{VideoEvents as Ft}from"@mux/mux-video";var _t="en",H={code:_t};var tt="en";function d(t,a=!0){var r,o;let e=a&&(o=(r=H)==null?void 0:r[t])!=null?o:t,i=a?H.code:tt;return new Me(e,i)}var Me=class{constructor(a,e=(i=>(i=H.code)!=null?i:tt)()){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 at(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${Nt(e)}: ${i}; `)}),a?a.trim():void 0}function Nt(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function it(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function S(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ce(t){let a=Vt(t).toString();return a?"?"+a:""}function Vt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}function I(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 Pe=(t,a)=>!t||!a?!1:t.contains(a)?!0:Pe(t,a.getRootNode().host);var Be="mux.com",Ht=()=>{try{return"1.7.0"}catch{}return"UNKNOWN"},$t=Ht(),be=()=>$t,De=(t,{token:a,domain:e=Be}={})=>`https://stream.${e}/${t}.m3u8${ce(!!a?{token:a}:{redundant_streams:!0})}`,rt=(t,{token:a,thumbnailTime:e,domain:i=Be}={})=>{let r=a==null?e:void 0,{aud:o}=I(a);if(!(a&&o!=="t"))return`https://image.${i}/${t}/thumbnail.webp${ce({token:a,time:r})}`},ot=(t,{token:a,domain:e=Be}={})=>{let{aud:i}=I(a);if(!(a&&i!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ce({token:a,format:"webp"})}`};var Kt={crossorigin:"crossOrigin",playsinline:"playsInline"};function nt(t){var a;return(a=Kt[t])!=null?a:it(t)}var $,K,k,pe=class{constructor(a,e){c(this,$,void 0);c(this,K,void 0);c(this,k,[]);A(this,$,a),A(this,K,e)}[Symbol.iterator](){return l(this,k).values()}get length(){return l(this,k).length}get value(){var a;return(a=l(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 l(this,k)[a]}values(){return l(this,k).values()}keys(){return l(this,k).keys()}forEach(a){l(this,k).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||l(this,k).push(r)}),!(this.value===""&&!((e=l(this,$))!=null&&e.hasAttribute(`${l(this,K)}`)))&&((i=l(this,$))==null||i.setAttribute(`${l(this,K)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{l(this,k).splice(l(this,k).indexOf(i),1)}),(e=l(this,$))==null||e.setAttribute(`${l(this,K)}`,`${this.value}`)}contains(a){return l(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)}};$=new WeakMap,K=new WeakMap,k=new WeakMap;var st=`[mux-player ${be()}]`;function _(...t){console.warn(st,...t)}function x(...t){console.error(st,...t)}function he(t){var e;let a=(e=t.message)!=null?e:"";if(t.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${d("Read more: ")}
2
+ ${i}${t.file}`}_(a)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},dt=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}}),Ut=Ft.filter(t=>t!=="error"),Yt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Zt=Object.values(F);function ut(t){t.querySelectorAll(":scope > track").forEach(a=>{var e;(e=t.media)==null||e.append(a.cloneNode())}),Ut.forEach(a=>{var e;(e=t.media)==null||e.addEventListener(a,i=>{t.dispatchEvent(new Event(i.type))})})}var Ie=class extends p.HTMLElement{static get observedAttributes(){return[...Yt,...Zt]}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,g;let n=(m=this.media)==null?void 0:m.querySelector(`track[src="${o.src}"]`);n&&((g=this.media)==null||g.removeChild(n))}),r.addedNodes.forEach(o=>{var n;(n=this.media)==null||n.append(o.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,e,i){var r,o;switch(a){case F.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case F.VOLUME:{let n=(r=S(i))!=null?r:1;this.media&&(this.media.volume=n);return}case F.PLAYBACKRATE:{let n=(o=S(i))!=null?o:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);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 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:dt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:dt}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=S(this.getAttribute(F.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(F.PLAYBACKRATE,`${a}`):this.removeAttribute(F.PLAYBACKRATE)}get crossOrigin(){return ee(this,y.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(y.CROSSORIGIN,`${a}`)}get autoplay(){return ee(this,y.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(y.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return ee(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 ee(this,y.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return ee(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 ee(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var _e=Ie;import"media-chrome/dist/media-theme-element.js";var ct=`
3
3
  :host {
4
4
  cursor: pointer;
5
5
  }
6
6
  media-time-display {
7
7
  color: inherit;
8
8
  }
9
- `,Mt=E.createElement("template");Mt.innerHTML=`
9
+ `,pt=v.createElement("template");pt.innerHTML=`
10
10
  <style>
11
- ${Rt}
11
+ ${ct}
12
12
  </style>
13
13
  <media-time-display show-duration></media-time-display>
14
- `;var Ct=["Enter"," "],oe,j,ve,q=class extends h.HTMLElement{constructor(){var e,i;super();c(this,j);c(this,oe,void 0);this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(i=this.shadowRoot)==null?void 0:i.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var e,i,r;(e=this.timeDisplayEl)!=null&&e.hasAttribute("remaining")?(i=this.timeDisplayEl)==null||i.removeAttribute("remaining"):(r=this.timeDisplayEl)==null||r.setAttribute("remaining","")}connectedCallback(){let e=i=>{let{key:r}=i;if(!Ct.includes(r)){this.removeEventListener("keyup",e);return}this.toggleTimeDisplay()};this.addEventListener("keydown",i=>{let{metaKey:r,altKey:o,key:n}=i;if(r||o||!Ct.includes(n)){this.removeEventListener("keyup",e);return}this.addEventListener("keyup",e)}),this.addEventListener("click",this.toggleTimeDisplay),k(this,oe,setInterval(p(this,j,ve).bind(this),200)),requestAnimationFrame(()=>p(this,j,ve).call(this))}disconnectedCallback(){clearInterval(l(this,oe))}attributeChangedCallback(e,i,r){var o,n;e==="hide-duration"&&p(this,j,ve).call(this),["remaining","disabled","aria-disabled"].includes(e)&&i!==r&&(r==null?(o=this.timeDisplayEl)==null||o.removeAttribute(e):(n=this.timeDisplayEl)==null||n.setAttribute(e,r))}};oe=new WeakMap,j=new WeakSet,ve=function(){var i,r,o,n;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(i=this.timeDisplayEl)!=null&&i.hasAttribute("show-duration")&&((r=this.timeDisplayEl)==null||r.removeAttribute("show-duration")):(o=this.timeDisplayEl)!=null&&o.hasAttribute("show-duration")||(n=this.timeDisplayEl)==null||n.setAttribute("show-duration","")},q.styles=Rt,q.template=Mt;h.customElements.get("mxp-time-display")||(h.customElements.define("mxp-time-display",q),h.MxpTimeDisplay=q);var Pt=`:host {
14
+ `;var mt=["Enter"," "],te,z,ge,G=class extends p.HTMLElement{constructor(){var e,i;super();c(this,z);c(this,te,void 0);this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(i=this.shadowRoot)==null?void 0:i.querySelector("media-time-display")}static get observedAttributes(){return["hide-duration","remaining","disabled","aria-disabled"]}toggleTimeDisplay(){var e,i,r;(e=this.timeDisplayEl)!=null&&e.hasAttribute("remaining")?(i=this.timeDisplayEl)==null||i.removeAttribute("remaining"):(r=this.timeDisplayEl)==null||r.setAttribute("remaining","")}connectedCallback(){let e=i=>{let{key:r}=i;if(!mt.includes(r)){this.removeEventListener("keyup",e);return}this.toggleTimeDisplay()};this.addEventListener("keydown",i=>{let{metaKey:r,altKey:o,key:n}=i;if(r||o||!mt.includes(n)){this.removeEventListener("keyup",e);return}this.addEventListener("keyup",e)}),this.addEventListener("click",this.toggleTimeDisplay),A(this,te,setInterval(b(this,z,ge).bind(this),200)),requestAnimationFrame(()=>b(this,z,ge).call(this))}disconnectedCallback(){clearInterval(l(this,te))}attributeChangedCallback(e,i,r){var o,n;e==="hide-duration"&&b(this,z,ge).call(this),["remaining","disabled","aria-disabled"].includes(e)&&i!==r&&(r==null?(o=this.timeDisplayEl)==null||o.removeAttribute(e):(n=this.timeDisplayEl)==null||n.setAttribute(e,r))}};te=new WeakMap,z=new WeakSet,ge=function(){var i,r,o,n;getComputedStyle(this).getPropertyValue("--media-duration-display").trim()==="none"||this.getAttribute("hide-duration")!=null?(i=this.timeDisplayEl)!=null&&i.hasAttribute("show-duration")&&((r=this.timeDisplayEl)==null||r.removeAttribute("show-duration")):(o=this.timeDisplayEl)!=null&&o.hasAttribute("show-duration")||(n=this.timeDisplayEl)==null||n.setAttribute("show-duration","")},G.styles=ct,G.template=pt;p.customElements.get("mxp-time-display")||(p.customElements.define("mxp-time-display",G),p.MxpTimeDisplay=G);var bt=`:host {
15
15
  display: inline-block;
16
16
  width: 100%;
17
17
  }
@@ -27,46 +27,6 @@ a {
27
27
  text-decoration: underline;
28
28
  }
29
29
 
30
- [audio] [part~='seek-live'] {
31
- margin: 0;
32
- height: 42px;
33
- border-radius: 0;
34
- background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
35
- }
36
-
37
- [part~='seek-live'] {
38
- margin-left: 10px;
39
- margin-right: 5px;
40
- align-self: center;
41
- position: relative;
42
- box-sizing: border-box;
43
- padding: 4px 6px;
44
- border-radius: 12px;
45
- background-color: rgba(20, 20, 30, 0.7);
46
- font-size: 0.75rem;
47
- line-height: 1;
48
- color: #fff;
49
- border: none;
50
- cursor: pointer;
51
- }
52
-
53
- [part~='seek-live'] svg {
54
- width: 8px;
55
- fill: rgb(118, 118, 118);
56
- }
57
- [part~='seek-live'][in-live-window] svg {
58
- fill: #fb3c4d;
59
- }
60
-
61
- [part~='seek-live'][disabled] {
62
- opacity: 60%;
63
- cursor: not-allowed;
64
- }
65
- [part~='seek-live'][in-live-window] {
66
- opacity: 100%;
67
- cursor: unset;
68
- }
69
-
70
30
  ::part(top),
71
31
  [part~='top'] {
72
32
  --media-controls: var(--controls, var(--top-controls));
@@ -76,6 +36,10 @@ a {
76
36
  --media-seek-forward-button: var(--seek-forward-button, var(--top-seek-forward-button));
77
37
  --media-mute-button: var(--mute-button, var(--top-mute-button));
78
38
  --media-captions-button: var(--captions-button, var(--top-captions-button));
39
+ --media-captions-menu-button: var(
40
+ --captions-menu-button,
41
+ var(--media-captions-button, var(--top-captions-menu-button))
42
+ );
79
43
  --media-airplay-button: var(--airplay-button, var(--top-airplay-button));
80
44
  --media-pip-button: var(--pip-button, var(--top-pip-button));
81
45
  --media-fullscreen-button: var(--fullscreen-button, var(--top-fullscreen-button));
@@ -97,6 +61,10 @@ a {
97
61
  --media-seek-forward-button: var(--seek-forward-button, var(--center-seek-forward-button));
98
62
  --media-mute-button: var(--mute-button, var(--center-mute-button));
99
63
  --media-captions-button: var(--captions-button, var(--center-captions-button));
64
+ --media-captions-menu-button: var(
65
+ --captions-menu-button,
66
+ var(--media-captions-button, var(--center-captions-menu-button))
67
+ );
100
68
  --media-airplay-button: var(--airplay-button, var(--center-airplay-button));
101
69
  --media-pip-button: var(--pip-button, var(--center-pip-button));
102
70
  --media-fullscreen-button: var(--fullscreen-button, var(--center-fullscreen-button));
@@ -117,6 +85,10 @@ a {
117
85
  --media-seek-forward-button: var(--seek-forward-button, var(--bottom-seek-forward-button));
118
86
  --media-mute-button: var(--mute-button, var(--bottom-mute-button));
119
87
  --media-captions-button: var(--captions-button, var(--bottom-captions-button));
88
+ --media-captions-menu-button: var(
89
+ --captions-menu-button,
90
+ var(--media-captions-button, var(--bottom-captions-menu-button))
91
+ );
120
92
  --media-airplay-button: var(--airplay-button, var(--bottom-airplay-button));
121
93
  --media-pip-button: var(--pip-button, var(--bottom-pip-button));
122
94
  --media-fullscreen-button: var(--fullscreen-button, var(--bottom-fullscreen-button));
@@ -147,8 +119,8 @@ a {
147
119
  ::part(mute button) {
148
120
  display: var(--media-controls, var(--media-mute-button));
149
121
  }
150
- ::part(captions button) {
151
- display: var(--media-controls, var(--media-captions-button));
122
+ ::part(captions menu-button) {
123
+ display: var(--media-controls, var(--media-captions-menu-button, contents));
152
124
  }
153
125
  ::part(airplay button) {
154
126
  display: var(--media-controls, var(--media-airplay-button));
@@ -177,7 +149,8 @@ a {
177
149
  ::part(title display) {
178
150
  display: var(--media-controls, var(--media-title-display));
179
151
  }
180
- `;var Bt=`<template id="media-theme-mux">
152
+ `;var ht=`<!-- prettier-ignore -->
153
+ <template id="media-theme-mux">
181
154
  <style>
182
155
  :host(:not([audio])) {
183
156
  --secondary-color: transparent;
@@ -248,8 +221,21 @@ a {
248
221
  cursor: not-allowed;
249
222
  }
250
223
 
251
- media-captions-button:not(:is([media-captions-list], [media-subtitles-list])) {
252
- --captions-button: none;
224
+ :host(:not([audio])) media-captions-menu-button::part(listbox) {
225
+ bottom: 42px;
226
+ z-index: 10;
227
+ }
228
+
229
+ media-controller:not(:is([media-captions-list], [media-subtitles-list])) media-captions-menu-button {
230
+ --captions-menu-button: none;
231
+ }
232
+
233
+ media-captions-menu-button {
234
+ --media-listbox-background: var(--secondary-color);
235
+ --media-listbox-selected-background: rgba(255, 255, 255, 0.28);
236
+ --media-listbox-hover-background: none;
237
+ --media-listbox-hover-outline: white solid 1px;
238
+ --media-text-color: white;
253
239
  }
254
240
 
255
241
  media-volume-range[media-volume-unavailable] {
@@ -302,15 +288,15 @@ a {
302
288
  }
303
289
 
304
290
  media-control-bar {
305
- --media-control-padding: 9px 7px;
291
+ --media-control-padding: 4px 3px;
306
292
  }
307
293
 
308
- .size-small media-control-bar {
294
+ [breakpoint-sm] media-control-bar {
309
295
  --media-control-padding: 9px 5px;
310
296
  }
311
297
 
312
- .size-extra-small media-control-bar {
313
- --media-control-padding: 4px 3px;
298
+ [breakpoint-md] media-control-bar {
299
+ --media-control-padding: 9px 7px;
314
300
  }
315
301
 
316
302
  media-control-bar :is([role='button'], [role='switch'], button) {
@@ -440,7 +426,8 @@ a {
440
426
  line-height: 24px;
441
427
  }
442
428
 
443
- .title-display {
429
+ :is(.title-display, media-live-button) {
430
+ color: inherit;
444
431
  font-size: 16px;
445
432
  text-shadow: 0 0 2px rgb(0 0 0 / 0.6);
446
433
  }
@@ -451,11 +438,11 @@ a {
451
438
  }
452
439
  </style>
453
440
  <media-controller
441
+ breakpoints="sm:300 md:700"
454
442
  gestures-disabled="{{disabled}}"
455
443
  hotkeys="{{hotkeys}}"
456
444
  nohotkeys="{{nohotkeys}}"
457
445
  audio="{{audio}}"
458
- class="size-{{playerSize}}"
459
446
  exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"
460
447
  >
461
448
  <slot name="media" slot="media"></slot>
@@ -469,7 +456,9 @@ a {
469
456
 
470
457
  <template partial="TitleDisplay">
471
458
  <template if="title">
472
- <media-text-display part="top title display" class="title-display"> {{title}} </media-text-display>
459
+ <media-text-display part="top title display" class="title-display">
460
+ {{title}}
461
+ </media-text-display>
473
462
  </template>
474
463
  </template>
475
464
 
@@ -562,10 +551,10 @@ a {
562
551
  </media-pip-button>
563
552
  </template>
564
553
 
565
- <template partial="CaptionsButton">
566
- <media-captions-button
554
+ <template partial="CaptionsMenuButton">
555
+ <media-captions-menu-button
567
556
  default-showing="{{defaultShowingCaptions}}"
568
- part="bottom captions button"
557
+ part="bottom captions menu-button"
569
558
  disabled="{{disabled}}"
570
559
  aria-disabled="{{disabled}}"
571
560
  >
@@ -579,7 +568,7 @@ a {
579
568
  d="M22.832 5.68a2.58 2.58 0 0 0-2.3-2.5c-1.81-.12-4.67-.18-7.53-.18-2.86 0-5.72.06-7.53.18a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c1.81.12 4.67.18 7.53.18 2.86 0 5.72-.06 7.53-.18a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.137-.21-8.283 0-12.42a1.11 1.11 0 0 1 .91-1.11c1.67-.11 4.43-.18 7.43-.18s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.137.21 8.283 0 12.42ZM10.843 14a1.55 1.55 0 0 1-.76.18 1.57 1.57 0 0 1-.71-.18 1.69 1.69 0 0 1-.57-.42 2.099 2.099 0 0 1-.38-.58 2.47 2.47 0 0 1 0-1.64 2 2 0 0 1 .39-.66 1.73 1.73 0 0 1 .58-.42c.23-.103.479-.158.73-.16.241-.004.48.044.7.14.199.088.373.222.51.39l1.08-.89a2.179 2.179 0 0 0-.47-.44 2.81 2.81 0 0 0-.54-.32 2.91 2.91 0 0 0-.58-.15 2.71 2.71 0 0 0-.56 0 4.08 4.08 0 0 0-1.38.15 3.27 3.27 0 0 0-1.09.67 3.14 3.14 0 0 0-.71 1.06 3.62 3.62 0 0 0-.26 1.39 3.57 3.57 0 0 0 .26 1.38 3 3 0 0 0 .71 1.06c.316.293.687.52 1.09.67.443.16.91.238 1.38.23a3.2 3.2 0 0 0 1.28-.27c.401-.183.747-.47 1-.83l-1.17-.88a1.42 1.42 0 0 1-.53.52Zm6.62 0a1.58 1.58 0 0 1-.76.18 1.54 1.54 0 0 1-.7-.18 1.69 1.69 0 0 1-.57-.42 2.12 2.12 0 0 1-.43-.58 2.29 2.29 0 0 1 .39-2.3 1.84 1.84 0 0 1 1.32-.58c.241-.003.48.045.7.14.199.088.373.222.51.39l1.08-.92a2.43 2.43 0 0 0-.47-.44 3.22 3.22 0 0 0-.53-.29 2.999 2.999 0 0 0-.57-.15 2.87 2.87 0 0 0-.57 0 4.06 4.06 0 0 0-1.36.15 3.17 3.17 0 0 0-1.09.67 3 3 0 0 0-.72 1.06 3.62 3.62 0 0 0-.25 1.39 3.57 3.57 0 0 0 .25 1.38c.16.402.405.764.72 1.06a3.17 3.17 0 0 0 1.09.67c.44.16.904.237 1.37.23.441 0 .877-.092 1.28-.27a2.45 2.45 0 0 0 1-.83l-1.15-.85a1.49 1.49 0 0 1-.54.49Z"
580
569
  />
581
570
  </svg>
582
- </media-captions-button>
571
+ </media-captions-menu-button>
583
572
  </template>
584
573
 
585
574
  <template partial="AirplayButton">
@@ -630,6 +619,15 @@ a {
630
619
  </media-cast-button>
631
620
  </template>
632
621
 
622
+ <template partial="LiveButton">
623
+ <!-- NOTE: Keeping "seek-live" part for backwards compatibility for now -->
624
+ <media-live-button
625
+ part="{{section ?? 'top'}} live seek-live button"
626
+ disabled="{{disabled}}"
627
+ aria-disabled="{{disabled}}"
628
+ ></media-live-button>
629
+ </template>
630
+
633
631
  <template partial="PlaybackRateButton">
634
632
  <media-playback-rate-button
635
633
  rates="{{playbackRates}}"
@@ -664,161 +662,273 @@ a {
664
662
  ></media-time-range>
665
663
  </template>
666
664
 
667
- <template if="layout == 'audio on-demand'">
668
- <template if="title">
669
- <media-control-bar>{{>TitleDisplay}}</media-control-bar>
665
+ <template if="audio">
666
+
667
+ <template if="streamType == 'on-demand'">
668
+ <template if="title">
669
+ <media-control-bar>{{>TitleDisplay}}</media-control-bar>
670
+ </template>
671
+ <media-control-bar>
672
+ {{>PlayButton}}
673
+ {{>SeekBackwardButton}}
674
+ {{>SeekForwardButton}}
675
+ {{>TimeDisplay}}
676
+ {{>TimeRange}}
677
+ {{>MuteButton}}
678
+ {{>VolumeRange}}
679
+ {{>PlaybackRateButton}}
680
+ {{>AirplayButton}}
681
+ {{>CastButton}}
682
+ </media-control-bar>
670
683
  </template>
671
- <media-control-bar>
672
- {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>TimeRange}} {{>MuteButton}}
673
- {{>VolumeRange}} {{>PlaybackRateButton}} {{>AirplayButton}} {{>CastButton}}
674
- </media-control-bar>
675
- </template>
676
684
 
677
- <template if="layout == 'audio dvr'">
678
- <template if="title">
679
- <media-control-bar>{{>TitleDisplay}}</media-control-bar>
680
- </template>
681
- <media-control-bar>
682
- {{>PlayButton}}
683
- <slot name="seek-live"></slot>
684
- {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>TimeRange}} {{>MuteButton}} {{>VolumeRange}}
685
- {{>PlaybackRateButton}} {{>AirplayButton}} {{>CastButton}}
686
- </media-control-bar>
687
- </template>
685
+ <template if="streamType == 'live'">
686
+
687
+ <template if="targetLiveWindow > 0">
688
+ <template if="title">
689
+ <media-control-bar>{{>TitleDisplay}}</media-control-bar>
690
+ </template>
691
+ <media-control-bar>
692
+ {{>PlayButton}}
693
+ {{>LiveButton section="bottom"}}
694
+ {{>SeekBackwardButton}}
695
+ {{>SeekForwardButton}}
696
+ {{>TimeDisplay}}
697
+ {{>TimeRange}}
698
+ {{>MuteButton}}
699
+ {{>VolumeRange}}
700
+ {{>PlaybackRateButton}}
701
+ {{>AirplayButton}}
702
+ {{>CastButton}}
703
+ </media-control-bar>
704
+ </template>
705
+
706
+ <template if="targetLiveWindow == null">
707
+ <template if="title">
708
+ <media-control-bar>{{>TitleDisplay}}</media-control-bar>
709
+ </template>
710
+ <media-control-bar>
711
+ {{>PlayButton}}
712
+ {{>LiveButton section="bottom"}}
713
+ {{>MuteButton}}
714
+ {{>VolumeRange}}
715
+ <div class="spacer"></div>
716
+ {{>AirplayButton}}
717
+ {{>CastButton}}
718
+ </media-control-bar>
719
+ </template>
688
720
 
689
- <template if="layout == 'audio live'">
690
- <template if="title">
691
- <media-control-bar>{{>TitleDisplay}}</media-control-bar>
692
721
  </template>
693
- <media-control-bar>
694
- {{>PlayButton}}
695
- <slot name="seek-live"></slot>
696
- {{>MuteButton}} {{>VolumeRange}}
697
- <div class="spacer"></div>
698
- {{>AirplayButton}} {{>CastButton}}
699
- </media-control-bar>
700
- </template>
701
-
702
- <template if="layout == 'on-demand extra-small'">
703
- {{>TimeRange}}
704
- <media-control-bar>
705
- {{>PlayButton}} {{>MuteButton}}
706
- <div class="spacer"></div>
707
- {{>CaptionsButton}} {{>FullscreenButton}}
708
- </media-control-bar>
709
722
  </template>
710
723
 
711
- <template if="layout == 'on-demand small'">
712
- <media-control-bar slot="top-chrome"> {{>TitleDisplay}} </media-control-bar>
713
- <div slot="centered-chrome" class="center-controls">
714
- {{>SeekBackwardButton section="center"}} {{>PlayButton section="center"}} {{>SeekForwardButton
715
- section="center"}}
716
- </div>
717
- {{>TimeRange}}
718
- <media-control-bar>
719
- {{>TimeDisplay}} {{>MuteButton}} {{>VolumeRange}}
720
- <div class="spacer"></div>
721
- {{>PlaybackRateButton}} {{>CaptionsButton}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}}
722
- {{>FullscreenButton}}
723
- </media-control-bar>
724
- </template>
724
+ <template if="audio == null">
725
+
726
+ <template if="streamType == 'on-demand'">
727
+
728
+ <template if="breakpointSm == null">
729
+ {{>TimeRange}}
730
+ <media-control-bar>
731
+ {{>PlayButton}}
732
+ {{>MuteButton}}
733
+ <div class="spacer"></div>
734
+ {{>CaptionsMenuButton}}
735
+ {{>FullscreenButton}}
736
+ </media-control-bar>
737
+ </template>
738
+
739
+ <template if="breakpointSm">
740
+ <template if="breakpointMd == null">
741
+ <media-control-bar slot="top-chrome">
742
+ {{>TitleDisplay}}
743
+ </media-control-bar>
744
+ <div slot="centered-chrome" class="center-controls">
745
+ {{>SeekBackwardButton section="center"}}
746
+ {{>PlayButton section="center"}}
747
+ {{>SeekForwardButton section="center"}}
748
+ </div>
749
+ {{>TimeRange}}
750
+ <media-control-bar>
751
+ {{>PlayButton}}
752
+ {{>TimeDisplay}}
753
+ {{>MuteButton}}
754
+ {{>VolumeRange}}
755
+ <div class="spacer"></div>
756
+ {{>PlaybackRateButton}}
757
+ {{>CaptionsMenuButton}}
758
+ {{>AirplayButton}}
759
+ {{>CastButton}}
760
+ {{>PipButton}}
761
+ {{>FullscreenButton}}
762
+ </media-control-bar>
763
+ </template>
764
+ </template>
765
+
766
+ <template if="breakpointMd">
767
+ <media-control-bar slot="top-chrome">
768
+ {{>TitleDisplay}}
769
+ </media-control-bar>
770
+ <div slot="centered-chrome" class="center-controls">
771
+ {{>PlayButton section="center"}}
772
+ </div>
773
+ {{>TimeRange}}
774
+ <media-control-bar>
775
+ {{>PlayButton}}
776
+ {{>SeekBackwardButton}}
777
+ {{>SeekForwardButton}}
778
+ {{>TimeDisplay}}
779
+ {{>MuteButton}}
780
+ {{>VolumeRange}}
781
+ <div class="spacer"></div>
782
+ {{>PlaybackRateButton}}
783
+ {{>CaptionsMenuButton}}
784
+ {{>AirplayButton}}
785
+ {{>CastButton}}
786
+ {{>PipButton}}
787
+ {{>FullscreenButton}}
788
+ </media-control-bar>
789
+ </template>
725
790
 
726
- <template if="layout == 'on-demand large'">
727
- <media-control-bar slot="top-chrome"> {{>TitleDisplay}} </media-control-bar>
728
- <div slot="centered-chrome" class="center-controls">{{>PlayButton section="center"}}</div>
729
- {{>TimeRange}}
730
- <media-control-bar>
731
- {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}} {{>VolumeRange}}
732
- <div class="spacer"></div>
733
- {{>PlaybackRateButton}} {{>CaptionsButton}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}}
734
- {{>FullscreenButton}}
735
- </media-control-bar>
736
- </template>
737
-
738
- <template if="layout == 'live extra-small'">
739
- <media-control-bar slot="top-chrome">
740
- <slot name="seek-live"></slot>
741
- </media-control-bar>
742
- <media-control-bar>
743
- {{>PlayButton}} {{>MuteButton}}
744
- <div class="spacer"></div>
745
- {{>CaptionsButton}} {{>FullscreenButton}}
746
- </media-control-bar>
747
- </template>
748
-
749
- <template if="layout == 'live small'">
750
- <media-control-bar slot="top-chrome">
751
- <slot name="seek-live"></slot>
752
- {{>TitleDisplay}}
753
- </media-control-bar>
754
- <div slot="centered-chrome" class="center-controls">{{>PlayButton section="center"}}</div>
755
- <media-control-bar>
756
- {{>MuteButton}} {{>VolumeRange}}
757
- <div class="spacer"></div>
758
- {{>CaptionsButton}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
759
- </media-control-bar>
760
- </template>
761
-
762
- <template if="layout == 'live large'">
763
- <media-control-bar slot="top-chrome">
764
- <slot name="seek-live"></slot>
765
- {{>TitleDisplay}}
766
- </media-control-bar>
767
- <div slot="centered-chrome" class="center-controls">{{>PlayButton section="center"}}</div>
768
- <media-control-bar>
769
- {{>PlayButton}} {{>MuteButton}} {{>VolumeRange}}
770
- <div class="spacer"></div>
771
- {{>CaptionsButton}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
772
- </media-control-bar>
773
- </template>
791
+ </template>
774
792
 
775
- <template if="layout == 'dvr extra-small'">
776
- <media-control-bar slot="top-chrome">
777
- <slot name="seek-live"></slot>
778
- </media-control-bar>
779
- {{>TimeRange}}
780
- <media-control-bar>
781
- {{>PlayButton}} {{>MuteButton}}
782
- <div class="spacer"></div>
783
- {{>CaptionsButton}} {{>FullscreenButton}}
784
- </media-control-bar>
785
- </template>
793
+ <template if="streamType == 'live'">
794
+
795
+ <template if="targetLiveWindow == null">
796
+
797
+ <template if="breakpointSm == null">
798
+ <media-control-bar slot="top-chrome">
799
+ {{>LiveButton}}
800
+ </media-control-bar>
801
+ <media-control-bar>
802
+ {{>PlayButton}}
803
+ {{>MuteButton}}
804
+ <div class="spacer"></div>
805
+ {{>CaptionsMenuButton}}
806
+ {{>FullscreenButton}}
807
+ </media-control-bar>
808
+ </template>
809
+
810
+ <template if="breakpointSm">
811
+ <template if="breakpointMd == null">
812
+ <media-control-bar slot="top-chrome">
813
+ {{>LiveButton}}
814
+ {{>TitleDisplay}}
815
+ </media-control-bar>
816
+ <div slot="centered-chrome" class="center-controls">
817
+ {{>PlayButton section="center"}}
818
+ </div>
819
+ <media-control-bar>
820
+ {{>PlayButton}}
821
+ {{>MuteButton}}
822
+ {{>VolumeRange}}
823
+ <div class="spacer"></div>
824
+ {{>CaptionsMenuButton}}
825
+ {{>AirplayButton}}
826
+ {{>CastButton}}
827
+ {{>PipButton}}
828
+ {{>FullscreenButton}}
829
+ </media-control-bar>
830
+ </template>
831
+ </template>
832
+
833
+ <template if="breakpointMd">
834
+ <media-control-bar slot="top-chrome">
835
+ {{>LiveButton}}
836
+ {{>TitleDisplay}}
837
+ </media-control-bar>
838
+ <div slot="centered-chrome" class="center-controls">
839
+ {{>PlayButton section="center"}}
840
+ </div>
841
+ <media-control-bar>
842
+ {{>PlayButton}}
843
+ {{>MuteButton}}
844
+ {{>VolumeRange}}
845
+ <div class="spacer"></div>
846
+ {{>CaptionsMenuButton}}
847
+ {{>AirplayButton}}
848
+ {{>CastButton}}
849
+ {{>PipButton}}
850
+ {{>FullscreenButton}}
851
+ </media-control-bar>
852
+ </template>
853
+ </template>
854
+
855
+ <template if="targetLiveWindow > 0">
856
+
857
+ <template if="breakpointSm == null">
858
+ <media-control-bar slot="top-chrome">
859
+ {{>LiveButton}}
860
+ </media-control-bar>
861
+ {{>TimeRange}}
862
+ <media-control-bar>
863
+ {{>PlayButton}}
864
+ {{>MuteButton}}
865
+ <div class="spacer"></div>
866
+ {{>CaptionsMenuButton}}
867
+ {{>FullscreenButton}}
868
+ </media-control-bar>
869
+ </template>
870
+
871
+ <template if="breakpointSm">
872
+ <template if="breakpointMd == null">
873
+ <media-control-bar slot="top-chrome">
874
+ {{>LiveButton}}
875
+ {{>TitleDisplay}}
876
+ </media-control-bar>
877
+ <div slot="centered-chrome" class="center-controls">
878
+ {{>SeekBackwardButton section="center"}}
879
+ {{>PlayButton section="center"}}
880
+ {{>SeekForwardButton section="center"}}
881
+ </div>
882
+ {{>TimeRange}}
883
+ <media-control-bar>
884
+ {{>PlayButton}}
885
+ {{>MuteButton}}
886
+ {{>VolumeRange}}
887
+ <div class="spacer"></div>
888
+ {{>CaptionsMenuButton}}
889
+ {{>AirplayButton}}
890
+ {{>CastButton}}
891
+ {{>PipButton}}
892
+ {{>FullscreenButton}}
893
+ </media-control-bar>
894
+ </template>
895
+ </template>
896
+
897
+ <template if="breakpointMd">
898
+ <media-control-bar slot="top-chrome">
899
+ {{>LiveButton}}
900
+ {{>TitleDisplay}}
901
+ </media-control-bar>
902
+ <div slot="centered-chrome" class="center-controls">
903
+ {{>PlayButton section="center"}}
904
+ </div>
905
+ {{>TimeRange}}
906
+ <media-control-bar>
907
+ {{>PlayButton}}
908
+ {{>SeekBackwardButton}}
909
+ {{>SeekForwardButton}}
910
+ {{>MuteButton}}
911
+ {{>VolumeRange}}
912
+ <div class="spacer"></div>
913
+ {{>CaptionsMenuButton}}
914
+ {{>AirplayButton}}
915
+ {{>CastButton}}
916
+ {{>PipButton}}
917
+ {{>FullscreenButton}}
918
+ </media-control-bar>
919
+ </template>
920
+
921
+ </template>
786
922
 
787
- <template if="layout == 'dvr small'">
788
- <media-control-bar slot="top-chrome">
789
- <slot name="seek-live"></slot>
790
- {{>TitleDisplay}}
791
- </media-control-bar>
792
- <div slot="centered-chrome" class="center-controls">
793
- {{>SeekBackwardButton section="center"}} {{>PlayButton section="center"}} {{>SeekForwardButton
794
- section="center"}}
795
- </div>
796
- {{>TimeRange}}
797
- <media-control-bar>
798
- {{>MuteButton}} {{>VolumeRange}}
799
- <div class="spacer"></div>
800
- {{>CaptionsButton}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
801
- </media-control-bar>
802
- </template>
923
+ </template>
803
924
 
804
- <template if="layout == 'dvr large'">
805
- <media-control-bar slot="top-chrome">
806
- <slot name="seek-live"></slot>
807
- {{>TitleDisplay}}
808
- </media-control-bar>
809
- <div slot="centered-chrome" class="center-controls">{{>PlayButton section="center"}}</div>
810
- {{>TimeRange}}
811
- <media-control-bar>
812
- {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>MuteButton}} {{>VolumeRange}}
813
- <div class="spacer"></div>
814
- {{>CaptionsButton}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}
815
- </media-control-bar>
816
925
  </template>
817
926
 
818
927
  <slot></slot>
928
+
819
929
  </media-controller>
820
930
  </template>
821
- `;var It=`
931
+ `;var ft=`
822
932
  :host {
823
933
  z-index: 100;
824
934
  display: flex;
@@ -870,17 +980,17 @@ a {
870
980
  text-align: center;
871
981
  line-height: 1.4;
872
982
  }
873
- `,_t=E.createElement("template");_t.innerHTML=`
983
+ `,yt=v.createElement("template");yt.innerHTML=`
874
984
  <style>
875
- ${It}
985
+ ${ft}
876
986
  </style>
877
987
 
878
988
  <div class="dialog">
879
989
  <slot></slot>
880
990
  </div>
881
- `;var V=class extends h.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})),Dt(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),ga(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")&&Dt(this)}};V.styles=It,V.template=_t,V.observedAttributes=["open"];function Dt(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=Nt(t.shadowRoot)),t._previouslyFocusedElement=E.activeElement,E.activeElement instanceof HTMLElement&&E.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function Nt(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=Nt(r[o].shadowRoot),i));o++);}return i}function ga(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}h.customElements.get("media-dialog")||(h.customElements.define("media-dialog",V),h.MediaDialog=V);var We=V;var Vt=E.createElement("template");Vt.innerHTML=`
991
+ `;var N=class extends p.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})),gt(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),jt(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")&&gt(this)}};N.styles=ft,N.template=yt,N.observedAttributes=["open"];function gt(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=vt(t.shadowRoot)),t._previouslyFocusedElement=v.activeElement,v.activeElement instanceof HTMLElement&&v.activeElement.blur(),t.addEventListener("transitionend",()=>{e instanceof HTMLElement&&e.focus({preventScroll:!0})},{once:!0})}function vt(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=vt(r[o].shadowRoot),i));o++);}return i}function jt(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}p.customElements.get("media-dialog")||(p.customElements.define("media-dialog",N),p.MediaDialog=N);var Ne=N;var kt=v.createElement("template");kt.innerHTML=`
882
992
  <style>
883
- ${We.styles}
993
+ ${Ne.styles}
884
994
 
885
995
  .close {
886
996
  background: none;
@@ -909,87 +1019,76 @@ a {
909
1019
  </svg>
910
1020
  </button>
911
1021
  </slot>
912
- `;var ne=class extends We{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ne.template=Vt;h.customElements.get("mxp-dialog")||(h.customElements.define("mxp-dialog",ne),h.MxpDialog=ne);import{TemplateInstance as fa,ChildNodePart as Ee,AttrPart as Te}from"media-chrome/dist/media-theme-element.js";var se=new WeakMap,le=class{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=se.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=se.get(this.element);e&&e.delete(this.type)}}static for(a){se.has(a.element)||se.set(a.element,new Map);let e=a.attributeName.slice(2),i=se.get(a.element);return i&&i.has(e)?i.get(e):new le(a.element,e)}};function ya(t,a){return t instanceof Te&&t.attributeName.startsWith("on")?(le.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function va(t,a){return a instanceof ke&&t instanceof Ee?(a.renderInto(t),!0):!1}function ka(t,a){return a instanceof DocumentFragment&&t instanceof Ee?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Ea(t,a){if(t instanceof Te){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 Ta(t,a){if(t instanceof Te&&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 Aa(t,a){if(typeof a=="boolean"&&t instanceof Te){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function xa(t,a){return a===!1&&t instanceof Ee?(t.replace(""),!0):!1}function wa(t,a){Ta(t,a)||Aa(t,a)||ya(t,a)||xa(t,a)||va(t,a)||ka(t,a)||Ea(t,a)}var ze=new Map,$t=new WeakMap,Ht=new WeakMap,ke=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(ze.has(this.stringsKey))return ze.get(this.stringsKey);{let a=E.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,o)=>i+r+(o<e?`{{ ${o} }}`:""),""),ze.set(this.stringsKey,a),a}}renderInto(a){let e=this.template;if($t.get(a)!==e){$t.set(a,e);let r=new fa(e,this.values,this.processor);Ht.set(a,r),a instanceof Ee?a.replace(...r.children):a.appendChild(r);return}let i=Ht.get(a);i&&i.update(this.values)}},La={processCallback(t,a,e){var i;if(!!e){for(let[r,o]of a)if(r in e){let n=(i=e[r])!=null?i:"";wa(o,n)}}}};function w(t,...a){return new ke(t,a,La)}function Kt(t,a){t.renderInto(a)}import{StreamTypes as G}from"@mux/playback-core";var qe=E.createElement("template");"innerHTML"in qe&&(qe.innerHTML=Bt);var Ft=t=>w`
1022
+ `;var ae=class extends Ne{constructor(){var a,e;super(),(e=(a=this.shadowRoot)==null?void 0:a.querySelector(".close"))==null||e.addEventListener("click",()=>{this.close()})}};ae.template=kt;p.customElements.get("mxp-dialog")||(p.customElements.define("mxp-dialog",ae),p.MxpDialog=ae);import{TemplateInstance as Gt,ChildNodePart as ye,AttrPart as ve}from"media-chrome/dist/media-theme-element.js";var ie=new WeakMap,re=class{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=ie.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=ie.get(this.element);e&&e.delete(this.type)}}static for(a){ie.has(a.element)||ie.set(a.element,new Map);let e=a.attributeName.slice(2),i=ie.get(a.element);return i&&i.has(e)?i.get(e):new re(a.element,e)}};function zt(t,a){return t instanceof ve&&t.attributeName.startsWith("on")?(re.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function Jt(t,a){return a instanceof fe&&t instanceof ye?(a.renderInto(t),!0):!1}function Qt(t,a){return a instanceof DocumentFragment&&t instanceof ye?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function Xt(t,a){if(t instanceof ve){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 ea(t,a){if(t instanceof ve&&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 ve){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function aa(t,a){return a===!1&&t instanceof ye?(t.replace(""),!0):!1}function ia(t,a){ea(t,a)||ta(t,a)||zt(t,a)||aa(t,a)||Jt(t,a)||Qt(t,a)||Xt(t,a)}var Ve=new Map,Et=new WeakMap,At=new WeakMap,fe=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(Ve.has(this.stringsKey))return Ve.get(this.stringsKey);{let a=v.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,o)=>i+r+(o<e?`{{ ${o} }}`:""),""),Ve.set(this.stringsKey,a),a}}renderInto(a){let e=this.template;if(Et.get(a)!==e){Et.set(a,e);let r=new Gt(e,this.values,this.processor);At.set(a,r),a instanceof ye?a.replace(...r.children):a.appendChild(r);return}let i=At.get(a);i&&i.update(this.values)}},ra={processCallback(t,a,e){var i;if(!!e){for(let[r,o]of a)if(r in e){let n=(i=e[r])!=null?i:"";ia(o,n)}}}};function C(t,...a){return new fe(t,a,ra)}function Tt(t,a){t.renderInto(a)}import{StreamTypes as ke}from"@mux/playback-core";var He=v.createElement("template");"innerHTML"in He&&(He.innerHTML=ht);var xt=t=>C`
913
1023
  <style>
914
- ${Pt}
1024
+ ${bt}
915
1025
  </style>
916
- ${Ca(t)}
917
- `,je=t=>[G.LIVE,G.LL_LIVE].includes(t.streamType),Ge=t=>[G.LIVE,G.LL_LIVE,G.DVR,G.LL_DVR].includes(t.streamType),Sa=t=>{let a="";return t.audio&&(a+="audio "),je(t)?a+="live":Ge(t)?a+="dvr":a+=t.streamType||"on-demand",!t.audio&&t.playerSize&&(a+=` ${t.playerSize}`),a},Oa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return Ge(t)&&(a+=" noarrowleft noarrowright"),a},Ca=t=>{var a,e,i,r,o,n,m,b,f,A,D,I,g,O,C,R,y,pe,te,W,et,tt,at,it,rt,ot,nt,st,lt,dt,ut,mt;return w`
1026
+ ${na(t)}
1027
+ `,wt=t=>[ke.LIVE,ke.LL_LIVE].includes(t.streamType),Lt=t=>[ke.DVR,ke.LL_DVR].includes(t.streamType),Ot=t=>wt(t)||Lt(t),oa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return Ot(t)&&(a+=" noarrowleft noarrowright"),a},na=t=>{var a,e,i,r,o,n,m,g,T,E,B,D,h,w,L,O,f,me,J,q,Fe,Ue,Ye,Ze,We,qe,je,Ge,ze,Je,Qe;return C`
918
1028
  <media-theme
919
- template="${(a=t.theme)!=null?a:qe.content.children[0]}"
920
- class="size-${t.playerSize}${t.secondaryColor?" two-tone":""}"
921
- player-size="${(e=t.playerSize)!=null?e:!1}"
922
- layout="${Sa(t)}"
923
- hotkeys="${Oa(t)||!1}"
1029
+ template="${(a=t.theme)!=null?a:He.content.children[0]}"
1030
+ class="${t.secondaryColor?"two-tone":!1}"
1031
+ stream-type="${Ot(t)?"live":"on-demand"}"
1032
+ target-live-window="${Lt(t)?1:!1}"
1033
+ hotkeys="${oa(t)||!1}"
924
1034
  nohotkeys="${t.noHotKeys||!t.hasSrc||t.isDialogOpen||!1}"
925
1035
  disabled="${!t.hasSrc||t.isDialogOpen}"
926
- audio="${(i=t.audio)!=null?i:!1}"
927
- style="${(r=gt({"--primary-color":t.primaryColor,"--secondary-color":t.secondaryColor}))!=null?r:!1}"
1036
+ audio="${(e=t.audio)!=null?e:!1}"
1037
+ style="${(i=at({"--primary-color":t.primaryColor,"--secondary-color":t.secondaryColor}))!=null?i:!1}"
928
1038
  default-showing-captions="${!t.defaultHiddenCaptions}"
929
- forward-seek-offset="${(o=t.forwardSeekOffset)!=null?o:!1}"
930
- backward-seek-offset="${(n=t.backwardSeekOffset)!=null?n:!1}"
931
- playback-rates="${(m=t.playbackRates)!=null?m:!1}"
932
- default-show-remaining-time="${(b=t.defaultShowRemainingTime)!=null?b:!1}"
933
- title="${(f=t.title)!=null?f:!1}"
934
- poster="${t.poster===""?!1:(A=t.poster)!=null?A:!1}"
935
- placeholder="${(D=t.placeholder)!=null?D:!1}"
1039
+ forward-seek-offset="${(r=t.forwardSeekOffset)!=null?r:!1}"
1040
+ backward-seek-offset="${(o=t.backwardSeekOffset)!=null?o:!1}"
1041
+ playback-rates="${(n=t.playbackRates)!=null?n:!1}"
1042
+ default-show-remaining-time="${(m=t.defaultShowRemainingTime)!=null?m:!1}"
1043
+ title="${(g=t.title)!=null?g:!1}"
1044
+ poster="${t.poster===""?!1:(T=t.poster)!=null?T:!1}"
1045
+ placeholder="${(E=t.placeholder)!=null?E:!1}"
936
1046
  exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, poster, seek-live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
937
1047
  >
938
1048
  <mux-video
939
1049
  slot="media"
940
- crossorigin="${(I=t.crossOrigin)!=null?I:""}"
1050
+ crossorigin="${(B=t.crossOrigin)!=null?B:""}"
941
1051
  playsinline
942
- autoplay="${(g=t.autoplay)!=null?g:!1}"
943
- muted="${(O=t.muted)!=null?O:!1}"
944
- loop="${(C=t.loop)!=null?C:!1}"
945
- preload="${(R=t.preload)!=null?R:!1}"
946
- debug="${(y=t.debug)!=null?y:!1}"
947
- prefer-cmcd="${(pe=t.preferCmcd)!=null?pe:!1}"
948
- disable-cookies="${(te=t.disableCookies)!=null?te:!1}"
949
- prefer-playback="${(W=t.preferPlayback)!=null?W:!1}"
1052
+ autoplay="${(D=t.autoplay)!=null?D:!1}"
1053
+ muted="${(h=t.muted)!=null?h:!1}"
1054
+ loop="${(w=t.loop)!=null?w:!1}"
1055
+ preload="${(L=t.preload)!=null?L:!1}"
1056
+ debug="${(O=t.debug)!=null?O:!1}"
1057
+ prefer-cmcd="${(f=t.preferCmcd)!=null?f:!1}"
1058
+ disable-cookies="${(me=t.disableCookies)!=null?me:!1}"
1059
+ prefer-playback="${(J=t.preferPlayback)!=null?J:!1}"
950
1060
  start-time="${t.startTime!=null?t.startTime:!1}"
951
- beacon-collection-domain="${(et=t.beaconCollectionDomain)!=null?et:!1}"
952
- player-software-name="${(tt=t.playerSoftwareName)!=null?tt:!1}"
953
- player-software-version="${(at=t.playerSoftwareVersion)!=null?at:!1}"
954
- env-key="${(it=t.envKey)!=null?it:!1}"
955
- stream-type="${(rt=t.streamType)!=null?rt:!1}"
956
- custom-domain="${(ot=t.customDomain)!=null?ot:!1}"
957
- src="${t.src?t.src:t.playbackId?Fe(t.playbackId,{domain:t.customDomain,token:t.tokens.playback}):!1}"
958
- cast-src="${t.src?t.src:t.playbackId?Fe(t.playbackId,{domain:t.customDomain,token:t.tokens.playback}):!1}"
959
- cast-stream-type="${je(t)?"live":!1}"
1061
+ beacon-collection-domain="${(q=t.beaconCollectionDomain)!=null?q:!1}"
1062
+ player-software-name="${(Fe=t.playerSoftwareName)!=null?Fe:!1}"
1063
+ player-software-version="${(Ue=t.playerSoftwareVersion)!=null?Ue:!1}"
1064
+ env-key="${(Ye=t.envKey)!=null?Ye:!1}"
1065
+ stream-type="${(Ze=t.streamType)!=null?Ze:!1}"
1066
+ custom-domain="${(We=t.customDomain)!=null?We:!1}"
1067
+ src="${t.src?t.src:t.playbackId?De(t.playbackId,{domain:t.customDomain,token:t.tokens.playback}):!1}"
1068
+ cast-src="${t.src?t.src:t.playbackId?De(t.playbackId,{domain:t.customDomain,token:t.tokens.playback}):!1}"
1069
+ cast-stream-type="${wt(t)?"live":!1}"
960
1070
  exportparts="video"
961
1071
  >
962
- ${t.storyboard?w`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:w``}
1072
+ ${t.storyboard?C`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:C``}
963
1073
  </mux-video>
964
- ${Ge(t)?w`<button
965
- slot="seek-live"
966
- part="${je(t)?"top":"bottom"} seek-live button"
967
- disabled="${t.inLiveWindow||!t.hasSrc||t.isDialogOpen}"
968
- aria-disabled="${(t.inLiveWindow||!t.hasSrc||t.isDialogOpen)&&"true"}"
969
- in-live-window="${t.inLiveWindow}"
970
- onclick="${function(Xt){var ct;if((ct=t.onSeekToLive)==null||ct.call(t,Xt),t.paused){let Qt=new CustomEvent("mediaplayrequest",{composed:!0,bubbles:!0});this.dispatchEvent(Qt)}}}"
971
- >
972
- <svg viewBox="0 0 8 8"><circle cx="4" cy="4" r="4"></circle></svg>
973
- Live
974
- </button>`:w``}
975
1074
  <mxp-dialog
976
1075
  no-auto-hide
977
- open="${(nt=t.isDialogOpen)!=null?nt:!1}"
1076
+ open="${(qe=t.isDialogOpen)!=null?qe:!1}"
978
1077
  onclose="${t.onCloseErrorDialog}"
979
1078
  oninitfocus="${t.onInitFocusDialog}"
980
1079
  >
981
- ${(st=t.dialog)!=null&&st.title?w`<h3>${t.dialog.title}</h3>`:w``}
1080
+ ${(je=t.dialog)!=null&&je.title?C`<h3>${t.dialog.title}</h3>`:C``}
982
1081
  <p>
983
- ${(lt=t.dialog)==null?void 0:lt.message}
984
- ${(dt=t.dialog)!=null&&dt.linkUrl?w`<a
1082
+ ${(Ge=t.dialog)==null?void 0:Ge.message}
1083
+ ${(ze=t.dialog)!=null&&ze.linkUrl?C`<a
985
1084
  href="${t.dialog.linkUrl}"
986
1085
  target="_blank"
987
1086
  rel="external noopener"
988
- aria-label="${(ut=t.dialog.linkText)!=null?ut:""} ${d("(opens in a new window)")}"
989
- >${(mt=t.dialog.linkText)!=null?mt:t.dialog.linkUrl}</a
990
- >`:w``}
1087
+ aria-label="${(Je=t.dialog.linkText)!=null?Je:""} ${d("(opens in a new window)")}"
1088
+ >${(Qe=t.dialog.linkText)!=null?Qe:t.dialog.linkUrl}</a
1089
+ >`:C``}
991
1090
  </p>
992
1091
  </mxp-dialog>
993
1092
  </media-theme>
994
- `};import{MediaError as Ae}from"@mux/mux-video";function xe(t,a,e,i,r){var m,b,f;let o={},n={};switch(t.code){case Ae.MEDIA_ERR_NETWORK:{switch(o.title=d("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=d("Video is not currently available",r),o.message=d("The live stream or video file are not yet ready.",r),n.message=d("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),n.file="412-not-playable.md";break}case 404:{o.title=d("Video does not exist",r),o.message="",n.message=d("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),n.file="404-not-found.md";break}case 403:{if(o.title=d("Invalid playback URL",r),o.message=d("The video URL or playback-token are formatted with incorrect or incomplete information.",r),n.message=d("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),n.file="missing-signed-tokens.md",!i)break;let{exp:A,aud:D,sub:I}=_(i),g=Date.now()>A*1e3,O=I!==e,C=D!=="v",R={timeStyle:"medium",dateStyle:"medium"};if(g){o.title=d("Video URL has expired",r),o.message=d("The video\u2019s secured playback-token has expired.",r),n.message=d("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(H.code,R).format(A*1e3),currentDate:new Intl.DateTimeFormat(H.code,R).format(Date.now())}),n.file="403-expired-token.md";break}if(O){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),n.message=d("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:e,tokenPlaybackId:I}),n.file="403-playback-id-mismatch.md";break}if(C){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The playback-token is formatted with incorrect information.",r),n.message=d("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:D}),n.file="403-incorrect-aud-value.md";break}n.message=d("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),n.file="403-malformatted-token.md";break}}break}case Ae.MEDIA_ERR_DECODE:{let{message:A}=t;o={title:d("Media Error",r),message:A},n.file="media-decode-error.md";break}case Ae.MEDIA_ERR_SRC_NOT_SUPPORTED:{let A=(f=(b=t.data)==null?void 0:b.response)==null?void 0:f.code;if(A>=400&&A<500){t.code=Ae.MEDIA_ERR_NETWORK,t.data={response:{code:A}},{dialog:o,devlog:n}=xe(t,a,e,i);break}o={title:d("Source Not Supported",r),message:t.message},n.file="media-src-not-supported.md";break}default:o={title:d("Error",r),message:t.message};break}return a&&(o={title:d("Your device appears to be offline",r),message:d("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:n}}var Da=Object.values(x),Ia=700,_a=300,Xe={LG:"large",SM:"small",XS:"extra-small"};function Le(t){let a=t.getBoundingClientRect();return a.width<_a?Xe.XS:a.width<Ia?Xe.SM:Xe.LG}var P={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",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"};function Na(t,a){var i,r;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(s.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),theme:t.getAttribute("theme"),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(s.NOHOTKEYS),hotKeys:t.getAttribute(s.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,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,streamType:t.streamType,primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,playbackRates:t.getAttribute(s.PLAYBACK_RATES),customDomain:(i=t.getAttribute(u.CUSTOM_DOMAIN))!=null?i:void 0,playerSize:Le((r=t.mediaController)!=null?r:t),title:t.getAttribute(s.TITLE),...a}}var Va=Object.values(u),$a=Object.values(P),Ha=Object.values(s),Ka=fe(),Fa="mux-player",Yt={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},Z,ue,B,me,X,S,Q,Se,Ce,Zt,$,J,ee,Oe,ce,Qe,Re,Wt,Me,zt,Pe,qt,Be,jt,De,Gt,Ie,Jt,de=class extends Ze{constructor(){super();c(this,Q);c(this,Ce);c(this,$);c(this,ee);c(this,ce);c(this,Re);c(this,Me);c(this,Pe);c(this,Be);c(this,De);c(this,Ie);c(this,Z,!1);c(this,ue,{});c(this,B,!0);c(this,me,new ge(this,"hotkeys"));c(this,X,void 0);c(this,S,{...Yt,onCloseErrorDialog:()=>p(this,$,J).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{He(this,E.activeElement)||e.preventDefault()},onSeekToLive:()=>Ue(this)});this.attachShadow({mode:"open"}),p(this,Ce,Zt).call(this),this.isConnected&&p(this,Q,Se).call(this)}static get observedAttributes(){var e;return[...(e=Ze.observedAttributes)!=null?e:[],...$a,...Va,...Ha]}get theme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.theme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=this.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},{})}connectedCallback(){var i;p(this,ce,Qe).call(this);let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=this.metadataFromAttrs),p(this,Re,Wt).call(this)}disconnectedCallback(){p(this,Me,zt).call(this)}attributeChangedCallback(e,i,r){switch(l(this,Z)||p(this,Q,Se).call(this),super.attributeChangedCallback(e,i,r),e){case s.HOTKEYS:l(this,me).value=r;break;case s.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&N(d("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:n}=_(r);r&&n!=="t"&&N(d("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case s.STORYBOARD_TOKEN:{let{aud:n}=_(r);r&&n!=="s"&&N(d("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case u.PLAYBACK_ID:{r!=null&&r.includes("?token")&&L(d("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!Da.includes(this.streamType)&&ye({file:"invalid-stream-type.md",message:d("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):ye({file:"invalid-stream-type.md",message:String(d("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[u.PLAYBACK_ID,P.SRC,s.PLAYBACK_TOKEN].includes(e)&&i!==r&&k(this,S,{...l(this,S),...Yt}),p(this,ee,Oe).call(this,{[Tt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(u.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Ut.includes(e)?this.setAttribute(u.PREFER_CMCD,e):N(`Invalid value for preferCmcd. Must be one of ${Ut.join()}`):this.removeAttribute(u.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?i:!1}get inLiveWindow(){return l(this,S).inLiveWindow}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 playbackId(){var e;return(e=this.getAttribute(u.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(u.PLAYBACK_ID,e):this.removeAttribute(u.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=Y(this,P.SRC))!=null?e:void 0:(i=this.getAttribute(P.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(P.SRC,e):this.removeAttribute(P.SRC)}get poster(){var i;let e=this.getAttribute(P.POSTER);if(e!=null)return e;if(this.playbackId&&!this.audio)return kt(this.playbackId,{domain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(P.POSTER,e):this.removeAttribute(P.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(s.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(s.STORYBOARD_SRC,e):this.removeAttribute(s.STORYBOARD_SRC)}get storyboard(){if(!this.audio&&(!this.streamType||![x.LIVE,x.LL_LIVE,x.DVR,x.LL_DVR].includes(this.streamType))){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(this.playbackId)return Et(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}}get audio(){return this.hasAttribute(s.AUDIO)}set audio(e){if(!e){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return l(this,me)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return M(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(s.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(s.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(s.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Y(this,s.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(s.PLACEHOLDER,`${e}`)}get primaryColor(){var e;return(e=this.getAttribute(s.PRIMARY_COLOR))!=null?e:void 0}set primaryColor(e){this.setAttribute(s.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e;return(e=this.getAttribute(s.SECONDARY_COLOR))!=null?e:"rgb(0 0 0 / .65)"}set secondaryColor(e){this.setAttribute(s.SECONDARY_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=M(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=M(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_NAME))!=null?e:Fa}get playerSoftwareVersion(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_VERSION))!=null?e:Ka}get beaconCollectionDomain(){var e;return(e=this.getAttribute(u.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(u.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(u.BEACON_COLLECTION_DOMAIN))}get customDomain(){var e;return(e=this.getAttribute(u.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(u.CUSTOM_DOMAIN,e):this.removeAttribute(u.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Y(this,u.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(u.ENV_KEY,`${e}`)}get debug(){return Y(this,u.DEBUG)!=null}set debug(e){e?this.setAttribute(u.DEBUG,""):this.removeAttribute(u.DEBUG)}get disableCookies(){return Y(this,u.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(u.DISABLE_COOKIES,""):this.removeAttribute(u.DISABLE_COOKIES)}get streamType(){return Y(this,u.STREAM_TYPE)}set streamType(e){this.setAttribute(u.STREAM_TYPE,`${e}`)}get startTime(){return M(Y(this,u.START_TIME))}set startTime(e){this.setAttribute(u.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(u.PREFER_PLAYBACK);if(e===we.MSE||e===we.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===we.MSE||e===we.NATIVE?this.setAttribute(u.PREFER_PLAYBACK,e):this.removeAttribute(u.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(l(this,Z)||p(this,Q,Se).call(this),!this.media){L("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...e}}get tokens(){let e=this.getAttribute(s.PLAYBACK_TOKEN),i=this.getAttribute(s.THUMBNAIL_TOKEN),r=this.getAttribute(s.STORYBOARD_TOKEN);return{...l(this,ue),...e!=null?{playback:e}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(e){k(this,ue,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(s.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(s.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(s.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(s.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(s.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let n=(m=this.media)==null?void 0:m.nativeEl;if(!!n)return Pa(n,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(!!i)return Ba(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};Z=new WeakMap,ue=new WeakMap,B=new WeakMap,me=new WeakMap,X=new WeakMap,S=new WeakMap,Q=new WeakSet,Se=function(){var e,i;if(!l(this,Z)){k(this,Z,!0),p(this,$,J).call(this,{playerSize:Le(this)});try{if(customElements.upgrade(this.theme),!(this.theme instanceof h.HTMLElement))throw""}catch{L("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof Ma))throw""}catch{L("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof Ra))throw""}catch{L("<media-controller> failed to upgrade!")}Ot(this),p(this,Be,jt).call(this),p(this,De,Gt).call(this),p(this,Pe,qt).call(this),k(this,B,(i=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?i:!0),p(this,Ie,Jt).call(this)}},Ce=new WeakSet,Zt=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},$=new WeakSet,J=function(e){Object.assign(l(this,S),e),p(this,ee,Oe).call(this)},ee=new WeakSet,Oe=function(e={}){Kt(Ft(Na(this,{...l(this,S),...e})),this.shadowRoot)},ce=new WeakSet,Qe=function(){var e,i;l(this,S).playerSize!=Le((e=this.mediaController)!=null?e:this)&&p(this,$,J).call(this,{playerSize:Le((i=this.mediaController)!=null?i:this)})},Re=new WeakSet,Wt=function(){var e;k(this,X,new ResizeObserver(()=>p(this,ce,Qe).call(this))),l(this,X).observe((e=this.mediaController)!=null?e:this)},Me=new WeakSet,zt=function(){var e;(e=l(this,X))==null||e.disconnect()},Pe=new WeakSet,qt=function(){var i,r,o,n,m;(i=this.mediaController)==null||i.addEventListener("mediaplayrequest",b=>{var f;((f=b.target)==null?void 0:f.localName)==="media-play-button"&&this.streamType&&[x.LIVE,x.LL_LIVE,x.DVR,x.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Ue(this)});let e=()=>{let b=xt(this),f=l(this,S).inLiveWindow;b!==f&&(p(this,$,J).call(this,{inLiveWindow:b}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(r=this.media)==null||r.addEventListener("progress",e),(o=this.media)==null||o.addEventListener("waiting",e),(n=this.media)==null||n.addEventListener("timeupdate",e),(m=this.media)==null||m.addEventListener("emptied",e)},Be=new WeakSet,jt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof Je||(o=new Je(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){N(o),o.data&&N(`${o.name} data:`,o.data);return}let{dialog:n,devlog:m}=xe(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&ye(m),L(o),o.data&&L(`${o.name} data:`,o.data),p(this,$,J).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var n,m,b;if(!((n=this.media)!=null&&n.error))return r;let{devlog:o}=xe((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(b=this.media)==null?void 0:b.error.code,player_error_message:o.message?String(o.message):r.player_error_message}}),(i=this.media)==null||i.addEventListener("error",r=>{var n,m;let{detail:o}=r;if(!o){let{message:b,code:f}=(m=(n=this.media)==null?void 0:n.error)!=null?m:{};o=new Je(b,f)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},De=new WeakSet,Gt=function(){var i,r,o,n;let e=()=>p(this,ee,Oe).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(n=(o=this.media)==null?void 0:o.textTracks)==null||n.addEventListener("removetrack",e)},Ie=new WeakSet,Jt=function(){var A,D,I;let e=this.mediaController,i=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(i)return;let r,o=new WeakMap,n=()=>this.streamType&&[x.LIVE,x.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,m=(g,O,C=!1)=>{if(n())return;Array.from(g&&g.activeCues||[]).forEach(y=>{if(!(!y.snapToLines||y.line<-5||y.line>=0&&y.line<10))if(!O||this.paused){let pe=y.text.split(`
995
- `).length,te=i?-2:-3;this.streamType&&[x.LIVE,x.LL_LIVE].includes(this.streamType)&&(te=i?-1:-2);let W=te-pe;if(y.line===W&&!C)return;o.has(y)||o.set(y,y.line),y.line=W-1,y.line=W}else setTimeout(()=>{y.line=o.get(y)||"auto"},500)})},b=()=>{var g;m(r,(g=e==null?void 0:e.hasAttribute("user-inactive"))!=null?g:!1)},f=()=>{var C;let O=Array.from(((C=e==null?void 0:e.media)==null?void 0:C.textTracks)||[]).filter(R=>["subtitles","captions"].includes(R.kind)&&R.mode==="showing")[0];O!==r&&(r==null||r.removeEventListener("cuechange",b)),r=O,r==null||r.addEventListener("cuechange",b),m(r,l(this,B))};if(f(),(A=e==null?void 0:e.media)==null||A.textTracks.addEventListener("change",f),(D=e==null?void 0:e.media)==null||D.textTracks.addEventListener("addtrack",f),navigator.userAgent.includes("Chrome/")){let g=()=>{m(r,l(this,B),!0),this.paused||window.requestAnimationFrame(g)};(I=e==null?void 0:e.media)==null||I.addEventListener("playing",()=>{g()})}e==null||e.addEventListener("userinactivechange",()=>{let g=e==null?void 0:e.hasAttribute("user-inactive");l(this,B)!==g&&(k(this,B,g),m(r,l(this,B)))})};function Y(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}h.customElements.get("mux-player")||(h.customElements.define("mux-player",de),h.MuxPlayerElement=de);var qi=de;export{Je as MediaError,qi as default,Y as getVideoAttribute};
1093
+ `};import{MediaError as Ee}from"@mux/mux-video";function Ae(t,a,e,i,r){var m,g,T;let o={},n={};switch(t.code){case Ee.MEDIA_ERR_NETWORK:{switch(o.title=d("Network Error",r),o.message=t.message,(m=t.data)==null?void 0:m.response.code){case 412:{o.title=d("Video is not currently available",r),o.message=d("The live stream or video file are not yet ready.",r),n.message=d("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),n.file="412-not-playable.md";break}case 404:{o.title=d("Video does not exist",r),o.message="",n.message=d("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),n.file="404-not-found.md";break}case 403:{if(o.title=d("Invalid playback URL",r),o.message=d("The video URL or playback-token are formatted with incorrect or incomplete information.",r),n.message=d("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",r),n.file="missing-signed-tokens.md",!i)break;let{exp:E,aud:B,sub:D}=I(i),h=Date.now()>E*1e3,w=D!==e,L=B!=="v",O={timeStyle:"medium",dateStyle:"medium"};if(h){o.title=d("Video URL has expired",r),o.message=d("The video\u2019s secured playback-token has expired.",r),n.message=d("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat(H.code,O).format(E*1e3),currentDate:new Intl.DateTimeFormat(H.code,O).format(Date.now())}),n.file="403-expired-token.md";break}if(w){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The video\u2019s playback ID does not match the one encoded in the playback-token.",r),n.message=d("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",r).format({playbackId:e,tokenPlaybackId:D}),n.file="403-playback-id-mismatch.md";break}if(L){o.title=d("Video URL is formatted incorrectly",r),o.message=d("The playback-token is formatted with incorrect information.",r),n.message=d("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",r).format({tokenType:B}),n.file="403-incorrect-aud-value.md";break}n.message=d("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",r),n.file="403-malformatted-token.md";break}}break}case Ee.MEDIA_ERR_DECODE:{let{message:E}=t;o={title:d("Media Error",r),message:E},n.file="media-decode-error.md";break}case Ee.MEDIA_ERR_SRC_NOT_SUPPORTED:{let E=(T=(g=t.data)==null?void 0:g.response)==null?void 0:T.code;if(E>=400&&E<500){t.code=Ee.MEDIA_ERR_NETWORK,t.data={response:{code:E}},{dialog:o,devlog:n}=Ae(t,a,e,i);break}o={title:d("Source Not Supported",r),message:t.message},n.file="media-src-not-supported.md";break}default:o={title:d("Error",r),message:t.message};break}return a&&(o={title:d("Your device appears to be offline",r),message:d("Check your internet connection and try reloading this video.",r)}),{dialog:o,devlog:n}}var ma=Object.values(R),M={SRC:"src",POSTER:"poster"},s={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",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"};function ca(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(s.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),theme:t.getAttribute("theme"),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(s.NOHOTKEYS),hotKeys:t.getAttribute(s.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,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,streamType:t.streamType,primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultShowRemainingTime:t.defaultShowRemainingTime,playbackRates:t.getAttribute(s.PLAYBACK_RATES),customDomain:(i=t.getAttribute(u.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(s.TITLE),...a}}var pa=Object.values(u),ba=Object.values(M),ha=Object.values(s),ga=be(),fa="mux-player",Ct={dialog:void 0,isDialogOpen:!1},V,le,P,de,Y,Z,oe,xe,Rt,ue,Ke,W,ne,we,Mt,Le,Pt,Oe,Bt,se=class extends _e{constructor(){super();c(this,Z);c(this,xe);c(this,ue);c(this,W);c(this,we);c(this,Le);c(this,Oe);c(this,V,!1);c(this,le,{});c(this,P,!0);c(this,de,new pe(this,"hotkeys"));c(this,Y,{...Ct,onCloseErrorDialog:()=>b(this,ue,Ke).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{Pe(this,v.activeElement)||e.preventDefault()}});this.attachShadow({mode:"open"}),b(this,xe,Rt).call(this),this.isConnected&&b(this,Z,oe).call(this)}static get observedAttributes(){var e;return[...(e=_e.observedAttributes)!=null?e:[],...ba,...pa,...ha]}get theme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.theme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}get metadataFromAttrs(){return this.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=this.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},{})}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=this.metadataFromAttrs)}attributeChangedCallback(e,i,r){switch(l(this,V)||b(this,Z,oe).call(this),super.attributeChangedCallback(e,i,r),e){case s.HOTKEYS:l(this,de).value=r;break;case s.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&_(d("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case s.THUMBNAIL_TOKEN:{let{aud:n}=I(r);r&&n!=="t"&&_(d("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case s.STORYBOARD_TOKEN:{let{aud:n}=I(r);r&&n!=="s"&&_(d("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case u.PLAYBACK_ID:{r!=null&&r.includes("?token")&&x(d("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r})),this.streamType?this.streamType!=null&&!ma.includes(this.streamType)&&he({file:"invalid-stream-type.md",message:d("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`").format({streamType:this.streamType})}):he({file:"invalid-stream-type.md",message:String(d("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live`, `ll-live`, `live:dvr`, or `ll-live:dvr`"))});break}}[u.PLAYBACK_ID,M.SRC,s.PLAYBACK_TOKEN].includes(e)&&i!==r&&A(this,Y,{...l(this,Y),...Ct}),b(this,W,ne).call(this,{[nt(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(u.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?St.includes(e)?this.setAttribute(u.PREFER_CMCD,e):_(`Invalid value for preferCmcd. Must be one of ${St.join()}`):this.removeAttribute(u.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?i:!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 playbackId(){var e;return(e=this.getAttribute(u.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(u.PLAYBACK_ID,e):this.removeAttribute(u.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=U(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 rt(this.playbackId,{domain: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(s.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(s.STORYBOARD_SRC,e):this.removeAttribute(s.STORYBOARD_SRC)}get storyboard(){if(!this.audio&&(!this.streamType||![R.LIVE,R.LL_LIVE,R.DVR,R.LL_DVR].includes(this.streamType))){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(this.playbackId)return ot(this.playbackId,{domain:this.customDomain,token:this.tokens.storyboard})}}get audio(){return this.hasAttribute(s.AUDIO)}set audio(e){if(!e){this.removeAttribute(s.AUDIO);return}this.setAttribute(s.AUDIO,"")}get hotkeys(){return l(this,de)}get nohotkeys(){return this.hasAttribute(s.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(s.NOHOTKEYS);return}this.setAttribute(s.NOHOTKEYS,"")}get thumbnailTime(){return S(this.getAttribute(s.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(s.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(s.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(s.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=U(this,s.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(s.PLACEHOLDER,`${e}`)}get primaryColor(){var e;return(e=this.getAttribute(s.PRIMARY_COLOR))!=null?e:void 0}set primaryColor(e){this.setAttribute(s.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e;return(e=this.getAttribute(s.SECONDARY_COLOR))!=null?e:"rgb(0 0 0 / .75)"}set secondaryColor(e){this.setAttribute(s.SECONDARY_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(s.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(s.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(!!this.hasAttribute(s.PLAYBACK_RATES))return this.getAttribute(s.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,i)=>e-i)}set playbackRates(e){if(!e){this.removeAttribute(s.PLAYBACK_RATES);return}this.setAttribute(s.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=S(this.getAttribute(s.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(s.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=S(this.getAttribute(s.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(s.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(s.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(s.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_NAME))!=null?e:fa}get playerSoftwareVersion(){var e;return(e=this.getAttribute(u.PLAYER_SOFTWARE_VERSION))!=null?e:ga}get beaconCollectionDomain(){var e;return(e=this.getAttribute(u.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(u.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(u.BEACON_COLLECTION_DOMAIN))}get customDomain(){var e;return(e=this.getAttribute(u.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(u.CUSTOM_DOMAIN,e):this.removeAttribute(u.CUSTOM_DOMAIN))}get envKey(){var e;return(e=U(this,u.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(u.ENV_KEY,`${e}`)}get debug(){return U(this,u.DEBUG)!=null}set debug(e){e?this.setAttribute(u.DEBUG,""):this.removeAttribute(u.DEBUG)}get disableCookies(){return U(this,u.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(u.DISABLE_COOKIES,""):this.removeAttribute(u.DISABLE_COOKIES)}get streamType(){return U(this,u.STREAM_TYPE)}set streamType(e){this.setAttribute(u.STREAM_TYPE,`${e}`)}get startTime(){return S(U(this,u.START_TIME))}set startTime(e){this.setAttribute(u.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(u.PREFER_PLAYBACK);if(e===Te.MSE||e===Te.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Te.MSE||e===Te.NATIVE?this.setAttribute(u.PREFER_PLAYBACK,e):this.removeAttribute(u.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(l(this,V)||b(this,Z,oe).call(this),!this.media){x("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...this.metadataFromAttrs,...e}}async addCuePoints(e){var i;if(l(this,V)||b(this,Z,oe).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:[]}get tokens(){let e=this.getAttribute(s.PLAYBACK_TOKEN),i=this.getAttribute(s.THUMBNAIL_TOKEN),r=this.getAttribute(s.STORYBOARD_TOKEN);return{...l(this,le),...e!=null?{playback:e}:{},...i!=null?{thumbnail:i}:{},...r!=null?{storyboard:r}:{}}}set tokens(e){A(this,le,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(s.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(s.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(s.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(s.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(s.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(s.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,o){var m;let n=(m=this.media)==null?void 0:m.nativeEl;if(!!n)return da(n,e,i,r,o)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(!!i)return ua(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};V=new WeakMap,le=new WeakMap,P=new WeakMap,de=new WeakMap,Y=new WeakMap,Z=new WeakSet,oe=function(){var e,i;if(!l(this,V)){A(this,V,!0),b(this,W,ne).call(this);try{if(customElements.upgrade(this.theme),!(this.theme instanceof p.HTMLElement))throw""}catch{x("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof la))throw""}catch{x("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof sa))throw""}catch{x("<media-controller> failed to upgrade!")}ut(this),b(this,we,Mt).call(this),b(this,Le,Pt).call(this),A(this,P,(i=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?i:!0),b(this,Oe,Bt).call(this)}},xe=new WeakSet,Rt=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--primary-color",syntax:"<color>",inherits:!0,initialValue:"white"}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--secondary-color",syntax:"<color>",inherits:!0,initialValue:"transparent"})}catch{}},ue=new WeakSet,Ke=function(e){Object.assign(l(this,Y),e),b(this,W,ne).call(this)},W=new WeakSet,ne=function(e={}){Tt(xt(ca(this,{...l(this,Y),...e})),this.shadowRoot)},we=new WeakSet,Mt=function(){var i;let e=r=>{let{detail:o}=r;if(o instanceof $e||(o=new $e(o.message,o.code,o.fatal)),!(o!=null&&o.fatal)){_(o),o.data&&_(`${o.name} data:`,o.data);return}let{dialog:n,devlog:m}=Ae(o,!window.navigator.onLine,this.playbackId,this.playbackToken);m.message&&he(m),x(o),o.data&&x(`${o.name} data:`,o.data),b(this,ue,Ke).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var n,m,g;if(!((n=this.media)!=null&&n.error))return r;let{devlog:o}=Ae((m=this.media)==null?void 0:m.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(g=this.media)==null?void 0:g.error.code,player_error_message:o.message?String(o.message):r.player_error_message}}),(i=this.media)==null||i.addEventListener("error",r=>{var n,m;let{detail:o}=r;if(!o){let{message:g,code:T}=(m=(n=this.media)==null?void 0:n.error)!=null?m:{};o=new $e(g,T)}!(o!=null&&o.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:o}))})},Le=new WeakSet,Pt=function(){var i,r,o,n;let e=()=>b(this,W,ne).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(n=(o=this.media)==null?void 0:o.textTracks)==null||n.addEventListener("removetrack",e)},Oe=new WeakSet,Bt=function(){var E,B,D;let e=this.mediaController,i=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(i)return;let r,o=new WeakMap,n=()=>this.streamType&&[R.LIVE,R.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,m=(h,w,L=!1)=>{if(n())return;Array.from(h&&h.activeCues||[]).forEach(f=>{if(!(!f.snapToLines||f.line<-5||f.line>=0&&f.line<10))if(!w||this.paused){let me=f.text.split(`
1094
+ `).length,J=i?-2:-3;this.streamType&&[R.LIVE,R.LL_LIVE].includes(this.streamType)&&(J=i?-1:-2);let q=J-me;if(f.line===q&&!L)return;o.has(f)||o.set(f,f.line),f.line=q-1,f.line=q}else setTimeout(()=>{f.line=o.get(f)||"auto"},500)})},g=()=>{var h;m(r,(h=e==null?void 0:e.hasAttribute("user-inactive"))!=null?h:!1)},T=()=>{var L;let w=Array.from(((L=e==null?void 0:e.media)==null?void 0:L.textTracks)||[]).filter(O=>["subtitles","captions"].includes(O.kind)&&O.mode==="showing")[0];w!==r&&(r==null||r.removeEventListener("cuechange",g)),r=w,r==null||r.addEventListener("cuechange",g),m(r,l(this,P))};if(T(),(E=e==null?void 0:e.media)==null||E.textTracks.addEventListener("change",T),(B=e==null?void 0:e.media)==null||B.textTracks.addEventListener("addtrack",T),navigator.userAgent.includes("Chrome/")){let h=()=>{m(r,l(this,P),!0),this.paused||window.requestAnimationFrame(h)};(D=e==null?void 0:e.media)==null||D.addEventListener("playing",()=>{h()})}e==null||e.addEventListener("userinactivechange",()=>{let h=e==null?void 0:e.hasAttribute("user-inactive");l(this,P)!==h&&(A(this,P,h),m(r,l(this,P)))})};function U(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}p.customElements.get("mux-player")||(p.customElements.define("mux-player",se),p.MuxPlayerElement=se);var Ti=se;export{$e as MediaError,Ti as default,U as getVideoAttribute};