@mux/mux-player 3.2.5-canary.0 → 3.2.5-canary.2
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.cjs.js +185 -78
- package/dist/index.mjs +146 -39
- package/dist/mux-player.js +260 -153
- package/dist/mux-player.mjs +260 -153
- package/dist/themes/gerwig/index.cjs.js +106 -0
- package/dist/themes/gerwig/index.js +106 -0
- package/dist/themes/gerwig/index.mjs +106 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types-ts3.4/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),
|
|
1
|
+
var ze=t=>{throw TypeError(t)};var he=(t,a,e)=>a.has(t)||ze("Cannot "+e);var u=(t,a,e)=>(he(t,a,"read from private field"),e?e.call(t):a.get(t)),T=(t,a,e)=>a.has(t)?ze("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),k=(t,a,e,i)=>(he(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),b=(t,a,e)=>(he(t,a,"access private method"),e);var $=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends ${}globalThis.DocumentFragment=t}var G=class extends ${},ge=class extends ${},St={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(G)}},j,fe=class{constructor(a,e={}){T(this,j);k(this,j,e==null?void 0:e.detail)}get detail(){return u(this,j)}initCustomEvent(){}};j=new WeakMap;function wt(t,a){return new G}var Xe={document:{createElement:wt},DocumentFragment,customElements:St,CustomEvent:fe,EventTarget:$,HTMLElement:G,HTMLVideoElement:ge},qe=typeof window=="undefined"||typeof globalThis.customElements=="undefined",E=qe?Xe:globalThis,Y=qe?Xe.document:globalThis.document;import{MediaController as ma,MediaErrorDialog as Rt}from"media-chrome";import{Attributes as Oe}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Tt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ca,{MediaError as Q,Attributes as s}from"@mux/mux-video";import{StreamTypes as M,PlaybackTypes as be,addTextTrack as pa,removeTextTrack as ba,CmcdTypeValues as Et,i18n as K,parseJwt as Me,MuxJWTAud as Le,generatePlayerInitTime as ha}from"@mux/playback-core";import{VideoEvents as Ut}from"@mux/mux-video";import{i18n as Kt}from"@mux/playback-core";import{StreamTypes as Te,parseJwt as Qe}from"@mux/playback-core";function Je(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ne(e)}: ${i}; `)}),a?a.trim():void 0}function ne(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function se(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ye(t){let a=Pt(t).toString();return a?"?"+a:""}function Pt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var ve=(t,a)=>!t||!a?!1:t.contains(a)?!0:ve(t,a.getRootNode().host);var et="mux.com",It=()=>{try{return"3.2.4"}catch{}return"UNKNOWN"},Dt=It(),le=()=>Dt,tt=(t,{token:a,customDomain:e=et,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=Qe(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${ye({token:a,time:n,program_time:r})}`},at=(t,{token:a,customDomain:e=et,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=Qe(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ye({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([Te.LIVE,Te.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Te.LIVE}};var Vt={crossorigin:"crossOrigin",playsinline:"playsInline"};function it(t){var a;return(a=Vt[t])!=null?a:se(t)}var P,I,v,de=class{constructor(a,e){T(this,P);T(this,I);T(this,v,[]);k(this,P,a),k(this,I,e)}[Symbol.iterator](){return u(this,v).values()}get length(){return u(this,v).length}get value(){var a;return(a=u(this,v).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(k(this,v,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,v)[a]}values(){return u(this,v).values()}keys(){return u(this,v).keys()}forEach(a){u(this,v).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,v).push(r)}),!(this.value===""&&!((e=u(this,P))!=null&&e.hasAttribute(`${u(this,I)}`)))&&((i=u(this,P))==null||i.setAttribute(`${u(this,I)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,v).splice(u(this,v).indexOf(i),1)}),(e=u(this,P))==null||e.setAttribute(`${u(this,I)}`,`${this.value}`)}contains(a){return u(this,v).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)}};P=new WeakMap,I=new WeakMap,v=new WeakMap;var rt=`[mux-player ${le()}]`;function O(...t){console.warn(rt,...t)}function A(...t){console.error(rt,...t)}function Ee(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Kt("Read more: ")}
|
|
2
|
+
https://github.com/muxinc/elements/blob/main/errors/${t.file}`),O(a)}var f={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},D={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},nt=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}}),Ht=Ut.filter(t=>t!=="error"),Bt=Object.values(f).filter(t=>![f.PLAYSINLINE].includes(t)),$t=Object.values(D),Ae=class extends E.HTMLElement{static get observedAttributes(){return[...Bt,...$t]}constructor(){super()}init(){Ht.forEach(a=>{var e;(e=this.media)==null||e.addEventListener(a,i=>{this.dispatchEvent(new Event(i.type))})})}attributeChangedCallback(a,e,i){var r,n;switch(a){case D.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case D.VOLUME:{let d=(r=y(i))!=null?r:1;this.media&&(this.media.volume=d);return}case D.PLAYBACKRATE:{let d=(n=y(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);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()}load(){var a;(a=this.media)==null||a.load()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:nt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:nt}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 currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}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=y(this.getAttribute(D.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(D.PLAYBACKRATE,`${a}`):this.removeAttribute(D.PLAYBACKRATE)}get crossOrigin(){return X(this,f.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(f.CROSSORIGIN,`${a}`)}get autoplay(){return X(this,f.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(f.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(f.AUTOPLAY)}get loop(){return X(this,f.LOOP)!=null}set loop(a){a?this.setAttribute(f.LOOP,""):this.removeAttribute(f.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return X(this,f.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(f.MUTED,""):this.removeAttribute(f.MUTED)}get playsInline(){return X(this,f.PLAYSINLINE)!=null}set playsInline(a){A("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(f.PRELOAD,a):this.removeAttribute(f.PRELOAD)}};function X(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ce=Ae;import"media-chrome/dist/media-theme-element.js";var st=`:host {
|
|
3
3
|
--media-control-display: var(--controls);
|
|
4
4
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
5
5
|
--media-dialog-display: var(--dialog);
|
|
@@ -150,61 +150,62 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
150
150
|
:host([no-tooltips]) {
|
|
151
151
|
--media-tooltip-display: none;
|
|
152
152
|
}
|
|
153
|
-
`;import{TemplateInstance as
|
|
153
|
+
`;import{TemplateInstance as Ft,ChildNodePart as me,AttrPart as ce}from"media-chrome/dist/media-theme-element.js";var q=new WeakMap,xe=class t{constructor(a,e){this.element=a;this.type=e;this.element.addEventListener(this.type,this);let i=q.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=q.get(this.element);e&&e.delete(this.type)}}static for(a){q.has(a.element)||q.set(a.element,new Map);let e=a.attributeName.slice(2),i=q.get(a.element);return i&&i.has(e)?i.get(e):new t(a.element,e)}};function Wt(t,a){return t instanceof ce&&t.attributeName.startsWith("on")?(xe.for(t).set(a),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function Zt(t,a){return a instanceof ue&&t instanceof me?(a.renderInto(t),!0):!1}function Gt(t,a){return a instanceof DocumentFragment&&t instanceof me?(a.childNodes.length&&t.replace(...a.childNodes),!0):!1}function jt(t,a){if(t instanceof ce){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 zt(t,a){if(t instanceof ce&&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 Xt(t,a){if(typeof a=="boolean"&&t instanceof ce){let e=t.attributeNamespace,i=t.element.hasAttributeNS(e,t.attributeName);return a!==i&&(t.booleanValue=a),!0}return!1}function qt(t,a){return a===!1&&t instanceof me?(t.replace(""),!0):!1}function Jt(t,a){zt(t,a)||Xt(t,a)||Wt(t,a)||qt(t,a)||Zt(t,a)||Gt(t,a)||jt(t,a)}var ke=new Map,dt=new WeakMap,lt=new WeakMap,ue=class{constructor(a,e,i){this.strings=a;this.values=e;this.processor=i;this.stringsKey=this.strings.join("")}get template(){if(ke.has(this.stringsKey))return ke.get(this.stringsKey);{let a=Y.createElement("template"),e=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<e?`{{ ${n} }}`:""),""),ke.set(this.stringsKey,a),a}}renderInto(a){var r;let e=this.template;if(dt.get(a)!==e){dt.set(a,e);let n=new Ft(e,this.values,this.processor);lt.set(a,n),a instanceof me?a.replace(...n.children):a.appendChild(n);return}let i=lt.get(a);(r=i==null?void 0:i.update)==null||r.call(i,this.values)}},Qt={processCallback(t,a,e){var i;if(e){for(let[r,n]of a)if(r in e){let d=(i=e[r])!=null?i:"";Jt(n,d)}}}};function J(t,...a){return new ue(t,a,Qt)}function ut(t,a){t.renderInto(a)}import{StreamTypes as ea,toMuxVideoURL as mt}from"@mux/playback-core";var ta=t=>{let{tokens:a}=t;return a.drm?":host { --_cast-button-drm-display: none; }":""},ct=t=>J`
|
|
154
154
|
<style>
|
|
155
|
-
${
|
|
156
|
-
${
|
|
155
|
+
${ta(t)}
|
|
156
|
+
${st}
|
|
157
157
|
</style>
|
|
158
|
-
${
|
|
159
|
-
`,
|
|
158
|
+
${oa(t)}
|
|
159
|
+
`,aa=t=>{let a=t.hotKeys?`${t.hotKeys}`:"";return z(t.streamType)==="live"&&(a+=" noarrowleft noarrowright"),a},ia={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",LISTBOX:"listbox",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},ra=Object.values(ia).join(", "),oa=t=>{var a,e,i,r,n,d,l,p,R,F,x,C,_,B,h,oe,W,Z,we,Pe,Ie,De,Ve,Ke,Ue,He,Be,$e,Ye,Fe,We,Ze,Ge,je;return J`
|
|
160
160
|
<media-theme
|
|
161
161
|
template="${t.themeTemplate||!1}"
|
|
162
162
|
defaultstreamtype="${(a=t.defaultStreamType)!=null?a:!1}"
|
|
163
|
-
hotkeys="${
|
|
163
|
+
hotkeys="${aa(t)||!1}"
|
|
164
164
|
nohotkeys="${t.noHotKeys||!t.hasSrc||!1}"
|
|
165
|
-
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(
|
|
165
|
+
noautoseektolive="${!!((e=t.streamType)!=null&&e.includes(ea.LIVE))&&t.targetLiveWindow!==0}"
|
|
166
166
|
novolumepref="${t.novolumepref||!1}"
|
|
167
167
|
disabled="${!t.hasSrc||t.isDialogOpen}"
|
|
168
168
|
audio="${(i=t.audio)!=null?i:!1}"
|
|
169
|
-
style="${(r=
|
|
169
|
+
style="${(r=Je({"--media-primary-color":t.primaryColor,"--media-secondary-color":t.secondaryColor,"--media-accent-color":t.accentColor}))!=null?r:!1}"
|
|
170
170
|
defaultsubtitles="${!t.defaultHiddenCaptions}"
|
|
171
171
|
forwardseekoffset="${(n=t.forwardSeekOffset)!=null?n:!1}"
|
|
172
172
|
backwardseekoffset="${(d=t.backwardSeekOffset)!=null?d:!1}"
|
|
173
173
|
playbackrates="${(l=t.playbackRates)!=null?l:!1}"
|
|
174
174
|
defaultshowremainingtime="${(p=t.defaultShowRemainingTime)!=null?p:!1}"
|
|
175
|
-
defaultduration="${(
|
|
175
|
+
defaultduration="${(R=t.defaultDuration)!=null?R:!1}"
|
|
176
176
|
hideduration="${(F=t.hideDuration)!=null?F:!1}"
|
|
177
|
-
title="${(
|
|
178
|
-
|
|
177
|
+
title="${(x=t.title)!=null?x:!1}"
|
|
178
|
+
proudlydisplaymuxbadge="${(C=t.proudlyDisplayMuxBadge)!=null?C:!1}"
|
|
179
|
+
exportparts="${ra}"
|
|
179
180
|
onclose="${t.onCloseErrorDialog}"
|
|
180
181
|
onfocusin="${t.onFocusInErrorDialog}"
|
|
181
182
|
>
|
|
182
183
|
<mux-video
|
|
183
184
|
slot="media"
|
|
184
|
-
target-live-window="${(
|
|
185
|
-
stream-type="${(
|
|
186
|
-
crossorigin="${(
|
|
185
|
+
target-live-window="${(_=t.targetLiveWindow)!=null?_:!1}"
|
|
186
|
+
stream-type="${(B=z(t.streamType))!=null?B:!1}"
|
|
187
|
+
crossorigin="${(h=t.crossOrigin)!=null?h:""}"
|
|
187
188
|
playsinline
|
|
188
|
-
autoplay="${(
|
|
189
|
-
muted="${(
|
|
190
|
-
loop="${(
|
|
191
|
-
preload="${(
|
|
192
|
-
debug="${(
|
|
193
|
-
prefer-cmcd="${(
|
|
194
|
-
disable-tracking="${(
|
|
195
|
-
disable-cookies="${(
|
|
196
|
-
prefer-playback="${(
|
|
189
|
+
autoplay="${(oe=t.autoplay)!=null?oe:!1}"
|
|
190
|
+
muted="${(W=t.muted)!=null?W:!1}"
|
|
191
|
+
loop="${(Z=t.loop)!=null?Z:!1}"
|
|
192
|
+
preload="${(we=t.preload)!=null?we:!1}"
|
|
193
|
+
debug="${(Pe=t.debug)!=null?Pe:!1}"
|
|
194
|
+
prefer-cmcd="${(Ie=t.preferCmcd)!=null?Ie:!1}"
|
|
195
|
+
disable-tracking="${(De=t.disableTracking)!=null?De:!1}"
|
|
196
|
+
disable-cookies="${(Ve=t.disableCookies)!=null?Ve:!1}"
|
|
197
|
+
prefer-playback="${(Ke=t.preferPlayback)!=null?Ke:!1}"
|
|
197
198
|
start-time="${t.startTime!=null?t.startTime:!1}"
|
|
198
|
-
beacon-collection-domain="${(
|
|
199
|
+
beacon-collection-domain="${(Ue=t.beaconCollectionDomain)!=null?Ue:!1}"
|
|
199
200
|
player-init-time="${(He=t.playerInitTime)!=null?He:!1}"
|
|
200
|
-
player-software-name="${(
|
|
201
|
-
player-software-version="${(
|
|
202
|
-
env-key="${(
|
|
203
|
-
custom-domain="${(
|
|
204
|
-
src="${t.src?t.src:t.playbackId?
|
|
205
|
-
cast-src="${t.src?t.src:t.playbackId?
|
|
206
|
-
cast-receiver="${(
|
|
207
|
-
drm-token="${(
|
|
201
|
+
player-software-name="${(Be=t.playerSoftwareName)!=null?Be:!1}"
|
|
202
|
+
player-software-version="${($e=t.playerSoftwareVersion)!=null?$e:!1}"
|
|
203
|
+
env-key="${(Ye=t.envKey)!=null?Ye:!1}"
|
|
204
|
+
custom-domain="${(Fe=t.customDomain)!=null?Fe:!1}"
|
|
205
|
+
src="${t.src?t.src:t.playbackId?mt(t):!1}"
|
|
206
|
+
cast-src="${t.src?t.src:t.playbackId?mt(t):!1}"
|
|
207
|
+
cast-receiver="${(We=t.castReceiver)!=null?We:!1}"
|
|
208
|
+
drm-token="${(Ge=(Ze=t.tokens)==null?void 0:Ze.drm)!=null?Ge:!1}"
|
|
208
209
|
exportparts="video"
|
|
209
210
|
>
|
|
210
211
|
${t.storyboard?J`<track label="thumbnails" default kind="metadata" src="${t.storyboard}" />`:J``}
|
|
@@ -215,11 +216,11 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
215
216
|
part="poster"
|
|
216
217
|
exportparts="poster, img"
|
|
217
218
|
src="${t.poster?t.poster:!1}"
|
|
218
|
-
placeholdersrc="${(
|
|
219
|
+
placeholdersrc="${(je=t.placeholder)!=null?je:!1}"
|
|
219
220
|
></media-poster-image>
|
|
220
221
|
</slot>
|
|
221
222
|
</media-theme>
|
|
222
|
-
`};import{errorCategoryToTokenNameOrPrefix as
|
|
223
|
+
`};import{errorCategoryToTokenNameOrPrefix as pt,i18n as g,MediaError as L,MuxErrorCategory as bt,MuxErrorCode as c}from"@mux/playback-core";var ht=t=>t.charAt(0).toUpperCase()+t.slice(1),na=(t,a=!1)=>{var e,i;if(t.muxCode){let r=ht((e=t.errorCategory)!=null?e:"video"),n=pt((i=t.errorCategory)!=null?i:bt.VIDEO);if(t.muxCode===c.NETWORK_OFFLINE)return g("Your device appears to be offline",a);if(t.muxCode===c.NETWORK_TOKEN_EXPIRED)return g("{category} URL has expired",a).format({category:r});if([c.NETWORK_TOKEN_SUB_MISMATCH,c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING,c.NETWORK_TOKEN_MALFORMED].includes(t.muxCode))return g("{category} URL is formatted incorrectly",a).format({category:r});if(t.muxCode===c.NETWORK_TOKEN_MISSING)return g("Invalid {categoryName} URL",a).format({categoryName:n});if(t.muxCode===c.NETWORK_NOT_FOUND)return g("{category} does not exist",a).format({category:r});if(t.muxCode===c.NETWORK_NOT_READY)return g("{category} is not currently available",a).format({category:r})}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return g("Network Error",a);if(t.code===L.MEDIA_ERR_DECODE)return g("Media Error",a);if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return g("Source Not Supported",a)}return g("Error",a)},sa=(t,a=!1)=>{var e,i;if(t.muxCode){let r=ht((e=t.errorCategory)!=null?e:"video"),n=pt((i=t.errorCategory)!=null?i:bt.VIDEO);return t.muxCode===c.NETWORK_OFFLINE?g("Check your internet connection and try reloading this video.",a):t.muxCode===c.NETWORK_TOKEN_EXPIRED?g("The video\u2019s secured {tokenNamePrefix}-token has expired.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_TOKEN_SUB_MISMATCH?g("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_TOKEN_MALFORMED?g("{category} URL is formatted incorrectly",a).format({category:r}):[c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode)?g("The {tokenNamePrefix}-token is formatted with incorrect information.",a).format({tokenNamePrefix:n}):[c.NETWORK_TOKEN_MISSING,c.NETWORK_INVALID_URL].includes(t.muxCode)?g("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",a).format({tokenNamePrefix:n}):t.muxCode===c.NETWORK_NOT_FOUND?"":t.muxCode===c.NETWORK_NOT_READY?g("The live stream or video file are not yet ready.",a):t.message}return t.code&&(t.code===L.MEDIA_ERR_NETWORK||t.code===L.MEDIA_ERR_DECODE||t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED),t.message},gt=(t,a=!1)=>{let e=na(t,a),i=sa(t,a);return{title:e,message:i}},da=t=>{if(t.muxCode){if(t.muxCode===c.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(t.muxCode===c.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([c.NETWORK_TOKEN_AUD_MISMATCH,c.NETWORK_TOKEN_AUD_MISSING].includes(t.muxCode))return"403-incorrect-aud-value.md";if(t.muxCode===c.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(t.muxCode===c.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(t.muxCode===c.NETWORK_NOT_FOUND)return"404-not-found.md";if(t.muxCode===c.NETWORK_NOT_READY)return"412-not-playable.md"}if(t.code){if(t.code===L.MEDIA_ERR_NETWORK)return"";if(t.code===L.MEDIA_ERR_DECODE)return"media-decode-error.md";if(t.code===L.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},Re=(t,a)=>{let e=da(t);return{message:t.message,context:t.context,file:e}};var ft=`<template id="media-theme-gerwig">
|
|
223
224
|
<style>
|
|
224
225
|
@keyframes pre-play-hide {
|
|
225
226
|
0% {
|
|
@@ -732,6 +733,80 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
732
733
|
--bottom-playback-rate-menu-button: none;
|
|
733
734
|
--bottom-pip-button: none;
|
|
734
735
|
}
|
|
736
|
+
|
|
737
|
+
[part='mux-badge'] {
|
|
738
|
+
position: absolute;
|
|
739
|
+
bottom: 10px;
|
|
740
|
+
right: 10px;
|
|
741
|
+
z-index: 2;
|
|
742
|
+
opacity: 0.6;
|
|
743
|
+
transition:
|
|
744
|
+
opacity 0.2s ease-in-out,
|
|
745
|
+
bottom 0.2s ease-in-out;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
[part='mux-badge']:hover {
|
|
749
|
+
opacity: 1;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
[part='mux-badge'] a {
|
|
753
|
+
font-size: 14px;
|
|
754
|
+
font-family: var(--_font-family);
|
|
755
|
+
color: var(--_primary-color);
|
|
756
|
+
text-decoration: none;
|
|
757
|
+
display: flex;
|
|
758
|
+
align-items: center;
|
|
759
|
+
gap: 5px;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
[part='mux-badge'] .mux-badge-text {
|
|
763
|
+
transition: opacity 0.5s ease-in-out;
|
|
764
|
+
opacity: 0;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
[part='mux-badge'] .mux-badge-logo {
|
|
768
|
+
width: 40px;
|
|
769
|
+
height: auto;
|
|
770
|
+
display: inline-block;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
[part='mux-badge'] .mux-badge-logo svg {
|
|
774
|
+
width: 100%;
|
|
775
|
+
height: 100%;
|
|
776
|
+
fill: white;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'],
|
|
780
|
+
media-controller:not([userinactive]) [part='mux-badge'],
|
|
781
|
+
media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
|
|
782
|
+
transition: bottom 0.1s ease-in-out;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
|
|
786
|
+
transition: bottom 0.2s ease-in-out 0.62s;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text,
|
|
790
|
+
media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text {
|
|
791
|
+
opacity: 1;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text {
|
|
795
|
+
opacity: 0;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] {
|
|
799
|
+
bottom: 10px;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] {
|
|
803
|
+
bottom: 10px;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'],
|
|
807
|
+
media-controller[mediahasplayed][mediapaused] [part='mux-badge'] {
|
|
808
|
+
bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2);
|
|
809
|
+
}
|
|
735
810
|
</style>
|
|
736
811
|
|
|
737
812
|
<template partial="TitleDisplay">
|
|
@@ -1109,6 +1184,35 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1109
1184
|
</media-rendition-menu>
|
|
1110
1185
|
</template>
|
|
1111
1186
|
|
|
1187
|
+
<template partial="MuxBadge">
|
|
1188
|
+
<div part="mux-badge">
|
|
1189
|
+
<a href="https://www.mux.com/player" target="_blank">
|
|
1190
|
+
<span class="mux-badge-text">Powered by</span>
|
|
1191
|
+
<div class="mux-badge-logo">
|
|
1192
|
+
<svg
|
|
1193
|
+
viewBox="0 0 1600 500"
|
|
1194
|
+
style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2"
|
|
1195
|
+
>
|
|
1196
|
+
<g>
|
|
1197
|
+
<path
|
|
1198
|
+
d="M994.287,93.486c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m0,-93.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,68.943 -56.09,125.033 -125.032,125.033c-68.942,-0 -125.03,-56.09 -125.03,-125.033l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,137.853 112.149,250.003 249.999,250.003c137.851,-0 250.001,-112.15 250.001,-250.003l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486"
|
|
1199
|
+
style="fill-rule: nonzero"
|
|
1200
|
+
></path>
|
|
1201
|
+
<path
|
|
1202
|
+
d="M1537.51,468.511c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m-275.883,-218.509l-143.33,143.329c-24.402,24.402 -24.402,63.966 0,88.368c24.402,24.402 63.967,24.402 88.369,-0l143.33,-143.329l143.328,143.329c24.402,24.4 63.967,24.402 88.369,-0c24.403,-24.402 24.403,-63.966 0.001,-88.368l-143.33,-143.329l0.001,-0.004l143.329,-143.329c24.402,-24.402 24.402,-63.965 0,-88.367c-24.402,-24.402 -63.967,-24.402 -88.369,-0l-143.329,143.328l-143.329,-143.328c-24.402,-24.401 -63.967,-24.402 -88.369,-0c-24.402,24.402 -24.402,63.965 0,88.367l143.329,143.329l0,0.004Z"
|
|
1203
|
+
style="fill-rule: nonzero"
|
|
1204
|
+
></path>
|
|
1205
|
+
<path
|
|
1206
|
+
d="M437.511,468.521c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m23.915,-463.762c-23.348,-9.672 -50.226,-4.327 -68.096,13.544l-143.331,143.329l-143.33,-143.329c-17.871,-17.871 -44.747,-23.216 -68.096,-13.544c-23.349,9.671 -38.574,32.455 -38.574,57.729l0,375.026c0,34.51 27.977,62.486 62.487,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-224.173l80.843,80.844c24.404,24.402 63.965,24.402 88.369,-0l80.843,-80.844l0,224.173c0,34.51 27.976,62.486 62.486,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-375.026c0,-25.274 -15.224,-48.058 -38.573,-57.729"
|
|
1207
|
+
style="fill-rule: nonzero"
|
|
1208
|
+
></path>
|
|
1209
|
+
</g>
|
|
1210
|
+
</svg>
|
|
1211
|
+
</div>
|
|
1212
|
+
</a>
|
|
1213
|
+
</div>
|
|
1214
|
+
</template>
|
|
1215
|
+
|
|
1112
1216
|
<media-controller
|
|
1113
1217
|
part="controller"
|
|
1114
1218
|
defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}"
|
|
@@ -1140,6 +1244,9 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1140
1244
|
<template if="breakpointsm">{{>PrePlayButton section="center"}}</template>
|
|
1141
1245
|
</div>
|
|
1142
1246
|
|
|
1247
|
+
<!-- Mux Badge -->
|
|
1248
|
+
<template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template>
|
|
1249
|
+
|
|
1143
1250
|
<!-- Autoplay centered unmute button -->
|
|
1144
1251
|
<!--
|
|
1145
1252
|
todo: figure out how show this with available state variables
|
|
@@ -1226,7 +1333,7 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1226
1333
|
<slot></slot>
|
|
1227
1334
|
</media-controller>
|
|
1228
1335
|
</template>
|
|
1229
|
-
`;import{MediaThemeElement as
|
|
1336
|
+
`;import{MediaThemeElement as ua}from"media-chrome/dist/media-theme-element.js";import"media-chrome/dist/menu";var _e=Y.createElement("template");"innerHTML"in _e&&(_e.innerHTML=ft);var yt,vt,pe=class extends ua{};pe.template=(vt=(yt=_e.content)==null?void 0:yt.children)==null?void 0:vt[0];E.customElements.get("media-theme-gerwig")||E.customElements.define("media-theme-gerwig",pe);var ga="gerwig";var N={SRC:"src",POSTER:"poster"},o={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge"},Ne=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref","proudlydisplaymuxbadge"];function fa(t,a){var i;return{src:!t.playbackId&&t.src,playbackId:t.playbackId,hasSrc:!!t.playbackId||!!t.src||!!t.currentSrc,poster:t.poster,storyboard:t.storyboard,storyboardSrc:t.getAttribute(o.STORYBOARD_SRC),placeholder:t.getAttribute("placeholder"),themeTemplate:va(t),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,noHotKeys:t.hasAttribute(o.NOHOTKEYS),hotKeys:t.getAttribute(o.HOTKEYS),muted:t.muted,paused:t.paused,preload:t.preload,envKey:t.envKey,preferCmcd:t.preferCmcd,debug:t.debug,disableTracking:t.disableTracking,disableCookies:t.disableCookies,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,maxResolution:t.maxResolution,minResolution:t.minResolution,programStartTime:t.programStartTime,programEndTime:t.programEndTime,assetStartTime:t.assetStartTime,assetEndTime:t.assetEndTime,renditionOrder:t.renditionOrder,metadata:t.metadata,playerInitTime:t.playerInitTime,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferPlayback:t.preferPlayback,audio:t.audio,defaultStreamType:t.defaultStreamType,targetLiveWindow:t.getAttribute(s.TARGET_LIVE_WINDOW),streamType:z(t.getAttribute(s.STREAM_TYPE)),primaryColor:t.getAttribute(o.PRIMARY_COLOR),secondaryColor:t.getAttribute(o.SECONDARY_COLOR),accentColor:t.getAttribute(o.ACCENT_COLOR),forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,defaultDuration:t.defaultDuration,defaultShowRemainingTime:t.defaultShowRemainingTime,hideDuration:Ta(t),playbackRates:t.getAttribute(o.PLAYBACK_RATES),customDomain:(i=t.getAttribute(s.CUSTOM_DOMAIN))!=null?i:void 0,title:t.getAttribute(o.TITLE),novolumepref:t.hasAttribute(o.NO_VOLUME_PREF),castReceiver:t.castReceiver,proudlyDisplayMuxBadge:t.hasAttribute(o.PROUDLY_DISPLAY_MUX_BADGE),...a,extraSourceParams:t.extraSourceParams}}var ya=Rt.formatErrorMessage;Rt.formatErrorMessage=t=>{var a,e;if(t instanceof Q){let i=gt(t,!1);return`
|
|
1230
1337
|
${i!=null&&i.title?`<h3>${i.title}</h3>`:""}
|
|
1231
1338
|
${i!=null&&i.message||i!=null&&i.linkUrl?`<p>
|
|
1232
1339
|
${i==null?void 0:i.message}
|
|
@@ -1238,5 +1345,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
1238
1345
|
>${(e=i.linkText)!=null?e:i.linkUrl}</a
|
|
1239
1346
|
>`:""}
|
|
1240
1347
|
</p>`:""}
|
|
1241
|
-
`}return ga(t)};function ya(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=E.customElements.get(a);if(n!=null&&n.template)return n.template}}function Ta(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function Et(t){let a=t.hasAttribute(o.TITLE)?{video_title:t.getAttribute(o.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var va=Object.values(s),Ea=Object.values(N),Aa=Object.values(o),At=le(),Ct="mux-player",kt={isDialogOpen:!1},Ca={redundant_streams:!0},te,ae,ie,w,re,U,m,S,Ot,Se,H,_t,xt,Mt,Lt,ee=class extends Ce{constructor(){super();v(this,m);v(this,te);v(this,ae,!1);v(this,ie,{});v(this,w,!0);v(this,re,new de(this,"hotkeys"));v(this,U,{...kt,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&b(this,m,Se).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;Te(this,Y.activeElement)||e.preventDefault()}});k(this,te,ba()),this.attachShadow({mode:"open"}),b(this,m,Ot).call(this),this.isConnected&&b(this,m,S).call(this)}static get NAME(){return Ct}static get VERSION(){return At}static get observedAttributes(){var e;return[...(e=Ce.observedAttributes)!=null?e:[],...Ea,...va,...Aa]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=Et(this))}attributeChangedCallback(e,i,r){switch(b(this,m,S).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:u(this,re).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&x(K("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case o.THUMBNAIL_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.THUMBNAIL;l!==p&&x(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.STORYBOARD;l!==p&&x(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.DRM;l!==p&&x(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&A(K("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:r&&![M.LIVE,M.ON_DEMAND,M.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Ee({file:"invalid-stream-type.md",message:K("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===M.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[s.PLAYBACK_ID,N.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&k(this,U,{...u(this,U),...kt}),b(this,m,H).call(this,{[at(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?vt.includes(e)?this.setAttribute(s.PREFER_CMCD,e):x(`Invalid value for preferCmcd. Must be one of ${vt.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Tt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Tt.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:ha}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ne.includes(r))continue;let n=e.getAttribute(r);i[se(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;b(this,m,S).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ne.includes(d))continue;let l=e==null?void 0:e[d];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(ne(d),!!l):(n=this.mediaTheme)==null||n.setAttribute(ne(d),l)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=V(this,N.SRC))!=null?e:void 0:(i=this.getAttribute(N.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(N.SRC,e):this.removeAttribute(N.SRC)}get poster(){var r;let e=this.getAttribute(N.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){x("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return et(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(N.POSTER,e):this.removeAttribute(N.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[M.LIVE,M.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return tt(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return u(this,re)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return y(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(o.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(o.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=V(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.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(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=y(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=y(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return y(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?y(this.getAttribute(s.PLAYER_INIT_TIME)):u(this,te)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:Ct}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:At}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return y(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return y(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return y(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return y(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):Ca}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=V(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get debug(){return V(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return V(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return V(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:M.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:M.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return y(V(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===be.MSE||e===be.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===be.MSE||e===be.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Et(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(b(this,m,S).call(this),!this.media){A("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:[]}addChapters(e){var i;if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...u(this,ie),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){k(this,ie,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var l;let d=(l=this.media)==null?void 0:l.nativeEl;if(d)return ca(d,e,i,r,n)}removeTextTrack(e){var r;let i=(r=this.media)==null?void 0:r.nativeEl;if(i)return pa(i,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){A("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}};te=new WeakMap,ae=new WeakMap,ie=new WeakMap,w=new WeakMap,re=new WeakMap,U=new WeakMap,m=new WeakSet,S=function(){var e,i,r,n;if(!u(this,ae)){k(this,ae,!0),b(this,m,H).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof E.HTMLElement))throw""}catch{A("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ma))throw""}catch{A("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ua))throw""}catch{A("<media-controller> failed to upgrade!")}this.init(),b(this,m,_t).call(this),b(this,m,xt).call(this),b(this,m,Mt).call(this),k(this,w,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(xe.USER_INACTIVE))!=null?i:!0),b(this,m,Lt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>b(this,m,H).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>b(this,m,H).call(this))}},Ot=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Se=function(e){Object.assign(u(this,U),e),b(this,m,H).call(this)},H=function(e={}){lt(mt(fa(this,{...u(this,U),...e})),this.shadowRoot)},_t=function(){let e=r=>{var l,p;if(!(r!=null&&r.startsWith("theme-")))return;let n=r.replace(/^theme-/,"");if(Ne.includes(n))return;let d=this.getAttribute(r);d!=null?(l=this.mediaTheme)==null||l.setAttribute(n,d):(p=this.mediaTheme)==null||p.removeAttribute(n)};new MutationObserver(r=>{for(let{attributeName:n}of r)e(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},xt=function(){var i;let e=r=>{let{detail:n}=r;if(n instanceof Q||(n=new Q(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){x(n),n.data&&x(`${n.name} data:`,n.data);return}let d=Oe(n,!1);d.message&&Ee(d),A(n),n.data&&A(`${n.name} data:`,n.data),b(this,m,Se).call(this,{isDialogOpen:!0})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var d,l,p;if(!(((d=this.media)==null?void 0:d.error)instanceof Q))return r;let n=Oe((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(p=this.media)==null?void 0:p.error.code,player_error_message:n.message?String(n.message):r.player_error_message,player_error_context:n.context?String(n.context):r.player_error_context}}),(i=this.media)==null||i.addEventListener("error",r=>{var d,l;let{detail:n}=r;if(!n){let{message:p,code:O}=(l=(d=this.media)==null?void 0:d.error)!=null?l:{};n=new Q(p,O)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Mt=function(){var i,r,n,d;let e=()=>b(this,m,H).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.addEventListener("removetrack",e)},Lt=function(){var O,F;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===M.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(R,C,_=!1)=>{if(n())return;Array.from(R&&R.activeCues||[]).forEach(h=>{if(!(!h.snapToLines||h.line<-5||h.line>=0&&h.line<10))if(!C||this.paused){let oe=h.text.split(`
|
|
1242
|
-
`).length,W=-3;this.streamType===M.LIVE&&(W=-2);let Z=W-oe;if(h.line===Z&&!_)return;r.has(h)||r.set(h,h.line),h.line=Z}else setTimeout(()=>{h.line=r.get(h)||"auto"},500)})},l=()=>{var
|
|
1348
|
+
`}return ya(t)};function va(t){var e,i;let a=t.theme;if(a){let r=(i=(e=t.getRootNode())==null?void 0:e.getElementById)==null?void 0:i.call(e,a);if(r&&r instanceof HTMLTemplateElement)return r;a.startsWith("media-theme-")||(a=`media-theme-${a}`);let n=E.customElements.get(a);if(n!=null&&n.template)return n.template}}function Ta(t){var e;let a=(e=t.mediaController)==null?void 0:e.querySelector("media-time-display");return a&&getComputedStyle(a).getPropertyValue("--media-duration-display-display").trim()==="none"}function At(t){let a=t.hasAttribute(o.TITLE)?{video_title:t.getAttribute(o.TITLE)}:{};return t.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((e,i)=>{let r=t.getAttribute(i);return r!==null&&(e[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),e},a)}var Ea=Object.values(s),Aa=Object.values(N),Ca=Object.values(o),Ct=le(),kt="mux-player",xt={isDialogOpen:!1},ka={redundant_streams:!0},te,ae,ie,w,re,H,m,S,_t,Se,U,Ot,Mt,Lt,Nt,ee=class extends Ce{constructor(){super();T(this,m);T(this,te);T(this,ae,!1);T(this,ie,{});T(this,w,!0);T(this,re,new de(this,"hotkeys"));T(this,H,{...xt,onCloseErrorDialog:e=>{var r;((r=e.composedPath()[0])==null?void 0:r.localName)==="media-error-dialog"&&b(this,m,Se).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:e=>{var n;if(((n=e.composedPath()[0])==null?void 0:n.localName)!=="media-error-dialog")return;ve(this,Y.activeElement)||e.preventDefault()}});k(this,te,ha()),this.attachShadow({mode:"open"}),b(this,m,_t).call(this),this.isConnected&&b(this,m,S).call(this)}static get NAME(){return kt}static get VERSION(){return Ct}static get observedAttributes(){var e;return[...(e=Ce.observedAttributes)!=null?e:[],...Aa,...Ea,...Ca]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,i;return(i=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("media-controller")}connectedCallback(){var i;let e=(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video");e&&(e.metadata=At(this))}attributeChangedCallback(e,i,r){switch(b(this,m,S).call(this),super.attributeChangedCallback(e,i,r),e){case o.HOTKEYS:u(this,re).value=r;break;case o.THUMBNAIL_TIME:{r!=null&&this.tokens.thumbnail&&O(K("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time."));break}case o.THUMBNAIL_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.THUMBNAIL;l!==p&&O(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"thumbnail"}))}}break}case o.STORYBOARD_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.STORYBOARD;l!==p&&O(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"storyboard"}))}}break}case o.DRM_TOKEN:{if(r){let d=Me(r);if(d){let{aud:l}=d,p=Le.DRM;l!==p&&O(K("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:l,expectedAud:p,tokenNamePrefix:"drm"}))}}break}case s.PLAYBACK_ID:{r!=null&&r.includes("?token")&&A(K("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:r}));break}case s.STREAM_TYPE:r&&![M.LIVE,M.ON_DEMAND,M.UNKNOWN].includes(r)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=r.includes("dvr")?Number.POSITIVE_INFINITY:0:Ee({file:"invalid-stream-type.md",message:K("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):r===M.LIVE?this.getAttribute(o.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[s.PLAYBACK_ID,N.SRC,o.PLAYBACK_TOKEN].includes(e)&&i!==r&&k(this,H,{...u(this,H),...xt}),b(this,m,U).call(this,{[it(e)]:r})}get preferCmcd(){var e;return(e=this.getAttribute(s.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Et.includes(e)?this.setAttribute(s.PREFER_CMCD,e):O(`Invalid value for preferCmcd. Must be one of ${Et.join()}`):this.removeAttribute(s.PREFER_CMCD))}get hasPlayed(){var e,i;return(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Tt.MEDIA_HAS_PLAYED))!=null?i:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(Tt.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute(o.THEME))!=null?e:ga}set theme(e){this.setAttribute(o.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let i={};for(let r of e.getAttributeNames()){if(Ne.includes(r))continue;let n=e.getAttribute(r);i[se(r)]=n===""?!0:n}return i}set themeProps(e){var r,n;b(this,m,S).call(this);let i={...this.themeProps,...e};for(let d in i){if(Ne.includes(d))continue;let l=e==null?void 0:e[d];typeof l=="boolean"||l==null?(r=this.mediaTheme)==null||r.toggleAttribute(ne(d),!!l):(n=this.mediaTheme)==null||n.setAttribute(ne(d),l)}}get playbackId(){var e;return(e=this.getAttribute(s.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(s.PLAYBACK_ID,e):this.removeAttribute(s.PLAYBACK_ID)}get src(){var e,i;return this.playbackId?(e=V(this,N.SRC))!=null?e:void 0:(i=this.getAttribute(N.SRC))!=null?i:void 0}set src(e){e?this.setAttribute(N.SRC,e):this.removeAttribute(N.SRC)}get poster(){var r;let e=this.getAttribute(N.POSTER);if(e!=null)return e;let{tokens:i}=this;if(i.playback&&!i.thumbnail){O("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return tt(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(r=this.thumbnailTime)!=null?r:this.startTime,programTime:this.programStartTime,token:i.thumbnail})}set poster(e){e||e===""?this.setAttribute(N.POSTER,e):this.removeAttribute(N.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute(o.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute(o.STORYBOARD_SRC,e):this.removeAttribute(o.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;if(this.storyboardSrc&&!e.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[M.LIVE,M.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard))return at(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(o.AUDIO)}set audio(e){if(!e){this.removeAttribute(o.AUDIO);return}this.setAttribute(o.AUDIO,"")}get hotkeys(){return u(this,re)}get nohotkeys(){return this.hasAttribute(o.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute(o.NOHOTKEYS);return}this.setAttribute(o.NOHOTKEYS,"")}get thumbnailTime(){return y(this.getAttribute(o.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(o.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute(o.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute(o.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=V(this,o.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute(o.PLACEHOLDER,`${e}`)}get primaryColor(){var i,r;let e=this.getAttribute(o.PRIMARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:r.trim(),e))return e}set primaryColor(e){this.setAttribute(o.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var i,r;let e=this.getAttribute(o.SECONDARY_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:r.trim(),e))return e}set secondaryColor(e){this.setAttribute(o.SECONDARY_COLOR,`${e}`)}get accentColor(){var i,r;let e=this.getAttribute(o.ACCENT_COLOR);if(e!=null||this.mediaTheme&&(e=(r=(i=E.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:r.trim(),e))return e}set accentColor(e){this.setAttribute(o.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(o.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(o.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(o.PLAYBACK_RATES))return this.getAttribute(o.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(o.PLAYBACK_RATES);return}this.setAttribute(o.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=y(this.getAttribute(o.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(o.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=y(this.getAttribute(o.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(o.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(o.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(o.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return y(this.getAttribute(o.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute(o.DEFAULT_DURATION):this.setAttribute(o.DEFAULT_DURATION,`${e}`)}get playerInitTime(){return this.hasAttribute(s.PLAYER_INIT_TIME)?y(this.getAttribute(s.PLAYER_INIT_TIME)):u(this,te)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(s.PLAYER_INIT_TIME):this.setAttribute(s.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_NAME))!=null?e:kt}get playerSoftwareVersion(){var e;return(e=this.getAttribute(s.PLAYER_SOFTWARE_VERSION))!=null?e:Ct}get beaconCollectionDomain(){var e;return(e=this.getAttribute(s.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(s.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(s.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(s.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(s.MAX_RESOLUTION,e):this.removeAttribute(s.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(s.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(s.MIN_RESOLUTION,e):this.removeAttribute(s.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(s.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(s.RENDITION_ORDER,e):this.removeAttribute(s.RENDITION_ORDER))}get programStartTime(){return y(this.getAttribute(s.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(s.PROGRAM_START_TIME):this.setAttribute(s.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return y(this.getAttribute(s.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(s.PROGRAM_END_TIME):this.setAttribute(s.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){return y(this.getAttribute(s.ASSET_START_TIME))}set assetStartTime(e){e==null?this.removeAttribute(s.ASSET_START_TIME):this.setAttribute(s.ASSET_START_TIME,`${e}`)}get assetEndTime(){return y(this.getAttribute(s.ASSET_END_TIME))}set assetEndTime(e){e==null?this.removeAttribute(s.ASSET_END_TIME):this.setAttribute(s.ASSET_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute(o.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(o.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[i,r])=>(e[i]=r,e),{}):ka}set extraSourceParams(e){e==null?this.removeAttribute(o.EXTRA_SOURCE_PARAMS):this.setAttribute(o.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(s.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(s.CUSTOM_DOMAIN,e):this.removeAttribute(s.CUSTOM_DOMAIN))}get envKey(){var e;return(e=V(this,s.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(s.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute(o.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(o.NO_VOLUME_PREF,""):this.removeAttribute(o.NO_VOLUME_PREF)}get debug(){return V(this,s.DEBUG)!=null}set debug(e){e?this.setAttribute(s.DEBUG,""):this.removeAttribute(s.DEBUG)}get disableTracking(){return V(this,s.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(s.DISABLE_TRACKING,!!e)}get disableCookies(){return V(this,s.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(s.DISABLE_COOKIES,""):this.removeAttribute(s.DISABLE_COOKIES)}get streamType(){var e,i,r;return(r=(i=this.getAttribute(s.STREAM_TYPE))!=null?i:(e=this.media)==null?void 0:e.streamType)!=null?r:M.UNKNOWN}set streamType(e){this.setAttribute(s.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,i,r;return(r=(i=this.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?i:(e=this.mediaController)==null?void 0:e.getAttribute(o.DEFAULT_STREAM_TYPE))!=null?r:M.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(o.DEFAULT_STREAM_TYPE,e):this.removeAttribute(o.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,i;return this.hasAttribute(o.TARGET_LIVE_WINDOW)?+this.getAttribute(o.TARGET_LIVE_WINDOW):(i=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?i:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute(o.TARGET_LIVE_WINDOW):this.setAttribute(o.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return y(V(this,s.START_TIME))}set startTime(e){this.setAttribute(s.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(s.PREFER_PLAYBACK);if(e===be.MSE||e===be.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===be.MSE||e===be.NATIVE?this.setAttribute(s.PREFER_PLAYBACK,e):this.removeAttribute(s.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...At(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var i;if(b(this,m,S).call(this),!this.media){A("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:[]}addChapters(e){var i;if(b(this,m,S).call(this),!this.media){A("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(i=this.media)==null?void 0:i.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,i;return(i=(e=this.media)==null?void 0:e.chapters)!=null?i:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(o.PLAYBACK_TOKEN),i=this.getAttribute(o.DRM_TOKEN),r=this.getAttribute(o.THUMBNAIL_TOKEN),n=this.getAttribute(o.STORYBOARD_TOKEN);return{...u(this,ie),...e!=null?{playback:e}:{},...i!=null?{drm:i}:{},...r!=null?{thumbnail:r}:{},...n!=null?{storyboard:n}:{}}}set tokens(e){k(this,ie,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(o.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(o.PLAYBACK_TOKEN,`${e}`)}get drmToken(){var e;return(e=this.getAttribute(o.DRM_TOKEN))!=null?e:void 0}set drmToken(e){this.setAttribute(o.DRM_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(o.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(o.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(o.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(o.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,i,r,n){var l;let d=(l=this.media)==null?void 0:l.nativeEl;if(d)return pa(d,e,i,r,n)}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}get castReceiver(){var e;return(e=this.getAttribute(o.CAST_RECEIVER))!=null?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(o.CAST_RECEIVER,e):this.removeAttribute(o.CAST_RECEIVER))}get castCustomData(){var e;return(e=this.media)==null?void 0:e.castCustomData}set castCustomData(e){if(!this.media){A("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(o.NO_TOOLTIPS)}set noTooltips(e){if(!e){this.removeAttribute(o.NO_TOOLTIPS);return}this.setAttribute(o.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(o.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(e){e?this.setAttribute(o.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(o.PROUDLY_DISPLAY_MUX_BADGE)}};te=new WeakMap,ae=new WeakMap,ie=new WeakMap,w=new WeakMap,re=new WeakMap,H=new WeakMap,m=new WeakSet,S=function(){var e,i,r,n;if(!u(this,ae)){k(this,ae,!0),b(this,m,U).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof E.HTMLElement))throw""}catch{A("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof ca))throw""}catch{A("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof ma))throw""}catch{A("<media-controller> failed to upgrade!")}this.init(),b(this,m,Ot).call(this),b(this,m,Mt).call(this),b(this,m,Lt).call(this),k(this,w,(i=(e=this.mediaController)==null?void 0:e.hasAttribute(Oe.USER_INACTIVE))!=null?i:!0),b(this,m,Nt).call(this),(r=this.media)==null||r.addEventListener("streamtypechange",()=>b(this,m,U).call(this)),(n=this.media)==null||n.addEventListener("loadstart",()=>b(this,m,U).call(this))}},_t=function(){var e,i;try{(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Se=function(e){Object.assign(u(this,H),e),b(this,m,U).call(this)},U=function(e={}){ut(ct(fa(this,{...u(this,H),...e})),this.shadowRoot)},Ot=function(){let e=r=>{var l,p;if(!(r!=null&&r.startsWith("theme-")))return;let n=r.replace(/^theme-/,"");if(Ne.includes(n))return;let d=this.getAttribute(r);d!=null?(l=this.mediaTheme)==null||l.setAttribute(n,d):(p=this.mediaTheme)==null||p.removeAttribute(n)};new MutationObserver(r=>{for(let{attributeName:n}of r)e(n)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(e)},Mt=function(){var i;let e=r=>{let{detail:n}=r;if(n instanceof Q||(n=new Q(n.message,n.code,n.fatal)),!(n!=null&&n.fatal)){O(n),n.data&&O(`${n.name} data:`,n.data);return}let d=Re(n,!1);d.message&&Ee(d),A(n),n.data&&A(`${n.name} data:`,n.data),b(this,m,Se).call(this,{isDialogOpen:!0})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(r={})=>{var d,l,p;if(!(((d=this.media)==null?void 0:d.error)instanceof Q))return r;let n=Re((l=this.media)==null?void 0:l.error,!1);return{player_error_code:(p=this.media)==null?void 0:p.error.code,player_error_message:n.message?String(n.message):r.player_error_message,player_error_context:n.context?String(n.context):r.player_error_context}}),(i=this.media)==null||i.addEventListener("error",r=>{var d,l;let{detail:n}=r;if(!n){let{message:p,code:R}=(l=(d=this.media)==null?void 0:d.error)!=null?l:{};n=new Q(p,R)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},Lt=function(){var i,r,n,d;let e=()=>b(this,m,U).call(this);(r=(i=this.media)==null?void 0:i.textTracks)==null||r.addEventListener("addtrack",e),(d=(n=this.media)==null?void 0:n.textTracks)==null||d.addEventListener("removetrack",e)},Nt=function(){var R,F;if(!/Firefox/i.test(navigator.userAgent))return;let i,r=new WeakMap,n=()=>this.streamType===M.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,d=(x,C,_=!1)=>{if(n())return;Array.from(x&&x.activeCues||[]).forEach(h=>{if(!(!h.snapToLines||h.line<-5||h.line>=0&&h.line<10))if(!C||this.paused){let oe=h.text.split(`
|
|
1349
|
+
`).length,W=-3;this.streamType===M.LIVE&&(W=-2);let Z=W-oe;if(h.line===Z&&!_)return;r.has(h)||r.set(h,h.line),h.line=Z}else setTimeout(()=>{h.line=r.get(h)||"auto"},500)})},l=()=>{var x,C;d(i,(C=(x=this.mediaController)==null?void 0:x.hasAttribute(Oe.USER_INACTIVE))!=null?C:!1)},p=()=>{var _,B;let C=Array.from(((B=(_=this.mediaController)==null?void 0:_.media)==null?void 0:B.textTracks)||[]).filter(h=>["subtitles","captions"].includes(h.kind)&&h.mode==="showing")[0];C!==i&&(i==null||i.removeEventListener("cuechange",l)),i=C,i==null||i.addEventListener("cuechange",l),d(i,u(this,w))};p(),(R=this.textTracks)==null||R.addEventListener("change",p),(F=this.textTracks)==null||F.addEventListener("addtrack",p),this.addEventListener("userinactivechange",()=>{var C,_;let x=(_=(C=this.mediaController)==null?void 0:C.hasAttribute(Oe.USER_INACTIVE))!=null?_:!0;u(this,w)!==x&&(k(this,w,x),d(i,u(this,w)))})};function V(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}E.customElements.get("mux-player")||(E.customElements.define("mux-player",ee),E.MuxPlayerElement=ee);var Ti=ee;export{Q as MediaError,Ti as default,ha as generatePlayerInitTime,V as getVideoAttribute,kt as playerSoftwareName,Ct as playerSoftwareVersion};
|