@mux/mux-player 1.1.3-canary.0-e2c64b6 → 1.1.3-canary.0-ccbd4e6
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/CHANGELOG.md +17 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/mux-player.js +1 -1
- package/dist/mux-player.mjs +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.2.0](https://github.com/muxinc/elements/compare/@mux/mux-player@1.1.3...@mux/mux-player@1.2.0) (2022-10-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* playbackRate not working on mux-player-react ([#470](https://github.com/muxinc/elements/issues/470)) ([e2c64b6](https://github.com/muxinc/elements/commit/e2c64b60bb53a66101004ed198f9bb1a08630eb2))
|
|
12
|
+
* should have focus outline on dialog's close button ([#472](https://github.com/muxinc/elements/issues/472)) ([da33141](https://github.com/muxinc/elements/commit/da33141ba4a518a1843fc75c8e69ed24de5d00f1))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **mux-player:** Add type-compliant seekable prop to video-api. ([587266a](https://github.com/muxinc/elements/commit/587266a2a517875a509fa8540f606ee81c2d6c0a))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [1.1.3](https://github.com/muxinc/elements/compare/@mux/mux-player@1.1.2...@mux/mux-player@1.1.3) (2022-10-12)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @mux/mux-player
|
package/dist/index.cjs.js
CHANGED
|
@@ -722,7 +722,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
722
722
|
}
|
|
723
723
|
</style>
|
|
724
724
|
<slot></slot>
|
|
725
|
-
`;var fa=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(hn.content.cloneNode(!0))}};p("media-title-bar",fa);var Ks=100,Ys=t=>{var i;if(t.getAttribute(o.MEDIA_MUTED)!=null)return 0;let a=+((i=t.getAttribute(o.MEDIA_VOLUME))!=null?i:1);return Math.round(a*t.range.max)},Gs=({value:t,max:i})=>`${Math.round(t/i*100)}%`,ga=class extends ut{static get observedAttributes(){return[...super.observedAttributes,o.MEDIA_VOLUME,o.MEDIA_MUTED,o.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=Ks,this.range.addEventListener("input",()=>{let e=this.range.value/this.range.max,a=new u.CustomEvent(h.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(a)})}connectedCallback(){this.range.setAttribute("aria-label",N.VOLUME()),super.connectedCallback()}attributeChangedCallback(i,e,a){if(i===o.MEDIA_VOLUME||i===o.MEDIA_MUTED){let r=Ys(this);this.range.value=r,this.range.setAttribute("aria-valuetext",Gs(this.range)),this.updateBar()}super.attributeChangedCallback(i,e,a)}};p("media-volume-range",ga);var Zs=Object.defineProperty,Qs=(t,i,e)=>i in t?Zs(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,qs=(t,i,e)=>(Qs(t,typeof i!="symbol"?i+"":i,e),e),bt=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){this.shadowRoot.textContent="";let i=d.createElement("template");i.innerHTML=this.constructor.template,this.shadowRoot.append(i.content.cloneNode(!0))}get mediaController(){return this.shadowRoot.querySelector("media-controller")}};qs(bt,"template","");p("media-theme",bt);var va=bt;var Aa=class extends ct{};u.customElements.get("media-chrome")||u.customElements.define("media-chrome",Aa);var _a=class extends ct{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};u.customElements.get("media-container")||u.customElements.define("media-container",_a);var v=Ko(require("@mux/mux-video")),D=require("@mux/playback-core");var kn=require("@mux/mux-video");var zs="en",Te={code:zs};var pn="en";function A(t,i=!0){var r,n;let e=i&&(n=(r=Te)==null?void 0:r[t])!=null?n:t,a=i?Te.code:pn;return new ya(e,a)}var ya=class{constructor(i,e=(a=>(a=Te.code)!=null?a:pn)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var r;return(r=i[a])!=null?r:""})}toString(){return this.message}};function bn(t){let i="";return Object.entries(t).forEach(([e,a])=>{a!=null&&(i+=`${js(e)}: ${a}; `)}),i?i.trim():void 0}function js(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function En(t){return t.replace(/[-_]([a-z])/g,(i,e)=>e.toUpperCase())}function se(t){if(t==null)return;let i=+t;return Number.isNaN(i)?void 0:i}function ti(t){let i=Xs(t).toString();return i?"?"+i:""}function Xs(t){let i={};for(let e in t)t[e]!=null&&(i[e]=t[e]);return new URLSearchParams(i)}function Et(t){let i=(t!=null?t:"").split(".")[1];if(!i)return{};let e=i.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Ta=(t,i)=>!t||!i?!1:t.contains(i)?!0:Ta(t,i.getRootNode().host);var ft=require("@mux/playback-core");var Ia="mux.com",Js=()=>{try{return"1.
|
|
725
|
+
`;var fa=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(hn.content.cloneNode(!0))}};p("media-title-bar",fa);var Ks=100,Ys=t=>{var i;if(t.getAttribute(o.MEDIA_MUTED)!=null)return 0;let a=+((i=t.getAttribute(o.MEDIA_VOLUME))!=null?i:1);return Math.round(a*t.range.max)},Gs=({value:t,max:i})=>`${Math.round(t/i*100)}%`,ga=class extends ut{static get observedAttributes(){return[...super.observedAttributes,o.MEDIA_VOLUME,o.MEDIA_MUTED,o.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.max=Ks,this.range.addEventListener("input",()=>{let e=this.range.value/this.range.max,a=new u.CustomEvent(h.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(a)})}connectedCallback(){this.range.setAttribute("aria-label",N.VOLUME()),super.connectedCallback()}attributeChangedCallback(i,e,a){if(i===o.MEDIA_VOLUME||i===o.MEDIA_MUTED){let r=Ys(this);this.range.value=r,this.range.setAttribute("aria-valuetext",Gs(this.range)),this.updateBar()}super.attributeChangedCallback(i,e,a)}};p("media-volume-range",ga);var Zs=Object.defineProperty,Qs=(t,i,e)=>i in t?Zs(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,qs=(t,i,e)=>(Qs(t,typeof i!="symbol"?i+"":i,e),e),bt=class extends u.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){this.shadowRoot.textContent="";let i=d.createElement("template");i.innerHTML=this.constructor.template,this.shadowRoot.append(i.content.cloneNode(!0))}get mediaController(){return this.shadowRoot.querySelector("media-controller")}};qs(bt,"template","");p("media-theme",bt);var va=bt;var Aa=class extends ct{};u.customElements.get("media-chrome")||u.customElements.define("media-chrome",Aa);var _a=class extends ct{constructor(){super(),console.warn("MediaChrome: <media-container> is deprecated. Use <media-controller>.")}};u.customElements.get("media-container")||u.customElements.define("media-container",_a);var v=Ko(require("@mux/mux-video")),D=require("@mux/playback-core");var kn=require("@mux/mux-video");var zs="en",Te={code:zs};var pn="en";function A(t,i=!0){var r,n;let e=i&&(n=(r=Te)==null?void 0:r[t])!=null?n:t,a=i?Te.code:pn;return new ya(e,a)}var ya=class{constructor(i,e=(a=>(a=Te.code)!=null?a:pn)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var r;return(r=i[a])!=null?r:""})}toString(){return this.message}};function bn(t){let i="";return Object.entries(t).forEach(([e,a])=>{a!=null&&(i+=`${js(e)}: ${a}; `)}),i?i.trim():void 0}function js(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function En(t){return t.replace(/[-_]([a-z])/g,(i,e)=>e.toUpperCase())}function se(t){if(t==null)return;let i=+t;return Number.isNaN(i)?void 0:i}function ti(t){let i=Xs(t).toString();return i?"?"+i:""}function Xs(t){let i={};for(let e in t)t[e]!=null&&(i[e]=t[e]);return new URLSearchParams(i)}function Et(t){let i=(t!=null?t:"").split(".")[1];if(!i)return{};let e=i.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Ta=(t,i)=>!t||!i?!1:t.contains(i)?!0:Ta(t,i.getRootNode().host);var ft=require("@mux/playback-core");var Ia="mux.com",Js=()=>{try{return"1.2.0"}catch{}return"UNKNOWN"},el=Js(),ai=()=>el,Ma=(t,{token:i,domain:e=Ia}={})=>`https://stream.${e}/${t}.m3u8${ti(!!i?{token:i}:{redundant_streams:!0})}`,vn=(t,{token:i,thumbnailTime:e,domain:a=Ia}={})=>{let r=i==null?e:void 0;return`https://image.${a}/${t}/thumbnail.jpg${ti({token:i,time:r})}`},An=(t,{token:i,domain:e=Ia}={})=>`https://image.${e}/${t}/storyboard.vtt${ti({token:i})}`;function Sa(t){if(t&&/^media-theme-[\w-]+$/.test(t))return t}var tl={crossorigin:"crossOrigin",playsinline:"playsInline"};function _n(t){var i;return(i=tl[t])!=null?i:En(t)}var yn=t=>{var e,a;let{media:i}=t;return(a=(e=i==null?void 0:i._hls)==null?void 0:e.liveSyncPosition)!=null?a:i!=null&&i.seekable.length?i==null?void 0:i.seekable.end(i.seekable.length-1):void 0},ka=t=>{let i=yn(t);if(i==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}t.currentTime=i},il=1,al=5,fn=3,gn=.5,Tn=t=>{var n;let{streamType:i}=t,e=yn(t),a=(n=t.media)==null?void 0:n.currentTime;if(e==null||a==null)return!1;let r=e-a;return i===ft.StreamTypes.LL_LIVE||i===ft.StreamTypes.LL_DVR?r<=il*(fn+gn):i===ft.StreamTypes.LIVE||i===ft.StreamTypes.DVR?r<=al*(fn+gn):!1},Ie,Me,V,ii=class{constructor(i,e){T(this,Ie,void 0);T(this,Me,void 0);T(this,V,[]);B(this,Ie,i),B(this,Me,e)}[Symbol.iterator](){return g(this,V).values()}get length(){return g(this,V).length}get value(){var i;return(i=g(this,V).join(" "))!=null?i:""}set value(i){var e;i!==this.value&&(B(this,V,[]),this.add(...(e=i==null?void 0:i.split(" "))!=null?e:[]))}toString(){return this.value}item(i){return g(this,V)[i]}values(){return g(this,V).values()}keys(){return g(this,V).keys()}forEach(i){g(this,V).forEach(i)}add(...i){var e,a;i.forEach(r=>{this.contains(r)||g(this,V).push(r)}),!(this.value===""&&!((e=g(this,Ie))!=null&&e.hasAttribute(`${g(this,Me)}`)))&&((a=g(this,Ie))==null||a.setAttribute(`${g(this,Me)}`,`${this.value}`))}remove(...i){var e;i.forEach(a=>{g(this,V).splice(g(this,V).indexOf(a),1)}),(e=g(this,Ie))==null||e.setAttribute(`${g(this,Me)}`,`${this.value}`)}contains(i){return g(this,V).includes(i)}toggle(i,e){return typeof e!="undefined"?e?(this.add(i),!0):(this.remove(i),!1):this.contains(i)?(this.remove(i),!1):(this.add(i),!0)}replace(i,e){this.remove(i),this.add(e)}};Ie=new WeakMap,Me=new WeakMap,V=new WeakMap;var In=`[mux-player ${ai()}]`;function Se(...t){console.warn(In,...t)}function X(...t){console.error(In,...t)}function ri(t){var e;let i=(e=t.message)!=null?e:"";if(t.file){let a="https://github.com/muxinc/elements/blob/main/errors/";i+=` ${A("Read more: ")}
|
|
726
726
|
${a}${t.file}`}Se(i)}var $={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},ke={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Sn=Object.freeze({length:0,start(t){let i=t>>>0;if(i>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${i}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let i=t>>>0;if(i>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${i}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),rl=kn.VideoEvents.filter(t=>t!=="error"),nl=Object.values($).filter(t=>![$.PLAYSINLINE].includes(t)),ol=Object.values(ke);function Ln(t){t.querySelectorAll(":scope > track").forEach(i=>{var e;(e=t.media)==null||e.append(i.cloneNode())}),rl.forEach(i=>{var e;(e=t.media)==null||e.addEventListener(i,a=>{t.dispatchEvent(new Event(a.type))})})}var La=class extends M.HTMLElement{static get observedAttributes(){return[...nl,...ol]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(a=>{var r;(r=this.media)==null||r.append(a.cloneNode())});let i=a=>{for(let r of a)r.type==="childList"&&(r.removedNodes.forEach(n=>{var l,c;let s=(l=this.media)==null?void 0:l.querySelector(`track[src="${n.src}"]`);s&&((c=this.media)==null||c.removeChild(s))}),r.addedNodes.forEach(n=>{var s;(s=this.media)==null||s.append(n.cloneNode())}))};new MutationObserver(i).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(i,e,a){var r,n;switch(i){case ke.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case ke.VOLUME:{let s=(r=se(a))!=null?r:1;this.media&&(this.media.volume=s);return}case ke.PLAYBACKRATE:{let s=(n=se(a))!=null?n:1;this.media&&(this.media.playbackRate=s,this.media.defaultPlaybackRate=s);return}}}play(){var i,e;return(e=(i=this.media)==null?void 0:i.play())!=null?e:Promise.reject()}pause(){var i;(i=this.media)==null||i.pause()}requestCast(i){var e;return(e=this.media)==null?void 0:e.requestCast(i)}get media(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video")}get paused(){var i,e;return(e=(i=this.media)==null?void 0:i.paused)!=null?e:!0}get duration(){var i,e;return(e=(i=this.media)==null?void 0:i.duration)!=null?e:NaN}get ended(){var i,e;return(e=(i=this.media)==null?void 0:i.ended)!=null?e:!1}get buffered(){var i,e;return(e=(i=this.media)==null?void 0:i.buffered)!=null?e:Sn}get seekable(){var i,e;return(e=(i=this.media)==null?void 0:i.seekable)!=null?e:Sn}get readyState(){var i,e;return(e=(i=this.media)==null?void 0:i.readyState)!=null?e:0}get videoWidth(){var i,e;return(e=(i=this.media)==null?void 0:i.videoWidth)!=null?e:0}get videoHeight(){var i,e;return(e=(i=this.media)==null?void 0:i.videoHeight)!=null?e:0}get currentTime(){var i,e;return(e=(i=this.media)==null?void 0:i.currentTime)!=null?e:0}set currentTime(i){this.media&&(this.media.currentTime=Number(i))}get volume(){var i,e;return(e=(i=this.media)==null?void 0:i.volume)!=null?e:1}set volume(i){this.media&&(this.media.volume=Number(i))}get playbackRate(){var i,e;return(e=(i=this.media)==null?void 0:i.playbackRate)!=null?e:1}set playbackRate(i){this.media&&(this.media.playbackRate=Number(i))}get defaultPlaybackRate(){var i;return(i=se(this.getAttribute(ke.PLAYBACKRATE)))!=null?i:1}set defaultPlaybackRate(i){i!=null?this.setAttribute(ke.PLAYBACKRATE,`${i}`):this.removeAttribute(ke.PLAYBACKRATE)}get crossOrigin(){return gt(this,$.CROSSORIGIN)}set crossOrigin(i){this.setAttribute($.CROSSORIGIN,`${i}`)}get autoplay(){return gt(this,$.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute($.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute($.AUTOPLAY)}get loop(){return gt(this,$.LOOP)!=null}set loop(i){i?this.setAttribute($.LOOP,""):this.removeAttribute($.LOOP)}get muted(){var i,e;return(e=(i=this.media)==null?void 0:i.muted)!=null?e:!1}set muted(i){this.media&&(this.media.muted=Boolean(i))}get defaultMuted(){return gt(this,$.MUTED)!=null}set defaultMuted(i){i?this.setAttribute($.MUTED,""):this.removeAttribute($.MUTED)}get playsInline(){return gt(this,$.PLAYSINLINE)!=null}set playsInline(i){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(i){["","none","metadata","auto"].includes(i)?this.setAttribute($.PRELOAD,i):this.removeAttribute($.PRELOAD)}};function gt(t,i){return t.media?t.media.getAttribute(i):t.getAttribute(i)}var Ca=La;var ni=new Map;function oi(t){if(ni.has(t))return ni.get(t);let i=t.length,e=0,a=0,r=0,n=[];for(let s=0;s<i;s+=1){let l=t[s],c=t[s+1],m=t[s-1];l==="{"&&c==="{"&&m!=="\\"?(r+=1,r===1&&(a=s),s+=1):l==="}"&&c==="}"&&m!=="\\"&&r&&(r-=1,r===0&&(a>e&&(n.push(Object.freeze({type:"string",start:e,end:a,value:t.slice(e,a)})),e=a),n.push(Object.freeze({type:"part",start:a,end:s+2,value:t.slice(e+2,s).trim()})),s+=1,e=s+1))}return e<i&&n.push(Object.freeze({type:"string",start:e,end:i,value:t.slice(e,i)})),ni.set(t,Object.freeze(n)),ni.get(t)}var Le=new WeakMap,Cn=new WeakMap,q=class{constructor(i,e){this.expression=e,Le.set(this,i),i.updateParent("")}get attributeName(){return Le.get(this).attr.name}get attributeNamespace(){return Le.get(this).attr.namespaceURI}get value(){return Cn.get(this)}set value(i){Cn.set(this,i||""),Le.get(this).updateParent(i)}get element(){return Le.get(this).element}get booleanValue(){return Le.get(this).booleanValue}set booleanValue(i){Le.get(this).booleanValue=i}},vt=class{constructor(i,e){this.element=i,this.attr=e,this.partList=[]}get booleanValue(){return this.element.hasAttributeNS(this.attr.namespaceURI,this.attr.name)}set booleanValue(i){if(this.partList.length!==1)throw new DOMException("Operation not supported","NotSupportedError");this.partList[0].value=i?"":null}append(i){this.partList.push(i)}updateParent(i){if(this.partList.length===1&&i===null)this.element.removeAttributeNS(this.attr.namespaceURI,this.attr.name);else{let e=this.partList.map(a=>typeof a=="string"?a:a.value).join("");this.element.setAttributeNS(this.attr.namespaceURI,this.attr.name,e)}}};var Ee=new WeakMap,J=class{constructor(i,e){this.expression=e,Ee.set(this,[i]),i.textContent=""}get value(){return Ee.get(this).map(i=>i.textContent).join("")}set value(i){this.replace(i)}get previousSibling(){return Ee.get(this)[0].previousSibling}get nextSibling(){return Ee.get(this)[Ee.get(this).length-1].nextSibling}replace(...i){let e=i.map(a=>typeof a=="string"?new Text(a):a);e.length||e.push(new Text("")),Ee.get(this)[0].before(...e);for(let a of Ee.get(this))a.remove();Ee.set(this,e)}};function At(t){return{processCallback(i,e,a){var r;if(!(typeof a!="object"||!a)){for(let n of e)if(n.expression in a){let s=(r=a[n.expression])!==null&&r!==void 0?r:"";t(n,s)}}}}}function wa(t,i){t.value=String(i)}function wn(t,i){return typeof i=="boolean"&&t instanceof q&&typeof t.element[t.attributeName]=="boolean"?(t.booleanValue=i,!0):!1}var Da=At(wa),sl=At((t,i)=>{wn(t,i)||wa(t,i)});function*ll(t){let i=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null,!1),e;for(;e=i.nextNode();)if(e instanceof Element&&e.hasAttributes())for(let a=0;a<e.attributes.length;a+=1){let r=e.attributes.item(a);if(r&&r.value.includes("{{")){let n=new vt(e,r);for(let s of oi(r.value))if(s.type==="string")n.append(s.value);else{let l=new q(n,s.value);n.append(l),yield l}}}else if(e instanceof Text&&e.textContent&&e.textContent.includes("{{")){let a=oi(e.textContent);for(let r=0;r<a.length;r+=1){let n=a[r];n.end<e.textContent.length&&e.splitText(n.end),n.type==="part"&&(yield new J(e,n.value));break}}}var si=new WeakMap,li=new WeakMap,le=class extends DocumentFragment{constructor(i,e,a=Da){var r,n;super(),Object.getPrototypeOf(this)!==le.prototype&&Object.setPrototypeOf(this,le.prototype),this.appendChild(i.content.cloneNode(!0)),li.set(this,Array.from(ll(this))),si.set(this,a),(n=(r=si.get(this)).createCallback)===null||n===void 0||n.call(r,this,li.get(this),e),si.get(this).processCallback(this,li.get(this),e)}update(i){si.get(this).processCallback(this,li.get(this),i)}};var _t=new WeakMap,yt=class{constructor(i,e){this.element=i;this.type=e;this.element.addEventListener(this.type,this);let a=_t.get(this.element);a&&a.set(this.type,this)}set(i){if(typeof i=="function")this.handleEvent=i.bind(this.element);else if(typeof i=="object"&&typeof i.handleEvent=="function")this.handleEvent=i.handleEvent.bind(i);else{this.element.removeEventListener(this.type,this);let e=_t.get(this.element);e&&e.delete(this.type)}}static for(i){_t.has(i.element)||_t.set(i.element,new Map);let e=i.attributeName.slice(2),a=_t.get(i.element);return a&&a.has(e)?a.get(e):new yt(i.element,e)}};function dl(t,i){return t instanceof q&&t.attributeName.startsWith("on")?(yt.for(t).set(i),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function cl(t,i){return i instanceof Tt&&t instanceof J?(i.renderInto(t),!0):!1}function ul(t,i){return i instanceof DocumentFragment&&t instanceof J?(i.childNodes.length&&t.replace(...i.childNodes),!0):!1}function ml(t,i){if(t instanceof q){let e=t.attributeNamespace,a=t.element.getAttributeNS(e,t.attributeName);return String(i)!==a&&(t.value=String(i)),!0}return t.value=String(i),!0}function hl(t,i){if(typeof i=="boolean"&&t instanceof q){let e=t.attributeNamespace,a=t.element.hasAttributeNS(e,t.attributeName);return i!==a&&(t.booleanValue=i),!0}return!1}function pl(t,i){return i===!1&&t instanceof J?(t.replace(""),!0):!1}function bl(t,i){hl(t,i)||dl(t,i)||pl(t,i)||cl(t,i)||ul(t,i)||ml(t,i)}var xa=new WeakMap,Dn=new WeakMap,xn=new WeakMap,Tt=class{constructor(i,e,a){this.strings=i;this.values=e;this.processor=a}get template(){if(xa.has(this.strings))return xa.get(this.strings);{let i=document.createElement("template"),e=this.strings.length-1;return i.innerHTML=this.strings.reduce((a,r,n)=>a+r+(n<e?`{{ ${n} }}`:""),""),xa.set(this.strings,i),i}}renderInto(i){let e=this.template;if(Dn.get(i)!==e){Dn.set(i,e);let r=new le(e,this.values,this.processor);xn.set(i,r),i instanceof J?i.replace(...r.children):i.appendChild(r);return}let a=xn.get(i);a&&a.update(this.values)}},Rn=new Map,El=At(bl);function f(t,...i){let e=[""],a=[],r,n=!1,s=(l,c=[])=>{e[e.length-1]=e[e.length-1]+l[0],c.forEach((m,E)=>{(r=m==null?void 0:m.$static$)!==void 0?(r.forEach(y=>{s(y.strings,y.values)}),e[e.length-1]=e[e.length-1]+l[E+1],n=!0):(a.push(m),e.push(l[E+1]))})};if(s(t,i),n){let l=e.join("$$html$$");t=Rn.get(l),t===void 0&&(e.raw=e,Rn.set(l,t=e)),i=a}return new Tt(t,i,El)}function di(t,i){t.renderInto(i)}function R(t,i){let e=document.createElement("template");return e.innerHTML=t,new le(e,i)}var Ra=(...t)=>({$static$:t.map(i=>i instanceof Tt?i:/\w-/.test(i)?{strings:[i]}:{strings:[]})});var Un=`
|
|
727
727
|
:host {
|
|
728
728
|
cursor: pointer;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var et=(e,a,t)=>{if(!a.has(e))throw TypeError("Cannot "+t)};var d=(e,a,t)=>(et(e,a,"read from private field"),t?t.call(e):a.get(e)),h=(e,a,t)=>{if(a.has(e))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(e):a.set(e,t)},A=(e,a,t,i)=>(et(e,a,"write to private field"),i?i.call(e,t):a.set(e,t),t);var p=(e,a,t)=>(et(e,a,"access private method"),t);var ie=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class e extends ie{}globalThis.DocumentFragment=e}var ge=class extends ie{},tt=class extends ie{},di={get(e){},define(e,a,t){},upgrade(e){},whenDefined(e){return Promise.resolve(ge)}},fe,at=class{constructor(a,t={}){h(this,fe,void 0);A(this,fe,t==null?void 0:t.detail)}get detail(){return d(this,fe)}initCustomEvent(){}};fe=new WeakMap;function mi(e,a){return new ge}var Bt={document:{createElement:mi},DocumentFragment,customElements:di,CustomEvent:at,EventTarget:ie,HTMLElement:ge,HTMLVideoElement:tt},Kt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",g=Kt?Bt:globalThis,S=Kt?Bt.document:globalThis.document;import{MediaController as hr}from"media-chrome";import br,{MediaError as gt,Attributes as c}from"@mux/mux-video";import{StreamTypes as K,PlaybackTypes as Ye,addTextTrack as pr,removeTextTrack as gr}from"@mux/playback-core";import{VideoEvents as yi}from"@mux/mux-video";var ui="en",z={code:ui};var Ut="en";function u(e,a=!0){var r,n;let t=a&&(n=(r=z)==null?void 0:r[e])!=null?n:e,i=a?z.code:Ut;return new it(t,i)}var it=class{constructor(a,t=(i=>(i=z.code)!=null?i:Ut)()){this.message=a,this.locale=t}format(a){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function Ft(e){let a="";return Object.entries(e).forEach(([t,i])=>{i!=null&&(a+=`${ci(t)}: ${i}; `)}),a?a.trim():void 0}function ci(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Yt(e){return e.replace(/[-_]([a-z])/g,(a,t)=>t.toUpperCase())}function N(e){if(e==null)return;let a=+e;return Number.isNaN(a)?void 0:a}function Ce(e){let a=hi(e).toString();return a?"?"+a:""}function hi(e){let a={};for(let t in e)e[t]!=null&&(a[t]=e[t]);return new URLSearchParams(a)}function ve(e){let a=(e!=null?e:"").split(".")[1];if(!a)return{};let t=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var rt=(e,a)=>!e||!a?!1:e.contains(a)?!0:rt(e,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var nt="mux.com",bi=()=>{try{return"1.
|
|
1
|
+
var et=(e,a,t)=>{if(!a.has(e))throw TypeError("Cannot "+t)};var d=(e,a,t)=>(et(e,a,"read from private field"),t?t.call(e):a.get(e)),h=(e,a,t)=>{if(a.has(e))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(e):a.set(e,t)},A=(e,a,t,i)=>(et(e,a,"write to private field"),i?i.call(e,t):a.set(e,t),t);var p=(e,a,t)=>(et(e,a,"access private method"),t);var ie=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class e extends ie{}globalThis.DocumentFragment=e}var ge=class extends ie{},tt=class extends ie{},di={get(e){},define(e,a,t){},upgrade(e){},whenDefined(e){return Promise.resolve(ge)}},fe,at=class{constructor(a,t={}){h(this,fe,void 0);A(this,fe,t==null?void 0:t.detail)}get detail(){return d(this,fe)}initCustomEvent(){}};fe=new WeakMap;function mi(e,a){return new ge}var Bt={document:{createElement:mi},DocumentFragment,customElements:di,CustomEvent:at,EventTarget:ie,HTMLElement:ge,HTMLVideoElement:tt},Kt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",g=Kt?Bt:globalThis,S=Kt?Bt.document:globalThis.document;import{MediaController as hr}from"media-chrome";import br,{MediaError as gt,Attributes as c}from"@mux/mux-video";import{StreamTypes as K,PlaybackTypes as Ye,addTextTrack as pr,removeTextTrack as gr}from"@mux/playback-core";import{VideoEvents as yi}from"@mux/mux-video";var ui="en",z={code:ui};var Ut="en";function u(e,a=!0){var r,n;let t=a&&(n=(r=z)==null?void 0:r[e])!=null?n:e,i=a?z.code:Ut;return new it(t,i)}var it=class{constructor(a,t=(i=>(i=z.code)!=null?i:Ut)()){this.message=a,this.locale=t}format(a){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return(r=a[i])!=null?r:""})}toString(){return this.message}};function Ft(e){let a="";return Object.entries(e).forEach(([t,i])=>{i!=null&&(a+=`${ci(t)}: ${i}; `)}),a?a.trim():void 0}function ci(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Yt(e){return e.replace(/[-_]([a-z])/g,(a,t)=>t.toUpperCase())}function N(e){if(e==null)return;let a=+e;return Number.isNaN(a)?void 0:a}function Ce(e){let a=hi(e).toString();return a?"?"+a:""}function hi(e){let a={};for(let t in e)e[t]!=null&&(a[t]=e[t]);return new URLSearchParams(a)}function ve(e){let a=(e!=null?e:"").split(".")[1];if(!a)return{};let t=a.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}var rt=(e,a)=>!e||!a?!1:e.contains(a)?!0:rt(e,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var nt="mux.com",bi=()=>{try{return"1.2.0"}catch{}return"UNKNOWN"},pi=bi(),Re=()=>pi,ot=(e,{token:a,domain:t=nt}={})=>`https://stream.${t}/${e}.m3u8${Ce(!!a?{token:a}:{redundant_streams:!0})}`,zt=(e,{token:a,thumbnailTime:t,domain:i=nt}={})=>{let r=a==null?t:void 0;return`https://image.${i}/${e}/thumbnail.jpg${Ce({token:a,time:r})}`},qt=(e,{token:a,domain:t=nt}={})=>`https://image.${t}/${e}/storyboard.vtt${Ce({token:a})}`;function st(e){if(e&&/^media-theme-[\w-]+$/.test(e))return e}var gi={crossorigin:"crossOrigin",playsinline:"playsInline"};function jt(e){var a;return(a=gi[e])!=null?a:Yt(e)}var Gt=e=>{var t,i;let{media:a}=e;return(i=(t=a==null?void 0:a._hls)==null?void 0:t.liveSyncPosition)!=null?i:a!=null&&a.seekable.length?a==null?void 0:a.seekable.end(a.seekable.length-1):void 0},lt=e=>{let a=Gt(e);if(a==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}e.currentTime=a},fi=1,vi=5,Zt=3,Wt=.5,Xt=e=>{var n;let{streamType:a}=e,t=Gt(e),i=(n=e.media)==null?void 0:n.currentTime;if(t==null||i==null)return!1;let r=t-i;return a===Me.LL_LIVE||a===Me.LL_DVR?r<=fi*(Zt+Wt):a===Me.LIVE||a===Me.DVR?r<=vi*(Zt+Wt):!1},q,j,x,Pe=class{constructor(a,t){h(this,q,void 0);h(this,j,void 0);h(this,x,[]);A(this,q,a),A(this,j,t)}[Symbol.iterator](){return d(this,x).values()}get length(){return d(this,x).length}get value(){var a;return(a=d(this,x).join(" "))!=null?a:""}set value(a){var t;a!==this.value&&(A(this,x,[]),this.add(...(t=a==null?void 0:a.split(" "))!=null?t:[]))}toString(){return this.value}item(a){return d(this,x)[a]}values(){return d(this,x).values()}keys(){return d(this,x).keys()}forEach(a){d(this,x).forEach(a)}add(...a){var t,i;a.forEach(r=>{this.contains(r)||d(this,x).push(r)}),!(this.value===""&&!((t=d(this,q))!=null&&t.hasAttribute(`${d(this,j)}`)))&&((i=d(this,q))==null||i.setAttribute(`${d(this,j)}`,`${this.value}`))}remove(...a){var t;a.forEach(i=>{d(this,x).splice(d(this,x).indexOf(i),1)}),(t=d(this,q))==null||t.setAttribute(`${d(this,j)}`,`${this.value}`)}contains(a){return d(this,x).includes(a)}toggle(a,t){return typeof t!="undefined"?t?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,t){this.remove(a),this.add(t)}};q=new WeakMap,j=new WeakMap,x=new WeakMap;var Jt=`[mux-player ${Re()}]`;function G(...e){console.warn(Jt,...e)}function O(...e){console.error(Jt,...e)}function Ie(e){var t;let a=(t=e.message)!=null?t:"";if(e.file){let i="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${u("Read more: ")}
|
|
2
2
|
${i}${e.file}`}G(a)}var T={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},X={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ea=Object.freeze({length:0,start(e){let a=e>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(e){let a=e>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Ei=yi.filter(e=>e!=="error"),ki=Object.values(T).filter(e=>![T.PLAYSINLINE].includes(e)),Ti=Object.values(X);function ta(e){e.querySelectorAll(":scope > track").forEach(a=>{var t;(t=e.media)==null||t.append(a.cloneNode())}),Ei.forEach(a=>{var t;(t=e.media)==null||t.addEventListener(a,i=>{e.dispatchEvent(new Event(i.type))})})}var dt=class extends g.HTMLElement{static get observedAttributes(){return[...ki,...Ti]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(i=>{var r;(r=this.media)==null||r.append(i.cloneNode())});let a=i=>{for(let r of i)r.type==="childList"&&(r.removedNodes.forEach(n=>{var m,b;let o=(m=this.media)==null?void 0:m.querySelector(`track[src="${n.src}"]`);o&&((b=this.media)==null||b.removeChild(o))}),r.addedNodes.forEach(n=>{var o;(o=this.media)==null||o.append(n.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,t,i){var r,n;switch(a){case X.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case X.VOLUME:{let o=(r=N(i))!=null?r:1;this.media&&(this.media.volume=o);return}case X.PLAYBACKRATE:{let o=(n=N(i))!=null?n:1;this.media&&(this.media.playbackRate=o,this.media.defaultPlaybackRate=o);return}}}play(){var a,t;return(t=(a=this.media)==null?void 0:a.play())!=null?t:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var t;return(t=this.media)==null?void 0:t.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,t;return(t=(a=this.media)==null?void 0:a.paused)!=null?t:!0}get duration(){var a,t;return(t=(a=this.media)==null?void 0:a.duration)!=null?t:NaN}get ended(){var a,t;return(t=(a=this.media)==null?void 0:a.ended)!=null?t:!1}get buffered(){var a,t;return(t=(a=this.media)==null?void 0:a.buffered)!=null?t:ea}get seekable(){var a,t;return(t=(a=this.media)==null?void 0:a.seekable)!=null?t:ea}get readyState(){var a,t;return(t=(a=this.media)==null?void 0:a.readyState)!=null?t:0}get videoWidth(){var a,t;return(t=(a=this.media)==null?void 0:a.videoWidth)!=null?t:0}get videoHeight(){var a,t;return(t=(a=this.media)==null?void 0:a.videoHeight)!=null?t:0}get currentTime(){var a,t;return(t=(a=this.media)==null?void 0:a.currentTime)!=null?t:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,t;return(t=(a=this.media)==null?void 0:a.volume)!=null?t:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,t;return(t=(a=this.media)==null?void 0:a.playbackRate)!=null?t:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=N(this.getAttribute(X.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(X.PLAYBACKRATE,`${a}`):this.removeAttribute(X.PLAYBACKRATE)}get crossOrigin(){return ye(this,T.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(T.CROSSORIGIN,`${a}`)}get autoplay(){return ye(this,T.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(T.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(T.AUTOPLAY)}get loop(){return ye(this,T.LOOP)!=null}set loop(a){a?this.setAttribute(T.LOOP,""):this.removeAttribute(T.LOOP)}get muted(){var a,t;return(t=(a=this.media)==null?void 0:a.muted)!=null?t:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return ye(this,T.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(T.MUTED,""):this.removeAttribute(T.MUTED)}get playsInline(){return ye(this,T.PLAYSINLINE)!=null}set playsInline(a){O("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(a){["","none","metadata","auto"].includes(a)?this.setAttribute(T.PRELOAD,a):this.removeAttribute(T.PRELOAD)}};function ye(e,a){return e.media?e.media.getAttribute(a):e.getAttribute(a)}var mt=dt;import{MediaTheme as Xi}from"media-chrome";import{TemplateInstance as na,NodeTemplatePart as De,createProcessor as Ai,AttributeTemplatePart as ct}from"@github/template-parts";var Ee=new WeakMap,ke=class{constructor(a,t){this.element=a;this.type=t;this.element.addEventListener(this.type,this);let i=Ee.get(this.element);i&&i.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let t=Ee.get(this.element);t&&t.delete(this.type)}}static for(a){Ee.has(a.element)||Ee.set(a.element,new Map);let t=a.attributeName.slice(2),i=Ee.get(a.element);return i&&i.has(t)?i.get(t):new ke(a.element,t)}};function xi(e,a){return e instanceof ct&&e.attributeName.startsWith("on")?(ke.for(e).set(a),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),!0):!1}function wi(e,a){return a instanceof Te&&e instanceof De?(a.renderInto(e),!0):!1}function Li(e,a){return a instanceof DocumentFragment&&e instanceof De?(a.childNodes.length&&e.replace(...a.childNodes),!0):!1}function $i(e,a){if(e instanceof ct){let t=e.attributeNamespace,i=e.element.getAttributeNS(t,e.attributeName);return String(a)!==i&&(e.value=String(a)),!0}return e.value=String(a),!0}function Si(e,a){if(typeof a=="boolean"&&e instanceof ct){let t=e.attributeNamespace,i=e.element.hasAttributeNS(t,e.attributeName);return a!==i&&(e.booleanValue=a),!0}return!1}function Oi(e,a){return a===!1&&e instanceof De?(e.replace(""),!0):!1}function Ci(e,a){Si(e,a)||xi(e,a)||Oi(e,a)||wi(e,a)||Li(e,a)||$i(e,a)}var ut=new WeakMap,aa=new WeakMap,ia=new WeakMap,Te=class{constructor(a,t,i){this.strings=a;this.values=t;this.processor=i}get template(){if(ut.has(this.strings))return ut.get(this.strings);{let a=document.createElement("template"),t=this.strings.length-1;return a.innerHTML=this.strings.reduce((i,r,n)=>i+r+(n<t?`{{ ${n} }}`:""),""),ut.set(this.strings,a),a}}renderInto(a){let t=this.template;if(aa.get(a)!==t){aa.set(a,t);let r=new na(t,this.values,this.processor);ia.set(a,r),a instanceof De?a.replace(...r.children):a.appendChild(r);return}let i=ia.get(a);i&&i.update(this.values)}},ra=new Map,Mi=Ai(Ci);function l(e,...a){let t=[""],i=[],r,n=!1,o=(m,b=[])=>{t[t.length-1]=t[t.length-1]+m[0],b.forEach((f,v)=>{(r=f==null?void 0:f.$static$)!==void 0?(r.forEach($=>{o($.strings,$.values)}),t[t.length-1]=t[t.length-1]+m[v+1],n=!0):(i.push(f),t.push(m[v+1]))})};if(o(e,a),n){let m=t.join("$$html$$");e=ra.get(m),e===void 0&&(t.raw=t,ra.set(m,e=t)),a=i}return new Te(e,a,Mi)}function _e(e,a){e.renderInto(a)}function y(e,a){let t=document.createElement("template");return t.innerHTML=e,new na(t,a)}var ht=(...e)=>({$static$:e.map(a=>a instanceof Te?a:/\w-/.test(a)?{strings:[a]}:{strings:[]})});var sa=`
|
|
3
3
|
:host {
|
|
4
4
|
cursor: pointer;
|
package/dist/mux-player.js
CHANGED
|
@@ -770,7 +770,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
770
770
|
</style>
|
|
771
771
|
<video is="castable-video" part="video" crossorigin></video>
|
|
772
772
|
<slot></slot>
|
|
773
|
-
`;var Wi,Qr,Hi,ji,Sa,gr=class extends Ot.HTMLElement{constructor(){super(),De(this,Qr),De(this,ji),De(this,Wi,void 0),this.attachShadow({mode:"open"}),this.isConnected&&$e(this,Qr,Hi).call(this)}static get observedAttributes(){let r=[],t=a=>a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(a=>{let n=!1;try{typeof this.prototype[a]=="function"&&(n=!0)}catch{}!n&&a!==a.toUpperCase()&&r.push(a.toLowerCase(),t(a))});let e=Object.getPrototypeOf(this).observedAttributes;return e&&(r=r.concat(e)),r}attributeChangedCallback(r,t,e){$e(this,Qr,Hi).call(this),$e(this,ji,Sa).call(this,r,t,e)}connectedCallback(){$e(this,Qr,Hi).call(this)}};Wi=new WeakMap,Qr=new WeakSet,Hi=function(){if(ue(this,Wi))return;et(this,Wi,!0),this.shadowRoot.append(Lo.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Ia.forEach(t=>{this.nativeEl.addEventListener(t,e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))})});let r=this.shadowRoot.querySelector("slot");r.addEventListener("slotchange",()=>{r.assignedElements().forEach(t=>{!["track","source"].includes(t.localName)||this.nativeEl.append(t)})}),Array.prototype.forEach.call(this.attributes,t=>{$e(this,ji,Sa).call(this,t.name,null,t.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},ji=new WeakSet,Sa=function(r,t,e){let a=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=kd(a,r),u=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;n&&!u?typeof this[n]=="boolean"?e===null?this[n]=!1:this[n]=!0:this[n]=e:e===null?this.nativeEl.removeAttribute(r):["id","class"].indexOf(r)===-1&&this.nativeEl.setAttribute(r,e)};var Do=[],Io=xo.createElement("video",{is:"castable-video"}),Pd=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let r=Object.getPrototypeOf(Io);r&&r!==Ot.HTMLElement.prototype;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(t=>{Pd.indexOf(t)===-1&&Do.push(t)});Do.forEach(r=>{if(!(r in gr.prototype))if(typeof Io[r]=="function")gr.prototype[r]=function(){return this.nativeEl[r].apply(this.nativeEl,arguments)};else{let t={get(){return this.nativeEl[r]}};r!==r.toUpperCase()&&(t.set=function(e){this.nativeEl[r]=e}),Object.defineProperty(gr.prototype,r,t)}});function kd(r,t){let e=null;return r.forEach(a=>{a.toLowerCase()==t.toLowerCase()&&(e=a)}),e}Ot.customElements.get("custom-video")||(Ot.customElements.define("custom-video",gr),Ot.CustomVideoElement=gr);var Ao=gr,ae={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},wd=Object.values(ae),Ud=Od(),Nd="mux-video",xa=class extends Ao{constructor(){super(),this.__metadata={},this.__playerInitTime=mo()}static get observedAttributes(){var r;return[...wd,...(r=Ao.observedAttributes)!=null?r:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var r;return(r=this.__playerSoftwareName)!=null?r:Nd}set playerSoftwareName(r){this.__playerSoftwareName=r}get playerSoftwareVersion(){var r;return(r=this.__playerSoftwareVersion)!=null?r:Ud}set playerSoftwareVersion(r){this.__playerSoftwareVersion=r}get _hls(){var r;return(r=this.__core)==null?void 0:r.engine}get mux(){return this.nativeEl.mux}get error(){var r;return(r=po(this.nativeEl))!=null?r:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(r){this.__errorTranslator=r}get src(){return this.getAttribute("src")}set src(r){r!==this.src&&(r==null?this.removeAttribute("src"):this.setAttribute("src",r))}get type(){var r;return(r=this.getAttribute(ae.TYPE))!=null?r:void 0}set type(r){r!==this.type&&(r?this.setAttribute(ae.TYPE,r):this.removeAttribute(ae.TYPE))}get autoplay(){let r=this.getAttribute("autoplay");return r===null?!1:r===""?!0:r}set autoplay(r){let t=this.autoplay;r!==t&&(r?this.setAttribute("autoplay",typeof r=="string"?r:""):this.removeAttribute("autoplay"))}get preload(){let r=this.getAttribute("preload");return r===""?"auto":["none","metadata","auto"].includes(r)?r:super.preload}set preload(r){r!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(r)?this.setAttribute("preload",r):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(r){r!==this.debug&&(r?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get startTime(){let r=this.getAttribute(ae.START_TIME);if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}set startTime(r){r!==this.startTime&&(r==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${r}`))}get playbackId(){var r;return(r=this.getAttribute(ae.PLAYBACK_ID))!=null?r:void 0}set playbackId(r){r!==this.playbackId&&(r?this.setAttribute(ae.PLAYBACK_ID,r):this.removeAttribute(ae.PLAYBACK_ID))}get customDomain(){var r;return(r=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?r:void 0}set customDomain(r){r!==this.customDomain&&(r?this.setAttribute(ae.CUSTOM_DOMAIN,r):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var r;return(r=this.getAttribute(ae.ENV_KEY))!=null?r:void 0}set envKey(r){r!==this.envKey&&(r?this.setAttribute(ae.ENV_KEY,r):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var r;return(r=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?r:void 0}set beaconCollectionDomain(r){r!==this.beaconCollectionDomain&&(r?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,r):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var r;return(r=this.getAttribute(ae.STREAM_TYPE))!=null?r:void 0}set streamType(r){r!==this.streamType&&(r?this.setAttribute(ae.STREAM_TYPE,r):this.removeAttribute(ae.STREAM_TYPE))}get preferPlayback(){let r=this.getAttribute(ae.PREFER_PLAYBACK);if(r===at.MSE||r===at.NATIVE)return r}set preferPlayback(r){r!==this.preferPlayback&&(r===at.MSE||r===at.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,r):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){let r=this.getAttribute(ae.METADATA_VIDEO_ID),t=this.getAttribute(ae.METADATA_VIDEO_TITLE),e=this.getAttribute(ae.METADATA_VIEWER_USER_ID);return{...this.__metadata,...r!=null?{video_id:r}:{},...t!=null?{video_title:t}:{},...e!=null?{viewer_user_id:e}:{}}}set metadata(r){this.__metadata=r!=null?r:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){this.__core=Eo(this,this.nativeEl,this.__core)}unload(){_a(this.nativeEl,this.__core),this.__core=void 0}attributeChangedCallback(r,t,e){var a,n;switch(super.attributeChangedCallback(r,t,e),r){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=e!=null?e:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=e!=null?e:void 0;break;case"src":{let u=!!t,D=!!e;!u&&D?this.load():u&&!D?this.unload():u&&D&&(this.unload(),this.load());break}case"autoplay":if(e===t)break;(a=this.__core)==null||a.setAutoplay(this.autoplay);break;case"preload":if(e===t)break;(n=this.__core)==null||n.setPreload(e);break;case ae.PLAYBACK_ID:this.src=go(e!=null?e:void 0,{domain:this.customDomain});break;case ae.DEBUG:{let u=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=u);break}case ae.METADATA_URL:e&&fetch(e).then(u=>u.json()).then(u=>this.metadata=u).catch(u=>console.error(`Unable to load or parse metadata JSON from metadata-url ${e}!`));break;default:break}}disconnectedCallback(){this.unload()}};Ot.customElements.get("mux-video")||(Ot.customElements.define("mux-video",xa),Ot.MuxVideoElement=xa);var Mo=xa;var Fd="en",jt={code:Fd};var Ro="en";function be(r,t=!0){var n,u;let e=t&&(u=(n=jt)==null?void 0:n[r])!=null?u:r,a=t?jt.code:Ro;return new Ma(e,a)}var Ma=class{constructor(t,e=(a=>(a=jt.code)!=null?a:Ro)()){this.message=t,this.locale=e}format(t){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var n;return(n=t[a])!=null?n:""})}toString(){return this.message}};function Oo(r){let t="";return Object.entries(r).forEach(([e,a])=>{a!=null&&(t+=`${Bd(e)}: ${a}; `)}),t?t.trim():void 0}function Bd(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Co(r){return r.replace(/[-_]([a-z])/g,(t,e)=>e.toUpperCase())}function bt(r){if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}function Vi(r){let t=Kd(r).toString();return t?"?"+t:""}function Kd(r){let t={};for(let e in r)r[e]!=null&&(t[e]=r[e]);return new URLSearchParams(t)}function Zr(r){let t=(r!=null?r:"").split(".")[1];if(!t)return{};let e=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Ra=(r,t)=>!r||!t?!1:r.contains(t)?!0:Ra(r,t.getRootNode().host);var Oa="mux.com",Wd=()=>{try{return"1.1.3"}catch{}return"UNKNOWN"},Hd=Wd(),Yi=()=>Hd,Ca=(r,{token:t,domain:e=Oa}={})=>`https://stream.${e}/${r}.m3u8${Vi(!!t?{token:t}:{redundant_streams:!0})}`,wo=(r,{token:t,thumbnailTime:e,domain:a=Oa}={})=>{let n=t==null?e:void 0;return`https://image.${a}/${r}/thumbnail.jpg${Vi({token:t,time:n})}`},Uo=(r,{token:t,domain:e=Oa}={})=>`https://image.${e}/${r}/storyboard.vtt${Vi({token:t})}`;function Pa(r){if(r&&/^media-theme-[\w-]+$/.test(r))return r}var jd={crossorigin:"crossOrigin",playsinline:"playsInline"};function No(r){var t;return(t=jd[r])!=null?t:Co(r)}var Fo=r=>{var e,a;let{media:t}=r;return(a=(e=t==null?void 0:t._hls)==null?void 0:e.liveSyncPosition)!=null?a:t!=null&&t.seekable.length?t==null?void 0:t.seekable.end(t.seekable.length-1):void 0},ka=r=>{let t=Fo(r);if(t==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}r.currentTime=t},Gd=1,Vd=5,Po=3,ko=.5,Bo=r=>{var u;let{streamType:t}=r,e=Fo(r),a=(u=r.media)==null?void 0:u.currentTime;if(e==null||a==null)return!1;let n=e-a;return t===pe.LL_LIVE||t===pe.LL_DVR?n<=Gd*(Po+ko):t===pe.LIVE||t===pe.DVR?n<=Vd*(Po+ko):!1},Gt,Vt,tt,$i=class{constructor(t,e){Le(this,Gt,void 0);Le(this,Vt,void 0);Le(this,tt,[]);qe(this,Gt,t),qe(this,Vt,e)}[Symbol.iterator](){return ge(this,tt).values()}get length(){return ge(this,tt).length}get value(){var t;return(t=ge(this,tt).join(" "))!=null?t:""}set value(t){var e;t!==this.value&&(qe(this,tt,[]),this.add(...(e=t==null?void 0:t.split(" "))!=null?e:[]))}toString(){return this.value}item(t){return ge(this,tt)[t]}values(){return ge(this,tt).values()}keys(){return ge(this,tt).keys()}forEach(t){ge(this,tt).forEach(t)}add(...t){var e,a;t.forEach(n=>{this.contains(n)||ge(this,tt).push(n)}),!(this.value===""&&!((e=ge(this,Gt))!=null&&e.hasAttribute(`${ge(this,Vt)}`)))&&((a=ge(this,Gt))==null||a.setAttribute(`${ge(this,Vt)}`,`${this.value}`))}remove(...t){var e;t.forEach(a=>{ge(this,tt).splice(ge(this,tt).indexOf(a),1)}),(e=ge(this,Gt))==null||e.setAttribute(`${ge(this,Vt)}`,`${this.value}`)}contains(t){return ge(this,tt).includes(t)}toggle(t,e){return typeof e!="undefined"?e?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,e){this.remove(t),this.add(e)}};Gt=new WeakMap,Vt=new WeakMap,tt=new WeakMap;var Ko=`[mux-player ${Yi()}]`;function $t(...r){console.warn(Ko,...r)}function ht(...r){console.error(Ko,...r)}function zi(r){var e;let t=(e=r.message)!=null?e:"";if(r.file){let a="https://github.com/muxinc/elements/blob/main/errors/";t+=` ${be("Read more: ")}
|
|
773
|
+
`;var Wi,Qr,Hi,ji,Sa,gr=class extends Ot.HTMLElement{constructor(){super(),De(this,Qr),De(this,ji),De(this,Wi,void 0),this.attachShadow({mode:"open"}),this.isConnected&&$e(this,Qr,Hi).call(this)}static get observedAttributes(){let r=[],t=a=>a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(a=>{let n=!1;try{typeof this.prototype[a]=="function"&&(n=!0)}catch{}!n&&a!==a.toUpperCase()&&r.push(a.toLowerCase(),t(a))});let e=Object.getPrototypeOf(this).observedAttributes;return e&&(r=r.concat(e)),r}attributeChangedCallback(r,t,e){$e(this,Qr,Hi).call(this),$e(this,ji,Sa).call(this,r,t,e)}connectedCallback(){$e(this,Qr,Hi).call(this)}};Wi=new WeakMap,Qr=new WeakSet,Hi=function(){if(ue(this,Wi))return;et(this,Wi,!0),this.shadowRoot.append(Lo.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Ia.forEach(t=>{this.nativeEl.addEventListener(t,e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))})});let r=this.shadowRoot.querySelector("slot");r.addEventListener("slotchange",()=>{r.assignedElements().forEach(t=>{!["track","source"].includes(t.localName)||this.nativeEl.append(t)})}),Array.prototype.forEach.call(this.attributes,t=>{$e(this,ji,Sa).call(this,t.name,null,t.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},ji=new WeakSet,Sa=function(r,t,e){let a=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=kd(a,r),u=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;n&&!u?typeof this[n]=="boolean"?e===null?this[n]=!1:this[n]=!0:this[n]=e:e===null?this.nativeEl.removeAttribute(r):["id","class"].indexOf(r)===-1&&this.nativeEl.setAttribute(r,e)};var Do=[],Io=xo.createElement("video",{is:"castable-video"}),Pd=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let r=Object.getPrototypeOf(Io);r&&r!==Ot.HTMLElement.prototype;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(t=>{Pd.indexOf(t)===-1&&Do.push(t)});Do.forEach(r=>{if(!(r in gr.prototype))if(typeof Io[r]=="function")gr.prototype[r]=function(){return this.nativeEl[r].apply(this.nativeEl,arguments)};else{let t={get(){return this.nativeEl[r]}};r!==r.toUpperCase()&&(t.set=function(e){this.nativeEl[r]=e}),Object.defineProperty(gr.prototype,r,t)}});function kd(r,t){let e=null;return r.forEach(a=>{a.toLowerCase()==t.toLowerCase()&&(e=a)}),e}Ot.customElements.get("custom-video")||(Ot.customElements.define("custom-video",gr),Ot.CustomVideoElement=gr);var Ao=gr,ae={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},wd=Object.values(ae),Ud=Od(),Nd="mux-video",xa=class extends Ao{constructor(){super(),this.__metadata={},this.__playerInitTime=mo()}static get observedAttributes(){var r;return[...wd,...(r=Ao.observedAttributes)!=null?r:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var r;return(r=this.__playerSoftwareName)!=null?r:Nd}set playerSoftwareName(r){this.__playerSoftwareName=r}get playerSoftwareVersion(){var r;return(r=this.__playerSoftwareVersion)!=null?r:Ud}set playerSoftwareVersion(r){this.__playerSoftwareVersion=r}get _hls(){var r;return(r=this.__core)==null?void 0:r.engine}get mux(){return this.nativeEl.mux}get error(){var r;return(r=po(this.nativeEl))!=null?r:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(r){this.__errorTranslator=r}get src(){return this.getAttribute("src")}set src(r){r!==this.src&&(r==null?this.removeAttribute("src"):this.setAttribute("src",r))}get type(){var r;return(r=this.getAttribute(ae.TYPE))!=null?r:void 0}set type(r){r!==this.type&&(r?this.setAttribute(ae.TYPE,r):this.removeAttribute(ae.TYPE))}get autoplay(){let r=this.getAttribute("autoplay");return r===null?!1:r===""?!0:r}set autoplay(r){let t=this.autoplay;r!==t&&(r?this.setAttribute("autoplay",typeof r=="string"?r:""):this.removeAttribute("autoplay"))}get preload(){let r=this.getAttribute("preload");return r===""?"auto":["none","metadata","auto"].includes(r)?r:super.preload}set preload(r){r!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(r)?this.setAttribute("preload",r):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(r){r!==this.debug&&(r?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get startTime(){let r=this.getAttribute(ae.START_TIME);if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}set startTime(r){r!==this.startTime&&(r==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${r}`))}get playbackId(){var r;return(r=this.getAttribute(ae.PLAYBACK_ID))!=null?r:void 0}set playbackId(r){r!==this.playbackId&&(r?this.setAttribute(ae.PLAYBACK_ID,r):this.removeAttribute(ae.PLAYBACK_ID))}get customDomain(){var r;return(r=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?r:void 0}set customDomain(r){r!==this.customDomain&&(r?this.setAttribute(ae.CUSTOM_DOMAIN,r):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var r;return(r=this.getAttribute(ae.ENV_KEY))!=null?r:void 0}set envKey(r){r!==this.envKey&&(r?this.setAttribute(ae.ENV_KEY,r):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var r;return(r=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?r:void 0}set beaconCollectionDomain(r){r!==this.beaconCollectionDomain&&(r?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,r):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var r;return(r=this.getAttribute(ae.STREAM_TYPE))!=null?r:void 0}set streamType(r){r!==this.streamType&&(r?this.setAttribute(ae.STREAM_TYPE,r):this.removeAttribute(ae.STREAM_TYPE))}get preferPlayback(){let r=this.getAttribute(ae.PREFER_PLAYBACK);if(r===at.MSE||r===at.NATIVE)return r}set preferPlayback(r){r!==this.preferPlayback&&(r===at.MSE||r===at.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,r):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){let r=this.getAttribute(ae.METADATA_VIDEO_ID),t=this.getAttribute(ae.METADATA_VIDEO_TITLE),e=this.getAttribute(ae.METADATA_VIEWER_USER_ID);return{...this.__metadata,...r!=null?{video_id:r}:{},...t!=null?{video_title:t}:{},...e!=null?{viewer_user_id:e}:{}}}set metadata(r){this.__metadata=r!=null?r:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){this.__core=Eo(this,this.nativeEl,this.__core)}unload(){_a(this.nativeEl,this.__core),this.__core=void 0}attributeChangedCallback(r,t,e){var a,n;switch(super.attributeChangedCallback(r,t,e),r){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=e!=null?e:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=e!=null?e:void 0;break;case"src":{let u=!!t,D=!!e;!u&&D?this.load():u&&!D?this.unload():u&&D&&(this.unload(),this.load());break}case"autoplay":if(e===t)break;(a=this.__core)==null||a.setAutoplay(this.autoplay);break;case"preload":if(e===t)break;(n=this.__core)==null||n.setPreload(e);break;case ae.PLAYBACK_ID:this.src=go(e!=null?e:void 0,{domain:this.customDomain});break;case ae.DEBUG:{let u=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=u);break}case ae.METADATA_URL:e&&fetch(e).then(u=>u.json()).then(u=>this.metadata=u).catch(u=>console.error(`Unable to load or parse metadata JSON from metadata-url ${e}!`));break;default:break}}disconnectedCallback(){this.unload()}};Ot.customElements.get("mux-video")||(Ot.customElements.define("mux-video",xa),Ot.MuxVideoElement=xa);var Mo=xa;var Fd="en",jt={code:Fd};var Ro="en";function be(r,t=!0){var n,u;let e=t&&(u=(n=jt)==null?void 0:n[r])!=null?u:r,a=t?jt.code:Ro;return new Ma(e,a)}var Ma=class{constructor(t,e=(a=>(a=jt.code)!=null?a:Ro)()){this.message=t,this.locale=e}format(t){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var n;return(n=t[a])!=null?n:""})}toString(){return this.message}};function Oo(r){let t="";return Object.entries(r).forEach(([e,a])=>{a!=null&&(t+=`${Bd(e)}: ${a}; `)}),t?t.trim():void 0}function Bd(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Co(r){return r.replace(/[-_]([a-z])/g,(t,e)=>e.toUpperCase())}function bt(r){if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}function Vi(r){let t=Kd(r).toString();return t?"?"+t:""}function Kd(r){let t={};for(let e in r)r[e]!=null&&(t[e]=r[e]);return new URLSearchParams(t)}function Zr(r){let t=(r!=null?r:"").split(".")[1];if(!t)return{};let e=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Ra=(r,t)=>!r||!t?!1:r.contains(t)?!0:Ra(r,t.getRootNode().host);var Oa="mux.com",Wd=()=>{try{return"1.2.0"}catch{}return"UNKNOWN"},Hd=Wd(),Yi=()=>Hd,Ca=(r,{token:t,domain:e=Oa}={})=>`https://stream.${e}/${r}.m3u8${Vi(!!t?{token:t}:{redundant_streams:!0})}`,wo=(r,{token:t,thumbnailTime:e,domain:a=Oa}={})=>{let n=t==null?e:void 0;return`https://image.${a}/${r}/thumbnail.jpg${Vi({token:t,time:n})}`},Uo=(r,{token:t,domain:e=Oa}={})=>`https://image.${e}/${r}/storyboard.vtt${Vi({token:t})}`;function Pa(r){if(r&&/^media-theme-[\w-]+$/.test(r))return r}var jd={crossorigin:"crossOrigin",playsinline:"playsInline"};function No(r){var t;return(t=jd[r])!=null?t:Co(r)}var Fo=r=>{var e,a;let{media:t}=r;return(a=(e=t==null?void 0:t._hls)==null?void 0:e.liveSyncPosition)!=null?a:t!=null&&t.seekable.length?t==null?void 0:t.seekable.end(t.seekable.length-1):void 0},ka=r=>{let t=Fo(r);if(t==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}r.currentTime=t},Gd=1,Vd=5,Po=3,ko=.5,Bo=r=>{var u;let{streamType:t}=r,e=Fo(r),a=(u=r.media)==null?void 0:u.currentTime;if(e==null||a==null)return!1;let n=e-a;return t===pe.LL_LIVE||t===pe.LL_DVR?n<=Gd*(Po+ko):t===pe.LIVE||t===pe.DVR?n<=Vd*(Po+ko):!1},Gt,Vt,tt,$i=class{constructor(t,e){Le(this,Gt,void 0);Le(this,Vt,void 0);Le(this,tt,[]);qe(this,Gt,t),qe(this,Vt,e)}[Symbol.iterator](){return ge(this,tt).values()}get length(){return ge(this,tt).length}get value(){var t;return(t=ge(this,tt).join(" "))!=null?t:""}set value(t){var e;t!==this.value&&(qe(this,tt,[]),this.add(...(e=t==null?void 0:t.split(" "))!=null?e:[]))}toString(){return this.value}item(t){return ge(this,tt)[t]}values(){return ge(this,tt).values()}keys(){return ge(this,tt).keys()}forEach(t){ge(this,tt).forEach(t)}add(...t){var e,a;t.forEach(n=>{this.contains(n)||ge(this,tt).push(n)}),!(this.value===""&&!((e=ge(this,Gt))!=null&&e.hasAttribute(`${ge(this,Vt)}`)))&&((a=ge(this,Gt))==null||a.setAttribute(`${ge(this,Vt)}`,`${this.value}`))}remove(...t){var e;t.forEach(a=>{ge(this,tt).splice(ge(this,tt).indexOf(a),1)}),(e=ge(this,Gt))==null||e.setAttribute(`${ge(this,Vt)}`,`${this.value}`)}contains(t){return ge(this,tt).includes(t)}toggle(t,e){return typeof e!="undefined"?e?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,e){this.remove(t),this.add(e)}};Gt=new WeakMap,Vt=new WeakMap,tt=new WeakMap;var Ko=`[mux-player ${Yi()}]`;function $t(...r){console.warn(Ko,...r)}function ht(...r){console.error(Ko,...r)}function zi(r){var e;let t=(e=r.message)!=null?e:"";if(r.file){let a="https://github.com/muxinc/elements/blob/main/errors/";t+=` ${be("Read more: ")}
|
|
774
774
|
${a}${r.file}`}$t(t)}var Je={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Yt={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Ho=Object.freeze({length:0,start(r){let t=r>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(r){let t=r>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),$d=Ia.filter(r=>r!=="error"),Yd=Object.values(Je).filter(r=>![Je.PLAYSINLINE].includes(r)),zd=Object.values(Yt);function jo(r){r.querySelectorAll(":scope > track").forEach(t=>{var e;(e=r.media)==null||e.append(t.cloneNode())}),$d.forEach(t=>{var e;(e=r.media)==null||e.addEventListener(t,a=>{r.dispatchEvent(new Event(a.type))})})}var wa=class extends Pe.HTMLElement{static get observedAttributes(){return[...Yd,...zd]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(a=>{var n;(n=this.media)==null||n.append(a.cloneNode())});let t=a=>{for(let n of a)n.type==="childList"&&(n.removedNodes.forEach(u=>{var y,M;let D=(y=this.media)==null?void 0:y.querySelector(`track[src="${u.src}"]`);D&&((M=this.media)==null||M.removeChild(D))}),n.addedNodes.forEach(u=>{var D;(D=this.media)==null||D.append(u.cloneNode())}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(t,e,a){var n,u;switch(t){case Yt.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case Yt.VOLUME:{let D=(n=bt(a))!=null?n:1;this.media&&(this.media.volume=D);return}case Yt.PLAYBACKRATE:{let D=(u=bt(a))!=null?u:1;this.media&&(this.media.playbackRate=D,this.media.defaultPlaybackRate=D);return}}}play(){var t,e;return(e=(t=this.media)==null?void 0:t.play())!=null?e:Promise.reject()}pause(){var t;(t=this.media)==null||t.pause()}requestCast(t){var e;return(e=this.media)==null?void 0:e.requestCast(t)}get media(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("mux-video")}get paused(){var t,e;return(e=(t=this.media)==null?void 0:t.paused)!=null?e:!0}get duration(){var t,e;return(e=(t=this.media)==null?void 0:t.duration)!=null?e:NaN}get ended(){var t,e;return(e=(t=this.media)==null?void 0:t.ended)!=null?e:!1}get buffered(){var t,e;return(e=(t=this.media)==null?void 0:t.buffered)!=null?e:Ho}get seekable(){var t,e;return(e=(t=this.media)==null?void 0:t.seekable)!=null?e:Ho}get readyState(){var t,e;return(e=(t=this.media)==null?void 0:t.readyState)!=null?e:0}get videoWidth(){var t,e;return(e=(t=this.media)==null?void 0:t.videoWidth)!=null?e:0}get videoHeight(){var t,e;return(e=(t=this.media)==null?void 0:t.videoHeight)!=null?e:0}get currentTime(){var t,e;return(e=(t=this.media)==null?void 0:t.currentTime)!=null?e:0}set currentTime(t){this.media&&(this.media.currentTime=Number(t))}get volume(){var t,e;return(e=(t=this.media)==null?void 0:t.volume)!=null?e:1}set volume(t){this.media&&(this.media.volume=Number(t))}get playbackRate(){var t,e;return(e=(t=this.media)==null?void 0:t.playbackRate)!=null?e:1}set playbackRate(t){this.media&&(this.media.playbackRate=Number(t))}get defaultPlaybackRate(){var t;return(t=bt(this.getAttribute(Yt.PLAYBACKRATE)))!=null?t:1}set defaultPlaybackRate(t){t!=null?this.setAttribute(Yt.PLAYBACKRATE,`${t}`):this.removeAttribute(Yt.PLAYBACKRATE)}get crossOrigin(){return Jr(this,Je.CROSSORIGIN)}set crossOrigin(t){this.setAttribute(Je.CROSSORIGIN,`${t}`)}get autoplay(){return Jr(this,Je.AUTOPLAY)!=null}set autoplay(t){t?this.setAttribute(Je.AUTOPLAY,typeof t=="string"?t:""):this.removeAttribute(Je.AUTOPLAY)}get loop(){return Jr(this,Je.LOOP)!=null}set loop(t){t?this.setAttribute(Je.LOOP,""):this.removeAttribute(Je.LOOP)}get muted(){var t,e;return(e=(t=this.media)==null?void 0:t.muted)!=null?e:!1}set muted(t){this.media&&(this.media.muted=Boolean(t))}get defaultMuted(){return Jr(this,Je.MUTED)!=null}set defaultMuted(t){t?this.setAttribute(Je.MUTED,""):this.removeAttribute(Je.MUTED)}get playsInline(){return Jr(this,Je.PLAYSINLINE)!=null}set playsInline(t){ht("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(t){["","none","metadata","auto"].includes(t)?this.setAttribute(Je.PRELOAD,t):this.removeAttribute(Je.PRELOAD)}};function Jr(r,t){return r.media?r.media.getAttribute(t):r.getAttribute(t)}var Ua=wa;var Xi=new Map;function Qi(r){if(Xi.has(r))return Xi.get(r);let t=r.length,e=0,a=0,n=0,u=[];for(let D=0;D<t;D+=1){let y=r[D],M=r[D+1],x=r[D-1];y==="{"&&M==="{"&&x!=="\\"?(n+=1,n===1&&(a=D),D+=1):y==="}"&&M==="}"&&x!=="\\"&&n&&(n-=1,n===0&&(a>e&&(u.push(Object.freeze({type:"string",start:e,end:a,value:r.slice(e,a)})),e=a),u.push(Object.freeze({type:"part",start:a,end:D+2,value:r.slice(e+2,D).trim()})),D+=1,e=D+1))}return e<t&&u.push(Object.freeze({type:"string",start:e,end:t,value:r.slice(e,t)})),Xi.set(r,Object.freeze(u)),Xi.get(r)}var zt=new WeakMap,Go=new WeakMap,dt=class{constructor(t,e){this.expression=e,zt.set(this,t),t.updateParent("")}get attributeName(){return zt.get(this).attr.name}get attributeNamespace(){return zt.get(this).attr.namespaceURI}get value(){return Go.get(this)}set value(t){Go.set(this,t||""),zt.get(this).updateParent(t)}get element(){return zt.get(this).element}get booleanValue(){return zt.get(this).booleanValue}set booleanValue(t){zt.get(this).booleanValue=t}},qr=class{constructor(t,e){this.element=t,this.attr=e,this.partList=[]}get booleanValue(){return this.element.hasAttributeNS(this.attr.namespaceURI,this.attr.name)}set booleanValue(t){if(this.partList.length!==1)throw new DOMException("Operation not supported","NotSupportedError");this.partList[0].value=t?"":null}append(t){this.partList.push(t)}updateParent(t){if(this.partList.length===1&&t===null)this.element.removeAttributeNS(this.attr.namespaceURI,this.attr.name);else{let e=this.partList.map(a=>typeof a=="string"?a:a.value).join("");this.element.setAttributeNS(this.attr.namespaceURI,this.attr.name,e)}}};var Ct=new WeakMap,vt=class{constructor(t,e){this.expression=e,Ct.set(this,[t]),t.textContent=""}get value(){return Ct.get(this).map(t=>t.textContent).join("")}set value(t){this.replace(t)}get previousSibling(){return Ct.get(this)[0].previousSibling}get nextSibling(){return Ct.get(this)[Ct.get(this).length-1].nextSibling}replace(...t){let e=t.map(a=>typeof a=="string"?new Text(a):a);e.length||e.push(new Text("")),Ct.get(this)[0].before(...e);for(let a of Ct.get(this))a.remove();Ct.set(this,e)}};function ei(r){return{processCallback(t,e,a){var n;if(!(typeof a!="object"||!a)){for(let u of e)if(u.expression in a){let D=(n=a[u.expression])!==null&&n!==void 0?n:"";r(u,D)}}}}}function Na(r,t){r.value=String(t)}function Vo(r,t){return typeof t=="boolean"&&r instanceof dt&&typeof r.element[r.attributeName]=="boolean"?(r.booleanValue=t,!0):!1}var Fa=ei(Na),Xd=ei((r,t)=>{Vo(r,t)||Na(r,t)});function*Qd(r){let t=r.ownerDocument.createTreeWalker(r,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null,!1),e;for(;e=t.nextNode();)if(e instanceof Element&&e.hasAttributes())for(let a=0;a<e.attributes.length;a+=1){let n=e.attributes.item(a);if(n&&n.value.includes("{{")){let u=new qr(e,n);for(let D of Qi(n.value))if(D.type==="string")u.append(D.value);else{let y=new dt(u,D.value);u.append(y),yield y}}}else if(e instanceof Text&&e.textContent&&e.textContent.includes("{{")){let a=Qi(e.textContent);for(let n=0;n<a.length;n+=1){let u=a[n];u.end<e.textContent.length&&e.splitText(u.end),u.type==="part"&&(yield new vt(e,u.value));break}}}var Zi=new WeakMap,Ji=new WeakMap,At=class extends DocumentFragment{constructor(t,e,a=Fa){var n,u;super(),Object.getPrototypeOf(this)!==At.prototype&&Object.setPrototypeOf(this,At.prototype),this.appendChild(t.content.cloneNode(!0)),Ji.set(this,Array.from(Qd(this))),Zi.set(this,a),(u=(n=Zi.get(this)).createCallback)===null||u===void 0||u.call(n,this,Ji.get(this),e),Zi.get(this).processCallback(this,Ji.get(this),e)}update(t){Zi.get(this).processCallback(this,Ji.get(this),t)}};var ti=new WeakMap,ri=class{constructor(t,e){this.element=t;this.type=e;this.element.addEventListener(this.type,this);let a=ti.get(this.element);a&&a.set(this.type,this)}set(t){if(typeof t=="function")this.handleEvent=t.bind(this.element);else if(typeof t=="object"&&typeof t.handleEvent=="function")this.handleEvent=t.handleEvent.bind(t);else{this.element.removeEventListener(this.type,this);let e=ti.get(this.element);e&&e.delete(this.type)}}static for(t){ti.has(t.element)||ti.set(t.element,new Map);let e=t.attributeName.slice(2),a=ti.get(t.element);return a&&a.has(e)?a.get(e):new ri(t.element,e)}};function Zd(r,t){return r instanceof dt&&r.attributeName.startsWith("on")?(ri.for(r).set(t),r.element.removeAttributeNS(r.attributeNamespace,r.attributeName),!0):!1}function Jd(r,t){return t instanceof ii&&r instanceof vt?(t.renderInto(r),!0):!1}function qd(r,t){return t instanceof DocumentFragment&&r instanceof vt?(t.childNodes.length&&r.replace(...t.childNodes),!0):!1}function ec(r,t){if(r instanceof dt){let e=r.attributeNamespace,a=r.element.getAttributeNS(e,r.attributeName);return String(t)!==a&&(r.value=String(t)),!0}return r.value=String(t),!0}function tc(r,t){if(typeof t=="boolean"&&r instanceof dt){let e=r.attributeNamespace,a=r.element.hasAttributeNS(e,r.attributeName);return t!==a&&(r.booleanValue=t),!0}return!1}function rc(r,t){return t===!1&&r instanceof vt?(r.replace(""),!0):!1}function ic(r,t){tc(r,t)||Zd(r,t)||rc(r,t)||Jd(r,t)||qd(r,t)||ec(r,t)}var Ba=new WeakMap,$o=new WeakMap,Yo=new WeakMap,ii=class{constructor(t,e,a){this.strings=t;this.values=e;this.processor=a}get template(){if(Ba.has(this.strings))return Ba.get(this.strings);{let t=document.createElement("template"),e=this.strings.length-1;return t.innerHTML=this.strings.reduce((a,n,u)=>a+n+(u<e?`{{ ${u} }}`:""),""),Ba.set(this.strings,t),t}}renderInto(t){let e=this.template;if($o.get(t)!==e){$o.set(t,e);let n=new At(e,this.values,this.processor);Yo.set(t,n),t instanceof vt?t.replace(...n.children):t.appendChild(n);return}let a=Yo.get(t);a&&a.update(this.values)}},zo=new Map,nc=ei(ic);function ce(r,...t){let e=[""],a=[],n,u=!1,D=(y,M=[])=>{e[e.length-1]=e[e.length-1]+y[0],M.forEach((x,A)=>{(n=x==null?void 0:x.$static$)!==void 0?(n.forEach(I=>{D(I.strings,I.values)}),e[e.length-1]=e[e.length-1]+y[A+1],u=!0):(a.push(x),e.push(y[A+1]))})};if(D(r,t),u){let y=e.join("$$html$$");r=zo.get(y),r===void 0&&(e.raw=e,zo.set(y,r=e)),t=a}return new ii(r,t,nc)}function qi(r,t){r.renderInto(t)}function Ye(r,t){let e=document.createElement("template");return e.innerHTML=r,new At(e,t)}var Ka=(...r)=>({$static$:r.map(t=>t instanceof ii?t:/\w-/.test(t)?{strings:[t]}:{strings:[]})});var Qo=`
|
|
775
775
|
:host {
|
|
776
776
|
cursor: pointer;
|
package/dist/mux-player.mjs
CHANGED
|
@@ -770,7 +770,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
770
770
|
</style>
|
|
771
771
|
<video is="castable-video" part="video" crossorigin></video>
|
|
772
772
|
<slot></slot>
|
|
773
|
-
`;var Wi,Qr,Hi,ji,Sa,gr=class extends Ot.HTMLElement{constructor(){super(),De(this,Qr),De(this,ji),De(this,Wi,void 0),this.attachShadow({mode:"open"}),this.isConnected&&$e(this,Qr,Hi).call(this)}static get observedAttributes(){let r=[],t=a=>a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(a=>{let n=!1;try{typeof this.prototype[a]=="function"&&(n=!0)}catch{}!n&&a!==a.toUpperCase()&&r.push(a.toLowerCase(),t(a))});let e=Object.getPrototypeOf(this).observedAttributes;return e&&(r=r.concat(e)),r}attributeChangedCallback(r,t,e){$e(this,Qr,Hi).call(this),$e(this,ji,Sa).call(this,r,t,e)}connectedCallback(){$e(this,Qr,Hi).call(this)}};Wi=new WeakMap,Qr=new WeakSet,Hi=function(){if(ue(this,Wi))return;et(this,Wi,!0),this.shadowRoot.append(Lo.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Ia.forEach(t=>{this.nativeEl.addEventListener(t,e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))})});let r=this.shadowRoot.querySelector("slot");r.addEventListener("slotchange",()=>{r.assignedElements().forEach(t=>{!["track","source"].includes(t.localName)||this.nativeEl.append(t)})}),Array.prototype.forEach.call(this.attributes,t=>{$e(this,ji,Sa).call(this,t.name,null,t.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},ji=new WeakSet,Sa=function(r,t,e){let a=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=kd(a,r),u=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;n&&!u?typeof this[n]=="boolean"?e===null?this[n]=!1:this[n]=!0:this[n]=e:e===null?this.nativeEl.removeAttribute(r):["id","class"].indexOf(r)===-1&&this.nativeEl.setAttribute(r,e)};var Do=[],Io=xo.createElement("video",{is:"castable-video"}),Pd=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let r=Object.getPrototypeOf(Io);r&&r!==Ot.HTMLElement.prototype;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(t=>{Pd.indexOf(t)===-1&&Do.push(t)});Do.forEach(r=>{if(!(r in gr.prototype))if(typeof Io[r]=="function")gr.prototype[r]=function(){return this.nativeEl[r].apply(this.nativeEl,arguments)};else{let t={get(){return this.nativeEl[r]}};r!==r.toUpperCase()&&(t.set=function(e){this.nativeEl[r]=e}),Object.defineProperty(gr.prototype,r,t)}});function kd(r,t){let e=null;return r.forEach(a=>{a.toLowerCase()==t.toLowerCase()&&(e=a)}),e}Ot.customElements.get("custom-video")||(Ot.customElements.define("custom-video",gr),Ot.CustomVideoElement=gr);var Ao=gr,ae={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},wd=Object.values(ae),Ud=Od(),Nd="mux-video",xa=class extends Ao{constructor(){super(),this.__metadata={},this.__playerInitTime=mo()}static get observedAttributes(){var r;return[...wd,...(r=Ao.observedAttributes)!=null?r:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var r;return(r=this.__playerSoftwareName)!=null?r:Nd}set playerSoftwareName(r){this.__playerSoftwareName=r}get playerSoftwareVersion(){var r;return(r=this.__playerSoftwareVersion)!=null?r:Ud}set playerSoftwareVersion(r){this.__playerSoftwareVersion=r}get _hls(){var r;return(r=this.__core)==null?void 0:r.engine}get mux(){return this.nativeEl.mux}get error(){var r;return(r=po(this.nativeEl))!=null?r:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(r){this.__errorTranslator=r}get src(){return this.getAttribute("src")}set src(r){r!==this.src&&(r==null?this.removeAttribute("src"):this.setAttribute("src",r))}get type(){var r;return(r=this.getAttribute(ae.TYPE))!=null?r:void 0}set type(r){r!==this.type&&(r?this.setAttribute(ae.TYPE,r):this.removeAttribute(ae.TYPE))}get autoplay(){let r=this.getAttribute("autoplay");return r===null?!1:r===""?!0:r}set autoplay(r){let t=this.autoplay;r!==t&&(r?this.setAttribute("autoplay",typeof r=="string"?r:""):this.removeAttribute("autoplay"))}get preload(){let r=this.getAttribute("preload");return r===""?"auto":["none","metadata","auto"].includes(r)?r:super.preload}set preload(r){r!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(r)?this.setAttribute("preload",r):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(r){r!==this.debug&&(r?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get startTime(){let r=this.getAttribute(ae.START_TIME);if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}set startTime(r){r!==this.startTime&&(r==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${r}`))}get playbackId(){var r;return(r=this.getAttribute(ae.PLAYBACK_ID))!=null?r:void 0}set playbackId(r){r!==this.playbackId&&(r?this.setAttribute(ae.PLAYBACK_ID,r):this.removeAttribute(ae.PLAYBACK_ID))}get customDomain(){var r;return(r=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?r:void 0}set customDomain(r){r!==this.customDomain&&(r?this.setAttribute(ae.CUSTOM_DOMAIN,r):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var r;return(r=this.getAttribute(ae.ENV_KEY))!=null?r:void 0}set envKey(r){r!==this.envKey&&(r?this.setAttribute(ae.ENV_KEY,r):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var r;return(r=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?r:void 0}set beaconCollectionDomain(r){r!==this.beaconCollectionDomain&&(r?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,r):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var r;return(r=this.getAttribute(ae.STREAM_TYPE))!=null?r:void 0}set streamType(r){r!==this.streamType&&(r?this.setAttribute(ae.STREAM_TYPE,r):this.removeAttribute(ae.STREAM_TYPE))}get preferPlayback(){let r=this.getAttribute(ae.PREFER_PLAYBACK);if(r===at.MSE||r===at.NATIVE)return r}set preferPlayback(r){r!==this.preferPlayback&&(r===at.MSE||r===at.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,r):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){let r=this.getAttribute(ae.METADATA_VIDEO_ID),t=this.getAttribute(ae.METADATA_VIDEO_TITLE),e=this.getAttribute(ae.METADATA_VIEWER_USER_ID);return{...this.__metadata,...r!=null?{video_id:r}:{},...t!=null?{video_title:t}:{},...e!=null?{viewer_user_id:e}:{}}}set metadata(r){this.__metadata=r!=null?r:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){this.__core=Eo(this,this.nativeEl,this.__core)}unload(){_a(this.nativeEl,this.__core),this.__core=void 0}attributeChangedCallback(r,t,e){var a,n;switch(super.attributeChangedCallback(r,t,e),r){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=e!=null?e:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=e!=null?e:void 0;break;case"src":{let u=!!t,D=!!e;!u&&D?this.load():u&&!D?this.unload():u&&D&&(this.unload(),this.load());break}case"autoplay":if(e===t)break;(a=this.__core)==null||a.setAutoplay(this.autoplay);break;case"preload":if(e===t)break;(n=this.__core)==null||n.setPreload(e);break;case ae.PLAYBACK_ID:this.src=go(e!=null?e:void 0,{domain:this.customDomain});break;case ae.DEBUG:{let u=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=u);break}case ae.METADATA_URL:e&&fetch(e).then(u=>u.json()).then(u=>this.metadata=u).catch(u=>console.error(`Unable to load or parse metadata JSON from metadata-url ${e}!`));break;default:break}}disconnectedCallback(){this.unload()}};Ot.customElements.get("mux-video")||(Ot.customElements.define("mux-video",xa),Ot.MuxVideoElement=xa);var Mo=xa;var Fd="en",jt={code:Fd};var Ro="en";function be(r,t=!0){var n,u;let e=t&&(u=(n=jt)==null?void 0:n[r])!=null?u:r,a=t?jt.code:Ro;return new Ma(e,a)}var Ma=class{constructor(t,e=(a=>(a=jt.code)!=null?a:Ro)()){this.message=t,this.locale=e}format(t){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var n;return(n=t[a])!=null?n:""})}toString(){return this.message}};function Oo(r){let t="";return Object.entries(r).forEach(([e,a])=>{a!=null&&(t+=`${Bd(e)}: ${a}; `)}),t?t.trim():void 0}function Bd(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Co(r){return r.replace(/[-_]([a-z])/g,(t,e)=>e.toUpperCase())}function bt(r){if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}function Vi(r){let t=Kd(r).toString();return t?"?"+t:""}function Kd(r){let t={};for(let e in r)r[e]!=null&&(t[e]=r[e]);return new URLSearchParams(t)}function Zr(r){let t=(r!=null?r:"").split(".")[1];if(!t)return{};let e=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Ra=(r,t)=>!r||!t?!1:r.contains(t)?!0:Ra(r,t.getRootNode().host);var Oa="mux.com",Wd=()=>{try{return"1.1.3"}catch{}return"UNKNOWN"},Hd=Wd(),Yi=()=>Hd,Ca=(r,{token:t,domain:e=Oa}={})=>`https://stream.${e}/${r}.m3u8${Vi(!!t?{token:t}:{redundant_streams:!0})}`,wo=(r,{token:t,thumbnailTime:e,domain:a=Oa}={})=>{let n=t==null?e:void 0;return`https://image.${a}/${r}/thumbnail.jpg${Vi({token:t,time:n})}`},Uo=(r,{token:t,domain:e=Oa}={})=>`https://image.${e}/${r}/storyboard.vtt${Vi({token:t})}`;function Pa(r){if(r&&/^media-theme-[\w-]+$/.test(r))return r}var jd={crossorigin:"crossOrigin",playsinline:"playsInline"};function No(r){var t;return(t=jd[r])!=null?t:Co(r)}var Fo=r=>{var e,a;let{media:t}=r;return(a=(e=t==null?void 0:t._hls)==null?void 0:e.liveSyncPosition)!=null?a:t!=null&&t.seekable.length?t==null?void 0:t.seekable.end(t.seekable.length-1):void 0},ka=r=>{let t=Fo(r);if(t==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}r.currentTime=t},Gd=1,Vd=5,Po=3,ko=.5,Bo=r=>{var u;let{streamType:t}=r,e=Fo(r),a=(u=r.media)==null?void 0:u.currentTime;if(e==null||a==null)return!1;let n=e-a;return t===pe.LL_LIVE||t===pe.LL_DVR?n<=Gd*(Po+ko):t===pe.LIVE||t===pe.DVR?n<=Vd*(Po+ko):!1},Gt,Vt,tt,$i=class{constructor(t,e){Le(this,Gt,void 0);Le(this,Vt,void 0);Le(this,tt,[]);qe(this,Gt,t),qe(this,Vt,e)}[Symbol.iterator](){return ge(this,tt).values()}get length(){return ge(this,tt).length}get value(){var t;return(t=ge(this,tt).join(" "))!=null?t:""}set value(t){var e;t!==this.value&&(qe(this,tt,[]),this.add(...(e=t==null?void 0:t.split(" "))!=null?e:[]))}toString(){return this.value}item(t){return ge(this,tt)[t]}values(){return ge(this,tt).values()}keys(){return ge(this,tt).keys()}forEach(t){ge(this,tt).forEach(t)}add(...t){var e,a;t.forEach(n=>{this.contains(n)||ge(this,tt).push(n)}),!(this.value===""&&!((e=ge(this,Gt))!=null&&e.hasAttribute(`${ge(this,Vt)}`)))&&((a=ge(this,Gt))==null||a.setAttribute(`${ge(this,Vt)}`,`${this.value}`))}remove(...t){var e;t.forEach(a=>{ge(this,tt).splice(ge(this,tt).indexOf(a),1)}),(e=ge(this,Gt))==null||e.setAttribute(`${ge(this,Vt)}`,`${this.value}`)}contains(t){return ge(this,tt).includes(t)}toggle(t,e){return typeof e!="undefined"?e?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,e){this.remove(t),this.add(e)}};Gt=new WeakMap,Vt=new WeakMap,tt=new WeakMap;var Ko=`[mux-player ${Yi()}]`;function $t(...r){console.warn(Ko,...r)}function ht(...r){console.error(Ko,...r)}function zi(r){var e;let t=(e=r.message)!=null?e:"";if(r.file){let a="https://github.com/muxinc/elements/blob/main/errors/";t+=` ${be("Read more: ")}
|
|
773
|
+
`;var Wi,Qr,Hi,ji,Sa,gr=class extends Ot.HTMLElement{constructor(){super(),De(this,Qr),De(this,ji),De(this,Wi,void 0),this.attachShadow({mode:"open"}),this.isConnected&&$e(this,Qr,Hi).call(this)}static get observedAttributes(){let r=[],t=a=>a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(a=>{let n=!1;try{typeof this.prototype[a]=="function"&&(n=!0)}catch{}!n&&a!==a.toUpperCase()&&r.push(a.toLowerCase(),t(a))});let e=Object.getPrototypeOf(this).observedAttributes;return e&&(r=r.concat(e)),r}attributeChangedCallback(r,t,e){$e(this,Qr,Hi).call(this),$e(this,ji,Sa).call(this,r,t,e)}connectedCallback(){$e(this,Qr,Hi).call(this)}};Wi=new WeakMap,Qr=new WeakSet,Hi=function(){if(ue(this,Wi))return;et(this,Wi,!0),this.shadowRoot.append(Lo.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),Ia.forEach(t=>{this.nativeEl.addEventListener(t,e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))})});let r=this.shadowRoot.querySelector("slot");r.addEventListener("slotchange",()=>{r.assignedElements().forEach(t=>{!["track","source"].includes(t.localName)||this.nativeEl.append(t)})}),Array.prototype.forEach.call(this.attributes,t=>{$e(this,ji,Sa).call(this,t.name,null,t.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},ji=new WeakSet,Sa=function(r,t,e){let a=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),n=kd(a,r),u=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;n&&!u?typeof this[n]=="boolean"?e===null?this[n]=!1:this[n]=!0:this[n]=e:e===null?this.nativeEl.removeAttribute(r):["id","class"].indexOf(r)===-1&&this.nativeEl.setAttribute(r,e)};var Do=[],Io=xo.createElement("video",{is:"castable-video"}),Pd=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let r=Object.getPrototypeOf(Io);r&&r!==Ot.HTMLElement.prototype;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(t=>{Pd.indexOf(t)===-1&&Do.push(t)});Do.forEach(r=>{if(!(r in gr.prototype))if(typeof Io[r]=="function")gr.prototype[r]=function(){return this.nativeEl[r].apply(this.nativeEl,arguments)};else{let t={get(){return this.nativeEl[r]}};r!==r.toUpperCase()&&(t.set=function(e){this.nativeEl[r]=e}),Object.defineProperty(gr.prototype,r,t)}});function kd(r,t){let e=null;return r.forEach(a=>{a.toLowerCase()==t.toLowerCase()&&(e=a)}),e}Ot.customElements.get("custom-video")||(Ot.customElements.define("custom-video",gr),Ot.CustomVideoElement=gr);var Ao=gr,ae={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},wd=Object.values(ae),Ud=Od(),Nd="mux-video",xa=class extends Ao{constructor(){super(),this.__metadata={},this.__playerInitTime=mo()}static get observedAttributes(){var r;return[...wd,...(r=Ao.observedAttributes)!=null?r:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var r;return(r=this.__playerSoftwareName)!=null?r:Nd}set playerSoftwareName(r){this.__playerSoftwareName=r}get playerSoftwareVersion(){var r;return(r=this.__playerSoftwareVersion)!=null?r:Ud}set playerSoftwareVersion(r){this.__playerSoftwareVersion=r}get _hls(){var r;return(r=this.__core)==null?void 0:r.engine}get mux(){return this.nativeEl.mux}get error(){var r;return(r=po(this.nativeEl))!=null?r:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(r){this.__errorTranslator=r}get src(){return this.getAttribute("src")}set src(r){r!==this.src&&(r==null?this.removeAttribute("src"):this.setAttribute("src",r))}get type(){var r;return(r=this.getAttribute(ae.TYPE))!=null?r:void 0}set type(r){r!==this.type&&(r?this.setAttribute(ae.TYPE,r):this.removeAttribute(ae.TYPE))}get autoplay(){let r=this.getAttribute("autoplay");return r===null?!1:r===""?!0:r}set autoplay(r){let t=this.autoplay;r!==t&&(r?this.setAttribute("autoplay",typeof r=="string"?r:""):this.removeAttribute("autoplay"))}get preload(){let r=this.getAttribute("preload");return r===""?"auto":["none","metadata","auto"].includes(r)?r:super.preload}set preload(r){r!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(r)?this.setAttribute("preload",r):this.removeAttribute("preload"))}get debug(){return this.getAttribute(ae.DEBUG)!=null}set debug(r){r!==this.debug&&(r?this.setAttribute(ae.DEBUG,""):this.removeAttribute(ae.DEBUG))}get startTime(){let r=this.getAttribute(ae.START_TIME);if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}set startTime(r){r!==this.startTime&&(r==null?this.removeAttribute(ae.START_TIME):this.setAttribute(ae.START_TIME,`${r}`))}get playbackId(){var r;return(r=this.getAttribute(ae.PLAYBACK_ID))!=null?r:void 0}set playbackId(r){r!==this.playbackId&&(r?this.setAttribute(ae.PLAYBACK_ID,r):this.removeAttribute(ae.PLAYBACK_ID))}get customDomain(){var r;return(r=this.getAttribute(ae.CUSTOM_DOMAIN))!=null?r:void 0}set customDomain(r){r!==this.customDomain&&(r?this.setAttribute(ae.CUSTOM_DOMAIN,r):this.removeAttribute(ae.CUSTOM_DOMAIN))}get envKey(){var r;return(r=this.getAttribute(ae.ENV_KEY))!=null?r:void 0}set envKey(r){r!==this.envKey&&(r?this.setAttribute(ae.ENV_KEY,r):this.removeAttribute(ae.ENV_KEY))}get beaconCollectionDomain(){var r;return(r=this.getAttribute(ae.BEACON_COLLECTION_DOMAIN))!=null?r:void 0}set beaconCollectionDomain(r){r!==this.beaconCollectionDomain&&(r?this.setAttribute(ae.BEACON_COLLECTION_DOMAIN,r):this.removeAttribute(ae.BEACON_COLLECTION_DOMAIN))}get streamType(){var r;return(r=this.getAttribute(ae.STREAM_TYPE))!=null?r:void 0}set streamType(r){r!==this.streamType&&(r?this.setAttribute(ae.STREAM_TYPE,r):this.removeAttribute(ae.STREAM_TYPE))}get preferPlayback(){let r=this.getAttribute(ae.PREFER_PLAYBACK);if(r===at.MSE||r===at.NATIVE)return r}set preferPlayback(r){r!==this.preferPlayback&&(r===at.MSE||r===at.NATIVE?this.setAttribute(ae.PREFER_PLAYBACK,r):this.removeAttribute(ae.PREFER_PLAYBACK))}get metadata(){let r=this.getAttribute(ae.METADATA_VIDEO_ID),t=this.getAttribute(ae.METADATA_VIDEO_TITLE),e=this.getAttribute(ae.METADATA_VIEWER_USER_ID);return{...this.__metadata,...r!=null?{video_id:r}:{},...t!=null?{video_title:t}:{},...e!=null?{viewer_user_id:e}:{}}}set metadata(r){this.__metadata=r!=null?r:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){this.__core=Eo(this,this.nativeEl,this.__core)}unload(){_a(this.nativeEl,this.__core),this.__core=void 0}attributeChangedCallback(r,t,e){var a,n;switch(super.attributeChangedCallback(r,t,e),r){case ae.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=e!=null?e:void 0;break;case ae.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=e!=null?e:void 0;break;case"src":{let u=!!t,D=!!e;!u&&D?this.load():u&&!D?this.unload():u&&D&&(this.unload(),this.load());break}case"autoplay":if(e===t)break;(a=this.__core)==null||a.setAutoplay(this.autoplay);break;case"preload":if(e===t)break;(n=this.__core)==null||n.setPreload(e);break;case ae.PLAYBACK_ID:this.src=go(e!=null?e:void 0,{domain:this.customDomain});break;case ae.DEBUG:{let u=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=u);break}case ae.METADATA_URL:e&&fetch(e).then(u=>u.json()).then(u=>this.metadata=u).catch(u=>console.error(`Unable to load or parse metadata JSON from metadata-url ${e}!`));break;default:break}}disconnectedCallback(){this.unload()}};Ot.customElements.get("mux-video")||(Ot.customElements.define("mux-video",xa),Ot.MuxVideoElement=xa);var Mo=xa;var Fd="en",jt={code:Fd};var Ro="en";function be(r,t=!0){var n,u;let e=t&&(u=(n=jt)==null?void 0:n[r])!=null?u:r,a=t?jt.code:Ro;return new Ma(e,a)}var Ma=class{constructor(t,e=(a=>(a=jt.code)!=null?a:Ro)()){this.message=t,this.locale=e}format(t){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var n;return(n=t[a])!=null?n:""})}toString(){return this.message}};function Oo(r){let t="";return Object.entries(r).forEach(([e,a])=>{a!=null&&(t+=`${Bd(e)}: ${a}; `)}),t?t.trim():void 0}function Bd(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Co(r){return r.replace(/[-_]([a-z])/g,(t,e)=>e.toUpperCase())}function bt(r){if(r==null)return;let t=+r;return Number.isNaN(t)?void 0:t}function Vi(r){let t=Kd(r).toString();return t?"?"+t:""}function Kd(r){let t={};for(let e in r)r[e]!=null&&(t[e]=r[e]);return new URLSearchParams(t)}function Zr(r){let t=(r!=null?r:"").split(".")[1];if(!t)return{};let e=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(n){return"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Ra=(r,t)=>!r||!t?!1:r.contains(t)?!0:Ra(r,t.getRootNode().host);var Oa="mux.com",Wd=()=>{try{return"1.2.0"}catch{}return"UNKNOWN"},Hd=Wd(),Yi=()=>Hd,Ca=(r,{token:t,domain:e=Oa}={})=>`https://stream.${e}/${r}.m3u8${Vi(!!t?{token:t}:{redundant_streams:!0})}`,wo=(r,{token:t,thumbnailTime:e,domain:a=Oa}={})=>{let n=t==null?e:void 0;return`https://image.${a}/${r}/thumbnail.jpg${Vi({token:t,time:n})}`},Uo=(r,{token:t,domain:e=Oa}={})=>`https://image.${e}/${r}/storyboard.vtt${Vi({token:t})}`;function Pa(r){if(r&&/^media-theme-[\w-]+$/.test(r))return r}var jd={crossorigin:"crossOrigin",playsinline:"playsInline"};function No(r){var t;return(t=jd[r])!=null?t:Co(r)}var Fo=r=>{var e,a;let{media:t}=r;return(a=(e=t==null?void 0:t._hls)==null?void 0:e.liveSyncPosition)!=null?a:t!=null&&t.seekable.length?t==null?void 0:t.seekable.end(t.seekable.length-1):void 0},ka=r=>{let t=Fo(r);if(t==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}r.currentTime=t},Gd=1,Vd=5,Po=3,ko=.5,Bo=r=>{var u;let{streamType:t}=r,e=Fo(r),a=(u=r.media)==null?void 0:u.currentTime;if(e==null||a==null)return!1;let n=e-a;return t===pe.LL_LIVE||t===pe.LL_DVR?n<=Gd*(Po+ko):t===pe.LIVE||t===pe.DVR?n<=Vd*(Po+ko):!1},Gt,Vt,tt,$i=class{constructor(t,e){Le(this,Gt,void 0);Le(this,Vt,void 0);Le(this,tt,[]);qe(this,Gt,t),qe(this,Vt,e)}[Symbol.iterator](){return ge(this,tt).values()}get length(){return ge(this,tt).length}get value(){var t;return(t=ge(this,tt).join(" "))!=null?t:""}set value(t){var e;t!==this.value&&(qe(this,tt,[]),this.add(...(e=t==null?void 0:t.split(" "))!=null?e:[]))}toString(){return this.value}item(t){return ge(this,tt)[t]}values(){return ge(this,tt).values()}keys(){return ge(this,tt).keys()}forEach(t){ge(this,tt).forEach(t)}add(...t){var e,a;t.forEach(n=>{this.contains(n)||ge(this,tt).push(n)}),!(this.value===""&&!((e=ge(this,Gt))!=null&&e.hasAttribute(`${ge(this,Vt)}`)))&&((a=ge(this,Gt))==null||a.setAttribute(`${ge(this,Vt)}`,`${this.value}`))}remove(...t){var e;t.forEach(a=>{ge(this,tt).splice(ge(this,tt).indexOf(a),1)}),(e=ge(this,Gt))==null||e.setAttribute(`${ge(this,Vt)}`,`${this.value}`)}contains(t){return ge(this,tt).includes(t)}toggle(t,e){return typeof e!="undefined"?e?(this.add(t),!0):(this.remove(t),!1):this.contains(t)?(this.remove(t),!1):(this.add(t),!0)}replace(t,e){this.remove(t),this.add(e)}};Gt=new WeakMap,Vt=new WeakMap,tt=new WeakMap;var Ko=`[mux-player ${Yi()}]`;function $t(...r){console.warn(Ko,...r)}function ht(...r){console.error(Ko,...r)}function zi(r){var e;let t=(e=r.message)!=null?e:"";if(r.file){let a="https://github.com/muxinc/elements/blob/main/errors/";t+=` ${be("Read more: ")}
|
|
774
774
|
${a}${r.file}`}$t(t)}var Je={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Yt={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Ho=Object.freeze({length:0,start(r){let t=r>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(r){let t=r>>>0;if(t>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${t}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),$d=Ia.filter(r=>r!=="error"),Yd=Object.values(Je).filter(r=>![Je.PLAYSINLINE].includes(r)),zd=Object.values(Yt);function jo(r){r.querySelectorAll(":scope > track").forEach(t=>{var e;(e=r.media)==null||e.append(t.cloneNode())}),$d.forEach(t=>{var e;(e=r.media)==null||e.addEventListener(t,a=>{r.dispatchEvent(new Event(a.type))})})}var wa=class extends Pe.HTMLElement{static get observedAttributes(){return[...Yd,...zd]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(a=>{var n;(n=this.media)==null||n.append(a.cloneNode())});let t=a=>{for(let n of a)n.type==="childList"&&(n.removedNodes.forEach(u=>{var y,M;let D=(y=this.media)==null?void 0:y.querySelector(`track[src="${u.src}"]`);D&&((M=this.media)==null||M.removeChild(D))}),n.addedNodes.forEach(u=>{var D;(D=this.media)==null||D.append(u.cloneNode())}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(t,e,a){var n,u;switch(t){case Yt.MUTED:{this.media&&(this.media.muted=a!=null,this.media.defaultMuted=a!=null);return}case Yt.VOLUME:{let D=(n=bt(a))!=null?n:1;this.media&&(this.media.volume=D);return}case Yt.PLAYBACKRATE:{let D=(u=bt(a))!=null?u:1;this.media&&(this.media.playbackRate=D,this.media.defaultPlaybackRate=D);return}}}play(){var t,e;return(e=(t=this.media)==null?void 0:t.play())!=null?e:Promise.reject()}pause(){var t;(t=this.media)==null||t.pause()}requestCast(t){var e;return(e=this.media)==null?void 0:e.requestCast(t)}get media(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("mux-video")}get paused(){var t,e;return(e=(t=this.media)==null?void 0:t.paused)!=null?e:!0}get duration(){var t,e;return(e=(t=this.media)==null?void 0:t.duration)!=null?e:NaN}get ended(){var t,e;return(e=(t=this.media)==null?void 0:t.ended)!=null?e:!1}get buffered(){var t,e;return(e=(t=this.media)==null?void 0:t.buffered)!=null?e:Ho}get seekable(){var t,e;return(e=(t=this.media)==null?void 0:t.seekable)!=null?e:Ho}get readyState(){var t,e;return(e=(t=this.media)==null?void 0:t.readyState)!=null?e:0}get videoWidth(){var t,e;return(e=(t=this.media)==null?void 0:t.videoWidth)!=null?e:0}get videoHeight(){var t,e;return(e=(t=this.media)==null?void 0:t.videoHeight)!=null?e:0}get currentTime(){var t,e;return(e=(t=this.media)==null?void 0:t.currentTime)!=null?e:0}set currentTime(t){this.media&&(this.media.currentTime=Number(t))}get volume(){var t,e;return(e=(t=this.media)==null?void 0:t.volume)!=null?e:1}set volume(t){this.media&&(this.media.volume=Number(t))}get playbackRate(){var t,e;return(e=(t=this.media)==null?void 0:t.playbackRate)!=null?e:1}set playbackRate(t){this.media&&(this.media.playbackRate=Number(t))}get defaultPlaybackRate(){var t;return(t=bt(this.getAttribute(Yt.PLAYBACKRATE)))!=null?t:1}set defaultPlaybackRate(t){t!=null?this.setAttribute(Yt.PLAYBACKRATE,`${t}`):this.removeAttribute(Yt.PLAYBACKRATE)}get crossOrigin(){return Jr(this,Je.CROSSORIGIN)}set crossOrigin(t){this.setAttribute(Je.CROSSORIGIN,`${t}`)}get autoplay(){return Jr(this,Je.AUTOPLAY)!=null}set autoplay(t){t?this.setAttribute(Je.AUTOPLAY,typeof t=="string"?t:""):this.removeAttribute(Je.AUTOPLAY)}get loop(){return Jr(this,Je.LOOP)!=null}set loop(t){t?this.setAttribute(Je.LOOP,""):this.removeAttribute(Je.LOOP)}get muted(){var t,e;return(e=(t=this.media)==null?void 0:t.muted)!=null?e:!1}set muted(t){this.media&&(this.media.muted=Boolean(t))}get defaultMuted(){return Jr(this,Je.MUTED)!=null}set defaultMuted(t){t?this.setAttribute(Je.MUTED,""):this.removeAttribute(Je.MUTED)}get playsInline(){return Jr(this,Je.PLAYSINLINE)!=null}set playsInline(t){ht("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(t){["","none","metadata","auto"].includes(t)?this.setAttribute(Je.PRELOAD,t):this.removeAttribute(Je.PRELOAD)}};function Jr(r,t){return r.media?r.media.getAttribute(t):r.getAttribute(t)}var Ua=wa;var Xi=new Map;function Qi(r){if(Xi.has(r))return Xi.get(r);let t=r.length,e=0,a=0,n=0,u=[];for(let D=0;D<t;D+=1){let y=r[D],M=r[D+1],x=r[D-1];y==="{"&&M==="{"&&x!=="\\"?(n+=1,n===1&&(a=D),D+=1):y==="}"&&M==="}"&&x!=="\\"&&n&&(n-=1,n===0&&(a>e&&(u.push(Object.freeze({type:"string",start:e,end:a,value:r.slice(e,a)})),e=a),u.push(Object.freeze({type:"part",start:a,end:D+2,value:r.slice(e+2,D).trim()})),D+=1,e=D+1))}return e<t&&u.push(Object.freeze({type:"string",start:e,end:t,value:r.slice(e,t)})),Xi.set(r,Object.freeze(u)),Xi.get(r)}var zt=new WeakMap,Go=new WeakMap,dt=class{constructor(t,e){this.expression=e,zt.set(this,t),t.updateParent("")}get attributeName(){return zt.get(this).attr.name}get attributeNamespace(){return zt.get(this).attr.namespaceURI}get value(){return Go.get(this)}set value(t){Go.set(this,t||""),zt.get(this).updateParent(t)}get element(){return zt.get(this).element}get booleanValue(){return zt.get(this).booleanValue}set booleanValue(t){zt.get(this).booleanValue=t}},qr=class{constructor(t,e){this.element=t,this.attr=e,this.partList=[]}get booleanValue(){return this.element.hasAttributeNS(this.attr.namespaceURI,this.attr.name)}set booleanValue(t){if(this.partList.length!==1)throw new DOMException("Operation not supported","NotSupportedError");this.partList[0].value=t?"":null}append(t){this.partList.push(t)}updateParent(t){if(this.partList.length===1&&t===null)this.element.removeAttributeNS(this.attr.namespaceURI,this.attr.name);else{let e=this.partList.map(a=>typeof a=="string"?a:a.value).join("");this.element.setAttributeNS(this.attr.namespaceURI,this.attr.name,e)}}};var Ct=new WeakMap,vt=class{constructor(t,e){this.expression=e,Ct.set(this,[t]),t.textContent=""}get value(){return Ct.get(this).map(t=>t.textContent).join("")}set value(t){this.replace(t)}get previousSibling(){return Ct.get(this)[0].previousSibling}get nextSibling(){return Ct.get(this)[Ct.get(this).length-1].nextSibling}replace(...t){let e=t.map(a=>typeof a=="string"?new Text(a):a);e.length||e.push(new Text("")),Ct.get(this)[0].before(...e);for(let a of Ct.get(this))a.remove();Ct.set(this,e)}};function ei(r){return{processCallback(t,e,a){var n;if(!(typeof a!="object"||!a)){for(let u of e)if(u.expression in a){let D=(n=a[u.expression])!==null&&n!==void 0?n:"";r(u,D)}}}}}function Na(r,t){r.value=String(t)}function Vo(r,t){return typeof t=="boolean"&&r instanceof dt&&typeof r.element[r.attributeName]=="boolean"?(r.booleanValue=t,!0):!1}var Fa=ei(Na),Xd=ei((r,t)=>{Vo(r,t)||Na(r,t)});function*Qd(r){let t=r.ownerDocument.createTreeWalker(r,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null,!1),e;for(;e=t.nextNode();)if(e instanceof Element&&e.hasAttributes())for(let a=0;a<e.attributes.length;a+=1){let n=e.attributes.item(a);if(n&&n.value.includes("{{")){let u=new qr(e,n);for(let D of Qi(n.value))if(D.type==="string")u.append(D.value);else{let y=new dt(u,D.value);u.append(y),yield y}}}else if(e instanceof Text&&e.textContent&&e.textContent.includes("{{")){let a=Qi(e.textContent);for(let n=0;n<a.length;n+=1){let u=a[n];u.end<e.textContent.length&&e.splitText(u.end),u.type==="part"&&(yield new vt(e,u.value));break}}}var Zi=new WeakMap,Ji=new WeakMap,At=class extends DocumentFragment{constructor(t,e,a=Fa){var n,u;super(),Object.getPrototypeOf(this)!==At.prototype&&Object.setPrototypeOf(this,At.prototype),this.appendChild(t.content.cloneNode(!0)),Ji.set(this,Array.from(Qd(this))),Zi.set(this,a),(u=(n=Zi.get(this)).createCallback)===null||u===void 0||u.call(n,this,Ji.get(this),e),Zi.get(this).processCallback(this,Ji.get(this),e)}update(t){Zi.get(this).processCallback(this,Ji.get(this),t)}};var ti=new WeakMap,ri=class{constructor(t,e){this.element=t;this.type=e;this.element.addEventListener(this.type,this);let a=ti.get(this.element);a&&a.set(this.type,this)}set(t){if(typeof t=="function")this.handleEvent=t.bind(this.element);else if(typeof t=="object"&&typeof t.handleEvent=="function")this.handleEvent=t.handleEvent.bind(t);else{this.element.removeEventListener(this.type,this);let e=ti.get(this.element);e&&e.delete(this.type)}}static for(t){ti.has(t.element)||ti.set(t.element,new Map);let e=t.attributeName.slice(2),a=ti.get(t.element);return a&&a.has(e)?a.get(e):new ri(t.element,e)}};function Zd(r,t){return r instanceof dt&&r.attributeName.startsWith("on")?(ri.for(r).set(t),r.element.removeAttributeNS(r.attributeNamespace,r.attributeName),!0):!1}function Jd(r,t){return t instanceof ii&&r instanceof vt?(t.renderInto(r),!0):!1}function qd(r,t){return t instanceof DocumentFragment&&r instanceof vt?(t.childNodes.length&&r.replace(...t.childNodes),!0):!1}function ec(r,t){if(r instanceof dt){let e=r.attributeNamespace,a=r.element.getAttributeNS(e,r.attributeName);return String(t)!==a&&(r.value=String(t)),!0}return r.value=String(t),!0}function tc(r,t){if(typeof t=="boolean"&&r instanceof dt){let e=r.attributeNamespace,a=r.element.hasAttributeNS(e,r.attributeName);return t!==a&&(r.booleanValue=t),!0}return!1}function rc(r,t){return t===!1&&r instanceof vt?(r.replace(""),!0):!1}function ic(r,t){tc(r,t)||Zd(r,t)||rc(r,t)||Jd(r,t)||qd(r,t)||ec(r,t)}var Ba=new WeakMap,$o=new WeakMap,Yo=new WeakMap,ii=class{constructor(t,e,a){this.strings=t;this.values=e;this.processor=a}get template(){if(Ba.has(this.strings))return Ba.get(this.strings);{let t=document.createElement("template"),e=this.strings.length-1;return t.innerHTML=this.strings.reduce((a,n,u)=>a+n+(u<e?`{{ ${u} }}`:""),""),Ba.set(this.strings,t),t}}renderInto(t){let e=this.template;if($o.get(t)!==e){$o.set(t,e);let n=new At(e,this.values,this.processor);Yo.set(t,n),t instanceof vt?t.replace(...n.children):t.appendChild(n);return}let a=Yo.get(t);a&&a.update(this.values)}},zo=new Map,nc=ei(ic);function ce(r,...t){let e=[""],a=[],n,u=!1,D=(y,M=[])=>{e[e.length-1]=e[e.length-1]+y[0],M.forEach((x,A)=>{(n=x==null?void 0:x.$static$)!==void 0?(n.forEach(I=>{D(I.strings,I.values)}),e[e.length-1]=e[e.length-1]+y[A+1],u=!0):(a.push(x),e.push(y[A+1]))})};if(D(r,t),u){let y=e.join("$$html$$");r=zo.get(y),r===void 0&&(e.raw=e,zo.set(y,r=e)),t=a}return new ii(r,t,nc)}function qi(r,t){r.renderInto(t)}function Ye(r,t){let e=document.createElement("template");return e.innerHTML=r,new At(e,t)}var Ka=(...r)=>({$static$:r.map(t=>t instanceof ii?t:/\w-/.test(t)?{strings:[t]}:{strings:[]})});var Qo=`
|
|
775
775
|
:host {
|
|
776
776
|
cursor: pointer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mux/mux-player",
|
|
3
|
-
"version": "1.1.3-canary.0-
|
|
3
|
+
"version": "1.1.3-canary.0-ccbd4e6",
|
|
4
4
|
"description": "An open source Mux player web component that Just Works™",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@github/template-parts": "^0.5.3",
|
|
53
|
-
"@mux/mux-audio": "0.7.0-canary.0-
|
|
54
|
-
"@mux/mux-audio-react": "0.5.0-canary.0-
|
|
55
|
-
"@mux/mux-elements-codemod": "1.1.4-canary.0-
|
|
56
|
-
"@mux/mux-uploader-react": "0.1.0-canary.
|
|
57
|
-
"@mux/mux-video": "0.9.2-canary.0-
|
|
58
|
-
"@mux/mux-video-react": "0.6.0-canary.0-
|
|
59
|
-
"@mux/playback-core": "0.9.1-canary.
|
|
53
|
+
"@mux/mux-audio": "0.7.0-canary.0-ccbd4e6",
|
|
54
|
+
"@mux/mux-audio-react": "0.5.0-canary.0-ccbd4e6",
|
|
55
|
+
"@mux/mux-elements-codemod": "1.1.4-canary.0-ccbd4e6",
|
|
56
|
+
"@mux/mux-uploader-react": "0.1.0-canary.114-ccbd4e6",
|
|
57
|
+
"@mux/mux-video": "0.9.2-canary.0-ccbd4e6",
|
|
58
|
+
"@mux/mux-video-react": "0.6.0-canary.0-ccbd4e6",
|
|
59
|
+
"@mux/playback-core": "0.9.1-canary.114-ccbd4e6",
|
|
60
60
|
"media-chrome": "0.14.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|