@srgssr/pillarbox-web 1.15.0 → 1.15.1

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/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Pillarbox Web Player
2
+
3
+ [![Pillarbox logo](docs/README-images/logo.jpg)](https://github.com/SRGSSR/pillarbox-web)
4
+
5
+ ## About
6
+
7
+ The Pillarbox Web Player is a web-based video player that extends Video.js to enable playback of
8
+ SRGSSR content through a custom data provider. This player is designed to enhance the viewing
9
+ experience of SRGSSR content, making it more accessible and feature-rich.
10
+
11
+ ## Quick Start
12
+
13
+ To get started with Pillarbox, install it through the following command:
14
+
15
+ ```bash
16
+ npm install --save @srgssr/pillarbox-web
17
+ ```
18
+
19
+ In your HTML file, add the following code to initialize Pillarbox:
20
+
21
+ ```html
22
+ <video-js id="my-player" class="pillarbox-js" controls></video-js>
23
+ ```
24
+
25
+ Import the CSS file in your HTML to apply Pillarbox default theme:
26
+
27
+ ```html
28
+ <link rel="stylesheet" href="node_modules/@srgssr/pillarbox-web/dist/pillarbox.min.css"/>
29
+ ```
30
+
31
+ Finally, import Pillarbox and set up the player:
32
+
33
+ ```javascript
34
+ import Pillarbox from '@srgssr/pillarbox-web';
35
+
36
+ const player = new Pillarbox('my-player', {/* options... */ });
37
+ player.src({ src: 'urn:swi:video:48115940', type: 'srgssr/urn' });
38
+ ```
39
+
40
+ ## Documentation
41
+
42
+ For detailed information on how to use the Pillarbox Web Player, checkout
43
+ the [API Documentation](https://web.pillarbox.ch/api).
44
+
45
+ A live demo of the player is available
46
+ here: [Pillarbox Web Demo](https://demo.pillarbox.ch).
47
+
48
+ To expand the features that Pillarbox offers out of the box, visit the [Pillarbox Web
49
+ Suite](https://github.com/SRGSSR/pillarbox-web-suite). You are welcome to contribute and share your
50
+ own components there.
51
+
52
+ You can create your own theme with
53
+ the [Pillarbox Theme Editor](https://editor.pillarbox.ch).
54
+
55
+ ## Pillarbox flavours
56
+
57
+ Pillarbox comes in two variants:
58
+
59
+ - `pillarbox-core`: is the core library that provides a rich set of features on top of the Video.js
60
+ API. It does not include any SRGSSR-specific business logic, so it can be used by any developer
61
+ who wants to customize their own video player.
62
+ - `pillarbox` is the complete package that includes the core library as well as the SRGSSR data
63
+ provider and analytics. It is designed for SRGSSR applications that need to integrate with the
64
+ SRGSSR media platform and tracking behavior.
65
+
66
+ ## TypeScript Support
67
+
68
+ TypeScript is a language that extends JavaScript with static types and other features. It helps to
69
+ write more reliable and maintainable code. `Pillarbox` is written in plain JavaScript, but it
70
+ provides type declarations for TypeScript users. These declarations are carefully generated and
71
+ included in the bundled package.
72
+
73
+ ## Contributing
74
+
75
+ If you want to contribute to this project, you are welcome to do so. Please follow the code style
76
+ and linting rules defined in this project. You can use the following commands to check and fix your
77
+ code:
78
+
79
+ Check your javascript code:
80
+
81
+ ```shell
82
+ npm run eslint
83
+ ```
84
+
85
+ Check your CSS and SCSS code:
86
+
87
+ ```shell
88
+ npm run stylelint
89
+ ```
90
+
91
+ Fix your CSS and SCSS code:
92
+
93
+ ```shell
94
+ npm run stylelint:fix
95
+ ```
96
+
97
+ This project also has a pre-commit hook that runs the linting check automatically before you commit
98
+ your changes. You can enable this hook by running the `prepare` script: `npm run prepare`.
99
+
100
+ Before submitting a pull request, please make sure that your code builds successfully. You can use
101
+ the following commands to build the project:
102
+
103
+ ```shell
104
+ npm run build
105
+ ```
106
+
107
+ If you want to enhance our demo application you can get involved
108
+ here: https://github.com/SRGSSR/pillarbox-web-demo
109
+ To contribute to the theme editor go to: https://github.com/SRGSSR/pillarbox-web-theme-editor
110
+
111
+ ## License
112
+
113
+ See the [LICENSE](LICENSE) file for more information.
114
+
115
+ [token-settings]: https://github.com/settings/tokens
116
+
117
+ [token-guide]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token
@@ -3,7 +3,7 @@
3
3
  const videojs = require('video.js');
4
4
  require('videojs-contrib-eme');
5
5
 
6
- const version = "1.14.1";
6
+ const version = "1.15.0";
7
7
 
8
8
  /**
9
9
  * @ignore
@@ -1,7 +1,7 @@
1
1
  import videojs from 'video.js';
2
2
  import 'videojs-contrib-eme';
3
3
 
4
- const version = "1.14.1";
4
+ const version = "1.15.0";
5
5
 
6
6
  /**
7
7
  * @ignore
@@ -109,7 +109,7 @@ function _objectWithoutProperties(source, excluded) {
109
109
  return target;
110
110
  }
111
111
 
112
- const version = "1.14.1";
112
+ const version = "1.15.0";
113
113
 
114
114
  /**
115
115
  * @ignore
@@ -107,7 +107,7 @@ function _objectWithoutProperties(source, excluded) {
107
107
  return target;
108
108
  }
109
109
 
110
- const version = "1.14.1";
110
+ const version = "1.15.0";
111
111
 
112
112
  /**
113
113
  * @ignore
@@ -110,7 +110,7 @@
110
110
  return target;
111
111
  }
112
112
 
113
- const version$8 = "1.14.1";
113
+ const version$8 = "1.15.0";
114
114
 
115
115
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
116
116
 
@@ -31,5 +31,5 @@ const ic=we,sc=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,rc=e=>
31
31
  /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */let t=null;class i{constructor(e){let i,s,r;t||(t=function(){const e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],r=i[4];let n,a,o;const l=[],d=[];let c,u,h,p,m,g;for(n=0;n<256;n++)d[(l[n]=n<<1^283*(n>>7))^n]=n;for(a=o=0;!s[a];a^=c||1,o=d[o]||1)for(p=o^o<<1^o<<2^o<<3^o<<4,p=p>>8^255&p^99,s[a]=p,r[p]=a,h=l[u=l[c=l[a]]],g=16843009*h^65537*u^257*c^16843008*a,m=257*l[p]^16843008*p,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][p]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}()),this._tables=[[t[0][0].slice(),t[0][1].slice(),t[0][2].slice(),t[0][3].slice(),t[0][4].slice()],[t[1][0].slice(),t[1][1].slice(),t[1][2].slice(),t[1][3].slice(),t[1][4].slice()]];const n=this._tables[0][4],a=this._tables[1],o=e.length;let l=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");const d=e.slice(0),c=[];for(this._key=[d,c],i=o;i<4*o+28;i++)r=d[i-1],(i%o==0||8===o&&i%o==4)&&(r=n[r>>>24]<<24^n[r>>16&255]<<16^n[r>>8&255]<<8^n[255&r],i%o==0&&(r=r<<8^r>>>24^l<<24,l=l<<1^283*(l>>7))),d[i]=d[i-o]^r;for(s=0;i;s++,i--)r=d[3&s?i:i-4],c[s]=i<=4||s<4?r:a[0][n[r>>>24]]^a[1][n[r>>16&255]]^a[2][n[r>>8&255]]^a[3][n[255&r]]}decrypt(e,t,i,s,r,n){const a=this._key[1];let o,l,d,c=e^a[0],u=s^a[1],h=i^a[2],p=t^a[3];const m=a.length/4-2;let g,f=4;const y=this._tables[1],_=y[0],v=y[1],b=y[2],T=y[3],S=y[4];for(g=0;g<m;g++)o=_[c>>>24]^v[u>>16&255]^b[h>>8&255]^T[255&p]^a[f],l=_[u>>>24]^v[h>>16&255]^b[p>>8&255]^T[255&c]^a[f+1],d=_[h>>>24]^v[p>>16&255]^b[c>>8&255]^T[255&u]^a[f+2],p=_[p>>>24]^v[c>>16&255]^b[u>>8&255]^T[255&h]^a[f+3],f+=4,c=o,u=l,h=d;for(g=0;g<4;g++)r[(3&-g)+n]=S[c>>>24]<<24^S[u>>16&255]<<16^S[h>>8&255]<<8^S[255&p]^a[f++],o=c,c=u,u=h,h=p,p=o}}class s extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const r=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24};class n{constructor(e,t,i,a){const o=n.STEP,l=new Int32Array(e.buffer),d=new Uint8Array(e.byteLength);let c=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(l.subarray(c,c+o),t,i,d)),c=o;c<l.length;c+=o)i=new Uint32Array([r(l[c-4]),r(l[c-3]),r(l[c-2]),r(l[c-1])]),this.asyncStream_.push(this.decryptChunk_(l.subarray(c,c+o),t,i,d));this.asyncStream_.push((function(){var e;
32
32
  /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */a(null,(e=d).subarray(0,e.byteLength-e[e.byteLength-1]))}))}static get STEP(){return 32e3}decryptChunk_(e,t,s,n){return function(){const a=function(e,t,s){const n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),a=new i(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),l=new Int32Array(o.buffer);let d,c,u,h,p,m,g,f,y;for(d=s[0],c=s[1],u=s[2],h=s[3],y=0;y<n.length;y+=4)p=r(n[y]),m=r(n[y+1]),g=r(n[y+2]),f=r(n[y+3]),a.decrypt(p,m,g,f,l,y),l[y]=r(l[y]^d),l[y+1]=r(l[y+1]^c),l[y+2]=r(l[y+2]^u),l[y+3]=r(l[y+3]^h),d=p,c=m,u=g,h=f;return o}(e,t,s);n.set(a,e.byteOffset)}}}var a,o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};a="undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof self?self:{};var l=a.BigInt||Number;l("0x1"),l("0x100"),l("0x10000"),l("0x1000000"),l("0x100000000"),l("0x10000000000"),l("0x1000000000000"),l("0x100000000000000"),l("0x10000000000000000"),function(){var e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);255===t[0]||t[0]}();const d=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];var r;r=s,("function"===ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t};self.onmessage=function(e){const t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),s=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new n(i,s,r,(function(e,i){self.postMessage(d({source:t.source,decrypted:i}),[i.buffer])}))}})));var Yh=vu(Xh);const Qh=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Jh=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Zh=(e,t)=>{t.activePlaylistLoader=e,e.load()},ep={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:i},excludePlaylist:s}=t,r=i.activeTrack(),n=i.activeGroup(),a=(n.filter((e=>e.default))[0]||n[0]).id,o=i.tracks[a];if(r!==o){Qd.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()}else s({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:i}}=t;Qd.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const s=i.activeTrack();s&&(s.mode="disabled"),i.onTrackChanged()}},tp={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",(()=>{const e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",ep[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",ep[e](e,i))}},ip={AUDIO:(e,t)=>{const{vhs:i,sourceType:s,segmentLoaders:{[e]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:d}},mainPlaylistLoader:c}=t,u=Lc(c.main);a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}},u&&(a[e].main.default.playlists=c.main.playlists));for(const r in a[e]){o[r]||(o[r]=[]);for(const h in a[e][r]){let p,m=a[e][r][h];if(u?(d(`AUDIO group '${r}' label '${h}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===s&&m.playlists?new Kc(m.playlists[0],i,n):m.resolvedUri?new Kc(m.resolvedUri,i,n):m.playlists&&"dash"===s?new fu(m.playlists[0],i,n,c):null,m=nc({id:h,playlistLoader:p},m),tp[e](e,m.playlistLoader,t),o[r].push(m),void 0===l[h]){const e=new Qd.AudioTrack({id:h,kind:Qh(m),enabled:!1,language:m.language,default:m.default,label:h});l[h]=e}}}r.on("error",ep[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:s,sourceType:r,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:d}},mainPlaylistLoader:c}=t;for(const n in o[e]){l[n]||(l[n]=[]);for(const u in o[e][n]){if(!s.options_.useForcedSubtitles&&o[e][n][u].forced)continue;let h,p=o[e][n][u];if("hls"===r)h=new Kc(p.resolvedUri,s,a);else if("dash"===r){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;h=new fu(p.playlists[0],s,a,c)}else"vhs-json"===r&&(h=new Kc(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=nc({id:u,playlistLoader:h},p),tp[e](e,p.playlistLoader,t),l[n].push(p),void 0===d[u]){const e=i.addRemoteTextTrack({id:u,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:u},!1).track;d[u]=e}}}n.on("error",ep[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const t in s[e]){r[t]||(r[t]=[]);for(const a in s[e][t]){const o=s[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const l=i.options_.vhs&&i.options_.vhs.captionServices||{};let d={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[d.instreamId]&&(d=nc(d,l[d.instreamId])),void 0===d.default&&delete d.default,r[t].push(nc({id:a},o)),void 0===n[a]){const e=i.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;n[a]=e}}}}},sp=(e,t)=>{for(let i=0;i<e.length;i++){if(Dc(t,e[i]))return!0;if(e[i].playlists&&sp(e[i].playlists,t))return!0}return!1},rp={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},np=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{ip[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:r,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=((e,t)=>i=>{const{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:r}}}=t,n=s.media();if(!n)return null;let a=null;n.attributes[e]&&(a=r[n.attributes[e]]);const o=Object.keys(r);if(!a)if("AUDIO"===e&&o.length>1&&Lc(t.main))for(let e=0;e<o.length;e++){const t=r[o[e]];if(sp(t,n)){a=t;break}}else r.main?a=r.main:1===o.length&&(a=r[o[0]]);return void 0===i?a:null!==i&&a&&a.filter((e=>e.id===i.id))[0]||null})(i,e),t[i].activeTrack=rp[i](i,e),t[i].onGroupChanged=((e,t)=>()=>{const{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:r}}=t,n=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;a&&l&&a.id===l.id||(r.lastGroup_=a,r.lastTrack_=n,Jh(i,r),a&&!a.isMainPlaylist&&(a.playlistLoader?(i.resyncLoader(),Zh(a.playlistLoader,r)):o&&s.resetEverything()))})(i,e),t[i].onGroupChanging=((e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;s.lastGroup_=null,i.abort(),i.pause()})(i,e),t[i].onTrackChanged=((e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:r},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Jh(s,n),o)){if(o.isMainPlaylist){if(!a||!d||a.id===d.id)return;const e=t.vhs.playlistController_,s=e.selectPlaylist();if(e.media()===s)return;return n.logger_(`track change. Switching main audio from ${d.id} to ${a.id}`),i.pause(),r.resetEverything(),void e.fastQualityChange_(s)}if("AUDIO"===e){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l!==o.playlistLoader?(s.track&&s.track(a),s.resetEverything(),Zh(o.playlistLoader,n)):Zh(o.playlistLoader,n)}})(i,e),t[i].getActiveGroup=((e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null})(i,e)}));const o=t.AUDIO.activeGroup();if(o){const e=(o.filter((e=>e.default))[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged();t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const l=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),s.clearTracks("audio");for(const e in t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[e])};class ap{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=ic(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map((e=>[e.ID,e]))))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class op extends Qd.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new ap,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=rc("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i)return this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),void this.trigger("error");i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=ic(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"))}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i)return this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),void this.dispose();this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},((e,t)=>{if(e){if(410===t.status)return this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i);if(429===t.status){const i=t.responseHeaders["retry-after"];return this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),void this.startTTLTimeout_(parseInt(i,10))}return this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_()}const s=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(s),this.startTTLTimeout_()}))}setProxyServerUrl_(e){const t=new u.URL(e),i=new u.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(u.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new u.URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){const e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(s){const e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,s)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version)return this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),void this.trigger("error");this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(e=>{for(const t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!t(i))return i}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=1e3*e;this.ttlTimeout_=u.setTimeout((()=>{this.requestSteeringManifest()}),t)}clearTTLTimeout_(){u.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new ap}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(ic(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let lp;const dp=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],cp=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]};class up extends Qd.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:s,bandwidth:r,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:c,bufferBasedABR:h,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),lp=n,this.bufferBasedABR=Boolean(h),this.leastPixelDiffSelector=Boolean(p),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:_h,activeTrack:_h,getActiveGroup:_h,onGroupChanged:_h,onTrackChanged:_h,lastTrack_:null,logger_:rc(`MediaGroups[${t}]`)}})),e})(),this.mediaSource=new u.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=ac(),this.hasPlayed_=!1,this.syncController_=new Gh(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Yh,this.sourceUpdater_=new Uh(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Kh,this.keyStatusMap_=new Map;const f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:m,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:c,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new fu(t,this.vhs_,nc(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Kc(t,this.vhs_,nc(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new yh(nc(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new yh(nc(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new jh(nc(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){s.off("vttjserror",r),e()}function r(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",r),s.addWebVttScript_()}))}),e);this.contentSteeringController_=new op(this.vhs_.xhr,(()=>this.mainSegmentLoader_.bandwidth)),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),dp.forEach((e=>{this[e+"_"]=cp.bind(this,e)})),this.logger_=rc("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const s=this.media(),r=s&&(s.id||s.uri),n=e&&(e.id||e.uri);r&&r!==n&&(this.logger_(`switch media ${r} -> ${n} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){const t=(i.length?i[0].playlists:i.playlists).filter((e=>e.attributes.serviceLocation===s));t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}}))}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=u.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(u.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||s.length&&i[s[0]];for(const t in e)if(e[t].default){r={label:t};break}}if(!r)return t;const n=[];for(const t in i)if(i[t][r.label]){const s=i[t][r.label];if(s.playlists&&s.playlists.length)n.push.apply(n,s.playlists);else if(s.uri)n.push(s);else if(e.playlists.length)for(let i=0;i<e.playlists.length;i++){const s=e.playlists[i];s.attributes&&s.attributes.AUDIO&&s.attributes.AUDIO===t&&n.push(s)}}return n.length?n:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Ac(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),np({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(()=>{this.trigger("selectedinitialmedia")}))})),this.mainPlaylistLoader_.on("loadedplaylist",(()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t))return;this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial");if(!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainPlaylistLoader_.on("mediachanging",(()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()})),this.mainPlaylistLoader_.on("mediachange",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Ac(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})})),this.mainPlaylistLoader_.on("playlistunchanged",(()=>{const e=this.mainPlaylistLoader_.media();if("playlist-unchanged"===e.lastExcludeReason_)return;this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))})),this.mainPlaylistLoader_.on("renditiondisabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})})),this.mainPlaylistLoader_.on("renditionenabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let s=!0;const r=Object.keys(i.AUDIO);for(const e in i.AUDIO)for(const t in i.AUDIO[e]){i.AUDIO[e][t].uri||(s=!1)}s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),lp.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!s)return Qd.log.warn("We received no playlist to switch to. Please check your stream."),!1;const d=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return l(`${d} as current playlist is not set`),!0;if(s.id===e.id)return!1;const c=Boolean(cc(t,i).length);if(!e.endList)return c||"number"!=typeof e.partTargetDuration?(l(`${d} as current playlist is live`),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const u=gc(t,i),h=o?yu.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:yu.MAX_BUFFER_LOW_WATER_LINE;if(a<h)return l(`${d} as duration < max low water line (${a} < ${h})`),!0;const p=s.attributes.BANDWIDTH,m=e.attributes.BANDWIDTH;if(p<m&&(!o||u<n)){let e=`${d} as next bandwidth < current bandwidth (${p} < ${m})`;return o&&(e+=` and forwardBuffer < bufferHighWaterLine (${u} < ${n})`),l(e),!0}if((!o||p>m)&&u>=r){let e=`${d} as forwardBuffer >= bufferLowWaterLine (${u} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${d} as no switching criteria met`),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainSegmentLoader_.on("appenderror",(()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("ended",(()=>{this.logger_("main segment loader ended"),this.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}))}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything((()=>{this.tech_.setCurrentTime(this.tech_.currentTime())}))}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let s=i;if(e.start){const r=e.start.timeOffset;s=r<0?Math.max(i+r,t.start(0)):Math.min(i,r)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(e=>{}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=lp.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-s<=lc;const n=r.end(r.length-1);return n-s<=lc&&i-n<=lc}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,r=s.filter(xc),n=1===r.length&&r[0]===e;if(1===s.length&&i!==1/0)return Qd.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){if(this.main().contentSteering){const t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),void setTimeout((()=>{this.contentSteeringController_.addAvailablePathway(t)}),i)}let t=!1;s.forEach((i=>{if(i===e)return;const s=i.excludeUntil;void 0!==s&&s!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(Qd.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;a=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=a,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const o=this.selectPlaylist();if(!o)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const l=t.internal?this.logger_:Qd.log.warn,d=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${d} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const c=o.targetDuration/2*1e3||5e3,u="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=c;return this.switchMedia_(o,"exclude",n||u)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);const r=[];(s||"audio"===e)&&r.push("AUDIO"),(s||"subtitle"===e)&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const s=this[`${t}SegmentLoader_`];!s||e!==t&&"all"!==e||i.push(s)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){const t=cc(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:lp.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const s=this.mainPlaylistLoader_.main,r=lp.Playlist.seekable(t,i,lp.Playlist.liveEdgeDelay(s,t));if(0===r.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=lp.Playlist.seekable(t,i,lp.Playlist.liveEdgeDelay(s,t)),0===e.length)return}let n,a;this.seekable_&&this.seekable_.length&&(n=this.seekable_.end(0),a=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=ac([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===n&&this.seekable_.start(0)===a||(this.logger_(`seekable updated [${hc(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){const e=this.seekable();if(!e.length)return;return void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<e.end(e.length-1))&&this.sourceUpdater_.setDuration(e.end(e.length-1)))}const t=this.tech_.buffered();let i=lp.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{const t=this.mediaTypes_[e].groups;for(const e in t)t[e].forEach((e=>{e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Yu(this.main(),t),s={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||ze}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||ze,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const n={};let a;if(["video","audio"].forEach((function(t){if(s.hasOwnProperty(t)&&(i=e[t].isFmp4,r=s[t],!(i?Ve(r):He(r)))){const i=e[t].isFmp4?"browser":"muxer";n[i]=n[i]||[],n[i].push(s[t]),"audio"===t&&(a=i)}var i,r})),r&&a&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${a} does not support codec(s): "${s.audio}"`)}if(!Object.keys(n).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(qe(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(qe(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return s}{const e=Object.keys(n).reduce(((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${n[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);const r=Yu(this.main,s),n=[];!r.audio||He(r.audio)||Ve(r.audio)||n.push(`audio codec ${r.audio}`),!r.video||He(r.video)||Ve(r.video)||n.push(`video codec ${r.video}`),r.text&&"stpp.ttml.im1t"===r.text&&n.push(`text codec ${r.text}`),n.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${n.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,s=Ku(qe(e)),r=Xu(s),n=s.video&&qe(s.video)[0]||null,a=s.audio&&qe(s.audio)[0]||null;Object.keys(i).forEach((e=>{const s=i[e];if(-1!==t.indexOf(s.id)||s.excludeUntil===1/0)return;t.push(s.id);const o=[],l=Yu(this.mainPlaylistLoader_.main,s),d=Xu(l);if(l.audio||l.video){if(d!==r&&o.push(`codec count "${d}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const e=l.video&&qe(l.video)[0]||null,t=l.audio&&qe(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id}: ${o.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i=0){if(!e.segments)return;let s,r=i;for(let i=0;i<e.segments.length;i++){const n=e.segments[i];if(s||(s=$h(t,r+n.duration/2)),s){if("cueIn"in n){s.endTime=r,s.adEndTime=r,r+=n.duration,s=null;continue}if(r<s.endTime){r+=n.duration;continue}s.endTime+=n.duration}else if("cueOut"in n&&(s=new u.VTTCue(r,r+n.duration,n.cueOut),s.adStartTime=r,s.adEndTime=r+parseFloat(n.cueOut),t.addCue(s)),"cueOutCont"in n){const[e,i]=n.cueOutCont.split("/").map(parseFloat);s=new u.VTTCue(r,r+n.duration,""),s.adStartTime=r-e,s.adEndTime=s.adStartTime+i,t.addCue(s)}r+=n.duration}}(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=yu.GOAL_BUFFER_LENGTH,i=yu.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,yu.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=yu.BUFFER_LOW_WATER_LINE,i=yu.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,yu.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,yu.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return yu.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){lh(this.inbandTextTracks_,"com.apple.streaming",this.tech_),(({inbandTextTracks:e,dateRanges:t})=>{const i=e.metadataTrack_;if(!i)return;const s=u.WebKitDataCue||u.VTTCue;t.forEach((e=>{for(const t of Object.keys(e)){if(oh.has(t))continue;const r=new s(e.startTime,e.endTime,"");r.id=e.id,r.type="com.apple.quicktime.HLS",r.value={key:ah[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(r.value.data=new Uint8Array(r.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(r)}e.processDateRange()}))})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();lh(this.inbandTextTracks_,e,this.tech_),nh({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):this.tech_.one("canplay",(()=>{this.contentSteeringController_.requestSteeringManifest()}))}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",(()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),i=[];for(const s of e.playlists){const e=s.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!(i.length||!t.size)})())&&this.resetContentSteeringController_()}))}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,i=new Set;let s=!1;Object.keys(t).forEach((r=>{const n=t[r],a=this.pathwayAttribute_(n),o=a&&e!==a;n.excludeUntil===1/0&&"content-steering"===n.lastExcludeReason_&&!o&&(delete n.excludeUntil,delete n.lastExcludeReason_,s=!0);const l=!n.excludeUntil&&n.excludeUntil!==1/0;!i.has(n.id)&&o&&l&&(i.add(n.id),n.excludeUntil=1/0,n.lastExcludeReason_="content-steering",this.logger_(`excluding ${n.id} for ${n.lastExcludeReason_}`))})),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach((t=>{const i=this.mediaTypes_[t];if(i.activePlaylistLoader){const t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(s=!0)}})),s&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(const[e,s]of t.entries()){i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(e))}for(const[s,r]of i.entries()){const i=t.get(s);if(i)this.equalPathwayClones_(i,r)||(this.mainPlaylistLoader_.updateOrDeleteClone(r,!0),this.contentSteeringController_.addAvailablePathway(s));else{e.filter((e=>e.attributes["PATHWAY-ID"]===r["BASE-ID"])).forEach((e=>{this.mainPlaylistLoader_.addClonePathway(r,e)})),this.contentSteeringController_.addAvailablePathway(s)}}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const e in i)if(i[e]!==s[e])return!1;for(const e in s)if(i[e]!==s[e])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach((i=>{const s=this.mainPlaylistLoader_.getKeyIdSet(i);s&&s.size&&s.forEach((s=>{const r="usable",n=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===r,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;n?n&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${s} is ${r}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${r}`)),e++)}))})),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach((e=>{const i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,s=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&s&&(delete e.excludeUntil,Qd.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))}))}addKeyStatus_(e,t){const i=("string"==typeof e?e:(e=>{const t=new Uint8Array(e);return Array.from(t).map((e=>e.toString(16).padStart(2,"0"))).join("")})(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${i} added to the keyStatusMap`),this.keyStatusMap_.set(i,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}class hp{constructor(e,t,i){const{playlistController_:s}=e,r=s.fastQualityChange_.bind(s);if(t.attributes){const e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}var n,a,o;this.codecs=Yu(s.main(),t),this.playlist=t,this.id=i,this.enabled=(n=e.playlists,a=t.id,o=r,e=>{const t=n.main.playlists[a],i=Cc(t),s=xc(t);return void 0===e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(o(t),e?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),e)})}}const pp=["seeking","seeked","pause","playing","error"];class mp{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=rc("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}));const l=e=>{["main","audio"].forEach((t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(pp,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(pp,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach((e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&u.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&u.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=u.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[`${e}Buffered_`],s);this[`${e}Buffered_`]=s,r?this.resetSegmentDownloads_(e):(this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:pc(s)}),this[`${e}StalledDownloads_`]<10||(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+lc>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)){i=e.end(e.length-1)}if(this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:lc)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${hc(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const s=this.playlistController_.sourceUpdater_,r=this.tech_.buffered(),n=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-oc),d=[n,a];for(let e=0;e<d.length;e++){if(!d[e])continue;if(gc(d[e],t)<l)return!1}const c=uc(r,t);return 0!==c.length&&(i=c.start(0)+lc,this.logger_(`Buffered region starts (${c.start(0)}) just beyond seek point (${t}). Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=cc(t,e);return i.length&&e+3<=i.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const r=uc(s,t);return r.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+lc;const n=!i.endList,a="number"==typeof i.partTargetDuration;return n&&(a||s)&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let s;if(e.length&&t.length){const r=cc(e,i-3),n=cc(e,i),a=cc(t,i);a.length&&!n.length&&r.length&&(s={start:r.end(0),end:a.end(0)})}else{uc(e,i).length||(s=this.gapFromVideoUnderflow_(e,i))}return!!s&&(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0)}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),s=uc(t,i);this.resetTimeUpdate_(),0!==s.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+oc),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){const i=function(e){if(e.length<2)return ac();const t=[];for(let i=1;i<e.length;i++){const s=e.end(i-1),r=e.start(i);t.push([s,r])}return ac(t)}(e);for(let e=0;e<i.length;e++){const s=i.start(e),r=i.end(e);if(t-s<4&&t-s>2)return{start:s,end:r}}return null}}const gp={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},fp=function(e,t){let i=0,s=0;const r=nc(gp,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const n=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*r.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(r.getSource&&"function"==typeof r.getSource)return i=Date.now(),r.getSource.call(e,a);Qd.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),fp(e,t)}},yp=function(e){fp(this,e)};var _p="3.12.1";const vp={PlaylistLoader:Kc,Playlist:Oc,utils:nu,STANDARD_PLAYLIST_SELECTOR:sh,INITIAL_PLAYLIST_SELECTOR:function(){const e=this.playlists.main.playlists.filter(Oc.isEnabled);eh(e,((e,t)=>th(e,t)));return e.filter((e=>!!Yu(this.playlists.main,e).video))[0]||null},lastBandwidthSelector:sh,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let s=this.useDevicePixelRatio&&u.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),ih(this.playlists.main,t,parseInt(Zu(this.tech_.el(),"width"),10)*s,parseInt(Zu(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:th,comparePlaylistResolution:function(e,t){let i,s;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||u.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(s=t.attributes.RESOLUTION.width),s=s||u.Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s},xhr:Yc()};Object.keys(yu).forEach((e=>{Object.defineProperty(vp,e,{get:()=>(Qd.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),yu[e]),set(t){Qd.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?Qd.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):yu[e]=t}})}));const bp="videojs-vhs",Tp=function(e,t){const i=t.media();let s=-1;for(let t=0;t<e.length;t++)if(e[t].id===i.id){s=t;break}e.selectedIndex_=s,e.trigger({selectedIndex:s,type:"change"})};vp.canPlaySource=function(){return Qd.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Sp=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const r=((e,t)=>e.reduce(((e,i)=>{if(!i.contentProtection)return e;const s=t.reduce(((e,t)=>{const s=i.contentProtection[t];return s&&s.pssh&&(e[t]={pssh:s.pssh}),e}),{});return Object.keys(s).length&&e.push(s),e}),[]))(i?s.concat([i]):s,Object.keys(t)),n=[],a=[];return r.forEach((t=>{a.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),n.push(new Promise(((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?s(e):i()}))})))})),Promise.race([Promise.all(n),Promise.race(a)])},wp=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{const r=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Ku(qe(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);const r=$e(s.video),n=$e(s.audio),a={};for(const i in e)a[i]={},n&&(a[i].audioContentType=n),r&&(a[i].videoContentType=r),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(a[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(a[i].url=e[i]);return nc(e,a)})(t,i,s);return!!r&&(e.currentSource().keySystems=r,!(r&&!e.eme)||(Qd.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},Ep=()=>{if(!u.localStorage)return null;const e=u.localStorage.getItem(bp);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},kp=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},Cp=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},xp=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Ip=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};vp.supportsNativeHls=function(){if(!y||!y.createElement)return!1;const e=y.createElement("video");if(!Qd.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),vp.supportsNativeDash=!!(y&&y.createElement&&Qd.getTech("Html5").isSupported())&&/maybe|probably/i.test(y.createElement("video").canPlayType("application/dash+xml")),vp.supportsTypeNatively=e=>"hls"===e?vp.supportsNativeHls:"dash"===e&&vp.supportsNativeDash,vp.isSupported=function(){return Qd.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},vp.xhr.onRequest=function(e){kp(vp.xhr,e)},vp.xhr.onResponse=function(e){Cp(vp.xhr,e)},vp.xhr.offRequest=function(e){xp(vp.xhr,e)},vp.xhr.offResponse=function(e){Ip(vp.xhr,e)};const Ap=Qd.getComponent("Component");class Dp extends Ap{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=rc("VhsHandler"),t.options_&&t.options_.playerId){const e=Qd.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(y,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=y.fullscreenElement||y.webkitFullscreenElement||y.mozFullScreenElement||y.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),this.on(this.tech_,"error",(function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()})),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=nc(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){const e=Ep();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=yu.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===yu.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;var i;this.setOptions_(),this.options_.src=0===(i=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(i.substring(i.indexOf(",")+1)):i,this.options_.tech=this.tech_,this.options_.externVhs=vp,this.options_.sourceType=Ke(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new up(this.options_);const s=nc({liveRangeSafeTimeDelta:lc},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new mp(s),this.playlistController_.on("error",(()=>{const e=Qd.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const r=this.options_.bufferBasedABR?vp.movingAverageBandwidthSelector(.55):vp.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=vp.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;const t=u.navigator.connection||u.navigator.mozConnection||u.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const s=1e3*t.downlink*1e3;e=s>=i&&e>=i?Math.max(e,s):s}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;t=this.throughput>0?1/this.throughput:0;return Math.floor(1/(e+t))},set(){Qd.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>pc(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>pc(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",(()=>{this.options_.useBandwidthFromLocalStorage&&(e=>{if(!u.localStorage)return!1;let t=Ep();t=t?nc(t,e):e;try{u.localStorage.setItem(bp,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{const t=e.playlistController_.main(),i=Lc(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!Cc(e))).map(((t,i)=>new hp(e,t,t.id))):[]}})),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",(()=>{this.setupEme_()})),this.on(this.playlistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.playlistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=u.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Sp({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then((()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()})).catch((e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3,metadata:{errorType:Qd.Error.EMEKeySessionCreationError}})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=wp({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",(e=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),t?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=Qd.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{!function(e,t){t.representations().forEach((t=>{e.addQualityLevel(t)})),Tp(e,t.playlists)}(this.qualityLevels_,this)})),this.playlists.on("mediachange",(()=>{Tp(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":_p,"mux.js":"7.0.3","mpd-parser":"1.3.0","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return Uh.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&u.URL.revokeObjectURL&&(u.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return au({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return ou({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{kp(this.xhr,e)},this.xhr.onResponse=e=>{Cp(this.xhr,e)},this.xhr.offRequest=e=>{xp(this.xhr,e)},this.xhr.offResponse=e=>{Ip(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const Pp={name:"videojs-http-streaming",VERSION:_p,canHandleSource(e,t={}){const i=nc(Qd.options,t);return Pp.canPlayType(e.type,i)},handleSource(e,t,i={}){const s=nc(Qd.options,i);return t.vhs=new Dp(e,t,s),t.vhs.xhr=Yc(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=Ke(e);if(!i)return"";const s=Pp.getOverrideNative(t);return!vp.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(Qd.browser.IS_ANY_SAFARI||Qd.browser.IS_IOS),{overrideNative:s=i}=t;return s}};
33
33
  /*! @name videojs-contrib-eme @version 3.11.2 @license Apache-2.0 */
34
- function Lp(){return Lp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},Lp.apply(this,arguments)}Ve("avc1.4d400d,mp4a.40.2")&&Qd.getTech("Html5").registerSourceHandler(Pp,0),Qd.VhsHandler=Dp,Qd.VhsSourceHandler=Pp,Qd.Vhs=vp,Qd.use||Qd.registerComponent("Vhs",vp),Qd.options.vhs=Qd.options.vhs||{},Qd.getPlugin&&Qd.getPlugin("reloadSourceOnError")||Qd.registerPlugin("reloadSourceOnError",yp);var Op=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var i=new DataView(e),s=new DataView(t),r=0;r<i.byteLength;r++)if(i.getUint8(r)!==s.getUint8(r))return!1;return!0},Rp=function(e){return e instanceof Uint8Array||e instanceof Uint16Array?e.buffer:e},Mp=function(){for(var e=Qd.obj||Qd,t=e.merge||e.mergeOptions,i=arguments.length,s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];return t.apply(e,s)},Np=function(){var e=Mp.apply(void 0,arguments);return Object.keys(e).forEach((function(t){null===e[t]&&delete e[t]})),e},Up=Qd.xhr.httpHandler;Up||(Up=function(e,t){return function(i,s,r){if(i)e(i);else{if(s.statusCode>=400&&s.statusCode<=599){var n=r;return t&&(n=String.fromCharCode.apply(null,new Uint8Array(r))),void e({cause:n})}e(null,r)}}});var Bp=function(e,t,i,s){var r=function(e){var t=String.fromCharCode.apply(null,new Uint16Array(e)),i=(new u.DOMParser).parseFromString(t,"application/xml"),s=i.getElementsByTagName("HttpHeaders")[0],r={};if(s)for(var n=s.getElementsByTagName("name"),a=s.getElementsByTagName("value"),o=0;o<n.length;o++)r[n[o].childNodes[0].nodeValue]=a[o].childNodes[0].nodeValue;var l,d=i.getElementsByTagName("Challenge")[0];return d&&(l=u.atob(d.childNodes[0].nodeValue)),i.querySelector("parsererror")&&(r={"Content-Type":"text/xml; charset=utf-8",SOAPAction:'"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"'},l=e),{headers:r,message:l}}(t),n=r.message,a=Np(r.headers,i.emeHeaders,e.licenseHeaders);Qd.xhr({uri:e.url,method:"post",headers:a,body:n,responseType:"arraybuffer"},Up(s,!0))},Fp=function(e){var t;return Object.keys(e).forEach((function(i){var s=function(e){if(e.supportedConfigurations)return e.supportedConfigurations;var t={},i=e.audioContentType,s=e.audioRobustness,r=e.videoContentType,n=e.videoRobustness,a=e.persistentState;return(i||s)&&(t.audioCapabilities=[Lp({},i?{contentType:i}:{},s?{robustness:s}:{})]),(r||n)&&(t.videoCapabilities=[Lp({},r?{contentType:r}:{},n?{robustness:n}:{})]),a&&(t.persistentState=a),[t]}(e[i]);t=t?t.catch((function(e){return u.navigator.requestMediaKeySystemAccess(i,s)})):u.navigator.requestMediaKeySystemAccess(i,s)})),t},qp=function e(t,i){var s=i.mediaKeys,r=i.initDataType,n=i.initData,a=i.options,o=i.getLicense,l=i.removeSession,d=i.eventBus,c=s.createSession();return d.trigger("keysessioncreated"),t.on("dispose",(function(){c.close()})),new Promise((function(s,u){c.addEventListener("message",(function(e){"license-request"!==e.messageType&&"license-renewal"!==e.messageType||o(a,e.message).then((function(e){s(c.update(e))})).catch((function(e){u(e)}))}),!1),c.addEventListener("keystatuseschange",(function(s){var r=!1;c.keyStatuses.forEach((function(e,t){switch(d.trigger({keyId:t,status:e,target:c,type:"keystatuschange"}),e){case"expired":r=!0;break;case"internal-error":Qd.log.warn('Key status reported as "internal-error." Leaving the session open since we don\'t have enough details to know if this error is fatal.',s)}})),r&&c.close().then((function(){l(n),e(t,i)}))}),!1),c.generateRequest(r,n).catch((function(){u("Unable to create or initialize key session")}))}))},jp=function(e,t){return function(i,s){return new Promise((function(r,n){e(i,s,(function(e,i){t&&t.trigger("licenserequestattempted"),e?n(e):r(i)}))}))}},$p=function(e,t){if("string"==typeof t&&(t={url:t}),!t.url&&!t.getLicense)throw new Error("Neither URL nor getLicense function provided to get license");return t.url&&!t.getLicense&&(t.getLicense="com.microsoft.playready"===e?function(e){return function(t,i,s){Bp(e,i,t,s)}}(t):function(e){return function(t,i,s){var r=Np({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Qd.xhr({uri:e.url,method:"POST",responseType:"arraybuffer",body:i,headers:r},Up(s,!0))}}(t)),t},Vp=function(e){var t,i,s=e.player,r=e.video,n=e.initDataType,a=e.initData,o=e.keySystemAccess,l=e.options,d=e.removeSession,c=e.eventBus,u=Promise.resolve();void 0===r.mediaKeysObject&&(r.mediaKeysObject=null,r.pendingSessionData=[],u=new Promise((function(e,s){r.keySystem=o.keySystem,(i=$p(o.keySystem,l.keySystems[o.keySystem])).getCertificate?i.getCertificate(l,(function(i,r){i?s(i):(t=r,e())})):e(o)})).then((function(){return o.createMediaKeys()})).then((function(e){return function(e){var t=e.player,i=e.video,s=e.certificate,r=e.createdMediaKeys;i.mediaKeysObject=r;var n=[];s&&n.push(r.setServerCertificate(s));for(var a=0;a<i.pendingSessionData.length;a++){var o=i.pendingSessionData[a];n.push(qp(t,{mediaKeys:i.mediaKeysObject,initDataType:o.initDataType,initData:o.initData,options:o.options,getLicense:o.getLicense,removeSession:o.removeSession,eventBus:o.eventBus}))}return i.pendingSessionData=[],n.push(i.setMediaKeys(r)),Promise.all(n)}({player:s,video:r,certificate:t,createdMediaKeys:e})})).catch((function(e){return e?Promise.reject(e):Promise.reject("Failed to create and initialize a MediaKeys object")})));return u.then((function(){var e=$p(r.keySystem,l.keySystems[r.keySystem]).getLicense;return function(e){var t=e.player,i=e.video,s=e.initDataType,r=e.initData,n=e.options,a=e.getLicense,o=e.removeSession,l=e.eventBus;return i.mediaKeysObject?qp(t,{mediaKeys:i.mediaKeysObject,initDataType:s,initData:r,options:n,getLicense:a,removeSession:o,eventBus:l}):(i.pendingSessionData.push({initDataType:s,initData:r,options:n,getLicense:a,removeSession:o,eventBus:l}),Promise.resolve())}({player:s,video:r,initDataType:n,initData:a,options:l,getLicense:r.keySystem?jp(e,c):null,removeSession:d,eventBus:c})}))},Hp="com.apple.fps.1_0",zp=function(e){var t=e.initData,i=e.id,s=e.cert;"string"==typeof i&&(i=function(e){for(var t=new ArrayBuffer(2*e.length),i=new Uint16Array(t),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i}(i));var r=0,n=new ArrayBuffer(t.byteLength+4+i.byteLength+4+s.byteLength),a=new DataView(n);new Uint8Array(n,r,t.byteLength).set(t),r+=t.byteLength,a.setUint32(r,i.byteLength,!0),r+=4;var o=new Uint16Array(n,r,i.length);return o.set(i),r+=o.byteLength,a.setUint32(r,s.byteLength,!0),r+=4,new Uint8Array(n,r,s.byteLength).set(s),new Uint8Array(n,0,n.byteLength)},Wp=function(e,t){return r=t,i=String.fromCharCode.apply(null,new Uint16Array(r.buffer)),(s=y.createElement("a")).href=i,s.hostname;var i,s,r},Gp=function(e){var t=e.video,i=e.initData,s=e.options,r=e.eventBus,n=s.keySystems[Hp],a=n.getCertificate||function(e){return function(t,i){var s=Np(t.emeHeaders,e.certificateHeaders);Qd.xhr({uri:e.certificateUri,responseType:"arraybuffer",headers:s},Up((function(e,t){e?i(e):i(null,new Uint8Array(t))})))}}(n),o=n.getContentId||Wp,l=n.getLicense||function(e){return function(t,i,s,r){var n=Np({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Qd.xhr({uri:e.licenseUri,method:"POST",responseType:"arraybuffer",body:s,headers:n},Up(r,!0))}}(n);return new Promise((function(e,t){a(s,(function(i,s){i?t(i):e(s)}))})).then((function(e){return function(e){var t=e.video,i=e.contentId,s=e.initData,r=e.cert,n=e.options,a=e.getLicense,o=e.eventBus;return new Promise((function(e,l){if(!t.webkitKeys)try{t.webkitSetMediaKeys(new u.WebKitMediaKeys(Hp))}catch(e){return void l("Could not create MediaKeys")}var d;try{d=t.webkitKeys.createSession("video/mp4",zp({id:i,initData:s,cert:r}))}catch(e){return void l("Could not create key session")}o.trigger("keysessioncreated"),d.contentId=i,d.addEventListener("webkitkeymessage",(function(e){a(n,i,e.message,(function(e,t){o&&o.trigger("licenserequestattempted"),e?l(e):d.update(new Uint8Array(t))}))})),d.addEventListener("webkitkeyadded",(function(){e()})),d.addEventListener("webkitkeyerror",(function(){var e=d.error;l("KeySession error: code "+e.code+", systemCode "+e.systemCode)}))}))}({video:t,cert:e,initData:i,getLicense:l,options:s,contentId:o(s,i),eventBus:r})}))},Kp="com.microsoft.playready",Xp=function(e,t,i,s){var r=e.msKeys.createSession("video/mp4",t);if(!r)throw new Error("Could not create key session.");s.trigger("keysessioncreated"),r.addEventListener("mskeymessage",(function(e){!function(e,t,i,s){var r=e.keySystems[Kp];if("function"!=typeof r.getKey){"string"==typeof r?r={url:r}:"boolean"==typeof r&&(r={}),r.url||(r.url=i.destinationURL);var n=function(e,i){s&&s.trigger("licenserequestattempted"),e?s.trigger({message:"Unable to request key from url: "+r.url,target:t,type:"mskeyerror"}):t.update(new Uint8Array(i))};r.getLicense?r.getLicense(e,i.message.buffer,n):Bp(r,i.message.buffer,e,n)}else r.getKey(e,i.destinationURL,i.message.buffer,(function(e,i){e?s.trigger({message:"Unable to get key: "+e,target:t,type:"mskeyerror"}):t.update(i)}))}(i,r,e,s)})),r.addEventListener("mskeyerror",(function(e){s.trigger({message:"Unexpected key error from key session with code: "+r.error.code+" and systemCode: "+r.error.systemCode,target:r,type:"mskeyerror"})})),r.addEventListener("mskeyadded",(function(){s.trigger({target:r,type:"mskeyadded"})}))},Yp=function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData===t)return void e.splice(i,1)},Qp=function(e,t,i,s,r){if(!i||!i.keySystems)return Promise.resolve();var n=t.initData;return Fp(i.keySystems).then((function(a){var o=a.keySystem;return i.keySystems[o]&&i.keySystems[o].pssh&&(n=i.keySystems[o].pssh),function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData){var s=Rp(e[i].initData),r=Rp(t);if(Op(s,r))return!0}return!1}(s,n)||!n?Promise.resolve():(s.push({initData:n}),Vp({player:e,video:t.target,initDataType:t.initDataType,initData:n,keySystemAccess:a,options:i,removeSession:Yp.bind(null,s),eventBus:r}))}))},Jp=function(e,t,i,s){if(t.keySystems&&t.keySystems[Kp]&&!i.reduce((function(e,t){return e||t.playready}),!1)){var r=e.initData;t.keySystems[Kp]&&t.keySystems[Kp].pssh&&(r=t.keySystems[Kp].pssh),r&&(i.push({playready:!0,initData:r}),function(e){var t=e.video,i=e.initData,s=e.options,r=e.eventBus;t.msKeys&&delete t.msKeys;try{t.msSetMediaKeys(new u.MSMediaKeys(Kp))}catch(e){throw new Error("Unable to create media keys for PlayReady key system. Error: "+e.message)}Xp(t,i,s,r)}({video:e.target,initData:r,options:t,eventBus:s}))}},Zp=function(e){return Mp(e.currentSource(),e.eme.options)},em=function(e){var t=e.src();t!==e.eme.activeSrc&&(e.eme.activeSrc=t,e.eme.sessions=[])},tm=function(e,t){if("video"===e.$(".vjs-tech").tagName.toLowerCase())if(em(e),u.WebKitMediaKeys){var i=function(i){em(e),function(e,t,i){return t.keySystems&&t.keySystems[Hp]&&e.initData?Gp({video:e.target,initData:e.initData,options:t,eventBus:i}):Promise.resolve()}(i,Zp(e),e.tech_).catch(t)};e.tech_.el_.addEventListener("webkitneedkey",(function(t){var s=Zp(e).firstWebkitneedkeyTimeout||1e3,r=e.src();e.eme.webkitneedkey_=e.eme.webkitneedkey_||{},e.eme.webkitneedkey_.src!==r&&(e.eme.webkitneedkey_={handledFirstEvent:!1,src:r}),e.eme.webkitneedkey_.handledFirstEvent?i(t):(e.clearTimeout(e.eme.webkitneedkey_.timeout),e.eme.webkitneedkey_.timeout=e.setTimeout((function(){e.eme.webkitneedkey_.handledFirstEvent=!0,e.eme.webkitneedkey_.timeout=null,i(t)}),s))}))}else u.MediaKeys?e.tech_.el_.addEventListener("encrypted",(function(i){em(e),Qp(e,i,Zp(e),e.eme.sessions,e.tech_).catch(t)})):u.MSMediaKeys&&(e.tech_.el_.addEventListener("msneedkey",(function(i){em(e);try{Jp(i,Zp(e),e.eme.sessions,e.tech_)}catch(e){t(e)}})),e.tech_.on("mskeyerror",t),e.on("dispose",(function(){e.tech_.off("mskeyerror",t)})))},im=function(e){void 0===e&&(e={});var t=this,i=function(e){return function(t){var i={code:5};"string"==typeof t?i.message=t:t&&(t.message&&(i.message=t.message),t.cause&&(t.cause.length||t.cause.byteLength)&&(i.cause=t.cause)),e.error(i)}}(t);t.ready((function(){return tm(t,i)})),t.eme={initializeMediaKeys:function(s,r,n){void 0===s&&(s={}),void 0===r&&(r=function(){}),void 0===n&&(n=!1);var a=Mp(t.currentSource(),e,s),o={initDataType:"cenc",initData:null,target:t.tech_.el_};if(em(t),t.tech_.el_.setMediaKeys)Qp(t,o,a,t.eme.sessions,t.tech_).then((function(){return r()})).catch((function(e){r(e),n||i(e)}));else if(t.tech_.el_.msSetMediaKeys){var l=function e(s){t.tech_.off("mskeyadded",e),t.tech_.off("mskeyerror",e),"mskeyerror"===s.type?(r(s.target.error),n||i(s.message)):r()};t.tech_.one("mskeyadded",l),t.tech_.one("mskeyerror",l);try{Jp(o,a,t.eme.sessions,t.tech_)}catch(e){t.tech_.off("mskeyadded",l),t.tech_.off("mskeyerror",l),r(e),n||i(e)}}},options:e}};Qd.registerPlugin("eme",im),im.VERSION="3.11.2";const sm=Qd.getComponent("player");Qd.registerComponent("player",class extends sm{constructor(e,t,i){super(e,t=Qd.obj.merge(t,{plugins:{eme:!0}}),i)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:i,language:s}=e,r=t.find((e=>e.language===s&&e.kind===i))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const i=this.buffered().start(t),s=this.buffered().end(t);e.push({start:i,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const i=this.played().start(t),s=this.played().end(t);e.push({start:i,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const i=this.seekable().start(t),s=this.seekable().end(t);e.push({start:i,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:i,language:s}=e;return t.find((e=>(e.language===s&&e.kind===i&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const rm=Qd;rm.VERSION={pillarbox:"1.14.1",videojs:Qd.VERSION,[Qd.VhsSourceHandler.name]:Qd.VhsSourceHandler.VERSION,eme:Qd.getPlugin("eme").VERSION},rm.options.enableSmoothSeeking=!0,rm.options.fill=!0,rm.options.html5={vhs:{useForcedSubtitles:!0}},rm.options.liveTracker={trackingThreshold:120,liveTolerance:15},rm.options.liveui=!0,rm.options.playsinline=!0,rm.options.responsive=!0,rm.options.trackers={};class nm{constructor(e="il.srgssr.ch"){this.setIlHost(e)}setIlHost(e){this.baseUrl=`${e}/integrationlayer/2.1/`}handleRequest(e){var t=this;return function(){var i=r((function*(i){const s="function"==typeof e?e(i):t.mediaCompositionUrlHandler(i),r=yield fetch(s);if(!r.ok)throw r;return yield r.json()}));return function(e){return i.apply(this,arguments)}}()}mediaCompositionUrlHandler(e){return`https://${this.baseUrl}mediaComposition/byUrn/${e}?onlyChapters=true&vector=portalplay`}}const am="240",om="320",lm="480",dm="960",cm="1920",um="jpg",hm="webp",pm="png";class mm{static scale({url:e,width:t=dm,format:i=um}={},s="https://il.srgssr.ch/images/"){if(!e)return;const r=new URL(s);return r.searchParams.set("imageUrl",e),r.searchParams.set("format",i),r.searchParams.set("width",t),decodeURIComponent(r.href)}static get JPG(){return um}static get PNG(){return pm}static get WEBP(){return hm}static get WIDTH_240(){return am}static get WIDTH_320(){return om}static get WIDTH_480(){return lm}static get WIDTH_960(){return dm}static get WIDTH_1920(){return cm}}const gm={WIDEVINE:"com.widevine.alpha",FAIRPLAY:"com.apple.fps.1_0",PLAYREADY:"com.microsoft.playready"};class fm{static buildKeySystems(e=[]){const t={};return e.forEach((e=>{const i=fm.vendors[e.type];if(fm.vendors.FAIRPLAY===i){const{certificateUrl:s,licenseUrl:r}=e;t[i]={certificateUri:s,licenseUri:r}}else t[i]=e.licenseUrl})),{keySystems:t}}static hasDrm(e){return e.some((({drmList:e})=>e&&e.length>0))}static get vendors(){return gm}}const ym="AKAMAI",_m="NONE";class vm{static aclPath(e){const t=e.pathname;return`${t.substring(0,t.lastIndexOf("/")+1)}*`}static get AKAMAI(){return ym}static hasToken(e){return e.some((e=>vm.isAkamai(e.tokenType)))}static isAkamai(e){return ym===e}static isNone(e){return _m===e}static get NONE(){return _m}static tokenize(e,t){const i=new URL(`${e.url}`),s=vm.aclPath(i),r=`${t}${encodeURIComponent(s)}`;return fetch(r).then((e=>e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText}))).then((({token:{authparams:t}})=>(new URLSearchParams(t).forEach(((e,t)=>i.searchParams.set(t,e))),Object.assign({},e,{url:i.toString()})))).catch((e=>Promise.reject(e)))}static tokenizeSources(e,t="https://tp.srgssr.ch/akahd/token?acl="){const i=[];return e.forEach((e=>{const s=vm.tokenize(e,t);i.push(s)})),Promise.all(i).then((e=>e)).catch((e=>Promise.reject(e)))}}const bm="emptied",Tm="ended",Sm="loadeddata",wm="loadstart",Em="pause",km="play",Cm="playing",xm="ratechange",Im="seeking",Am="timeupdate",Dm="waiting";class Pm{constructor(e,{debug:t=!1,environment:i="prod",playerVersion:s="none",tagCommanderScriptURL:r="//colibri-js.akamaized.net/penguin/tc_SRGGD_11.js"}={}){this.isDebugEnabled=t,this.elapsedPlaybackTime=0,this.environment=i,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isSeeking=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.pendingTagCommanderReload=!1,this.player=e,this.playerVersion=s,this.srcMediaData=void 0,this.startPlaybackSession=0,this.tagCommanderScriptURL=r,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0,this.initScript(),this.initListeners()}beforeunload(){this.notify("stop")}clearTimers(){clearInterval(this.heartBeatIntervalId),clearInterval(this.uptimeIntervalId),clearTimeout(this.uptimeTimeoutId)}currentTime(){return Math.round(this.trackedCurrentTime)}debug(e){if(void 0===e)return this.isDebugEnabled||this.player.debug();this.isDebugEnabled=Boolean(e)}destroy(){this.clearTimers(),window.tc_vars||(window.tc_vars={}),this.elapsedPlaybackTime=0,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.srcMediaData=void 0,this.startPlaybackSession=0,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0}dispose(){this.beforeunload(),this.clearTimers(),window.removeEventListener("beforeunload",this.beforeunloadListener),this.player.off(bm,this.emptiedListener),this.player.off(Tm,this.endedListener),this.player.off(wm,this.loadstartListener),this.player.off(Sm,this.loadeddataListener),this.player.off(Cm,this.playListener),this.player.off(Em,this.pauseListener),this.player.off(xm,this.rateChangeListener),this.player.off(Im,this.seekingListener),this.player.off(Am,this.timeUpdateListener),this.player.off(Dm,this.waitingListener)}emptied(){this.player.ended()||this.notify("stop")}ended(){this.notify("eof"),this.mediaSession=0,this.clearTimers()}flush(){this.isTrackerDisabled()||(this.pendingTagCommanderReload&&window.tC&&(window.tC.container.reload(),this.pendingTagCommanderReload=!1),window.tc_events_11&&this.pendingQueue.length>0&&(this.pendingQueue.forEach((e=>{window.tc_events_11(this.player.el(),e.action,e.labels)})),this.pendingQueue=[]))}getCurrentAudioTrack(){const e=Array.from(this.player.audioTracks()).find((e=>e.enabled));let t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getCurrentTextTrack(){const e=this.player.textTrack();let t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getDvrWindowPosition(){const{liveTracker:e}=this.player,t=this.currentTime()-e.seekableStart()|0,i=e.liveWindow()-t;return i<0||i===1/0?0:1e3*i}getDvrWindowSize(){const e=this.player.liveTracker.liveWindow()===1/0,t=1e3*this.player.liveTracker.liveWindow();return e?0:t}getElapsedPlaybackTime(){return this.startPlaybackSession?this.getElapsedPlayingTime():this.elapsedPlaybackTime}getElapsedPlayingTime(){const e=Pm.now()-this.startPlaybackSession|0;return this.elapsedPlaybackTime+e}getEventLabels(e){const t={event_id:e,event_timestamp:Pm.now(),media_dvr_window_length:0,media_dvr_window_offset:0,media_is_dvr:!1,media_is_live:!1,media_mute:this.player.muted()?"1":"0",media_playback_rate:this.player.playbackRate(),media_position:this.currentTime(),media_quality:this.srcMediaData.mediaData.quality,media_subtitles_on:this.isTextTrackEnabled(),media_volume:(100*this.player.volume()).toFixed(0),navigation_environment:this.environment};return this.isAudioTrackEnabled()&&(t.media_audio_track=this.getCurrentAudioTrack(),t.media_audiodescription_on=this.isAudioDescriptionEnabled()),this.isTextTrackEnabled()&&(t.media_subtitle_selection=this.getCurrentTextTrack()),this.isMediaOnDemand()||(t.media_is_live=!0,t.media_position=this.getElapsedPlaybackTime()),this.isMediaDvr()&&(t.media_dvr_window_offset=0|this.getDvrWindowPosition(),t.media_dvr_window_length=0|this.getDvrWindowSize(),t.media_is_dvr=!0,t.media_timeshift=[km,Em].includes(e)?this.timeShifted():0),t}getInternalLabels(){const e={media_bu_distributer:this.srcMediaData.mediaData.vendor,media_chromecast_selected:Boolean(this.player.tech(!0).isCasting),media_embedding_url:document.referrer,media_player_display:"default",media_player_name:"pillarbox-web",media_player_version:this.playerVersion,media_url:this.srcMediaData.src},t=this.srcMediaData.mediaData.analyticsMetadata||{};window.tc_vars=Object.assign({},window.tc_vars,e,t)}heartBeat(){this.heartBeatIntervalId=setInterval((()=>{this.player.paused()||this.notify("pos")}),3e4)}initCallbacks(){this.beforeunloadListener=this.beforeunload.bind(this),this.emptiedListener=this.emptied.bind(this),this.endedListener=this.ended.bind(this),this.loadstartListener=this.loadstart.bind(this),this.loadeddataListener=this.loadeddata.bind(this),this.playListener=this.play.bind(this),this.pauseListener=this.pause.bind(this),this.rateChangeListener=this.rateChange.bind(this),this.seekingListener=this.seeking.bind(this),this.timeUpdateListener=this.timeUpdate.bind(this),this.waitingListener=this.waiting.bind(this)}initListeners(){this.initCallbacks(),window.addEventListener("beforeunload",this.beforeunloadListener),this.player.on(bm,this.emptiedListener),this.player.on(Tm,this.endedListener),this.player.on(wm,this.loadstartListener),this.player.on(Sm,this.loadeddataListener),this.player.on(Cm,this.playListener),this.player.on(Em,this.pauseListener),this.player.on(xm,this.rateChangeListener),this.player.on(Im,this.seekingListener),this.player.on(Am,this.timeUpdateListener),this.player.on(Dm,this.waitingListener),this.player.one("dispose",this.dispose.bind(this))}initScript(){const e="tc_script__11";if(!document.querySelector(`#${e}`)){const t=document.createElement("script"),i=this.tagCommanderScriptURL;t.defer=!0,t.id=e,t.src=i,t.type="text/javascript",t.onload=e=>{this.flush()},document.body.appendChild(t)}}isAudioDescriptionEnabled(){const e=Array.from(this.player.audioTracks()).find((e=>e.enabled&&e.kind.includes("desc")));return Boolean(e)}isAudioTrackEnabled(){return!!this.getCurrentAudioTrack()}isMediaDvr(){const{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&&e<this.player.liveTracker.liveWindow()}isMediaLive(){const{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&&e>this.player.liveTracker.liveWindow()}isMediaOnDemand(){return Number.isFinite(this.player.duration())}isTextTrackEnabled(){return!!this.getCurrentTextTrack()}isTrackerDisabled(){return!this.srcMediaData||!this.srcMediaData.mediaData||(Array.isArray(this.srcMediaData.disableTrackers)?Boolean(this.srcMediaData.disableTrackers.find((e=>e.toLowerCase()===Pm.name.toLowerCase()))):Boolean(this.srcMediaData.disableTrackers))}loadstart(){this.destroy(),this.updateSrcMediaData(this.player.currentSource()),this.isTrackerDisabled()||(this.getInternalLabels(),this.reloadTagCommanderContainer(),this.notify("buffer_start"),this.hasStarted=!1)}loadeddata(){this.notify("init"),this.initialized=!0,this.notify("buffer_stop")}log(e,t,i="log"){this.debug()&&console[i](`SRGAnalytics:${e}`,t,window.tc_vars)}notify(e,t){if(this.isTrackerDisabled())return;try{this.flush()}catch(t){this.log(e,t,"error")}const i=Object.assign({},this.getEventLabels(e),t);this.log(e,i);try{window.tc_events_11?window.tc_events_11(this.player.el(),e,i):this.pendingQueue.push({action:e,labels:i})}catch(t){this.log(e,t,"error")}}static now(){return(Date.now()/1e3).toFixed(0)}play(){this.hasStarted||(this.hasStarted=!0),this.startPlaybackSession||this.isMediaOnDemand()||(this.startPlaybackSession=Pm.now()),0===this.mediaSession&&(this.mediaSession=Pm.now(),this.heartBeat(),this.uptime()),this.timeUpdate(),this.notify("play"),this.isSeeking&&(this.isSeeking=!1)}pause(){this.isMediaOnDemand()||(this.elapsedPlaybackTime=this.getElapsedPlayingTime(),this.startPlaybackSession=0),!this.player.seeking()&&!this.isMediaLive()&&this.player.currentTime()<this.player.duration()?this.notify("pause"):this.hasStarted&&!this.isSeeking&&(this.notify("seek"),this.isSeeking=!0)}rateChange(){this.notify("change_playback_rate")}reloadTagCommanderContainer(){window.tC?(window.tC.container.reload(),this.pendingTagCommanderReload=!1):this.pendingTagCommanderReload=!0}seeking(){!this.hasStarted||this.player.paused()||this.isSeeking||(this.notify("seek"),this.isSeeking=!0)}timeUpdate(){this.player.paused()||(this.trackedCurrentTime=this.player.currentTime())}timeShifted(){const e=this.player.liveTracker.atLiveEdge(),t=this.player.liveTracker.liveCurrentTime(),i=this.player.currentTime();return e?0:(t-i).toFixed(0)}updateSrcMediaData(e){this.srcMediaData=e}uptime(){const e=()=>{this.player.paused()||this.isMediaOnDemand()||this.notify("uptime")};this.uptimeTimeoutId=setTimeout((()=>{e(),this.uptimeIntervalId=setInterval((()=>{e()}),6e4)}),3e4)}waiting(){if(!this.initialized||this.isWaiting)return;const e=()=>{this.isWaiting=!1,this.notify("buffer_stop")};this.isWaiting=!0,this.notify("buffer_start"),rm.browser.IS_ANY_SAFARI?this.player.one(Am,e):this.player.one(Cm,e)}}class Lm{constructor(e,{playerName:t="none",playerVersion:i="none",platform:s="Web",schemaVersion:r=1,heartbeatInterval:n=3e4,beaconUrl:a="https://monitoring.pillarbox.ch/api/events"}={}){this.player=e,this.playerName=t,this.playerVersion=i,this.platform=s,this.schemaVersion=r,this.heartbeatInterval=n,this.beaconUrl=a,this.currentSessionId=void 0,this.lastPlaybackDuration=0,this.lastPlaybackStartTimestamp=0,this.lastStallCount=0,this.lastStallDuration=0,this.loadStartTimestamp=void 0,this.metadataRequestTime=0,this.mediaAssetUrl=void 0,this.mediaId=void 0,this.mediaMetadataUrl=void 0,this.mediaOrigin=void 0,this.tokenRequestTime=0,this.addListeners()}addListeners(){this.bindCallBacks(),this.player.on("loadstart",this.loadStart),this.player.on("loadeddata",this.loadedData),this.player.on("playing",this.playbackStart),this.player.on("pause",this.playbackStop),this.player.on("error",this.error),this.player.on(["playerreset","dispose","ended"],this.sessionStop),this.player.on(["waiting","stalled"],this.stalled),window.addEventListener("beforeunload",this.sessionStop)}bandwidth(){const e=this.player.tech(!0).vhs?this.player.tech(!0).vhs.stats:void 0;return e?e.bandwidth:void 0}bindCallBacks(){this.error=this.error.bind(this),this.loadedData=this.loadedData.bind(this),this.loadStart=this.loadStart.bind(this),this.playbackStart=this.playbackStart.bind(this),this.playbackStop=this.playbackStop.bind(this),this.stalled=this.stalled.bind(this),this.sessionStop=this.sessionStop.bind(this)}bufferDuration(){const e=this.player.buffered();let t=0;for(let i=0;i<e.length;i++){const s=e.start(i);t+=e.end(i)-s}return Lm.secondsToMilliseconds(t)}currentRepresentation(){const{activeCues:{cues_:[e]}={cues_:[]}}=Array.from(this.player.textTracks()).find((({label:e,kind:t})=>"metadata"===t&&"segment-metadata"===e))||{};return e?e.value:void 0}currentResource(){let{bandwidth:e,uri:t}=this.currentRepresentation()||{};if(rm.browser.IS_ANY_SAFARI){const{configuration:i}=Array.from(this.player.videoTracks()).find((e=>e.selected))||{};e=i?i.bitrate:void 0,t=this.player.currentSource().src}return{bitrate:e,url:t}}currentSourceMediaData(){return this.player.currentSource().mediaData?this.player.currentSource().mediaData:{}}error(){const e=this.player.error(),i=this.playbackPosition(),s=this.currentRepresentation(),r=s?s.uri:this.player.currentSource().src;this.player.hasStarted()||this.sendEvent("START",this.startEventData()),this.sendEvent("ERROR",t(t({log:JSON.stringify(e.metadata||rm.log.history().slice(-15)),message:e.message,name:e.code},i),{},{url:r})),this.reset()}getDrmRequestDuration(){const e=Object.values(this.player.currentSource().keySystems||{}).map((e=>e.url));if(!e.length)return;const t=performance.getEntriesByType("resource").filter((({initiatorType:t,name:i})=>"xmlhttprequest"===t&&e.includes(i))).pop();return t&&t.duration}getMetadataInfo(e){const t=performance.getEntriesByType("resource").filter((({initiatorType:t,name:i})=>"fetch"===t&&i.includes(e))).pop();return t?{name:t.name,duration:t.duration}:{}}getTokenRequestDuration(e){if(!e)return;const t=performance.getEntriesByType("resource").filter((({initiatorType:e,name:t})=>"fetch"===e&&t.includes("/akahd/token"))).pop();return t&&t.duration}heartbeat(){this.heartbeatIntervalId=setInterval((()=>{this.sendEvent("HEARTBEAT",this.statusEventData())}),this.heartbeatInterval)}isTrackerDisabled(){const e=this.player.currentSource();return Array.isArray(e.disableTrackers)?Boolean(e.disableTrackers.find((e=>e.toLowerCase()===Lm.name.toLowerCase()))):Boolean(e.disableTrackers)}loadedData(){this.sendEvent("START",this.startEventData()),this.sendEvent("HEARTBEAT",this.statusEventData()),this.heartbeat()}loadStart(){!Object.keys(this.currentSourceMediaData()).length&&this.currentSessionId&&(this.sessionStop(),this.sessionStartTimestamp=Lm.timestamp()),this.loadStartTimestamp=Lm.timestamp()}mediaInfo(){return{asset_url:this.mediaAssetUrl,id:this.mediaId,metadata_url:this.mediaMetadataUrl,origin:this.mediaOrigin}}playbackDuration(){return this.lastPlaybackStartTimestamp?Lm.timestamp()+this.lastPlaybackDuration-this.lastPlaybackStartTimestamp:this.lastPlaybackDuration}playbackPosition(){const e=this.currentRepresentation(),t=Lm.secondsToMilliseconds(this.player.currentTime());let i;if(e&&(i=e.programDateTime),rm.browser.IS_ANY_SAFARI){const e=Date.parse(this.player.$("video").getStartDate());i=isNaN(e)?void 0:e+t}return{position:t,position_timestamp:i}}playbackStart(){this.lastPlaybackStartTimestamp=Lm.timestamp()}playbackStop(){this.lastPlaybackDuration+=Lm.timestamp()-this.lastPlaybackStartTimestamp,this.lastPlaybackStartTimestamp=0}playerCurrentDimensions(){return this.player.currentDimensions()}playerInfo(){return{name:this.playerName,version:this.playerVersion,platform:this.platform}}qoeTimings(e,t){return{metadata:this.metadataRequestTime,asset:e,total:t-this.sessionStartTimestamp}}qosTimings(e){return{asset:e,drm:this.getDrmRequestDuration(),metadata:this.metadataRequestTime,token:this.tokenRequestTime}}removeListeners(){this.player.off("loadstart",this.loadStart),this.player.off("loadeddata",this.loadedData),this.player.off("playing",this.playbackStart),this.player.off("pause",this.playbackStop),this.player.off("error",this.error),this.player.off(["playerreset","dispose","ended"],this.sessionStop),this.player.off(["waiting","stalled"],this.stalled),window.removeEventListener("beforeunload",this.sessionStop)}removeTokenFromAssetUrl(e){if(e)try{const t=new URL(e);return t.searchParams.delete("hdnts"),t.href}catch(e){return}}reset(e){this.currentSessionId=void 0,this.lastPlaybackDuration=0,this.lastPlaybackStartTimestamp=0,this.lastStallCount=0,this.lastStallDuration=0,this.loadStartTimestamp=0,this.metadataRequestTime=0,this.mediaAssetUrl=void 0,this.mediaId=void 0,this.mediaMetadataUrl=void 0,this.mediaOrigin=void 0,this.sessionStartTimestamp=void 0,this.tokenRequestTime=0,clearInterval(this.heartbeatIntervalId),e&&!["ended","playerreset"].includes(e.type)&&this.removeListeners()}sendEvent(e,t={}){if(this.isTrackerDisabled()&&!this.currentSessionId||!this.currentSessionId)return;const i=JSON.stringify({event_name:e,session_id:this.currentSessionId,timestamp:Lm.timestamp(),version:this.schemaVersion,data:t});navigator.sendBeacon(this.beaconUrl,i)}sessionStart(){this.sessionStartTimestamp&&this.sessionStop(),this.sessionStartTimestamp=Lm.timestamp(),this.mediaId=this.player.currentSource().src||void 0}sessionStop(e){this.sendEvent("STOP",this.statusEventData()),this.reset(e)}stalled(){if(!this.player.hasStarted()||this.player.seeking()||this.isStalled)return;this.isStalled=!0;const e=Lm.timestamp(),t=()=>{const t=Lm.timestamp();this.isStalled=!1,this.lastStallCount+=1,this.lastStallDuration+=t-e};rm.browser.IS_ANY_SAFARI?this.player.one("timeupdate",t):this.player.one("playing",t)}stallInfo(){return{count:this.lastStallCount,duration:this.lastStallDuration}}statusEventData(){const e=this.bandwidth(),t=this.bufferDuration(),{bitrate:i,url:s}=this.currentResource(),{droppedVideoFrames:r}=this.player.getVideoPlaybackQuality(),n=this.playbackDuration(),{position:a,position_timestamp:o}=this.playbackPosition(),l=isFinite(this.player.duration())?"On-demand":"Live";return{bandwidth:e,bitrate:i,buffered_duration:t,frame_drops:r,playback_duration:n,position:a,position_timestamp:o,stall:this.stallInfo(),stream_type:l,url:s}}startEventData(){const e=Lm.timestamp(),t=this.loadStartTimestamp?e-this.loadStartTimestamp:0;return this.isTrackerDisabled()||(this.currentSessionId=Lm.sessionId()),this.mediaAssetUrl=this.removeTokenFromAssetUrl(this.player.currentSource().src),this.mediaMetadataUrl=this.getMetadataInfo(this.mediaId).name,this.metadataRequestTime=this.getMetadataInfo(this.mediaId).duration,this.mediaOrigin=window.location.href,this.tokenRequestTime=this.getTokenRequestDuration(this.currentSourceMediaData().tokenType),{browser:Lm.userAgent(),device:{id:Lm.deviceId()},media:this.mediaInfo(),player:this.playerInfo(),qoe_timings:this.qoeTimings(t,e),qos_timings:this.qosTimings(t),screen:this.playerCurrentDimensions()}}static sessionId(){return Lm.randomUUID()}static deviceId(){if(!localStorage)return;const e="pillarbox_device_id";let t=localStorage.getItem(e);return t||(t=Lm.randomUUID(),localStorage.setItem(e,t)),t}static randomUUID(){return crypto.randomUUID?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)))}static secondsToMilliseconds(e){return parseInt(1e3*e)}static timestamp(){return Date.now()}static userAgent(){return{user_agent:navigator.userAgent}}}class Om{findChapterByUrn(e){if(this.chapterList){const[t]=this.chapterList.filter((t=>t.urn===e));return t}}findMainSegment(){if(!this.segmentUrn)return;const e=this.getMainSegments(),[t]=e.filter((e=>e.urn===this.segmentUrn));return t}findResourceListByUrn(e){const t=this.findChapterByUrn(e);if(t)return t.resourceList||[]}getChapters(){const e="AUDIO";return this.getMainChapter().mediaType===e?[]:this.chapterList.filter((({mediaType:t})=>t!==e))}getFilteredExternalSubtitles(){const{subtitleList:e}=this.getMainChapter(),[{subtitleInformationList:t}={}]=this.getResourceList().filter((({subtitleInformationList:e})=>e)),i=e&&!t;if(!e)return[];const s=e.filter((e=>"TTML"!==e.format));return i?s:s.filter((e=>!t.find((t=>t.locale===e.locale&&e.type===t.type))))}getMainBlockReason(){const e=this.getMainChapter();if(!e)return;let{blockReason:t}=e;return!t&&new Date<this.getMainValidFromDate()&&(t="STARTDATE"),t}getMainBlockedSegments(){return this.getMainSegments().filter((e=>e.blockReason))}getMainChapter(){return this.mainChapter||(this.mainChapter=this.findChapterByUrn(this.chapterUrn)),!this.mainChapter&&this.chapterList&&this.chapterList.length>0&&([this.mainChapter]=this.chapterList),this.mainChapter}getMainChapterImageUrl(){const e=this.getMainChapter();if(e&&e.imageUrl)return e.imageUrl}getMainResources(){const e=this.getResourceList();if(e&&e.length)return e.map((e=>({analyticsData:this.getMergedAnalyticsData(e.analyticsData),analyticsMetadata:this.getMergedAnalyticsMetadata(e.analyticsMetadata),blockReason:this.getMainChapter().blockReason,blockedSegments:this.getMainBlockedSegments(),imageUrl:this.getMainChapterImageUrl(),chapters:this.getChapters(),drmList:e.drmList,dvr:e.dvr,eventData:this.getMainChapter().eventData,id:this.getMainChapter().id,imageCopyright:this.getMainChapter().imageCopyright,intervals:this.getMainTimeIntervals(),live:e.live,mediaType:this.getMainChapter().mediaType,mimeType:e.mimeType,presentation:e.presentation,quality:e.quality,streaming:e.streaming,streamOffset:e.streamOffset,subtitles:this.getFilteredExternalSubtitles(),title:this.getMainChapter().title,tokenType:e.tokenType,url:e.url,urn:this.chapterUrn,vendor:this.getMainChapter().vendor})))}getMainSegments(){const e=this.getMainChapter();return!this.mainSegments&&e&&e.segmentList&&(this.mainSegments=e.segmentList),this.mainSegments||[]}getMainTimeIntervals(){const{timeIntervalList:e=[]}=this.getMainChapter()||{};return e}getMainValidFromDate(){const e=this.getMainChapter();if(!e)return new Date(0);const{validFrom:t}=e;return t?new Date(t):void 0}getMergedAnalyticsData(e){return t(t(t({},this.analyticsData),this.getMainChapter().analyticsData),e)}getMergedAnalyticsMetadata(e){return t(t(t({},this.analyticsMetadata),this.getMainChapter().analyticsMetadata),e)}getResourceList(){const{resourceList:e}=this.getMainChapter();return e||[]}}const Rm={Play:"Wiedergabe",Pause:"Pause",Replay:"Erneut abspielen","Current Time":"Aktueller Zeitpunkt",Duration:"Dauer","Remaining Time":"Verbleibende Zeit","Stream Type":"Streamtyp",LIVE:"LIVE",Loaded:"Geladen",Progress:"Status",Fullscreen:"Vollbild","Exit Fullscreen":"Vollbildmodus beenden",Mute:"Stumm schalten",Unmute:"Ton einschalten","Playback Rate":"Wiedergabegeschwindigkeit",Subtitles:"Untertitel","subtitles off":"Untertitel aus",Captions:"Untertitel","captions off":"Untertitel aus",Chapters:"Kapitel","You aborted the media playback":"Sie haben die Videowiedergabe abgebrochen.","A network error caused the media download to fail part-way.":"Der Videodownload ist aufgrund eines Netzwerkfehlers fehlgeschlagen.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Die Videowiedergabe wurde entweder wegen eines Problems mit einem beschädigten Video oder wegen verwendeten Funktionen, die vom Browser nicht unterstützt werden, abgebrochen.","No compatible source was found for this media.":"Für dieses Video wurde keine kompatible Quelle gefunden.","Play Video":"Video abspielen",Close:"Schließen","Modal Window":"Modales Fenster","This is a modal window":"Dies ist ein modales Fenster","This modal can be closed by pressing the Escape key or activating the close button.":'Durch Drücken der Esc-Taste bzw. Betätigung der Schaltfläche "Schließen" wird dieses modale Fenster geschlossen.',", opens captions settings dialog":", öffnet Einstellungen für Untertitel",", opens subtitles settings dialog":", öffnet Einstellungen für Untertitel",", selected":", ausgewählt","captions settings":"Untertiteleinstellungen","subtitles settings":"Untertiteleinstellungen","descriptions settings":"Einstellungen für Beschreibungen","Close Modal Dialog":"Modales Fenster schließen",Descriptions:"Beschreibungen","descriptions off":"Beschreibungen aus","The media is encrypted and we do not have the keys to decrypt it.":"Die Entschlüsselungsschlüssel für den verschlüsselten Medieninhalt sind nicht verfügbar.",", opens descriptions settings dialog":", öffnet Einstellungen für Beschreibungen","Audio Track":"Tonspur",Text:"Schrift",White:"Weiß",Black:"Schwarz",Red:"Rot",Green:"Grün",Blue:"Blau",Yellow:"Gelb",Magenta:"Magenta",Cyan:"Türkis",Background:"Hintergrund",Window:"Fenster",Transparent:"Durchsichtig","Semi-Transparent":"Halbdurchsichtig",Opaque:"Undurchsichtig","Font Size":"Schriftgröße","Text Edge Style":"Textkantenstil",None:"Kein",Raised:"Erhoben",Depressed:"Gedrückt",Uniform:"Uniform","Drop shadow":"Schlagschatten","Font Family":"Schriftfamilie","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:"Zwanglos",Script:"Schreibschrift","Small Caps":"Small-Caps",Reset:"Zurücksetzen","restore all settings to the default values":"Alle Einstellungen auf die Standardwerte zurücksetzen",Done:"Fertig","Caption Settings Dialog":"Einstellungsdialog für Untertitel","Beginning of dialog window. Escape will cancel and close the window.":"Anfang des Dialogfensters. Esc bricht ab und schließt das Fenster.","End of dialog window.":"Ende des Dialogfensters.","Audio Player":"Audio-Player","Video Player":"Video-Player","Progress Bar":"Fortschrittsbalken","progress bar timing: currentTime={1} duration={2}":"{1} von {2}","Volume Level":"Lautstärke","{1} is loading.":"{1} wird geladen.","Seek to live, currently behind live":"Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.","Seek to live, currently playing live":"Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.","Exit Picture-in-Picture":"Bild-im-Bild-Modus beenden","Picture-in-Picture":"Bild-im-Bild-Modus","No content":"Kein Inhalt",Color:"Farbe",Opacity:"Deckkraft","Text Background":"Texthintergrund","Caption Area Background":"Hintergrund des Untertitelbereichs","Playing in Picture-in-Picture":"Wird im Bild-im-Bild-Modus wiedergegeben","Skip forward {1} seconds":"{1} Sekunden vorwärts","Skip backward {1} seconds":"{1} Sekunden zurück"},Mm={AGERATING12:"Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 20:00 und 06:00 Uhr zur Verfügung.",AGERATING18:"Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 23:00 und 05:00 Uhr zur Verfügung.",COMMERCIAL:"Die Werbung wurde übersprungen.",ENDDATE:"Dieser Inhalt ist nicht mehr verfügbar.",GEOBLOCK:"Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.",JOURNALISTIC:"Dieser Inhalt steht aus publizistischen Gründen vorübergehend nicht zur Verfügung.",LEGAL:"Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.",STARTDATE:"Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.",UNKNOWN:"Dieser Inhalt ist nicht verfügbar."};rm.addLanguage("de",t(t({},Rm),Mm));const Nm={"Audio Player":"Audio Player","Video Player":"Video Player",Play:"Play",Pause:"Pause",Replay:"Replay","Current Time":"Current Time",Duration:"Duration","Remaining Time":"Remaining Time","Stream Type":"Stream Type",LIVE:"LIVE","Seek to live, currently behind live":"Seek to live, currently behind live","Seek to live, currently playing live":"Seek to live, currently playing live",Loaded:"Loaded",Progress:"Progress","Progress Bar":"Progress Bar","progress bar timing: currentTime={1} duration={2}":"{1} of {2}",Fullscreen:"Fullscreen","Exit Fullscreen":"Exit Fullscreen",Mute:"Mute",Unmute:"Unmute","Playback Rate":"Playback Rate",Subtitles:"Subtitles","subtitles off":"subtitles off",Captions:"Captions","captions off":"captions off",Chapters:"Chapters",Descriptions:"Descriptions","descriptions off":"descriptions off","Audio Track":"Audio Track","Volume Level":"Volume Level","You aborted the media playback":"You aborted the media playback","A network error caused the media download to fail part-way.":"A network error caused the media download to fail part-way.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"The media could not be loaded, either because the server or network failed or because the format is not supported.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.","No compatible source was found for this media.":"No compatible source was found for this media.","The media is encrypted and we do not have the keys to decrypt it.":"The media is encrypted and we do not have the keys to decrypt it.","Play Video":"Play Video",Close:"Close","Close Modal Dialog":"Close Modal Dialog","Modal Window":"Modal Window","This is a modal window":"This is a modal window","This modal can be closed by pressing the Escape key or activating the close button.":"This modal can be closed by pressing the Escape key or activating the close button.",", opens captions settings dialog":", opens captions settings dialog",", opens subtitles settings dialog":", opens subtitles settings dialog",", opens descriptions settings dialog":", opens descriptions settings dialog",", selected":", selected","captions settings":"captions settings","subtitles settings":"subtitles settings","descriptions settings":"descriptions settings",Text:"Text",White:"White",Black:"Black",Red:"Red",Green:"Green",Blue:"Blue",Yellow:"Yellow",Magenta:"Magenta",Cyan:"Cyan",Background:"Background",Window:"Window",Transparent:"Transparent","Semi-Transparent":"Semi-Transparent",Opaque:"Opaque","Font Size":"Font Size","Text Edge Style":"Text Edge Style",None:"None",Raised:"Raised",Depressed:"Depressed",Uniform:"Uniform","Drop shadow":"Drop shadow","Font Family":"Font Family","Proportional Sans-Serif":"Proportional Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportional Serif","Monospace Serif":"Monospace Serif",Casual:"Casual",Script:"Script","Small Caps":"Small Caps",Reset:"Reset","restore all settings to the default values":"restore all settings to the default values",Done:"Done","Caption Settings Dialog":"Caption Settings Dialog","Beginning of dialog window. Escape will cancel and close the window.":"Beginning of dialog window. Escape will cancel and close the window.","End of dialog window.":"End of dialog window.","{1} is loading.":"{1} is loading.","Exit Picture-in-Picture":"Exit Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture","No content":"No content",Color:"Color",Opacity:"Opacity","Text Background":"Text Background","Caption Area Background":"Caption Area Background","Playing in Picture-in-Picture":"Playing in Picture-in-Picture","Skip backward {1} seconds":"Skip backward {1} seconds","Skip forward {1} seconds":"Skip forward {1} seconds"},Um={AGERATING12:"To protect children this content is only available between 8PM and 6AM.",AGERATING18:"To protect children this content is only available between 10PM and 5AM.",COMMERCIAL:"This commercial content is not available.",ENDDATE:"This content is not available anymore.",GEOBLOCK:"This content is not available outside Switzerland.",JOURNALISTIC:"This content is temporarily unavailable for journalistic reasons.",LEGAL:"This content is not available due to legal restrictions.",STARTDATE:"This content is not available yet.",UNKNOWN:"This content is not available."};rm.addLanguage("en",t(t({},Nm),Um));const Bm={"Audio Player":"Lecteur audio","Video Player":"Lecteur vidéo",Play:"Lecture",Pause:"Pause",Replay:"Revoir","Current Time":"Temps actuel",Duration:"Durée","Remaining Time":"Temps restant","Stream Type":"Type de flux",LIVE:"EN DIRECT","Seek to live, currently behind live":"Rechercher le direct, actuellement après le direct","Seek to live, currently playing live":"Rechercher le direct, le direct actuellement en cours de lecture",Loaded:"Chargé",Progress:"Progression","Progress Bar":"Barre de progression","progress bar timing: currentTime={1} duration={2}":"{1} de {2}",Fullscreen:"Plein écran","Exit Fullscreen":"Fenêtré",Mute:"Mettre en sourdine",Unmute:"Activer le son","Playback Rate":"Vitesse de lecture",Subtitles:"Sous-titres","subtitles off":"Sous-titres désactivés",Captions:"Sous-titres transcrits","captions off":"Sous-titres transcrits désactivés",Chapters:"Chapitres",Descriptions:"Descriptions","descriptions off":"descriptions désactivées","Audio Track":"Piste audio","Volume Level":"Niveau de volume","You aborted the media playback":"Vous avez interrompu la lecture de la vidéo.","A network error caused the media download to fail part-way.":"Une erreur de réseau a interrompu le téléchargement de la vidéo.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Cette vidéo n'a pas pu être chargée, soit parce que le serveur ou le réseau a échoué ou parce que le format n'est pas reconnu.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La lecture de la vidéo a été interrompue à cause d'un problème de corruption ou parce que la vidéo utilise des fonctionnalités non prises en charge par votre navigateur.","No compatible source was found for this media.":"Aucune source compatible n'a été trouvée pour cette vidéo.","The media is encrypted and we do not have the keys to decrypt it.":"Le média est chiffré et nous n'avons pas les clés pour le déchiffrer.","Play Video":"Lire la vidéo",Close:"Fermer","Close Modal Dialog":"Fermer la boîte de dialogue modale","Modal Window":"Fenêtre modale","This is a modal window":"Ceci est une fenêtre modale","This modal can be closed by pressing the Escape key or activating the close button.":"Ce modal peut être fermé en appuyant sur la touche Échap ou activer le bouton de fermeture.",", opens captions settings dialog":", ouvrir les paramètres des sous-titres transcrits",", opens subtitles settings dialog":", ouvrir les paramètres des sous-titres",", opens descriptions settings dialog":", ouvrir les paramètres des descriptions",", selected":", sélectionné","captions settings":"Paramètres des sous-titres transcrits","subtitles settings":"Paramètres des sous-titres","descriptions settings":"Paramètres des descriptions",Text:"Texte",White:"Blanc",Black:"Noir",Red:"Rouge",Green:"Vert",Blue:"Bleu",Yellow:"Jaune",Magenta:"Magenta",Cyan:"Cyan",Background:"Arrière-plan",Window:"Fenêtre",Transparent:"Transparent","Semi-Transparent":"Semi-transparent",Opaque:"Opaque","Font Size":"Taille des caractères","Text Edge Style":"Style des contours du texte",None:"Aucun",Raised:"Élevé",Depressed:"Enfoncé",Uniform:"Uniforme","Drop shadow":"Ombre portée","Font Family":"Famille de polices","Proportional Sans-Serif":"Polices à chasse variable sans empattement (Proportional Sans-Serif)","Monospace Sans-Serif":"Polices à chasse fixe sans empattement (Monospace Sans-Serif)","Proportional Serif":"Polices à chasse variable avec empattement (Proportional Serif)","Monospace Serif":"Polices à chasse fixe avec empattement (Monospace Serif)",Casual:"Manuscrite",Script:"Scripte","Small Caps":"Petites capitales",Reset:"Réinitialiser","restore all settings to the default values":"Restaurer tous les paramètres aux valeurs par défaut",Done:"Terminé","Caption Settings Dialog":"Boîte de dialogue des paramètres des sous-titres transcrits","Beginning of dialog window. Escape will cancel and close the window.":"Début de la fenêtre de dialogue. La touche d'échappement annulera et fermera la fenêtre.","End of dialog window.":"Fin de la fenêtre de dialogue.","Exit Picture-in-Picture":"Quitter le mode image dans l'image","Picture-in-Picture":"Image dans l'image","{1} is loading.":"{1} en cours de chargement.","No content":"Aucun contenu",Color:"Couleur",Opacity:"Opacité","Text Background":"Arrière-plan du texte","Caption Area Background":"Arrière-plan de la zone de sous-titre","Skip backward {1} seconds":"Reculer de {1} secondes","Skip forward {1} seconds":"Avancer de {1} secondes"},Fm={AGERATING12:"Pour protéger les enfants, ce contenu est accessible entre 20h et 6h.",AGERATING18:"Pour protéger les enfants, ce contenu est accessible entre 23h et 5h.",COMMERCIAL:"Ce contenu n'est actuellement pas disponible.",ENDDATE:"Ce contenu n'est plus disponible.",GEOBLOCK:"La RTS ne dispose pas des droits de diffusion en dehors de la Suisse.",JOURNALISTIC:"Ce contenu est temporairement indisponible pour des raisons éditoriales.",LEGAL:"Pour des raisons juridiques, ce contenu n'est pas disponible.",STARTDATE:"Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.",UNKNOWN:"Ce contenu n'est actuellement pas disponible."};rm.addLanguage("fr",t(t({},Bm),Fm));const qm={"Audio Player":"Lettore audio","Video Player":"Lettore video",Play:"Play",Pause:"Pausa",Replay:"Replay","Current Time":"Orario attuale",Duration:"Durata","Remaining Time":"Tempo rimanente","Stream Type":"Tipo di streaming",LIVE:"LIVE",Loaded:"Caricato",Progress:"Stato","Progress Bar":"Barra di avanzamento","progress bar timing: currentTime={1} duration={2}":"{1} di {2}",Fullscreen:"Schermo intero","Exit Fullscreen":"Chiudi Schermo intero",Mute:"Disattiva l’audio",Unmute:"Attiva l’audio","Playback Rate":"Velocità di riproduzione",Subtitles:"Sottotitoli","subtitles off":"Senza sottotitoli",Captions:"Didascalie","captions off":"Senza didascalie",Chapters:"Capitolo",Descriptions:"Descrizioni","descriptions off":"Descrizioni disattivate","Audio Track":"Traccia audio","Volume Level":"Livello del volume","You aborted the media playback":"La riproduzione del contenuto multimediale è stata interrotta.","A network error caused the media download to fail part-way.":"Il download del contenuto multimediale è stato interrotto a causa di un problema rete.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il contenuto multimediale non può essere caricato a causa di un errore nel server o nella rete o perché il formato non viene supportato.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La riproduzione del contenuto multimediale è stata interrotta a causa di un file danneggiato o per l’utilizzo di impostazioni non supportate dal browser.","No compatible source was found for this media.":"Non ci sono fonti compatibili per questo contenuto multimediale.","The media is encrypted and we do not have the keys to decrypt it.":"Il contenuto multimediale è criptato e non disponiamo delle chiavi per decifrarlo.","Play Video":"Riproduci il video",Close:"Chiudi","Close Modal Dialog":"Chiudi la finestra di dialogo","Modal Window":"Finestra di dialogo","This is a modal window":"Questa è una finestra di dialogo","This modal can be closed by pressing the Escape key or activating the close button.":"Questa finestra di dialogo può essere chiusa premendo sul tasto Esc o attivando il pulsante di chiusura.",", opens captions settings dialog":", aprire le impostazioni delle didascalie",", opens subtitles settings dialog":", aprire le impostazioni dei sottotitoli",", opens descriptions settings dialog":", aprire le impostazioni delle descrizioni",", selected":", selezionato","captions settings":"Impostazioni didascalie","subtitles settings":"Impostazioni sottotitoli","descriptions settings":"Impostazioni descrizioni",Text:"Testo",White:"Bianco",Black:"Nero",Red:"Rosso",Green:"Verde",Blue:"Blu",Yellow:"Giallo",Magenta:"Magenta",Cyan:"Ciano",Background:"Sfondo",Window:"Finestra",Transparent:"Trasparente","Semi-Transparent":"Semi-Trasparente",Opaque:"Opaco","Font Size":"Dimensione dei caratteri","Text Edge Style":"Stile dei bordi del testo",None:"Nessuno",Uniform:"Uniforme","Drop shadow":"Ombra","Font Family":"Carattere","Proportional Sans-Serif":"Sans-Serif proporzionale","Monospace Sans-Serif":"Sans-Serif monospaziato","Proportional Serif":"Serif proporzionale","Monospace Serif":"Serif monospaziato","Small Caps":"Maiuscoletto",Reset:"Reinizializza","restore all settings to the default values":"Ripristina i valori predefiniti per tutti i parametri",Done:"Fatto","Caption Settings Dialog":"Finestra di dialogo dei parametri della trascrizione dei sottotitoli","Beginning of dialog window. Escape will cancel and close the window.":"Inizio della finestra di dialogo. Il tasto Esc annullerà l’operazione e chiuderà la finestra.","End of dialog window.":"Fine della finestra di dialogo.","{1} is loading.":"{1} in fase di caricamento.","Exit Picture-in-Picture":"Esci dalla modalità Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture",Color:"Colore",Opacity:"Opacità","Text Background":"Sfondo testo","Caption Area Background":"Sfondo area sottotitoli","Skip forward {1} seconds":"Avanti {1} secondi","Skip backward {1} seconds":"Indietro {1} secondi"},jm={AGERATING12:"Per proteggere i bambini, questo media è disponibile solo fra le 20 e le 6.",AGERATING18:"Per proteggere i bambini, questo media è disponibile solo fra le 23 le 5.",COMMERCIAL:"Questo contenuto commerciale non è disponibile.",ENDDATE:"Questo media non è più disponibile.",GEOBLOCK:"Questo media non è disponibile fuori dalla Svizzera.",JOURNALISTIC:"Questo contenuto è temporaneamente non disponibile per motivi editoriali.",LEGAL:"Il contenuto non è fruibile a causa di restrizioni legali.",STARTDATE:"Il contenuto non è ancora disponibile. Per cortesia prova più tardi.",UNKNOWN:"Questo media non è disponibile."};rm.addLanguage("it",t(t({},qm),jm));const $m={"Audio Player":"Audio-Player","Video Player":"Video-Player",Play:"Laschar ir",Pause:"Pausa",Replay:"Mussar danovamain","Current Time":"Temp actual",Duration:"Durada","Remaining Time":"Temp restant","Stream Type":"Tip dal stream",LIVE:"LIVE",Loaded:"Chargià",Progress:"Progress","Progress Bar":"Bar da progessiun","progress bar timing: currentTime={1} duration={2}":"{1} da {2}",Fullscreen:"Entir visur","Non-Fullscreen":"Betg entir visur",Mute:"Senza tun",Unmute:"Cun tun","Playback Rate":"Tempo ",Subtitles:"Suttitels","subtitles off":"senza suttitels",Captions:"Suttitels","captions off":"senza suttitels",Chapters:"Chapitels",Descriptions:"Descripziuns","descriptions off":"senza descripziuns","Audio Track":"Piese audio","Volume Level":"Nivel dal volumen","You aborted the media playback":"Vus avais interrut il vdieo","A network error caused the media download to fail part-way.":"In sbagl en la rait ha impedì il download","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il video n'è betg chargià - ubain per in sbagl da server / da la rait, ubain ch'il format n'è betg cumpatibel.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Il video è interrut: Ubain ch'il video è donnegià, ubain che funcziuns n'èn betg cumpatiblas.","No compatible source was found for this media.":"Chattà nagina funtauna cumpatibla per quest video.","The media is encrypted and we do not have the keys to decrypt it.":"Il video è codifitgà da moda nunenconuschenta.","Play Video":"Aviar video",Close:"Serrar","Close Modal Dialog":"Serrar la fanestra modala","Modal Window":"Fanestra modala","This is a modal window":"Quai è ina fanestra modala","This modal can be closed by pressing the Escape key or activating the close button.":'Questa fanestra modala pudais serrar cun la tasta "Escape" ubain cun il buttun.',", opens captions settings dialog":", avra opziuns per ils suttitels",", opens subtitles settings dialog":", avra opziuns per ils suttitels",", opens descriptions settings dialog":", avra opziuns per la descripziun",", selected":", selecziunà","captions settings":"opziuns per ils suttitels","subtitles settings":"opziuns per ils suttitels","descriptions settings":"opziuns per la descripziun",Text:"Text",White:"Alv",Black:"Nair",Red:"Cotschn",Green:"Verd",Blue:"Blau",Yellow:"Mellen",Magenta:"Magenta",Cyan:"Cyan",Background:"Fund",Window:"Fanestra",Transparent:"Transparent","Semi-Transparent":"Mez transparent",Opaque:"Betg transparent","Font Size":"Grandezza dal text","Text Edge Style":"Stil dal text",None:"Nagin",Raised:"Auzà",Depressed:"Sbassà",Uniform:"Uniform",Dropshadow:"Sumbriva","Font Family":"Scrittira","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:"Casual",Script:"Script","Small Caps":"Bustabs pitschens",Reset:"Da nov","restore all settings to the default values":"Enavos tar las opziuns da standard",Done:"Fatg","Caption Settings Dialog":"Opziuns per suttitels","Beginning of dialog window. Escape will cancel and close the window.":"Entschatta da la fanestra da dialog. Escape stizza e serra la fanestra.","End of dialog window.":"Fin da la fanestra da dialog.",AGERATING12:"Per proteger uffants, è quest cuntegn disponibel mo tranter las 20.00 e las 06.00.",AGERATING18:"Per proteger uffants, è quest cuntegn disponibel mo tranter las 23.00 e las 05.00.",COMMERCIAL:"Quest medium commerzial n'è betg disponibel.",ENDDATE:"Quest cuntegn n'è betg pli disponibel.",GEOBLOCK:"Quest cuntegn n'è betg disponibel ordaifer la Svizra.",JOURNALISTIC:"Quest cuntegn na stat ad interim betg a disposiziun per motivs publicistics.",LEGAL:"Quest cuntegn n'è betg disponibel perquai ch'el è scadì.",STARTDATE:"Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.",UNKNOWN:"Quest cuntegn n'è betg disponibel."};rm.addLanguage("rm",t({},$m));const Vm=["url","mimeType","keySystems"],Hm=["src"];class zm{static addBlockedSegments(e,t=[]){const i="srgssr-blocked-segments",s=e.textTracks().getTrackById(i);if(s&&e.textTracks().removeTrack(s),!Array.isArray(t)||!t.length)return;const r=t.filter((e=>e.blockReason));r.length&&zm.createTextTrack(e,i).then((t=>{r.forEach((e=>{zm.addTextTrackCue(t,e)})),e.textTracks().addTrack(t)}))}static addRemoteTextTracks(e,t=[]){Array.isArray(t)&&t.forEach((({type:t,language:i,locale:s,url:r})=>{e.addRemoteTextTrack({kind:"SDH"===t?"captions":"subtitles",label:i,language:s,src:r})}))}static addTextTrackCue(e,t){const i=(Number.isFinite(t.markIn)?t.markIn:t.fullLengthMarkIn)/1e3,s=(Number.isFinite(t.markOut)?t.markOut:t.fullLengthMarkOut)/1e3;e.addCue(new VTTCue(i,s,JSON.stringify(t)))}static addTextTracks(e,{mediaData:t}){zm.addRemoteTextTracks(e,t.subtitles),zm.addChapters(e,t.urn,t.chapters),zm.addBlockedSegments(e,t.blockedSegments),zm.addIntervals(e,t.intervals)}static addChapters(e,t,i=[]){const s="srgssr-chapters",r=e.textTracks().getTrackById(s);r&&e.textTracks().removeTrack(r),Array.isArray(i)&&i.length&&zm.createTextTrack(e,s).then((s=>{i.forEach((e=>{t===e.fullLengthUrn&&zm.addTextTrackCue(s,e)})),e.textTracks().addTrack(s)}))}static addIntervals(e,t=[]){const i="srgssr-intervals",s=e.textTracks().getTrackById(i);s&&e.textTracks().removeTrack(s),Array.isArray(t)&&t.length&&zm.createTextTrack(e,i).then((i=>{t.forEach((e=>{zm.addTextTrackCue(i,e)})),e.textTracks().addTrack(i)}))}static blockingReason(e,t){if(!t.mediaData.blockReason)return;const i=e.localize(t.mediaData.blockReason);return zm.error(e,{code:MediaError.MEDIA_ERR_ABORTED,message:i,metadata:{errorType:t.mediaData.blockReason,src:t}}),!0}static composeAkamaiResources(e=[]){return r((function*(){return vm.hasToken(e)?vm.tokenizeSources(e):Promise.resolve(e)}))()}static composeKeySystemsResources(e=[]){if(!fm.hasDrm(e))return e;return e.map((e=>t(t({},e),fm.buildKeySystems(e.drmList))))}static composeMainResources(e){return zm.composeAkamaiResources(zm.composeKeySystemsResources(zm.filterIncompatibleResources(e.getMainResources())))}static composeSrcMediaData({mediaData:e,disableTrackers:t},i){const s=rm.obj.merge(i,e),{url:r,mimeType:n,keySystems:o}=s;return{src:r,type:n,keySystems:o,disableTrackers:t,mediaData:a(s,Vm)}}static createTextTrack(e,t){return new Promise((i=>{setTimeout((()=>{i(new rm.TextTrack({id:t,kind:"metadata",label:t,tech:e.tech(!0)}))}),100)}))}static cuechangeEventProxy(e){e.textTracks().on("addtrack",(({track:t})=>{["srgssr-chapters","srgssr-intervals"].includes(t.id)&&t.on("cuechange",(()=>{const[i]=Array.from(t.activeCues),s=t.id.includes("srgssr-chapters")?"srgssr/chapter":"srgssr/interval";e.trigger({type:s,data:i})}))}))}static dataProvider(e){if(!e.options().srgOptions.dataProvider){const{dataProviderHost:t,dataProviderUrlHandler:i}=e.options().srgOptions,s=new nm(t).handleRequest(i);e.options({srgOptions:{dataProvider:s}})}return e.options().srgOptions.dataProvider}static dataProviderError(e,t){if(!t)return;const i=t.statusText?t.statusText:t.message;return zm.error(e,{code:0,message:e.localize("UNKNOWN"),metadata:{errorType:"UNKNOWN",urn:e.src(),status:t.status,statusText:i,url:t.url}}),!0}static error(e,{code:t,message:i,metadata:s}){e.error(null),e.error({code:t,message:i,metadata:s})}static filterIncompatibleResources(e=[]){return e.filter((e=>!["RTMP","HDS"].includes(e.streaming)))}static getBlockedSegment(e){const t=e.textTracks().getTrackById("srgssr-blocked-segments");if(!t)return;const[i]=Array.from(t.activeCues);return i}static getBlockedSegmentByTime(e,t){const i=zm.getBlockedSegment(e);if(!i)return;return t>=i.startTime&&t<i.endTime?i:void 0}static getMediaComposition(e,t=(new nm).handleRequest()){return r((function*(){const i=yield t(e);return Object.assign(new Om,i)}))()}static getMediaData(e=[]){if(vm.hasToken(e))return e[0];const t=rm.browser.IS_ANY_SAFARI?"HLS":"DASH";return e.find((({streaming:e})=>e===t))||e[0]}static getSrcMediaObj(e,t){return r((function*(){zm.pillarboxMonitoring(e)&&zm.pillarboxMonitoring(e).sessionStart();const{src:i}=t,s=a(t,Hm),r=yield zm.getMediaComposition(i,zm.dataProvider(e)),n=yield zm.composeMainResources(r),o=zm.getMediaData(n);return zm.composeSrcMediaData(s,o)}))()}static handleCurrentTime(e,t){const i=zm.getBlockedSegmentByTime(e,t);if(!i||!Number.isFinite(i.endTime))return t;const s=i.endTime+.1;return e.trigger({type:"srgssr/blocked-segment",data:i}),e.currentTime(s),s}static handleSetCurrentTime(e,t){const{endTime:i}=zm.getBlockedSegmentByTime(e,t)||{};return Number.isFinite(i)?i:t}static handleSetSource(e,t,i){return r((function*(){try{const s=yield zm.getSrcMediaObj(e,t);if(zm.srgAnalytics(e),zm.updateTitleBar(e,s),zm.updatePoster(e,s),zm.blockingReason(e,s))return;return zm.addTextTracks(e,s),i(null,s)}catch(t){if(zm.dataProviderError(e,t))return;return i(t)}}))()}static srgAnalytics(e){if(!1!==e.options().trackers.srgAnalytics&&!e.options().trackers.srgAnalytics){const t=new Pm(e,{debug:e.debug(),playerVersion:rm.VERSION.pillarbox,tagCommanderScriptURL:e.options().srgOptions.tagCommanderScriptURL});e.options({trackers:{srgAnalytics:t}})}}static pillarboxMonitoring(e){if(!1!==e.options().trackers.pillarboxMonitoring){if(!e.options().trackers.pillarboxMonitoring){const t=new Lm(e,{debug:e.debug(),playerVersion:rm.VERSION.pillarbox,playerName:"Pillarbox"});e.options({trackers:{pillarboxMonitoring:t}})}return e.options().trackers.pillarboxMonitoring}}static updatePoster(e,t,i=mm){e.poster(i.scale({url:t.mediaData.imageUrl}))}static updateTitleBar(e,t){e.titleBar&&e.titleBar.update({title:t.mediaData.vendor,description:t.mediaData.title})}static middleware(e){return zm.pillarboxMonitoring(e),zm.cuechangeEventProxy(e),{currentTime:t=>zm.handleCurrentTime(e,t),setCurrentTime:t=>zm.handleSetCurrentTime(e,t),setSource:(t=r((function*(t,i){return zm.handleSetSource(e,t,i)})),function(e,i){return t.apply(this,arguments)})};var t}}return rm.use("srgssr/urn",zm.middleware),rm.options.srgOptions={dataProvider:void 0,dataProviderHost:void 0,dataProviderUrlHandler:void 0,tagCommanderScriptURL:void 0},rm}));
34
+ function Lp(){return Lp=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},Lp.apply(this,arguments)}Ve("avc1.4d400d,mp4a.40.2")&&Qd.getTech("Html5").registerSourceHandler(Pp,0),Qd.VhsHandler=Dp,Qd.VhsSourceHandler=Pp,Qd.Vhs=vp,Qd.use||Qd.registerComponent("Vhs",vp),Qd.options.vhs=Qd.options.vhs||{},Qd.getPlugin&&Qd.getPlugin("reloadSourceOnError")||Qd.registerPlugin("reloadSourceOnError",yp);var Op=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var i=new DataView(e),s=new DataView(t),r=0;r<i.byteLength;r++)if(i.getUint8(r)!==s.getUint8(r))return!1;return!0},Rp=function(e){return e instanceof Uint8Array||e instanceof Uint16Array?e.buffer:e},Mp=function(){for(var e=Qd.obj||Qd,t=e.merge||e.mergeOptions,i=arguments.length,s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];return t.apply(e,s)},Np=function(){var e=Mp.apply(void 0,arguments);return Object.keys(e).forEach((function(t){null===e[t]&&delete e[t]})),e},Up=Qd.xhr.httpHandler;Up||(Up=function(e,t){return function(i,s,r){if(i)e(i);else{if(s.statusCode>=400&&s.statusCode<=599){var n=r;return t&&(n=String.fromCharCode.apply(null,new Uint8Array(r))),void e({cause:n})}e(null,r)}}});var Bp=function(e,t,i,s){var r=function(e){var t=String.fromCharCode.apply(null,new Uint16Array(e)),i=(new u.DOMParser).parseFromString(t,"application/xml"),s=i.getElementsByTagName("HttpHeaders")[0],r={};if(s)for(var n=s.getElementsByTagName("name"),a=s.getElementsByTagName("value"),o=0;o<n.length;o++)r[n[o].childNodes[0].nodeValue]=a[o].childNodes[0].nodeValue;var l,d=i.getElementsByTagName("Challenge")[0];return d&&(l=u.atob(d.childNodes[0].nodeValue)),i.querySelector("parsererror")&&(r={"Content-Type":"text/xml; charset=utf-8",SOAPAction:'"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"'},l=e),{headers:r,message:l}}(t),n=r.message,a=Np(r.headers,i.emeHeaders,e.licenseHeaders);Qd.xhr({uri:e.url,method:"post",headers:a,body:n,responseType:"arraybuffer"},Up(s,!0))},Fp=function(e){var t;return Object.keys(e).forEach((function(i){var s=function(e){if(e.supportedConfigurations)return e.supportedConfigurations;var t={},i=e.audioContentType,s=e.audioRobustness,r=e.videoContentType,n=e.videoRobustness,a=e.persistentState;return(i||s)&&(t.audioCapabilities=[Lp({},i?{contentType:i}:{},s?{robustness:s}:{})]),(r||n)&&(t.videoCapabilities=[Lp({},r?{contentType:r}:{},n?{robustness:n}:{})]),a&&(t.persistentState=a),[t]}(e[i]);t=t?t.catch((function(e){return u.navigator.requestMediaKeySystemAccess(i,s)})):u.navigator.requestMediaKeySystemAccess(i,s)})),t},qp=function e(t,i){var s=i.mediaKeys,r=i.initDataType,n=i.initData,a=i.options,o=i.getLicense,l=i.removeSession,d=i.eventBus,c=s.createSession();return d.trigger("keysessioncreated"),t.on("dispose",(function(){c.close()})),new Promise((function(s,u){c.addEventListener("message",(function(e){"license-request"!==e.messageType&&"license-renewal"!==e.messageType||o(a,e.message).then((function(e){s(c.update(e))})).catch((function(e){u(e)}))}),!1),c.addEventListener("keystatuseschange",(function(s){var r=!1;c.keyStatuses.forEach((function(e,t){switch(d.trigger({keyId:t,status:e,target:c,type:"keystatuschange"}),e){case"expired":r=!0;break;case"internal-error":Qd.log.warn('Key status reported as "internal-error." Leaving the session open since we don\'t have enough details to know if this error is fatal.',s)}})),r&&c.close().then((function(){l(n),e(t,i)}))}),!1),c.generateRequest(r,n).catch((function(){u("Unable to create or initialize key session")}))}))},jp=function(e,t){return function(i,s){return new Promise((function(r,n){e(i,s,(function(e,i){t&&t.trigger("licenserequestattempted"),e?n(e):r(i)}))}))}},$p=function(e,t){if("string"==typeof t&&(t={url:t}),!t.url&&!t.getLicense)throw new Error("Neither URL nor getLicense function provided to get license");return t.url&&!t.getLicense&&(t.getLicense="com.microsoft.playready"===e?function(e){return function(t,i,s){Bp(e,i,t,s)}}(t):function(e){return function(t,i,s){var r=Np({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Qd.xhr({uri:e.url,method:"POST",responseType:"arraybuffer",body:i,headers:r},Up(s,!0))}}(t)),t},Vp=function(e){var t,i,s=e.player,r=e.video,n=e.initDataType,a=e.initData,o=e.keySystemAccess,l=e.options,d=e.removeSession,c=e.eventBus,u=Promise.resolve();void 0===r.mediaKeysObject&&(r.mediaKeysObject=null,r.pendingSessionData=[],u=new Promise((function(e,s){r.keySystem=o.keySystem,(i=$p(o.keySystem,l.keySystems[o.keySystem])).getCertificate?i.getCertificate(l,(function(i,r){i?s(i):(t=r,e())})):e(o)})).then((function(){return o.createMediaKeys()})).then((function(e){return function(e){var t=e.player,i=e.video,s=e.certificate,r=e.createdMediaKeys;i.mediaKeysObject=r;var n=[];s&&n.push(r.setServerCertificate(s));for(var a=0;a<i.pendingSessionData.length;a++){var o=i.pendingSessionData[a];n.push(qp(t,{mediaKeys:i.mediaKeysObject,initDataType:o.initDataType,initData:o.initData,options:o.options,getLicense:o.getLicense,removeSession:o.removeSession,eventBus:o.eventBus}))}return i.pendingSessionData=[],n.push(i.setMediaKeys(r)),Promise.all(n)}({player:s,video:r,certificate:t,createdMediaKeys:e})})).catch((function(e){return e?Promise.reject(e):Promise.reject("Failed to create and initialize a MediaKeys object")})));return u.then((function(){var e=$p(r.keySystem,l.keySystems[r.keySystem]).getLicense;return function(e){var t=e.player,i=e.video,s=e.initDataType,r=e.initData,n=e.options,a=e.getLicense,o=e.removeSession,l=e.eventBus;return i.mediaKeysObject?qp(t,{mediaKeys:i.mediaKeysObject,initDataType:s,initData:r,options:n,getLicense:a,removeSession:o,eventBus:l}):(i.pendingSessionData.push({initDataType:s,initData:r,options:n,getLicense:a,removeSession:o,eventBus:l}),Promise.resolve())}({player:s,video:r,initDataType:n,initData:a,options:l,getLicense:r.keySystem?jp(e,c):null,removeSession:d,eventBus:c})}))},Hp="com.apple.fps.1_0",zp=function(e){var t=e.initData,i=e.id,s=e.cert;"string"==typeof i&&(i=function(e){for(var t=new ArrayBuffer(2*e.length),i=new Uint16Array(t),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i}(i));var r=0,n=new ArrayBuffer(t.byteLength+4+i.byteLength+4+s.byteLength),a=new DataView(n);new Uint8Array(n,r,t.byteLength).set(t),r+=t.byteLength,a.setUint32(r,i.byteLength,!0),r+=4;var o=new Uint16Array(n,r,i.length);return o.set(i),r+=o.byteLength,a.setUint32(r,s.byteLength,!0),r+=4,new Uint8Array(n,r,s.byteLength).set(s),new Uint8Array(n,0,n.byteLength)},Wp=function(e,t){return r=t,i=String.fromCharCode.apply(null,new Uint16Array(r.buffer)),(s=y.createElement("a")).href=i,s.hostname;var i,s,r},Gp=function(e){var t=e.video,i=e.initData,s=e.options,r=e.eventBus,n=s.keySystems[Hp],a=n.getCertificate||function(e){return function(t,i){var s=Np(t.emeHeaders,e.certificateHeaders);Qd.xhr({uri:e.certificateUri,responseType:"arraybuffer",headers:s},Up((function(e,t){e?i(e):i(null,new Uint8Array(t))})))}}(n),o=n.getContentId||Wp,l=n.getLicense||function(e){return function(t,i,s,r){var n=Np({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Qd.xhr({uri:e.licenseUri,method:"POST",responseType:"arraybuffer",body:s,headers:n},Up(r,!0))}}(n);return new Promise((function(e,t){a(s,(function(i,s){i?t(i):e(s)}))})).then((function(e){return function(e){var t=e.video,i=e.contentId,s=e.initData,r=e.cert,n=e.options,a=e.getLicense,o=e.eventBus;return new Promise((function(e,l){if(!t.webkitKeys)try{t.webkitSetMediaKeys(new u.WebKitMediaKeys(Hp))}catch(e){return void l("Could not create MediaKeys")}var d;try{d=t.webkitKeys.createSession("video/mp4",zp({id:i,initData:s,cert:r}))}catch(e){return void l("Could not create key session")}o.trigger("keysessioncreated"),d.contentId=i,d.addEventListener("webkitkeymessage",(function(e){a(n,i,e.message,(function(e,t){o&&o.trigger("licenserequestattempted"),e?l(e):d.update(new Uint8Array(t))}))})),d.addEventListener("webkitkeyadded",(function(){e()})),d.addEventListener("webkitkeyerror",(function(){var e=d.error;l("KeySession error: code "+e.code+", systemCode "+e.systemCode)}))}))}({video:t,cert:e,initData:i,getLicense:l,options:s,contentId:o(s,i),eventBus:r})}))},Kp="com.microsoft.playready",Xp=function(e,t,i,s){var r=e.msKeys.createSession("video/mp4",t);if(!r)throw new Error("Could not create key session.");s.trigger("keysessioncreated"),r.addEventListener("mskeymessage",(function(e){!function(e,t,i,s){var r=e.keySystems[Kp];if("function"!=typeof r.getKey){"string"==typeof r?r={url:r}:"boolean"==typeof r&&(r={}),r.url||(r.url=i.destinationURL);var n=function(e,i){s&&s.trigger("licenserequestattempted"),e?s.trigger({message:"Unable to request key from url: "+r.url,target:t,type:"mskeyerror"}):t.update(new Uint8Array(i))};r.getLicense?r.getLicense(e,i.message.buffer,n):Bp(r,i.message.buffer,e,n)}else r.getKey(e,i.destinationURL,i.message.buffer,(function(e,i){e?s.trigger({message:"Unable to get key: "+e,target:t,type:"mskeyerror"}):t.update(i)}))}(i,r,e,s)})),r.addEventListener("mskeyerror",(function(e){s.trigger({message:"Unexpected key error from key session with code: "+r.error.code+" and systemCode: "+r.error.systemCode,target:r,type:"mskeyerror"})})),r.addEventListener("mskeyadded",(function(){s.trigger({target:r,type:"mskeyadded"})}))},Yp=function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData===t)return void e.splice(i,1)},Qp=function(e,t,i,s,r){if(!i||!i.keySystems)return Promise.resolve();var n=t.initData;return Fp(i.keySystems).then((function(a){var o=a.keySystem;return i.keySystems[o]&&i.keySystems[o].pssh&&(n=i.keySystems[o].pssh),function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData){var s=Rp(e[i].initData),r=Rp(t);if(Op(s,r))return!0}return!1}(s,n)||!n?Promise.resolve():(s.push({initData:n}),Vp({player:e,video:t.target,initDataType:t.initDataType,initData:n,keySystemAccess:a,options:i,removeSession:Yp.bind(null,s),eventBus:r}))}))},Jp=function(e,t,i,s){if(t.keySystems&&t.keySystems[Kp]&&!i.reduce((function(e,t){return e||t.playready}),!1)){var r=e.initData;t.keySystems[Kp]&&t.keySystems[Kp].pssh&&(r=t.keySystems[Kp].pssh),r&&(i.push({playready:!0,initData:r}),function(e){var t=e.video,i=e.initData,s=e.options,r=e.eventBus;t.msKeys&&delete t.msKeys;try{t.msSetMediaKeys(new u.MSMediaKeys(Kp))}catch(e){throw new Error("Unable to create media keys for PlayReady key system. Error: "+e.message)}Xp(t,i,s,r)}({video:e.target,initData:r,options:t,eventBus:s}))}},Zp=function(e){return Mp(e.currentSource(),e.eme.options)},em=function(e){var t=e.src();t!==e.eme.activeSrc&&(e.eme.activeSrc=t,e.eme.sessions=[])},tm=function(e,t){if("video"===e.$(".vjs-tech").tagName.toLowerCase())if(em(e),u.WebKitMediaKeys){var i=function(i){em(e),function(e,t,i){return t.keySystems&&t.keySystems[Hp]&&e.initData?Gp({video:e.target,initData:e.initData,options:t,eventBus:i}):Promise.resolve()}(i,Zp(e),e.tech_).catch(t)};e.tech_.el_.addEventListener("webkitneedkey",(function(t){var s=Zp(e).firstWebkitneedkeyTimeout||1e3,r=e.src();e.eme.webkitneedkey_=e.eme.webkitneedkey_||{},e.eme.webkitneedkey_.src!==r&&(e.eme.webkitneedkey_={handledFirstEvent:!1,src:r}),e.eme.webkitneedkey_.handledFirstEvent?i(t):(e.clearTimeout(e.eme.webkitneedkey_.timeout),e.eme.webkitneedkey_.timeout=e.setTimeout((function(){e.eme.webkitneedkey_.handledFirstEvent=!0,e.eme.webkitneedkey_.timeout=null,i(t)}),s))}))}else u.MediaKeys?e.tech_.el_.addEventListener("encrypted",(function(i){em(e),Qp(e,i,Zp(e),e.eme.sessions,e.tech_).catch(t)})):u.MSMediaKeys&&(e.tech_.el_.addEventListener("msneedkey",(function(i){em(e);try{Jp(i,Zp(e),e.eme.sessions,e.tech_)}catch(e){t(e)}})),e.tech_.on("mskeyerror",t),e.on("dispose",(function(){e.tech_.off("mskeyerror",t)})))},im=function(e){void 0===e&&(e={});var t=this,i=function(e){return function(t){var i={code:5};"string"==typeof t?i.message=t:t&&(t.message&&(i.message=t.message),t.cause&&(t.cause.length||t.cause.byteLength)&&(i.cause=t.cause)),e.error(i)}}(t);t.ready((function(){return tm(t,i)})),t.eme={initializeMediaKeys:function(s,r,n){void 0===s&&(s={}),void 0===r&&(r=function(){}),void 0===n&&(n=!1);var a=Mp(t.currentSource(),e,s),o={initDataType:"cenc",initData:null,target:t.tech_.el_};if(em(t),t.tech_.el_.setMediaKeys)Qp(t,o,a,t.eme.sessions,t.tech_).then((function(){return r()})).catch((function(e){r(e),n||i(e)}));else if(t.tech_.el_.msSetMediaKeys){var l=function e(s){t.tech_.off("mskeyadded",e),t.tech_.off("mskeyerror",e),"mskeyerror"===s.type?(r(s.target.error),n||i(s.message)):r()};t.tech_.one("mskeyadded",l),t.tech_.one("mskeyerror",l);try{Jp(o,a,t.eme.sessions,t.tech_)}catch(e){t.tech_.off("mskeyadded",l),t.tech_.off("mskeyerror",l),r(e),n||i(e)}}},options:e}};Qd.registerPlugin("eme",im),im.VERSION="3.11.2";const sm=Qd.getComponent("player");Qd.registerComponent("player",class extends sm{constructor(e,t,i){super(e,t=Qd.obj.merge(t,{plugins:{eme:!0}}),i)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:i,language:s}=e,r=t.find((e=>e.language===s&&e.kind===i))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const i=this.buffered().start(t),s=this.buffered().end(t);e.push({start:i,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const i=this.played().start(t),s=this.played().end(t);e.push({start:i,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const i=this.seekable().start(t),s=this.seekable().end(t);e.push({start:i,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:i,language:s}=e;return t.find((e=>(e.language===s&&e.kind===i&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const rm=Qd;rm.VERSION={pillarbox:"1.15.0",videojs:Qd.VERSION,[Qd.VhsSourceHandler.name]:Qd.VhsSourceHandler.VERSION,eme:Qd.getPlugin("eme").VERSION},rm.options.enableSmoothSeeking=!0,rm.options.fill=!0,rm.options.html5={vhs:{useForcedSubtitles:!0}},rm.options.liveTracker={trackingThreshold:120,liveTolerance:15},rm.options.liveui=!0,rm.options.playsinline=!0,rm.options.responsive=!0,rm.options.trackers={};class nm{constructor(e="il.srgssr.ch"){this.setIlHost(e)}setIlHost(e){this.baseUrl=`${e}/integrationlayer/2.1/`}handleRequest(e){var t=this;return function(){var i=r((function*(i){const s="function"==typeof e?e(i):t.mediaCompositionUrlHandler(i),r=yield fetch(s);if(!r.ok)throw r;return yield r.json()}));return function(e){return i.apply(this,arguments)}}()}mediaCompositionUrlHandler(e){return`https://${this.baseUrl}mediaComposition/byUrn/${e}?onlyChapters=true&vector=portalplay`}}const am="240",om="320",lm="480",dm="960",cm="1920",um="jpg",hm="webp",pm="png";class mm{static scale({url:e,width:t=dm,format:i=um}={},s="https://il.srgssr.ch/images/"){if(!e)return;const r=new URL(s);return r.searchParams.set("imageUrl",e),r.searchParams.set("format",i),r.searchParams.set("width",t),decodeURIComponent(r.href)}static get JPG(){return um}static get PNG(){return pm}static get WEBP(){return hm}static get WIDTH_240(){return am}static get WIDTH_320(){return om}static get WIDTH_480(){return lm}static get WIDTH_960(){return dm}static get WIDTH_1920(){return cm}}const gm={WIDEVINE:"com.widevine.alpha",FAIRPLAY:"com.apple.fps.1_0",PLAYREADY:"com.microsoft.playready"};class fm{static buildKeySystems(e=[]){const t={};return e.forEach((e=>{const i=fm.vendors[e.type];if(fm.vendors.FAIRPLAY===i){const{certificateUrl:s,licenseUrl:r}=e;t[i]={certificateUri:s,licenseUri:r}}else t[i]=e.licenseUrl})),{keySystems:t}}static hasDrm(e){return e.some((({drmList:e})=>e&&e.length>0))}static get vendors(){return gm}}const ym="AKAMAI",_m="NONE";class vm{static aclPath(e){const t=e.pathname;return`${t.substring(0,t.lastIndexOf("/")+1)}*`}static get AKAMAI(){return ym}static hasToken(e){return e.some((e=>vm.isAkamai(e.tokenType)))}static isAkamai(e){return ym===e}static isNone(e){return _m===e}static get NONE(){return _m}static tokenize(e,t){const i=new URL(`${e.url}`),s=vm.aclPath(i),r=`${t}${encodeURIComponent(s)}`;return fetch(r).then((e=>e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText}))).then((({token:{authparams:t}})=>(new URLSearchParams(t).forEach(((e,t)=>i.searchParams.set(t,e))),Object.assign({},e,{url:i.toString()})))).catch((e=>Promise.reject(e)))}static tokenizeSources(e,t="https://tp.srgssr.ch/akahd/token?acl="){const i=[];return e.forEach((e=>{const s=vm.tokenize(e,t);i.push(s)})),Promise.all(i).then((e=>e)).catch((e=>Promise.reject(e)))}}const bm="emptied",Tm="ended",Sm="loadeddata",wm="loadstart",Em="pause",km="play",Cm="playing",xm="ratechange",Im="seeking",Am="timeupdate",Dm="waiting";class Pm{constructor(e,{debug:t=!1,environment:i="prod",playerVersion:s="none",tagCommanderScriptURL:r="//colibri-js.akamaized.net/penguin/tc_SRGGD_11.js"}={}){this.isDebugEnabled=t,this.elapsedPlaybackTime=0,this.environment=i,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isSeeking=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.pendingTagCommanderReload=!1,this.player=e,this.playerVersion=s,this.srcMediaData=void 0,this.startPlaybackSession=0,this.tagCommanderScriptURL=r,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0,this.initScript(),this.initListeners()}beforeunload(){this.notify("stop")}clearTimers(){clearInterval(this.heartBeatIntervalId),clearInterval(this.uptimeIntervalId),clearTimeout(this.uptimeTimeoutId)}currentTime(){return Math.round(this.trackedCurrentTime)}debug(e){if(void 0===e)return this.isDebugEnabled||this.player.debug();this.isDebugEnabled=Boolean(e)}destroy(){this.clearTimers(),window.tc_vars||(window.tc_vars={}),this.elapsedPlaybackTime=0,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.srcMediaData=void 0,this.startPlaybackSession=0,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0}dispose(){this.beforeunload(),this.clearTimers(),window.removeEventListener("beforeunload",this.beforeunloadListener),this.player.off(bm,this.emptiedListener),this.player.off(Tm,this.endedListener),this.player.off(wm,this.loadstartListener),this.player.off(Sm,this.loadeddataListener),this.player.off(Cm,this.playListener),this.player.off(Em,this.pauseListener),this.player.off(xm,this.rateChangeListener),this.player.off(Im,this.seekingListener),this.player.off(Am,this.timeUpdateListener),this.player.off(Dm,this.waitingListener)}emptied(){this.player.ended()||this.notify("stop")}ended(){this.notify("eof"),this.mediaSession=0,this.clearTimers()}flush(){this.isTrackerDisabled()||(this.pendingTagCommanderReload&&window.tC&&(window.tC.container.reload(),this.pendingTagCommanderReload=!1),window.tc_events_11&&this.pendingQueue.length>0&&(this.pendingQueue.forEach((e=>{window.tc_events_11(this.player.el(),e.action,e.labels)})),this.pendingQueue=[]))}getCurrentAudioTrack(){const e=Array.from(this.player.audioTracks()).find((e=>e.enabled));let t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getCurrentTextTrack(){const e=this.player.textTrack();let t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getDvrWindowPosition(){const{liveTracker:e}=this.player,t=this.currentTime()-e.seekableStart()|0,i=e.liveWindow()-t;return i<0||i===1/0?0:1e3*i}getDvrWindowSize(){const e=this.player.liveTracker.liveWindow()===1/0,t=1e3*this.player.liveTracker.liveWindow();return e?0:t}getElapsedPlaybackTime(){return this.startPlaybackSession?this.getElapsedPlayingTime():this.elapsedPlaybackTime}getElapsedPlayingTime(){const e=Pm.now()-this.startPlaybackSession|0;return this.elapsedPlaybackTime+e}getEventLabels(e){const t={event_id:e,event_timestamp:Pm.now(),media_dvr_window_length:0,media_dvr_window_offset:0,media_is_dvr:!1,media_is_live:!1,media_mute:this.player.muted()?"1":"0",media_playback_rate:this.player.playbackRate(),media_position:this.currentTime(),media_quality:this.srcMediaData.mediaData.quality,media_subtitles_on:this.isTextTrackEnabled(),media_volume:(100*this.player.volume()).toFixed(0),navigation_environment:this.environment};return this.isAudioTrackEnabled()&&(t.media_audio_track=this.getCurrentAudioTrack(),t.media_audiodescription_on=this.isAudioDescriptionEnabled()),this.isTextTrackEnabled()&&(t.media_subtitle_selection=this.getCurrentTextTrack()),this.isMediaOnDemand()||(t.media_is_live=!0,t.media_position=this.getElapsedPlaybackTime()),this.isMediaDvr()&&(t.media_dvr_window_offset=0|this.getDvrWindowPosition(),t.media_dvr_window_length=0|this.getDvrWindowSize(),t.media_is_dvr=!0,t.media_timeshift=[km,Em].includes(e)?this.timeShifted():0),t}getInternalLabels(){const e={media_bu_distributer:this.srcMediaData.mediaData.vendor,media_chromecast_selected:Boolean(this.player.tech(!0).isCasting),media_embedding_url:document.referrer,media_player_display:"default",media_player_name:"pillarbox-web",media_player_version:this.playerVersion,media_url:this.srcMediaData.src},t=this.srcMediaData.mediaData.analyticsMetadata||{};window.tc_vars=Object.assign({},window.tc_vars,e,t)}heartBeat(){this.heartBeatIntervalId=setInterval((()=>{this.player.paused()||this.notify("pos")}),3e4)}initCallbacks(){this.beforeunloadListener=this.beforeunload.bind(this),this.emptiedListener=this.emptied.bind(this),this.endedListener=this.ended.bind(this),this.loadstartListener=this.loadstart.bind(this),this.loadeddataListener=this.loadeddata.bind(this),this.playListener=this.play.bind(this),this.pauseListener=this.pause.bind(this),this.rateChangeListener=this.rateChange.bind(this),this.seekingListener=this.seeking.bind(this),this.timeUpdateListener=this.timeUpdate.bind(this),this.waitingListener=this.waiting.bind(this)}initListeners(){this.initCallbacks(),window.addEventListener("beforeunload",this.beforeunloadListener),this.player.on(bm,this.emptiedListener),this.player.on(Tm,this.endedListener),this.player.on(wm,this.loadstartListener),this.player.on(Sm,this.loadeddataListener),this.player.on(Cm,this.playListener),this.player.on(Em,this.pauseListener),this.player.on(xm,this.rateChangeListener),this.player.on(Im,this.seekingListener),this.player.on(Am,this.timeUpdateListener),this.player.on(Dm,this.waitingListener),this.player.one("dispose",this.dispose.bind(this))}initScript(){const e="tc_script__11";if(!document.querySelector(`#${e}`)){const t=document.createElement("script"),i=this.tagCommanderScriptURL;t.defer=!0,t.id=e,t.src=i,t.type="text/javascript",t.onload=e=>{this.flush()},document.body.appendChild(t)}}isAudioDescriptionEnabled(){const e=Array.from(this.player.audioTracks()).find((e=>e.enabled&&e.kind.includes("desc")));return Boolean(e)}isAudioTrackEnabled(){return!!this.getCurrentAudioTrack()}isMediaDvr(){const{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&&e<this.player.liveTracker.liveWindow()}isMediaLive(){const{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&&e>this.player.liveTracker.liveWindow()}isMediaOnDemand(){return Number.isFinite(this.player.duration())}isTextTrackEnabled(){return!!this.getCurrentTextTrack()}isTrackerDisabled(){return!this.srcMediaData||!this.srcMediaData.mediaData||(Array.isArray(this.srcMediaData.disableTrackers)?Boolean(this.srcMediaData.disableTrackers.find((e=>e.toLowerCase()===Pm.name.toLowerCase()))):Boolean(this.srcMediaData.disableTrackers))}loadstart(){this.destroy(),this.updateSrcMediaData(this.player.currentSource()),this.isTrackerDisabled()||(this.getInternalLabels(),this.reloadTagCommanderContainer(),this.notify("buffer_start"),this.hasStarted=!1)}loadeddata(){this.notify("init"),this.initialized=!0,this.notify("buffer_stop")}log(e,t,i="log"){this.debug()&&console[i](`SRGAnalytics:${e}`,t,window.tc_vars)}notify(e,t){if(this.isTrackerDisabled())return;try{this.flush()}catch(t){this.log(e,t,"error")}const i=Object.assign({},this.getEventLabels(e),t);this.log(e,i);try{window.tc_events_11?window.tc_events_11(this.player.el(),e,i):this.pendingQueue.push({action:e,labels:i})}catch(t){this.log(e,t,"error")}}static now(){return(Date.now()/1e3).toFixed(0)}play(){this.hasStarted||(this.hasStarted=!0),this.startPlaybackSession||this.isMediaOnDemand()||(this.startPlaybackSession=Pm.now()),0===this.mediaSession&&(this.mediaSession=Pm.now(),this.heartBeat(),this.uptime()),this.timeUpdate(),this.notify("play"),this.isSeeking&&(this.isSeeking=!1)}pause(){this.isMediaOnDemand()||(this.elapsedPlaybackTime=this.getElapsedPlayingTime(),this.startPlaybackSession=0),!this.player.seeking()&&!this.isMediaLive()&&this.player.currentTime()<this.player.duration()?this.notify("pause"):this.hasStarted&&!this.isSeeking&&(this.notify("seek"),this.isSeeking=!0)}rateChange(){this.notify("change_playback_rate")}reloadTagCommanderContainer(){window.tC?(window.tC.container.reload(),this.pendingTagCommanderReload=!1):this.pendingTagCommanderReload=!0}seeking(){!this.hasStarted||this.player.paused()||this.isSeeking||(this.notify("seek"),this.isSeeking=!0)}timeUpdate(){this.player.paused()||(this.trackedCurrentTime=this.player.currentTime())}timeShifted(){const e=this.player.liveTracker.atLiveEdge(),t=this.player.liveTracker.liveCurrentTime(),i=this.player.currentTime();return e?0:(t-i).toFixed(0)}updateSrcMediaData(e){this.srcMediaData=e}uptime(){const e=()=>{this.player.paused()||this.isMediaOnDemand()||this.notify("uptime")};this.uptimeTimeoutId=setTimeout((()=>{e(),this.uptimeIntervalId=setInterval((()=>{e()}),6e4)}),3e4)}waiting(){if(!this.initialized||this.isWaiting)return;const e=()=>{this.isWaiting=!1,this.notify("buffer_stop")};this.isWaiting=!0,this.notify("buffer_start"),rm.browser.IS_ANY_SAFARI?this.player.one(Am,e):this.player.one(Cm,e)}}class Lm{constructor(e,{playerName:t="none",playerVersion:i="none",platform:s="Web",schemaVersion:r=1,heartbeatInterval:n=3e4,beaconUrl:a="https://monitoring.pillarbox.ch/api/events"}={}){this.player=e,this.playerName=t,this.playerVersion=i,this.platform=s,this.schemaVersion=r,this.heartbeatInterval=n,this.beaconUrl=a,this.currentSessionId=void 0,this.lastPlaybackDuration=0,this.lastPlaybackStartTimestamp=0,this.lastStallCount=0,this.lastStallDuration=0,this.loadStartTimestamp=void 0,this.metadataRequestTime=0,this.mediaAssetUrl=void 0,this.mediaId=void 0,this.mediaMetadataUrl=void 0,this.mediaOrigin=void 0,this.tokenRequestTime=0,this.addListeners()}addListeners(){this.bindCallBacks(),this.player.on("loadstart",this.loadStart),this.player.on("loadeddata",this.loadedData),this.player.on("playing",this.playbackStart),this.player.on("pause",this.playbackStop),this.player.on("error",this.error),this.player.on(["playerreset","dispose","ended"],this.sessionStop),this.player.on(["waiting","stalled"],this.stalled),window.addEventListener("beforeunload",this.sessionStop)}bandwidth(){const e=this.player.tech(!0).vhs?this.player.tech(!0).vhs.stats:void 0;return e?e.bandwidth:void 0}bindCallBacks(){this.error=this.error.bind(this),this.loadedData=this.loadedData.bind(this),this.loadStart=this.loadStart.bind(this),this.playbackStart=this.playbackStart.bind(this),this.playbackStop=this.playbackStop.bind(this),this.stalled=this.stalled.bind(this),this.sessionStop=this.sessionStop.bind(this)}bufferDuration(){const e=this.player.buffered();let t=0;for(let i=0;i<e.length;i++){const s=e.start(i);t+=e.end(i)-s}return Lm.secondsToMilliseconds(t)}currentRepresentation(){const{activeCues:{cues_:[e]}={cues_:[]}}=Array.from(this.player.textTracks()).find((({label:e,kind:t})=>"metadata"===t&&"segment-metadata"===e))||{};return e?e.value:void 0}currentResource(){let{bandwidth:e,uri:t}=this.currentRepresentation()||{};if(rm.browser.IS_ANY_SAFARI){const{configuration:i}=Array.from(this.player.videoTracks()).find((e=>e.selected))||{};e=i?i.bitrate:void 0,t=this.player.currentSource().src}return{bitrate:e,url:t}}currentSourceMediaData(){return this.player.currentSource().mediaData?this.player.currentSource().mediaData:{}}error(){const e=this.player.error(),i=this.playbackPosition(),s=this.currentRepresentation(),r=s?s.uri:this.player.currentSource().src;this.player.hasStarted()||this.sendEvent("START",this.startEventData()),this.sendEvent("ERROR",t(t({log:JSON.stringify(e.metadata||rm.log.history().slice(-15)),message:e.message,name:e.code},i),{},{url:r})),this.reset()}getDrmRequestDuration(){const e=Object.values(this.player.currentSource().keySystems||{}).map((e=>e.url));if(!e.length)return;const t=performance.getEntriesByType("resource").filter((({initiatorType:t,name:i})=>"xmlhttprequest"===t&&e.includes(i))).pop();return t&&t.duration}getMetadataInfo(e){const t=performance.getEntriesByType("resource").filter((({initiatorType:t,name:i})=>"fetch"===t&&i.includes(e))).pop();return t?{name:t.name,duration:t.duration}:{}}getTokenRequestDuration(e){if(!e)return;const t=performance.getEntriesByType("resource").filter((({initiatorType:e,name:t})=>"fetch"===e&&t.includes("/akahd/token"))).pop();return t&&t.duration}heartbeat(){this.heartbeatIntervalId=setInterval((()=>{this.sendEvent("HEARTBEAT",this.statusEventData())}),this.heartbeatInterval)}isTrackerDisabled(){const e=this.player.currentSource();return Array.isArray(e.disableTrackers)?Boolean(e.disableTrackers.find((e=>e.toLowerCase()===Lm.name.toLowerCase()))):Boolean(e.disableTrackers)}loadedData(){this.sendEvent("START",this.startEventData()),this.sendEvent("HEARTBEAT",this.statusEventData()),this.heartbeat()}loadStart(){!Object.keys(this.currentSourceMediaData()).length&&this.currentSessionId&&(this.sessionStop(),this.sessionStartTimestamp=Lm.timestamp()),this.loadStartTimestamp=Lm.timestamp()}mediaInfo(){return{asset_url:this.mediaAssetUrl,id:this.mediaId,metadata_url:this.mediaMetadataUrl,origin:this.mediaOrigin}}playbackDuration(){return this.lastPlaybackStartTimestamp?Lm.timestamp()+this.lastPlaybackDuration-this.lastPlaybackStartTimestamp:this.lastPlaybackDuration}playbackPosition(){const e=this.currentRepresentation(),t=Lm.secondsToMilliseconds(this.player.currentTime());let i;if(e&&(i=e.programDateTime),rm.browser.IS_ANY_SAFARI){const e=Date.parse(this.player.$("video").getStartDate());i=isNaN(e)?void 0:e+t}return{position:t,position_timestamp:i}}playbackStart(){this.lastPlaybackStartTimestamp=Lm.timestamp()}playbackStop(){this.lastPlaybackDuration+=Lm.timestamp()-this.lastPlaybackStartTimestamp,this.lastPlaybackStartTimestamp=0}playerCurrentDimensions(){return this.player.currentDimensions()}playerInfo(){return{name:this.playerName,version:this.playerVersion,platform:this.platform}}qoeTimings(e,t){return{metadata:this.metadataRequestTime,asset:e,total:t-this.sessionStartTimestamp}}qosTimings(e){return{asset:e,drm:this.getDrmRequestDuration(),metadata:this.metadataRequestTime,token:this.tokenRequestTime}}removeListeners(){this.player.off("loadstart",this.loadStart),this.player.off("loadeddata",this.loadedData),this.player.off("playing",this.playbackStart),this.player.off("pause",this.playbackStop),this.player.off("error",this.error),this.player.off(["playerreset","dispose","ended"],this.sessionStop),this.player.off(["waiting","stalled"],this.stalled),window.removeEventListener("beforeunload",this.sessionStop)}removeTokenFromAssetUrl(e){if(e)try{const t=new URL(e);return t.searchParams.delete("hdnts"),t.href}catch(e){return}}reset(e){this.currentSessionId=void 0,this.lastPlaybackDuration=0,this.lastPlaybackStartTimestamp=0,this.lastStallCount=0,this.lastStallDuration=0,this.loadStartTimestamp=0,this.metadataRequestTime=0,this.mediaAssetUrl=void 0,this.mediaId=void 0,this.mediaMetadataUrl=void 0,this.mediaOrigin=void 0,this.sessionStartTimestamp=void 0,this.tokenRequestTime=0,clearInterval(this.heartbeatIntervalId),e&&!["ended","playerreset"].includes(e.type)&&this.removeListeners()}sendEvent(e,t={}){if(this.isTrackerDisabled()&&!this.currentSessionId||!this.currentSessionId)return;const i=JSON.stringify({event_name:e,session_id:this.currentSessionId,timestamp:Lm.timestamp(),version:this.schemaVersion,data:t});navigator.sendBeacon(this.beaconUrl,i)}sessionStart(){this.sessionStartTimestamp&&this.sessionStop(),this.sessionStartTimestamp=Lm.timestamp(),this.mediaId=this.player.currentSource().src||void 0}sessionStop(e){this.sendEvent("STOP",this.statusEventData()),this.reset(e)}stalled(){if(!this.player.hasStarted()||this.player.seeking()||this.isStalled)return;this.isStalled=!0;const e=Lm.timestamp(),t=()=>{const t=Lm.timestamp();this.isStalled=!1,this.lastStallCount+=1,this.lastStallDuration+=t-e};rm.browser.IS_ANY_SAFARI?this.player.one("timeupdate",t):this.player.one("playing",t)}stallInfo(){return{count:this.lastStallCount,duration:this.lastStallDuration}}statusEventData(){const e=this.bandwidth(),t=this.bufferDuration(),{bitrate:i,url:s}=this.currentResource(),{droppedVideoFrames:r}=this.player.getVideoPlaybackQuality(),n=this.playbackDuration(),{position:a,position_timestamp:o}=this.playbackPosition(),l=isFinite(this.player.duration())?"On-demand":"Live";return{bandwidth:e,bitrate:i,buffered_duration:t,frame_drops:r,playback_duration:n,position:a,position_timestamp:o,stall:this.stallInfo(),stream_type:l,url:s}}startEventData(){const e=Lm.timestamp(),t=this.loadStartTimestamp?e-this.loadStartTimestamp:0;return this.isTrackerDisabled()||(this.currentSessionId=Lm.sessionId()),this.mediaAssetUrl=this.removeTokenFromAssetUrl(this.player.currentSource().src),this.mediaMetadataUrl=this.getMetadataInfo(this.mediaId).name,this.metadataRequestTime=this.getMetadataInfo(this.mediaId).duration,this.mediaOrigin=window.location.href,this.tokenRequestTime=this.getTokenRequestDuration(this.currentSourceMediaData().tokenType),{browser:Lm.userAgent(),device:{id:Lm.deviceId()},media:this.mediaInfo(),player:this.playerInfo(),qoe_timings:this.qoeTimings(t,e),qos_timings:this.qosTimings(t),screen:this.playerCurrentDimensions()}}static sessionId(){return Lm.randomUUID()}static deviceId(){if(!localStorage)return;const e="pillarbox_device_id";let t=localStorage.getItem(e);return t||(t=Lm.randomUUID(),localStorage.setItem(e,t)),t}static randomUUID(){return crypto.randomUUID?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)))}static secondsToMilliseconds(e){return parseInt(1e3*e)}static timestamp(){return Date.now()}static userAgent(){return{user_agent:navigator.userAgent}}}class Om{findChapterByUrn(e){if(this.chapterList){const[t]=this.chapterList.filter((t=>t.urn===e));return t}}findMainSegment(){if(!this.segmentUrn)return;const e=this.getMainSegments(),[t]=e.filter((e=>e.urn===this.segmentUrn));return t}findResourceListByUrn(e){const t=this.findChapterByUrn(e);if(t)return t.resourceList||[]}getChapters(){const e="AUDIO";return this.getMainChapter().mediaType===e?[]:this.chapterList.filter((({mediaType:t})=>t!==e))}getFilteredExternalSubtitles(){const{subtitleList:e}=this.getMainChapter(),[{subtitleInformationList:t}={}]=this.getResourceList().filter((({subtitleInformationList:e})=>e)),i=e&&!t;if(!e)return[];const s=e.filter((e=>"TTML"!==e.format));return i?s:s.filter((e=>!t.find((t=>t.locale===e.locale&&e.type===t.type))))}getMainBlockReason(){const e=this.getMainChapter();if(!e)return;let{blockReason:t}=e;return!t&&new Date<this.getMainValidFromDate()&&(t="STARTDATE"),t}getMainBlockedSegments(){return this.getMainSegments().filter((e=>e.blockReason))}getMainChapter(){return this.mainChapter||(this.mainChapter=this.findChapterByUrn(this.chapterUrn)),!this.mainChapter&&this.chapterList&&this.chapterList.length>0&&([this.mainChapter]=this.chapterList),this.mainChapter}getMainChapterImageUrl(){const e=this.getMainChapter();if(e&&e.imageUrl)return e.imageUrl}getMainResources(){const e=this.getResourceList();if(e&&e.length)return e.map((e=>({analyticsData:this.getMergedAnalyticsData(e.analyticsData),analyticsMetadata:this.getMergedAnalyticsMetadata(e.analyticsMetadata),blockReason:this.getMainChapter().blockReason,blockedSegments:this.getMainBlockedSegments(),imageUrl:this.getMainChapterImageUrl(),chapters:this.getChapters(),drmList:e.drmList,dvr:e.dvr,eventData:this.getMainChapter().eventData,id:this.getMainChapter().id,imageCopyright:this.getMainChapter().imageCopyright,intervals:this.getMainTimeIntervals(),live:e.live,mediaType:this.getMainChapter().mediaType,mimeType:e.mimeType,presentation:e.presentation,quality:e.quality,streaming:e.streaming,streamOffset:e.streamOffset,subtitles:this.getFilteredExternalSubtitles(),title:this.getMainChapter().title,tokenType:e.tokenType,url:e.url,urn:this.chapterUrn,vendor:this.getMainChapter().vendor})))}getMainSegments(){const e=this.getMainChapter();return!this.mainSegments&&e&&e.segmentList&&(this.mainSegments=e.segmentList),this.mainSegments||[]}getMainTimeIntervals(){const{timeIntervalList:e=[]}=this.getMainChapter()||{};return e}getMainValidFromDate(){const e=this.getMainChapter();if(!e)return new Date(0);const{validFrom:t}=e;return t?new Date(t):void 0}getMergedAnalyticsData(e){return t(t(t({},this.analyticsData),this.getMainChapter().analyticsData),e)}getMergedAnalyticsMetadata(e){return t(t(t({},this.analyticsMetadata),this.getMainChapter().analyticsMetadata),e)}getResourceList(){const{resourceList:e}=this.getMainChapter();return e||[]}}const Rm={Play:"Wiedergabe",Pause:"Pause",Replay:"Erneut abspielen","Current Time":"Aktueller Zeitpunkt",Duration:"Dauer","Remaining Time":"Verbleibende Zeit","Stream Type":"Streamtyp",LIVE:"LIVE",Loaded:"Geladen",Progress:"Status",Fullscreen:"Vollbild","Exit Fullscreen":"Vollbildmodus beenden",Mute:"Stumm schalten",Unmute:"Ton einschalten","Playback Rate":"Wiedergabegeschwindigkeit",Subtitles:"Untertitel","subtitles off":"Untertitel aus",Captions:"Untertitel","captions off":"Untertitel aus",Chapters:"Kapitel","You aborted the media playback":"Sie haben die Videowiedergabe abgebrochen.","A network error caused the media download to fail part-way.":"Der Videodownload ist aufgrund eines Netzwerkfehlers fehlgeschlagen.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Die Videowiedergabe wurde entweder wegen eines Problems mit einem beschädigten Video oder wegen verwendeten Funktionen, die vom Browser nicht unterstützt werden, abgebrochen.","No compatible source was found for this media.":"Für dieses Video wurde keine kompatible Quelle gefunden.","Play Video":"Video abspielen",Close:"Schließen","Modal Window":"Modales Fenster","This is a modal window":"Dies ist ein modales Fenster","This modal can be closed by pressing the Escape key or activating the close button.":'Durch Drücken der Esc-Taste bzw. Betätigung der Schaltfläche "Schließen" wird dieses modale Fenster geschlossen.',", opens captions settings dialog":", öffnet Einstellungen für Untertitel",", opens subtitles settings dialog":", öffnet Einstellungen für Untertitel",", selected":", ausgewählt","captions settings":"Untertiteleinstellungen","subtitles settings":"Untertiteleinstellungen","descriptions settings":"Einstellungen für Beschreibungen","Close Modal Dialog":"Modales Fenster schließen",Descriptions:"Beschreibungen","descriptions off":"Beschreibungen aus","The media is encrypted and we do not have the keys to decrypt it.":"Die Entschlüsselungsschlüssel für den verschlüsselten Medieninhalt sind nicht verfügbar.",", opens descriptions settings dialog":", öffnet Einstellungen für Beschreibungen","Audio Track":"Tonspur",Text:"Schrift",White:"Weiß",Black:"Schwarz",Red:"Rot",Green:"Grün",Blue:"Blau",Yellow:"Gelb",Magenta:"Magenta",Cyan:"Türkis",Background:"Hintergrund",Window:"Fenster",Transparent:"Durchsichtig","Semi-Transparent":"Halbdurchsichtig",Opaque:"Undurchsichtig","Font Size":"Schriftgröße","Text Edge Style":"Textkantenstil",None:"Kein",Raised:"Erhoben",Depressed:"Gedrückt",Uniform:"Uniform","Drop shadow":"Schlagschatten","Font Family":"Schriftfamilie","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:"Zwanglos",Script:"Schreibschrift","Small Caps":"Small-Caps",Reset:"Zurücksetzen","restore all settings to the default values":"Alle Einstellungen auf die Standardwerte zurücksetzen",Done:"Fertig","Caption Settings Dialog":"Einstellungsdialog für Untertitel","Beginning of dialog window. Escape will cancel and close the window.":"Anfang des Dialogfensters. Esc bricht ab und schließt das Fenster.","End of dialog window.":"Ende des Dialogfensters.","Audio Player":"Audio-Player","Video Player":"Video-Player","Progress Bar":"Fortschrittsbalken","progress bar timing: currentTime={1} duration={2}":"{1} von {2}","Volume Level":"Lautstärke","{1} is loading.":"{1} wird geladen.","Seek to live, currently behind live":"Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.","Seek to live, currently playing live":"Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.","Exit Picture-in-Picture":"Bild-im-Bild-Modus beenden","Picture-in-Picture":"Bild-im-Bild-Modus","No content":"Kein Inhalt",Color:"Farbe",Opacity:"Deckkraft","Text Background":"Texthintergrund","Caption Area Background":"Hintergrund des Untertitelbereichs","Playing in Picture-in-Picture":"Wird im Bild-im-Bild-Modus wiedergegeben","Skip forward {1} seconds":"{1} Sekunden vorwärts","Skip backward {1} seconds":"{1} Sekunden zurück"},Mm={AGERATING12:"Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 20:00 und 06:00 Uhr zur Verfügung.",AGERATING18:"Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 23:00 und 05:00 Uhr zur Verfügung.",COMMERCIAL:"Die Werbung wurde übersprungen.",ENDDATE:"Dieser Inhalt ist nicht mehr verfügbar.",GEOBLOCK:"Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.",JOURNALISTIC:"Dieser Inhalt steht aus publizistischen Gründen vorübergehend nicht zur Verfügung.",LEGAL:"Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.",STARTDATE:"Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.",UNKNOWN:"Dieser Inhalt ist nicht verfügbar."};rm.addLanguage("de",t(t({},Rm),Mm));const Nm={"Audio Player":"Audio Player","Video Player":"Video Player",Play:"Play",Pause:"Pause",Replay:"Replay","Current Time":"Current Time",Duration:"Duration","Remaining Time":"Remaining Time","Stream Type":"Stream Type",LIVE:"LIVE","Seek to live, currently behind live":"Seek to live, currently behind live","Seek to live, currently playing live":"Seek to live, currently playing live",Loaded:"Loaded",Progress:"Progress","Progress Bar":"Progress Bar","progress bar timing: currentTime={1} duration={2}":"{1} of {2}",Fullscreen:"Fullscreen","Exit Fullscreen":"Exit Fullscreen",Mute:"Mute",Unmute:"Unmute","Playback Rate":"Playback Rate",Subtitles:"Subtitles","subtitles off":"subtitles off",Captions:"Captions","captions off":"captions off",Chapters:"Chapters",Descriptions:"Descriptions","descriptions off":"descriptions off","Audio Track":"Audio Track","Volume Level":"Volume Level","You aborted the media playback":"You aborted the media playback","A network error caused the media download to fail part-way.":"A network error caused the media download to fail part-way.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"The media could not be loaded, either because the server or network failed or because the format is not supported.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.","No compatible source was found for this media.":"No compatible source was found for this media.","The media is encrypted and we do not have the keys to decrypt it.":"The media is encrypted and we do not have the keys to decrypt it.","Play Video":"Play Video",Close:"Close","Close Modal Dialog":"Close Modal Dialog","Modal Window":"Modal Window","This is a modal window":"This is a modal window","This modal can be closed by pressing the Escape key or activating the close button.":"This modal can be closed by pressing the Escape key or activating the close button.",", opens captions settings dialog":", opens captions settings dialog",", opens subtitles settings dialog":", opens subtitles settings dialog",", opens descriptions settings dialog":", opens descriptions settings dialog",", selected":", selected","captions settings":"captions settings","subtitles settings":"subtitles settings","descriptions settings":"descriptions settings",Text:"Text",White:"White",Black:"Black",Red:"Red",Green:"Green",Blue:"Blue",Yellow:"Yellow",Magenta:"Magenta",Cyan:"Cyan",Background:"Background",Window:"Window",Transparent:"Transparent","Semi-Transparent":"Semi-Transparent",Opaque:"Opaque","Font Size":"Font Size","Text Edge Style":"Text Edge Style",None:"None",Raised:"Raised",Depressed:"Depressed",Uniform:"Uniform","Drop shadow":"Drop shadow","Font Family":"Font Family","Proportional Sans-Serif":"Proportional Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportional Serif","Monospace Serif":"Monospace Serif",Casual:"Casual",Script:"Script","Small Caps":"Small Caps",Reset:"Reset","restore all settings to the default values":"restore all settings to the default values",Done:"Done","Caption Settings Dialog":"Caption Settings Dialog","Beginning of dialog window. Escape will cancel and close the window.":"Beginning of dialog window. Escape will cancel and close the window.","End of dialog window.":"End of dialog window.","{1} is loading.":"{1} is loading.","Exit Picture-in-Picture":"Exit Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture","No content":"No content",Color:"Color",Opacity:"Opacity","Text Background":"Text Background","Caption Area Background":"Caption Area Background","Playing in Picture-in-Picture":"Playing in Picture-in-Picture","Skip backward {1} seconds":"Skip backward {1} seconds","Skip forward {1} seconds":"Skip forward {1} seconds"},Um={AGERATING12:"To protect children this content is only available between 8PM and 6AM.",AGERATING18:"To protect children this content is only available between 10PM and 5AM.",COMMERCIAL:"This commercial content is not available.",ENDDATE:"This content is not available anymore.",GEOBLOCK:"This content is not available outside Switzerland.",JOURNALISTIC:"This content is temporarily unavailable for journalistic reasons.",LEGAL:"This content is not available due to legal restrictions.",STARTDATE:"This content is not available yet.",UNKNOWN:"This content is not available."};rm.addLanguage("en",t(t({},Nm),Um));const Bm={"Audio Player":"Lecteur audio","Video Player":"Lecteur vidéo",Play:"Lecture",Pause:"Pause",Replay:"Revoir","Current Time":"Temps actuel",Duration:"Durée","Remaining Time":"Temps restant","Stream Type":"Type de flux",LIVE:"EN DIRECT","Seek to live, currently behind live":"Rechercher le direct, actuellement après le direct","Seek to live, currently playing live":"Rechercher le direct, le direct actuellement en cours de lecture",Loaded:"Chargé",Progress:"Progression","Progress Bar":"Barre de progression","progress bar timing: currentTime={1} duration={2}":"{1} de {2}",Fullscreen:"Plein écran","Exit Fullscreen":"Fenêtré",Mute:"Mettre en sourdine",Unmute:"Activer le son","Playback Rate":"Vitesse de lecture",Subtitles:"Sous-titres","subtitles off":"Sous-titres désactivés",Captions:"Sous-titres transcrits","captions off":"Sous-titres transcrits désactivés",Chapters:"Chapitres",Descriptions:"Descriptions","descriptions off":"descriptions désactivées","Audio Track":"Piste audio","Volume Level":"Niveau de volume","You aborted the media playback":"Vous avez interrompu la lecture de la vidéo.","A network error caused the media download to fail part-way.":"Une erreur de réseau a interrompu le téléchargement de la vidéo.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Cette vidéo n'a pas pu être chargée, soit parce que le serveur ou le réseau a échoué ou parce que le format n'est pas reconnu.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La lecture de la vidéo a été interrompue à cause d'un problème de corruption ou parce que la vidéo utilise des fonctionnalités non prises en charge par votre navigateur.","No compatible source was found for this media.":"Aucune source compatible n'a été trouvée pour cette vidéo.","The media is encrypted and we do not have the keys to decrypt it.":"Le média est chiffré et nous n'avons pas les clés pour le déchiffrer.","Play Video":"Lire la vidéo",Close:"Fermer","Close Modal Dialog":"Fermer la boîte de dialogue modale","Modal Window":"Fenêtre modale","This is a modal window":"Ceci est une fenêtre modale","This modal can be closed by pressing the Escape key or activating the close button.":"Ce modal peut être fermé en appuyant sur la touche Échap ou activer le bouton de fermeture.",", opens captions settings dialog":", ouvrir les paramètres des sous-titres transcrits",", opens subtitles settings dialog":", ouvrir les paramètres des sous-titres",", opens descriptions settings dialog":", ouvrir les paramètres des descriptions",", selected":", sélectionné","captions settings":"Paramètres des sous-titres transcrits","subtitles settings":"Paramètres des sous-titres","descriptions settings":"Paramètres des descriptions",Text:"Texte",White:"Blanc",Black:"Noir",Red:"Rouge",Green:"Vert",Blue:"Bleu",Yellow:"Jaune",Magenta:"Magenta",Cyan:"Cyan",Background:"Arrière-plan",Window:"Fenêtre",Transparent:"Transparent","Semi-Transparent":"Semi-transparent",Opaque:"Opaque","Font Size":"Taille des caractères","Text Edge Style":"Style des contours du texte",None:"Aucun",Raised:"Élevé",Depressed:"Enfoncé",Uniform:"Uniforme","Drop shadow":"Ombre portée","Font Family":"Famille de polices","Proportional Sans-Serif":"Polices à chasse variable sans empattement (Proportional Sans-Serif)","Monospace Sans-Serif":"Polices à chasse fixe sans empattement (Monospace Sans-Serif)","Proportional Serif":"Polices à chasse variable avec empattement (Proportional Serif)","Monospace Serif":"Polices à chasse fixe avec empattement (Monospace Serif)",Casual:"Manuscrite",Script:"Scripte","Small Caps":"Petites capitales",Reset:"Réinitialiser","restore all settings to the default values":"Restaurer tous les paramètres aux valeurs par défaut",Done:"Terminé","Caption Settings Dialog":"Boîte de dialogue des paramètres des sous-titres transcrits","Beginning of dialog window. Escape will cancel and close the window.":"Début de la fenêtre de dialogue. La touche d'échappement annulera et fermera la fenêtre.","End of dialog window.":"Fin de la fenêtre de dialogue.","Exit Picture-in-Picture":"Quitter le mode image dans l'image","Picture-in-Picture":"Image dans l'image","{1} is loading.":"{1} en cours de chargement.","No content":"Aucun contenu",Color:"Couleur",Opacity:"Opacité","Text Background":"Arrière-plan du texte","Caption Area Background":"Arrière-plan de la zone de sous-titre","Skip backward {1} seconds":"Reculer de {1} secondes","Skip forward {1} seconds":"Avancer de {1} secondes"},Fm={AGERATING12:"Pour protéger les enfants, ce contenu est accessible entre 20h et 6h.",AGERATING18:"Pour protéger les enfants, ce contenu est accessible entre 23h et 5h.",COMMERCIAL:"Ce contenu n'est actuellement pas disponible.",ENDDATE:"Ce contenu n'est plus disponible.",GEOBLOCK:"La RTS ne dispose pas des droits de diffusion en dehors de la Suisse.",JOURNALISTIC:"Ce contenu est temporairement indisponible pour des raisons éditoriales.",LEGAL:"Pour des raisons juridiques, ce contenu n'est pas disponible.",STARTDATE:"Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.",UNKNOWN:"Ce contenu n'est actuellement pas disponible."};rm.addLanguage("fr",t(t({},Bm),Fm));const qm={"Audio Player":"Lettore audio","Video Player":"Lettore video",Play:"Play",Pause:"Pausa",Replay:"Replay","Current Time":"Orario attuale",Duration:"Durata","Remaining Time":"Tempo rimanente","Stream Type":"Tipo di streaming",LIVE:"LIVE",Loaded:"Caricato",Progress:"Stato","Progress Bar":"Barra di avanzamento","progress bar timing: currentTime={1} duration={2}":"{1} di {2}",Fullscreen:"Schermo intero","Exit Fullscreen":"Chiudi Schermo intero",Mute:"Disattiva l’audio",Unmute:"Attiva l’audio","Playback Rate":"Velocità di riproduzione",Subtitles:"Sottotitoli","subtitles off":"Senza sottotitoli",Captions:"Didascalie","captions off":"Senza didascalie",Chapters:"Capitolo",Descriptions:"Descrizioni","descriptions off":"Descrizioni disattivate","Audio Track":"Traccia audio","Volume Level":"Livello del volume","You aborted the media playback":"La riproduzione del contenuto multimediale è stata interrotta.","A network error caused the media download to fail part-way.":"Il download del contenuto multimediale è stato interrotto a causa di un problema rete.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il contenuto multimediale non può essere caricato a causa di un errore nel server o nella rete o perché il formato non viene supportato.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La riproduzione del contenuto multimediale è stata interrotta a causa di un file danneggiato o per l’utilizzo di impostazioni non supportate dal browser.","No compatible source was found for this media.":"Non ci sono fonti compatibili per questo contenuto multimediale.","The media is encrypted and we do not have the keys to decrypt it.":"Il contenuto multimediale è criptato e non disponiamo delle chiavi per decifrarlo.","Play Video":"Riproduci il video",Close:"Chiudi","Close Modal Dialog":"Chiudi la finestra di dialogo","Modal Window":"Finestra di dialogo","This is a modal window":"Questa è una finestra di dialogo","This modal can be closed by pressing the Escape key or activating the close button.":"Questa finestra di dialogo può essere chiusa premendo sul tasto Esc o attivando il pulsante di chiusura.",", opens captions settings dialog":", aprire le impostazioni delle didascalie",", opens subtitles settings dialog":", aprire le impostazioni dei sottotitoli",", opens descriptions settings dialog":", aprire le impostazioni delle descrizioni",", selected":", selezionato","captions settings":"Impostazioni didascalie","subtitles settings":"Impostazioni sottotitoli","descriptions settings":"Impostazioni descrizioni",Text:"Testo",White:"Bianco",Black:"Nero",Red:"Rosso",Green:"Verde",Blue:"Blu",Yellow:"Giallo",Magenta:"Magenta",Cyan:"Ciano",Background:"Sfondo",Window:"Finestra",Transparent:"Trasparente","Semi-Transparent":"Semi-Trasparente",Opaque:"Opaco","Font Size":"Dimensione dei caratteri","Text Edge Style":"Stile dei bordi del testo",None:"Nessuno",Uniform:"Uniforme","Drop shadow":"Ombra","Font Family":"Carattere","Proportional Sans-Serif":"Sans-Serif proporzionale","Monospace Sans-Serif":"Sans-Serif monospaziato","Proportional Serif":"Serif proporzionale","Monospace Serif":"Serif monospaziato","Small Caps":"Maiuscoletto",Reset:"Reinizializza","restore all settings to the default values":"Ripristina i valori predefiniti per tutti i parametri",Done:"Fatto","Caption Settings Dialog":"Finestra di dialogo dei parametri della trascrizione dei sottotitoli","Beginning of dialog window. Escape will cancel and close the window.":"Inizio della finestra di dialogo. Il tasto Esc annullerà l’operazione e chiuderà la finestra.","End of dialog window.":"Fine della finestra di dialogo.","{1} is loading.":"{1} in fase di caricamento.","Exit Picture-in-Picture":"Esci dalla modalità Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture",Color:"Colore",Opacity:"Opacità","Text Background":"Sfondo testo","Caption Area Background":"Sfondo area sottotitoli","Skip forward {1} seconds":"Avanti {1} secondi","Skip backward {1} seconds":"Indietro {1} secondi"},jm={AGERATING12:"Per proteggere i bambini, questo media è disponibile solo fra le 20 e le 6.",AGERATING18:"Per proteggere i bambini, questo media è disponibile solo fra le 23 le 5.",COMMERCIAL:"Questo contenuto commerciale non è disponibile.",ENDDATE:"Questo media non è più disponibile.",GEOBLOCK:"Questo media non è disponibile fuori dalla Svizzera.",JOURNALISTIC:"Questo contenuto è temporaneamente non disponibile per motivi editoriali.",LEGAL:"Il contenuto non è fruibile a causa di restrizioni legali.",STARTDATE:"Il contenuto non è ancora disponibile. Per cortesia prova più tardi.",UNKNOWN:"Questo media non è disponibile."};rm.addLanguage("it",t(t({},qm),jm));const $m={"Audio Player":"Audio-Player","Video Player":"Video-Player",Play:"Laschar ir",Pause:"Pausa",Replay:"Mussar danovamain","Current Time":"Temp actual",Duration:"Durada","Remaining Time":"Temp restant","Stream Type":"Tip dal stream",LIVE:"LIVE",Loaded:"Chargià",Progress:"Progress","Progress Bar":"Bar da progessiun","progress bar timing: currentTime={1} duration={2}":"{1} da {2}",Fullscreen:"Entir visur","Non-Fullscreen":"Betg entir visur",Mute:"Senza tun",Unmute:"Cun tun","Playback Rate":"Tempo ",Subtitles:"Suttitels","subtitles off":"senza suttitels",Captions:"Suttitels","captions off":"senza suttitels",Chapters:"Chapitels",Descriptions:"Descripziuns","descriptions off":"senza descripziuns","Audio Track":"Piese audio","Volume Level":"Nivel dal volumen","You aborted the media playback":"Vus avais interrut il vdieo","A network error caused the media download to fail part-way.":"In sbagl en la rait ha impedì il download","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il video n'è betg chargià - ubain per in sbagl da server / da la rait, ubain ch'il format n'è betg cumpatibel.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Il video è interrut: Ubain ch'il video è donnegià, ubain che funcziuns n'èn betg cumpatiblas.","No compatible source was found for this media.":"Chattà nagina funtauna cumpatibla per quest video.","The media is encrypted and we do not have the keys to decrypt it.":"Il video è codifitgà da moda nunenconuschenta.","Play Video":"Aviar video",Close:"Serrar","Close Modal Dialog":"Serrar la fanestra modala","Modal Window":"Fanestra modala","This is a modal window":"Quai è ina fanestra modala","This modal can be closed by pressing the Escape key or activating the close button.":'Questa fanestra modala pudais serrar cun la tasta "Escape" ubain cun il buttun.',", opens captions settings dialog":", avra opziuns per ils suttitels",", opens subtitles settings dialog":", avra opziuns per ils suttitels",", opens descriptions settings dialog":", avra opziuns per la descripziun",", selected":", selecziunà","captions settings":"opziuns per ils suttitels","subtitles settings":"opziuns per ils suttitels","descriptions settings":"opziuns per la descripziun",Text:"Text",White:"Alv",Black:"Nair",Red:"Cotschn",Green:"Verd",Blue:"Blau",Yellow:"Mellen",Magenta:"Magenta",Cyan:"Cyan",Background:"Fund",Window:"Fanestra",Transparent:"Transparent","Semi-Transparent":"Mez transparent",Opaque:"Betg transparent","Font Size":"Grandezza dal text","Text Edge Style":"Stil dal text",None:"Nagin",Raised:"Auzà",Depressed:"Sbassà",Uniform:"Uniform",Dropshadow:"Sumbriva","Font Family":"Scrittira","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:"Casual",Script:"Script","Small Caps":"Bustabs pitschens",Reset:"Da nov","restore all settings to the default values":"Enavos tar las opziuns da standard",Done:"Fatg","Caption Settings Dialog":"Opziuns per suttitels","Beginning of dialog window. Escape will cancel and close the window.":"Entschatta da la fanestra da dialog. Escape stizza e serra la fanestra.","End of dialog window.":"Fin da la fanestra da dialog.",AGERATING12:"Per proteger uffants, è quest cuntegn disponibel mo tranter las 20.00 e las 06.00.",AGERATING18:"Per proteger uffants, è quest cuntegn disponibel mo tranter las 23.00 e las 05.00.",COMMERCIAL:"Quest medium commerzial n'è betg disponibel.",ENDDATE:"Quest cuntegn n'è betg pli disponibel.",GEOBLOCK:"Quest cuntegn n'è betg disponibel ordaifer la Svizra.",JOURNALISTIC:"Quest cuntegn na stat ad interim betg a disposiziun per motivs publicistics.",LEGAL:"Quest cuntegn n'è betg disponibel perquai ch'el è scadì.",STARTDATE:"Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.",UNKNOWN:"Quest cuntegn n'è betg disponibel."};rm.addLanguage("rm",t({},$m));const Vm=["url","mimeType","keySystems"],Hm=["src"];class zm{static addBlockedSegments(e,t=[]){const i="srgssr-blocked-segments",s=e.textTracks().getTrackById(i);if(s&&e.textTracks().removeTrack(s),!Array.isArray(t)||!t.length)return;const r=t.filter((e=>e.blockReason));r.length&&zm.createTextTrack(e,i).then((t=>{r.forEach((e=>{zm.addTextTrackCue(t,e)})),e.textTracks().addTrack(t)}))}static addRemoteTextTracks(e,t=[]){Array.isArray(t)&&t.forEach((({type:t,language:i,locale:s,url:r})=>{e.addRemoteTextTrack({kind:"SDH"===t?"captions":"subtitles",label:i,language:s,src:r})}))}static addTextTrackCue(e,t){const i=(Number.isFinite(t.markIn)?t.markIn:t.fullLengthMarkIn)/1e3,s=(Number.isFinite(t.markOut)?t.markOut:t.fullLengthMarkOut)/1e3;e.addCue(new VTTCue(i,s,JSON.stringify(t)))}static addTextTracks(e,{mediaData:t}){zm.addRemoteTextTracks(e,t.subtitles),zm.addChapters(e,t.urn,t.chapters),zm.addBlockedSegments(e,t.blockedSegments),zm.addIntervals(e,t.intervals)}static addChapters(e,t,i=[]){const s="srgssr-chapters",r=e.textTracks().getTrackById(s);r&&e.textTracks().removeTrack(r),Array.isArray(i)&&i.length&&zm.createTextTrack(e,s).then((s=>{i.forEach((e=>{t===e.fullLengthUrn&&zm.addTextTrackCue(s,e)})),e.textTracks().addTrack(s)}))}static addIntervals(e,t=[]){const i="srgssr-intervals",s=e.textTracks().getTrackById(i);s&&e.textTracks().removeTrack(s),Array.isArray(t)&&t.length&&zm.createTextTrack(e,i).then((i=>{t.forEach((e=>{zm.addTextTrackCue(i,e)})),e.textTracks().addTrack(i)}))}static blockingReason(e,t){if(!t.mediaData.blockReason)return;const i=e.localize(t.mediaData.blockReason);return zm.error(e,{code:MediaError.MEDIA_ERR_ABORTED,message:i,metadata:{errorType:t.mediaData.blockReason,src:t}}),!0}static composeAkamaiResources(e=[]){return r((function*(){return vm.hasToken(e)?vm.tokenizeSources(e):Promise.resolve(e)}))()}static composeKeySystemsResources(e=[]){if(!fm.hasDrm(e))return e;return e.map((e=>t(t({},e),fm.buildKeySystems(e.drmList))))}static composeMainResources(e){return zm.composeAkamaiResources(zm.composeKeySystemsResources(zm.filterIncompatibleResources(e.getMainResources())))}static composeSrcMediaData({mediaData:e,disableTrackers:t},i){const s=rm.obj.merge(i,e),{url:r,mimeType:n,keySystems:o}=s;return{src:r,type:n,keySystems:o,disableTrackers:t,mediaData:a(s,Vm)}}static createTextTrack(e,t){return new Promise((i=>{setTimeout((()=>{i(new rm.TextTrack({id:t,kind:"metadata",label:t,tech:e.tech(!0)}))}),100)}))}static cuechangeEventProxy(e){e.textTracks().on("addtrack",(({track:t})=>{["srgssr-chapters","srgssr-intervals"].includes(t.id)&&t.on("cuechange",(()=>{const[i]=Array.from(t.activeCues),s=t.id.includes("srgssr-chapters")?"srgssr/chapter":"srgssr/interval";e.trigger({type:s,data:i})}))}))}static dataProvider(e){if(!e.options().srgOptions.dataProvider){const{dataProviderHost:t,dataProviderUrlHandler:i}=e.options().srgOptions,s=new nm(t).handleRequest(i);e.options({srgOptions:{dataProvider:s}})}return e.options().srgOptions.dataProvider}static dataProviderError(e,t){if(!t)return;const i=t.statusText?t.statusText:t.message;return zm.error(e,{code:0,message:e.localize("UNKNOWN"),metadata:{errorType:"UNKNOWN",urn:e.src(),status:t.status,statusText:i,url:t.url}}),!0}static error(e,{code:t,message:i,metadata:s}){e.error(null),e.error({code:t,message:i,metadata:s})}static filterIncompatibleResources(e=[]){return e.filter((e=>!["RTMP","HDS"].includes(e.streaming)))}static getBlockedSegment(e){const t=e.textTracks().getTrackById("srgssr-blocked-segments");if(!t)return;const[i]=Array.from(t.activeCues);return i}static getBlockedSegmentByTime(e,t){const i=zm.getBlockedSegment(e);if(!i)return;return t>=i.startTime&&t<i.endTime?i:void 0}static getMediaComposition(e,t=(new nm).handleRequest()){return r((function*(){const i=yield t(e);return Object.assign(new Om,i)}))()}static getMediaData(e=[]){if(vm.hasToken(e))return e[0];const t=rm.browser.IS_ANY_SAFARI?"HLS":"DASH";return e.find((({streaming:e})=>e===t))||e[0]}static getSrcMediaObj(e,t){return r((function*(){zm.pillarboxMonitoring(e)&&zm.pillarboxMonitoring(e).sessionStart();const{src:i}=t,s=a(t,Hm),r=yield zm.getMediaComposition(i,zm.dataProvider(e)),n=yield zm.composeMainResources(r),o=zm.getMediaData(n);return zm.composeSrcMediaData(s,o)}))()}static handleCurrentTime(e,t){const i=zm.getBlockedSegmentByTime(e,t);if(!i||!Number.isFinite(i.endTime))return t;const s=i.endTime+.1;return e.trigger({type:"srgssr/blocked-segment",data:i}),e.currentTime(s),s}static handleSetCurrentTime(e,t){const{endTime:i}=zm.getBlockedSegmentByTime(e,t)||{};return Number.isFinite(i)?i:t}static handleSetSource(e,t,i){return r((function*(){try{const s=yield zm.getSrcMediaObj(e,t);if(zm.srgAnalytics(e),zm.updateTitleBar(e,s),zm.updatePoster(e,s),zm.blockingReason(e,s))return;return zm.addTextTracks(e,s),i(null,s)}catch(t){if(zm.dataProviderError(e,t))return;return i(t)}}))()}static srgAnalytics(e){if(!1!==e.options().trackers.srgAnalytics&&!e.options().trackers.srgAnalytics){const t=new Pm(e,{debug:e.debug(),playerVersion:rm.VERSION.pillarbox,tagCommanderScriptURL:e.options().srgOptions.tagCommanderScriptURL});e.options({trackers:{srgAnalytics:t}})}}static pillarboxMonitoring(e){if(!1!==e.options().trackers.pillarboxMonitoring){if(!e.options().trackers.pillarboxMonitoring){const t=new Lm(e,{debug:e.debug(),playerVersion:rm.VERSION.pillarbox,playerName:"Pillarbox"});e.options({trackers:{pillarboxMonitoring:t}})}return e.options().trackers.pillarboxMonitoring}}static updatePoster(e,t,i=mm){e.poster(i.scale({url:t.mediaData.imageUrl}))}static updateTitleBar(e,t){e.titleBar&&e.titleBar.update({title:t.mediaData.vendor,description:t.mediaData.title})}static middleware(e){return zm.pillarboxMonitoring(e),zm.cuechangeEventProxy(e),{currentTime:t=>zm.handleCurrentTime(e,t),setCurrentTime:t=>zm.handleSetCurrentTime(e,t),setSource:(t=r((function*(t,i){return zm.handleSetSource(e,t,i)})),function(e,i){return t.apply(this,arguments)})};var t}}return rm.use("srgssr/urn",zm.middleware),rm.options.srgOptions={dataProvider:void 0,dataProviderHost:void 0,dataProviderUrlHandler:void 0,tagCommanderScriptURL:void 0},rm}));
35
35
  //# sourceMappingURL=pillarbox.umd.min.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@srgssr/pillarbox-web",
3
3
  "description": "Pillarbox is the modern SRG SSR player",
4
- "version": "1.15.0",
4
+ "version": "1.15.1",
5
5
  "type": "module",
6
6
  "module": "dist/pillarbox.es.js",
7
7
  "main": "dist/pillarbox.cjs.js",
@@ -59,7 +59,7 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "homepage": "https://srgssr.github.io/pillarbox-web-demo/",
62
+ "homepage": "https://www.pillarbox.ch/",
63
63
  "devDependencies": {
64
64
  "@babel/core": "^7.24.1",
65
65
  "@babel/preset-env": "^7.24.1",