From 56cfb2b53d198fbb678fcbb7a3808b365804d8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=B6lzel?= Date: Thu, 31 Jul 2025 16:19:26 +0200 Subject: [PATCH 1/3] update node packages to latest version --- Build/package-lock.json | 72 ++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Build/package-lock.json b/Build/package-lock.json index 175fd91ac1..09ebbe7b64 100644 --- a/Build/package-lock.json +++ b/Build/package-lock.json @@ -2523,9 +2523,9 @@ } }, "node_modules/@jsonjoy.com/json-pack": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.2.0.tgz", - "integrity": "sha512-io1zEbbYcElht3tdlqEOFxZ0dMTYrHz9iMf0gqn1pPjZFTCgM5R4R5IMA20Chb2UPYYsxjzs8CgZ7Nb5n2K2rA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.4.0.tgz", + "integrity": "sha512-Akn8XZqN3xO9YGcgvIiTauBBXTP92QSvw6EcGha+p5nm7brhbwvev5gw4fi+ouLGrBpfPpb72+S5pxl4mkMIGQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2546,9 +2546,9 @@ } }, "node_modules/@jsonjoy.com/util": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.6.0.tgz", - "integrity": "sha512-sw/RMbehRhN68WRtcKCpQOPfnH6lLP4GJfqzi3iYej8tnzpZUDr6UkZYJjcjjC0FWEJOJbyM3PTIwxucUmDG2A==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.8.0.tgz", + "integrity": "sha512-HeR0JQNEdBozt+FrfyM5T0X3R+fIN0D+BRDkxPP5o41fTWzHfeZEqtK16aTW8haU+h+SG7XYq9PP5kobvOmkSA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -4176,9 +4176,9 @@ } }, "node_modules/babel-preset-current-node-syntax": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", - "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz", + "integrity": "sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==", "dev": true, "license": "MIT", "dependencies": { @@ -4199,7 +4199,7 @@ "@babel/plugin-syntax-top-level-await": "^7.14.5" }, "peerDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.0.0 || ^8.0.0-0" } }, "node_modules/babel-preset-jest": { @@ -4495,9 +4495,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001727", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz", - "integrity": "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==", + "version": "1.0.30001731", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001731.tgz", + "integrity": "sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg==", "dev": true, "funding": [ { @@ -5682,9 +5682,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.191", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.191.tgz", - "integrity": "sha512-xcwe9ELcuxYLUFqZZxL19Z6HVKcvNkIwhbHUz7L3us6u12yR+7uY89dSl570f/IqNthx8dAw3tojG7i4Ni4tDA==", + "version": "1.5.193", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.193.tgz", + "integrity": "sha512-eePuBZXM9OVCwfYUhd2OzESeNGnWmLyeu0XAEjf7xjijNjHFdeJSzuRUGN4ueT2tEYo5YqjHramKEFxz67p3XA==", "dev": true, "license": "ISC" }, @@ -6973,9 +6973,9 @@ "license": "ISC" }, "node_modules/follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", "dev": true, "funding": [ { @@ -9630,14 +9630,14 @@ "peer": true }, "node_modules/launch-editor": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.10.0.tgz", - "integrity": "sha512-D7dBRJo/qcGX9xlvt/6wUYzQxjh5G1RvZPgPv8vi4KRU99DVQL/oW7tnVOCCTm2HGeo3C5HvGE5Yrh6UBoZ0vA==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.11.0.tgz", + "integrity": "sha512-R/PIF14L6e2eHkhvQPu7jDRCr0msfCYCxbYiLgkkAGi0dVPWuM+RrsPu0a5dpuNe0KWGL3jpAkOlv53xGfPheQ==", "dev": true, "license": "MIT", "dependencies": { - "picocolors": "^1.0.0", - "shell-quote": "^1.8.1" + "picocolors": "^1.1.1", + "shell-quote": "^1.8.3" } }, "node_modules/less": { @@ -9892,9 +9892,9 @@ } }, "node_modules/memfs": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.17.2.tgz", - "integrity": "sha512-NgYhCOWgovOXSzvYgUW0LQ7Qy72rWQMGGFJDoWg4G30RHd3z77VbYdtJ4fembJXBy8pMIUA31XNAupobOQlwdg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.25.0.tgz", + "integrity": "sha512-VZhVrmQJFuWhjGAye01xO2N7SQZ507j3rq5mfebhcXbYTj7b4iapuA1w+LPJEp+uGKtDTYmBWZa9BNZDem1yuA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -10380,9 +10380,9 @@ } }, "node_modules/nwsapi": { - "version": "2.2.20", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.20.tgz", - "integrity": "sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==", + "version": "2.2.21", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.21.tgz", + "integrity": "sha512-o6nIY3qwiSXl7/LuOU0Dmuctd34Yay0yeuZRLFmDPrrdHpXKFndPj3hM+YEPVHYC5fx2otBx4Ilc/gyYSAUaIA==", "dev": true, "license": "MIT" }, @@ -12676,9 +12676,9 @@ "license": "ISC" }, "node_modules/shaka-player": { - "version": "4.15.8", - "resolved": "https://registry.npmjs.org/shaka-player/-/shaka-player-4.15.8.tgz", - "integrity": "sha512-/yxkzgBNo7LyOGrHVw1q9P2NozJUdgHSxI2DSP3vD5iH2zS+9oIVdePB7JgSEzBF6LxnTkH5ZeCsG3dV2GU20w==", + "version": "4.15.9", + "resolved": "https://registry.npmjs.org/shaka-player/-/shaka-player-4.15.9.tgz", + "integrity": "sha512-x8TElKG1eaj3nlcO9whvH1SbGvJ1gwSdgYlbvcJBNWsMJal70C2ZLk4w8qi8uXpcDjzSR8p28gYgD7WfOdHDGA==", "license": "Apache-2.0", "engines": { "node": ">=18" @@ -14051,9 +14051,9 @@ } }, "node_modules/webpack": { - "version": "5.100.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.100.2.tgz", - "integrity": "sha512-QaNKAvGCDRh3wW1dsDjeMdDXwZm2vqq3zn6Pvq4rHOEOGSaUMgOOjG2Y9ZbIGzpfkJk9ZYTHpDqgDfeBDcnLaw==", + "version": "5.101.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.0.tgz", + "integrity": "sha512-B4t+nJqytPeuZlHuIKTbalhljIFXeNRqrUGAQgTGlfOl2lXXKXw+yZu6bicycP+PUlM44CxBjCFD6aciKFT3LQ==", "dev": true, "license": "MIT", "dependencies": { From 543b6ee34cabaa2233d37b9e0bbb2e16c220f591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=B6lzel?= Date: Thu, 31 Jul 2025 16:21:04 +0200 Subject: [PATCH 2/3] node build production --- Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaPlayer.js | 2 +- Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaVendor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaPlayer.js b/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaPlayer.js index d6dbb1707c..961158f1b7 100644 --- a/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaPlayer.js +++ b/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaPlayer.js @@ -1,3 +1,3 @@ /*! For license information please see DlfMediaPlayer.js.LICENSE.txt */ -(()=>{"use strict";var e,t={6266:(e,t,s)=>{s(4715);var i=s(3838),n=s.n(i);function r(e,t={},s=[]){const i=document.createElement(e);for(const[e,s]of Object.entries(t))"$"===e[0]?i.addEventListener(e.substring(1),s):i[e]=s;for(const e of s)"string"==typeof e?i.append(document.createTextNode(e)):e instanceof HTMLElement&&i.append(e);return i}function a(e,[t,s]){return es?s:e}function o(e,t){return et?1:0}function l(e,t){let s=e;for(const[e,i]of Object.entries(t))void 0!==i&&(s=s.split(`{${e}}`).join(i));return s}function h(e,t){return e.toString().padStart(t,"0")}function d(e,t){return new Promise((s,i)=>{const n=new FileReader;n.onload=()=>{"string"==typeof n.result?s(n.result):i(null)},n.onerror=()=>{i(n.error)},n[t](e)})}function c(e,t){const s=URL.createObjectURL(e);let i;try{i=t(s)}catch(e){throw URL.revokeObjectURL(s),e}if(i instanceof Promise){const e=i;return new Promise((t,i)=>{e.then(e=>{URL.revokeObjectURL(s),t(e)}).catch(e=>{URL.revokeObjectURL(s),i(e)})})}return URL.revokeObjectURL(s),i}async function u(e){const t=r("img");return t.decoding="async",t.src=e,await t.decode(),t}function p(e,t){"string"==typeof e?r("a",{href:e,download:t}).click():c(e,e=>{p(e,t)})}function m(e){return e.preventDefault(),!1}function f(e,t){const s=[],i=Array.isArray(t)?t:[t];for(let t=0;t0)for(const e of i){const t="string"==typeof e?e:e.cloneNode(!0);s.push(t)}s.push(e[t])}return s}function g(e,t,s){s?e.classList.add(t):e.classList.remove(t)}function v(e){return e.filter(e=>null!==e)}function b(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null}class y extends n().ui.Element{static register(e,t={}){const s=e.mkid();return n().ui.Controls.registerElement(s,{create:(s,i)=>new this(s,i,e,t)}),s}constructor(e,t,s,i={}){super(e,t),this.env=s;const n=i.element??r("button");e.appendChild(n),this.dlf={config:i,element:n};const{onClickAction:a}=i;this.eventManager&&a&&(this.eventManager.listen(n,"click",()=>{a.isAvailable()&&a.execute()}),this.eventManager.listen(this.player,"loaded",()=>{this.updateControlPanelButton()})),this.updateControlPanelButton()}updateControlPanelButton(){for(const e of this.dlf.element.getAttributeNames())if(e.startsWith("data-t-")){const t=e.substring(7),s=this.dlf.element.getAttribute(e);s&&this.dlf.element.setAttribute(t,this.env.t(s))}let e=this.dlf.element.title??"";this.dlf.element.ariaLabel=e,this.dlf.element.title="",g(this.dlf.element,"shaka-tooltip",""!==e);const{onClickAction:t}=this.dlf.config;t&&g(this.dlf.element,"shaka-hidden",!t.isAvailable())}}class k{constructor(){this.tasks={}}get(e){const t=this.tasks[e]??=this.createTask(e);return this.resumeTask(t)}getCached(e){const t=this.tasks[e]?.state;return 4===t?.type?t.image:null}abortPending(){for(const[e,t]of Object.entries(this.tasks))this.stopTask(t)}createTask(e){return{state:{type:0,url:e},promise:null,stopNext:!1}}stopTask(e){e.stopNext=!0}resumeTask(e){return e.stopNext=!1,null===e.promise&&(e.promise=new Promise(async(t,s)=>{try{for(;;){if(4===e.state.type){t(e.state.image);break}if(e.stopNext){e.promise=null;break}await this.progressTask(e)}}catch(e){s(e)}})),e.promise}async progressTask(e){switch(e.state.type){case 0:{const t=new AbortController,s=e.state.url,i=fetch(s,{signal:t.signal});e.state={type:1,abortController:t,responsePromise:i};break}case 1:{const t=await e.state.responsePromise;if(!t.ok)throw t;e.state={type:2,imageBlob:await t.blob()};break}case 2:e.state={type:3,imagePromise:(t=e.state.imageBlob,c(t,u))};break;case 3:{const t=await e.state.imagePromise;e.state={type:4,image:t};break}case 4:break;default:throw new Error(`Unhandled LoadState type: ${e.state}`)}var t}}function w(e,t=null){const s=function(e,t=0){const s=Math.floor(e/3600),i=Math.floor(e/60%60),n=e%1;return{hours:s,minutes:i,totalMinutes:60*s+i,seconds:Math.floor(e%60),fractional:n,frames:Math.floor(n*t)}}(e,t??0);return{h:`${s.hours}`,hh:h(s.hours,2),m:`${s.totalMinutes}`,mm:h(s.minutes,2),ss:h(s.seconds,2),ff:h(s.frames,2),"00":h(Math.floor(100*s.fractional),2),"000":h(Math.floor(1e3*s.fractional),3)}}function T(e,t,s=null){let i=t?"{h}:{mm}:{ss}":"{m}:{ss}";return s?(i+=":{ff}",t||(i+="f")):i+=".{00}",l(i,w(e,s))}class C{constructor(e){this.seekBar=e.seekBar,this.player=e.player,this.network=e.network,this.interaction=e.interaction,this.fps=null,this.chapters=null,this.thumbnailTracks=[],this.snapToThumbnail=null,this.lastRendered=null,this.isChanging=!1,this.deltaStart=null,this.current=null,this.renderAnimationFrame=null,this.seekMode="wide",this.openDisplayTimeout=null,this.handlers={onWindowBlur:this.onWindowBlur.bind(this),onWindowResize:this.onWindowResize.bind(this),onPointerMove:this.onPointerMove.bind(this),onPointerDown:this.onPointerDown.bind(this),onPointerUpOrCancel:this.onPointerUpOrCancel.bind(this)},this.$container=r("div",{className:"dlf-media-thumbnail-preview"},[r("div",{className:"content-box"},[this.$display=r("div",{className:"display"},[this.$img=r("img")]),this.$info=r("span",{className:"info"},[this.$chapterText=r("span",{className:"chapter-text"}),this.$timecodeText=r("span",{className:"timecode-text"})])])]),this.$seekMarker=r("div",{className:"seek-marker"}),this.$seekThumbBar=r("div",{className:"seek-thumb-bar"}),this.seekBar.append(this.$seekMarker,this.$seekThumbBar,this.$container),this.ensureDisplaySize(160,90),window.addEventListener("blur",this.handlers.onWindowBlur),window.addEventListener("resize",this.handlers.onWindowResize),document.addEventListener("pointermove",this.handlers.onPointerMove),document.addEventListener("pointerdown",this.handlers.onPointerDown),document.addEventListener("pointerup",this.handlers.onPointerUpOrCancel),document.addEventListener("pointercancel",this.handlers.onPointerUpOrCancel)}release(){window.removeEventListener("blur",this.handlers.onWindowBlur),window.removeEventListener("resize",this.handlers.onWindowResize),document.removeEventListener("pointermove",this.handlers.onPointerMove),document.removeEventListener("pointerdown",this.handlers.onPointerDown),document.removeEventListener("pointerup",this.handlers.onPointerUpOrCancel),document.removeEventListener("pointercancel",this.handlers.onPointerUpOrCancel)}setFps(e){this.fps=e,this.currentRenderBest()}setChapters(e){this.chapters=e,this.currentRenderBest()}async setThumbnailTracks(e){this.thumbnailTracks=e.slice(),this.thumbnailTracks.sort((e,t)=>t.bandwidth-e.bandwidth),await this.activateThumbnailSnap(!1)}async activateThumbnailSnap(e){this.snapToThumbnail=e?this.lastRendered?.thumb.track??this.thumbnailTracks[0]??null:null,this.current&&(this.current.seekPosition=await this.snapPosition(this.current.rawSeekPosition)),this.current&&this.renderSeekPosition(this.current.seekPosition),this.currentRenderBest()}setSeekMode(e){this.seekMode=e,this.currentRenderBest()}onWindowBlur(){this.cancelPreview()}onWindowResize(){this.cancelPreview()}async onPointerMove(e){const t=this.mouseEventToPosition(e);if(void 0===t)return this.setIsVisible(!1);const s=await this.snapPosition(t);"touch"===e.pointerType&&this.beginChange();let i=[];if(this.showThumbnailImage()){const e=s.seconds,t=.01*this.player.getStats().estimatedBandwidth;i=await this.getThumbnails(e,t)}const n=null===this.current;this.current={rawSeekPosition:t,seekPosition:s,thumbs:i},this.isChanging&&1&e.buttons&&this.interaction?.onChange?.(s),this.currentRenderBest(n)}async onPointerDown(e){if(1&e.buttons){const t=this.mouseEventToPosition(e,"mouse"===e.pointerType);if(void 0!==t){const e=await this.snapPosition(t);this.beginChange(),this.interaction?.onChange?.(e)}}}onPointerUpOrCancel(e){this.endChange(),"mouse"===e.pointerType&&void 0!==this.mouseEventToPosition(e)||this.setIsVisible(!1)}mouseEventToPosition(e,t=!0){const s=this.saneVideoDuration();if(void 0===s)return;if(null!==document.querySelector("input[type=button]:hover, button:hover"))return;const i=this.seekBar.getBoundingClientRect();let n=i.left;if(null!==this.deltaStart){const e=i.width/s;n=this.deltaStart.clientX-this.deltaStart.seconds*e}if(!this.isChanging)if(this.isVisible&&t){const{right:t,bottom:s}=i;if(!(n<=e.clientX&&e.clientX<=t&&e.clientY<=s))return;let{top:r}="wide"===this.seekMode?this.$container.getBoundingClientRect():this.seekBar.getBoundingClientRect();if(null!==this.openDisplayTimeout&&(r+=(s-r)/2),!(r<=e.clientY))return}else if(!(e.target instanceof Node&&this.seekBar.contains(e.target)))return;const r=s/i.width;return{absoluteRaw:a(e.clientX-n,[0,i.width]),secondsPerPixel:r}}async snapPosition(e){let{absoluteRaw:t,secondsPerPixel:s}=e,i=t*s;const n=this.chapters?.timeToChapter(i+2*s);let r=!1;if(!this.isChanging){if(null!==this.snapToThumbnail){const e=await this.getSingleThumbnail(this.snapToThumbnail,i);null!==e&&(i=e.imageTime,t=i/s)}n&&(i-n.timecode)/s<6&&(null===this.snapToThumbnail&&(i=n.timecode,t=i/s),r=!0)}return{absolute:t,seconds:i,chapter:n,onChapterMarker:r}}ensureDisplaySize(e,t){const s=Math.floor(160/e*t);this.$display.clientHeight!==s&&(this.$display.style.height=`${s}px`)}currentRenderBest(e=!1){e&&null===this.openDisplayTimeout?this.openDisplayTimeout=setTimeout(()=>{this.openDisplayTimeout=null,this.currentRenderBest()},100):null===this.openDisplayTimeout&&null===this.renderAnimationFrame&&(this.renderAnimationFrame=window.requestAnimationFrame(()=>{this.renderAnimationFrame=null;const e=this.current;if(null!==e){this.setIsVisible(!0,e.thumbs.length>0,!1),this.renderSeekPosition(e.seekPosition);for(const t of e.thumbs){const s=t.uris[0];if(void 0===s)continue;const i=this.network.getCached(s);if(null!==i){this.renderImageAndShow(s,t,i,e.seekPosition);break}this.network.get(s).then(()=>{this.currentRenderBest()})}}}))}renderImageAndShow(e,t,s,i){this.ensureDisplaySize(t.width,t.height),this.renderImage(e,t,s),this.setIsVisible(!0),this.positionContainer(i),this.renderSeekPosition(i,t)}renderImage(e,t,s,i=!1){if(i||null===this.lastRendered||t.imageTime!==this.lastRendered.thumb.imageTime||t.bandwidth!==this.lastRendered.thumb.bandwidth){const{positionX:i,positionY:n,width:r}=t,a=160/r;this.$img.replaceWith(s),this.$img=s,this.$img.style.transform=[`scale(${a})`,`translateX(-${i}px)`,`translateY(-${n}px)`].join(" "),this.$img.style.transformOrigin="left top",this.lastRendered={uri:e,thumb:t,tilesetImage:s}}}positionContainer(e){const t=a(e.absolute-this.$container.offsetWidth/2,[0,this.seekBar.clientWidth-this.$container.offsetWidth]);this.$container.style.left=`${t}px`}renderSeekPosition(e,t=null){const s=this.saneVideoDuration();if(void 0===s)return void this.setIsVisible(!1);this.$seekMarker.style.left=`${e.absolute}px`,null!==t&&null!==this.snapToThumbnail&&(this.$seekThumbBar.style.left=t.startTime/s*100+"%",this.$seekThumbBar.style.width=t.duration/s*100+"%"),e.onChapterMarker?this.$info.classList.add("on-chapter-marker"):this.$info.classList.remove("on-chapter-marker");const i=e.chapter?.title??"";this.$chapterText.innerText=i,g(this.$chapterText,"displayed",""!==i),this.$timecodeText.innerText=T(e.seconds,s>=3600,this.fps),this.positionContainer(e)}cancelPreview(){this.setIsVisible(!1),this.endChange()}beginChange(e=null){this.isChanging||(this.deltaStart=this.convertDelta(e),this.interaction?.onChangeStart?.(),document.body.classList.add("seek-or-scrub"),this.isChanging=!0)}convertDelta(e){if(null===e)return null;const t=this.player.getMediaElement();return null===t?null:{clientX:e,seconds:t.currentTime}}endChange(){this.isChanging&&(this.deltaStart=null,this.interaction?.onChangeEnd?.(),document.body.classList.remove("seek-or-scrub"),this.isChanging=!1)}get isVisible(){return null!==this.current}setIsVisible(e,t=e,s=t){e||(this.current=null),g(this.$container,"dlf-visible",e),g(this.$seekMarker,"dlf-visible",e),g(this.$seekThumbBar,"dlf-visible",s&&null!==this.snapToThumbnail),g(this.$display,"is-open",t),g(this.$img,"dlf-visible",s),function(e){e.draggable=!1,e.ondragstart=m}(this.$img)}async getThumbnails(e,t){let s=[];if(null!==this.snapToThumbnail)s=[this.snapToThumbnail];else{let e=this.thumbnailTracks.find(e=>e.bandwidththis.getSingleThumbnail(t,e));return v(await Promise.all(i))}async getSingleThumbnail(e,t){const s=await e.getThumb(t),i=this.saneVideoDuration();return null===s||void 0===i?null:(r=i,(n=s).startTime0?e:void 0}}class S extends n().ui.Element{static register(){n().ui.Controls.registerSeekBar({create:(e,t)=>new S(e,t)})}constructor(e,t){super(e,t),this.$container=r("div",{className:"dlf-media-flat-seek-bar"},[this.$range=r("div",{className:"range"})]),e.prepend(this.$container),this.dlf={mediaProperties:{poster:null,chapters:null,fps:null,variantGroups:null},hasRenderedChapters:!1,value:0,uiConfig:t.getConfig(),wasPlaying:!1,seekTimer:null,thumbnailPreview:null,lastGradientStr:""},this.dlf.seekTimer=new(n().util.Timer)(()=>{null!==this.video&&(this.video.currentTime=this.getValue(),this.controls?.dispatchEvent(new CustomEvent("dlf-media-manual-seek",{})))}),null!==this.player&&(this.dlf.thumbnailPreview=new C({seekBar:this.$container,player:this.player,network:new k,interaction:{onChangeStart:()=>{this.controls?.setSeeking(!0),null!==this.video&&(this.dlf.wasPlaying=!this.video.paused,this.video.pause())},onChange:e=>{this.dlf.value=e.seconds,this.update(),this.dlf.seekTimer?.tickAfter(.125)},onChangeEnd:()=>{this.dlf.seekTimer?.tickNow(),this.controls?.setSeeking(!1),this.dlf.wasPlaying&&this.video?.play()}}})),this.eventManager&&(this.eventManager.listen(this.player,"loaded",()=>{this.update()}),this.eventManager.listen(this.player,"variantchanged",()=>{this.updatePreviewImageTracks()}),this.eventManager.listen(this.controls,"dlf-media-properties",e=>{const t=e.detail;this.dlf.mediaProperties=t.fullProps;const{chapters:s,fps:i,variantGroups:n}=t.updateProps;void 0!==s&&(this.dlf.hasRenderedChapters=!1,this.dlf.thumbnailPreview?.setChapters(s),this.update()),void 0!==i&&this.dlf.thumbnailPreview?.setFps(i?.rate??null),n&&this.updatePreviewImageTracks()}),this.controls?.dispatchEvent(new CustomEvent("dlf-media-seek-bar",{detail:{seekBar:this}})))}release(){null!==this.dlf.seekTimer&&(this.dlf.seekTimer.stop(),this.dlf.seekTimer=null),null!==this.dlf.thumbnailPreview&&(this.dlf.thumbnailPreview.release(),this.dlf.thumbnailPreview=null),super.release()}get thumbnailPreview(){return this.dlf.thumbnailPreview}isThumbnailPreviewOpen(){return this.dlf.thumbnailPreview?.isVisible??!1}endSeek(){this.dlf.thumbnailPreview?.endChange(),this.dlf.thumbnailPreview?.setIsVisible(!1)}setThumbnailSnap(e){this.dlf.thumbnailPreview?.activateThumbnailSnap(e)}renderChapterMarkers(e,t){this.$range.querySelectorAll(".dlf-media-chapter-marker").forEach(e=>{e.remove()});for(const s of e){const e=s.timecode/t;if(!(0<=e&&e<1))continue;const i=document.createElement("span");i.className="dlf-media-chapter-marker",i.style.position="absolute",i.style.left=100*e+"%",this.$range.append(i)}}updatePreviewImageTracks(){if(null===this.dlf.thumbnailPreview)return void console.warn("FlatSeekBar: Missing thumbnail preview");const{variantGroups:e}=this.dlf.mediaProperties;if(null===e)return;const t=e.findThumbnailTracks();this.dlf.thumbnailPreview.setThumbnailTracks(t)}getValue(){return this.dlf.value}isShowing(){return!0}setValue(e){this.controls?.isSeeking()||(this.dlf.value=e)}makeColor(e,t){return`${e} ${100*t}%`}update(){if(null===this.video)return void console.warn("FlatSeekBar: Missing video");const e=this.video.duration;if(!(e>0))return;const{chapters:t}=this.dlf.mediaProperties;null==t||this.dlf.hasRenderedChapters||(this.renderChapterMarkers(t,e),this.dlf.hasRenderedChapters=!0);const s=getComputedStyle(this.$container),i={base:s.getPropertyValue("--base-color")||"rgba(255, 255, 255, 0.3)",buffered:s.getPropertyValue("--buffered-color")||"rgba(255, 255, 255, 0.54)",played:s.getPropertyValue("--played-color")||"rgb(255, 255, 255)"},n=this.getValue(),r=this.video.buffered.length,a=r?this.video.buffered.start(0):0,o=r?this.video.buffered.end(r-1):0,l={start:0,end:e},h=l.end-l.start,d=Math.max(a,l.start),c=Math.min(o,l.end),u=Math.min(Math.max(n,l.start),l.end),p=(d-l.start)/h||0,m=(c-l.start)/h||0,f=(u-l.start)/h||0,g=this.dlf.uiConfig.showUnbufferedStart?i.base:i.played,v="linear-gradient("+["to right",this.makeColor(g,p),this.makeColor(i.played,p),this.makeColor(i.played,f),this.makeColor(i.buffered,f),this.makeColor(i.buffered,m),this.makeColor(i.base,m)].join(",")+")";v!==this.dlf.lastGradientStr&&(this.dlf.lastGradientStr=v,this.$range.style.background=v)}}class P extends y{constructor(e,t,s,i={}){const n=r("button",{className:"material-icons-round shaka-fullscreen-button shaka-tooltip"},["fullscreen"]);n.setAttribute("data-t-title","control.bookmark.tooltip"),super(e,t,s,{...i,element:n}),this.eventManager&&this.eventManager.listen(document,"fullscreenchange",this.updateFullScreenButton.bind(this)),this.updateFullScreenButton()}updateControlPanelButton(){}updateFullScreenButton(){document.fullscreenEnabled?(this.dlf.element.textContent=document.fullscreenElement?"fullscreen_exit":"fullscreen",this.dlf.element.ariaLabel=document.fullscreenElement?this.env.t("control.fullscreen_exit.tooltip"):this.env.t("control.fullscreen.tooltip")):this.dlf.element.classList.add("shaka-hidden")}}n().ui.SettingsMenu;class x extends n().ui.PlaybackRateSelection{static register(e){const t=e.mkid();return n().ui.OverflowMenu.registerElement(t,{create:(t,s)=>new x(t,s,e)}),t}constructor(e,t,s){super(e,t),this.$playRateTooltip=r("div",{className:"dlf-playrate-tooltip"});const i=this.player?.getPlaybackRate()||1;this.$playRateTooltip.textContent=this.getRateStr(i),this.$container=r("div",{className:"shaka-range-container dlf-playrate-slider"},[this.$input=r("input",{className:"shaka-range-element",type:"range",valueAsNumber:Math.log2(i),min:"-1",max:"1",step:"0.01",$input:()=>{const e=2**this.$input.valueAsNumber,t=this.player?.getMediaElement();t&&(t.playbackRate=e,t.defaultPlaybackRate=e)}}),this.$playRateTooltip]),null!==this.player&&this.menu.insertBefore(this.$container,this.backButton.nextSibling),null!==this.eventManager&&this.eventManager.listen(this.player,"ratechange",()=>{if(null!==this.player){const e=this.player.getPlaybackRate();this.$input.valueAsNumber=Math.log2(e);const t=this.getRateStr(e);this.currentSelection.textContent=t,this.button.setAttribute("shaka-status",t),this.updateTooltip(e,this.$input)}})}getRateStr(e){return`${e.toLocaleString(void 0,{maximumFractionDigits:2})}x`}updateTooltip(e,t){const s=t.valueAsNumber,i=t.min?parseFloat(t.min):0,n=t.max?parseFloat(t.max):100,r=Number(100*(s-i)/(n-i));this.$playRateTooltip.textContent=this.getRateStr(e),this.$playRateTooltip.style.left=`calc(${r}% + (${17-.35*r}px))`}}const _=0,M=1,$=2;class E extends n().ui.Element{static register(e){const t=e.mkid();return n().ui.Controls.registerElement(t,{create:(t,s)=>new E(t,s,e)}),t}constructor(e,t,s){super(e,t);const i=r("button",{className:"shaka-current-time shaka-tooltip",ariaLabel:s.t("control.time.tooltip")});if(e.appendChild(i),this.dlf={env:s,currentTime:i},this.state={isReady:!1,activeMode:0,totalSeconds:0,duration:0,mediaProperties:{chapters:null,fps:null}},this.eventManager){this.eventManager.listen(i,"click",()=>{this.render({activeMode:(this.state.activeMode+1)%3})});const e=this.updateTime.bind(this);this.eventManager.listen(this.controls,"timeandseekrangeupdated",e),this.eventManager.listen(this.controls,"dlf-media-properties",e=>{const t=e.detail;this.render({mediaProperties:t.fullProps})})}}updateTime(){if(null===this.controls||null===this.video||this.video.readyState<1)this.render({isReady:!1});else{let e=this.video.duration;e>=0||(e=0),this.render({isReady:!0,duration:e,totalSeconds:a(this.controls.getDisplayTime(),[0,e])})}}render(e){const t=Object.assign({},this.state,e);if(Object.keys(e).some(t=>e[t]!==this.state[t])){const e={[_]:"current-time",[M]:"remaining-time",[$]:"current-frame"}[t.activeMode]??"current-time";this.dlf.currentTime.textContent=this.getTimecodeText(e,t)}this.state=t}getTimecodeText(e,{isReady:t,totalSeconds:s,duration:i,mediaProperties:n}){if(t&&0!==i){const t=i>=3600,{chapters:r,fps:a}=n,o=a?.rate??null,l={get chapterTitle(){return r?.timeToChapter(s)?.title??"_"},get currentTime(){return T(s,t,o)},get totalTime(){return T(i,t,o)},get remainingTime(){return T(i-s,t,o)},get currentFrame(){return a?.vifa.get()??-1}};return this.dlf.env.t(`control.time.${e}.text`,l)}return this.dlf.env.t("player.loading")}}class A extends n().ui.SettingsMenu{static register(e){const t=e.mkid();return n().ui.OverflowMenu.registerElement(t,{create:(t,s)=>new A(t,s,e)}),t}constructor(e,t,s){super(e,t,"switch_video"),this.dlf={env:s,activeCheck:r("i",{className:"material-icons-round shaka-chosen-item"},["done"]),variantGroups:null},this.updateStrings(),this.updateVisibility(),this.menuButtons={},this.eventManager&&(this.eventManager.listen(this.controls,"dlf-media-properties",e=>{const t=e.detail,{variantGroups:s}=t.updateProps;if(void 0!==s)try{this.setVariantGroups(s)}catch(e){console.error(e)}}),this.eventManager.listen(this.player,"variantchanged",()=>{this.markActiveGroup()}))}setVariantGroups(e){if(this.dlf.variantGroups=e,this.clearMenu(),this.updateVisibility(),null!==e){for(const t of e){const e=r("button",{$click:()=>{this.dlf.variantGroups?.selectGroupByKey(t.key)}},[r("span",{},[t.key])]);this.menu.appendChild(e),this.menuButtons[t.key]=e}this.markActiveGroup()}}clearMenu(){for(const e of Object.values(this.menuButtons))e.remove();this.menuButtons={}}markActiveGroup(){const e=this.dlf.variantGroups?.findActiveGroup();e&&(this.menuButtons[e.key]?.appendChild(this.dlf.activeCheck),this.currentSelection.textContent=e.key)}updateVisibility(){(this.dlf.variantGroups?.numGroups??0)>0?this.button.classList.remove("shaka-hidden"):this.button.classList.add("shaka-hidden")}updateStrings(){const e=this.dlf.env.t("control.back"),t=this.dlf.env.t("control.video-track.title");this.backButton.ariaLabel=e,this.button.ariaLabel=t,this.nameSpan.textContent=t,this.backSpan.textContent=t}}class R{constructor(e){this.elements=e.slice(),this.elements.sort((e,t)=>e.timecode-t.timecode),this.elementToIndex=new Map;for(const[e,t]of this.elements.entries())this.elementToIndex.set(t,e)}at(e){return this.elements[e]}indexOf(e){return this.elementToIndex.get(e)}advance(e,t=1){const s=this.indexOf(e);if(void 0!==s)return this.elements[s+t]}timeToElement(e){return this.timeToEntry(e)?.[1]}timeToEntry(e){if(0===this.elements.length)return;let t=0,s=this.elements.length-1;for(;t+1=0;e--)yield this.elements[e]}}class B extends R{timeToChapter(e){return this.timeToElement(e)}filter(e){return new B(this.elements.filter(e))}static isEqual(e,t){return e===t||null!==e&&null!==t&&e.timecode===t.timecode&&!!globalThis.dlfUtils?.arrayEqualsByIdentity(e.fileIds,t.fileIds)}}class q{constructor(){this.__listeners=new Map}addEventListener(e,t,s={}){if(arguments.length<2)throw new TypeError("TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only "+arguments.length+" present.");const i=this.__listeners,n=e.toString();i.has(n)||i.set(n,new Map);const r=i.get(n);r.has(t)||r.set(t,s)}removeEventListener(e,t,s){if(arguments.length<2)throw new TypeError("TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only "+arguments.length+" present.");const i=this.__listeners,n=e.toString();if(i.has(n)){const e=i.get(n);e.has(t)&&e.delete(t)}}dispatchEvent(e){if(!(e instanceof Event))throw new TypeError("Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.");const t=e.type,s=this.__listeners.get(t);if(s)for(var i of s.entries()){const t=i[0],n=i[1];try{"function"==typeof t?t.call(this,e):t&&"function"==typeof t.handleEvent&&t.handleEvent(e)}catch(e){setTimeout(()=>{throw e})}n&&n.once&&s.delete(t)}return!0}}class F extends q{constructor(){super(),this.cnt_=0,this.activeSegment_=null,this.segments_={}}get activeSegment(){return this.activeSegment_}add(e){const t=e.id??this.makeId(),s=this.segments_[t]={labelText:"",editable:!0,...e,id:t,toTimeRange(){return{startTime:this.startTime,endTime:this.endTime??null}}};return this.dispatchEvent(new CustomEvent("add",{detail:{segments:[s]}})),this.activateSegmentById(s.id),s}update(e,t=!1){const s=this.segments_[e.id],i=Object.assign({},s);if(void 0!==s){for(const[t,i]of Object.entries(e))void 0!==i&&(s[t]=i);this.dispatchEvent(new CustomEvent("update",{detail:{segment:s,prevSegment:i}})),t&&this.activateSegment(s)}}removeById(e){const t=this.segments_[e];delete this.segments_[e],void 0!==t&&this.dispatchEvent(new CustomEvent("remove",{detail:{segments:[t]}})),null!==this.activeSegment_&&e===this.activeSegment_.id&&this.activateSegment(null)}removeAll(){this.segments_={},this.dispatchEvent(new CustomEvent("remove_all",{detail:{}})),this.activateSegment(null)}activateSegmentById(e){const t=this.segments_[e];void 0!==t&&this.activateSegment(t)}activateSegment(e){e!==this.activeSegment_&&(this.activeSegment_=e,this.dispatchEvent(new CustomEvent("activate_segment",{detail:{segment:this.activeSegment_}})))}getSegment(e){return this.segments_[e]}getSegments(){return Object.values(this.segments_)}makeId(){return"dlf.segments."+this.cnt_++}}var I=s(2065);class L{constructor(){this.idCnt=0,this.testElements={},this.lang={twoLetterIsoCode:"en",phrasesInput:{},phrasesCompiled:{}}}getLocation(){return new URL(window.location.href)}supportsMediaSource(){return void 0!==window.MediaSource&&void 0!==window.MediaSource.isTypeSupported}supportsCanvasExport(e){var t;return(t=this.getTestElement("canvas").toDataURL(e),t.match(/data:(.*);/)?.[1])===e}supportsVideoMime(e){return""!==this.getTestElement("video").canPlayType(e)}getKeyboardVariant(){return navigator.userAgent.includes("Mac")?"mac":"ibm"}isInFullScreen(){return null!==b()}async toggleFullScreen(e,t){if(document.fullscreenElement)screen.orientation&&screen.orientation.unlock(),await document.exitFullscreen();else try{if(document.pictureInPictureElement&&await document.exitPictureInPicture(),await e.requestFullscreen({navigationUI:"hide"}),t&&screen.orientation)try{await screen.orientation.lock("landscape")}catch(e){}}catch(e){console.log(e)}}mkid(){return"__autoid_"+ ++this.idCnt}uuidv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})}setLang(e){this.lang={twoLetterIsoCode:e.twoLetterIsoCode,phrasesInput:e.phrases,phrasesCompiled:{}}}t(e,t={},s=void 0){let i=this.lang.phrasesCompiled[e];if(void 0===i){const t=this.lang.phrasesInput[e];if(void 0===t)return"function"==typeof s?s():(console.error(`Warning: Translation key '${e}' not defined, fallback not provided.`),e);i=this.lang.phrasesCompiled[e]=new I.Ay(t,this.lang.twoLetterIsoCode,{},{ignoreTag:!0})}return i.format(t)}getTestElement(e){return this.testElements[e]??document.createElement(e)}}class N{constructor(){this.listeners_=[]}record(e){const t=EventTarget.prototype.addEventListener,s=q.prototype.addEventListener,i=this;try{EventTarget.prototype.addEventListener=function(e,s,n){i.listeners_.push({target:this,type:e,callback:s,options:n}),t.call(this,e,s,n)},q.prototype.addEventListener=function(e,t,n){i.listeners_.push({target:this,type:e,callback:t,options:n}),s.call(this,e,t,n)},e()}finally{EventTarget.prototype.addEventListener=t,q.prototype.addEventListener=s}}removeAll(){for(const e of this.listeners_)e.target.removeEventListener(e.type,e.callback,e.options)}}function O(e){return"function"==typeof e?{isAvailable:()=>!0,execute:e}:{isAvailable:e.isAvailable??(()=>!0),execute:e.execute??(()=>!1)}}function D(e){return"audio"===e||"video"===e}var V=s(7007),U=s.n(V);class G{constructor(e={}){this.config={tapMaxDelay:200,tapMaxDistance:20,swipeMinDistance:100,holdMinDelay:200,allowGesture:()=>!0,...e},this.last={tapdown:null,tapup:null},this.holdTimeout=null,this.tapCount=0,this.handlers={contextmenu:this.handleContextMenu.bind(this),pointerdown:this.handlePointerDown.bind(this),pointerup:this.handlePointerUp.bind(this),pointercancel:this.handlePointerCancel.bind(this),pointerleave:this.handlePointerLeave.bind(this)},this.events=new(U())}register(e){e.addEventListener("contextmenu",this.handlers.contextmenu),e.addEventListener("pointerdown",this.handlers.pointerdown),e.addEventListener("pointerup",this.handlers.pointerup),e.addEventListener("pointercancel",this.handlers.pointercancel),e.addEventListener("pointerleave",this.handlers.pointerleave)}deregister(e){e.removeEventListener("contextmenu",this.handlers.contextmenu),e.removeEventListener("pointerdown",this.handlers.pointerdown),e.removeEventListener("pointerup",this.handlers.pointerup),e.removeEventListener("pointercancel",this.handlers.pointercancel),e.removeEventListener("pointerleave",this.handlers.pointerleave)}on(e,t){this.events.on(e,t)}handleContextMenu(e){this.release()}handlePointerDown(e){if(0!==e.button||!this.config.allowGesture(e))return void this.release();const t=this.getStat(e);"tap"===this.getContinuation(this.last.tapup,t)?this.tapCount++:this.tapCount=1;const s=this.tapCount;this.clearHold(),this.holdTimeout=setTimeout(()=>{this.events.emit("gesture",{type:"hold",event:e,position:t.positionRel,tapCount:s})},this.config.holdMinDelay),this.emitTap("tapdown",e,t)}handlePointerUp(e){if(0!==e.button||!this.config.allowGesture(e))return;const t=this.getStat(e);this.clearHold();const s=this.getContinuation(this.last.tapdown,t);if("tap"===s)this.emitTap("tapup",e,t);else if(1===this.tapCount&&"swipe"===s){const s=this.last.tapdown,i=t,n=Math.atan2(s.positionPx.y-i.positionPx.y,i.positionPx.x-s.positionPx.x),r=Math.abs(n/Math.PI*180);let a;a=r<45?"east":r<135?n>0?"north":"south":"west",this.events.emit("gesture",{type:"swipe",event:e,begin:s.positionRel,end:i.positionRel,angle:n,direction:a}),this.reset()}else this.release()}handlePointerCancel(e){this.release()}handlePointerLeave(e){const{tapdown:t,tapup:s}=this.last;(null===t||null!==s&&t.date>s.date)&&this.release()}emitTap(e,t,s){this.events.emit("gesture",{type:e,event:t,position:s.positionRel,tapCount:this.tapCount}),this.last[e]=s}release(){const e=this.isActive;this.reset(),e&&this.events.emit("release")}reset(){this.tapCount=0,this.clearHold(),this.last={tapdown:null,tapup:null}}get isActive(){return 0!==this.tapCount||null!==this.last.tapdown||null!==this.last.tapup}getStat(e){const t=e.target.getBoundingClientRect(),s={x:e.clientX,y:e.clientY},i={x:e.screenX||s.x,y:e.screenY||s.y},n={x:(s.x-t.left)/t.width,y:(s.y-t.top)/t.height};return{date:new Date,positionClientPx:s,positionPx:i,positionRel:n}}getContinuation(e,t){if(null===e)return"tap";if(t.date.valueOf()-e.date.valueOf()>this.config.tapMaxDelay)return"cancel";const s=(t.positionPx.x-e.positionPx.x)**2+(t.positionPx.y-e.positionPx.y)**2;return s<=this.config.tapMaxDistance**2?"tap":s>=this.config.swipeMinDistance**2?"swipe":"cancel"}clearHold(){null!==this.holdTimeout&&(clearTimeout(this.holdTimeout),this.holdTimeout=null)}}class z{constructor(e,t,s,i){this.constants={minBottomControlsReadyState:2},this.env=e,this.eventMgr_=t,this.player=s,this.media=i,this.mediaProperties={poster:null,chapters:null,fps:null,variantGroups:null},this.lastReadyState=0,this.playerProperties={mode:"audio",locale:"",state:"poster",error:null,controlElements:[],actions:{},playerView:null},this.overflowMenuButtons=[],this.shakaBottomControls=null,this.shakaBottomControlElements=[],this.seekBar_=null,this.$container=r("div",{className:"dlf-media-player dlf-shaka"},[this.$videoBox=r("div",{className:"dlf-media-shaka-box"},[this.$video=i,this.$poster=r("img",{className:"dlf-media-poster dlf-visible",$error:()=>{this.hidePoster()}})]),this.$errorBox=r("div",{className:"dlf-media-shaka-box dlf-media-error"})]),this.ui=new(n().ui.Overlay)(this.player,this.$videoBox,this.media),this.controls=this.ui.getControls(),this.configureTimeout=null,this.isConfigured=!1,this.gestures_=new G({allowGesture:this.allowGesture.bind(this)}),this.handlers={onControlsErrorEvent:this.onControlsErrorEvent.bind(this),onPlay:this.onPlay.bind(this),onTimeUpdate:this.onTimeUpdate.bind(this),afterManualSeek:this.afterManualSeek.bind(this)},this.registerEventHandlers(),this.scheduleConfigure()}destroy(){this.controls.destroy(),this.gestures_.deregister(this.$videoBox)}registerEventHandlers(){this.controls.addEventListener("error",this.handlers.onControlsErrorEvent),this.controls.addEventListener("dlf-media-seek-bar",e=>{const t=e.detail;this.seekBar_=t.seekBar,this.autosetSeekMode()}),this.controls.addEventListener("dlf-media-manual-seek",this.handlers.afterManualSeek),this.controls.addEventListener("timeandseekrangeupdated",this.handlers.onTimeUpdate),this.media.addEventListener("play",this.handlers.onPlay),this.gestures_.register(this.$videoBox)}get domElement(){return this.$container}get seekBar(){return this.seekBar_}get gestures(){return this.gestures_}updateMediaProperties(e){Object.assign(this.mediaProperties,e),this.notifyMediaProperties(this.mediaProperties,e)}notifyMediaProperties(e=this.mediaProperties,t=e){void 0!==t.poster&&this.renderPoster();const s=new CustomEvent("dlf-media-properties",{detail:{updateProps:t,fullProps:e}});this.controls.dispatchEvent(s)}updatePlayerProperties(e){const t=void 0!==e.mode&&(!this.isConfigured||e.mode!==this.playerProperties.mode)||void 0!==e.controlElements&&(!this.isConfigured||e.controlElements!==this.playerProperties.controlElements);for(const[t,s]of Object.entries(e))void 0!==s&&(this.playerProperties[t]=s);void 0!==e.locale&&this.controls.getLocalization()?.changeLocale([e.locale]),void 0!==e.state&&this.renderPoster(),void 0!==e.error&&this.renderError(),t&&this.scheduleConfigure()}handleEscape(){return this.seekBar?.isThumbnailPreviewOpen()?(this.seekBar?.endSeek(),!0):!!this.controls.anySettingsMenusAreOpen()&&(this.controls.hideSettingsMenus(),!0)}afterManualSeek(){this.hidePoster()}alwaysPrependBottomControl(e){this.prependBottomControl(e),this.shakaBottomControlElements.push(e)}prependBottomControl(e){if("video"===this.playerProperties.mode)this.shakaBottomControls?.prepend(e);else{const t=this.$container.parentElement;null!==t&&null!==t.parentElement&&t.parentElement.insertBefore(e,t)}}addOverflowButton(...e){this.overflowMenuButtons.push(...e),this.scheduleConfigure()}scheduleConfigure(){null===this.configureTimeout&&(this.configureTimeout=setTimeout(()=>{this.configureTimeout=null,this.configure()}))}configure(){if(S.register(),this.$container.setAttribute("data-mode",this.playerProperties.mode),this.playerProperties.playerView?.setAttribute("data-mode",this.playerProperties.mode),this.ui.configure(this.getShakaConfiguration()),this.isConfigured=!0,this.autosetSeekMode(),this.$videoBox.dispatchEvent(new MouseEvent("mousemove")),this.shakaBottomControls=this.$videoBox.querySelector(".shaka-bottom-controls"),null!==this.shakaBottomControls)for(const e of this.shakaBottomControlElements)this.prependBottomControl(e);this.notifyMediaProperties()}autosetSeekMode(){const e="audio"===this.playerProperties.mode?"narrow":"wide";this.seekBar_?.thumbnailPreview?.setSeekMode(e)}getShakaConfiguration(){const e=this.playerProperties.mode,t=this.playerProperties.controlElements,s=getComputedStyle(this.$container);return{addSeekBar:!0,enableTooltips:!0,controlPanelElements:["play_pause",E.register(this.env),"spacer",...t.map(this.makeControlElement.bind(this)),"overflow_menu"],overflowMenuButtons:["language",A.register(this.env),x.register(this.env),"loop","quality","picture_in_picture","captions",...this.overflowMenuButtons],addBigPlayButton:"video"===e,fadeDelay:"audio"===e?1e8:void 0,volumeBarColors:{base:s.getPropertyValue("--volume-base-color")||"rgba(255, 255, 255, 0.54)",level:s.getPropertyValue("--volume-level-color")||"rgb(255, 255, 255)"},enableKeyboardPlaybackControls:!1,doubleClickForFullscreen:!1,singleClickForPlayAndPause:!1,seekOnTaps:!1}}makeControlElement(e){const t=this.playerProperties.actions,s=e.getAttribute("data-type");if(null===s){const s=e.getAttribute("data-action")??"";return y.register(this.env,{element:e,onClickAction:O({isAvailable:()=>t[s]?.isAvailable()??!1,execute:()=>{t[s]?.execute()}})})}return"fullscreen"===s?P.register(this.env,{onClickAction:t["fullscreen.toggle"]}):s}hideBigPlayButton(){const e=document.querySelector(".shaka-controls-container .shaka-play-button");e&&e.classList.add("dlf-hide-big-play-button")}hidePoster(){this.$poster.classList.remove("dlf-visible")}renderPoster(){const e=null!==this.mediaProperties.poster&&"poster"===this.playerProperties.state;e&&(this.$poster.src=this.mediaProperties.poster),g(this.$poster,"dlf-visible",e)}renderError(){null===this.playerProperties.error?g(this.$errorBox,"dlf-visible",!1):(g(this.$errorBox,"dlf-visible",!0),this.$errorBox.textContent=this.env.t(this.playerProperties.error))}allowGesture(e){const t=this.$videoBox.getBoundingClientRect(),s=this.shakaBottomControls?.getBoundingClientRect().height??0,i=t.bottom-s-20;return!(e.clientY>=i)&&e.target===this.$videoBox.querySelector(".shaka-play-button-container")}onControlsErrorEvent(e){if(e instanceof CustomEvent){const t=e.detail;console.error("Error from Shaka controls",t.code,t)}}onPlay(){this.hidePoster(),this.hideBigPlayButton()}onTimeUpdate(){const e=this.media.readyState;e!==this.lastReadyState&&this.updateBottomControlsVisibility(e)}updateBottomControlsVisibility(e){0===e?this.shakaBottomControls?.classList.remove("dlf-visible"):e>=this.constants.minBottomControlsReadyState&&this.shakaBottomControls?.classList.add("dlf-visible")}}class j{constructor(e,t){this.player=e,this.track=t}get bandwidth(){return this.track.bandwidth}async getThumb(e){const t=await this.player.getThumbnails(this.track.id,e);return null===t?null:{track:this,...t,imageTime:t.startTime+t.duration/2-1e-5,bandwidth:this.track.bandwidth}}}class H{constructor(e){if(this.player=e,this.manifest=e.getManifest(),this.groupKeys=[],this.groups=[],this.keyToGroup={},null!==this.manifest)for(const e of this.manifest.variants)this.addVariant(e);else console.warn("Manifest not available")}static splitRepresentationId(e){const t=(e??"").split("#");return{id:t[0]??null,group:t[1]??"Standard"}}addVariant(e){const t=e.video;if(t){const s=H.splitRepresentationId(t.originalId).group,i=this.getGroupOrCreate(s);i.variants.push(e);for(const e of t.roles)i.roles.add(e);t.primary&&(i.hasPrimary=!0)}}get numGroups(){return this.groupKeys.length}getGroupOrCreate(e){let t=this.keyToGroup[e];return t||(t=this.keyToGroup[e]={key:e,variants:[],roles:new Set,hasPrimary:!1},this.groupKeys.push(e),this.groups.push(t)),t}findActiveTrack(){return this.player.getVariantTracks().find(e=>e.active)}findThumbnailTracks(){const e=[],t=this.findActiveGroup()?.key;for(const s of this.player.getImageTracks())H.splitRepresentationId(s.originalImageId).group===t&&e.push(new j(this.player,s));return e}findActiveGroup(){const e=this.findActiveTrack();if(e){const t=H.splitRepresentationId(e.originalVideoId).group;return this.keyToGroup[t]}}selectGroup(e){if(this.manifest){if(this.manifest.variants!==e.variants){const t=this.findActiveTrack();this.manifest.variants=e.variants,this.player.selectAudioLanguage(t?.language??"und")}}else console.warn("Cannot select group: Manifest not available")}trySelectGroup(e){return!!e&&(this.selectGroup(e),!0)}selectGroupByKey(e){return this.trySelectGroup(this.keyToGroup[e])}selectGroupByIndex(e){return this.trySelectGroup(this.groups[e])}selectGroupByRole(e){return this.trySelectGroup(this.groups.find(t=>t.roles.has(e)))}selectGroupWithPrimary(){return this.trySelectGroup(this.groups.find(e=>e.hasPrimary))}*[Symbol.iterator](){for(const e in this.keyToGroup)yield this.keyToGroup[e]}}var W=function(e){if(this===window)return new W(e);this.obj=e||{},this.frameRate=this.obj.frameRate||24,this.video=document.getElementById(this.obj.id)||document.getElementsByTagName("video")[0]};W.prototype={get:function(){return Math.floor(this.video.currentTime.toFixed(5)*this.frameRate)},listen:function(e,t){var s=this;e?this.interval=setInterval(function(){if(!s.video.paused&&!s.video.ended){var t="SMPTE"===e?s.toSMPTE():"time"===e?s.toTime():s.get();return s.obj.callback&&s.obj.callback(t,e),t}},t||1e3/s.frameRate/2):console.log("VideoFrame: Error - The listen method requires the format parameter.")},stopListen:function(){clearInterval(this.interval)},fps:{film:24,NTSC:29.97,NTSC_Film:23.98,NTSC_HD:59.94,PAL:25,PAL_HD:50,web:30,high:60}},W.prototype.toTime=function(e){var t="number"!=typeof e?this.video.currentTime:e,s=this.frameRate,i=new Date,n="hh:mm:ss"+("number"==typeof e?":ff":"");function r(e){return e<10?"0"+e:e}return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(1e3*t),n.replace(/hh|mm|ss|ff/g,function(e){switch(e){case"hh":return r(i.getHours()<13?i.getHours():i.getHours()-12);case"mm":return r(i.getMinutes());case"ss":return r(i.getSeconds());case"ff":return r(Math.floor(t%1*s))}})},W.prototype.toSMPTE=function(e){if(!e)return this.toTime(this.video.currentTime);var t=Number(e),s=this.frameRate;function i(e){return e<10?"0"+e:e}var n=60*s,r=(t/(60*s*60)).toFixed(0),a=Number((t/n).toString().split(".")[0])%60,o=Number((t/s).toString().split(".")[0])%60;return i(r)+":"+i(a)+":"+i(o)+":"+i(t%s)},W.prototype.toSeconds=function(e){if(!e)return Math.floor(this.video.currentTime);var t=e.split(":");return 60*Number(t[0])*60+60*Number(t[1])+Number(t[2])},W.prototype.toMilliseconds=function(e){var t=Number(e?e.split(":")[3]:this.toSMPTE().split(":")[3]),s=1e3/this.frameRate*(isNaN(t)?0:t);return Math.floor(1e3*this.toSeconds(e)+s)},W.prototype.toFrames=function(e){var t=e?e.split(":"):this.toSMPTE().split(":"),s=this.frameRate,i=60*Number(t[0])*60*s,n=60*Number(t[1])*s,r=Number(t[2])*s,a=Number(t[3]);return Math.floor(i+n+r+a)},W.prototype.__seek=function(e,t){this.video.paused||this.video.pause();var s=Number(this.get());this.video.currentTime=("backward"===e?s-t:s+t)/this.frameRate+1e-5},W.prototype.seekForward=function(e,t){return e||(e=1),this.__seek("forward",Number(e)),!t||t()},W.prototype.seekBackward=function(e,t){return e||(e=1),this.__seek("backward",Number(e)),!t||t()},W.prototype.seekTo=function(e){var t,s,i=e||{},n=Object.keys(i)[0];if("SMPTE"==n||"time"==n)return s=i[n],t=this.toMilliseconds(s)/1e3+.001,void(this.video.currentTime=t);switch(n){case"frame":s=this.toSMPTE(i[n]),t=this.toMilliseconds(s)/1e3+.001;break;case"seconds":t=Number(i[n]);break;case"milliseconds":t=Number(i[n])/1e3+.001}isNaN(t)||(this.video.currentTime=t)};const K=W;class X extends HTMLElement{static hasInstalledPolyfills=!1;constructor(){super(),X.hasInstalledPolyfills||(n().polyfill.installAll(),X.hasInstalledPolyfills=!0),this.config=null,this.env=new L,this.eventMgr_=new N,this.constants=this.constantDefaults(),this.dlf={handlers:{onDomContentLoaded:this.onDomContentLoaded.bind(this),onPlayerErrorEvent:this.onPlayerErrorEvent.bind(this),onTrackChange:this.onTrackChange.bind(this),onTick:this.onTick.bind(this),onPlay:this.onPlay.bind(this)}},this.video=r("video",{id:this.env.mkid(),className:"dlf-media"}),this.videoPausedOn=null,this.currentSource=null,this.timeRange=null,this.player=new(n().Player),this.player.attach(this.video),this.fps=null,this.variantGroups=null,this.chapters_=new B([]),this.currentChapter=null,this.markers_=new F,this.frontend=new z(this.env,this.eventMgr_,this.player,this.video),this.playerView=null,this.autoplay_=!1,this.mode="auto",this.hasBeenConnected_=!1,this.__dlfRegisterEvents(),this.actions=this.getActions()}getEnv(){return this.env}getMarkers(){return this.markers_}connectedCallback(){if(this.hasBeenConnected_)return;this.hasBeenConnected_=!0;const e=this.getConfig();this.env.setLang(e.lang);const t=this.getAttribute("autoplay");this.autoplay_=null!==t&&"false"!==t,this.timeRange=this.getTimeRange(),null!==this.timeRange&&this.markers_.add({id:"dlf.segment_shared",startTime:this.timeRange.startTime,endTime:this.timeRange.endTime??void 0,labelText:this.env.t("share.shared_timecode"),editable:!1});const s=this.getAttribute("player-view");null!==s&&(this.playerView=document.getElementById(s)),this.configureFrontend(e),setTimeout(()=>{this.loadSources(),this.parseChapters()}),this.appendChild(this.frontend.domElement),this.frontend.domElement.className+=` ${this.className}`}destroy(){this.eventMgr_.removeAll(),this.player.destroy(),this.frontend.destroy(),this.remove()}configureFrontend(e){const t=Array.from(this.querySelectorAll("dlf-media-controls *")).filter(e=>e instanceof HTMLElement),s=this.getAttribute("mode");let i;if("auto"===s){const e=this.getAttribute("mode-fallback");D(e)&&(i=e),this.mode=s}else D(s)&&(this.mode=i=s);this.frontend.updatePlayerProperties({locale:e.lang.twoLetterIsoCode,mode:i,controlElements:t,actions:this.actions,playerView:this.playerView});const n=this.getAttribute("poster");null!==n&&this.frontend.updateMediaProperties({poster:n})}getConfig(){let e=this.config;if(null===e){const t=this.getAttribute("config");e=t?window[t]:{lang:{locale:"en_US.UTF8",twoLetterIsoCode:"en",phrases:{}}},this.config=e}return e}constantDefaults(){return{prevChapterTolerance:5,volumeStep:.05,seekStep:5,trickPlayFactor:4,forceLandscapeOnFullscreen:!0}}getActions(){return{"fullscreen.toggle":O({isAvailable:()=>Boolean(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled),execute:()=>{this.frontend.seekBar?.endSeek(),this.toggleFullScreen()}}),"playback.toggle":O(()=>{this.video.paused?this.video.play():this.video.pause()}),"playback.volume.mute.toggle":O(()=>{this.video.muted=!this.video.muted}),"playback.volume.inc":O(()=>{this.volume=this.volume+this.constants.volumeStep}),"playback.volume.dec":O(()=>{this.volume=this.volume-this.constants.volumeStep}),"playback.captions.toggle":O({isAvailable:()=>this.player.getTextTracks().length>0,execute:()=>{this.showCaptions=!this.showCaptions}}),"navigate.rewind":O(()=>{this.skipSeconds(-this.constants.seekStep)}),"navigate.seek":O(()=>{this.skipSeconds(+this.constants.seekStep)}),"navigate.continuous-rewind":O(()=>{this.ensureTrickPlay(-this.constants.trickPlayFactor)}),"navigate.continuous-seek":O(()=>{this.ensureTrickPlay(this.constants.trickPlayFactor)}),"navigate.chapter.prev":O(()=>{this.prevChapter()}),"navigate.chapter.next":O(()=>{this.nextChapter()}),"navigate.frame.prev":O({isAvailable:()=>null!==this.fps,execute:()=>{this.fps?.vifa.seekBackward(1),this.frontend.afterManualSeek()}}),"navigate.frame.next":O({isAvailable:()=>null!==this.fps,execute:()=>{this.fps?.vifa.seekForward(1),this.frontend.afterManualSeek()}}),"navigate.position.percental":O((e,t)=>{if(void 0!==e&&void 0!==t&&0<=t&&tnull!==this.variantGroups&&this.variantGroups.findThumbnailTracks().length>0,execute:(e,t,s)=>{this.frontend.seekBar?.setThumbnailSnap("down"===s)}}),"sound_tools.mode.audio":O({execute:()=>{this.ui.updatePlayerProperties({mode:"audio"})}}),"sound_tools.mode.video":O({isAvailable:()=>!this.player.isAudioOnly(),execute:()=>{this.ui.updatePlayerProperties({mode:"video"})}}),"sound_tools.segments.add":O({execute:()=>{this.markers_.add({startTime:this.displayTime})}}),"sound_tools.segments.close":O({execute:()=>{const e=this.markers_.activeSegment,t=this.displayTime;null!==e&&e.startTime=0))return null;let i=t?parseFloat(t):null;return null===i||i>=s||(i=null),{startTime:s,endTime:i}}__dlfRegisterEvents(){this.eventMgr_.record(()=>{window.addEventListener("DOMContentLoaded",this.dlf.handlers.onDomContentLoaded),this.player.addEventListener("error",this.dlf.handlers.onPlayerErrorEvent),this.player.addEventListener("adaptation",this.dlf.handlers.onTrackChange),this.player.addEventListener("variantchanged",this.dlf.handlers.onTrackChange),this.video.addEventListener("play",this.dlf.handlers.onPlay)}),this.tickInterval=setInterval(this.dlf.handlers.onTick,50),this.registerGestures()}registerGestures(){const e=this.frontend.gestures;null!==e&&(e.on("gesture",e=>{switch(e.type){case"tapup":"mouse"===e.event.pointerType?(e.tapCount<=2&&this.actions["playback.toggle"].execute(),2===e.tapCount&&this.actions["fullscreen.toggle"].execute()):e.tapCount>=2&&(e.position.x<1/3?this.actions["navigate.rewind"].execute():e.position.x>2/3?this.actions["navigate.seek"].execute():2!==e.tapCount||this.env.isInFullScreen()||this.actions["fullscreen.toggle"].execute());break;case"hold":1===e.tapCount?this.frontend.seekBar?.thumbnailPreview?.beginChange(e.event.clientX):e.tapCount>=2&&(e.position.x<1/3?this.actions["navigate.continuous-rewind"].execute():e.position.x>2/3&&this.actions["navigate.continuous-seek"].execute());break;case"swipe":"east"===e.direction?this.actions["navigate.rewind"].execute():"west"===e.direction&&this.actions["navigate.seek"].execute()}}),e.on("release",()=>{this.frontend.seekBar?.endSeek(),this.cancelTrickPlay()}))}get ui(){return this.frontend}supportsMimeType(e){switch(e){case"application/dash+xml":case"application/x-mpegurl":case"application/vnd.apple.mpegurl":return this.env.supportsMediaSource()||this.env.supportsVideoMime(e);default:return this.env.supportsVideoMime(e)}}loadSources(){const e=[];this.querySelectorAll("source").forEach(t=>{const s=t.getAttribute("src"),i=t.getAttribute("type");if(!s||!i)return void console.warn("Ignoring that does not specify URL or MIME type");let n=null;const r=t.getAttribute("data-fps");if(null!==r){const e=parseFloat(r);e>0&&(n=e)}const a=t.getAttribute("data-fileid");e.push({url:s,mimeType:i,frameRate:n,fileId:a})}),this.loadOneOf(e)}async loadOneOf(e){if(0===e.length)return this.frontend.updatePlayerProperties({error:"error.no-media-source"}),!1;let t=!1;for(const s of e)if(this.supportsMimeType(s.mimeType))try{return await this.loadManifest(s),this.frontend.updatePlayerProperties({error:null,mode:"auto"===this.mode?this.player.isAudioOnly()?"audio":"video":void 0}),this.loaded(),!0}catch(e){console.error(e)}else t=!0;return this.frontend.updatePlayerProperties({error:t?"error.playback-not-supported":"error.load-failed"}),!1}async loadManifest(e){const t=this.timeRange?.startTime??null;await this.player.load(e.url,t,e.mimeType),this.currentSource=e,this.variantGroups=new H(this.player),this.variantGroups.selectGroupWithPrimary()||this.variantGroups.selectGroupByRole("main")||this.variantGroups.selectGroupByIndex(0),this.frontend.updateMediaProperties({variantGroups:this.variantGroups,chapters:this.chaptersInFile}),this.updateFrameRate()}onDomContentLoaded(){}onTick(){const e=this.chaptersInFile.timeToChapter(this.video.currentTime)??null;if(e!==this.currentChapter){const t=this.currentChapter;this.currentChapter=e;const s=new CustomEvent("chapterchange",{detail:{curChapter:e,prevChapter:t}});this.dispatchEvent(s)}}onTrackChange(){this.updateFrameRate()}updateFrameRate(){const e=this.variantGroups?.findActiveTrack()?.frameRate??this.currentSource?.frameRate??null;null===e?this.fps=null:null!==this.fps&&e===this.fps.rate||(this.fps={rate:e,vifa:new K({id:this.video.id,frameRate:e})}),this.frontend.updateMediaProperties({fps:this.fps})}onPlay(){this.videoPausedOn=null}async toggleFullScreen(){this.env.toggleFullScreen(this.playerView??this.ui.domElement,this.constants.forceLandscapeOnFullscreen)}parseChapters(){const e=[];this.querySelectorAll("dlf-chapter").forEach(t=>{const s=t.getAttribute("title"),i=Number(t.getAttribute("timecode"));if(!(s&&i>=0))return void console.warn("Ignoring invalid ");let n=[];const r=t.getAttribute("fileids");null!==r&&(n=r.split(","));let a=null;const o=t.getAttribute("pageNo");null!==o&&(a=parseInt(o,10)),e.push({title:s,timecode:i,fileIds:n,pageNo:a})}),this.setChapters(new B(e))}get chapters(){return this.chapters_}get chaptersInFile(){return this.chapters_.filter(e=>this.isChapterInFile(e))}isChapterInFile(e){return null===this.currentSource||null===this.currentSource.fileId||e.fileIds.includes(this.currentSource.fileId)}setChapters(e){this.chapters_=e,this.frontend.updateMediaProperties({chapters:this.chaptersInFile})}loaded(){this.autoplay_&&this.video.play()}get hasVideo(){return null!==this.currentSource}getCurrentChapter(){return this.timeToChapter(this.video.currentTime)}timeToChapter(e){return this.chaptersInFile.timeToChapter(e)}get media(){return this.video}get hasCurrentData(){return this.video.readyState>=2}get showCaptions(){return this.player.isTextTrackVisible()}set showCaptions(e){this.player.setTextTrackVisibility(e)}isAudioOnly(){return this.player.isAudioOnly()}get volume(){return this.video.volume}set volume(e){this.video.volume=a(e,[0,1])}get displayTime(){return this.frontend.seekBar?.getValue()??this.video.currentTime}pauseOn(e){null!==this.videoPausedOn||this.video.paused||(this.videoPausedOn=e,this.video.pause())}resumeOn(e){this.videoPausedOn===e&&this.video.play()}getFps(){return this.fps?.rate??null}seekTo(e){return"number"==typeof e?(this.seekToTime(e),!0):"number"==typeof e.timecode&&this.seekToChapter(e)}seekToTime(e){this.video.currentTime=e,this.frontend.afterManualSeek()}seekToChapter(e){return!!this.isChapterInFile(e)&&(this.seekToTime(e.timecode),!0)}skipSeconds(e){this.seekTo(this.video.currentTime+e)}prevChapter(){const e=this.constants.prevChapterTolerance,t=this.timeToChapter(this.video.currentTime-e);this.seekTo(t??0)}nextChapter(){const e=this.getCurrentChapter();if(e){const t=this.chaptersInFile.advance(e,1);t&&this.seekTo(t)}}ensureTrickPlay(e){this.player.getPlaybackRate()!==e&&this.player.trickPlay(e)}cancelTrickPlay(){try{return this.player.cancelTrickPlay(),!0}catch(e){return!1}}onPlayerErrorEvent(e){if(e instanceof CustomEvent){const t=e.detail;console.error("Error from Shaka player",t.code,t)}}}customElements.define("dlf-media",X);class Y extends HTMLElement{constructor(){super(),this.env=new L,this.player=null,this.hasAttached=!1}get forPlayer(){return this.getAttribute("forPlayer")}set forPlayer(e){null===e?this.removeAttribute("forPlayer"):this.setAttribute("forPlayer",e)}connectedCallback(){this.isConnected&&(this.hasAttached||(setTimeout(()=>{const e=this.forPlayer;if(null===e)return;const t=document.getElementById(e);t instanceof X&&(this.env=t.getEnv(),this.player=t,this.attachToPlayer(t))}),this.hasAttached=!0))}attachToPlayer(e){}}var Q=s(8228),Z=s(317);customElements.define("dlf-waveform",class extends Y{static get observedAttributes(){return["hidden"]}constructor(){super();const e=this.attachShadow({mode:"open"});this.$style=r("style",{},["\n .container {\n position: relative;\n display: block;\n height: 100px;\n }\n\n .wave-overview {\n position: absolute;\n bottom: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.3);\n }\n "]),this.$container=r("div",{className:"container"},[this.$waveOverview=r("div",{className:"wave-overview"})]),e.append(this.$style,this.$container),this.nextUrl=null,this.peaks_=null,this.waveformdata=null,this.minSamplesPerPixel=0,this.maxSamplesPerPixel=Number.POSITIVE_INFINITY,this.samplesPerPixel=0,this.zoomview=null,this.handlers={onWheel:this.onWheel.bind(this),onResize:this.onResize.bind(this)},this.peaksHandlers={"points.dragend":e=>{null!==this.player&&void 0!==e.point.id&&this.player.getMarkers().update({id:e.point.id,startTime:e.point.time,labelText:e.point.labelText,color:e.point.color},!0)},"segments.dragend":e=>{null!==this.player&&void 0!==e.segment.id&&this.player.getMarkers().update({id:e.segment.id,startTime:e.segment.startTime,endTime:e.segment.endTime,labelText:e.segment.labelText,color:"string"==typeof e.segment.color?e.segment.color:void 0},!0)}},this.markersHandlers={remove:e=>{for(const t of e.detail.segments)null!==this.peaks_&&(void 0===t.endTime?this.peaks_.points.removeById(t.id):this.peaks_.segments.removeById(t.id))},remove_all:()=>{null!==this.peaks_&&(this.peaks_.points.removeAll(),this.peaks_.segments.removeAll())},add:e=>{this.peaksAddSegments(e.detail.segments)},update:e=>{const{segment:t,prevSegment:s}=e.detail;null!==this.peaks_&&(void 0===s.endTime&&void 0!==t.endTime?(this.peaks_.points.removeById(t.id),this.peaks_.segments.add({id:t.id,startTime:t.startTime,endTime:t.endTime,labelText:t.labelText,color:t.color,editable:t.editable})):void 0===t.endTime?this.peaks_.points.getPoint(t.id)?.update({time:t.startTime,editable:t.editable,labelText:t.labelText}):this.peaks_.segments.getSegment(t.id)?.update({startTime:t.startTime,endTime:t.endTime,editable:t.editable,labelText:t.labelText}))}},this.registerEventHandlers()}attributeChangedCallback(e,t,s){"hidden"===e&&(this.hidden||this.tryInitPeaks())}registerEventHandlers(){this.$waveOverview.addEventListener("wheel",this.handlers.onWheel),"ResizeObserver"in globalThis?new ResizeObserver(this.handlers.onResize).observe(this.$container):window.addEventListener("resize",this.handlers.onResize)}async attachToPlayer(e){const t=this.getAttribute("src"),s=this.getAttribute("type");t&&"application/vnd.kitodo.audiowaveform"===s&&(e.addActions({"sound_tools.waveform.toggle":O({execute:()=>{this.hidden=!this.hidden}})}),this.adaptPeaksMarkers(),e.ui instanceof z&&e.ui.alwaysPrependBottomControl(this),e.media.addEventListener("loadedmetadata",e=>{this.updateZoom(this.maxSamplesPerPixel)}),this.load(t))}async load(e){this.nextUrl=e;const t=await fetch(e),s=await t.arrayBuffer();e===this.nextUrl&&(this.waveformdata=Z.A.create(s),this.updateZoom(this.maxSamplesPerPixel),this.tryInitPeaks())}tryInitPeaks(){const e=this.waveformdata;if(null!==this.peaks_||this.hidden||null==this.player?.media||null===e)return;const t={logger:(...e)=>{console.log(...e)},mediaElement:this.player.media,zoomview:{container:this.$waveOverview},waveformData:{arraybuffer:e.toArrayBuffer()},waveformCache:!0};Q.A.init(t,(t,s)=>{s?(s.player.seek=e=>{this.player?.seekTo(e)},this.peaks_=s,this.zoomview=s.views.getView("zoomview"),this.zoomview?.setZoom({seconds:e.duration}),this.zoomview?.setWheelMode("scroll"),this.adaptPeaksMarkers()):console.log(t)})}adaptPeaksMarkers(){if(null!==this.peaks_&&null!==this.player){this.peaksAddSegments(this.player.getMarkers().getSegments());for(const[e,t]of Object.entries(this.peaksHandlers))this.peaks_.on(e,t);for(const[e,t]of Object.entries(this.markersHandlers))this.player.getMarkers().addEventListener(e,t)}}peaksAddSegments(e){if(null!==this.peaks_)for(const t of e)void 0===t.endTime?this.peaks_.points.add({id:t.id,time:t.startTime,labelText:t.labelText,color:t.color,editable:t.editable}):this.peaks_.segments.add({id:t.id,startTime:t.startTime,endTime:t.endTime,labelText:t.labelText,color:t.color,editable:t.editable})}onWheel(e){const t=1.5**(-e.deltaY/100);this.updateZoom(this.samplesPerPixel/t)}onResize(){this.zoomview?.fitToContainer(),this.updateZoom()}updateZoom(e=this.samplesPerPixel){if(null===this.waveformdata)return;const{sample_rate:t,seconds_per_pixel:s,duration:i}=this.waveformdata;this.minSamplesPerPixel=s*t,this.maxSamplesPerPixel=a(i*t/this.$waveOverview.offsetWidth,[this.minSamplesPerPixel,Number.POSITIVE_INFINITY]),this.samplesPerPixel=a(e,[this.minSamplesPerPixel,this.maxSamplesPerPixel]),null!==this.zoomview&&this.zoomview.setZoom({scale:this.samplesPerPixel})}}),window.DlfMediaPlayer=X;var J=s(7583);const ee=jQuery;var te=s.n(ee);class se extends(U()){constructor(e){super(),this.state=e,this.pendingStateUpdates=[],this.renderTimeout=null,this.renderPromise=Promise.resolve()}setState(e={}){const t="function"==typeof e?e:()=>e;this.pendingStateUpdates.push(t),this.renderTimeout||(this.renderPromise=new Promise(e=>{this.renderTimeout=setTimeout(()=>{const t=this.squashStateUpdates();this.render(t),this.state=t,this.renderTimeout=null,this.renderPromise=Promise.resolve(),this.emit("updated",t),e()})}))}update(){return this.renderPromise}squashStateUpdates(){const e=Object.assign({},this.state);for(const t of this.pendingStateUpdates)Object.assign(e,t(e));return this.pendingStateUpdates=[],e}render(e){}}class ie extends se{constructor(e,t){super({show:!1,...t}),this.parent=e,this.isAnimating=!1,this.$main=r("div",{className:"sxnd-modal"},[this.$headline=r("div",{className:"headline-container"},[this.$title=r("h3"),this.$close=r("span",{className:"modal-close material-icons-round",$click:this.close.bind(this)},["close"])]),this.$body=r("div",{className:"body-container"})]),this.parent.append(this.$main),this.jqMain=te()(this.$main),this.resize()}resize(){this.$body.style.maxHeight=`calc(${this.parent.clientHeight}px - 11rem)`}get isOpen(){return this.state.show}open(e=!0){this.isAnimating||this.setState({show:e})}close(){this.open(!1)}toggle(){this.open(!this.state.show)}render(e){const{show:t}=e;if(t!==this.state.show){this.isAnimating=!0;const e=t?"show":"hide";this.jqMain[e]({duration:"fast",complete:()=>{this.isAnimating=!1}})}}}function ne(e,t){return l(e,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t[0]??""])))}function re(e,t,s,i){const n=e.generateUrl(s),r={...t,host:[`${location.protocol}//${location.host}`],url:[n.toString()]};let a=0;"number"==typeof s?a=s:null!==s&&(a=s.startTime);const o=w(a,i);for(const[e,t]of Object.entries(o))r[e]=[t];return r}class ae{constructor(e){this.env=e}generateUrl(e){return"number"==typeof e?this.generateTimecodeUrl(e):this.generateTimerangeUrl(e)}generateTimerangeUrl(e){let t=[];null!==e&&(null!==e.endTime&&e.endTime>e.startTime&&t.unshift(e.endTime),(e.startTime>0||t.length>0)&&t.unshift(e.startTime));const s=this.env.getLocation();return t.length>0?s.searchParams.set("timecode",t.map(e=>e.toString()).join(",")):s.searchParams.delete("timecode"),s}generateTimecodeUrl(e){const t=null===e?null:{startTime:e,endTime:null};return this.generateTimerangeUrl(t)}}const oe=["current-time","marker","begin"];class le extends ie{constructor(e,t,s){super(e,{metadata:{},timing:{currentTime:0,markerRange:null},fps:0,startAtMode:"current-time",showQrCode:!1,showMastodonShare:!1}),this.lastRenderedUrl=null,this.handlers={handleClickShareButton:this.handleClickShareButton.bind(this),handleChangeStartAt:this.handleChangeStartAt.bind(this)},this.env=t,this.gen=new ae(this.env),this.$main.classList.add("bookmark-modal"),this.$title.innerText=this.env.t("modal.bookmark.title");const i=this.env.mkid(),n=(s.shareButtons??[]).map(e=>function(e,t,s){let i;switch(t.type){case"material":i=r("i",{className:"dlf-share-button material-icons-round"},[t.icon]);break;case"image":i=r("img",{className:"dlf-share-button dlf-share-button-image",src:t.src})}const n=r("a",{title:e.t(t.titleTranslationKey??"",{},()=>""),target:"_blank",rel:"noopener noreferrer",$click:s.onClick},[i]);return{hrefTemplate:t.hrefTemplate,setFullUrl:e=>{n.href=l(t.hrefTemplate,e)},element:n}}(this.env,e,{onClick:this.handlers.handleClickShareButton}));this.shareButtons=v(n),this.$startAtVariants={begin:this.makeStartAtVariant(i,"begin"),"current-time":this.makeStartAtVariant(i,"current-time"),marker:this.makeStartAtVariant(i,"marker")},this.$body.append(r("div",{},[this.shareButtons.length>0&&r("div",{className:"share-buttons"},this.shareButtons.map(e=>e.element)),this.$urlLine=r("div",{className:"url-line dlf-visible"},[this.$urlInput=r("input",{type:"url",readOnly:!0,value:location.href}),this.$copyLinkBtn=r("a",{href:"javascript:void(0)",target:"_blank",className:"copy-to-clipboard",title:this.env.t("modal.bookmark.copy-link"),$click:this.handleCopyToClipboard.bind(this)},[r("i",{className:"material-icons-round"},["content_copy"])])]),this.$mastodonShareDialog=r("div",{id:"mastodon-share",className:"mastodon-share-container"},[this.$headline=r("div",{className:"headline-container"},[this.$title=r("h4",{},[this.env.t("share.mastodon.title")]),this.$close=r("span",{className:"modal-close material-icons-round",$click:()=>{this.setState({showMastodonShare:!1})}},["close"])]),r("form",{method:"post",className:"mastodon-form",$submit:this.submitInstance.bind(this)},[this.$mastodonInstanceInput=r("input",{type:"text",name:"mastodon-instance",id:"instance",className:"mastodon-share-input",placeholder:this.env.t("share.mastodon.placeholder"),autocomplete:"url",required:!0,autocapitalize:"none",spellcheck:!1}),r("button",{type:"submit",id:"mastodon-share-button",className:"mastodon-share-button"},[this.env.t("share.mastodon.label")])])]),this.$startAt=r("div",{className:"start-at"},oe.map(e=>this.$startAtVariants[e].$container)),this.$qrCanvasContainer=r("div",{className:"url-qrcode"},[r("hr"),this.$qrCanvas=r("canvas")])]))}makeStartAtVariant(e,t){const s=this.env.mkid(),i=r("input",{type:"radio",name:e,value:t,id:s,$change:this.handlers.handleChangeStartAt}),n=r("label",{htmlFor:s},[this.translateStartAtLabel(t,{currentTime:0,markerRange:null},null)]);return{id:s,$radio:i,$label:n,$container:r("div",{className:`start-at-${t}`},[i,n])}}handleClickShareButton(e){const t=e.currentTarget;"dlf:qr_code"===t.href&&(e.preventDefault(),this.setState({showQrCode:!0})),"dlf:mastodon_share"===t.href&&(e.preventDefault(),this.setState({showMastodonShare:!0}))}async handleCopyToClipboard(e){e.preventDefault();const t=this.generateUrl(this.state);this.$urlInput.focus(),navigator.clipboard?navigator.clipboard.writeText(t):document.execCommand("copy")}handleChangeStartAt(e){e.target instanceof HTMLInputElement&&this.setState({startAtMode:e.target.value})}generateUrl(e){const t=this.getActiveTimeRange(e);return this.gen.generateTimerangeUrl(t).toString()}getActiveTimeRange(e){switch(this.getStartAtMode(e)){case"begin":return null;case"current-time":return{startTime:e.timing.currentTime,endTime:null};case"marker":return e.timing.markerRange}}open(e=!0){super.open(e),e||this.setState({showQrCode:!1,showMastodonShare:!1})}render(e){super.render(e);const{show:t,metadata:s,timing:i,fps:n,showQrCode:r,showMastodonShare:a}=e,o=this.getStartAtMode(e),l=this.getActiveTimeRange(e),h=re(this.gen,s,l,n),d=h.url?.[0]??"",c=d!==this.lastRenderedUrl;if(c){const e={};for(const[t,s]of Object.entries(h))e[t]=encodeURIComponent(s[0]??"");for(const t of this.shareButtons)t.setFullUrl(e);this.$urlInput.value=d,this.$copyLinkBtn.href=d,this.lastRenderedUrl=d}(c||r!==this.state.showQrCode)&&this.renderQrCode(r?d:null),a!==this.state.showMastodonShare&&this.renderMastodonShare(a),this.$startAtVariants[o].$radio.checked=!0;let u=0;for(const t of oe){this.$startAtVariants[t].$label.innerText=this.translateStartAtLabel(t,i,n);const s=this.isStartAtModeAllowed(t,e);g(this.$startAtVariants[t].$container,"shown",s),s&&u++}g(this.$startAtVariants.begin.$container,"shown",u>1),t&&t!==this.state.show&&this.$urlInput.select()}translateStartAtLabel(e,t,s){const i={currentTime:T(t.currentTime,!0,s),markerStart:"?",markerEnd:"_"};return null!==t.markerRange&&(i.markerStart=T(t.markerRange.startTime,!0,s),null!==t.markerRange.endTime&&(i.markerEnd=T(t.markerRange.endTime,!0,s))),this.env.t(`modal.bookmark.start-at-${e}`,i)}getStartAtMode(e){return this.isStartAtModeAllowed(e.startAtMode,e)?e.startAtMode:"begin"}isStartAtModeAllowed(e,t){switch(e){case"begin":return!0;case"current-time":return 0!==t.timing.currentTime;case"marker":return null!==t.timing.markerRange}}async renderQrCode(e){if(null!==e)try{await J.toCanvas(this.$qrCanvas,e),this.$qrCanvasContainer.classList.add("dlf-visible")}catch(e){alert(this.env.t("error.qrcode")),console.error(e)}else this.$qrCanvasContainer.classList.remove("dlf-visible")}renderMastodonShare(e){this.$urlLine.classList.toggle("dlf-visible",!e),this.$urlLine.classList.toggle("dlf-fade-in",!e),this.$urlLine.classList.toggle("dlf-fade-out",e),this.$mastodonShareDialog.classList.toggle("dlf-visible",e),this.$mastodonShareDialog.classList.toggle("dlf-fade-in",e),this.$mastodonShareDialog.classList.toggle("dlf-fade-out",!e)}openShareUrl(e,t,s){if(this.isValidUrl(e))if(null!==t)try{const i=new URL("/share",e),n=new URLSearchParams;n.set("text",s+"\n\n"),n.set("url",t),i.search=n.toString(),window.open(i.toString(),"_blank")}catch(e){return alert(this.env.t("error.mastodon.open_link")),void console.error(e)}else alert(this.env.t("error.mastodon.invalid_link"));else alert(this.env.t("error.mastodon.invalid_server"))}submitInstance(e){e.preventDefault();let t=this.$mastodonInstanceInput.value.trim();if(!t)return void alert(this.env.t("error.mastodon.enter_url"));t=t.replace(/[^a-zA-Z0-9-:.\/]/g,"");let s=t.replace(/^http:\/\//i,"https://");s.startsWith("https://")||(s=`https://${s}`);const i=document.title.trim();this.openShareUrl(s,this.lastRenderedUrl,i)}isValidUrl(e){try{return new URL(e),!0}catch(e){return!1}}}const he={None:0,Ctrl:1,Shift:2,Alt:4,Meta:8};function de(e,t,s){let i=s;return 1===t.length&&(i&=~he.Shift,"mac"===e.getKeyboardVariant()&&(i&=~he.Alt)),i}function ce(e,t,s){" "===t&&(t="Space");const i=s?".mod":"";return e.t(`key.${t}${i}`,{},()=>e.t(`key.${t}`,{},()=>e.t(`key.generic${i}`,{key:t.toUpperCase()},()=>e.t("key.generic",{key:t.toUpperCase()}))))}function ue(e,t){const s=function(e){const t=[];let s=null;for(const i of e)null===s?s={begin:i,end:i}:i.charCodeAt(0)===s.end.charCodeAt(0)+1?s.end=i:(t.push(s),s={begin:i,end:i});return null!==s&&t.push(s),t}(t.keys),i=[],n=[];void 0!==t.mod&&n.push(t.mod),"Shift"!==t.mod&&t.keys.every(e=>/^[A-Z]$/.test(e))&&n.push("Shift");const a=n.length>0||s.length>1,o=e.t("key.unto"+(a?".mod":""));for(const t of s){const s=r("kbd",{},[ce(e,t.begin,a)]);if(t.begin===t.end)i.push(s);else{const n=r("kbd",{},[ce(e,t.end,a)]);i.push(r("span",{className:"kb-range"},[s,o,n]))}}let l=[];if(n.length>0){const t=e.getKeyboardVariant();for(const s of n){const i=r("kbd",{},[e.t(`key.mod.${t}.${s}`)]);l.push(i," + ")}l.push(...f(i,"/"))}else l=f(i," / ");return t.repeat&&(l=f(e.t("key.repeat",{key:"###"}).split("###"),l)),r("span",{},l)}class pe extends ie{constructor(e,t,s){super(e,{}),this.env=t,this.config=s,this.tableSections=[],this.createBodyDom(),this.updateRowVisibility()}open(e=!0){e&&this.updateRowVisibility(),super.open(e)}createBodyDom(){const e=this.env;this.$main.classList.add("help-modal"),this.$title.innerText=e.t("modal.help.title");const t=r("table",{className:"keybindings-table"}),s=function(e,t){const s=e.getKeyboardVariant(),i={navigate:{},player:{},sound_tools:{},other:{}},n=t.slice();n.sort((e,t)=>e.order-t.order);for(const e of n){if(null!=e.keyboard&&e.keyboard!==s)continue;let t=i[e.kind];t||(t=i[e.kind]={});let n=t[e.action];n||(n=t[e.action]=[]),n.push(e)}return i}(e,this.config.keybindings);for(const[i,n]of Object.entries(s)){const s=[...Object.entries(n)];if(0===s.length)continue;const a={thead:r("thead",{},[r("th",{className:"kb-group",colSpan:2},[e.t(`action.kind.${i}`)])]),tbody:r("tbody",{}),rows:[]};for(const[e,t]of s){const s=r("tr",{},[r("td",{className:"key"},this.listKeybindings(t)),r("td",{className:"action"},[this.describeAction(e)])]);a.rows.push({action:e,tr:s}),a.tbody.append(s)}t.append(a.thead,a.tbody),this.tableSections.push(a)}this.$body.append(t)}listKeybindings(e){return f(e.map(e=>ue(this.env,e)),r("br"))}describeAction(e){return this.env.t(`action.${e}`,this.config.constants)}updateRowVisibility(){for(const e of this.tableSections){let t=!1;for(const s of e.rows){const e=this.config.actionIsAvailable(s.action);s.tr.setAttribute("aria-disabled",e?"false":"true");const i=e?"":this.env.t("action.unavailable");s.tr.setAttribute("title",i),s.tr.setAttribute("aria-label",i),t||=e}e.thead.setAttribute("aria-disabled",t?"false":"true"),e.tbody.setAttribute("aria-disabled",t?"false":"true")}}}var me=s(3318),fe=s.n(me);class ge{constructor(e){this.jpeg=e,this.exif=fe().load(e)}static fromBinaryString(e){return new ge(e)}toBinaryString(){const e=fe().dump(this.exif);return fe().insert(e,this.jpeg)}addMetadata(e){e.title&&(this.exif["0th"][fe().ImageIFD.ImageDescription]=e.title),e.comment&&(this.exif.Exif[fe().ExifIFD.UserComment]=e.comment)}getMetadata(){return{title:this.exif["0th"][fe().ImageIFD.ImageDescription]??"",comment:this.exif.Exif[fe().ExifIFD.UserComment]??""}}}const ve=String.fromCharCode(137,80,78,71,13,10,26,10);function be(e,t){var s=new Array(t);for(let i=t-1;i>=0;i--)s[i]=String.fromCharCode(255&e),e>>=8;return s.join("")}function ye(e){let t=0;for(let s=0;s>>8^t[255&(s^e.charCodeAt(i))];return(-1^s)>>>0}(t.type+t.data),t}addChunk(e){const t=ke.createChunk(e);if("iTXt"!==t.type)throw new Error(`Adding chunk type ${t.type} is not supported.`);this.chunks.unshift(t)}static fromBinaryString(e){if(!function(e){return e.substr(0,8)===ve}(e.substr(0,8)))return;let t;e=e.substr(8);for(var s=[];""!==e;){var i={},n=ye(e.substr(0,4));n<0&&(n=0);var r=e.substr(0,n+12);e=e.substr(n+12),i.size=n,i.type=r.substr(4,4),i.data=r.substr(8,n),i.crc=ye(r.substr(8+n,4)),"IHDR"===i.type?t=i:"IEND"!==i.type&&s.push(i)}return void 0===t?void 0:new ke(t,s)}toBinaryString(){var e=ve;const t=t=>{var s="";s+=be(t.size,4),s+=t.type,s+=t.data,s+=be(t.crc,4),e+=s};t(this.headerChunk);for(const e of this.chunks)t(e);return t(ke.createChunk({type:"IEND"})),e}addMetadata(e){for(const[t,s]of Object.entries(e)){if(!s)continue;const e={title:"Title",comment:"Comment"}[t];e&&this.addChunk({type:"iTXt",keyword:e,text:s})}}}const we=[{mimeType:"image/png",extension:"png",label:"PNG",parseBinaryString:e=>ke.fromBinaryString(e)},{mimeType:"image/jpeg",extension:"jpg",label:"JPEG",parseBinaryString:e=>ge.fromBinaryString(e)},{mimeType:"image/tiff",extension:"tiff",label:"TIFF",parseBinaryString:()=>{}}];function Te(e,t){const s=Object.assign({},t);for(const[i,n]of Object.entries(t)){const t=e[i]??n;switch(typeof n){case"boolean":s[i]=!0===t||Boolean(Number(t));break;case"number":s[i]=Number(t);break;case"string":s[i]=String(t)}}return s}class Ce extends ie{constructor(e,t,s){const i=we.filter(e=>t.supportsCanvasExport(e.mimeType));super(e,{metadata:null,showMetadata:!0,fps:null,timecode:null,supportedImageFormats:i,selectedImageFormat:i[0]??null}),this.env=t,this.gen=new ae(t),this.videoDomElement=null,this.config=s,this.constants=Te(s.constants,{screenshotFilenameTemplate:"Screenshot",screenshotCommentTemplate:""});const n=this.config.keybindings.find(e=>"modal.screenshot.snap"===e.action);this.$main.classList.add("screenshot-modal"),this.$title.innerText=t.t("modal.screenshot.title");const a=t.mkid(),o=t.mkid();this.$body.append(r("div",{className:"screenshot-config"},[r("h4",{},[t.t("modal.screenshot.configuration")]),r("section",{className:"metadata-config"},[r("h1",{},[t.t("modal.screenshot.metadata")]),r("div",{className:"metadata-overlay"},[r("input",{type:"checkbox",id:a,checked:this.state.showMetadata,$change:this.handleChangeShowMetadata.bind(this)}),r("label",{htmlFor:a},[t.t("modal.screenshot.metadata-overlay")])])]),r("section",{},[r("h1",{},[t.t("modal.screenshot.file-format")]),r("div",{},this.state.supportedImageFormats.map(e=>{const s=t.mkid();return r("span",{className:"file-format-option"},[r("input",{id:s,name:o,type:"radio",checked:e.mimeType===this.state.selectedImageFormat?.mimeType,$change:()=>{this.setState({selectedImageFormat:e})}}),r("label",{htmlFor:s},[` ${e.label}`])])}))]),r("a",{href:"#",className:"download-link",$click:this.handleDownloadImage.bind(this)},[r("i",{className:"material-icons-round inline-icon"},["download"]),t.t("modal.screenshot.download-image")]),n&&r("aside",{className:"snap-tip"},[r("i",{className:"material-icons-round inline-icon"},["info_outline"]),r("span",{},f(t.t("modal.screenshot.snap-tip",{keybinding:"{kb}"}).split("{kb}"),ue(t,n)))])]),this.$canvas=r("canvas"))}setVideo(e){return this.videoDomElement=e,this}setMetadata(e){return this.setState({metadata:e}),this}setFps(e){return this.setState({fps:e}),this}setTimecode(e){return this.setState({timecode:e}),this}handleChangeShowMetadata(e){e.target instanceof HTMLInputElement&&this.setState({showMetadata:e.target.checked})}async handleDownloadImage(e){e.preventDefault(),await this.downloadCurrentImage(this.state)}renderCurrentScreenshot({showMetadata:e,metadata:t,timecode:s,fps:i}){if(null===this.videoDomElement)return!1;const n={captions:[],minWidth:1e3};if(e){const e=re(this.gen,t??{},s,i);n.captions=this.getCaptions(e)}return function(e,t,s){const[i,n]=e instanceof HTMLCanvasElement?[e,e.getContext("2d")]:[e.canvas,e];if(null===n)return!1;const r=Math.max(1,Math.ceil((s.minWidth??0)/t.videoWidth));i.width=t.videoWidth*r,i.height=t.videoHeight*r,n.drawImage(t,0,0,i.width,i.height);const a=i.height/1080,o=10*a;n.font=`${Math.floor(25*a)}px Arial`,n.fillStyle="#FFFFFF",n.shadowBlur=5,n.shadowColor="black";for(const e of s.captions??[]){const t="left"===e.h?o:i.width-o,s="top"===e.v?o:i.height-o;n.textAlign=e.h,n.fillText(e.text,t,s)}}(this.$canvas,this.videoDomElement,n),!0}async downloadCurrentImage(e){const{metadata:t,timecode:s,fps:i,selectedImageFormat:n}=e;if(null===t||null===s||null===n)return console.error("one of [metadata, timecode, selectedImageFormat] is null"),!1;const r=re(this.gen,t,s,i);return p(await this.makeImageBlob(this.$canvas,n,r),this.getFilename(r,n)),!0}async makeImageBlob(e,t,s){const i=await function(e,t){return new Promise((s,i)=>{e.toBlob(e=>{e?s(e):i()},t,undefined)})}(e,t.mimeType),n=await(r=i,d(r,"readAsBinaryString"));var r;const a=t.parseBinaryString(n);if(a){a.addMetadata({title:s.title?.[0]??"",comment:ne(this.constants.screenshotCommentTemplate,s)});const e=function(e){const t=new Uint8Array(e.length);for(let s=0;s0?t:"_"}(s)}.${i}`}getCaptions(e){return this.config.screnshotCaptions.map(t=>({...t,text:ne(t.text,e)}))}async snap(){await this.update();const e=this.state;this.renderCurrentScreenshot(e)&&await this.downloadCurrentImage(e)||alert(this.env.t("modal.screenshot.error"))}render(e){super.render(e),e.show&&(!this.state.show||e.showMetadata!==this.state.showMetadata)&&this.renderCurrentScreenshot(e)}}const Se=JSON.parse('[{"keys":["Escape"],"action":"cancel","kind":"other","order":100},{"keys":["?"],"repeat":false,"action":"modal.help.toggle","kind":"other","order":99},{"keys":["F1"],"repeat":false,"action":"modal.help.toggle","kind":"other","order":99},{"keys":["b"],"scope":"player","action":"modal.bookmark.open","kind":"other","order":30},{"keys":["s"],"scope":"player","action":"modal.screenshot.open","kind":"other","order":31},{"keys":["S"],"scope":"player","action":"modal.screenshot.snap","kind":"other","order":32},{"keys":["f"],"repeat":false,"scope":"player","action":"fullscreen.toggle","kind":"player","order":20},{"keys":["t"],"repeat":false,"scope":"player","action":"theater.toggle","kind":"player","order":21},{"keys":[" "],"repeat":false,"scope":"player","action":"playback.toggle","kind":"player","order":0},{"keys":["m"],"repeat":false,"scope":"player","action":"playback.volume.mute.toggle","kind":"player","order":12},{"keys":["ArrowUp"],"scope":"player","action":"playback.volume.inc","kind":"player","order":10},{"keys":["ArrowDown"],"scope":"player","action":"playback.volume.dec","kind":"player","order":11},{"keys":["c"],"repeat":false,"scope":"player","action":"playback.captions.toggle","kind":"player","order":13},{"keys":["ArrowLeft"],"repeat":false,"scope":"player","action":"navigate.rewind","kind":"navigate","order":0},{"keys":["ArrowRight"],"repeat":false,"scope":"player","action":"navigate.seek","kind":"navigate","order":1},{"keys":["ArrowLeft"],"repeat":true,"scope":"player","action":"navigate.continuous-rewind","kind":"navigate","order":2},{"keys":["ArrowRight"],"repeat":true,"scope":"player","action":"navigate.continuous-seek","kind":"navigate","order":3},{"keyboard":"ibm","mod":"Ctrl","keys":["ArrowLeft"],"scope":"player","action":"navigate.chapter.prev","kind":"navigate","order":10},{"keyboard":"mac","mod":"Alt","keys":["ArrowLeft"],"scope":"player","action":"navigate.chapter.prev","kind":"navigate","order":10},{"keyboard":"ibm","mod":"Ctrl","keys":["ArrowRight"],"scope":"player","action":"navigate.chapter.next","kind":"navigate","order":11},{"keyboard":"mac","mod":"Alt","keys":["ArrowRight"],"scope":"player","action":"navigate.chapter.next","kind":"navigate","order":11},{"keys":["0","1","2","3","4","5","6","7","8","9"],"scope":"player","action":"navigate.position.percental","kind":"navigate","order":25},{"mod":"Shift","keys":["ArrowLeft"],"scope":"player","action":"navigate.frame.prev","kind":"navigate","order":20},{"mod":"Shift","keys":["ArrowRight"],"scope":"player","action":"navigate.frame.next","kind":"navigate","order":21},{"keys":[","],"scope":"player","action":"navigate.frame.prev","kind":"navigate","order":20},{"keys":["."],"scope":"player","action":"navigate.frame.next","kind":"navigate","order":21},{"keys":["Shift"],"scope":"player","action":"navigate.thumbnails.snap","kind":"navigate","order":30,"keydown":true,"keyup":true},{"keys":["F2"],"repeat":false,"action":"sound_tools.mode.audio","kind":"sound_tools","order":0},{"keys":["F4"],"repeat":false,"action":"sound_tools.mode.video","kind":"sound_tools","order":1},{"keys":["<"],"scope":"player","action":"sound_tools.segments.add","kind":"sound_tools","order":2},{"keys":[">"],"scope":"player","action":"sound_tools.segments.close","kind":"sound_tools","order":3},{"keys":["w"],"repeat":false,"scope":"player","action":"sound_tools.waveform.toggle","kind":"sound_tools","order":4}]');class Pe extends X{constructor(){super(),this.metadata={},this.keybindings=Se,this.handlers={onKeyDown:this.onKeyDown.bind(this),onKeyUp:this.onKeyUp.bind(this),onClickChapterLink:this.onClickChapterLink.bind(this),onChapterChanged:this.onChapterChanged.bind(this),onCloseModal:this.onCloseModal.bind(this)},this.chapterLinks=[],this.pageSelect=null,this.modals=null,this.appConstants={}}getKeybindings(){return this.keybindings}connectedCallback(){if(this.hasBeenConnected_)return;super.connectedCallback(),this.eventMgr_.record(()=>{this.addEventListener("chapterchange",this.handlers.onChapterChanged)});const e=this.getConfig(),t=Te(e.constants??{},this.constants);this.appConstants=t,null!==this.playerView&&(this.modals=function(e,t){const s=Object.values(t),i=document.createElement("div");i.className="sxnd-modal-cover",document.body.append(i);const n={toggleExclusive:e=>{e.isOpen?e.close():r.hasOpen()||e.open()},setFullscreen:e=>{(e??document.body).append(i)},hasOpen:()=>s.some(e=>e.isOpen),closeNext:()=>{for(const e of s)if(e.isOpen){e.close();break}},closeAll:()=>{for(const e of s)e.close()},update:async()=>{await Promise.all(s.map(e=>e.update()))},resize:()=>{for(const e of s)e.resize()}},r=Object.assign(new(U()),t,n);i.addEventListener("click",()=>{r.closeAll()}),e.record(()=>{window.addEventListener("resize",()=>{r.resize()}),document.addEventListener("fullscreenchange",()=>{r.setFullscreen(b())})});for(const e of s)e.on("updated",()=>{e.isOpen||r.emit("closed",e),r.hasOpen()?i.classList.add("shown"):i.classList.remove("shown")});return r}(this.eventMgr_,{help:new pe(this.playerView,this.env,{constants:{...t,forceLandscapeOnFullscreen:Number(this.constants.forceLandscapeOnFullscreen)},keybindings:this.keybindings,actionIsAvailable:e=>{const t=this.actions[e];return void 0!==t&&t.isAvailable()}}),bookmark:new le(this.playerView,this.env,{shareButtons:e.shareButtons??[]}),screenshot:new Ce(this.playerView,this.env,{keybindings:this.keybindings,screnshotCaptions:e.screenshotCaptions??[],constants:e.constants??{}})}),this.modals.on("closed",this.handlers.onCloseModal)),setTimeout(()=>{this.loadMetadata()})}loadMetadata(){this.querySelectorAll("dlf-meta").forEach(e=>{const t=e.getAttribute("key"),s=e.getAttribute("value");if(!t||!s)return;let i=this.metadata[t];void 0===i&&(i=this.metadata[t]=[]),i.push(s)})}getActions(){return{...{...super.getActions()},cancel:O(()=>{if(!this.modals?.hasOpen())return this.ui.handleEscape();this.modals.closeNext()}),"modal.help.open":O(()=>{this.openModal(this.modals?.help)}),"modal.help.toggle":O(()=>{null!==this.modals&&(this.ui.seekBar?.endSeek(),this.modals.toggleExclusive(this.modals.help))}),"modal.bookmark.open":O(()=>{this.showBookmarkUrl()}),"modal.screenshot.open":O({isAvailable:()=>!this.isAudioOnly(),execute:()=>{this.showScreenshot()}}),"modal.screenshot.snap":O({isAvailable:()=>!this.isAudioOnly(),execute:()=>{this.snapScreenshot()}}),"theater.toggle":O(()=>{this.ui.seekBar?.endSeek();const e=new CustomEvent("dlf-theater-mode",{detail:{action:"toggle",persist:!0}});window.dispatchEvent(e)}),"navigate.rewind":O(()=>{this.skipSeconds(-this.appConstants.seekStep)}),"navigate.seek":O(()=>{this.skipSeconds(+this.appConstants.seekStep)})}}getTimeRange(){const e=super.getTimeRange();if(null!==e)return e;const t=this.env.getLocation().searchParams.get("timecode");if(t){const[e,s]=t.split(",",2);return this.parseTimeRange(e,s)}return null}getChapterLink(e){const t=e.getAttribute("data-timecode");if(null!==t){const e=Number(t);if(Number.isFinite(e))return{timecode:e,fileIds:[],title:"",pageNo:null}}const s=e.hash.match(/timecode=(\d+(?:\.\d?)?)(?:;fileIds=([a-zA-Z0-9_,]+))?/);if(null!==s){const e=Number(s[1]);if(Number.isFinite(e)){const t=s[2];return{timecode:e,fileIds:void 0===t?[]:t.split(","),title:"",pageNo:null}}}return null}onDomContentLoaded(){super.onDomContentLoaded(),document.querySelectorAll("a[data-timecode], .tx-dlf-tableofcontents a, .tx-dlf-toc a").forEach(e=>{const t=e,s=this.getChapterLink(t);if(null!==s){const t=e;t.dlfVideoLink=s,this.eventMgr_.record(()=>{t.addEventListener("click",this.handlers.onClickChapterLink)}),this.chapterLinks.push(t)}});const e=document.querySelector("li.pages form select");e instanceof HTMLSelectElement&&(this.pageSelect=e,this.pageSelect.onchange=t=>{const s=Number(e.value),i=this.chapters.find(e=>e.pageNo===s)??this.chapters.at(s-1);void 0!==i&&this.seekToChapter(i)||this.pageSelect?.form?.submit()})}loaded(){super.loaded(),this.modals?.resize()}configureFrontend(e){super.configureFrontend(e),this.eventMgr_.record(()=>{document.addEventListener("keydown",this.handlers.onKeyDown,{capture:!0}),document.addEventListener("keyup",this.handlers.onKeyUp,{capture:!0})})}getKeyboardScope(){if(this.modals?.hasOpen())return"modal";for(const e of Array.from(document.querySelectorAll("input:focus")))if(e instanceof HTMLElement&&null!==e.offsetParent)return"input";return"player"}onKeyDown(e){this.hasVideo&&this.handleKey(e,"down")}onKeyUp(e){this.hasVideo&&(e.stopImmediatePropagation(),this.handleKey(e,"up"),this.cancelTrickPlay())}handleKey(e,t){const s=this.getKeyboardScope(),i=function(e,t,s,i){const n=function(e){let t=he.None;return e.ctrlKey&&"Control"!==e.key&&(t|=he.Ctrl),e.metaKey&&"Meta"!==e.key&&(t|=he.Meta),e.shiftKey&&"Shift"!==e.key&&(t|=he.Shift),e.altKey&&"Alt"!==e.key&&(t|=he.Alt),t}(s),r=e.getKeyboardVariant();for(const a of t){const t=a.keys.findIndex(e=>e===s.key);if(-1!==t&&!(null!=a.repeat&&a.repeat!==s.repeat||null!=a.scope&&a.scope!==i||de(e,s.key,he[a.mod??"None"])!==de(e,s.key,n)||null!=a.keyboard&&a.keyboard!==r))return{keybinding:a,keyIndex:t}}}(this.env,this.keybindings,e,s);if(i){const{keybinding:s,keyIndex:n}=i;e.preventDefault();const r="down"===t&&(s.keydown??!0)||"up"===t&&(s.keyup??!1),a=this.actions[s.action];r&&void 0!==a&&a.isAvailable()&&!1!==a.execute(s,n,t)&&"Escape"===e.key&&e.stopImmediatePropagation()}}onClickChapterLink(e){const t=e.currentTarget;this.seekToChapter(t.dlfVideoLink)&&(e.preventDefault(),this.media.play())}onChapterChanged(e){const t=e.detail.curChapter;if(null!=this.pageSelect&&null!==t)if(null!==t.pageNo)this.pageSelect.value=t.pageNo.toString();else{const e=this.chapters.indexOf(t);void 0!==e&&(this.pageSelect.value=(e+1).toString())}for(const e of this.chapterLinks)null!==e.parentElement&&g(e.parentElement,"current",B.isEqual(e.dlfVideoLink,t))}onCloseModal(e){"$startAtVariants"in e&&g(e.$startAtVariants.begin.$container,"bookmark-markertable-hidden",!1),this.resumeOn(e)}showBookmarkUrl(e=null,t=!1){if(!this.hasCurrentData)return;const s=this.modals?.bookmark;void 0!==s&&(s.setState({metadata:this.metadata,timing:{currentTime:this.displayTime,markerRange:e??this.getMarkers().activeSegment?.toTimeRange()??null},fps:this.getFps()??0}),null!==e&&s.setState({startAtMode:"marker"}),!0===t&&g(s.$startAtVariants.begin.$container,"bookmark-markertable-hidden",!0),this.openModal(s,!0))}prepareScreenshot(){if(this.hasCurrentData)return this.modals?.screenshot.setVideo(this.video).setMetadata(this.metadata).setFps(this.getFps()).setTimecode(this.displayTime)}showScreenshot(){const e=this.prepareScreenshot();this.openModal(e,!0)}snapScreenshot(){const e=this.prepareScreenshot();e?.snap()}openModal(e,t=!1){null!=e&&(t&&this.pauseOn(e),this.ui.seekBar?.endSeek(),e.open())}}function xe({frequency:e,sampleRate:t}){let s=2*Math.PI*(e/t);return s=Math.tan(s/2),Ee({type:"iir",sampleRate:t,feedforward:[1,-1,0],feedback:[s+1,s-1,0]})}function _e({frequency:e,gain:t,S:s,sampleRate:i}){const n=2*Math.PI*(e/i),r=10**(t/40),a=$e(r,s),o=Math.cos(n),l=Math.sin(n)/2*(1/a),h=2*Math.sqrt(r)*l;return Ee({type:"iir",sampleRate:i,feedforward:[r*(r+1-(r-1)*o+h),2*r*(r-1-(r+1)*o),r*(r+1-(r-1)*o-h)],feedback:[r+1+(r-1)*o+h,-2*(r-1+(r+1)*o),r+1+(r-1)*o-h]})}function Me({frequency:e,gain:t,S:s,sampleRate:i}){const n=2*Math.PI*(e/i),r=10**(t/40),a=$e(r,s),o=Math.cos(n),l=Math.sin(n)/2*(1/a),h=2*Math.sqrt(r)*l;return Ee({type:"iir",sampleRate:i,feedforward:[r*(r+1+(r-1)*o+h),-2*r*(r-1+(r+1)*o),r*(r+1+(r-1)*o-h)],feedback:[r+1-(r-1)*o+h,2*(r-1-(r+1)*o),r+1-(r-1)*o-h]})}function $e(e,t){return 1/Math.sqrt((e+1/e)*(1/t-1)+2)}function Ee(e){let t=e.feedback[0];for(let s=0;s<3;s++)void 0!==t&&(e.feedback[s]/=t),void 0!==t&&(e.feedforward[s]/=t);return e}customElements.define("slub-media",Pe),customElements.define("dlf-marker-table",class extends Y{constructor(){super(),this.rows={},this.rowCount=0,this.$container=null,this.markersHandlers={remove:e=>{for(const t of e.detail.segments)this.removeRowById(t.id)},remove_all:()=>{this.clearTable()},add:e=>{this.syncSegments(e.detail.segments)},update:e=>{const{segment:t}=e.detail;this.syncSegment(t)},activate_segment:e=>{const{segment:t}=e.detail;for(const e of Object.values(this.rows))g(e.$tr,"active-segment",null!==t&&e.segment.id===t.id)}},this.handlers={onLabelEditKeydown:this.rowEvent(this.onLabelEditKeydown.bind(this)),onLabelEditInput:this.rowEvent(this.onLabelEditInput.bind(this)),onDeleteRow:this.rowEvent(this.onDeleteRow.bind(this)),onBookmarkRow:this.rowEvent(this.onBookmarkRow.bind(this)),onSeekToStartTime:this.rowEvent(this.onSeekToStartTime.bind(this)),onSeekToEndTime:this.rowEvent(this.onSeekToEndTime.bind(this)),onClear:this.onClear.bind(this),onDownloadCsv:this.onDownloadCsv.bind(this)}}attachToPlayer(e){this.$container=r("div",{className:"dlf-media-markers is-empty"},[r("h2",{},[this.env.t("control.sound_tools.marker_table.title")]),r("div",{className:"dlf-media-markers-empty-msg",innerHTML:this.getEmptyTableHTML()}),r("div",{className:"dlf-media-markers-list"},[this.$exportCsvButton=r("a",{href:"#",$click:this.handlers.onDownloadCsv},[this.env.t("control.sound_tools.marker_table.download_csv")]),", ",this.$exportCsvButton=r("a",{href:"#",$click:this.handlers.onClear},[this.env.t("control.sound_tools.marker_table.clear")]),r("table",{},[r("thead",{},[r("tr",{},[r("th",{},[this.env.t("control.sound_tools.marker_table.entry.name")]),r("th",{},[this.env.t("control.sound_tools.marker_table.entry.startTime")]),r("th",{},[this.env.t("control.sound_tools.marker_table.entry.endTime")]),r("th",{},[""])])]),this.$body=r("tbody",{},[])])])]);for(const[t,s]of Object.entries(this.markersHandlers))e.getMarkers().addEventListener(t,s);this.syncSegments(e.getMarkers().getSegments()),this.append(this.$container)}onLabelEditKeydown(e,t){"Enter"===t.key&&e.$labelEditBox.blur()}onLabelEditInput(e,t){null!==this.player&&this.player.getMarkers().update({id:e.segment.id,labelText:e.$labelEditBox.value})}onDeleteRow(e){null!==this.player&&this.player.getMarkers().removeById(e.segment.id)}onBookmarkRow(e){this.player instanceof Pe&&this.player.showBookmarkUrl(e.segment.toTimeRange(),!0)}onSeekToStartTime(e){null!==this.player&&(this.player.seekTo(e.segment.startTime),this.player.getMarkers().activateSegmentById(e.segment.id))}onSeekToEndTime(e){null!==this.player&&(this.player.seekTo(e.segment.endTime??e.segment.startTime),this.player.getMarkers().activateSegmentById(e.segment.id))}onClear(e){e.preventDefault(),null!==this.player&&confirm(this.env.t("control.sound_tools.marker_table.clear.confirm"))&&this.player.getMarkers().removeAll()}onDownloadCsv(e){e.preventDefault();const t=new ae(this.env),s=[["ID","Label","Start [s]","End [s]","URL"],...Object.values(this.rows).map(e=>[e.segment.id,e.segment.labelText,e.segment.startTime.toString(),e.segment.endTime?.toString()??"",t.generateTimerangeUrl(e.segment.toTimeRange()).toString()])].map(e=>e.map(e=>`"${e.replace(/"/g,'""')}"`).join(";")).join("\n");p(new Blob([s],{type:"text/csv"}),"markers.csv")}rowEvent(e){return t=>{const s=t.currentTarget;if(void 0===s.rowId)return;const i=this.rows[s.rowId];void 0!==i&&e(i,t)}}syncSegments(e){for(const t of e)this.syncSegment(t)}syncSegment(e){let t=!1,s=this.rows[e.id];void 0===s&&(s=this.rows[e.id]=this.createRow(e),t=!0,this.rowCount++);const i=Object.assign({},s.segment);Object.assign(s.segment,e),(t||0!==this.cmpSegment(e,i))&&this.insertRow(s),s.$labelEditBox.value=e.labelText,s.$labelEditBox.readOnly=!e.editable,s.$startTime.textContent=T(e.startTime,!0),s.$endTime.textContent=void 0===e.endTime?"":T(e.endTime,!0),this.update()}createRow(e){let t,s,i,n;const a=r("button",{title:this.env.t("control.sound_tools.marker_table.entry.delete"),$click:this.handlers.onDeleteRow},[r("span",{className:"material-icons-round inline-icon"},["delete"])]);a.rowId=e.id;const o=r("button",{title:this.env.t("control.sound_tools.marker_table.entry.bookmark"),$click:this.handlers.onBookmarkRow},[r("span",{className:"material-icons-round inline-icon"},["bookmark_border"])]);o.rowId=e.id;const l=r("input",{placeholder:e.id,value:e.labelText,readOnly:!e.editable,$keydown:this.handlers.onLabelEditKeydown,$input:this.handlers.onLabelEditInput});l.rowId=e.id;const h=[s=r("td",{className:"marker-id-col"},[l]),i=r("td",{className:"marker-start-col",title:this.env.t("control.sound_tools.marker_table.jump_to_start"),$click:this.handlers.onSeekToStartTime}),n=r("td",{className:"marker-end-col",title:this.env.t("control.sound_tools.marker_table.jump_to_end"),$click:this.handlers.onSeekToEndTime}),r("td",{className:"marker-buttons-col"},[o,a])];for(const t of h)t.rowId=e.id;return t=r("tr",{},h),{segment:Object.assign({},e),$tr:t,$id:s,$labelEditBox:l,$startTime:i,$endTime:n}}insertRow(e){if(void 0===this.$body)return;let t=!1;for(const s of Object.values(this.rows))if(e!==s&&this.cmpSegment(e.segment,s.segment)<0){this.$body.insertBefore(e.$tr,s.$tr),t=!0;break}t||this.$body.append(e.$tr)}removeRowById(e){if(void 0===e)return;const t=this.rows[e];void 0!==t&&this.removeRow(t)}clearTable(){void 0!==this.$body&&(this.$body.innerHTML=""),this.rows={},this.rowCount=0,this.update()}removeRow(e){e.$tr.remove(),delete this.rows[e.segment.id],this.rowCount--,this.update()}getEmptyTableHTML(){if(!(this.player instanceof Pe))return"";const e=this.player.getKeybindings(),t=e.find(e=>"sound_tools.segments.add"===e.action),s=e.find(e=>"sound_tools.segments.close"===e.action);return l(r("span",{innerText:this.env.t("control.sound_tools.marker_table.empty",{keybindingAdd:"{keybindingAdd}",keybindingClose:"{keybindingClose}"})}).innerHTML,{keybindingAdd:t?ue(this.env,t).innerHTML:"",keybindingClose:s?ue(this.env,s).innerHTML:""})}update(){null!==this.$container&&g(this.$container,"is-empty",0===this.rowCount)}cmpSegment(e,t){return o(e.startTime,t.startTime)||o(e.endTime??e.startTime,t.endTime??t.startTime)}});class Ae{constructor(e,t=null){this.initial_=e,this.value_=e,this.updateFn_=t}get initial(){return this.initial_}get value(){return this.value_}get editable(){return null!==this.updateFn_}initialize(e){this.initial_=e,this.value_=e}update(e){if(null!==this.updateFn_){const t=this.value_,s=e(t);this.value_=s,this.updateFn_(t,s,e=>{this.value_=e})}}}const Re=["deepBaseRolloff","baseBoostRolloff","baseBoost","trebleCut"];function Be(e){return 1/(2*Math.PI*e)}function qe(e){return 1/(2*Math.PI*e)}class Fe{constructor(e){this.audioContext_=e,this.processorNode=new AudioWorkletNode(e,"multi-iir-processor"),this.pp={deepBaseRolloff:this.makeParam("base",50),baseBoostRolloff:this.makeParam("mid",1e3,()=>[0,this.pp.baseBoost.frequency.value-.01]),baseBoost:this.makeParam("mid",2e3,()=>[this.pp.baseBoostRolloff.frequency.value+.01,Number.POSITIVE_INFINITY]),trebleCut:this.makeParam("treble",5e3)},this.parameters_=[this.pp.deepBaseRolloff,this.pp.baseBoostRolloff,this.pp.baseBoost,this.pp.trebleCut],this.gain_=1,this.keyedFilters_=this.createFilters(),this.updateFilters()}get inputNode(){return this.processorNode}get outputNode(){return this.processorNode}get nodes(){return Object.values(this.keyedFilters_).filter(e=>e.isActive).map(e=>e.node)}get parameters(){return this.parameters_}get gain(){return this.gain_}targetCurve(e){const t={name:"RIAA Target",points:[]},s=this.single(1e3);for(let i=0;i[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY]){return{isActive:!1,frequency:new Ae(t,(t,i,n)=>{n(a(i,s())),this.keyedFilters_[e]=this.makeFilter(e),this.keyedFilters_[e].isActive=!0,this.updateFilters()}),gain:new Ae(0),getFrequencyResponse:t=>{const s=this.keyedFilters_[e]?.node??null;return null===s?{name:"Frequency Response",points:[]}:t.aggregate([s]).makeCurve(this.gain_)}}}updateFilters(){const e=this.single(1e3);this.gain_=10**(-e/20),this.processorNode.port.postMessage({type:"filters",gain:this.gain_,filters:this.keyedFilters_})}createFilters(){const e={base:this.makeFilter("base"),mid:this.makeFilter("mid"),treble:this.makeFilter("treble")};return e.base.isActive=this.pp.deepBaseRolloff.isActive,e.mid.isActive=this.pp.baseBoost.isActive,e.treble.isActive=this.pp.trebleCut.isActive,e}makeFilter(e){switch(e){case"base":return this.makeBaseFilter();case"mid":return this.makeMidFilter();case"treble":return this.makeTrebleFilter()}}makeBaseFilter(){return{isActive:!1,node:xe({frequency:this.pp.deepBaseRolloff.frequency.value,sampleRate:this.audioContext_.sampleRate})}}makeMidFilter(){const e=10*Math.log10(1+this.pp.baseBoost.frequency.value**2)-10*Math.log10(1+this.pp.baseBoostRolloff.frequency.value**2),t=e/2;return{isActive:!1,node:_e({frequency:Math.sqrt(this.pp.baseBoost.frequency.value**2-this.pp.baseBoostRolloff.frequency.value**2*10**(t/10))/Math.sqrt(10**(t/10)-1),gain:e,S:.5,sampleRate:this.audioContext_.sampleRate})}}makeTrebleFilter(){const e=this.single(2e4),t=e/2;return{isActive:!1,node:Me({frequency:Math.sqrt(10**(-t/10)-1)*this.pp.trebleCut.frequency.value,gain:e,S:.5,sampleRate:this.audioContext_.sampleRate})}}single(e){let t=0;return this.pp.deepBaseRolloff.isActive&&(t-=10*Math.log10(1+(this.pp.deepBaseRolloff.frequency.value/e)**2)),this.pp.baseBoost.isActive&&(t+=10*Math.log10(1+(this.pp.baseBoost.frequency.value/e)**2),t-=10*Math.log10(1+(this.pp.baseBoostRolloff.frequency.value/e)**2)),this.pp.trebleCut.isActive&&(t-=10*Math.log10(1+(e/this.pp.trebleCut.frequency.value)**2)),t}}function Ie(e){if("object"!=typeof e||null===e)return null;const{group:t,label:s,mode:i}=e;if("string"!=typeof t||"string"!=typeof s)return null;const n={group:t,label:s};if("string"==typeof e.key&&(n.key=e.key),"band-iso"===i){const t=Number(e.octaveStep);if(t>0)return{...n,mode:i,octaveStep:t}}else if("band"===i){if(Array.isArray(e.bands)){const t=[];for(const s of e.bands){if("object"!=typeof s||null===s)continue;const e=Number(s.frequency),i=Number(s.octaves),n=Number(s.gain);e>0&&i>0&&Number.isFinite(n)&&t.push({frequency:e,octaves:i,gain:n})}return{...n,mode:i,bands:t}}}else if("riaa"===i&&"object"==typeof e.params&&null!==e.params){const t={};let s=Number.POSITIVE_INFINITY;for(const i of Re){const n=Number(e.params[i]);ne.node)}get parameters(){return this.bands_.map(e=>e.param)}get inputNode(){return this.nodes[0]??this.fallbackNode_}get outputNode(){return this.nodes[this.nodes.length-1]??this.fallbackNode_}targetCurve(e){return null}getBands(){return this.bands_.map(e=>({frequency:e.options.frequency,octaves:Le.qToOctaves(e.options.Q),gain:e.options.gain}))}autofill(e){this.addBand(1e3,e,0);for(let t=1;;t++){let s=!1;for(const i of[-1,1]){const n=1e3*2**(i*t*e);20<=n&&n<=2e4&&(this.addBand(n,e,0),s=!0)}if(!s)break}}addBand(e,t,s){const i={type:"peaking",frequency:e,gain:s,Q:Le.octavesToQ(t)},n=new BiquadFilterNode(this.audioContext_,i);null!==this.prevNode_&&this.prevNode_.connect(n),this.prevNode_=n,this.bands_.push({node:n,param:{isActive:!0,frequency:new Ae(i.frequency),gain:new Ae(i.gain,(e,t)=>{n.gain.value=i.gain=t}),getFrequencyResponse:e=>e.aggregate([n]).makeCurve(this.gain)},options:i})}}class Ne{constructor(e){this.source_=e,this.audioContext_=e.context,this.fftSize_=8192,this.fftData_=new Float32Array(this.fftSize_),this.connection_=null,this.active_=!1,this.filterset_=new Le(this.audioContext_)}get audioContext(){return this.audioContext_}get active(){return this.active_}set active(e){e!==this.active_&&(this.active_=e,e?this.activate():this.deactivate())}get filterset(){return this.filterset_}get activeParams(){return this.filterset_.parameters.filter(e=>e.isActive)}getFrequencyResponse(e){return e.aggregate(this.filterset_.nodes).makeCurve(this.filterset.gain)}connect(e){const t=this.audioContext_.createAnalyser();t.smoothingTimeConstant=0,t.fftSize=this.fftSize_,this.connection_={destination:e,analyzer:t},this.source_.connect(t),t.connect(e)}setFilters(e){this.deactivate(),this.filterset_=e,this.active_&&this.activate()}loadPreset(e){let t;switch(e.mode){case"riaa":t=new Fe(this.audioContext),t.resetTc(e.params);break;case"band-iso":t=new Le(this.audioContext),t.autofill(e.octaveStep);break;case"band":t=new Le(this.audioContext);for(const s of e.bands)t.addBand(s.frequency,s.octaves,s.gain)}this.setFilters(t)}exportPreset(e){const t={group:"user",label:e};return this.filterset_ instanceof Le?{...t,mode:"band",bands:this.filterset_.getBands()}:this.filterset_ instanceof Fe?{...t,mode:"riaa",params:this.filterset_.getTc()}:null}fft(e){if(null===this.connection_)return null;this.connection_.analyzer.getFloatFrequencyData(this.fftData_);const t={name:"FFT",points:[]};for(let s=0;se<=0?Number.NEGATIVE_INFINITY:Math.log(e),invert:Math.exp},Ve={convert:e=>e,invert:e=>e};class Ue{constructor(e=0,t=1,s=0,i=1,n=Ve){this.skew=n,this.inputMin_=e,this.inputMax_=t,this.outputMin_=s,this.inputMinConv_=this.skew.convert(e),this.convScale_=(i-s)/(this.skew.convert(this.inputMax_)-this.inputMinConv_)}get max(){return this.inputMax_}convert(e){return(this.skew.convert(e)-this.inputMinConv_)*this.convScale_+this.outputMin_}invert(e){return this.skew.invert((e-this.outputMin_)/this.convScale_+this.inputMinConv_)}}class Ge extends q{constructor(e,t){super(),this.env=e,this.eq_=t,this.handlers={onCanvasMouseMove:this.onCanvasMouseMove.bind(this),onCanvasMouseLeave:this.onCanvasMouseLeave.bind(this),onCanvasMouseDown:this.onCanvasMouseDown.bind(this),onCanvasMouseUp:this.onCanvasMouseUp.bind(this),onCanvasDoubleClick:this.onCanvasDoubleClick.bind(this),onCanvasWheel:this.onCanvasWheel.bind(this),onChangeActivate:this.onChangeActivate.bind(this),onSelectPreset:this.onSelectPreset.bind(this),onResetPreset:this.onResetPreset.bind(this),onSavePreset:this.onSavePreset.bind(this),onDeletePreset:this.onDeletePreset.bind(this),onResizeWindow:this.resize.bind(this)};const s={activateCheck:this.env.mkid(),presetSelect:this.env.mkid(),labelInput:this.env.mkid()};this.$container=r("div",{className:"dlf-equalizer-view"},[r("h2",{},[this.env.t("control.sound_tools.equalizer.title")]),r("section",{className:"eq-controls"},[r("div",{className:"eq-preset"},[r("label",{htmlFor:s.presetSelect},[this.env.t("control.sound_tools.equalizer.preset.label")]),this.$presetSelect=r("select",{id:s.presetSelect,$change:this.handlers.onSelectPreset},[]),r("button",{title:this.env.t("control.sound_tools.equalizer.preset.reset"),$click:this.handlers.onResetPreset},[r("span",{className:"material-icons-round inline-icon"},["settings_backup_restore"])]),r("button",{title:this.env.t("control.sound_tools.equalizer.preset.save"),$click:this.handlers.onSavePreset},[r("span",{className:"material-icons-round inline-icon"},["save_as"])]),this.$deletePresetBtn=r("button",{disabled:!0,title:this.env.t("control.sound_tools.equalizer.preset.delete"),$click:this.handlers.onDeletePreset},[r("span",{className:"material-icons-round inline-icon"},["delete"])])]),r("div",{className:"eq-activate"},[this.$activateCheck=r("input",{id:s.activateCheck,type:"checkbox",checked:this.eq_.active,$input:this.handlers.onChangeActivate}),r("label",{htmlFor:s.activateCheck},[this.env.t("control.sound_tools.equalizer.activate")])])]),this.$canvas=r("canvas",{width:1e3,height:400,$mousemove:this.handlers.onCanvasMouseMove,$mouseleave:this.handlers.onCanvasMouseLeave,$mousedown:this.handlers.onCanvasMouseDown,$dblclick:this.handlers.onCanvasDoubleClick,$mouseup:this.handlers.onCanvasMouseUp,$wheel:this.handlers.onCanvasWheel})]),this.$ctx=this.$canvas.getContext("2d"),this.eqBox=this.calcEqBox(),this.resizeAnimationFrame=null,this.renderAnimationFrame=null,this.hovered=null,this.NUM_POINTS=1e3,this.db=new Ue,this.phase=new Ue,this.freq=new Ue,this.frequencies=new Float32Array(this.NUM_POINTS),this.frequencyResponse=new Oe(this.NUM_POINTS),this.singleFrequencyResponse=new Oe(1),this.frequencyResponseCurve=this.frequencyResponse.makeCurve(),this.presets={selected:null,keyToPreset:{},domGroups:{}},this.addPresetOptgroup("user"),this.setHovered(null),this.initFrequencies(),window.addEventListener("resize",this.handlers.onResizeWindow)}get domElement(){return this.$container}resize(){null===this.resizeAnimationFrame&&(this.resizeAnimationFrame=requestAnimationFrame(()=>{this.resizeAnimationFrame=null;const e=a(this.$container.offsetWidth-100,[100,1e3]),t=a(.4*e,[200,400]);this.$canvas.width=e,this.$canvas.height=t,this.eqBox=this.calcEqBox(),this.initFrequencies()}))}calcEqBox(){return new DOMRect(40,0,this.$canvas.width-40,this.$canvas.height-20)}initFrequencies(){const e=this.eq_.audioContext.sampleRate/2;this.db=new Ue(-24,24,this.eqBox.bottom,this.eqBox.top,Ve),this.phase=new Ue(-2*Math.PI,2*Math.PI,this.eqBox.bottom,this.eqBox.top,Ve),this.freq=new Ue(10,e,this.eqBox.left,this.eqBox.right,De);const t=new Ue(10,e,0,this.NUM_POINTS-1,De);for(let e=0;ee);const s=this.freq.invert(t.freqX+(this.hovered.grabbed.filter.freqX-this.hovered.grabbed.pointer.freqX));this.updateFilterFreq(this.hovered.param,()=>s)}else{const e=this.freq.invert(t.freqX);let s=null;for(const i of this.eq_.activeParams){const n={grabbed:null,pointer:t,dist:Math.abs(i.frequency.value-e),param:i};(null===s||n.dist<=s.dist)&&(s=n)}this.setHovered(s)}}onCanvasMouseLeave(){this.setHovered(null)}onCanvasMouseDown(e){if(null!==this.hovered){const t={freqX:e.offsetX,gainY:e.offsetY},s={gainY:this.db.convert(this.hovered.param.gain.value),freqX:this.freq.convert(this.hovered.param.frequency.value)};this.setHovered({...this.hovered,grabbed:{pointer:t,filter:s}})}}onCanvasMouseUp(){null!=this.hovered?.grabbed&&this.setHovered({...this.hovered,grabbed:null})}onCanvasDoubleClick(){const e=this.hovered?.param;null!=e&&(this.updateFilterGain(e,()=>e.gain.initial),this.updateFilterFreq(e,()=>e.frequency.initial))}onCanvasWheel(e){if(null!==this.hovered&&null===this.hovered.grabbed){e.preventDefault();const t=e.deltaY/4;let s=this.db.invert(this.eqBox.height/2-t);Math.abs(s)>1&&(s/=5),this.updateFilterGain(this.hovered.param,e=>e-s)}}setHovered(e){this.hovered=e,this.$canvas.style.cursor=e?.grabbed?"grab":"pointer",this.scheduleRenderGraph()}updateFilterGain(e,t){this.updateEqValue(e.gain,t,[-24,24])}updateFilterFreq(e,t){this.updateEqValue(e.frequency,t,[10,this.freq.max])}updateEqValue(e,t,s){e.editable&&(e.update(e=>a(t(e),s)),this.updateFrequencyResponse())}onSelectPreset(){this.selectPreset(this.$presetSelect.value)}onResetPreset(){this.selectPreset(this.$presetSelect.value,"original")}onSavePreset(){const e=prompt(this.env.t("control.sound_tools.equalizer.preset.save.name"));if(!e)return;const t=this.eq_.exportPreset(e);if(null===t)return;const s=this.addPreset(t);this.selectPreset(s),this.dispatchEvent(new CustomEvent("store_preset",{detail:{key:s,preset:t}}))}onDeletePreset(){const e=this.$presetSelect.value,t=this.presets.keyToPreset[e];void 0!==t&&"user"===t.original.group&&(this.presets.domGroups[t.original.group]?.querySelector(`option[value="${e}"]`)?.remove(),this.selectPreset(this.$presetSelect.value),this.dispatchEvent(new CustomEvent("delete_preset",{detail:{key:e}})))}addPreset(e){const t=e.key??this.env.uuidv4();this.presets.keyToPreset[t]={original:e,modified:e};let s=this.presets.domGroups[e.group];void 0===s&&(s=this.addPresetOptgroup(e.group));const i=r("option",{value:t},[e.label]);return s.append(i),t}selectPreset(e,t="modified"){if(null!==this.presets.selected){const e=this.eq_.exportPreset("");null!==e&&(this.presets.selected.modified=e)}const s=this.presets.keyToPreset[e];void 0!==s&&(this.presets.selected=s,this.eq_.loadPreset(s[t]),s.modified=s[t],this.$presetSelect.value=e,this.$deletePresetBtn.disabled="user"!==s.original.group,this.updateFrequencyResponse())}addPresetOptgroup(e){const t=r("optgroup",{label:this.env.t(`control.sound_tools.equalizer.preset.group.${e}`)},[]);return this.presets.domGroups[e]=t,this.$presetSelect.appendChild(t),t}fftSnapshot(e){this.fftCurve=this.eq_.fft(e),this.scheduleRenderGraph()}updateFrequencyResponse(){this.frequencyResponseCurve=this.eq_.getFrequencyResponse(this.frequencyResponse),this.scheduleRenderGraph()}scheduleRenderGraph(){null===this.renderAnimationFrame&&(this.renderAnimationFrame=requestAnimationFrame(()=>{this.renderGraph(),this.renderAnimationFrame=null}))}renderGraph(){if(null===this.$ctx)return;const e=this.eqBox;this.$ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height);for(let t=-24;t<=24;t+=6){const s=this.db.convert(t);this.$ctx.strokeStyle="#ddd",this.$ctx.beginPath(),this.$ctx.moveTo(e.left,s),this.$ctx.lineTo(e.right,s),this.$ctx.stroke();let i=s+4;t>0?i=s+10:t<0&&(i=s),this.$ctx.font="12px Arial",this.$ctx.fillStyle="#aaa",this.$ctx.textAlign="right",this.$ctx.fillText(`${t} dB`,e.left-4,i,e.width)}for(const t of[10,100,1e3,1e4]){for(let e=1;e<10;e++){this.$ctx.strokeStyle=e<=1?"#aaa":"#ddd";const s=this.freq.convert(t*e);this.$ctx.beginPath(),this.$ctx.moveTo(s,this.eqBox.top),this.$ctx.lineTo(s,this.eqBox.bottom),this.$ctx.stroke()}this.$ctx.font="12px Arial",this.$ctx.textAlign="left",this.$ctx.fillStyle="#aaa";const s=this.freq.convert(t);this.$ctx.fillText(`${t} Hz`,s,e.bottom+12)}const t=this.eq_.filterset.targetCurve(this.frequencies);if(null!==t&&this.drawEqCurve(t),this.$ctx.strokeStyle="black",this.drawEqCurve(this.frequencyResponseCurve,"gain"),this.$ctx.setLineDash([5,15]),this.drawEqCurve(this.frequencyResponseCurve,"phase"),this.$ctx.setLineDash([]),null!==this.hovered){const e=this.hovered.param.getFrequencyResponse(this.frequencyResponse);this.$ctx.strokeStyle="transparent",this.$ctx.fillStyle="rgba(0, 0, 0, 0.1)",this.fillEqCurve(e)}if(null!==this.hovered){const t=this.freq.invert(this.hovered.pointer.freqX),s=t.toLocaleString(void 0,{maximumFractionDigits:0});this.singleFrequencyResponse.setFrequency(0,t);const i=this.eq_.getFrequencyResponse(this.singleFrequencyResponse).points[0];if(void 0!==i){const t=i.gain.toLocaleString(void 0,{maximumFractionDigits:1,signDisplay:"exceptZero"}),n=(i.phase/Math.PI*180).toLocaleString(void 0,{maximumFractionDigits:0});this.$ctx.font="12px Arial",this.$ctx.fillStyle="rgba(0, 0, 0, 0.4)",this.$ctx.textAlign="left",this.$ctx.fillText(`${s} Hz: ${t} dB, ${n}°`,e.left+2,e.top+12)}}for(const e of this.eq_.activeParams){const t=this.freq.convert(e.frequency.value),s=this.db.convert(e.gain.value);this.$ctx.fillStyle=e===this.hovered?.param?"red":"blue",this.$ctx.beginPath(),this.$ctx.arc(t,s,3,0,2*Math.PI),this.$ctx.fill()}this.fftCurve&&(this.$ctx.strokeStyle="green",this.drawEqCurve(this.fftCurve))}fillEqCurve(e,t="gain"){if(null===this.$ctx)return;const s=e.points[0],i=e.points[e.points.length-1];s&&i&&(e.points.splice(0,0,{freq:s.freq,gain:0,phase:0}),e.points.push({freq:i.freq,gain:0,phase:0})),this.drawEqCurve(e,t),this.$ctx.closePath(),this.$ctx.fill()}drawEqCurve(e,t="gain"){if(null===this.$ctx)return;this.$ctx.beginPath();let s=!0;for(const i of e.points){const e=this.freq.convert(i.freq),n="gain"===t?this.db.convert(i.gain):this.phase.convert(i.phase);s?(this.$ctx.moveTo(e,n),s=!1):this.$ctx.lineTo(e,n)}this.$ctx.stroke()}}function ze(){const e=2**-1022;function t(t){return Math.abs(t){},this.resumedPromise=new Promise(e=>{this.markAsResumed=e})}get view(){return this.eqView_}async attachToPlayer(e){"https:"!==window.location.protocol&&console.error("Warning: The equalizer will probably fail without HTTPS"),await this.resumeAudioContext();const t=new Blob([`\n ${ze.toString()}\n ${ze.name}();\n `],{type:"application/javascript; charset=utf-8"}),s=await function(e){return d(e,"readAsDataURL")}(t);await this.context.audioWorklet.addModule(s),e.media.crossOrigin="anonymous";const i=this.context.createMediaElementSource(e.media),n=new Ne(i);n.connect(this.context.destination),this.eqView_=new Ge(this.env,n),this.eqView_.addEventListener("store_preset",this.handlers.onStorePreset);for(const e of this.presets_)this.eqView_.addPreset(e);for(const[e,t]of Object.entries(this.getLocalPresets()))this.eqView_.addPreset(t);null!==this.defaultPreset_&&this.eqView_.selectPreset(this.defaultPreset_),this.innerHTML="",this.append(this.eqView_.domElement),this.eqView_.resize()}parsePresets(e){if(!Array.isArray(e))return;const t=v(e.map(Ie));if(this.presets_.push(...t),null!==this.eqView_)for(const e of t)this.eqView_.addPreset(e)}selectPreset(e){null===this.eqView_?this.defaultPreset_=e:(this.eqView_.selectPreset(e),this.defaultPreset_=null)}async resumeAudioContext(){"running"===this.context.state?this.markAsResumed():(this.append(r("div",{className:"dlf-equalizer-resume"},[this.env.t("control.sound_tools.equalizer.resume_context")])),this.context.resume().then(()=>{this.markAsResumed()})),window.addEventListener("pointerdown",async()=>{await this.context.resume(),this.markAsResumed()},{once:!0,capture:!0}),window.addEventListener("keydown",async()=>{await this.context.resume(),this.markAsResumed()},{once:!0,capture:!0}),await this.resumedPromise}onStorePreset(e){const{key:t,preset:s}=e.detail;localStorage[`dlf.eq.presets.${t}`]=JSON.stringify(s)}getLocalPresets(){const e={};for(let t=0;t{if(!s){var a=1/0;for(d=0;d=r)&&Object.keys(i.O).every(e=>i.O[e](s[l]))?s.splice(l--,1):(o=!1,r0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[s,n,r]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={322:0};i.O.j=t=>0===e[t];var t=(t,s)=>{var n,r,a=s[0],o=s[1],l=s[2],h=0;if(a.some(t=>0!==e[t])){for(n in o)i.o(o,n)&&(i.m[n]=o[n]);if(l)var d=l(i)}for(t&&t(s);hi(6266));n=i.O(n)})(); +(()=>{"use strict";var e,t={6266:(e,t,s)=>{s(4715);var i=s(3838),n=s.n(i);function r(e,t={},s=[]){const i=document.createElement(e);for(const[e,s]of Object.entries(t))"$"===e[0]?i.addEventListener(e.substring(1),s):i[e]=s;for(const e of s)"string"==typeof e?i.append(document.createTextNode(e)):e instanceof HTMLElement&&i.append(e);return i}function a(e,[t,s]){return es?s:e}function o(e,t){return et?1:0}function l(e,t){let s=e;for(const[e,i]of Object.entries(t))void 0!==i&&(s=s.split(`{${e}}`).join(i));return s}function h(e,t){return e.toString().padStart(t,"0")}function d(e,t){return new Promise((s,i)=>{const n=new FileReader;n.onload=()=>{"string"==typeof n.result?s(n.result):i(null)},n.onerror=()=>{i(n.error)},n[t](e)})}function c(e,t){const s=URL.createObjectURL(e);let i;try{i=t(s)}catch(e){throw URL.revokeObjectURL(s),e}if(i instanceof Promise){const e=i;return new Promise((t,i)=>{e.then(e=>{URL.revokeObjectURL(s),t(e)}).catch(e=>{URL.revokeObjectURL(s),i(e)})})}return URL.revokeObjectURL(s),i}async function u(e){const t=r("img");return t.decoding="async",t.src=e,await t.decode(),t}function p(e,t){"string"==typeof e?r("a",{href:e,download:t}).click():c(e,e=>{p(e,t)})}function m(e){return e.preventDefault(),!1}function f(e,t){const s=[],i=Array.isArray(t)?t:[t];for(let t=0;t0)for(const e of i){const t="string"==typeof e?e:e.cloneNode(!0);s.push(t)}s.push(e[t])}return s}function g(e,t,s){s?e.classList.add(t):e.classList.remove(t)}function v(e){return e.filter(e=>null!==e)}function b(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null}class y extends n().ui.Element{static register(e,t={}){const s=e.mkid();return n().ui.Controls.registerElement(s,{create:(s,i)=>new this(s,i,e,t)}),s}constructor(e,t,s,i={}){super(e,t),this.env=s;const n=i.element??r("button");e.appendChild(n),this.dlf={config:i,element:n};const{onClickAction:a}=i;this.eventManager&&a&&(this.eventManager.listen(n,"click",()=>{a.isAvailable()&&a.execute()}),this.eventManager.listen(this.player,"loaded",()=>{this.updateControlPanelButton()})),this.updateControlPanelButton()}updateControlPanelButton(){for(const e of this.dlf.element.getAttributeNames())if(e.startsWith("data-t-")){const t=e.substring(7),s=this.dlf.element.getAttribute(e);s&&this.dlf.element.setAttribute(t,this.env.t(s))}let e=this.dlf.element.title??"";this.dlf.element.ariaLabel=e,this.dlf.element.title="",g(this.dlf.element,"shaka-tooltip",""!==e);const{onClickAction:t}=this.dlf.config;t&&g(this.dlf.element,"shaka-hidden",!t.isAvailable())}}class k{constructor(){this.tasks={}}get(e){const t=this.tasks[e]??=this.createTask(e);return this.resumeTask(t)}getCached(e){const t=this.tasks[e]?.state;return 4===t?.type?t.image:null}abortPending(){for(const[e,t]of Object.entries(this.tasks))this.stopTask(t)}createTask(e){return{state:{type:0,url:e},promise:null,stopNext:!1}}stopTask(e){e.stopNext=!0}resumeTask(e){return e.stopNext=!1,null===e.promise&&(e.promise=new Promise(async(t,s)=>{try{for(;;){if(4===e.state.type){t(e.state.image);break}if(e.stopNext){e.promise=null;break}await this.progressTask(e)}}catch(e){s(e)}})),e.promise}async progressTask(e){switch(e.state.type){case 0:{const t=new AbortController,s=e.state.url,i=fetch(s,{signal:t.signal});e.state={type:1,abortController:t,responsePromise:i};break}case 1:{const t=await e.state.responsePromise;if(!t.ok)throw t;e.state={type:2,imageBlob:await t.blob()};break}case 2:e.state={type:3,imagePromise:(t=e.state.imageBlob,c(t,u))};break;case 3:{const t=await e.state.imagePromise;e.state={type:4,image:t};break}case 4:break;default:throw new Error(`Unhandled LoadState type: ${e.state}`)}var t}}function w(e,t=null){const s=function(e,t=0){const s=Math.floor(e/3600),i=Math.floor(e/60%60),n=e%1;return{hours:s,minutes:i,totalMinutes:60*s+i,seconds:Math.floor(e%60),fractional:n,frames:Math.floor(n*t)}}(e,t??0);return{h:`${s.hours}`,hh:h(s.hours,2),m:`${s.totalMinutes}`,mm:h(s.minutes,2),ss:h(s.seconds,2),ff:h(s.frames,2),"00":h(Math.floor(100*s.fractional),2),"000":h(Math.floor(1e3*s.fractional),3)}}function T(e,t,s=null){let i=t?"{h}:{mm}:{ss}":"{m}:{ss}";return s?(i+=":{ff}",t||(i+="f")):i+=".{00}",l(i,w(e,s))}class C{constructor(e){this.seekBar=e.seekBar,this.player=e.player,this.network=e.network,this.interaction=e.interaction,this.fps=null,this.chapters=null,this.thumbnailTracks=[],this.snapToThumbnail=null,this.lastRendered=null,this.isChanging=!1,this.deltaStart=null,this.current=null,this.renderAnimationFrame=null,this.seekMode="wide",this.openDisplayTimeout=null,this.handlers={onWindowBlur:this.onWindowBlur.bind(this),onWindowResize:this.onWindowResize.bind(this),onPointerMove:this.onPointerMove.bind(this),onPointerDown:this.onPointerDown.bind(this),onPointerUpOrCancel:this.onPointerUpOrCancel.bind(this)},this.$container=r("div",{className:"dlf-media-thumbnail-preview"},[r("div",{className:"content-box"},[this.$display=r("div",{className:"display"},[this.$img=r("img")]),this.$info=r("span",{className:"info"},[this.$chapterText=r("span",{className:"chapter-text"}),this.$timecodeText=r("span",{className:"timecode-text"})])])]),this.$seekMarker=r("div",{className:"seek-marker"}),this.$seekThumbBar=r("div",{className:"seek-thumb-bar"}),this.seekBar.append(this.$seekMarker,this.$seekThumbBar,this.$container),this.ensureDisplaySize(160,90),window.addEventListener("blur",this.handlers.onWindowBlur),window.addEventListener("resize",this.handlers.onWindowResize),document.addEventListener("pointermove",this.handlers.onPointerMove),document.addEventListener("pointerdown",this.handlers.onPointerDown),document.addEventListener("pointerup",this.handlers.onPointerUpOrCancel),document.addEventListener("pointercancel",this.handlers.onPointerUpOrCancel)}release(){window.removeEventListener("blur",this.handlers.onWindowBlur),window.removeEventListener("resize",this.handlers.onWindowResize),document.removeEventListener("pointermove",this.handlers.onPointerMove),document.removeEventListener("pointerdown",this.handlers.onPointerDown),document.removeEventListener("pointerup",this.handlers.onPointerUpOrCancel),document.removeEventListener("pointercancel",this.handlers.onPointerUpOrCancel)}setFps(e){this.fps=e,this.currentRenderBest()}setChapters(e){this.chapters=e,this.currentRenderBest()}async setThumbnailTracks(e){this.thumbnailTracks=e.slice(),this.thumbnailTracks.sort((e,t)=>t.bandwidth-e.bandwidth),await this.activateThumbnailSnap(!1)}async activateThumbnailSnap(e){this.snapToThumbnail=e?this.lastRendered?.thumb.track??this.thumbnailTracks[0]??null:null,this.current&&(this.current.seekPosition=await this.snapPosition(this.current.rawSeekPosition)),this.current&&this.renderSeekPosition(this.current.seekPosition),this.currentRenderBest()}setSeekMode(e){this.seekMode=e,this.currentRenderBest()}onWindowBlur(){this.cancelPreview()}onWindowResize(){this.cancelPreview()}async onPointerMove(e){const t=this.mouseEventToPosition(e);if(void 0===t)return this.setIsVisible(!1);const s=await this.snapPosition(t);"touch"===e.pointerType&&this.beginChange();let i=[];if(this.showThumbnailImage()){const e=s.seconds,t=.01*this.player.getStats().estimatedBandwidth;i=await this.getThumbnails(e,t)}const n=null===this.current;this.current={rawSeekPosition:t,seekPosition:s,thumbs:i},this.isChanging&&1&e.buttons&&this.interaction?.onChange?.(s),this.currentRenderBest(n)}async onPointerDown(e){if(1&e.buttons){const t=this.mouseEventToPosition(e,"mouse"===e.pointerType);if(void 0!==t){const e=await this.snapPosition(t);this.beginChange(),this.interaction?.onChange?.(e)}}}onPointerUpOrCancel(e){this.endChange(),"mouse"===e.pointerType&&void 0!==this.mouseEventToPosition(e)||this.setIsVisible(!1)}mouseEventToPosition(e,t=!0){const s=this.saneVideoDuration();if(void 0===s)return;if(null!==document.querySelector("input[type=button]:hover, button:hover"))return;const i=this.seekBar.getBoundingClientRect();let n=i.left;if(null!==this.deltaStart){const e=i.width/s;n=this.deltaStart.clientX-this.deltaStart.seconds*e}if(!this.isChanging)if(this.isVisible&&t){const{right:t,bottom:s}=i;if(!(n<=e.clientX&&e.clientX<=t&&e.clientY<=s))return;let{top:r}="wide"===this.seekMode?this.$container.getBoundingClientRect():this.seekBar.getBoundingClientRect();if(null!==this.openDisplayTimeout&&(r+=(s-r)/2),!(r<=e.clientY))return}else if(!(e.target instanceof Node&&this.seekBar.contains(e.target)))return;const r=s/i.width;return{absoluteRaw:a(e.clientX-n,[0,i.width]),secondsPerPixel:r}}async snapPosition(e){let{absoluteRaw:t,secondsPerPixel:s}=e,i=t*s;const n=this.chapters?.timeToChapter(i+2*s);let r=!1;if(!this.isChanging){if(null!==this.snapToThumbnail){const e=await this.getSingleThumbnail(this.snapToThumbnail,i);null!==e&&(i=e.imageTime,t=i/s)}n&&(i-n.timecode)/s<6&&(null===this.snapToThumbnail&&(i=n.timecode,t=i/s),r=!0)}return{absolute:t,seconds:i,chapter:n,onChapterMarker:r}}ensureDisplaySize(e,t){const s=Math.floor(160/e*t);this.$display.clientHeight!==s&&(this.$display.style.height=`${s}px`)}currentRenderBest(e=!1){e&&null===this.openDisplayTimeout?this.openDisplayTimeout=setTimeout(()=>{this.openDisplayTimeout=null,this.currentRenderBest()},100):null===this.openDisplayTimeout&&null===this.renderAnimationFrame&&(this.renderAnimationFrame=window.requestAnimationFrame(()=>{this.renderAnimationFrame=null;const e=this.current;if(null!==e){this.setIsVisible(!0,e.thumbs.length>0,!1),this.renderSeekPosition(e.seekPosition);for(const t of e.thumbs){const s=t.uris[0];if(void 0===s)continue;const i=this.network.getCached(s);if(null!==i){this.renderImageAndShow(s,t,i,e.seekPosition);break}this.network.get(s).then(()=>{this.currentRenderBest()})}}}))}renderImageAndShow(e,t,s,i){this.ensureDisplaySize(t.width,t.height),this.renderImage(e,t,s),this.setIsVisible(!0),this.positionContainer(i),this.renderSeekPosition(i,t)}renderImage(e,t,s,i=!1){if(i||null===this.lastRendered||t.imageTime!==this.lastRendered.thumb.imageTime||t.bandwidth!==this.lastRendered.thumb.bandwidth){const{positionX:i,positionY:n,width:r}=t,a=160/r;this.$img.replaceWith(s),this.$img=s,this.$img.style.transform=[`scale(${a})`,`translateX(-${i}px)`,`translateY(-${n}px)`].join(" "),this.$img.style.transformOrigin="left top",this.lastRendered={uri:e,thumb:t,tilesetImage:s}}}positionContainer(e){const t=a(e.absolute-this.$container.offsetWidth/2,[0,this.seekBar.clientWidth-this.$container.offsetWidth]);this.$container.style.left=`${t}px`}renderSeekPosition(e,t=null){const s=this.saneVideoDuration();if(void 0===s)return void this.setIsVisible(!1);this.$seekMarker.style.left=`${e.absolute}px`,null!==t&&null!==this.snapToThumbnail&&(this.$seekThumbBar.style.left=t.startTime/s*100+"%",this.$seekThumbBar.style.width=t.duration/s*100+"%"),e.onChapterMarker?this.$info.classList.add("on-chapter-marker"):this.$info.classList.remove("on-chapter-marker");const i=e.chapter?.title??"";this.$chapterText.innerText=i,g(this.$chapterText,"displayed",""!==i),this.$timecodeText.innerText=T(e.seconds,s>=3600,this.fps),this.positionContainer(e)}cancelPreview(){this.setIsVisible(!1),this.endChange()}beginChange(e=null){this.isChanging||(this.deltaStart=this.convertDelta(e),this.interaction?.onChangeStart?.(),document.body.classList.add("seek-or-scrub"),this.isChanging=!0)}convertDelta(e){if(null===e)return null;const t=this.player.getMediaElement();return null===t?null:{clientX:e,seconds:t.currentTime}}endChange(){this.isChanging&&(this.deltaStart=null,this.interaction?.onChangeEnd?.(),document.body.classList.remove("seek-or-scrub"),this.isChanging=!1)}get isVisible(){return null!==this.current}setIsVisible(e,t=e,s=t){e||(this.current=null),g(this.$container,"dlf-visible",e),g(this.$seekMarker,"dlf-visible",e),g(this.$seekThumbBar,"dlf-visible",s&&null!==this.snapToThumbnail),g(this.$display,"is-open",t),g(this.$img,"dlf-visible",s),function(e){e.draggable=!1,e.ondragstart=m}(this.$img)}async getThumbnails(e,t){let s=[];if(null!==this.snapToThumbnail)s=[this.snapToThumbnail];else{let e=this.thumbnailTracks.find(e=>e.bandwidththis.getSingleThumbnail(t,e));return v(await Promise.all(i))}async getSingleThumbnail(e,t){const s=await e.getThumb(t),i=this.saneVideoDuration();return null===s||void 0===i?null:(r=i,(n=s).startTime0?e:void 0}}class S extends n().ui.Element{static register(){n().ui.Controls.registerSeekBar({create:(e,t)=>new S(e,t)})}constructor(e,t){super(e,t),this.$container=r("div",{className:"dlf-media-flat-seek-bar"},[this.$range=r("div",{className:"range"})]),e.prepend(this.$container),this.dlf={mediaProperties:{poster:null,chapters:null,fps:null,variantGroups:null},hasRenderedChapters:!1,value:0,uiConfig:t.getConfig(),wasPlaying:!1,seekTimer:null,thumbnailPreview:null,lastGradientStr:""},this.dlf.seekTimer=new(n().util.Timer)(()=>{null!==this.video&&(this.video.currentTime=this.getValue(),this.controls?.dispatchEvent(new CustomEvent("dlf-media-manual-seek",{})))}),null!==this.player&&(this.dlf.thumbnailPreview=new C({seekBar:this.$container,player:this.player,network:new k,interaction:{onChangeStart:()=>{this.controls?.setSeeking(!0),null!==this.video&&(this.dlf.wasPlaying=!this.video.paused,this.video.pause())},onChange:e=>{this.dlf.value=e.seconds,this.update(),this.dlf.seekTimer?.tickAfter(.125)},onChangeEnd:()=>{this.dlf.seekTimer?.tickNow(),this.controls?.setSeeking(!1),this.dlf.wasPlaying&&this.video?.play()}}})),this.eventManager&&(this.eventManager.listen(this.player,"loaded",()=>{this.update()}),this.eventManager.listen(this.player,"variantchanged",()=>{this.updatePreviewImageTracks()}),this.eventManager.listen(this.controls,"dlf-media-properties",e=>{const t=e.detail;this.dlf.mediaProperties=t.fullProps;const{chapters:s,fps:i,variantGroups:n}=t.updateProps;void 0!==s&&(this.dlf.hasRenderedChapters=!1,this.dlf.thumbnailPreview?.setChapters(s),this.update()),void 0!==i&&this.dlf.thumbnailPreview?.setFps(i?.rate??null),n&&this.updatePreviewImageTracks()}),this.controls?.dispatchEvent(new CustomEvent("dlf-media-seek-bar",{detail:{seekBar:this}})))}release(){null!==this.dlf.seekTimer&&(this.dlf.seekTimer.stop(),this.dlf.seekTimer=null),null!==this.dlf.thumbnailPreview&&(this.dlf.thumbnailPreview.release(),this.dlf.thumbnailPreview=null),super.release()}get thumbnailPreview(){return this.dlf.thumbnailPreview}isThumbnailPreviewOpen(){return this.dlf.thumbnailPreview?.isVisible??!1}endSeek(){this.dlf.thumbnailPreview?.endChange(),this.dlf.thumbnailPreview?.setIsVisible(!1)}setThumbnailSnap(e){this.dlf.thumbnailPreview?.activateThumbnailSnap(e)}renderChapterMarkers(e,t){this.$range.querySelectorAll(".dlf-media-chapter-marker").forEach(e=>{e.remove()});for(const s of e){const e=s.timecode/t;if(!(0<=e&&e<1))continue;const i=document.createElement("span");i.className="dlf-media-chapter-marker",i.style.position="absolute",i.style.left=100*e+"%",this.$range.append(i)}}updatePreviewImageTracks(){if(null===this.dlf.thumbnailPreview)return void console.warn("FlatSeekBar: Missing thumbnail preview");const{variantGroups:e}=this.dlf.mediaProperties;if(null===e)return;const t=e.findThumbnailTracks();this.dlf.thumbnailPreview.setThumbnailTracks(t)}getValue(){return this.dlf.value}isShowing(){return!0}setValue(e){this.controls?.isSeeking()||(this.dlf.value=e)}makeColor(e,t){return`${e} ${100*t}%`}update(){if(null===this.video)return void console.warn("FlatSeekBar: Missing video");const e=this.video.duration;if(!(e>0))return;const{chapters:t}=this.dlf.mediaProperties;null==t||this.dlf.hasRenderedChapters||(this.renderChapterMarkers(t,e),this.dlf.hasRenderedChapters=!0);const s=getComputedStyle(this.$container),i={base:s.getPropertyValue("--base-color")||"rgba(255, 255, 255, 0.3)",buffered:s.getPropertyValue("--buffered-color")||"rgba(255, 255, 255, 0.54)",played:s.getPropertyValue("--played-color")||"rgb(255, 255, 255)"},n=this.getValue(),r=this.video.buffered.length,a=r?this.video.buffered.start(0):0,o=r?this.video.buffered.end(r-1):0,l={start:0,end:e},h=l.end-l.start,d=Math.max(a,l.start),c=Math.min(o,l.end),u=Math.min(Math.max(n,l.start),l.end),p=(d-l.start)/h||0,m=(c-l.start)/h||0,f=(u-l.start)/h||0,g=this.dlf.uiConfig.showUnbufferedStart?i.base:i.played,v="linear-gradient("+["to right",this.makeColor(g,p),this.makeColor(i.played,p),this.makeColor(i.played,f),this.makeColor(i.buffered,f),this.makeColor(i.buffered,m),this.makeColor(i.base,m)].join(",")+")";v!==this.dlf.lastGradientStr&&(this.dlf.lastGradientStr=v,this.$range.style.background=v)}}class P extends y{constructor(e,t,s,i={}){const n=r("button",{className:"material-icons-round shaka-fullscreen-button shaka-tooltip"},["fullscreen"]);n.setAttribute("data-t-title","control.bookmark.tooltip"),super(e,t,s,{...i,element:n}),this.eventManager&&this.eventManager.listen(document,"fullscreenchange",this.updateFullScreenButton.bind(this)),this.updateFullScreenButton()}updateControlPanelButton(){}updateFullScreenButton(){document.fullscreenEnabled?(this.dlf.element.textContent=document.fullscreenElement?"fullscreen_exit":"fullscreen",this.dlf.element.ariaLabel=document.fullscreenElement?this.env.t("control.fullscreen_exit.tooltip"):this.env.t("control.fullscreen.tooltip")):this.dlf.element.classList.add("shaka-hidden")}}n().ui.SettingsMenu;class x extends n().ui.PlaybackRateSelection{static register(e){const t=e.mkid();return n().ui.OverflowMenu.registerElement(t,{create:(t,s)=>new x(t,s,e)}),t}constructor(e,t,s){super(e,t),this.$playRateTooltip=r("div",{className:"dlf-playrate-tooltip"});const i=this.player?.getPlaybackRate()||1;this.$playRateTooltip.textContent=this.getRateStr(i),this.$container=r("div",{className:"shaka-range-container dlf-playrate-slider"},[this.$input=r("input",{className:"shaka-range-element",type:"range",valueAsNumber:Math.log2(i),min:"-1",max:"1",step:"0.01",$input:()=>{const e=2**this.$input.valueAsNumber,t=this.player?.getMediaElement();t&&(t.playbackRate=e,t.defaultPlaybackRate=e)}}),this.$playRateTooltip]),null!==this.player&&this.menu.insertBefore(this.$container,this.backButton.nextSibling),null!==this.eventManager&&this.eventManager.listen(this.player,"ratechange",()=>{if(null!==this.player){const e=this.player.getPlaybackRate();this.$input.valueAsNumber=Math.log2(e);const t=this.getRateStr(e);this.currentSelection.textContent=t,this.button.setAttribute("shaka-status",t),this.updateTooltip(e,this.$input)}})}getRateStr(e){return`${e.toLocaleString(void 0,{maximumFractionDigits:2})}x`}updateTooltip(e,t){const s=t.valueAsNumber,i=t.min?parseFloat(t.min):0,n=t.max?parseFloat(t.max):100,r=Number(100*(s-i)/(n-i));this.$playRateTooltip.textContent=this.getRateStr(e),this.$playRateTooltip.style.left=`calc(${r}% + (${17-.35*r}px))`}}const _=0,M=1,$=2;class E extends n().ui.Element{static register(e){const t=e.mkid();return n().ui.Controls.registerElement(t,{create:(t,s)=>new E(t,s,e)}),t}constructor(e,t,s){super(e,t);const i=r("button",{className:"shaka-current-time shaka-tooltip",ariaLabel:s.t("control.time.tooltip")});if(e.appendChild(i),this.dlf={env:s,currentTime:i},this.state={isReady:!1,activeMode:0,totalSeconds:0,duration:0,mediaProperties:{chapters:null,fps:null}},this.eventManager){this.eventManager.listen(i,"click",()=>{this.render({activeMode:(this.state.activeMode+1)%3})});const e=this.updateTime.bind(this);this.eventManager.listen(this.controls,"timeandseekrangeupdated",e),this.eventManager.listen(this.controls,"dlf-media-properties",e=>{const t=e.detail;this.render({mediaProperties:t.fullProps})})}}updateTime(){if(null===this.controls||null===this.video||this.video.readyState<1)this.render({isReady:!1});else{let e=this.video.duration;e>=0||(e=0),this.render({isReady:!0,duration:e,totalSeconds:a(this.controls.getDisplayTime(),[0,e])})}}render(e){const t=Object.assign({},this.state,e);if(Object.keys(e).some(t=>e[t]!==this.state[t])){const e={[_]:"current-time",[M]:"remaining-time",[$]:"current-frame"}[t.activeMode]??"current-time";this.dlf.currentTime.textContent=this.getTimecodeText(e,t)}this.state=t}getTimecodeText(e,{isReady:t,totalSeconds:s,duration:i,mediaProperties:n}){if(t&&0!==i){const t=i>=3600,{chapters:r,fps:a}=n,o=a?.rate??null,l={get chapterTitle(){return r?.timeToChapter(s)?.title??"_"},get currentTime(){return T(s,t,o)},get totalTime(){return T(i,t,o)},get remainingTime(){return T(i-s,t,o)},get currentFrame(){return a?.vifa.get()??-1}};return this.dlf.env.t(`control.time.${e}.text`,l)}return this.dlf.env.t("player.loading")}}class A extends n().ui.SettingsMenu{static register(e){const t=e.mkid();return n().ui.OverflowMenu.registerElement(t,{create:(t,s)=>new A(t,s,e)}),t}constructor(e,t,s){super(e,t,"switch_video"),this.dlf={env:s,activeCheck:r("i",{className:"material-icons-round shaka-chosen-item"},["done"]),variantGroups:null},this.updateStrings(),this.updateVisibility(),this.menuButtons={},this.eventManager&&(this.eventManager.listen(this.controls,"dlf-media-properties",e=>{const t=e.detail,{variantGroups:s}=t.updateProps;if(void 0!==s)try{this.setVariantGroups(s)}catch(e){console.error(e)}}),this.eventManager.listen(this.player,"variantchanged",()=>{this.markActiveGroup()}))}setVariantGroups(e){if(this.dlf.variantGroups=e,this.clearMenu(),this.updateVisibility(),null!==e){for(const t of e){const e=r("button",{$click:()=>{this.dlf.variantGroups?.selectGroupByKey(t.key)}},[r("span",{},[t.key])]);this.menu.appendChild(e),this.menuButtons[t.key]=e}this.markActiveGroup()}}clearMenu(){for(const e of Object.values(this.menuButtons))e.remove();this.menuButtons={}}markActiveGroup(){const e=this.dlf.variantGroups?.findActiveGroup();e&&(this.menuButtons[e.key]?.appendChild(this.dlf.activeCheck),this.currentSelection.textContent=e.key)}updateVisibility(){(this.dlf.variantGroups?.numGroups??0)>0?this.button.classList.remove("shaka-hidden"):this.button.classList.add("shaka-hidden")}updateStrings(){const e=this.dlf.env.t("control.back"),t=this.dlf.env.t("control.video-track.title");this.backButton.ariaLabel=e,this.button.ariaLabel=t,this.nameSpan.textContent=t,this.backSpan.textContent=t}}class R{constructor(e){this.elements=e.slice(),this.elements.sort((e,t)=>e.timecode-t.timecode),this.elementToIndex=new Map;for(const[e,t]of this.elements.entries())this.elementToIndex.set(t,e)}at(e){return this.elements[e]}indexOf(e){return this.elementToIndex.get(e)}advance(e,t=1){const s=this.indexOf(e);if(void 0!==s)return this.elements[s+t]}timeToElement(e){return this.timeToEntry(e)?.[1]}timeToEntry(e){if(0===this.elements.length)return;let t=0,s=this.elements.length-1;for(;t+1=0;e--)yield this.elements[e]}}class B extends R{timeToChapter(e){return this.timeToElement(e)}filter(e){return new B(this.elements.filter(e))}static isEqual(e,t){return e===t||null!==e&&null!==t&&e.timecode===t.timecode&&!!globalThis.dlfUtils?.arrayEqualsByIdentity(e.fileIds,t.fileIds)}}class q{constructor(){this.__listeners=new Map}addEventListener(e,t,s={}){if(arguments.length<2)throw new TypeError("TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only "+arguments.length+" present.");const i=this.__listeners,n=e.toString();i.has(n)||i.set(n,new Map);const r=i.get(n);r.has(t)||r.set(t,s)}removeEventListener(e,t,s){if(arguments.length<2)throw new TypeError("TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only "+arguments.length+" present.");const i=this.__listeners,n=e.toString();if(i.has(n)){const e=i.get(n);e.has(t)&&e.delete(t)}}dispatchEvent(e){if(!(e instanceof Event))throw new TypeError("Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.");const t=e.type,s=this.__listeners.get(t);if(s)for(var i of s.entries()){const t=i[0],n=i[1];try{"function"==typeof t?t.call(this,e):t&&"function"==typeof t.handleEvent&&t.handleEvent(e)}catch(e){setTimeout(()=>{throw e})}n&&n.once&&s.delete(t)}return!0}}class F extends q{constructor(){super(),this.cnt_=0,this.activeSegment_=null,this.segments_={}}get activeSegment(){return this.activeSegment_}add(e){const t=e.id??this.makeId(),s=this.segments_[t]={labelText:"",editable:!0,...e,id:t,toTimeRange(){return{startTime:this.startTime,endTime:this.endTime??null}}};return this.dispatchEvent(new CustomEvent("add",{detail:{segments:[s]}})),this.activateSegmentById(s.id),s}update(e,t=!1){const s=this.segments_[e.id],i=Object.assign({},s);if(void 0!==s){for(const[t,i]of Object.entries(e))void 0!==i&&(s[t]=i);this.dispatchEvent(new CustomEvent("update",{detail:{segment:s,prevSegment:i}})),t&&this.activateSegment(s)}}removeById(e){const t=this.segments_[e];delete this.segments_[e],void 0!==t&&this.dispatchEvent(new CustomEvent("remove",{detail:{segments:[t]}})),null!==this.activeSegment_&&e===this.activeSegment_.id&&this.activateSegment(null)}removeAll(){this.segments_={},this.dispatchEvent(new CustomEvent("remove_all",{detail:{}})),this.activateSegment(null)}activateSegmentById(e){const t=this.segments_[e];void 0!==t&&this.activateSegment(t)}activateSegment(e){e!==this.activeSegment_&&(this.activeSegment_=e,this.dispatchEvent(new CustomEvent("activate_segment",{detail:{segment:this.activeSegment_}})))}getSegment(e){return this.segments_[e]}getSegments(){return Object.values(this.segments_)}makeId(){return"dlf.segments."+this.cnt_++}}var I=s(2065);class L{constructor(){this.idCnt=0,this.testElements={},this.lang={twoLetterIsoCode:"en",phrasesInput:{},phrasesCompiled:{}}}getLocation(){return new URL(window.location.href)}supportsMediaSource(){return void 0!==window.MediaSource&&void 0!==window.MediaSource.isTypeSupported}supportsCanvasExport(e){var t;return(t=this.getTestElement("canvas").toDataURL(e),t.match(/data:(.*);/)?.[1])===e}supportsVideoMime(e){return""!==this.getTestElement("video").canPlayType(e)}getKeyboardVariant(){return navigator.userAgent.includes("Mac")?"mac":"ibm"}isInFullScreen(){return null!==b()}async toggleFullScreen(e,t){if(document.fullscreenElement)screen.orientation&&screen.orientation.unlock(),await document.exitFullscreen();else try{if(document.pictureInPictureElement&&await document.exitPictureInPicture(),await e.requestFullscreen({navigationUI:"hide"}),t&&screen.orientation)try{await screen.orientation.lock("landscape")}catch(e){}}catch(e){console.log(e)}}mkid(){return"__autoid_"+ ++this.idCnt}uuidv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})}setLang(e){this.lang={twoLetterIsoCode:e.twoLetterIsoCode,phrasesInput:e.phrases,phrasesCompiled:{}}}t(e,t={},s=void 0){let i=this.lang.phrasesCompiled[e];if(void 0===i){const t=this.lang.phrasesInput[e];if(void 0===t)return"function"==typeof s?s():(console.error(`Warning: Translation key '${e}' not defined, fallback not provided.`),e);i=this.lang.phrasesCompiled[e]=new I.Ay(t,this.lang.twoLetterIsoCode,{},{ignoreTag:!0})}return i.format(t)}getTestElement(e){return this.testElements[e]??document.createElement(e)}}class N{constructor(){this.listeners_=[]}record(e){const t=EventTarget.prototype.addEventListener,s=q.prototype.addEventListener,i=this;try{EventTarget.prototype.addEventListener=function(e,s,n){i.listeners_.push({target:this,type:e,callback:s,options:n}),t.call(this,e,s,n)},q.prototype.addEventListener=function(e,t,n){i.listeners_.push({target:this,type:e,callback:t,options:n}),s.call(this,e,t,n)},e()}finally{EventTarget.prototype.addEventListener=t,q.prototype.addEventListener=s}}removeAll(){for(const e of this.listeners_)e.target.removeEventListener(e.type,e.callback,e.options)}}function O(e){return"function"==typeof e?{isAvailable:()=>!0,execute:e}:{isAvailable:e.isAvailable??(()=>!0),execute:e.execute??(()=>!1)}}function D(e){return"audio"===e||"video"===e}var V=s(7007),U=s.n(V);class G{constructor(e={}){this.config={tapMaxDelay:200,tapMaxDistance:20,swipeMinDistance:100,holdMinDelay:200,allowGesture:()=>!0,...e},this.last={tapdown:null,tapup:null},this.holdTimeout=null,this.tapCount=0,this.handlers={contextmenu:this.handleContextMenu.bind(this),pointerdown:this.handlePointerDown.bind(this),pointerup:this.handlePointerUp.bind(this),pointercancel:this.handlePointerCancel.bind(this),pointerleave:this.handlePointerLeave.bind(this)},this.events=new(U())}register(e){e.addEventListener("contextmenu",this.handlers.contextmenu),e.addEventListener("pointerdown",this.handlers.pointerdown),e.addEventListener("pointerup",this.handlers.pointerup),e.addEventListener("pointercancel",this.handlers.pointercancel),e.addEventListener("pointerleave",this.handlers.pointerleave)}deregister(e){e.removeEventListener("contextmenu",this.handlers.contextmenu),e.removeEventListener("pointerdown",this.handlers.pointerdown),e.removeEventListener("pointerup",this.handlers.pointerup),e.removeEventListener("pointercancel",this.handlers.pointercancel),e.removeEventListener("pointerleave",this.handlers.pointerleave)}on(e,t){this.events.on(e,t)}handleContextMenu(e){this.release()}handlePointerDown(e){if(0!==e.button||!this.config.allowGesture(e))return void this.release();const t=this.getStat(e);"tap"===this.getContinuation(this.last.tapup,t)?this.tapCount++:this.tapCount=1;const s=this.tapCount;this.clearHold(),this.holdTimeout=setTimeout(()=>{this.events.emit("gesture",{type:"hold",event:e,position:t.positionRel,tapCount:s})},this.config.holdMinDelay),this.emitTap("tapdown",e,t)}handlePointerUp(e){if(0!==e.button||!this.config.allowGesture(e))return;const t=this.getStat(e);this.clearHold();const s=this.getContinuation(this.last.tapdown,t);if("tap"===s)this.emitTap("tapup",e,t);else if(1===this.tapCount&&"swipe"===s){const s=this.last.tapdown,i=t,n=Math.atan2(s.positionPx.y-i.positionPx.y,i.positionPx.x-s.positionPx.x),r=Math.abs(n/Math.PI*180);let a;a=r<45?"east":r<135?n>0?"north":"south":"west",this.events.emit("gesture",{type:"swipe",event:e,begin:s.positionRel,end:i.positionRel,angle:n,direction:a}),this.reset()}else this.release()}handlePointerCancel(e){this.release()}handlePointerLeave(e){const{tapdown:t,tapup:s}=this.last;(null===t||null!==s&&t.date>s.date)&&this.release()}emitTap(e,t,s){this.events.emit("gesture",{type:e,event:t,position:s.positionRel,tapCount:this.tapCount}),this.last[e]=s}release(){const e=this.isActive;this.reset(),e&&this.events.emit("release")}reset(){this.tapCount=0,this.clearHold(),this.last={tapdown:null,tapup:null}}get isActive(){return 0!==this.tapCount||null!==this.last.tapdown||null!==this.last.tapup}getStat(e){const t=e.target.getBoundingClientRect(),s={x:e.clientX,y:e.clientY},i={x:e.screenX||s.x,y:e.screenY||s.y},n={x:(s.x-t.left)/t.width,y:(s.y-t.top)/t.height};return{date:new Date,positionClientPx:s,positionPx:i,positionRel:n}}getContinuation(e,t){if(null===e)return"tap";if(t.date.valueOf()-e.date.valueOf()>this.config.tapMaxDelay)return"cancel";const s=(t.positionPx.x-e.positionPx.x)**2+(t.positionPx.y-e.positionPx.y)**2;return s<=this.config.tapMaxDistance**2?"tap":s>=this.config.swipeMinDistance**2?"swipe":"cancel"}clearHold(){null!==this.holdTimeout&&(clearTimeout(this.holdTimeout),this.holdTimeout=null)}}class z{constructor(e,t,s,i){this.constants={minBottomControlsReadyState:2},this.env=e,this.eventMgr_=t,this.player=s,this.media=i,this.mediaProperties={poster:null,chapters:null,fps:null,variantGroups:null},this.lastReadyState=0,this.playerProperties={mode:"audio",locale:"",state:"poster",error:null,controlElements:[],actions:{},playerView:null},this.overflowMenuButtons=[],this.shakaBottomControls=null,this.shakaBottomControlElements=[],this.seekBar_=null,this.$container=r("div",{className:"dlf-media-player dlf-shaka"},[this.$videoBox=r("div",{className:"dlf-media-shaka-box"},[this.$video=i,this.$poster=r("img",{className:"dlf-media-poster dlf-visible",$error:()=>{this.hidePoster()}})]),this.$errorBox=r("div",{className:"dlf-media-shaka-box dlf-media-error"})]),this.ui=new(n().ui.Overlay)(this.player,this.$videoBox,this.media),this.controls=this.ui.getControls(),this.configureTimeout=null,this.isConfigured=!1,this.gestures_=new G({allowGesture:this.allowGesture.bind(this)}),this.handlers={onControlsErrorEvent:this.onControlsErrorEvent.bind(this),onPlay:this.onPlay.bind(this),onTimeUpdate:this.onTimeUpdate.bind(this),afterManualSeek:this.afterManualSeek.bind(this)},this.registerEventHandlers(),this.scheduleConfigure()}destroy(){this.controls.destroy(),this.gestures_.deregister(this.$videoBox)}registerEventHandlers(){this.controls.addEventListener("error",this.handlers.onControlsErrorEvent),this.controls.addEventListener("dlf-media-seek-bar",e=>{const t=e.detail;this.seekBar_=t.seekBar,this.autosetSeekMode()}),this.controls.addEventListener("dlf-media-manual-seek",this.handlers.afterManualSeek),this.controls.addEventListener("timeandseekrangeupdated",this.handlers.onTimeUpdate),this.media.addEventListener("play",this.handlers.onPlay),this.gestures_.register(this.$videoBox)}get domElement(){return this.$container}get seekBar(){return this.seekBar_}get gestures(){return this.gestures_}updateMediaProperties(e){Object.assign(this.mediaProperties,e),this.notifyMediaProperties(this.mediaProperties,e)}notifyMediaProperties(e=this.mediaProperties,t=e){void 0!==t.poster&&this.renderPoster();const s=new CustomEvent("dlf-media-properties",{detail:{updateProps:t,fullProps:e}});this.controls.dispatchEvent(s)}updatePlayerProperties(e){const t=void 0!==e.mode&&(!this.isConfigured||e.mode!==this.playerProperties.mode)||void 0!==e.controlElements&&(!this.isConfigured||e.controlElements!==this.playerProperties.controlElements);for(const[t,s]of Object.entries(e))void 0!==s&&(this.playerProperties[t]=s);void 0!==e.locale&&this.controls.getLocalization()?.changeLocale([e.locale]),void 0!==e.state&&this.renderPoster(),void 0!==e.error&&this.renderError(),t&&this.scheduleConfigure()}handleEscape(){return this.seekBar?.isThumbnailPreviewOpen()?(this.seekBar?.endSeek(),!0):!!this.controls.anySettingsMenusAreOpen()&&(this.controls.hideSettingsMenus(),!0)}afterManualSeek(){this.hidePoster()}alwaysPrependBottomControl(e){this.prependBottomControl(e),this.shakaBottomControlElements.push(e)}prependBottomControl(e){if("video"===this.playerProperties.mode)this.shakaBottomControls?.prepend(e);else{const t=this.$container.parentElement;null!==t&&null!==t.parentElement&&t.parentElement.insertBefore(e,t)}}addOverflowButton(...e){this.overflowMenuButtons.push(...e),this.scheduleConfigure()}scheduleConfigure(){null===this.configureTimeout&&(this.configureTimeout=setTimeout(()=>{this.configureTimeout=null,this.configure()}))}configure(){if(S.register(),this.$container.setAttribute("data-mode",this.playerProperties.mode),this.playerProperties.playerView?.setAttribute("data-mode",this.playerProperties.mode),this.ui.configure(this.getShakaConfiguration()),this.isConfigured=!0,this.autosetSeekMode(),this.$videoBox.dispatchEvent(new MouseEvent("mousemove")),this.shakaBottomControls=this.$videoBox.querySelector(".shaka-bottom-controls"),null!==this.shakaBottomControls)for(const e of this.shakaBottomControlElements)this.prependBottomControl(e);this.notifyMediaProperties()}autosetSeekMode(){const e="audio"===this.playerProperties.mode?"narrow":"wide";this.seekBar_?.thumbnailPreview?.setSeekMode(e)}getShakaConfiguration(){const e=this.playerProperties.mode,t=this.playerProperties.controlElements,s=getComputedStyle(this.$container);return{addSeekBar:!0,enableTooltips:!0,controlPanelElements:["play_pause",E.register(this.env),"spacer",...t.map(this.makeControlElement.bind(this)),"overflow_menu"],overflowMenuButtons:["language",A.register(this.env),x.register(this.env),"loop","quality","picture_in_picture","captions",...this.overflowMenuButtons],addBigPlayButton:"video"===e,fadeDelay:"audio"===e?1e8:void 0,volumeBarColors:{base:s.getPropertyValue("--volume-base-color")||"rgba(255, 255, 255, 0.54)",level:s.getPropertyValue("--volume-level-color")||"rgb(255, 255, 255)"},enableKeyboardPlaybackControls:!1,doubleClickForFullscreen:!1,singleClickForPlayAndPause:!1,seekOnTaps:!1}}makeControlElement(e){const t=this.playerProperties.actions,s=e.getAttribute("data-type");if(null===s){const s=e.getAttribute("data-action")??"";return y.register(this.env,{element:e,onClickAction:O({isAvailable:()=>t[s]?.isAvailable()??!1,execute:()=>{t[s]?.execute()}})})}return"fullscreen"===s?P.register(this.env,{onClickAction:t["fullscreen.toggle"]}):s}hideBigPlayButton(){const e=document.querySelector(".shaka-controls-container .shaka-play-button");e&&e.classList.add("dlf-hide-big-play-button")}hidePoster(){this.$poster.classList.remove("dlf-visible")}renderPoster(){const e=null!==this.mediaProperties.poster&&"poster"===this.playerProperties.state;e&&(this.$poster.src=this.mediaProperties.poster),g(this.$poster,"dlf-visible",e)}renderError(){null===this.playerProperties.error?g(this.$errorBox,"dlf-visible",!1):(g(this.$errorBox,"dlf-visible",!0),this.$errorBox.textContent=this.env.t(this.playerProperties.error))}allowGesture(e){const t=this.$videoBox.getBoundingClientRect(),s=this.shakaBottomControls?.getBoundingClientRect().height??0,i=t.bottom-s-20;return!(e.clientY>=i)&&e.target===this.$videoBox.querySelector(".shaka-play-button-container")}onControlsErrorEvent(e){if(e instanceof CustomEvent){const t=e.detail;console.error("Error from Shaka controls",t.code,t)}}onPlay(){this.hidePoster(),this.hideBigPlayButton()}onTimeUpdate(){const e=this.media.readyState;e!==this.lastReadyState&&this.updateBottomControlsVisibility(e)}updateBottomControlsVisibility(e){0===e?this.shakaBottomControls?.classList.remove("dlf-visible"):e>=this.constants.minBottomControlsReadyState&&this.shakaBottomControls?.classList.add("dlf-visible")}}class j{constructor(e,t){this.player=e,this.track=t}get bandwidth(){return this.track.bandwidth}async getThumb(e){const t=await this.player.getThumbnails(this.track.id,e);return null===t?null:{track:this,...t,imageTime:t.startTime+t.duration/2-1e-5,bandwidth:this.track.bandwidth}}}class H{constructor(e){if(this.player=e,this.manifest=e.getManifest(),this.groupKeys=[],this.groups=[],this.keyToGroup={},null!==this.manifest)for(const e of this.manifest.variants)this.addVariant(e);else console.warn("Manifest not available")}static splitRepresentationId(e){const t=(e??"").split("#");return{id:t[0]??null,group:t[1]??"Standard"}}addVariant(e){const t=e.video;if(t){const s=H.splitRepresentationId(t.originalId).group,i=this.getGroupOrCreate(s);i.variants.push(e);for(const e of t.roles)i.roles.add(e);t.primary&&(i.hasPrimary=!0)}}get numGroups(){return this.groupKeys.length}getGroupOrCreate(e){let t=this.keyToGroup[e];return t||(t=this.keyToGroup[e]={key:e,variants:[],roles:new Set,hasPrimary:!1},this.groupKeys.push(e),this.groups.push(t)),t}findActiveTrack(){return this.player.getVariantTracks().find(e=>e.active)}findThumbnailTracks(){const e=[],t=this.findActiveGroup()?.key;for(const s of this.player.getImageTracks())H.splitRepresentationId(s.originalImageId).group===t&&e.push(new j(this.player,s));return e}findActiveGroup(){const e=this.findActiveTrack();if(e){const t=H.splitRepresentationId(e.originalVideoId).group;return this.keyToGroup[t]}}selectGroup(e){if(this.manifest){if(this.manifest.variants!==e.variants){const t=this.findActiveTrack();this.manifest.variants=e.variants,this.player.selectAudioLanguage(t?.language??"und")}}else console.warn("Cannot select group: Manifest not available")}trySelectGroup(e){return!!e&&(this.selectGroup(e),!0)}selectGroupByKey(e){return this.trySelectGroup(this.keyToGroup[e])}selectGroupByIndex(e){return this.trySelectGroup(this.groups[e])}selectGroupByRole(e){return this.trySelectGroup(this.groups.find(t=>t.roles.has(e)))}selectGroupWithPrimary(){return this.trySelectGroup(this.groups.find(e=>e.hasPrimary))}*[Symbol.iterator](){for(const e in this.keyToGroup)yield this.keyToGroup[e]}}var W=function(e){if(this===window)return new W(e);this.obj=e||{},this.frameRate=this.obj.frameRate||24,this.video=document.getElementById(this.obj.id)||document.getElementsByTagName("video")[0]};W.prototype={get:function(){return Math.floor(this.video.currentTime.toFixed(5)*this.frameRate)},listen:function(e,t){var s=this;e?this.interval=setInterval(function(){if(!s.video.paused&&!s.video.ended){var t="SMPTE"===e?s.toSMPTE():"time"===e?s.toTime():s.get();return s.obj.callback&&s.obj.callback(t,e),t}},t||1e3/s.frameRate/2):console.log("VideoFrame: Error - The listen method requires the format parameter.")},stopListen:function(){clearInterval(this.interval)},fps:{film:24,NTSC:29.97,NTSC_Film:23.98,NTSC_HD:59.94,PAL:25,PAL_HD:50,web:30,high:60}},W.prototype.toTime=function(e){var t="number"!=typeof e?this.video.currentTime:e,s=this.frameRate,i=new Date,n="hh:mm:ss"+("number"==typeof e?":ff":"");function r(e){return e<10?"0"+e:e}return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(1e3*t),n.replace(/hh|mm|ss|ff/g,function(e){switch(e){case"hh":return r(i.getHours()<13?i.getHours():i.getHours()-12);case"mm":return r(i.getMinutes());case"ss":return r(i.getSeconds());case"ff":return r(Math.floor(t%1*s))}})},W.prototype.toSMPTE=function(e){if(!e)return this.toTime(this.video.currentTime);var t=Number(e),s=this.frameRate;function i(e){return e<10?"0"+e:e}var n=60*s,r=(t/(60*s*60)).toFixed(0),a=Number((t/n).toString().split(".")[0])%60,o=Number((t/s).toString().split(".")[0])%60;return i(r)+":"+i(a)+":"+i(o)+":"+i(t%s)},W.prototype.toSeconds=function(e){if(!e)return Math.floor(this.video.currentTime);var t=e.split(":");return 60*Number(t[0])*60+60*Number(t[1])+Number(t[2])},W.prototype.toMilliseconds=function(e){var t=Number(e?e.split(":")[3]:this.toSMPTE().split(":")[3]),s=1e3/this.frameRate*(isNaN(t)?0:t);return Math.floor(1e3*this.toSeconds(e)+s)},W.prototype.toFrames=function(e){var t=e?e.split(":"):this.toSMPTE().split(":"),s=this.frameRate,i=60*Number(t[0])*60*s,n=60*Number(t[1])*s,r=Number(t[2])*s,a=Number(t[3]);return Math.floor(i+n+r+a)},W.prototype.__seek=function(e,t){this.video.paused||this.video.pause();var s=Number(this.get());this.video.currentTime=("backward"===e?s-t:s+t)/this.frameRate+1e-5},W.prototype.seekForward=function(e,t){return e||(e=1),this.__seek("forward",Number(e)),!t||t()},W.prototype.seekBackward=function(e,t){return e||(e=1),this.__seek("backward",Number(e)),!t||t()},W.prototype.seekTo=function(e){var t,s,i=e||{},n=Object.keys(i)[0];if("SMPTE"==n||"time"==n)return s=i[n],t=this.toMilliseconds(s)/1e3+.001,void(this.video.currentTime=t);switch(n){case"frame":s=this.toSMPTE(i[n]),t=this.toMilliseconds(s)/1e3+.001;break;case"seconds":t=Number(i[n]);break;case"milliseconds":t=Number(i[n])/1e3+.001}isNaN(t)||(this.video.currentTime=t)};const K=W;class X extends HTMLElement{static hasInstalledPolyfills=!1;constructor(){super(),X.hasInstalledPolyfills||(n().polyfill.installAll(),X.hasInstalledPolyfills=!0),this.config=null,this.env=new L,this.eventMgr_=new N,this.constants=this.constantDefaults(),this.dlf={handlers:{onDomContentLoaded:this.onDomContentLoaded.bind(this),onPlayerErrorEvent:this.onPlayerErrorEvent.bind(this),onTrackChange:this.onTrackChange.bind(this),onTick:this.onTick.bind(this),onPlay:this.onPlay.bind(this)}},this.video=r("video",{id:this.env.mkid(),className:"dlf-media"}),this.videoPausedOn=null,this.currentSource=null,this.timeRange=null,this.player=new(n().Player),this.player.attach(this.video),this.fps=null,this.variantGroups=null,this.chapters_=new B([]),this.currentChapter=null,this.markers_=new F,this.frontend=new z(this.env,this.eventMgr_,this.player,this.video),this.playerView=null,this.autoplay_=!1,this.mode="auto",this.hasBeenConnected_=!1,this.__dlfRegisterEvents(),this.actions=this.getActions()}getEnv(){return this.env}getMarkers(){return this.markers_}connectedCallback(){if(this.hasBeenConnected_)return;this.hasBeenConnected_=!0;const e=this.getConfig();this.env.setLang(e.lang);const t=this.getAttribute("autoplay");this.autoplay_=null!==t&&"false"!==t,this.timeRange=this.getTimeRange(),null!==this.timeRange&&this.markers_.add({id:"dlf.segment_shared",startTime:this.timeRange.startTime,endTime:this.timeRange.endTime??void 0,labelText:this.env.t("share.shared_timecode"),editable:!1});const s=this.getAttribute("player-view");null!==s&&(this.playerView=document.getElementById(s)),this.configureFrontend(e),setTimeout(()=>{this.loadSources(),this.parseChapters()}),this.appendChild(this.frontend.domElement),this.frontend.domElement.className+=` ${this.className}`}destroy(){this.eventMgr_.removeAll(),this.player.destroy(),this.frontend.destroy(),this.remove()}configureFrontend(e){const t=Array.from(this.querySelectorAll("dlf-media-controls *")).filter(e=>e instanceof HTMLElement),s=this.getAttribute("mode");let i;if("auto"===s){const e=this.getAttribute("mode-fallback");D(e)&&(i=e),this.mode=s}else D(s)&&(this.mode=i=s);this.frontend.updatePlayerProperties({locale:e.lang.twoLetterIsoCode,mode:i,controlElements:t,actions:this.actions,playerView:this.playerView});const n=this.getAttribute("poster");null!==n&&this.frontend.updateMediaProperties({poster:n})}getConfig(){let e=this.config;if(null===e){const t=this.getAttribute("config");e=t?window[t]:{lang:{locale:"en_US.UTF8",twoLetterIsoCode:"en",phrases:{}}},this.config=e}return e}constantDefaults(){return{prevChapterTolerance:5,volumeStep:.05,seekStep:5,trickPlayFactor:4,forceLandscapeOnFullscreen:!0}}getActions(){return{"fullscreen.toggle":O({isAvailable:()=>Boolean(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled),execute:()=>{this.frontend.seekBar?.endSeek(),this.toggleFullScreen()}}),"playback.toggle":O(()=>{this.video.paused?this.video.play():this.video.pause()}),"playback.volume.mute.toggle":O(()=>{this.video.muted=!this.video.muted}),"playback.volume.inc":O(()=>{this.volume=this.volume+this.constants.volumeStep}),"playback.volume.dec":O(()=>{this.volume=this.volume-this.constants.volumeStep}),"playback.captions.toggle":O({isAvailable:()=>this.player.getTextTracks().length>0,execute:()=>{this.showCaptions=!this.showCaptions}}),"navigate.rewind":O(()=>{this.skipSeconds(-this.constants.seekStep)}),"navigate.seek":O(()=>{this.skipSeconds(+this.constants.seekStep)}),"navigate.continuous-rewind":O(()=>{this.ensureTrickPlay(-this.constants.trickPlayFactor)}),"navigate.continuous-seek":O(()=>{this.ensureTrickPlay(this.constants.trickPlayFactor)}),"navigate.chapter.prev":O(()=>{this.prevChapter()}),"navigate.chapter.next":O(()=>{this.nextChapter()}),"navigate.frame.prev":O({isAvailable:()=>null!==this.fps,execute:()=>{this.fps?.vifa.seekBackward(1),this.frontend.afterManualSeek()}}),"navigate.frame.next":O({isAvailable:()=>null!==this.fps,execute:()=>{this.fps?.vifa.seekForward(1),this.frontend.afterManualSeek()}}),"navigate.position.percental":O((e,t)=>{if(void 0!==e&&void 0!==t&&0<=t&&tnull!==this.variantGroups&&this.variantGroups.findThumbnailTracks().length>0,execute:(e,t,s)=>{this.frontend.seekBar?.setThumbnailSnap("down"===s)}}),"sound_tools.mode.audio":O({execute:()=>{this.ui.updatePlayerProperties({mode:"audio"})}}),"sound_tools.mode.video":O({isAvailable:()=>!this.player.isAudioOnly(),execute:()=>{this.ui.updatePlayerProperties({mode:"video"})}}),"sound_tools.segments.add":O({execute:()=>{this.markers_.add({startTime:this.displayTime})}}),"sound_tools.segments.close":O({execute:()=>{const e=this.markers_.activeSegment,t=this.displayTime;null!==e&&e.startTime=0))return null;let i=t?parseFloat(t):null;return null===i||i>=s||(i=null),{startTime:s,endTime:i}}__dlfRegisterEvents(){this.eventMgr_.record(()=>{window.addEventListener("DOMContentLoaded",this.dlf.handlers.onDomContentLoaded),this.player.addEventListener("error",this.dlf.handlers.onPlayerErrorEvent),this.player.addEventListener("adaptation",this.dlf.handlers.onTrackChange),this.player.addEventListener("variantchanged",this.dlf.handlers.onTrackChange),this.video.addEventListener("play",this.dlf.handlers.onPlay)}),this.tickInterval=setInterval(this.dlf.handlers.onTick,50),this.registerGestures()}registerGestures(){const e=this.frontend.gestures;null!==e&&(e.on("gesture",e=>{switch(e.type){case"tapup":"mouse"===e.event.pointerType?(e.tapCount<=2&&this.actions["playback.toggle"].execute(),2===e.tapCount&&this.actions["fullscreen.toggle"].execute()):e.tapCount>=2&&(e.position.x<1/3?this.actions["navigate.rewind"].execute():e.position.x>2/3?this.actions["navigate.seek"].execute():2!==e.tapCount||this.env.isInFullScreen()||this.actions["fullscreen.toggle"].execute());break;case"hold":1===e.tapCount?this.frontend.seekBar?.thumbnailPreview?.beginChange(e.event.clientX):e.tapCount>=2&&(e.position.x<1/3?this.actions["navigate.continuous-rewind"].execute():e.position.x>2/3&&this.actions["navigate.continuous-seek"].execute());break;case"swipe":"east"===e.direction?this.actions["navigate.rewind"].execute():"west"===e.direction&&this.actions["navigate.seek"].execute()}}),e.on("release",()=>{this.frontend.seekBar?.endSeek(),this.cancelTrickPlay()}))}get ui(){return this.frontend}supportsMimeType(e){switch(e){case"application/dash+xml":case"application/x-mpegurl":case"application/vnd.apple.mpegurl":return this.env.supportsMediaSource()||this.env.supportsVideoMime(e);default:return this.env.supportsVideoMime(e)}}loadSources(){const e=[];this.querySelectorAll("source").forEach(t=>{const s=t.getAttribute("src"),i=t.getAttribute("type");if(!s||!i)return void console.warn("Ignoring that does not specify URL or MIME type");let n=null;const r=t.getAttribute("data-fps");if(null!==r){const e=parseFloat(r);e>0&&(n=e)}const a=t.getAttribute("data-fileid");e.push({url:s,mimeType:i,frameRate:n,fileId:a})}),this.loadOneOf(e)}async loadOneOf(e){if(0===e.length)return this.frontend.updatePlayerProperties({error:"error.no-media-source"}),!1;let t=!1;for(const s of e)if(this.supportsMimeType(s.mimeType))try{return await this.loadManifest(s),this.frontend.updatePlayerProperties({error:null,mode:"auto"===this.mode?this.player.isAudioOnly()?"audio":"video":void 0}),this.loaded(),!0}catch(e){console.error(e)}else t=!0;return this.frontend.updatePlayerProperties({error:t?"error.playback-not-supported":"error.load-failed"}),!1}async loadManifest(e){const t=this.timeRange?.startTime??null;await this.player.load(e.url,t,e.mimeType),this.currentSource=e,this.variantGroups=new H(this.player),this.variantGroups.selectGroupWithPrimary()||this.variantGroups.selectGroupByRole("main")||this.variantGroups.selectGroupByIndex(0),this.frontend.updateMediaProperties({variantGroups:this.variantGroups,chapters:this.chaptersInFile}),this.updateFrameRate()}onDomContentLoaded(){}onTick(){const e=this.chaptersInFile.timeToChapter(this.video.currentTime)??null;if(e!==this.currentChapter){const t=this.currentChapter;this.currentChapter=e;const s=new CustomEvent("chapterchange",{detail:{curChapter:e,prevChapter:t}});this.dispatchEvent(s)}}onTrackChange(){this.updateFrameRate()}updateFrameRate(){const e=this.variantGroups?.findActiveTrack()?.frameRate??this.currentSource?.frameRate??null;null===e?this.fps=null:null!==this.fps&&e===this.fps.rate||(this.fps={rate:e,vifa:new K({id:this.video.id,frameRate:e})}),this.frontend.updateMediaProperties({fps:this.fps})}onPlay(){this.videoPausedOn=null}async toggleFullScreen(){this.env.toggleFullScreen(this.playerView??this.ui.domElement,this.constants.forceLandscapeOnFullscreen)}parseChapters(){const e=[];this.querySelectorAll("dlf-chapter").forEach(t=>{const s=t.getAttribute("title"),i=Number(t.getAttribute("timecode"));if(!(s&&i>=0))return void console.warn("Ignoring invalid ");let n=[];const r=t.getAttribute("fileids");null!==r&&(n=r.split(","));let a=null;const o=t.getAttribute("pageNo");null!==o&&(a=parseInt(o,10)),e.push({title:s,timecode:i,fileIds:n,pageNo:a})}),this.setChapters(new B(e))}get chapters(){return this.chapters_}get chaptersInFile(){return this.chapters_.filter(e=>this.isChapterInFile(e))}isChapterInFile(e){return null===this.currentSource||null===this.currentSource.fileId||e.fileIds.includes(this.currentSource.fileId)}setChapters(e){this.chapters_=e,this.frontend.updateMediaProperties({chapters:this.chaptersInFile})}loaded(){this.autoplay_&&this.video.play()}get hasVideo(){return null!==this.currentSource}getCurrentChapter(){return this.timeToChapter(this.video.currentTime)}timeToChapter(e){return this.chaptersInFile.timeToChapter(e)}get media(){return this.video}get hasCurrentData(){return this.video.readyState>=2}get showCaptions(){return this.player.isTextTrackVisible()}set showCaptions(e){this.player.setTextTrackVisibility(e)}isAudioOnly(){return this.player.isAudioOnly()}get volume(){return this.video.volume}set volume(e){this.video.volume=a(e,[0,1])}get displayTime(){return this.frontend.seekBar?.getValue()??this.video.currentTime}pauseOn(e){null!==this.videoPausedOn||this.video.paused||(this.videoPausedOn=e,this.video.pause())}resumeOn(e){this.videoPausedOn===e&&this.video.play()}getFps(){return this.fps?.rate??null}seekTo(e){return"number"==typeof e?(this.seekToTime(e),!0):"number"==typeof e.timecode&&this.seekToChapter(e)}seekToTime(e){this.video.currentTime=e,this.frontend.afterManualSeek()}seekToChapter(e){return!!this.isChapterInFile(e)&&(this.seekToTime(e.timecode),!0)}skipSeconds(e){this.seekTo(this.video.currentTime+e)}prevChapter(){const e=this.constants.prevChapterTolerance,t=this.timeToChapter(this.video.currentTime-e);this.seekTo(t??0)}nextChapter(){const e=this.getCurrentChapter();if(e){const t=this.chaptersInFile.advance(e,1);t&&this.seekTo(t)}}ensureTrickPlay(e){this.player.getPlaybackRate()!==e&&this.player.trickPlay(e)}cancelTrickPlay(){try{return this.player.cancelTrickPlay(),!0}catch(e){return!1}}onPlayerErrorEvent(e){if(e instanceof CustomEvent){const t=e.detail;console.error("Error from Shaka player",t.code,t)}}}customElements.define("dlf-media",X);class Y extends HTMLElement{constructor(){super(),this.env=new L,this.player=null,this.hasAttached=!1}get forPlayer(){return this.getAttribute("forPlayer")}set forPlayer(e){null===e?this.removeAttribute("forPlayer"):this.setAttribute("forPlayer",e)}connectedCallback(){this.isConnected&&(this.hasAttached||(setTimeout(()=>{const e=this.forPlayer;if(null===e)return;const t=document.getElementById(e);t instanceof X&&(this.env=t.getEnv(),this.player=t,this.attachToPlayer(t))}),this.hasAttached=!0))}attachToPlayer(e){}}var Q=s(8228),Z=s(317);customElements.define("dlf-waveform",class extends Y{static get observedAttributes(){return["hidden"]}constructor(){super();const e=this.attachShadow({mode:"open"});this.$style=r("style",{},["\n .container {\n position: relative;\n display: block;\n height: 100px;\n }\n\n .wave-overview {\n position: absolute;\n bottom: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.3);\n }\n "]),this.$container=r("div",{className:"container"},[this.$waveOverview=r("div",{className:"wave-overview"})]),e.append(this.$style,this.$container),this.nextUrl=null,this.peaks_=null,this.waveformdata=null,this.minSamplesPerPixel=0,this.maxSamplesPerPixel=Number.POSITIVE_INFINITY,this.samplesPerPixel=0,this.zoomview=null,this.handlers={onWheel:this.onWheel.bind(this),onResize:this.onResize.bind(this)},this.peaksHandlers={"points.dragend":e=>{null!==this.player&&void 0!==e.point.id&&this.player.getMarkers().update({id:e.point.id,startTime:e.point.time,labelText:e.point.labelText,color:e.point.color},!0)},"segments.dragend":e=>{null!==this.player&&void 0!==e.segment.id&&this.player.getMarkers().update({id:e.segment.id,startTime:e.segment.startTime,endTime:e.segment.endTime,labelText:e.segment.labelText,color:"string"==typeof e.segment.color?e.segment.color:void 0},!0)}},this.markersHandlers={remove:e=>{for(const t of e.detail.segments)null!==this.peaks_&&(void 0===t.endTime?this.peaks_.points.removeById(t.id):this.peaks_.segments.removeById(t.id))},remove_all:()=>{null!==this.peaks_&&(this.peaks_.points.removeAll(),this.peaks_.segments.removeAll())},add:e=>{this.peaksAddSegments(e.detail.segments)},update:e=>{const{segment:t,prevSegment:s}=e.detail;null!==this.peaks_&&(void 0===s.endTime&&void 0!==t.endTime?(this.peaks_.points.removeById(t.id),this.peaks_.segments.add({id:t.id,startTime:t.startTime,endTime:t.endTime,labelText:t.labelText,color:t.color,editable:t.editable})):void 0===t.endTime?this.peaks_.points.getPoint(t.id)?.update({time:t.startTime,editable:t.editable,labelText:t.labelText}):this.peaks_.segments.getSegment(t.id)?.update({startTime:t.startTime,endTime:t.endTime,editable:t.editable,labelText:t.labelText}))}},this.registerEventHandlers()}attributeChangedCallback(e,t,s){"hidden"===e&&(this.hidden||this.tryInitPeaks())}registerEventHandlers(){this.$waveOverview.addEventListener("wheel",this.handlers.onWheel),"ResizeObserver"in globalThis?new ResizeObserver(this.handlers.onResize).observe(this.$container):window.addEventListener("resize",this.handlers.onResize)}async attachToPlayer(e){const t=this.getAttribute("src"),s=this.getAttribute("type");t&&"application/vnd.kitodo.audiowaveform"===s&&(e.addActions({"sound_tools.waveform.toggle":O({execute:()=>{this.hidden=!this.hidden}})}),this.adaptPeaksMarkers(),e.ui instanceof z&&e.ui.alwaysPrependBottomControl(this),e.media.addEventListener("loadedmetadata",e=>{this.updateZoom(this.maxSamplesPerPixel)}),this.load(t))}async load(e){this.nextUrl=e;const t=await fetch(e),s=await t.arrayBuffer();e===this.nextUrl&&(this.waveformdata=Z.A.create(s),this.updateZoom(this.maxSamplesPerPixel),this.tryInitPeaks())}tryInitPeaks(){const e=this.waveformdata;if(null!==this.peaks_||this.hidden||null==this.player?.media||null===e)return;const t={logger:(...e)=>{console.log(...e)},mediaElement:this.player.media,zoomview:{container:this.$waveOverview},waveformData:{arraybuffer:e.toArrayBuffer()},waveformCache:!0};Q.A.init(t,(t,s)=>{s?(s.player.seek=e=>{this.player?.seekTo(e)},this.peaks_=s,this.zoomview=s.views.getView("zoomview"),this.zoomview?.setZoom({seconds:e.duration}),this.zoomview?.setWheelMode("scroll"),this.adaptPeaksMarkers()):console.log(t)})}adaptPeaksMarkers(){if(null!==this.peaks_&&null!==this.player){this.peaksAddSegments(this.player.getMarkers().getSegments());for(const[e,t]of Object.entries(this.peaksHandlers))this.peaks_.on(e,t);for(const[e,t]of Object.entries(this.markersHandlers))this.player.getMarkers().addEventListener(e,t)}}peaksAddSegments(e){if(null!==this.peaks_)for(const t of e)void 0===t.endTime?this.peaks_.points.add({id:t.id,time:t.startTime,labelText:t.labelText,color:t.color,editable:t.editable}):this.peaks_.segments.add({id:t.id,startTime:t.startTime,endTime:t.endTime,labelText:t.labelText,color:t.color,editable:t.editable})}onWheel(e){const t=1.5**(-e.deltaY/100);this.updateZoom(this.samplesPerPixel/t)}onResize(){this.zoomview?.fitToContainer(),this.updateZoom()}updateZoom(e=this.samplesPerPixel){if(null===this.waveformdata)return;const{sample_rate:t,seconds_per_pixel:s,duration:i}=this.waveformdata;this.minSamplesPerPixel=s*t,this.maxSamplesPerPixel=a(i*t/this.$waveOverview.offsetWidth,[this.minSamplesPerPixel,Number.POSITIVE_INFINITY]),this.samplesPerPixel=a(e,[this.minSamplesPerPixel,this.maxSamplesPerPixel]),null!==this.zoomview&&this.zoomview.setZoom({scale:this.samplesPerPixel})}}),window.DlfMediaPlayer=X;var J=s(7583);const ee=jQuery;var te=s.n(ee);class se extends(U()){constructor(e){super(),this.state=e,this.pendingStateUpdates=[],this.renderTimeout=null,this.renderPromise=Promise.resolve()}setState(e={}){const t="function"==typeof e?e:()=>e;this.pendingStateUpdates.push(t),this.renderTimeout||(this.renderPromise=new Promise(e=>{this.renderTimeout=setTimeout(()=>{const t=this.squashStateUpdates();this.render(t),this.state=t,this.renderTimeout=null,this.renderPromise=Promise.resolve(),this.emit("updated",t),e()})}))}update(){return this.renderPromise}squashStateUpdates(){const e=Object.assign({},this.state);for(const t of this.pendingStateUpdates)Object.assign(e,t(e));return this.pendingStateUpdates=[],e}render(e){}}class ie extends se{constructor(e,t){super({show:!1,...t}),this.parent=e,this.isAnimating=!1,this.$main=r("div",{className:"sxnd-modal"},[this.$headline=r("div",{className:"headline-container"},[this.$title=r("h3"),this.$close=r("span",{className:"modal-close material-icons-round",$click:this.close.bind(this)},["close"])]),this.$body=r("div",{className:"body-container"})]),this.parent.append(this.$main),this.jqMain=te()(this.$main),this.resize()}resize(){this.$body.style.maxHeight=`calc(${this.parent.clientHeight}px - 11rem)`}get isOpen(){return this.state.show}open(e=!0){this.isAnimating||this.setState({show:e})}close(){this.open(!1)}toggle(){this.open(!this.state.show)}render(e){const{show:t}=e;if(t!==this.state.show){this.isAnimating=!0;const e=t?"show":"hide";this.jqMain[e]({duration:"fast",complete:()=>{this.isAnimating=!1}})}}}function ne(e,t){return l(e,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t[0]??""])))}function re(e,t,s,i){const n=e.generateUrl(s),r={...t,host:[`${location.protocol}//${location.host}`],url:[n.toString()]};let a=0;"number"==typeof s?a=s:null!==s&&(a=s.startTime);const o=w(a,i);for(const[e,t]of Object.entries(o))r[e]=[t];return r}class ae{constructor(e){this.env=e}generateUrl(e){return"number"==typeof e?this.generateTimecodeUrl(e):this.generateTimerangeUrl(e)}generateTimerangeUrl(e){let t=[];null!==e&&(null!==e.endTime&&e.endTime>e.startTime&&t.unshift(e.endTime),(e.startTime>0||t.length>0)&&t.unshift(e.startTime));const s=this.env.getLocation();return t.length>0?s.searchParams.set("timecode",t.map(e=>e.toString()).join(",")):s.searchParams.delete("timecode"),s}generateTimecodeUrl(e){const t=null===e?null:{startTime:e,endTime:null};return this.generateTimerangeUrl(t)}}const oe=["current-time","marker","begin"];class le extends ie{constructor(e,t,s){super(e,{metadata:{},timing:{currentTime:0,markerRange:null},fps:0,startAtMode:"current-time",showQrCode:!1,showMastodonShare:!1}),this.lastRenderedUrl=null,this.handlers={handleClickShareButton:this.handleClickShareButton.bind(this),handleChangeStartAt:this.handleChangeStartAt.bind(this)},this.env=t,this.gen=new ae(this.env),this.$main.classList.add("bookmark-modal"),this.$title.innerText=this.env.t("modal.bookmark.title");const i=this.env.mkid(),n=(s.shareButtons??[]).map(e=>function(e,t,s){let i;switch(t.type){case"material":i=r("i",{className:"dlf-share-button material-icons-round"},[t.icon]);break;case"image":i=r("img",{className:"dlf-share-button dlf-share-button-image",src:t.src})}const n=r("a",{title:e.t(t.titleTranslationKey??"",{},()=>""),target:"_blank",rel:"noopener noreferrer",$click:s.onClick},[i]);return{hrefTemplate:t.hrefTemplate,setFullUrl:e=>{n.href=l(t.hrefTemplate,e)},element:n}}(this.env,e,{onClick:this.handlers.handleClickShareButton}));this.shareButtons=v(n),this.$startAtVariants={begin:this.makeStartAtVariant(i,"begin"),"current-time":this.makeStartAtVariant(i,"current-time"),marker:this.makeStartAtVariant(i,"marker")},this.$body.append(r("div",{},[this.shareButtons.length>0&&r("div",{className:"share-buttons"},this.shareButtons.map(e=>e.element)),this.$urlLine=r("div",{className:"url-line dlf-visible"},[this.$urlInput=r("input",{type:"url",readOnly:!0,value:location.href}),this.$copyLinkBtn=r("a",{href:"javascript:void(0)",target:"_blank",className:"copy-to-clipboard",title:this.env.t("modal.bookmark.copy-link"),$click:this.handleCopyToClipboard.bind(this)},[r("i",{className:"material-icons-round"},["content_copy"])])]),this.$mastodonShareDialog=r("div",{id:"mastodon-share",className:"mastodon-share-container"},[this.$headline=r("div",{className:"headline-container"},[this.$title=r("h4",{},[this.env.t("share.mastodon.title")]),this.$close=r("span",{className:"modal-close material-icons-round",$click:()=>{this.setState({showMastodonShare:!1})}},["close"])]),r("form",{method:"post",className:"mastodon-form",$submit:this.submitInstance.bind(this)},[this.$mastodonInstanceInput=r("input",{type:"text",name:"mastodon-instance",id:"instance",className:"mastodon-share-input",placeholder:this.env.t("share.mastodon.placeholder"),autocomplete:"url",required:!0,autocapitalize:"none",spellcheck:!1}),r("button",{type:"submit",id:"mastodon-share-button",className:"mastodon-share-button"},[this.env.t("share.mastodon.label")])])]),this.$startAt=r("div",{className:"start-at"},oe.map(e=>this.$startAtVariants[e].$container)),this.$qrCanvasContainer=r("div",{className:"url-qrcode"},[r("hr"),this.$qrCanvas=r("canvas")])]))}makeStartAtVariant(e,t){const s=this.env.mkid(),i=r("input",{type:"radio",name:e,value:t,id:s,$change:this.handlers.handleChangeStartAt}),n=r("label",{htmlFor:s},[this.translateStartAtLabel(t,{currentTime:0,markerRange:null},null)]);return{id:s,$radio:i,$label:n,$container:r("div",{className:`start-at-${t}`},[i,n])}}handleClickShareButton(e){const t=e.currentTarget;"dlf:qr_code"===t.href&&(e.preventDefault(),this.setState({showQrCode:!0})),"dlf:mastodon_share"===t.href&&(e.preventDefault(),this.setState({showMastodonShare:!0}))}async handleCopyToClipboard(e){e.preventDefault();const t=this.generateUrl(this.state);this.$urlInput.focus(),navigator.clipboard?navigator.clipboard.writeText(t):document.execCommand("copy")}handleChangeStartAt(e){e.target instanceof HTMLInputElement&&this.setState({startAtMode:e.target.value})}generateUrl(e){const t=this.getActiveTimeRange(e);return this.gen.generateTimerangeUrl(t).toString()}getActiveTimeRange(e){switch(this.getStartAtMode(e)){case"begin":return null;case"current-time":return{startTime:e.timing.currentTime,endTime:null};case"marker":return e.timing.markerRange}}open(e=!0){super.open(e),e||this.setState({showQrCode:!1,showMastodonShare:!1})}render(e){super.render(e);const{show:t,metadata:s,timing:i,fps:n,showQrCode:r,showMastodonShare:a}=e,o=this.getStartAtMode(e),l=this.getActiveTimeRange(e),h=re(this.gen,s,l,n),d=h.url?.[0]??"",c=d!==this.lastRenderedUrl;if(c){const e={};for(const[t,s]of Object.entries(h))e[t]=encodeURIComponent(s[0]??"");for(const t of this.shareButtons)t.setFullUrl(e);this.$urlInput.value=d,this.$copyLinkBtn.href=d,this.lastRenderedUrl=d}(c||r!==this.state.showQrCode)&&this.renderQrCode(r?d:null),a!==this.state.showMastodonShare&&this.renderMastodonShare(a),this.$startAtVariants[o].$radio.checked=!0;let u=0;for(const t of oe){this.$startAtVariants[t].$label.innerText=this.translateStartAtLabel(t,i,n);const s=this.isStartAtModeAllowed(t,e);g(this.$startAtVariants[t].$container,"shown",s),s&&u++}g(this.$startAtVariants.begin.$container,"shown",u>1),t&&t!==this.state.show&&this.$urlInput.select()}translateStartAtLabel(e,t,s){const i={currentTime:T(t.currentTime,!0,s),markerStart:"?",markerEnd:"_"};return null!==t.markerRange&&(i.markerStart=T(t.markerRange.startTime,!0,s),null!==t.markerRange.endTime&&(i.markerEnd=T(t.markerRange.endTime,!0,s))),this.env.t(`modal.bookmark.start-at-${e}`,i)}getStartAtMode(e){return this.isStartAtModeAllowed(e.startAtMode,e)?e.startAtMode:"begin"}isStartAtModeAllowed(e,t){switch(e){case"begin":return!0;case"current-time":return 0!==t.timing.currentTime;case"marker":return null!==t.timing.markerRange}}async renderQrCode(e){if(null!==e)try{await J.toCanvas(this.$qrCanvas,e),this.$qrCanvasContainer.classList.add("dlf-visible")}catch(e){alert(this.env.t("error.qrcode")),console.error(e)}else this.$qrCanvasContainer.classList.remove("dlf-visible")}renderMastodonShare(e){this.$urlLine.classList.toggle("dlf-visible",!e),this.$urlLine.classList.toggle("dlf-fade-in",!e),this.$urlLine.classList.toggle("dlf-fade-out",e),this.$mastodonShareDialog.classList.toggle("dlf-visible",e),this.$mastodonShareDialog.classList.toggle("dlf-fade-in",e),this.$mastodonShareDialog.classList.toggle("dlf-fade-out",!e)}openShareUrl(e,t,s){if(this.isValidUrl(e))if(null!==t)try{const i=new URL("/share",e),n=new URLSearchParams;n.set("text",s+"\n\n"),n.set("url",t),i.search=n.toString(),window.open(i.toString(),"_blank")}catch(e){return alert(this.env.t("error.mastodon.open_link")),void console.error(e)}else alert(this.env.t("error.mastodon.invalid_link"));else alert(this.env.t("error.mastodon.invalid_server"))}submitInstance(e){e.preventDefault();let t=this.$mastodonInstanceInput.value.trim();if(!t)return void alert(this.env.t("error.mastodon.enter_url"));t=t.replace(/[^a-zA-Z0-9-:.\/]/g,"");let s=t.replace(/^http:\/\//i,"https://");s.startsWith("https://")||(s=`https://${s}`);const i=document.title.trim();this.openShareUrl(s,this.lastRenderedUrl,i)}isValidUrl(e){try{return new URL(e),!0}catch(e){return!1}}}const he={None:0,Ctrl:1,Shift:2,Alt:4,Meta:8};function de(e,t,s){let i=s;return 1===t.length&&(i&=~he.Shift,"mac"===e.getKeyboardVariant()&&(i&=~he.Alt)),i}function ce(e,t,s){" "===t&&(t="Space");const i=s?".mod":"";return e.t(`key.${t}${i}`,{},()=>e.t(`key.${t}`,{},()=>e.t(`key.generic${i}`,{key:t.toUpperCase()},()=>e.t("key.generic",{key:t.toUpperCase()}))))}function ue(e,t){const s=function(e){const t=[];let s=null;for(const i of e)null===s?s={begin:i,end:i}:i.charCodeAt(0)===s.end.charCodeAt(0)+1?s.end=i:(t.push(s),s={begin:i,end:i});return null!==s&&t.push(s),t}(t.keys),i=[],n=[];void 0!==t.mod&&n.push(t.mod),"Shift"!==t.mod&&t.keys.every(e=>/^[A-Z]$/.test(e))&&n.push("Shift");const a=n.length>0||s.length>1,o=e.t("key.unto"+(a?".mod":""));for(const t of s){const s=r("kbd",{},[ce(e,t.begin,a)]);if(t.begin===t.end)i.push(s);else{const n=r("kbd",{},[ce(e,t.end,a)]);i.push(r("span",{className:"kb-range"},[s,o,n]))}}let l=[];if(n.length>0){const t=e.getKeyboardVariant();for(const s of n){const i=r("kbd",{},[e.t(`key.mod.${t}.${s}`)]);l.push(i," + ")}l.push(...f(i,"/"))}else l=f(i," / ");return t.repeat&&(l=f(e.t("key.repeat",{key:"###"}).split("###"),l)),r("span",{},l)}class pe extends ie{constructor(e,t,s){super(e,{}),this.env=t,this.config=s,this.tableSections=[],this.createBodyDom(),this.updateRowVisibility()}open(e=!0){e&&this.updateRowVisibility(),super.open(e)}createBodyDom(){const e=this.env;this.$main.classList.add("help-modal"),this.$title.innerText=e.t("modal.help.title");const t=r("table",{className:"keybindings-table"}),s=function(e,t){const s=e.getKeyboardVariant(),i={navigate:{},player:{},sound_tools:{},other:{}},n=t.slice();n.sort((e,t)=>e.order-t.order);for(const e of n){if(null!=e.keyboard&&e.keyboard!==s)continue;let t=i[e.kind];t||(t=i[e.kind]={});let n=t[e.action];n||(n=t[e.action]=[]),n.push(e)}return i}(e,this.config.keybindings);for(const[i,n]of Object.entries(s)){const s=[...Object.entries(n)];if(0===s.length)continue;const a={thead:r("thead",{},[r("th",{className:"kb-group",colSpan:2},[e.t(`action.kind.${i}`)])]),tbody:r("tbody",{}),rows:[]};for(const[e,t]of s){const s=r("tr",{},[r("td",{className:"key"},this.listKeybindings(t)),r("td",{className:"action"},[this.describeAction(e)])]);a.rows.push({action:e,tr:s}),a.tbody.append(s)}t.append(a.thead,a.tbody),this.tableSections.push(a)}this.$body.append(t)}listKeybindings(e){return f(e.map(e=>ue(this.env,e)),r("br"))}describeAction(e){return this.env.t(`action.${e}`,this.config.constants)}updateRowVisibility(){for(const e of this.tableSections){let t=!1;for(const s of e.rows){const e=this.config.actionIsAvailable(s.action);s.tr.setAttribute("aria-disabled",e?"false":"true");const i=e?"":this.env.t("action.unavailable");s.tr.setAttribute("title",i),s.tr.setAttribute("aria-label",i),t||=e}e.thead.setAttribute("aria-disabled",t?"false":"true"),e.tbody.setAttribute("aria-disabled",t?"false":"true")}}}var me=s(3318),fe=s.n(me);class ge{constructor(e){this.jpeg=e,this.exif=fe().load(e)}static fromBinaryString(e){return new ge(e)}toBinaryString(){const e=fe().dump(this.exif);return fe().insert(e,this.jpeg)}addMetadata(e){e.title&&(this.exif["0th"][fe().ImageIFD.ImageDescription]=e.title),e.comment&&(this.exif.Exif[fe().ExifIFD.UserComment]=e.comment)}getMetadata(){return{title:this.exif["0th"][fe().ImageIFD.ImageDescription]??"",comment:this.exif.Exif[fe().ExifIFD.UserComment]??""}}}const ve=String.fromCharCode(137,80,78,71,13,10,26,10);function be(e,t){var s=new Array(t);for(let i=t-1;i>=0;i--)s[i]=String.fromCharCode(255&e),e>>=8;return s.join("")}function ye(e){let t=0;for(let s=0;s>>8^t[255&(s^e.charCodeAt(i))];return(-1^s)>>>0}(t.type+t.data),t}addChunk(e){const t=ke.createChunk(e);if("iTXt"!==t.type)throw new Error(`Adding chunk type ${t.type} is not supported.`);this.chunks.unshift(t)}static fromBinaryString(e){if(!function(e){return e.substr(0,8)===ve}(e.substr(0,8)))return;let t;e=e.substr(8);for(var s=[];""!==e;){var i={},n=ye(e.substr(0,4));n<0&&(n=0);var r=e.substr(0,n+12);e=e.substr(n+12),i.size=n,i.type=r.substr(4,4),i.data=r.substr(8,n),i.crc=ye(r.substr(8+n,4)),"IHDR"===i.type?t=i:"IEND"!==i.type&&s.push(i)}return void 0===t?void 0:new ke(t,s)}toBinaryString(){var e=ve;const t=t=>{var s="";s+=be(t.size,4),s+=t.type,s+=t.data,s+=be(t.crc,4),e+=s};t(this.headerChunk);for(const e of this.chunks)t(e);return t(ke.createChunk({type:"IEND"})),e}addMetadata(e){for(const[t,s]of Object.entries(e)){if(!s)continue;const e={title:"Title",comment:"Comment"}[t];e&&this.addChunk({type:"iTXt",keyword:e,text:s})}}}const we=[{mimeType:"image/png",extension:"png",label:"PNG",parseBinaryString:e=>ke.fromBinaryString(e)},{mimeType:"image/jpeg",extension:"jpg",label:"JPEG",parseBinaryString:e=>ge.fromBinaryString(e)},{mimeType:"image/tiff",extension:"tiff",label:"TIFF",parseBinaryString:()=>{}}];function Te(e,t){const s=Object.assign({},t);for(const[i,n]of Object.entries(t)){const t=e[i]??n;switch(typeof n){case"boolean":s[i]=!0===t||Boolean(Number(t));break;case"number":s[i]=Number(t);break;case"string":s[i]=String(t)}}return s}class Ce extends ie{constructor(e,t,s){const i=we.filter(e=>t.supportsCanvasExport(e.mimeType));super(e,{metadata:null,showMetadata:!0,fps:null,timecode:null,supportedImageFormats:i,selectedImageFormat:i[0]??null}),this.env=t,this.gen=new ae(t),this.videoDomElement=null,this.config=s,this.constants=Te(s.constants,{screenshotFilenameTemplate:"Screenshot",screenshotCommentTemplate:""});const n=this.config.keybindings.find(e=>"modal.screenshot.snap"===e.action);this.$main.classList.add("screenshot-modal"),this.$title.innerText=t.t("modal.screenshot.title");const a=t.mkid(),o=t.mkid();this.$body.append(r("div",{className:"screenshot-config"},[r("h4",{},[t.t("modal.screenshot.configuration")]),r("section",{className:"metadata-config"},[r("h1",{},[t.t("modal.screenshot.metadata")]),r("div",{className:"metadata-overlay"},[r("input",{type:"checkbox",id:a,checked:this.state.showMetadata,$change:this.handleChangeShowMetadata.bind(this)}),r("label",{htmlFor:a},[t.t("modal.screenshot.metadata-overlay")])])]),r("section",{},[r("h1",{},[t.t("modal.screenshot.file-format")]),r("div",{},this.state.supportedImageFormats.map(e=>{const s=t.mkid();return r("span",{className:"file-format-option"},[r("input",{id:s,name:o,type:"radio",checked:e.mimeType===this.state.selectedImageFormat?.mimeType,$change:()=>{this.setState({selectedImageFormat:e})}}),r("label",{htmlFor:s},[` ${e.label}`])])}))]),r("a",{href:"#",className:"download-link",$click:this.handleDownloadImage.bind(this)},[r("i",{className:"material-icons-round inline-icon"},["download"]),t.t("modal.screenshot.download-image")]),n&&r("aside",{className:"snap-tip"},[r("i",{className:"material-icons-round inline-icon"},["info_outline"]),r("span",{},f(t.t("modal.screenshot.snap-tip",{keybinding:"{kb}"}).split("{kb}"),ue(t,n)))])]),this.$canvas=r("canvas"))}setVideo(e){return this.videoDomElement=e,this}setMetadata(e){return this.setState({metadata:e}),this}setFps(e){return this.setState({fps:e}),this}setTimecode(e){return this.setState({timecode:e}),this}handleChangeShowMetadata(e){e.target instanceof HTMLInputElement&&this.setState({showMetadata:e.target.checked})}async handleDownloadImage(e){e.preventDefault(),await this.downloadCurrentImage(this.state)}renderCurrentScreenshot({showMetadata:e,metadata:t,timecode:s,fps:i}){if(null===this.videoDomElement)return!1;const n={captions:[],minWidth:1e3};if(e){const e=re(this.gen,t??{},s,i);n.captions=this.getCaptions(e)}return function(e,t,s){const[i,n]=e instanceof HTMLCanvasElement?[e,e.getContext("2d")]:[e.canvas,e];if(null===n)return!1;const r=Math.max(1,Math.ceil((s.minWidth??0)/t.videoWidth));i.width=t.videoWidth*r,i.height=t.videoHeight*r,n.drawImage(t,0,0,i.width,i.height);const a=i.height/1080,o=10*a;n.font=`${Math.floor(25*a)}px Arial`,n.fillStyle="#FFFFFF",n.shadowBlur=5,n.shadowColor="black";for(const e of s.captions??[]){const t="left"===e.h?o:i.width-o,s="top"===e.v?o:i.height-o;n.textAlign=e.h,n.fillText(e.text,t,s)}}(this.$canvas,this.videoDomElement,n),!0}async downloadCurrentImage(e){const{metadata:t,timecode:s,fps:i,selectedImageFormat:n}=e;if(null===t||null===s||null===n)return console.error("one of [metadata, timecode, selectedImageFormat] is null"),!1;const r=re(this.gen,t,s,i);return p(await this.makeImageBlob(this.$canvas,n,r),this.getFilename(r,n)),!0}async makeImageBlob(e,t,s){const i=await function(e,t){return new Promise((s,i)=>{e.toBlob(e=>{e?s(e):i()},t,undefined)})}(e,t.mimeType),n=await(r=i,d(r,"readAsBinaryString"));var r;const a=t.parseBinaryString(n);if(a){a.addMetadata({title:s.title?.[0]??"",comment:ne(this.constants.screenshotCommentTemplate,s)});const e=function(e){const t=new Uint8Array(e.length);for(let s=0;s0?t:"_"}(s)}.${i}`}getCaptions(e){return this.config.screnshotCaptions.map(t=>({...t,text:ne(t.text,e)}))}async snap(){await this.update();const e=this.state;this.renderCurrentScreenshot(e)&&await this.downloadCurrentImage(e)||alert(this.env.t("modal.screenshot.error"))}render(e){super.render(e),e.show&&(!this.state.show||e.showMetadata!==this.state.showMetadata)&&this.renderCurrentScreenshot(e)}}const Se=JSON.parse('[{"keys":["Escape"],"action":"cancel","kind":"other","order":100},{"keys":["?"],"repeat":false,"action":"modal.help.toggle","kind":"other","order":99},{"keys":["F1"],"repeat":false,"action":"modal.help.toggle","kind":"other","order":99},{"keys":["b"],"scope":"player","action":"modal.bookmark.open","kind":"other","order":30},{"keys":["s"],"scope":"player","action":"modal.screenshot.open","kind":"other","order":31},{"keys":["S"],"scope":"player","action":"modal.screenshot.snap","kind":"other","order":32},{"keys":["f"],"repeat":false,"scope":"player","action":"fullscreen.toggle","kind":"player","order":20},{"keys":["t"],"repeat":false,"scope":"player","action":"theater.toggle","kind":"player","order":21},{"keys":[" "],"repeat":false,"scope":"player","action":"playback.toggle","kind":"player","order":0},{"keys":["m"],"repeat":false,"scope":"player","action":"playback.volume.mute.toggle","kind":"player","order":12},{"keys":["ArrowUp"],"scope":"player","action":"playback.volume.inc","kind":"player","order":10},{"keys":["ArrowDown"],"scope":"player","action":"playback.volume.dec","kind":"player","order":11},{"keys":["c"],"repeat":false,"scope":"player","action":"playback.captions.toggle","kind":"player","order":13},{"keys":["ArrowLeft"],"repeat":false,"scope":"player","action":"navigate.rewind","kind":"navigate","order":0},{"keys":["ArrowRight"],"repeat":false,"scope":"player","action":"navigate.seek","kind":"navigate","order":1},{"keys":["ArrowLeft"],"repeat":true,"scope":"player","action":"navigate.continuous-rewind","kind":"navigate","order":2},{"keys":["ArrowRight"],"repeat":true,"scope":"player","action":"navigate.continuous-seek","kind":"navigate","order":3},{"keyboard":"ibm","mod":"Ctrl","keys":["ArrowLeft"],"scope":"player","action":"navigate.chapter.prev","kind":"navigate","order":10},{"keyboard":"mac","mod":"Alt","keys":["ArrowLeft"],"scope":"player","action":"navigate.chapter.prev","kind":"navigate","order":10},{"keyboard":"ibm","mod":"Ctrl","keys":["ArrowRight"],"scope":"player","action":"navigate.chapter.next","kind":"navigate","order":11},{"keyboard":"mac","mod":"Alt","keys":["ArrowRight"],"scope":"player","action":"navigate.chapter.next","kind":"navigate","order":11},{"keys":["0","1","2","3","4","5","6","7","8","9"],"scope":"player","action":"navigate.position.percental","kind":"navigate","order":25},{"mod":"Shift","keys":["ArrowLeft"],"scope":"player","action":"navigate.frame.prev","kind":"navigate","order":20},{"mod":"Shift","keys":["ArrowRight"],"scope":"player","action":"navigate.frame.next","kind":"navigate","order":21},{"keys":[","],"scope":"player","action":"navigate.frame.prev","kind":"navigate","order":20},{"keys":["."],"scope":"player","action":"navigate.frame.next","kind":"navigate","order":21},{"keys":["Shift"],"scope":"player","action":"navigate.thumbnails.snap","kind":"navigate","order":30,"keydown":true,"keyup":true},{"keys":["F2"],"repeat":false,"action":"sound_tools.mode.audio","kind":"sound_tools","order":0},{"keys":["F4"],"repeat":false,"action":"sound_tools.mode.video","kind":"sound_tools","order":1},{"keys":["<"],"scope":"player","action":"sound_tools.segments.add","kind":"sound_tools","order":2},{"keys":[">"],"scope":"player","action":"sound_tools.segments.close","kind":"sound_tools","order":3},{"keys":["w"],"repeat":false,"scope":"player","action":"sound_tools.waveform.toggle","kind":"sound_tools","order":4}]');class Pe extends X{constructor(){super(),this.metadata={},this.keybindings=Se,this.handlers={onKeyDown:this.onKeyDown.bind(this),onKeyUp:this.onKeyUp.bind(this),onClickChapterLink:this.onClickChapterLink.bind(this),onChapterChanged:this.onChapterChanged.bind(this),onCloseModal:this.onCloseModal.bind(this)},this.chapterLinks=[],this.pageSelect=null,this.modals=null,this.appConstants={}}getKeybindings(){return this.keybindings}connectedCallback(){if(this.hasBeenConnected_)return;super.connectedCallback(),this.eventMgr_.record(()=>{this.addEventListener("chapterchange",this.handlers.onChapterChanged)});const e=this.getConfig(),t=Te(e.constants??{},this.constants);this.appConstants=t,null!==this.playerView&&(this.modals=function(e,t){const s=Object.values(t),i=document.createElement("div");i.className="sxnd-modal-cover",document.body.append(i);const n={toggleExclusive:e=>{e.isOpen?e.close():r.hasOpen()||e.open()},setFullscreen:e=>{(e??document.body).append(i)},hasOpen:()=>s.some(e=>e.isOpen),closeNext:()=>{for(const e of s)if(e.isOpen){e.close();break}},closeAll:()=>{for(const e of s)e.close()},update:async()=>{await Promise.all(s.map(e=>e.update()))},resize:()=>{for(const e of s)e.resize()}},r=Object.assign(new(U()),t,n);i.addEventListener("click",()=>{r.closeAll()}),e.record(()=>{window.addEventListener("resize",()=>{r.resize()}),document.addEventListener("fullscreenchange",()=>{r.setFullscreen(b())})});for(const e of s)e.on("updated",()=>{e.isOpen||r.emit("closed",e),r.hasOpen()?i.classList.add("shown"):i.classList.remove("shown")});return r}(this.eventMgr_,{help:new pe(this.playerView,this.env,{constants:{...t,forceLandscapeOnFullscreen:Number(this.constants.forceLandscapeOnFullscreen)},keybindings:this.keybindings,actionIsAvailable:e=>{const t=this.actions[e];return void 0!==t&&t.isAvailable()}}),bookmark:new le(this.playerView,this.env,{shareButtons:e.shareButtons??[]}),screenshot:new Ce(this.playerView,this.env,{keybindings:this.keybindings,screnshotCaptions:e.screenshotCaptions??[],constants:e.constants??{}})}),this.modals.on("closed",this.handlers.onCloseModal)),setTimeout(()=>{this.loadMetadata()})}loadMetadata(){this.querySelectorAll("dlf-meta").forEach(e=>{const t=e.getAttribute("key"),s=e.getAttribute("value");if(!t||!s)return;let i=this.metadata[t];void 0===i&&(i=this.metadata[t]=[]),i.push(s)})}getActions(){return{...{...super.getActions()},cancel:O(()=>{if(!this.modals?.hasOpen())return this.ui.handleEscape();this.modals.closeNext()}),"modal.help.open":O(()=>{this.openModal(this.modals?.help)}),"modal.help.toggle":O(()=>{null!==this.modals&&(this.ui.seekBar?.endSeek(),this.modals.toggleExclusive(this.modals.help))}),"modal.bookmark.open":O(()=>{this.showBookmarkUrl()}),"modal.screenshot.open":O({isAvailable:()=>!this.isAudioOnly(),execute:()=>{this.showScreenshot()}}),"modal.screenshot.snap":O({isAvailable:()=>!this.isAudioOnly(),execute:()=>{this.snapScreenshot()}}),"theater.toggle":O(()=>{this.ui.seekBar?.endSeek();const e=new CustomEvent("dlf-theater-mode",{detail:{action:"toggle",persist:!0}});window.dispatchEvent(e)}),"navigate.rewind":O(()=>{this.skipSeconds(-this.appConstants.seekStep)}),"navigate.seek":O(()=>{this.skipSeconds(+this.appConstants.seekStep)})}}getTimeRange(){const e=super.getTimeRange();if(null!==e)return e;const t=this.env.getLocation().searchParams.get("timecode");if(t){const[e,s]=t.split(",",2);return this.parseTimeRange(e,s)}return null}getChapterLink(e){const t=e.getAttribute("data-timecode");if(null!==t){const e=Number(t);if(Number.isFinite(e))return{timecode:e,fileIds:[],title:"",pageNo:null}}const s=e.hash.match(/#timecode=(\d+(?:\.\d+)?)(?:;fileIds=([\w,-]+))?/);if(null!==s){const e=Number(s[1]);if(Number.isFinite(e)){const t=s[2];return{timecode:e,fileIds:void 0===t?[]:t.split(","),title:"",pageNo:null}}}return null}onDomContentLoaded(){super.onDomContentLoaded(),document.querySelectorAll("a[data-timecode], .tx-dlf-tableofcontents a, .tx-dlf-toc a").forEach(e=>{const t=e,s=this.getChapterLink(t);if(null!==s){const t=e;t.dlfVideoLink=s,this.eventMgr_.record(()=>{t.addEventListener("click",this.handlers.onClickChapterLink)}),this.chapterLinks.push(t)}});const e=document.querySelector("li.pages form select");e instanceof HTMLSelectElement&&(this.pageSelect=e,this.pageSelect.onchange=t=>{const s=Number(e.value),i=this.chapters.find(e=>e.pageNo===s)??this.chapters.at(s-1);void 0!==i&&this.seekToChapter(i)||this.pageSelect?.form?.submit()})}loaded(){super.loaded(),this.modals?.resize()}configureFrontend(e){super.configureFrontend(e),this.eventMgr_.record(()=>{document.addEventListener("keydown",this.handlers.onKeyDown,{capture:!0}),document.addEventListener("keyup",this.handlers.onKeyUp,{capture:!0})})}getKeyboardScope(){if(this.modals?.hasOpen())return"modal";for(const e of Array.from(document.querySelectorAll("input:focus")))if(e instanceof HTMLElement&&null!==e.offsetParent)return"input";return"player"}onKeyDown(e){this.hasVideo&&this.handleKey(e,"down")}onKeyUp(e){this.hasVideo&&(e.stopImmediatePropagation(),this.handleKey(e,"up"),this.cancelTrickPlay())}handleKey(e,t){const s=this.getKeyboardScope(),i=function(e,t,s,i){const n=function(e){let t=he.None;return e.ctrlKey&&"Control"!==e.key&&(t|=he.Ctrl),e.metaKey&&"Meta"!==e.key&&(t|=he.Meta),e.shiftKey&&"Shift"!==e.key&&(t|=he.Shift),e.altKey&&"Alt"!==e.key&&(t|=he.Alt),t}(s),r=e.getKeyboardVariant();for(const a of t){const t=a.keys.findIndex(e=>e===s.key);if(-1!==t&&!(null!=a.repeat&&a.repeat!==s.repeat||null!=a.scope&&a.scope!==i||de(e,s.key,he[a.mod??"None"])!==de(e,s.key,n)||null!=a.keyboard&&a.keyboard!==r))return{keybinding:a,keyIndex:t}}}(this.env,this.keybindings,e,s);if(i){const{keybinding:s,keyIndex:n}=i;e.preventDefault();const r="down"===t&&(s.keydown??!0)||"up"===t&&(s.keyup??!1),a=this.actions[s.action];r&&void 0!==a&&a.isAvailable()&&!1!==a.execute(s,n,t)&&"Escape"===e.key&&e.stopImmediatePropagation()}}onClickChapterLink(e){const t=e.currentTarget;this.seekToChapter(t.dlfVideoLink)&&(e.preventDefault(),this.media.play())}onChapterChanged(e){const t=e.detail.curChapter;if(null!=this.pageSelect&&null!==t)if(null!==t.pageNo)this.pageSelect.value=t.pageNo.toString();else{const e=this.chapters.indexOf(t);void 0!==e&&(this.pageSelect.value=(e+1).toString())}for(const e of this.chapterLinks)null!==e.parentElement&&g(e.parentElement,"current",B.isEqual(e.dlfVideoLink,t))}onCloseModal(e){"$startAtVariants"in e&&g(e.$startAtVariants.begin.$container,"bookmark-markertable-hidden",!1),this.resumeOn(e)}showBookmarkUrl(e=null,t=!1){if(!this.hasCurrentData)return;const s=this.modals?.bookmark;void 0!==s&&(s.setState({metadata:this.metadata,timing:{currentTime:this.displayTime,markerRange:e??this.getMarkers().activeSegment?.toTimeRange()??null},fps:this.getFps()??0}),null!==e&&s.setState({startAtMode:"marker"}),!0===t&&g(s.$startAtVariants.begin.$container,"bookmark-markertable-hidden",!0),this.openModal(s,!0))}prepareScreenshot(){if(this.hasCurrentData)return this.modals?.screenshot.setVideo(this.video).setMetadata(this.metadata).setFps(this.getFps()).setTimecode(this.displayTime)}showScreenshot(){const e=this.prepareScreenshot();this.openModal(e,!0)}snapScreenshot(){const e=this.prepareScreenshot();e?.snap()}openModal(e,t=!1){null!=e&&(t&&this.pauseOn(e),this.ui.seekBar?.endSeek(),e.open())}}function xe({frequency:e,sampleRate:t}){let s=2*Math.PI*(e/t);return s=Math.tan(s/2),Ee({type:"iir",sampleRate:t,feedforward:[1,-1,0],feedback:[s+1,s-1,0]})}function _e({frequency:e,gain:t,S:s,sampleRate:i}){const n=2*Math.PI*(e/i),r=10**(t/40),a=$e(r,s),o=Math.cos(n),l=Math.sin(n)/2*(1/a),h=2*Math.sqrt(r)*l;return Ee({type:"iir",sampleRate:i,feedforward:[r*(r+1-(r-1)*o+h),2*r*(r-1-(r+1)*o),r*(r+1-(r-1)*o-h)],feedback:[r+1+(r-1)*o+h,-2*(r-1+(r+1)*o),r+1+(r-1)*o-h]})}function Me({frequency:e,gain:t,S:s,sampleRate:i}){const n=2*Math.PI*(e/i),r=10**(t/40),a=$e(r,s),o=Math.cos(n),l=Math.sin(n)/2*(1/a),h=2*Math.sqrt(r)*l;return Ee({type:"iir",sampleRate:i,feedforward:[r*(r+1+(r-1)*o+h),-2*r*(r-1+(r+1)*o),r*(r+1+(r-1)*o-h)],feedback:[r+1-(r-1)*o+h,2*(r-1-(r+1)*o),r+1-(r-1)*o-h]})}function $e(e,t){return 1/Math.sqrt((e+1/e)*(1/t-1)+2)}function Ee(e){let t=e.feedback[0];for(let s=0;s<3;s++)void 0!==t&&(e.feedback[s]/=t),void 0!==t&&(e.feedforward[s]/=t);return e}customElements.define("slub-media",Pe),customElements.define("dlf-marker-table",class extends Y{constructor(){super(),this.rows={},this.rowCount=0,this.$container=null,this.markersHandlers={remove:e=>{for(const t of e.detail.segments)this.removeRowById(t.id)},remove_all:()=>{this.clearTable()},add:e=>{this.syncSegments(e.detail.segments)},update:e=>{const{segment:t}=e.detail;this.syncSegment(t)},activate_segment:e=>{const{segment:t}=e.detail;for(const e of Object.values(this.rows))g(e.$tr,"active-segment",null!==t&&e.segment.id===t.id)}},this.handlers={onLabelEditKeydown:this.rowEvent(this.onLabelEditKeydown.bind(this)),onLabelEditInput:this.rowEvent(this.onLabelEditInput.bind(this)),onDeleteRow:this.rowEvent(this.onDeleteRow.bind(this)),onBookmarkRow:this.rowEvent(this.onBookmarkRow.bind(this)),onSeekToStartTime:this.rowEvent(this.onSeekToStartTime.bind(this)),onSeekToEndTime:this.rowEvent(this.onSeekToEndTime.bind(this)),onClear:this.onClear.bind(this),onDownloadCsv:this.onDownloadCsv.bind(this)}}attachToPlayer(e){this.$container=r("div",{className:"dlf-media-markers is-empty"},[r("h2",{},[this.env.t("control.sound_tools.marker_table.title")]),r("div",{className:"dlf-media-markers-empty-msg",innerHTML:this.getEmptyTableHTML()}),r("div",{className:"dlf-media-markers-list"},[this.$exportCsvButton=r("a",{href:"#",$click:this.handlers.onDownloadCsv},[this.env.t("control.sound_tools.marker_table.download_csv")]),", ",this.$exportCsvButton=r("a",{href:"#",$click:this.handlers.onClear},[this.env.t("control.sound_tools.marker_table.clear")]),r("table",{},[r("thead",{},[r("tr",{},[r("th",{},[this.env.t("control.sound_tools.marker_table.entry.name")]),r("th",{},[this.env.t("control.sound_tools.marker_table.entry.startTime")]),r("th",{},[this.env.t("control.sound_tools.marker_table.entry.endTime")]),r("th",{},[""])])]),this.$body=r("tbody",{},[])])])]);for(const[t,s]of Object.entries(this.markersHandlers))e.getMarkers().addEventListener(t,s);this.syncSegments(e.getMarkers().getSegments()),this.append(this.$container)}onLabelEditKeydown(e,t){"Enter"===t.key&&e.$labelEditBox.blur()}onLabelEditInput(e,t){null!==this.player&&this.player.getMarkers().update({id:e.segment.id,labelText:e.$labelEditBox.value})}onDeleteRow(e){null!==this.player&&this.player.getMarkers().removeById(e.segment.id)}onBookmarkRow(e){this.player instanceof Pe&&this.player.showBookmarkUrl(e.segment.toTimeRange(),!0)}onSeekToStartTime(e){null!==this.player&&(this.player.seekTo(e.segment.startTime),this.player.getMarkers().activateSegmentById(e.segment.id))}onSeekToEndTime(e){null!==this.player&&(this.player.seekTo(e.segment.endTime??e.segment.startTime),this.player.getMarkers().activateSegmentById(e.segment.id))}onClear(e){e.preventDefault(),null!==this.player&&confirm(this.env.t("control.sound_tools.marker_table.clear.confirm"))&&this.player.getMarkers().removeAll()}onDownloadCsv(e){e.preventDefault();const t=new ae(this.env),s=[["ID","Label","Start [s]","End [s]","URL"],...Object.values(this.rows).map(e=>[e.segment.id,e.segment.labelText,e.segment.startTime.toString(),e.segment.endTime?.toString()??"",t.generateTimerangeUrl(e.segment.toTimeRange()).toString()])].map(e=>e.map(e=>`"${e.replace(/"/g,'""')}"`).join(";")).join("\n");p(new Blob([s],{type:"text/csv"}),"markers.csv")}rowEvent(e){return t=>{const s=t.currentTarget;if(void 0===s.rowId)return;const i=this.rows[s.rowId];void 0!==i&&e(i,t)}}syncSegments(e){for(const t of e)this.syncSegment(t)}syncSegment(e){let t=!1,s=this.rows[e.id];void 0===s&&(s=this.rows[e.id]=this.createRow(e),t=!0,this.rowCount++);const i=Object.assign({},s.segment);Object.assign(s.segment,e),(t||0!==this.cmpSegment(e,i))&&this.insertRow(s),s.$labelEditBox.value=e.labelText,s.$labelEditBox.readOnly=!e.editable,s.$startTime.textContent=T(e.startTime,!0),s.$endTime.textContent=void 0===e.endTime?"":T(e.endTime,!0),this.update()}createRow(e){let t,s,i,n;const a=r("button",{title:this.env.t("control.sound_tools.marker_table.entry.delete"),$click:this.handlers.onDeleteRow},[r("span",{className:"material-icons-round inline-icon"},["delete"])]);a.rowId=e.id;const o=r("button",{title:this.env.t("control.sound_tools.marker_table.entry.bookmark"),$click:this.handlers.onBookmarkRow},[r("span",{className:"material-icons-round inline-icon"},["bookmark_border"])]);o.rowId=e.id;const l=r("input",{placeholder:e.id,value:e.labelText,readOnly:!e.editable,$keydown:this.handlers.onLabelEditKeydown,$input:this.handlers.onLabelEditInput});l.rowId=e.id;const h=[s=r("td",{className:"marker-id-col"},[l]),i=r("td",{className:"marker-start-col",title:this.env.t("control.sound_tools.marker_table.jump_to_start"),$click:this.handlers.onSeekToStartTime}),n=r("td",{className:"marker-end-col",title:this.env.t("control.sound_tools.marker_table.jump_to_end"),$click:this.handlers.onSeekToEndTime}),r("td",{className:"marker-buttons-col"},[o,a])];for(const t of h)t.rowId=e.id;return t=r("tr",{},h),{segment:Object.assign({},e),$tr:t,$id:s,$labelEditBox:l,$startTime:i,$endTime:n}}insertRow(e){if(void 0===this.$body)return;let t=!1;for(const s of Object.values(this.rows))if(e!==s&&this.cmpSegment(e.segment,s.segment)<0){this.$body.insertBefore(e.$tr,s.$tr),t=!0;break}t||this.$body.append(e.$tr)}removeRowById(e){if(void 0===e)return;const t=this.rows[e];void 0!==t&&this.removeRow(t)}clearTable(){void 0!==this.$body&&(this.$body.innerHTML=""),this.rows={},this.rowCount=0,this.update()}removeRow(e){e.$tr.remove(),delete this.rows[e.segment.id],this.rowCount--,this.update()}getEmptyTableHTML(){if(!(this.player instanceof Pe))return"";const e=this.player.getKeybindings(),t=e.find(e=>"sound_tools.segments.add"===e.action),s=e.find(e=>"sound_tools.segments.close"===e.action);return l(r("span",{innerText:this.env.t("control.sound_tools.marker_table.empty",{keybindingAdd:"{keybindingAdd}",keybindingClose:"{keybindingClose}"})}).innerHTML,{keybindingAdd:t?ue(this.env,t).innerHTML:"",keybindingClose:s?ue(this.env,s).innerHTML:""})}update(){null!==this.$container&&g(this.$container,"is-empty",0===this.rowCount)}cmpSegment(e,t){return o(e.startTime,t.startTime)||o(e.endTime??e.startTime,t.endTime??t.startTime)}});class Ae{constructor(e,t=null){this.initial_=e,this.value_=e,this.updateFn_=t}get initial(){return this.initial_}get value(){return this.value_}get editable(){return null!==this.updateFn_}initialize(e){this.initial_=e,this.value_=e}update(e){if(null!==this.updateFn_){const t=this.value_,s=e(t);this.value_=s,this.updateFn_(t,s,e=>{this.value_=e})}}}const Re=["deepBaseRolloff","baseBoostRolloff","baseBoost","trebleCut"];function Be(e){return 1/(2*Math.PI*e)}function qe(e){return 1/(2*Math.PI*e)}class Fe{constructor(e){this.audioContext_=e,this.processorNode=new AudioWorkletNode(e,"multi-iir-processor"),this.pp={deepBaseRolloff:this.makeParam("base",50),baseBoostRolloff:this.makeParam("mid",1e3,()=>[0,this.pp.baseBoost.frequency.value-.01]),baseBoost:this.makeParam("mid",2e3,()=>[this.pp.baseBoostRolloff.frequency.value+.01,Number.POSITIVE_INFINITY]),trebleCut:this.makeParam("treble",5e3)},this.parameters_=[this.pp.deepBaseRolloff,this.pp.baseBoostRolloff,this.pp.baseBoost,this.pp.trebleCut],this.gain_=1,this.keyedFilters_=this.createFilters(),this.updateFilters()}get inputNode(){return this.processorNode}get outputNode(){return this.processorNode}get nodes(){return Object.values(this.keyedFilters_).filter(e=>e.isActive).map(e=>e.node)}get parameters(){return this.parameters_}get gain(){return this.gain_}targetCurve(e){const t={name:"RIAA Target",points:[]},s=this.single(1e3);for(let i=0;i[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY]){return{isActive:!1,frequency:new Ae(t,(t,i,n)=>{n(a(i,s())),this.keyedFilters_[e]=this.makeFilter(e),this.keyedFilters_[e].isActive=!0,this.updateFilters()}),gain:new Ae(0),getFrequencyResponse:t=>{const s=this.keyedFilters_[e]?.node??null;return null===s?{name:"Frequency Response",points:[]}:t.aggregate([s]).makeCurve(this.gain_)}}}updateFilters(){const e=this.single(1e3);this.gain_=10**(-e/20),this.processorNode.port.postMessage({type:"filters",gain:this.gain_,filters:this.keyedFilters_})}createFilters(){const e={base:this.makeFilter("base"),mid:this.makeFilter("mid"),treble:this.makeFilter("treble")};return e.base.isActive=this.pp.deepBaseRolloff.isActive,e.mid.isActive=this.pp.baseBoost.isActive,e.treble.isActive=this.pp.trebleCut.isActive,e}makeFilter(e){switch(e){case"base":return this.makeBaseFilter();case"mid":return this.makeMidFilter();case"treble":return this.makeTrebleFilter()}}makeBaseFilter(){return{isActive:!1,node:xe({frequency:this.pp.deepBaseRolloff.frequency.value,sampleRate:this.audioContext_.sampleRate})}}makeMidFilter(){const e=10*Math.log10(1+this.pp.baseBoost.frequency.value**2)-10*Math.log10(1+this.pp.baseBoostRolloff.frequency.value**2),t=e/2;return{isActive:!1,node:_e({frequency:Math.sqrt(this.pp.baseBoost.frequency.value**2-this.pp.baseBoostRolloff.frequency.value**2*10**(t/10))/Math.sqrt(10**(t/10)-1),gain:e,S:.5,sampleRate:this.audioContext_.sampleRate})}}makeTrebleFilter(){const e=this.single(2e4),t=e/2;return{isActive:!1,node:Me({frequency:Math.sqrt(10**(-t/10)-1)*this.pp.trebleCut.frequency.value,gain:e,S:.5,sampleRate:this.audioContext_.sampleRate})}}single(e){let t=0;return this.pp.deepBaseRolloff.isActive&&(t-=10*Math.log10(1+(this.pp.deepBaseRolloff.frequency.value/e)**2)),this.pp.baseBoost.isActive&&(t+=10*Math.log10(1+(this.pp.baseBoost.frequency.value/e)**2),t-=10*Math.log10(1+(this.pp.baseBoostRolloff.frequency.value/e)**2)),this.pp.trebleCut.isActive&&(t-=10*Math.log10(1+(e/this.pp.trebleCut.frequency.value)**2)),t}}function Ie(e){if("object"!=typeof e||null===e)return null;const{group:t,label:s,mode:i}=e;if("string"!=typeof t||"string"!=typeof s)return null;const n={group:t,label:s};if("string"==typeof e.key&&(n.key=e.key),"band-iso"===i){const t=Number(e.octaveStep);if(t>0)return{...n,mode:i,octaveStep:t}}else if("band"===i){if(Array.isArray(e.bands)){const t=[];for(const s of e.bands){if("object"!=typeof s||null===s)continue;const e=Number(s.frequency),i=Number(s.octaves),n=Number(s.gain);e>0&&i>0&&Number.isFinite(n)&&t.push({frequency:e,octaves:i,gain:n})}return{...n,mode:i,bands:t}}}else if("riaa"===i&&"object"==typeof e.params&&null!==e.params){const t={};let s=Number.POSITIVE_INFINITY;for(const i of Re){const n=Number(e.params[i]);ne.node)}get parameters(){return this.bands_.map(e=>e.param)}get inputNode(){return this.nodes[0]??this.fallbackNode_}get outputNode(){return this.nodes[this.nodes.length-1]??this.fallbackNode_}targetCurve(e){return null}getBands(){return this.bands_.map(e=>({frequency:e.options.frequency,octaves:Le.qToOctaves(e.options.Q),gain:e.options.gain}))}autofill(e){this.addBand(1e3,e,0);for(let t=1;;t++){let s=!1;for(const i of[-1,1]){const n=1e3*2**(i*t*e);20<=n&&n<=2e4&&(this.addBand(n,e,0),s=!0)}if(!s)break}}addBand(e,t,s){const i={type:"peaking",frequency:e,gain:s,Q:Le.octavesToQ(t)},n=new BiquadFilterNode(this.audioContext_,i);null!==this.prevNode_&&this.prevNode_.connect(n),this.prevNode_=n,this.bands_.push({node:n,param:{isActive:!0,frequency:new Ae(i.frequency),gain:new Ae(i.gain,(e,t)=>{n.gain.value=i.gain=t}),getFrequencyResponse:e=>e.aggregate([n]).makeCurve(this.gain)},options:i})}}class Ne{constructor(e){this.source_=e,this.audioContext_=e.context,this.fftSize_=8192,this.fftData_=new Float32Array(this.fftSize_),this.connection_=null,this.active_=!1,this.filterset_=new Le(this.audioContext_)}get audioContext(){return this.audioContext_}get active(){return this.active_}set active(e){e!==this.active_&&(this.active_=e,e?this.activate():this.deactivate())}get filterset(){return this.filterset_}get activeParams(){return this.filterset_.parameters.filter(e=>e.isActive)}getFrequencyResponse(e){return e.aggregate(this.filterset_.nodes).makeCurve(this.filterset.gain)}connect(e){const t=this.audioContext_.createAnalyser();t.smoothingTimeConstant=0,t.fftSize=this.fftSize_,this.connection_={destination:e,analyzer:t},this.source_.connect(t),t.connect(e)}setFilters(e){this.deactivate(),this.filterset_=e,this.active_&&this.activate()}loadPreset(e){let t;switch(e.mode){case"riaa":t=new Fe(this.audioContext),t.resetTc(e.params);break;case"band-iso":t=new Le(this.audioContext),t.autofill(e.octaveStep);break;case"band":t=new Le(this.audioContext);for(const s of e.bands)t.addBand(s.frequency,s.octaves,s.gain)}this.setFilters(t)}exportPreset(e){const t={group:"user",label:e};return this.filterset_ instanceof Le?{...t,mode:"band",bands:this.filterset_.getBands()}:this.filterset_ instanceof Fe?{...t,mode:"riaa",params:this.filterset_.getTc()}:null}fft(e){if(null===this.connection_)return null;this.connection_.analyzer.getFloatFrequencyData(this.fftData_);const t={name:"FFT",points:[]};for(let s=0;se<=0?Number.NEGATIVE_INFINITY:Math.log(e),invert:Math.exp},Ve={convert:e=>e,invert:e=>e};class Ue{constructor(e=0,t=1,s=0,i=1,n=Ve){this.skew=n,this.inputMin_=e,this.inputMax_=t,this.outputMin_=s,this.inputMinConv_=this.skew.convert(e),this.convScale_=(i-s)/(this.skew.convert(this.inputMax_)-this.inputMinConv_)}get max(){return this.inputMax_}convert(e){return(this.skew.convert(e)-this.inputMinConv_)*this.convScale_+this.outputMin_}invert(e){return this.skew.invert((e-this.outputMin_)/this.convScale_+this.inputMinConv_)}}class Ge extends q{constructor(e,t){super(),this.env=e,this.eq_=t,this.handlers={onCanvasMouseMove:this.onCanvasMouseMove.bind(this),onCanvasMouseLeave:this.onCanvasMouseLeave.bind(this),onCanvasMouseDown:this.onCanvasMouseDown.bind(this),onCanvasMouseUp:this.onCanvasMouseUp.bind(this),onCanvasDoubleClick:this.onCanvasDoubleClick.bind(this),onCanvasWheel:this.onCanvasWheel.bind(this),onChangeActivate:this.onChangeActivate.bind(this),onSelectPreset:this.onSelectPreset.bind(this),onResetPreset:this.onResetPreset.bind(this),onSavePreset:this.onSavePreset.bind(this),onDeletePreset:this.onDeletePreset.bind(this),onResizeWindow:this.resize.bind(this)};const s={activateCheck:this.env.mkid(),presetSelect:this.env.mkid(),labelInput:this.env.mkid()};this.$container=r("div",{className:"dlf-equalizer-view"},[r("h2",{},[this.env.t("control.sound_tools.equalizer.title")]),r("section",{className:"eq-controls"},[r("div",{className:"eq-preset"},[r("label",{htmlFor:s.presetSelect},[this.env.t("control.sound_tools.equalizer.preset.label")]),this.$presetSelect=r("select",{id:s.presetSelect,$change:this.handlers.onSelectPreset},[]),r("button",{title:this.env.t("control.sound_tools.equalizer.preset.reset"),$click:this.handlers.onResetPreset},[r("span",{className:"material-icons-round inline-icon"},["settings_backup_restore"])]),r("button",{title:this.env.t("control.sound_tools.equalizer.preset.save"),$click:this.handlers.onSavePreset},[r("span",{className:"material-icons-round inline-icon"},["save_as"])]),this.$deletePresetBtn=r("button",{disabled:!0,title:this.env.t("control.sound_tools.equalizer.preset.delete"),$click:this.handlers.onDeletePreset},[r("span",{className:"material-icons-round inline-icon"},["delete"])])]),r("div",{className:"eq-activate"},[this.$activateCheck=r("input",{id:s.activateCheck,type:"checkbox",checked:this.eq_.active,$input:this.handlers.onChangeActivate}),r("label",{htmlFor:s.activateCheck},[this.env.t("control.sound_tools.equalizer.activate")])])]),this.$canvas=r("canvas",{width:1e3,height:400,$mousemove:this.handlers.onCanvasMouseMove,$mouseleave:this.handlers.onCanvasMouseLeave,$mousedown:this.handlers.onCanvasMouseDown,$dblclick:this.handlers.onCanvasDoubleClick,$mouseup:this.handlers.onCanvasMouseUp,$wheel:this.handlers.onCanvasWheel})]),this.$ctx=this.$canvas.getContext("2d"),this.eqBox=this.calcEqBox(),this.resizeAnimationFrame=null,this.renderAnimationFrame=null,this.hovered=null,this.NUM_POINTS=1e3,this.db=new Ue,this.phase=new Ue,this.freq=new Ue,this.frequencies=new Float32Array(this.NUM_POINTS),this.frequencyResponse=new Oe(this.NUM_POINTS),this.singleFrequencyResponse=new Oe(1),this.frequencyResponseCurve=this.frequencyResponse.makeCurve(),this.presets={selected:null,keyToPreset:{},domGroups:{}},this.addPresetOptgroup("user"),this.setHovered(null),this.initFrequencies(),window.addEventListener("resize",this.handlers.onResizeWindow)}get domElement(){return this.$container}resize(){null===this.resizeAnimationFrame&&(this.resizeAnimationFrame=requestAnimationFrame(()=>{this.resizeAnimationFrame=null;const e=a(this.$container.offsetWidth-100,[100,1e3]),t=a(.4*e,[200,400]);this.$canvas.width=e,this.$canvas.height=t,this.eqBox=this.calcEqBox(),this.initFrequencies()}))}calcEqBox(){return new DOMRect(40,0,this.$canvas.width-40,this.$canvas.height-20)}initFrequencies(){const e=this.eq_.audioContext.sampleRate/2;this.db=new Ue(-24,24,this.eqBox.bottom,this.eqBox.top,Ve),this.phase=new Ue(-2*Math.PI,2*Math.PI,this.eqBox.bottom,this.eqBox.top,Ve),this.freq=new Ue(10,e,this.eqBox.left,this.eqBox.right,De);const t=new Ue(10,e,0,this.NUM_POINTS-1,De);for(let e=0;ee);const s=this.freq.invert(t.freqX+(this.hovered.grabbed.filter.freqX-this.hovered.grabbed.pointer.freqX));this.updateFilterFreq(this.hovered.param,()=>s)}else{const e=this.freq.invert(t.freqX);let s=null;for(const i of this.eq_.activeParams){const n={grabbed:null,pointer:t,dist:Math.abs(i.frequency.value-e),param:i};(null===s||n.dist<=s.dist)&&(s=n)}this.setHovered(s)}}onCanvasMouseLeave(){this.setHovered(null)}onCanvasMouseDown(e){if(null!==this.hovered){const t={freqX:e.offsetX,gainY:e.offsetY},s={gainY:this.db.convert(this.hovered.param.gain.value),freqX:this.freq.convert(this.hovered.param.frequency.value)};this.setHovered({...this.hovered,grabbed:{pointer:t,filter:s}})}}onCanvasMouseUp(){null!=this.hovered?.grabbed&&this.setHovered({...this.hovered,grabbed:null})}onCanvasDoubleClick(){const e=this.hovered?.param;null!=e&&(this.updateFilterGain(e,()=>e.gain.initial),this.updateFilterFreq(e,()=>e.frequency.initial))}onCanvasWheel(e){if(null!==this.hovered&&null===this.hovered.grabbed){e.preventDefault();const t=e.deltaY/4;let s=this.db.invert(this.eqBox.height/2-t);Math.abs(s)>1&&(s/=5),this.updateFilterGain(this.hovered.param,e=>e-s)}}setHovered(e){this.hovered=e,this.$canvas.style.cursor=e?.grabbed?"grab":"pointer",this.scheduleRenderGraph()}updateFilterGain(e,t){this.updateEqValue(e.gain,t,[-24,24])}updateFilterFreq(e,t){this.updateEqValue(e.frequency,t,[10,this.freq.max])}updateEqValue(e,t,s){e.editable&&(e.update(e=>a(t(e),s)),this.updateFrequencyResponse())}onSelectPreset(){this.selectPreset(this.$presetSelect.value)}onResetPreset(){this.selectPreset(this.$presetSelect.value,"original")}onSavePreset(){const e=prompt(this.env.t("control.sound_tools.equalizer.preset.save.name"));if(!e)return;const t=this.eq_.exportPreset(e);if(null===t)return;const s=this.addPreset(t);this.selectPreset(s),this.dispatchEvent(new CustomEvent("store_preset",{detail:{key:s,preset:t}}))}onDeletePreset(){const e=this.$presetSelect.value,t=this.presets.keyToPreset[e];void 0!==t&&"user"===t.original.group&&(this.presets.domGroups[t.original.group]?.querySelector(`option[value="${e}"]`)?.remove(),this.selectPreset(this.$presetSelect.value),this.dispatchEvent(new CustomEvent("delete_preset",{detail:{key:e}})))}addPreset(e){const t=e.key??this.env.uuidv4();this.presets.keyToPreset[t]={original:e,modified:e};let s=this.presets.domGroups[e.group];void 0===s&&(s=this.addPresetOptgroup(e.group));const i=r("option",{value:t},[e.label]);return s.append(i),t}selectPreset(e,t="modified"){if(null!==this.presets.selected){const e=this.eq_.exportPreset("");null!==e&&(this.presets.selected.modified=e)}const s=this.presets.keyToPreset[e];void 0!==s&&(this.presets.selected=s,this.eq_.loadPreset(s[t]),s.modified=s[t],this.$presetSelect.value=e,this.$deletePresetBtn.disabled="user"!==s.original.group,this.updateFrequencyResponse())}addPresetOptgroup(e){const t=r("optgroup",{label:this.env.t(`control.sound_tools.equalizer.preset.group.${e}`)},[]);return this.presets.domGroups[e]=t,this.$presetSelect.appendChild(t),t}fftSnapshot(e){this.fftCurve=this.eq_.fft(e),this.scheduleRenderGraph()}updateFrequencyResponse(){this.frequencyResponseCurve=this.eq_.getFrequencyResponse(this.frequencyResponse),this.scheduleRenderGraph()}scheduleRenderGraph(){null===this.renderAnimationFrame&&(this.renderAnimationFrame=requestAnimationFrame(()=>{this.renderGraph(),this.renderAnimationFrame=null}))}renderGraph(){if(null===this.$ctx)return;const e=this.eqBox;this.$ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height);for(let t=-24;t<=24;t+=6){const s=this.db.convert(t);this.$ctx.strokeStyle="#ddd",this.$ctx.beginPath(),this.$ctx.moveTo(e.left,s),this.$ctx.lineTo(e.right,s),this.$ctx.stroke();let i=s+4;t>0?i=s+10:t<0&&(i=s),this.$ctx.font="12px Arial",this.$ctx.fillStyle="#aaa",this.$ctx.textAlign="right",this.$ctx.fillText(`${t} dB`,e.left-4,i,e.width)}for(const t of[10,100,1e3,1e4]){for(let e=1;e<10;e++){this.$ctx.strokeStyle=e<=1?"#aaa":"#ddd";const s=this.freq.convert(t*e);this.$ctx.beginPath(),this.$ctx.moveTo(s,this.eqBox.top),this.$ctx.lineTo(s,this.eqBox.bottom),this.$ctx.stroke()}this.$ctx.font="12px Arial",this.$ctx.textAlign="left",this.$ctx.fillStyle="#aaa";const s=this.freq.convert(t);this.$ctx.fillText(`${t} Hz`,s,e.bottom+12)}const t=this.eq_.filterset.targetCurve(this.frequencies);if(null!==t&&this.drawEqCurve(t),this.$ctx.strokeStyle="black",this.drawEqCurve(this.frequencyResponseCurve,"gain"),this.$ctx.setLineDash([5,15]),this.drawEqCurve(this.frequencyResponseCurve,"phase"),this.$ctx.setLineDash([]),null!==this.hovered){const e=this.hovered.param.getFrequencyResponse(this.frequencyResponse);this.$ctx.strokeStyle="transparent",this.$ctx.fillStyle="rgba(0, 0, 0, 0.1)",this.fillEqCurve(e)}if(null!==this.hovered){const t=this.freq.invert(this.hovered.pointer.freqX),s=t.toLocaleString(void 0,{maximumFractionDigits:0});this.singleFrequencyResponse.setFrequency(0,t);const i=this.eq_.getFrequencyResponse(this.singleFrequencyResponse).points[0];if(void 0!==i){const t=i.gain.toLocaleString(void 0,{maximumFractionDigits:1,signDisplay:"exceptZero"}),n=(i.phase/Math.PI*180).toLocaleString(void 0,{maximumFractionDigits:0});this.$ctx.font="12px Arial",this.$ctx.fillStyle="rgba(0, 0, 0, 0.4)",this.$ctx.textAlign="left",this.$ctx.fillText(`${s} Hz: ${t} dB, ${n}°`,e.left+2,e.top+12)}}for(const e of this.eq_.activeParams){const t=this.freq.convert(e.frequency.value),s=this.db.convert(e.gain.value);this.$ctx.fillStyle=e===this.hovered?.param?"red":"blue",this.$ctx.beginPath(),this.$ctx.arc(t,s,3,0,2*Math.PI),this.$ctx.fill()}this.fftCurve&&(this.$ctx.strokeStyle="green",this.drawEqCurve(this.fftCurve))}fillEqCurve(e,t="gain"){if(null===this.$ctx)return;const s=e.points[0],i=e.points[e.points.length-1];s&&i&&(e.points.splice(0,0,{freq:s.freq,gain:0,phase:0}),e.points.push({freq:i.freq,gain:0,phase:0})),this.drawEqCurve(e,t),this.$ctx.closePath(),this.$ctx.fill()}drawEqCurve(e,t="gain"){if(null===this.$ctx)return;this.$ctx.beginPath();let s=!0;for(const i of e.points){const e=this.freq.convert(i.freq),n="gain"===t?this.db.convert(i.gain):this.phase.convert(i.phase);s?(this.$ctx.moveTo(e,n),s=!1):this.$ctx.lineTo(e,n)}this.$ctx.stroke()}}function ze(){const e=2**-1022;function t(t){return Math.abs(t){},this.resumedPromise=new Promise(e=>{this.markAsResumed=e})}get view(){return this.eqView_}async attachToPlayer(e){"https:"!==window.location.protocol&&console.error("Warning: The equalizer will probably fail without HTTPS"),await this.resumeAudioContext();const t=new Blob([`\n ${ze.toString()}\n ${ze.name}();\n `],{type:"application/javascript; charset=utf-8"}),s=await function(e){return d(e,"readAsDataURL")}(t);await this.context.audioWorklet.addModule(s),e.media.crossOrigin="anonymous";const i=this.context.createMediaElementSource(e.media),n=new Ne(i);n.connect(this.context.destination),this.eqView_=new Ge(this.env,n),this.eqView_.addEventListener("store_preset",this.handlers.onStorePreset);for(const e of this.presets_)this.eqView_.addPreset(e);for(const[e,t]of Object.entries(this.getLocalPresets()))this.eqView_.addPreset(t);null!==this.defaultPreset_&&this.eqView_.selectPreset(this.defaultPreset_),this.innerHTML="",this.append(this.eqView_.domElement),this.eqView_.resize()}parsePresets(e){if(!Array.isArray(e))return;const t=v(e.map(Ie));if(this.presets_.push(...t),null!==this.eqView_)for(const e of t)this.eqView_.addPreset(e)}selectPreset(e){null===this.eqView_?this.defaultPreset_=e:(this.eqView_.selectPreset(e),this.defaultPreset_=null)}async resumeAudioContext(){"running"===this.context.state?this.markAsResumed():(this.append(r("div",{className:"dlf-equalizer-resume"},[this.env.t("control.sound_tools.equalizer.resume_context")])),this.context.resume().then(()=>{this.markAsResumed()})),window.addEventListener("pointerdown",async()=>{await this.context.resume(),this.markAsResumed()},{once:!0,capture:!0}),window.addEventListener("keydown",async()=>{await this.context.resume(),this.markAsResumed()},{once:!0,capture:!0}),await this.resumedPromise}onStorePreset(e){const{key:t,preset:s}=e.detail;localStorage[`dlf.eq.presets.${t}`]=JSON.stringify(s)}getLocalPresets(){const e={};for(let t=0;t{if(!s){var a=1/0;for(d=0;d=r)&&Object.keys(i.O).every(e=>i.O[e](s[l]))?s.splice(l--,1):(o=!1,r0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[s,n,r]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={322:0};i.O.j=t=>0===e[t];var t=(t,s)=>{var n,r,a=s[0],o=s[1],l=s[2],h=0;if(a.some(t=>0!==e[t])){for(n in o)i.o(o,n)&&(i.m[n]=o[n]);if(l)var d=l(i)}for(t&&t(s);hi(6266));n=i.O(n)})(); //# sourceMappingURL=DlfMediaPlayer.js.map \ No newline at end of file diff --git a/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaVendor.js b/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaVendor.js index 3bb572670c..672e71ecb6 100644 --- a/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaVendor.js +++ b/Resources/Public/JavaScript/DlfMediaPlayer/DlfMediaVendor.js @@ -1,3 +1,3 @@ /*! For license information please see DlfMediaVendor.js.LICENSE.txt */ -(self.webpackChunkkitodo_presentation=self.webpackChunkkitodo_presentation||[]).push([[951],{157:(e,t,n)=>{const i=n(6886),r=n(9953),a=n(9899),o=n(8820),s=n(6421),u=n(7756),l=n(1332),h=n(7518),c=n(4764),d=n(1427),p=n(4565),f=n(208),g=n(9801);function m(e,t,n){const i=e.size,r=p.getEncodedBits(t,n);let a,o;for(a=0;a<15;a++)o=1==(r>>a&1),a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(i-15+a,8,o,!0),a<8?e.set(8,i-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(i-8,8,1,!0)}function v(e,t,n,r){let p;if(Array.isArray(e))p=g.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let i=t;if(!i){const t=g.rawSplit(e);i=d.getBestVersionForData(t,n)}p=g.fromString(e,i||40)}}const v=d.getBestVersionForData(p,n);if(!v)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t=0&&t<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===t||6===t)||t>=2&&t<=4&&i>=2&&i<=4?e.set(r+t,a+i,!0,!0):e.set(r+t,a+i,!1,!0))}}(_,t),function(e){const t=e.size;for(let n=8;n=7&&function(e,t){const n=e.size,i=d.getEncodedBits(t);let r,a,o;for(let t=0;t<18;t++)r=Math.floor(t/3),a=t%3+n-8-3,o=1==(i>>t&1),e.set(r,a,o,!0),e.set(a,r,o,!0)}(_,t),function(e,t){const n=e.size;let i=-1,r=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(r,s-n)){let i=!1;o>>a&1)),e.set(r,s-n,i),a--,-1===a&&(o++,a=7)}if(r+=i,r<0||n<=r){r-=i,i=-i;break}}}(_,y),isNaN(r)&&(r=l.getBestMask(_,m.bind(null,_,n))),l.applyMask(r,_),m(_,n,r),{modules:_,version:t,errorCorrectionLevel:n,maskPattern:r,segments:p}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,a,o=r.M;return void 0!==t&&(o=r.from(t.errorCorrectionLevel,r.M),n=d.from(t.version),a=l.from(t.maskPattern),t.toSJISFunc&&i.setToSJISFunction(t.toSJISFunc)),v(e,n,o,a)}},208:(e,t,n)=>{const i=n(1878),r=n(7044);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!i.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return r.testNumeric(e)?t.NUMERIC:r.testAlphanumeric(e)?t.ALPHANUMERIC:r.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},317:(e,t,n)=>{"use strict";function i(e,t){this._waveformData=e,this._channelIndex=t}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e){return null==e}function o(e,t,n){var i;return function(r){return i=i||function(e,t,n){var i=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var i=new Uint8Array(n.length),r=0,a=n.length;ru}),i.prototype.min_sample=function(e){var t=2*(e*this._waveformData.channels+this._channelIndex);return this._waveformData._at(t)},i.prototype.max_sample=function(e){var t=2*(e*this._waveformData.channels+this._channelIndex)+1;return this._waveformData._at(t)},i.prototype.set_min_sample=function(e,t){var n=2*(e*this._waveformData.channels+this._channelIndex);return this._waveformData._set_at(n,t)},i.prototype.set_max_sample=function(e,t){var n=2*(e*this._waveformData.channels+this._channelIndex)+1;return this._waveformData._set_at(n,t)},i.prototype.min_array=function(){for(var e=this._waveformData.length,t=[],n=0;n0&&n++,n}(r,t),l=8===e.bits?1:2,h=new ArrayBuffer(24+2*u*l*s),c=new DataView(h),d=0,p=24,f=new Array(s),g=new Array(s),m=0;mg[0]&&(g[0]=_,g[0]>y&&(g[0]=y))}else for(var S=0;Sg[S]&&(g[S]=_,g[S]>y&&(g[S]=y));if(++d===t){for(var T=0;T0)for(var A=0;A0?(this._min[o]=this._inputData.channel(o).min_sample(this._input_index),this._max[o]=this._inputData.channel(o).max_sample(this._input_index)):(this._min[o]=0,this._max[o]=0);this._min_value=8===this._inputData.bits?-128:-32768,this._max_value=8===this._inputData.bits?127:32767,this._where=0,this._prev_where=0,this._stop=0,this._last_input_index=0}u.create=function(e){return new u(e)},u.createFromAudio=function(e,t){var n=function(e){return{scale:e.scale||512,bits:e.bits||8,amplitude_scale:e.amplitude_scale||1,split_channels:e.split_channels||false,disable_worker:e.disable_worker||false}}(e);if(e.audio_context&&e.array_buffer)return function(e,t,n,i){function r(e){e||(e=new DOMException("EncodingError")),i(e),i=function(){}}var a=e.decodeAudioData(t,function(e){l(e,n,i)},r);a&&a.catch(r)}(e.audio_context,e.array_buffer,n,t);if(e.audio_buffer)return l(e.audio_buffer,n,t);throw new TypeError("WaveformData.createFromAudio(): Pass either an AudioContext and ArrayBuffer, or an AudioBuffer object")},h.prototype.sample_at_pixel=function(e){return Math.floor(e*this._output_samples_per_pixel)},h.prototype.next=function(){for(var e,t=0,n=this._inputData.channels;this._input_index0)for(var i=0;ithis._input_buffer_size&&(this._stop=this._input_buffer_size);this._input_indexthis._max[a]&&(this._max[a]=o)}this._input_index++}t++}if(this._input_indexthis.length&&(t=this.length),n>this.length&&(n=this.length),t>n&&(t=n);var i=n-t,r=8===this.bits?1:2,o=24+2*i*this.channels*r,s=new ArrayBuffer(o),l=new DataView(s);l.setInt32(0,2,!0),l.setUint32(4,8===this.bits,!0),l.setInt32(8,this.sample_rate,!0),l.setInt32(12,this.scale,!0),l.setInt32(16,i,!0),l.setInt32(20,this.channels,!0);for(var h=0;h=0&&e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var i=n(680);Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return i.Konva}});const r=n(680);e.exports=r.Konva},680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const i=n(8871),r=n(4060),a=n(6536),o=n(4473),s=n(7324),u=n(6267),l=n(7457),h=n(7949),c=n(1268),d=n(4723),p=n(9696),f=n(8665),g=n(9869),m=n(8604);t.Konva=r.Util._assign(i.Konva,{Util:r.Util,Transform:r.Transform,Node:a.Node,Container:o.Container,Stage:s.Stage,stages:s.stages,Layer:u.Layer,FastLayer:l.FastLayer,Group:h.Group,DD:c.DD,Shape:d.Shape,shapes:d.shapes,Animation:p.Animation,Tween:f.Tween,Easings:f.Easings,Context:g.Context,Canvas:m.Canvas}),t.default=t.Konva},1268:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const i=n(8871),r=n(4060);t.DD={get isDragging(){let e=!1;return t.DD._dragElements.forEach(t=>{"dragging"===t.dragStatus&&(e=!0)}),e},justDragged:!1,get node(){let e;return t.DD._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const n=[];t.DD._dragElements.forEach((t,i)=>{const{node:a}=t,o=a.getStage();o.setPointersPositions(e),void 0===t.pointerId&&(t.pointerId=r.Util._getFirstPointerId(e));const s=o._changedPointerPositions.find(e=>e.id===t.pointerId);if(s){if("dragging"!==t.dragStatus){const n=a.dragDistance();if(Math.max(Math.abs(s.x-t.startPointerPos.x),Math.abs(s.y-t.startPointerPos.y)){t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)})},_endDragBefore(e){const n=[];t.DD._dragElements.forEach(r=>{const{node:a}=r,o=a.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(e=>e.id===r.pointerId))return;"dragging"!==r.dragStatus&&"stopped"!==r.dragStatus||(t.DD.justDragged=!0,i.Konva._mouseListenClick=!1,i.Konva._touchListenClick=!1,i.Konva._pointerListenClick=!1,r.dragStatus="stopped");const s=r.node.getLayer()||r.node instanceof i.Konva.Stage&&r.node;s&&-1===n.indexOf(s)&&n.push(s)}),n.forEach(e=>{e.draw()})},_endDragAfter(e){t.DD._dragElements.forEach((n,i)=>{"stopped"===n.dragStatus&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0),"dragging"!==n.dragStatus&&t.DD._dragElements.delete(i)})}},i.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))},1332:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(e,n,i){switch(e){case t.Patterns.PATTERN000:return(n+i)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return i%3==0;case t.Patterns.PATTERN011:return(n+i)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(i/3))%2==0;case t.Patterns.PATTERN101:return n*i%2+n*i%3==0;case t.Patterns.PATTERN110:return(n*i%2+n*i%3)%2==0;case t.Patterns.PATTERN111:return(n*i%3+(n+i)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let n=0,i=0,r=0,a=null,o=null;for(let s=0;s=5&&(n+=i-5+3),a=t,i=1),t=e.get(u,s),t===o?r++:(r>=5&&(n+=r-5+3),o=t,r=1)}i>=5&&(n+=i-5+3),r>=5&&(n+=r-5+3)}return n},t.getPenaltyN2=function(e){const t=e.size;let n=0;for(let i=0;i=10&&(1488===i||93===i)&&n++,r=r<<1&2047|e.get(o,a),o>=10&&(1488===r||93===r)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let i=0;i{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1427:(e,t,n)=>{const i=n(6886),r=n(7518),a=n(9953),o=n(208),s=n(1878),u=i.getBCHDigit(7973);function l(e,t){return o.getCharCountIndicator(e,t)+4}function h(e,t){let n=0;return e.forEach(function(e){const i=l(e.mode,t);n+=i+e.getBitsLength()}),n}t.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!s.isValid(e))throw new Error("Invalid QR Code version");void 0===n&&(n=o.BYTE);const a=8*(i.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,t));if(n===o.MIXED)return a;const u=a-l(n,e);switch(n){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},t.getBestVersionForData=function(e,n){let i;const r=a.from(n,a.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let i=1;i<=40;i++)if(h(e,i)<=t.getCapacity(i,n,o.MIXED))return i}(e,r);if(0===e.length)return 1;i=e[0]}else i=e;return function(e,n,i){for(let r=1;r<=40;r++)if(n<=t.getCapacity(r,i,e))return r}(i.mode,i.getLength(),r)},t.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;i.getBCHDigit(t)-u>=0;)t^=7973<{const i=n(208),r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(e){this.mode=i.ALPHANUMERIC,this.data=e}a.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*r.indexOf(this.data[t]);n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},e.exports=a},1878:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},1958:(e,t,n)=>{"use strict";t.EY=void 0;const i=n(4060),r=n(4892),a=n(4723),o=n(8871),s=n(5483),u=n(8871);function l(e){return[...e].reduce((e,t,n,i)=>{if(/\p{Emoji}/u.test(t)){const r=i[n+1];r&&/\p{Emoji_Modifier}|\u200D/u.test(r)?(e.push(t+r),i[n+1]=""):e.push(t)}else/\p{Regional_Indicator}{2}/u.test(t+(i[n+1]||""))?e.push(t+i[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(t)?e[e.length-1]+=t:t&&e.push(t);return e},[])}const h="auto",c="inherit",d="justify",p="left",f="middle",g="normal",m=" ",v="none",y=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],b=y.length;let _;function w(){return _||(_=i.Util.createCanvasElement().getContext("2d"),_)}class S extends a.Shape{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(let e=0;e1&&(T+=s)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=i.Util._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===h||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===h||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return i.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,i,r,a,o,s,u,l,h,c;let d,p=w(),f=this.fontSize();p.save(),p.font=this._getContextFont(),d=p.measureText(e),p.restore();const g=f/100;return{actualBoundingBoxAscent:null!==(t=d.actualBoundingBoxAscent)&&void 0!==t?t:71.58203125*g,actualBoundingBoxDescent:null!==(n=d.actualBoundingBoxDescent)&&void 0!==n?n:0,actualBoundingBoxLeft:null!==(i=d.actualBoundingBoxLeft)&&void 0!==i?i:-7.421875*g,actualBoundingBoxRight:null!==(r=d.actualBoundingBoxRight)&&void 0!==r?r:75.732421875*g,alphabeticBaseline:null!==(a=d.alphabeticBaseline)&&void 0!==a?a:0,emHeightAscent:null!==(o=d.emHeightAscent)&&void 0!==o?o:100*g,emHeightDescent:null!==(s=d.emHeightDescent)&&void 0!==s?s:-20*g,fontBoundingBoxAscent:null!==(u=d.fontBoundingBoxAscent)&&void 0!==u?u:91*g,fontBoundingBoxDescent:null!==(l=d.fontBoundingBoxDescent)&&void 0!==l?l:21*g,hangingBaseline:null!==(h=d.hangingBaseline)&&void 0!==h?h:72.80000305175781*g,ideographicBaseline:null!==(c=d.ideographicBaseline)&&void 0!==c?c:-21*g,width:d.width,height:f}}_getContextFont(){return this.fontStyle()+m+this.fontVariant()+m+(this.fontSize()+"px ")+this.fontFamily().split(",").map(e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e}).join(", ")}_addTextLine(e){this.align()===d&&(e=e.trim());const t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){const t=this.letterSpacing(),n=e.length;return w().measureText(e).width+t*n}_setTextData(){let e=this.text().split("\n"),t=+this.fontSize(),n=0,i=this.lineHeight()*t,r=this.attrs.width,a=this.attrs.height,o=r!==h&&void 0!==r,s=a!==h&&void 0!==a,u=this.padding(),c=r-2*u,d=a-2*u,p=0,f=this.wrap(),g="char"!==f&&f!==v,y=this.ellipsis();this.textArr=[],w().font=this._getContextFont();const b=y?this._getTextWidth("…"):0;for(let t=0,r=e.length;tc)for(;a.length>0;){let e=0,t=l(a).length,r="",o=0;for(;e>>1,u=l(a).slice(0,n+1).join(""),h=this._getTextWidth(u);(y&&s&&p+i>d?h+b:h)<=c?(e=n+1,r=u,o=h):t=n}if(!r)break;if(g){const t=l(a),n=l(r),i=t[n.length];let s;if((i===m||"-"===i)&&o<=c)s=n.length;else{const e=n.lastIndexOf(m),t=n.lastIndexOf("-");s=Math.max(e,t)+1}s>0&&(e=s,r=t.slice(0,e).join(""),o=this._getTextWidth(r))}if(r=r.trimRight(),this._addTextLine(r),n=Math.max(n,o),p+=i,this._shouldHandleEllipsis(p)){this._tryToAddEllipsisToLastLine();break}if(a=l(a).slice(e).join("").trimLeft(),a.length>0&&(u=this._getTextWidth(a),u<=c)){this._addTextLine(a),p+=i,n=Math.max(n,u);break}}else this._addTextLine(a),p+=i,n=Math.max(n,u),this._shouldHandleEllipsis(p)&&td)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,i=this.attrs.height,r=i!==h&&void 0!==i,a=i-2*this.padding();return!(this.wrap()!==v)||r&&e+n>a}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==h&&void 0!==e,n=e-2*this.padding(),i=this.ellipsis(),r=this.textArr[this.textArr.length-1];r&&i&&(t&&(this._getTextWidth(r.text+"…"){"use strict";n.d(t,{Ay:()=>Pe});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n1)throw new RangeError("integer-width stems only accept a single optional option");r.options[0].replace(B,function(e,n,i,r,a,o){if(n)t.minimumIntegerDigits=i.length;else{if(r&&a)throw new Error("We currently do not support maximum integer digits");if(o)throw new Error("We currently do not support exact integer digits")}return""});continue}if(F.test(r.stem))t.minimumIntegerDigits=r.stem.length;else if(O.test(r.stem)){if(r.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");r.stem.replace(O,function(e,n,i,r,a,o){return"*"===i?t.minimumFractionDigits=n.length:r&&"#"===r[0]?t.maximumFractionDigits=r.length:a&&o?(t.minimumFractionDigits=a.length,t.maximumFractionDigits=a.length+o.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),""});var o=r.options[0];"w"===o?t=a(a({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=a(a({},t),j(o)))}else if(U.test(r.stem))t=a(a({},t),j(r.stem));else{var s=G(r.stem);s&&(t=a(a({},t),s));var u=H(r.stem);u&&(t=a(a({},t),u))}}return t}var z,K={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function X(e){var t=e.hourCycle;if(void 0===t&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n,i=e.language;return"root"!==i&&(n=e.maximize().region),(K[n||""]||K[i||""]||K["".concat(i,"-001")]||K["001"])[0]}var Y=new RegExp("^".concat(P.source,"*")),q=new RegExp("".concat(P.source,"*$"));function Z(e,t){return{start:e,end:t}}var J=!!String.prototype.startsWith&&"_a".startsWith("a",1),Q=!!String.fromCodePoint,$=!!Object.fromEntries,ee=!!String.prototype.codePointAt,te=!!String.prototype.trimStart,ne=!!String.prototype.trimEnd,ie=Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},re=!0;try{re="a"===(null===(z=de("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===z?void 0:z[0])}catch(e){re=!1}var ae,oe=J?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},se=Q?String.fromCodePoint:function(){for(var e=[],t=0;ta;){if((n=e[a++])>1114111)throw RangeError(n+" is not a valid code point");i+=n<65536?String.fromCharCode(n):String.fromCharCode(55296+((n-=65536)>>10),n%1024+56320)}return i},ue=$?Object.fromEntries:function(e){for(var t={},n=0,i=e;n=n)){var i,r=e.charCodeAt(t);return r<55296||r>56319||t+1===n||(i=e.charCodeAt(t+1))<56320||i>57343?r:i-56320+(r-55296<<10)+65536}},he=te?function(e){return e.trimStart()}:function(e){return e.replace(Y,"")},ce=ne?function(e){return e.trimEnd()}:function(e){return e.replace(q,"")};function de(e,t){return new RegExp(e,t)}if(re){var pe=de("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");ae=function(e,t){var n;return pe.lastIndex=t,null!==(n=pe.exec(e)[1])&&void 0!==n?n:""}}else ae=function(e,t){for(var n=[];;){var i=le(e,t);if(void 0===i||ye(i)||be(i))break;n.push(i),t+=i>=65536?2:1}return se.apply(void 0,n)};var fe,ge=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,n){for(var i=[];!this.isEOF();){var r=this.char();if(123===r){if((a=this.parseArgument(e,n)).err)return a;i.push(a.val)}else{if(125===r&&e>0)break;if(35!==r||"plural"!==t&&"selectordinal"!==t){if(60===r&&!this.ignoreTag&&47===this.peek()){if(n)break;return this.error(d.UNMATCHED_CLOSING_TAG,Z(this.clonePosition(),this.clonePosition()))}if(60===r&&!this.ignoreTag&&me(this.peek()||0)){if((a=this.parseTag(e,t)).err)return a;i.push(a.val)}else{var a;if((a=this.parseLiteral(e,t)).err)return a;i.push(a.val)}}else{var o=this.clonePosition();this.bump(),i.push({type:p.pound,location:Z(o,this.clonePosition())})}}}return{val:i,err:null}},e.prototype.parseTag=function(e,t){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:p.literal,value:"<".concat(i,"/>"),location:Z(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var r=this.parseMessage(e+1,t,!0);if(r.err)return r;var a=r.val,o=this.clonePosition();if(this.bumpIf("")?{val:{type:p.tag,value:i,children:a,location:Z(n,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,Z(o,this.clonePosition())))}return this.error(d.UNCLOSED_TAG,Z(n,this.clonePosition()))}return this.error(d.INVALID_TAG,Z(n,this.clonePosition()))},e.prototype.parseTagName=function(){var e=this.offset();for(this.bump();!this.isEOF()&&ve(this.char());)this.bump();return this.message.slice(e,this.offset())},e.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),i="";;){var r=this.tryParseQuote(t);if(r)i+=r;else{var a=this.tryParseUnquoted(e,t);if(a)i+=a;else{var o=this.tryParseLeftAngleBracket();if(!o)break;i+=o}}}var s=Z(n,this.clonePosition());return{val:{type:p.literal,value:i,location:s},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(me(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(39===n){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(n);this.bump()}return se.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return 60===n||123===n||35===n&&("plural"===t||"selectordinal"===t)||125===n&&e>0?null:(this.bump(),se(n))},e.prototype.parseArgument=function(e,t){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(n,this.clonePosition()));if(125===this.char())return this.bump(),this.error(d.EMPTY_ARGUMENT,Z(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(d.MALFORMED_ARGUMENT,Z(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:p.argument,value:i,location:Z(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(n,this.clonePosition())):this.parseArgumentOptions(e,t,i,n);default:return this.error(d.MALFORMED_ARGUMENT,Z(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=ae(this.message,t),i=t+n.length;return this.bumpTo(i),{value:n,location:Z(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,n,i){var r,o=this.clonePosition(),s=this.parseIdentifierIfPossible().value,u=this.clonePosition();switch(s){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,Z(o,u));case"number":case"date":case"time":this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var h=this.clonePosition();if((w=this.parseSimpleArgStyleIfPossible()).err)return w;if(0===(v=ce(w.val)).length)return this.error(d.EXPECT_ARGUMENT_STYLE,Z(this.clonePosition(),this.clonePosition()));l={style:v,styleLocation:Z(h,this.clonePosition())}}if((S=this.tryParseArgumentClose(i)).err)return S;var c=Z(i,this.clonePosition());if(l&&oe(null==l?void 0:l.style,"::",0)){var g=he(l.style.slice(2));if("number"===s)return(w=this.parseNumberSkeletonFromString(g,l.styleLocation)).err?w:{val:{type:p.number,value:n,location:c,style:w.val},err:null};if(0===g.length)return this.error(d.EXPECT_DATE_TIME_SKELETON,c);var m=g;this.locale&&(m=function(e,t){for(var n="",i=0;i>1),u=X(t);for("H"!=u&&"k"!=u||(s=0);s-- >0;)n+="a";for(;o-- >0;)n=u+n}else n+="J"===r?"H":r}return n}(g,this.locale));var v={type:f.dateTime,pattern:m,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?D(m):{}};return{val:{type:"date"===s?p.date:p.time,value:n,location:c,style:v},err:null}}return{val:{type:"number"===s?p.number:"date"===s?p.date:p.time,value:n,location:c,style:null!==(r=null==l?void 0:l.style)&&void 0!==r?r:null},err:null};case"plural":case"selectordinal":case"select":var y=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,Z(y,a({},y)));this.bumpSpace();var b=this.parseIdentifierIfPossible(),_=0;if("select"!==s&&"offset"===b.value){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Z(this.clonePosition(),this.clonePosition()));var w;if(this.bumpSpace(),(w=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return w;this.bumpSpace(),b=this.parseIdentifierIfPossible(),_=w.val}var S,T=this.tryParsePluralOrSelectOptions(e,s,t,b);if(T.err)return T;if((S=this.tryParseArgumentClose(i)).err)return S;var A=Z(i,this.clonePosition());return"select"===s?{val:{type:p.select,value:n,options:ue(T.val),location:A},err:null}:{val:{type:p.plural,value:n,options:ue(T.val),offset:_,pluralType:"plural"===s?"cardinal":"ordinal",location:A},err:null};default:return this.error(d.INVALID_ARGUMENT_TYPE,Z(o,u))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Z(n,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var n=[];try{n=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],n=0,i=e.split(R).filter(function(e){return e.length>0});n=48&&o<=57))break;r=!0,a=10*a+(o-48),this.bump()}var s=Z(i,this.clonePosition());return r?ie(a*=n)?{val:a,err:null}:this.error(t,s):this.error(e,s)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=le(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(oe(this.message,e,this.offset())){for(var t=0;t=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&ye(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),n=this.message.charCodeAt(t+(e>=65536?2:1));return null!=n?n:null},e}();function me(e){return e>=97&&e<=122||e>=65&&e<=90}function ve(e){return 45===e||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function ye(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function be(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function _e(e){e.forEach(function(e){if(delete e.location,E(e)||x(e))for(var t in e.options)delete e.options[t].location,_e(e.options[t].value);else S(e)&&I(e.style)||(T(e)||A(e))&&M(e.style)?delete e.style.location:k(e)&&_e(e.children)})}function we(e,t){void 0===t&&(t={}),t=a({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new ge(e,t).parse();if(n.err){var i=SyntaxError(d[n.err.kind]);throw i.location=n.err.location,i.originalMessage=n.err.message,i}return(null==t?void 0:t.captureLocation)||_e(n.val),n.val}!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(fe||(fe={}));var Se,Te=function(e){function t(t,n,i){var r=e.call(this,t)||this;return r.code=n,r.originalMessage=i,r}return r(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Ae=function(e){function t(t,n,i,r){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(n,'". Options are "').concat(Object.keys(i).join('", "'),'"'),fe.INVALID_VALUE,r)||this}return r(t,e),t}(Te),Ee=function(e){function t(t,n,i){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(n),fe.INVALID_VALUE,i)||this}return r(t,e),t}(Te),xe=function(e){function t(t,n){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(n,'"'),fe.MISSING_VALUE,n)||this}return r(t,e),t}(Te);function Ce(e){return"function"==typeof e}function ke(e,t,n,i,r,a,o){if(1===e.length&&_(e[0]))return[{type:Se.literal,value:e[0].value}];for(var s=[],u=0,l=e;u0?new Intl.Locale(t[0]):new Intl.Locale("string"==typeof e?e:e[0])}},e.__parse=we,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();const Pe=Me},2726:(e,t)=>{function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:i,scale:i?4:r,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){const i=t.getScale(e,n);return Math.floor((e+2*n.margin)*i)},t.qrToImageData=function(e,n,i){const r=n.modules.size,a=n.modules.data,o=t.getScale(r,i),s=Math.floor((r+2*i.margin)*o),u=i.margin*o,l=[i.color.light,i.color.dark];for(let t=0;t=u&&n>=u&&t{const n=new Uint8Array(512),i=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)n[t]=e,i[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)n[e]=n[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return i[e]},t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[i[e]+i[t]]}},3318:(e,t)=>{!function(){"use strict";var n={};function i(e){return c(">"+p("B",e.length),e)}function r(e){return c(">"+p("H",e.length),e)}function a(e){return c(">"+p("L",e.length),e)}function o(e,t,n){var o,s,u,l,h="",d="";if("Byte"==t)(o=e.length)<=4?d=i(e)+p("\0",4-o):(d=c(">L",[n]),h=i(e));else if("Short"==t)(o=e.length)<=2?d=r(e)+p("\0\0",2-o):(d=c(">L",[n]),h=r(e));else if("Long"==t)(o=e.length)<=1?d=a(e):(d=c(">L",[n]),h=a(e));else if("Ascii"==t)(o=(s=e+"\0").length)>4?(d=c(">L",[n]),h=s):d=s+p("\0",4-o);else if("Rational"==t){if("number"==typeof e[0])o=1,u=e[0],l=e[1],s=c(">L",[u])+c(">L",[l]);else{o=e.length,s="";for(var f=0;fL",[u])+c(">L",[l])}d=c(">L",[n]),h=s}else if("SRational"==t){if("number"==typeof e[0])o=1,u=e[0],l=e[1],s=c(">l",[u])+c(">l",[l]);else for(o=e.length,s="",f=0;fl",[u])+c(">l",[l]);d=c(">L",[n]),h=s}else"Undefined"==t&&((o=e.length)>4?(d=c(">L",[n]),h=e):d=e+p("\0",4-o));return[c(">L",[o]),d,h]}function s(e,t,n){var i,r=Object.keys(e).length,a=c(">H",[r]);i=["0th","1st"].indexOf(t)>-1?2+12*r+4:2+12*r;var s="",u="";for(var l in e)if("string"==typeof l&&(l=parseInt(l)),!("0th"==t&&[34665,34853].indexOf(l)>-1||"Exif"==t&&40965==l||"1st"==t&&[513,514].indexOf(l)>-1)){var h=e[l],d=c(">H",[l]),p=m[t][l].type,f=c(">H",[g[p]]);"number"==typeof h&&(h=[h]);var v=o(h,p,8+i+n+u.length);s+=d+f+v[0]+v[1],u+=v[2]}return[a+s,u]}function u(e){var t;if("ÿØ"==e.slice(0,2))t=function(e){for(var t,n=0;n-1)this.tiftag=e;else{if("Exif"!=e.slice(0,4))throw new Error("Given file is neither JPEG nor TIFF.");this.tiftag=e.slice(6)}}if(n.version="1.0.4",n.remove=function(e){var t=!1;if("ÿØ"==e.slice(0,2));else{if("data:image/jpeg;base64,"!=e.slice(0,23)&&"data:image/jpg;base64,"!=e.slice(0,22))throw new Error("Given data is not jpeg.");e=h(e.split(",")[1]),t=!0}var n=f(e).filter(function(e){return!("ÿá"==e.slice(0,2)&&"Exif\0\0"==e.slice(4,10))}).join("");return t&&(n="data:image/jpeg;base64,"+l(n)),n},n.insert=function(e,t){var n=!1;if("Exif\0\0"!=e.slice(0,6))throw new Error("Given data is not exif.");if("ÿØ"==t.slice(0,2));else{if("data:image/jpeg;base64,"!=t.slice(0,23)&&"data:image/jpg;base64,"!=t.slice(0,22))throw new Error("Given data is not jpeg.");t=h(t.split(",")[1]),n=!0}var i="ÿá"+c(">H",[e.length+2])+e,r=function(e,t){var n=!1,i=[];return e.forEach(function(r,a){"ÿá"==r.slice(0,2)&&"Exif\0\0"==r.slice(4,10)&&(n?i.unshift(a):(e[a]=t,n=!0))}),i.forEach(function(t){e.splice(t,1)}),!n&&t&&(e=[e[0],t].concat(e.slice(1))),e.join("")}(f(t),i);return n&&(r="data:image/jpeg;base64,"+l(r)),r},n.load=function(e){var t;if("string"!=typeof e)throw new Error("'load' gots invalid type argument.");if("ÿØ"==e.slice(0,2))t=e;else if("data:image/jpeg;base64,"==e.slice(0,23)||"data:image/jpg;base64,"==e.slice(0,22))t=h(e.split(",")[1]);else{if("Exif"!=e.slice(0,4))throw new Error("'load' gots invalid file data.");t=e.slice(6)}var n={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null},i=new u(t);if(null===i.tiftag)return n;"II"==i.tiftag.slice(0,2)?i.endian_mark="<":i.endian_mark=">";var r=d(i.endian_mark+"L",i.tiftag.slice(4,8))[0];n["0th"]=i.get_ifd(r,"0th");var a=n["0th"].first_ifd_pointer;if(delete n["0th"].first_ifd_pointer,34665 in n["0th"]&&(r=n["0th"][34665],n.Exif=i.get_ifd(r,"Exif")),34853 in n["0th"]&&(r=n["0th"][34853],n.GPS=i.get_ifd(r,"GPS")),40965 in n.Exif&&(r=n.Exif[40965],n.Interop=i.get_ifd(r,"Interop")),"\0\0\0\0"!=a&&(r=d(i.endian_mark+"L",a)[0],n["1st"]=i.get_ifd(r,"1st"),513 in n["1st"]&&514 in n["1st"])){var o=n["1st"][513]+n["1st"][514],s=i.tiftag.slice(n["1st"][513],o);n.thumbnail=s}return n},n.dump=function(e){var t,i,r,a,o,u,l=(t=e,JSON.parse(JSON.stringify(t))),h=!1,d=!1,p=!1,m=!1;i="0th"in l?l["0th"]:{},"Exif"in l&&Object.keys(l.Exif).length||"Interop"in l&&Object.keys(l.Interop).length?(i[34665]=1,h=!0,r=l.Exif,"Interop"in l&&Object.keys(l.Interop).length?(r[40965]=1,p=!0,a=l.Interop):Object.keys(r).indexOf(n.ExifIFD.InteroperabilityTag.toString())>-1&&delete r[40965]):Object.keys(i).indexOf(n.ImageIFD.ExifTag.toString())>-1&&delete i[34665],"GPS"in l&&Object.keys(l.GPS).length?(i[n.ImageIFD.GPSTag]=1,d=!0,o=l.GPS):Object.keys(i).indexOf(n.ImageIFD.GPSTag.toString())>-1&&delete i[n.ImageIFD.GPSTag],"1st"in l&&"thumbnail"in l&&null!=l.thumbnail&&(m=!0,l["1st"][513]=1,l["1st"][514]=1,u=l["1st"]);var v,y,b,_=s(i,"0th",0),w=_[0].length+12*h+12*d+4+_[1].length,S="",T=0,A="",E=0,x="",C=0,k="";if(h&&(T=(v=s(r,"Exif",w))[0].length+12*p+v[1].length),d&&(E=(A=s(o,"GPS",w+T).join("")).length),p&&(C=(x=s(a,"Interop",w+T+E).join("")).length),m&&(y=s(u,"1st",w+T+E+C),(b=function(e){for(var t=f(e);"ÿà"<=t[1].slice(0,2)&&t[1].slice(0,2)<="ÿï";)t=[t[0]].concat(t.slice(2));return t.join("")}(l.thumbnail)).length>64e3))throw new Error("Given thumbnail is too large. max 64kB");var I="",M="",P="",L="\0\0\0\0";if(h){var D=c(">L",[R=8+w]);I=c(">H",[34665])+c(">H",[g.Long])+c(">L",[1])+D}if(d&&(D=c(">L",[R=8+w+T]),M=c(">H",[34853])+c(">H",[g.Long])+c(">L",[1])+D),p&&(D=c(">L",[R=8+w+T+E]),P=c(">H",[40965])+c(">H",[g.Long])+c(">L",[1])+D),m){var R;L=c(">L",[R=8+w+T+E+C]);var N="\0\0\0\0"+c(">L",[R+y[0].length+24+4+y[1].length]),O="\0\0\0\0"+c(">L",[b.length]);k=y[0]+N+O+"\0\0\0\0"+y[1]+b}var U=_[0]+I+M+L+_[1];return h&&(S=v[0]+P+v[1]),"Exif\0\0MM\0*\0\0\0\b"+U+S+A+x+k},u.prototype={get_ifd:function(e,t){var n,i={},r=d(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],a=e+2;n=["0th","1st"].indexOf(t)>-1?"Image":t;for(var o=0;o4?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("B",r),this.tiftag.slice(t,t+r))):n=d(this.endian_mark+p("B",r),a.slice(0,r));else if(2==i)r>4?(t=d(this.endian_mark+"L",a)[0],n=this.tiftag.slice(t,t+r-1)):n=a.slice(0,r-1);else if(3==i)r>2?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("H",r),this.tiftag.slice(t,t+2*r))):n=d(this.endian_mark+p("H",r),a.slice(0,2*r));else if(4==i)r>1?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("L",r),this.tiftag.slice(t,t+4*r))):n=d(this.endian_mark+p("L",r),a);else if(5==i)if(t=d(this.endian_mark+"L",a)[0],r>1){n=[];for(var o=0;o4?(t=d(this.endian_mark+"L",a)[0],n=this.tiftag.slice(t,t+r)):n=a.slice(0,r);else if(9==i)r>1?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("l",r),this.tiftag.slice(t,t+4*r))):n=d(this.endian_mark+p("l",r),a);else{if(10!=i)throw new Error("Exif might be wrong. Got incorrect value type to decode. type:"+i);if(t=d(this.endian_mark+"L",a)[0],r>1)for(n=[],o=0;o>2,a=(3&t)<<4|(n=e.charCodeAt(l++))>>4,o=(15&n)<<2|(i=e.charCodeAt(l++))>>6,s=63&i,isNaN(n)?o=s=64:isNaN(i)&&(s=64),u=u+h.charAt(r)+h.charAt(a)+h.charAt(o)+h.charAt(s);return u}),"undefined"!=typeof window&&"function"==typeof window.atob)var h=window.atob;function c(e,t){if(!(t instanceof Array))throw new Error("'pack' error. Got invalid type argument.");if(e.length-1!=t.length)throw new Error("'pack' error. "+(e.length-1)+" marks, "+t.length+" elements.");var n;if("<"==e[0])n=!0;else{if(">"!=e[0])throw new Error("");n=!1}for(var i="",r=1,a=null,o=null,s=null;o=e[r];){if("b"==o.toLowerCase()){if(a=t[r-1],"b"==o&&a<0&&(a+=256),a>255||a<0)throw new Error("'pack' error.");s=String.fromCharCode(a)}else if("H"==o){if((a=t[r-1])>65535||a<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(a%65536/256))+String.fromCharCode(a%256),n&&(s=s.split("").reverse().join(""))}else{if("l"!=o.toLowerCase())throw new Error("'pack' error.");if(a=t[r-1],"l"==o&&a<0&&(a+=4294967296),a>4294967295||a<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(a/16777216))+String.fromCharCode(Math.floor(a%16777216/65536))+String.fromCharCode(Math.floor(a%65536/256))+String.fromCharCode(a%256),n&&(s=s.split("").reverse().join(""))}i+=s,r+=1}return i}function d(e,t){if("string"!=typeof t)throw new Error("'unpack' error. Got invalid type argument.");for(var n,i=0,r=1;r"!=e[0])throw new Error("'unpack' error.");n=!1}for(var a=[],o=0,s=1,u=null,l=null,h=null,c="";l=e[s];){if("b"==l.toLowerCase())h=1,u=(c=t.slice(o,o+h)).charCodeAt(0),"b"==l&&u>=128&&(u-=256);else if("H"==l)h=2,c=t.slice(o,o+h),n&&(c=c.split("").reverse().join("")),u=256*c.charCodeAt(0)+c.charCodeAt(1);else{if("l"!=l.toLowerCase())throw new Error("'unpack' error. "+l);h=4,c=t.slice(o,o+h),n&&(c=c.split("").reverse().join("")),u=16777216*c.charCodeAt(0)+65536*c.charCodeAt(1)+256*c.charCodeAt(2)+c.charCodeAt(3),"l"==l&&u>=2147483648&&(u-=4294967296)}a.push(u),o+=h,s+=1}return a}function p(e,t){for(var n="",i=0;iH",e.slice(t+2,t+4))[0]+2;if(n.push(e.slice(t,i)),(t=i)>=e.length)throw new Error("Wrong JPEG data.")}return n}void 0===h&&(h=function(e){var t,n,i,r,a,o,s="",u=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u>4,n=(15&r)<<4|(a=l.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(o=l.indexOf(e.charAt(u++))),s+=String.fromCharCode(t),64!=a&&(s+=String.fromCharCode(n)),64!=o&&(s+=String.fromCharCode(i));return s});var g={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10},m={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};m["0th"]=m.Image,m["1st"]=m.Image,n.TAGS=m,n.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041},n.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240},n.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31},n.InteropIFD={InteroperabilityIndex:1},n.GPSHelper={degToDmsRational:function(e){var t=Math.abs(e),n=t%1*60,i=n%1*60;return[[Math.floor(t),1],[Math.floor(n),1],[Math.round(100*i),100]]},dmsRationalToDeg:function(e,t){var n="S"===t||"W"===t?-1:1;return(e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600)*n}},e.exports&&(t=e.exports=n),t.piexif=n}()},3443:(e,t,n)=>{"use strict";t.N=void 0;const i=n(4892),r=n(8871),a=n(4723),o=n(5483);function s(e,t,n,i,r,a,o){const s=Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2)),u=Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2)),l=o*s/(s+u),h=o*u/(s+u);return[n-l*(r-e),i-l*(a-t),n+h*(r-e),i+h*(a-t)]}function u(e,t){const n=e.length,i=[];for(let r=2;r4){const i=this.getTensionPoints(),a=i.length;for(o=r?0:4,r||e.quadraticCurveTo(i[0],i[1],i[2],i[3]);o{!function(){var e="undefined"!=typeof window?window:n.g,i={};for(var r in function(e,t,n){var i;function r(e){var t=0;return function(){return t>>0)+"_",i=0;return function e(r){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(r||"")+"_"+i++,r)}}),s("Symbol.iterator",function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var t="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),n=0;n(t=t||0)&&(t=Math.max(t+i,0));ti||1114111=i?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode(i>>>10&1023|55296),t+=String.fromCharCode(1023&i|56320))}return t}}),s("Array.prototype.findIndex",function(e){return e||function(e,t){return U(this,e,t).Yi}}),s("WeakSet",function(e){function t(e){if(this.g=new WeakMap,e){e=l(e);for(var t;!(t=e.next()).done;)this.add(t.value)}}return function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),i=new e([t]);return!(!i.has(t)||i.has(n))&&(i.delete(t),i.add(n),!i.has(t)&&i.has(n))}catch(e){return!1}}()?e:(t.prototype.add=function(e){return this.g.set(e,!0),this},t.prototype.has=function(e){return this.g.has(e)},t.prototype.delete=function(e){return this.g.delete(e)},t)}),s("Array.prototype.find",function(e){return e||function(e,t){return U(this,e,t).v}}),s("String.prototype.startsWith",function(e){return e||function(e,t){var n=O(this,e,"startsWith"),i=n.length,r=e.length;t=Math.max(0,Math.min(0|t,n.length));for(var a=0;a=r}}),s("Object.entries",function(e){return e||function(e){var t,n=[];for(t in e)R(e,t)&&n.push([t,e[t]]);return n}});var B="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n(e=Math.trunc(e)||0)&&(e+=this.length),!(0>e||e>=this.length))return this[e]}function j(e){return e||F}s("Object.assign",function(e){return e||B}),s("Promise.prototype.finally",function(e){return e||function(e){return this.then(function(t){return Promise.resolve(e()).then(function(){return t})},function(t){return Promise.resolve(e()).then(function(){throw t})})}}),s("Array.prototype.entries",function(e){return e||function(){return N(this,function(e,t){return[e,t]})}}),s("Number.isNaN",function(e){return e||function(e){return"number"==typeof e&&isNaN(e)}}),s("String.prototype.repeat",function(e){return e||function(e){var t=O(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return n}}),s("Number.EPSILON",function(){return Math.pow(2,-52)}),s("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991}),s("Number.isFinite",function(e){return e||function(e){return"number"==typeof e&&!isNaN(e)&&1/0!==e&&-1/0!==e}}),s("Object.values",function(e){return e||function(e){var t,n=[];for(t in e)R(e,t)&&n.push(e[t]);return n}}),s("Math.log2",function(e){return e||function(e){return Math.log(e)/Math.LN2}}),s("String.prototype.endsWith",function(e){return e||function(e,t){var n=O(this,e,"endsWith");void 0===t&&(t=n.length),t=Math.max(0,Math.min(0|t,n.length));for(var i=e.length;0=i}}),s("Math.trunc",function(e){return e||function(e){if(e=Number(e),isNaN(e)||1/0===e||-1/0===e||0===e)return e;var t=Math.floor(Math.abs(e));return 0>e?-t:t}}),s("Array.prototype.at",function(e){return e||F}),s("Int8Array.prototype.at",j),s("Uint8Array.prototype.at",j),s("Uint8ClampedArray.prototype.at",j),s("Int16Array.prototype.at",j),s("Uint16Array.prototype.at",j),s("Int32Array.prototype.at",j),s("Uint32Array.prototype.at",j),s("Float32Array.prototype.at",j),s("Float64Array.prototype.at",j),s("String.prototype.at",function(e){return e||F});var G=this||self;function H(e,t){e=e.split(".");var n,i=G;e[0]in i||void 0===i.execScript||i.execScript("var "+e[0]);for(;e.length&&(n=e.shift());)e.length||void 0===t?i=i[n]&&i[n]!==Object.prototype[n]?i[n]:i[n]={}:i[n]=t}function V(t,n){if(n)if(n instanceof Map)for(var i=l(n.keys()),r=i.next();!r.done;r=i.next())r=r.value,Object.defineProperty(this,r,{value:n.get(r),writable:!0,enumerable:!0});else for(i in n)Object.defineProperty(this,i,{value:n[i],writable:!0,enumerable:!0});this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=e.performance&&e.performance.now?e.performance.now():Date.now(),this.type=t,this.isTrusted=!1,this.target=this.currentTarget=null,this.g=!1}function W(e){var t,n=new V(e.type);for(t in e)Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0});return n}V.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},V.prototype.stopImmediatePropagation=function(){this.g=!0},V.prototype.stopPropagation=function(){},H("shaka.util.FakeEvent",V);var z={ym:"abrstatuschanged",zm:"adaptation",Am:"audiotrackchanged",Bm:"audiotrackschanged",Cm:"boundarycrossed",Dm:"buffering",Em:"canupdatestarttime",Fm:"complete",Gm:"currentitemchanged",Hm:"downloadcompleted",Im:"downloadfailed",Jm:"downloadheadersreceived",Km:"drmsessionupdate",Mm:"emsg",Sm:"itemsinserted",Tm:"itemsremoved",mn:"prft",Error:"error",Nm:"expirationupdated",Om:"firstquartile",Pm:"gapjumped",Um:"keystatuschanged",Ym:"loaded",Zm:"loading",an:"manifestparsed",cn:"manifestupdated",dn:"mediaqualitychanged",fn:"mediasourcerecovered",gn:"metadataadded",Metadata:"metadata",hn:"midpoint",jn:"nospatialvideoinfo",ln:"onstatechange",nn:"ratechange",qn:"segmentappended",rn:"sessiondata",sn:"spatialvideoinfo",tn:"stalldetected",un:"started",vn:"statechanged",wn:"streaming",xn:"textchanged",yn:"texttrackvisibility",zn:"thirdquartile",An:"timelineregionadded",Bn:"timelineregionenter",Cn:"timelineregionexit",Dn:"trackschanged",Fn:"unloading",Hn:"variantchanged"};function K(){}function X(){}function Y(){}function q(e){var t=D.apply(1,arguments);J.has(e)||(J.add(e),Y.apply(K,h(t)))}function Z(){}var J=new Set;function Q(){this.g=new Map}function $(){this.gb=new Q,this.Se=this}function ee(e,t){for(var n=[],i=(e=l(e)).next();!i.done;i=e.next())n.push(t(i.value));return n}function te(e,t){for(var n=(e=l(e)).next();!n.done;n=e.next())if(t(n.value))return!0;return!1}function ne(e,t){for(var n=[],i=(e=l(e)).next();!i.done;i=e.next())t(i=i.value)&&n.push(i);return n}e.console&&((new Map).set(1,function(){return console.error.apply(console,h(D.apply(0,arguments)))}).set(2,function(){return console.warn.apply(console,h(D.apply(0,arguments)))}).set(3,function(){return console.info.apply(console,h(D.apply(0,arguments)))}).set(4,function(){return console.log.apply(console,h(D.apply(0,arguments)))}).set(5,function(){return console.debug.apply(console,h(D.apply(0,arguments)))}).set(6,function(){return console.debug.apply(console,h(D.apply(0,arguments)))}),Y=function(){return console.warn.apply(console,h(D.apply(0,arguments)))},X=function(){console.error.apply(console,h(D.apply(0,arguments)))}),(i=Q.prototype).push=function(e,t){this.g.has(e)?this.g.get(e).push(t):this.g.set(e,[t])},i.get=function(e){return this.g.has(e)?this.g.get(e).slice():null},i.remove=function(e,t){if(this.g.has(e)){var n=this.g.get(e).filter(function(e){return e!=t});this.g.set(e,n),n.length||this.g.delete(e)}},i.forEach=function(e){this.g.forEach(function(t,n){e(n,t)})},i.size=function(){return this.g.size},i.keys=function(){return Array.from(this.g.keys())},$.prototype.addEventListener=function(e,t){this.gb&&this.gb.push(e,t)},$.prototype.removeEventListener=function(e,t){this.gb&&this.gb.remove(e,t)},$.prototype.dispatchEvent=function(e){if(!this.gb)return!0;var t=this.gb.get(e.type)||[],n=this.gb.get("All");for(n&&(t=t.concat(n)),n=(t=l(t)).next();!n.done;n=t.next()){n=n.value,e.target=this.Se,e.currentTarget=this.Se;try{n.handleEvent?n.handleEvent(e):n.call(this,e)}catch(e){}if(e.g)break}return e.defaultPrevented},$.prototype.release=function(){this.gb=null};var ie=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");function re(e){var t;e instanceof re?(ae(this,e.jc),this.ud=e.ud,oe(this,e.Gb),se(this,e.Md),this.vb=e.vb,ue(this,e.g.clone()),this.$c=e.$c):e&&(t=String(e).match(ie))?(ae(this,t[1]||"",!0),this.ud=le(t[2]||""),oe(this,t[3]||"",!0),se(this,t[4]),this.vb=le(t[5]||"",!0),ue(this,t[6]||"",!0),this.$c=le(t[7]||"")):this.g=new ve(null)}function ae(e,t,n){e.jc=n?le(t,!0):t,e.jc&&(e.jc=e.jc.replace(/:$/,""))}function oe(e,t,n){e.Gb=n?le(t,!0):t}function se(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.Md=t}else e.Md=null}function ue(e,t,n){t instanceof ve?e.g=t:(n||(t=he(t,ge)),e.g=new ve(t))}function le(e,t){return e?t?decodeURI(e):decodeURIComponent(e):""}function he(e,t,n){return null!=e?(e=encodeURI(e).replace(t,ce),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ce(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}(i=re.prototype).jc="",i.ud="",i.Gb="",i.Md=null,i.vb="",i.$c="",i.toString=function(){var e=[],t=this.jc;if(t&&e.push(he(t,de,!0),":"),t=this.Gb){e.push("//");var n=this.ud;n&&e.push(he(n,de,!0),"@"),e.push(encodeURIComponent(t).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(t=this.Md)&&e.push(":",String(t))}return(t=this.vb)&&(this.Gb&&"/"!=t.charAt(0)&&e.push("/"),e.push(he(t,"/"==t.charAt(0)?fe:pe,!0))),(t=this.g.toString())&&e.push("?",t),(t=this.$c)&&e.push("#",he(t,me)),e.join("")},i.resolve=function(e){var t=this.clone();"data"===t.jc&&(t=new re);var n=!!e.jc;n?ae(t,e.jc):n=!!e.ud,n?t.ud=e.ud:n=!!e.Gb,n?oe(t,e.Gb):n=null!=e.Md;var i=e.vb;if(n)se(t,e.Md);else if(n=!!e.vb){if("/"!=i.charAt(0))if(this.Gb&&!this.vb)i="/"+i;else{var r=t.vb.lastIndexOf("/");-1!=r&&(i=t.vb.substr(0,r+1)+i)}if(".."==i||"."==i)i="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var a=[],o=0;o=i+2&&192==(224&t[i])&&128==(192&t[i+1])?(r=(31&t[i])<<6|63&t[i+1],i+=1):t.length>=i+3&&224==(240&t[i])&&128==(192&t[i+1])&&128==(192&t[i+2])?(r=(15&t[i])<<12|(63&t[i+1])<<6|63&t[i+2],i+=2):t.length>=i+4&&240==(241&t[i])&&128==(192&t[i+1])&&128==(192&t[i+2])&&128==(192&t[i+3])&&(r=(7&t[i])<<18|(63&t[i+1])<<12|(63&t[i+2])<<6|63&t[i+3],i+=3):r=t[i],65535>=r)n+=String.fromCharCode(r);else{var a=1023&(r-=65536);n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+a)}}return n}function Oe(e,t,n){if(!e)return"";if(!n&&0!=e.byteLength%2)throw new Ce(2,2,2004);n=Math.floor(e.byteLength/2);var i=new Uint16Array(n);e=Ee(e);for(var r=0;r=n[e]}if(!e)return"";var n=Te(e);if(239==n[0]&&187==n[1]&&191==n[2])return Ne(n);if(254==n[0]&&255==n[1])return Oe(n.subarray(2),!1);if(255==n[0]&&254==n[1])return Oe(n.subarray(2),!0);if(0==n[0]&&0==n[2])return Oe(e,!1);if(0==n[1]&&0==n[3])return Oe(e,!0);if(t(0)&&t(1)&&t(2)&&t(3))return Ne(e);throw new Ce(2,2,2003)}function Be(t){if(e.TextEncoder&&!Me().ei()){var n=new TextEncoder;return Se(n.encode(t))}t=encodeURIComponent(t),t=unescape(t),n=new Uint8Array(t.length);for(var i=0;i",""":'"',"'":"'"," ":" ","‎":"‎","‏":"‏"},n=/&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g,i=RegExp(n.source);return e&&i.test(e)?e.replace(n,function(e){return"#"==e[1]?0<=(e="x"==e[2]||"X"==e[2]?parseInt(e.substring(3),16):parseInt(e.substring(2),10))&&1114111>=e?String.fromCodePoint(e):"":t[e]||"'"}):e||""}H("shaka.util.StringUtils",Re),Re.resetFromCharCode=function(){He.g=void 0},Re.toUTF16=Fe,Re.toUTF8=Be,Re.fromBytesAutoDetect=Ue,Re.fromUTF16=Oe,Re.fromUTF8=Ne;var He=new Ie(function(){function e(e){try{var t=new Uint8Array(e);return 0/= ".indexOf(e[i])&&e[i];)i++;return e.slice(t,i)}var i=0;return function r(a,o){o=void 0!==o&&o;for(var s=[];e[i];)if(60==e.charCodeAt(i)){if(47===e.charCodeAt(i+1)){o=i+2,i=e.indexOf(">",i);var u=(o=e.substring(o,i)).indexOf(a);if(-1==u){var l=a.indexOf(".");0",i+1);-1===i&&(i=e.length)}else if(91===e.charCodeAt(i+2)&&91===e.charCodeAt(i+8)&&"cdata"===e.substr(i+3,5).toLowerCase()){-1==(u=e.indexOf("]]>",i))?(s.push(e.substr(i+9)),i=e.length):(s.push(e.substring(i+9,u)),i=u+3);continue}i++;continue}e:{l=o,i++;var c=n(),d={};for(u=[];62!==e.charCodeAt(i)&&e[i];){var p=e.charCodeAt(i);if(64p||96p){p=n();for(var f=e.charCodeAt(i);f&&39!==f&&34!==f&&!(64f||96f)&&62!==f;)i++,f=e.charCodeAt(i);var g=i+1;if(i=e.indexOf(e[i],g),g=e.slice(g,i),39===f||34===f){if(-1===i){if(l={tagName:c,attributes:d,children:u,parent:null},t)for(c=0;cMath.abs(e.startTime-t.startTime)&&.001>Math.abs(e.endTime-t.endTime)))return!1;for(var n in e)if("startTime"!=n&&"endTime"!=n&&"payload"!=n)if("nestedCues"==n){if(!en(e.nestedCues,t.nestedCues,Xn))return!1}else if("region"==n||"cellResolution"==n){for(var i in e[n])if(e[n][i]!=t[n][i])return!1}else if(Array.isArray(e[n])){if(!en(e[n],t[n]))return!1}else if(e[n]!=t[n])return!1;return!0}function Yn(e,t){t=void 0===t?new Map:t;var n=e.payload;if(n.includes("<")){0===t.size&&qn(t);var i=n;n=[];for(var r=-1,a=0;a"===i[a]&&0",'
'),i+="
";e:{a=i,r=[];var o=-1;n="",i=!1;for(var s=0;s",s);if(-1===u){n=a;break e}if((u=a.substring(s+1,u))&&"v"==u){i=!0;var h=null;if(r.length&&(h=r[r.length-1]),h){if(h===u)n+="/"+u+">";else{if(!h.startsWith("v")){n+=a[s];continue}n+="/"+h+">"}s+=u.length+1}else n+=a[s]}else n+=a[s]}else"<"===a[s]?"v"!=a[o=s+1]&&(o=-1):">"===a[s]&&0","<"+o+">")).replace("",""),i||(n+="")}n=function(e){var t={"< ":""," >":" >"},n=/(< +>|<\s|\s>)/g,i=RegExp(n.source);return e&&i.test(e)?e.replace(n,function(e){return t[e]||""}):e||""}(n),e.payload="";try{var c=fn(""+n+"","span")}catch(e){}if(c)if(1!=(c=c.children).length||c[0].tagName)for(n=(c=l(c)).next();!n.done;n=c.next())Zn(n.value,e,t);else e.payload=Ge(n);else e.payload=Ge(n)}else e.payload=Ge(n)}function qn(e){for(var t=l(Object.entries(ui)),n=t.next();!n.done;n=t.next()){var i=l(n.value);n=i.next().value,i=i.next().value;var r=new zn(0,0,"");r.color=i,e.set("."+n,r)}for(n=(t=l(Object.entries(li))).next();!n.done;n=t.next())n=(i=l(n.value)).next().value,i=i.next().value,(r=new zn(0,0,"")).backgroundColor=i,e.set("."+n,r)}function Zn(e,t,n){var i=t.clone();if(i.nestedCues=[],i.payload="",i.rubyTag="",i.line=null,i.region=new Yt,i.position=null,i.size=0,i.textAlign=$n,e.tagName)for(var r=l(e.tagName.split(/(?=[ .])+/g)),a=r.next();!a.done;a=r.next()){var o=a=a.value;if(o.startsWith(".voice-")){var s=o.split("-").pop();o='v[voice="'+s+'"]',n.has(o)||(o="v[voice="+s+"]")}switch(n.has(o)&&(s=i,o=n.get(o))&&(s.backgroundColor=Jn(o.backgroundColor,s.backgroundColor),s.color=Jn(o.color,s.color),s.fontFamily=Jn(o.fontFamily,s.fontFamily),s.fontSize=Jn(o.fontSize,s.fontSize),s.textShadow=Jn(o.textShadow,s.textShadow),s.fontWeight=o.fontWeight,s.fontStyle=o.fontStyle,s.opacity=o.opacity,s.rubyTag=o.rubyTag,s.textCombineUpright=o.textCombineUpright,s.wrapLine=o.wrapLine),a){case"br":return i=Kn(i.startTime,i.endTime),void t.nestedCues.push(i);case"b":i.fontWeight=ci;break;case"i":i.fontStyle=pi;break;case"u":i.textDecoration.push(gi);break;case"font":(a=e.attributes.color)&&(i.color=a);break;case"div":if(!(a=e.attributes.time))break;(a=sn(a))&&(i.startTime=a);break;case"ruby":case"rp":case"rt":i.rubyTag=a}}if(r=e.children,mn(e)||1==r.length&&mn(r[0]))for(n=bn(e).split("\n"),e=!0,r=(n=l(n)).next();!r.done;r=n.next())r=r.value,e||(e=Kn(i.startTime,i.endTime),t.nestedCues.push(e)),0=n.h||(e<=n.g&&t>=n.h?n.g=n.h=null:e<=n.g&&tn.g&&t>=n.h&&(n.h=e)),w(i)})},H("shaka.text.TextEngine",Ui),Ui.prototype.destroy=Ui.prototype.destroy,Ui.findParser=Fi,Ui.unregisterParser=function(e){Vi.delete(e)},Ui.registerParser=Bi;var Vi=new Map;function Wi(e){this.h=e,this.g=null}function zi(e){this.h=e,this.g=null}function Ki(e,t){return e.concat(t)}function Xi(){}function Yi(e){return null!=e}function qi(e,t){return Promise.race([t,new Promise(function(t,n){new zi(n).X(e)})])}function Zi(){}function Ji(e,t,n,i,r){function a(e){var t=String(e.width||"")+String(e.height||"")+String(Math.round(e.frameRate||0))+(e.hdr||"")+e.fastSwitching;return e.dependencyStream&&(t+=e.dependencyStream.baseOriginalId||""),t}function o(e){var t=e.language+(e.channelsCount||0)+(e.audioSamplingRate||0)+e.roles.join(",")+e.label+e.groupId+e.fastSwitching;return e.dependencyStream&&(t+=e.dependencyStream.baseOriginalId||""),t}if(r.length){for(var s=e.textStreams,u=(r=l(r)).next(),c={};!u.done;c={ni:void 0},u=r.next())if(c.ni=u.value,(u=s.filter(function(e){return function(t){return!(!t.codecs.startsWith(e.ni)&&!t.mimeType.startsWith(e.ni))}}(c))).length){s=u;break}e.textStreams=s}if(s=e.variants,(t.length||n.length)&&(s=function(e,t,n){for(var i=(t=l(t)).next(),r={};!i.done;r={videoCodec:void 0},i=t.next())if(r.videoCodec=i.value,i=e.filter(function(e){return function(t){return t.video&&t.video.codecs.startsWith(e.videoCodec)}}(r)),i.length){e=i;break}for(t=(n=l(n)).next(),i={};!t.done;i={audioCodec:void 0},t=n.next())if(i.audioCodec=t.value,t=e.filter(function(e){return function(t){return t.audio&&t.audio.codecs.startsWith(e.audioCodec)}}(i)),t.length){e=t;break}return e}(s,t,n)),i.length){for(t=new Q,s=(n=l(s)).next();!s.done;s=n.next())s=s.value,t.push(String(s.video.width||0),s);var d=[];t.forEach(function(e,t){e=0;for(var n=[],r=(t=l(t)).next(),a={};!r.done;a={ug:void 0},r=t.next())a.ug=r.value,(r=i.filter(function(e){return function(t){return e.ug.decodingInfos[0][t]}}(a)).length)>e?(e=r,n=[a.ug]):r==e&&n.push(a.ug);d.push.apply(d,h(n))}),s=d}for(n=new Set,t=new Set,r=(s=l(s)).next();!r.done;r=s.next())(r=r.value).audio&&n.add(r.audio),r.video&&t.add(r.video);s=Array.from(n).sort(function(e,t){return e.bandwidth-t.bandwidth});var p=[];for(n=new Map,r=(s=l(s)).next();!r.done;r=s.next()){if(u=o(r=r.value),(c=n.get(u)||[]).length){var f=c[c.length-1],g=Mi(f.codecs),m=Mi(r.codecs);g!=m||r.bandwidth&&f.bandwidth&&!(r.bandwidth>f.bandwidth)||(c.push(r),p.push(r.id))}else c.push(r),p.push(r.id);n.set(u,c)}var v={vp8:1,avc:1,"dovi-avc":.95,vp9:.9,vp09:.9,hevc:.85,"dovi-hevc":.8,"dovi-p5":.75,av01:.7,"dovi-av1":.65,vvc:.6};s=Array.from(t).sort(function(e,t){if(!e.bandwidth||!t.bandwidth||e.bandwidth==t.bandwidth){if(e.codecs&&t.codecs&&e.codecs!=t.codecs&&e.width==t.width){var n=Mi(e.codecs),i=Mi(t.codecs);if(n!=i)return(v[n]||1)-(v[i]||1)}return e.width-t.width}return e.bandwidth-t.bandwidth}),t=Ut();var y=[];for(n=new Map,r=(s=l(s)).next();!r.done;r=s.next()){if(u=a(r=r.value),(c=n.get(u)||[]).length){if(f=c[c.length-1],!t&&(g=Mi(f.codecs))!==(m=Mi(r.codecs)))continue;(g=Mi(f.codecs))!=(m=Mi(r.codecs))||r.bandwidth&&f.bandwidth&&!(r.bandwidth>f.bandwidth)||(c.push(r),y.push(r.id))}else c.push(r),y.push(r.id);n.set(u,c)}e.variants=e.variants.filter(function(e){var t=e.audio;return e=e.video,!(t&&!p.includes(t.id)||e&&!y.includes(e.id))})}function Qi(e,t,n){function i(e,t,n){return e>=t&&e<=n}var r=e.video;if(r&&r.width&&r.height){var a=r.width,o=r.height;if(o>a&&(a=(o=l([o,a])).next().value,o=o.next().value),!i(a,t.minWidth,Math.min(t.maxWidth,n.width))||!i(o,t.minHeight,Math.min(t.maxHeight,n.height))||!i(r.width*r.height,t.minPixels,t.maxPixels))return!1}return!(e&&e.video&&e.video.frameRate&&!i(e.video.frameRate,t.minFrameRate,t.maxFrameRate)||e&&e.audio&&e.audio.channelsCount&&!i(e.audio.channelsCount,t.minChannelsCount,t.maxChannelsCount)||!i(e.bandwidth,t.minBandwidth,t.maxBandwidth))}function $i(e,t,n,i,r){var a,o;return L(function(s){if(1==s.g)return Me().Lj()&&function(e){for(var t=(new Map).set("dvav","avc3").set("dva1","avc1").set("dvhe","hev1").set("dvh1","hvc1").set("dvc1","vvc1").set("dvi1","vvi1"),n=new Set,i=(e=l(e)).next();!i.done;i=e.next())(i=i.value).video&&n.add(i.video);for(e=(n=l(n)).next();!e.done;e=n.next()){e=e.value;for(var r=(i=l(t)).next();!r.done;r=i.next()){var a=l(r.value);if(r=a.next().value,a=a.next().value,e.codecs.includes(r)){e.codecs=e.codecs.replace(r,a);break}}}}(t.variants),_(s,nr(t.variants,n,!1,i),2);a=null,e&&(o=e.g)&&(a=o.keySystem),t.variants=t.variants.filter(function(e){var t=function(e,t,n){if(!e.decodingInfos.some(function(e){return!(!e.supported||t&&(e=e.keySystemAccess)&&(n[e.keySystem]||e.keySystem)!=t)}))return!1;var i=Me(),r="Xbox"===i.Tb();i="MOBILE"===i.Ja()&&"GECKO"===i.Fa();var a=e.video,o=a&&a.width||0,s=a&&a.height||0;return!(r&&a&&(1920=t.i))return;e.I=!0,e.u-=1e3*(e.g.switchInterval-e.g.minTimeToSwitch)}Date.now()-e.u<1e3*e.g.switchInterval||(t=e.chooseVariant(),e.getBandwidthEstimate(),t&&e.G(t,e.g.clearBufferSwitch,e.g.safeMarginSwitch))}function xr(e,t,n,i,r){if(e.D){var a=e.D.Ti();a&&(n=n.filter(function(e){return!e.bandwidth||!a||e.bandwidth<=a}))}return t&&(n=n.filter(function(e){return Qi(e,t,{width:r,height:i})})),n.sort(function(e,t){return e.bandwidth-t.bandwidth})}(i=Ar.prototype).stop=function(){this.G=null,this.l=!1,this.F=[],this.H=1,this.m=this.u=null,this.h&&(this.h.disconnect(),this.h=null),this.B.stop(),this.D=this.i=null},i.release=function(){this.j.release(),this.B=null},i.init=function(e){this.G=e},i.chooseVariant=function(){var e=1/0,t=1/0;if(this.g.restrictToScreenSize){var n=this.g.ignoreDevicePixelRatio?1:this.C.devicePixelRatio;e=this.C.screen.height*n,t=this.C.screen.width*n}if(this.h&&this.g.restrictToElementSize){n=this.g.ignoreDevicePixelRatio?1:this.C.devicePixelRatio;var i=this.m.clientHeight,r=this.m.clientWidth;this.i&&document.pictureInPictureElement&&document.pictureInPictureElement==this.m&&(i=this.i.height,r=this.i.width),e=Math.min(e,i*n),t=Math.min(t,r*n)}if((n=this.F.filter(function(e){return e&&!(e.audio&&e.audio.fastSwitching||e.video&&e.video.fastSwitching)})).length||(n=this.F),i=n,n.length!=this.F.length&&(i=this.F.filter(function(e){return e&&!!(e.audio&&e.audio.fastSwitching||e.video&&e.video.fastSwitching)})),n=xr(this,this.g.restrictions,i,1/0,1/0),1/0!=e||1/0!=t){for(n=function(e){for(var t=[],n=(e=l(e)).next();!n.done;n=e.next())(n=n.value.video)&&n.height&&n.width&&t.push({height:n.height,width:n.width});return t.sort(function(e,t){return e.width-t.width})}(n),r=(n=l(n)).next();!r.done;r=n.next())if((r=r.value).height>=e&&r.width>=t){e=r.height,t=r.width;break}n=xr(this,this.g.restrictions,i,e,t)}for(e=this.getBandwidthEstimate(),i.length&&!n.length&&(n=[(n=xr(this,null,i,1/0,1/0))[0]]),t=n[0]||null,i=0;i=o&&e<=a&&(t.bandwidth!=r.bandwidth||t.bandwidth==r.bandwidth&&t.video&&r.video&&(t.video.width=this.g.cacheLoadThreshold&&this.s.sample(r,t),n&&null!=this.u&&this.l&&Er(this)},i.trySuggestStreams=function(){null!=this.u&&this.l&&Er(this)},i.getBandwidthEstimate=function(){var e=this.g.defaultBandwidthEstimate;return navigator.connection&&navigator.connection.downlink&&this.g.useNetworkInformation&&(e=1e6*navigator.connection.downlink),navigator.connection&&navigator.connection.downlink&&this.g.useNetworkInformation&&this.g.preferNetworkInformationBandwidth?e:(e=this.s.getBandwidthEstimate(e),this.D?this.D.getBandwidthEstimate(e):e)},i.setVariants=function(e){this.F=e},i.playbackRateChanged=function(e){this.H=e},i.setMediaElement=function(t){function n(){i.B.X(Cr)}var i=this;this.m=t,this.h&&(this.h.disconnect(),this.h=null),this.m&&"ResizeObserver"in e&&(this.h=new ResizeObserver(n),this.h.observe(this.m)),this.j.o(t,"enterpictureinpicture",function(e){e.pictureInPictureWindow&&(i.i=e.pictureInPictureWindow,i.j.o(i.i,"resize",n))}),this.j.o(t,"leavepictureinpicture",function(){i.i&&i.j.Da(i.i,"resize",n),i.i=null})},i.setCmsdManager=function(e){this.D=e},i.configure=function(e){this.g=e,this.s&&this.g&&this.s.configure(this.g.advanced)},H("shaka.abr.SimpleAbrManager",Ar),Ar.prototype.configure=Ar.prototype.configure,Ar.prototype.setCmsdManager=Ar.prototype.setCmsdManager,Ar.prototype.setMediaElement=Ar.prototype.setMediaElement,Ar.prototype.playbackRateChanged=Ar.prototype.playbackRateChanged,Ar.prototype.setVariants=Ar.prototype.setVariants,Ar.prototype.getBandwidthEstimate=Ar.prototype.getBandwidthEstimate,Ar.prototype.trySuggestStreams=Ar.prototype.trySuggestStreams,Ar.prototype.segmentDownloaded=Ar.prototype.segmentDownloaded,Ar.prototype.disable=Ar.prototype.disable,Ar.prototype.enable=Ar.prototype.enable,Ar.prototype.chooseVariant=Ar.prototype.chooseVariant,Ar.prototype.init=Ar.prototype.init,Ar.prototype.release=Ar.prototype.release,Ar.prototype.stop=Ar.prototype.stop;var Cr=1;function kr(e,t){if(e===t||!e.length||!t.length)return!0;for(var n=(e=l(e)).next();!n.done;n=e.next()){if(Lr(n=n.value))return!0;for(var i=l(t),r=i.next();!r.done;r=i.next())if(r=r.value,n.keySystem===r.keySystem||Lr(r))return!0}return!1}function Ir(e,t){if(!e.length)return t;if(!t.length)return e;for(var n=[],i=(e=l(e)).next();!i.done;i=e.next()){i=i.value;for(var r=l(t),a=r.next();!a.done;a=r.next()){if(a=a.value,i.keySystem==a.keySystem){r=new Map;for(var o=l((i.initData||[]).concat(a.initData||[])),s=o.next();!s.done;s=o.next())s=s.value,r.set(s.keyId,s);r=Array.from(r.values()),o=i.keyIds&&a.keyIds?new Set([].concat(h(i.keyIds),h(a.keyIds))):i.keyIds||a.keyIds,n.push({keySystem:i.keySystem,licenseServerUri:i.licenseServerUri||a.licenseServerUri,distinctiveIdentifierRequired:i.distinctiveIdentifierRequired||a.distinctiveIdentifierRequired,persistentStateRequired:i.persistentStateRequired||a.persistentStateRequired,videoRobustness:i.videoRobustness||a.videoRobustness,audioRobustness:i.audioRobustness||a.audioRobustness,serverCertificate:i.serverCertificate||a.serverCertificate,serverCertificateUri:i.serverCertificateUri||a.serverCertificateUri,initData:r,keyIds:o});break}Lr(i)?n.push(i):Lr(a)&&n.push(a)}}return n}function Mr(e){return!!e&&!!e.match(/^com\.(microsoft|chromecast)\.playready/)}function Pr(e){return!!e&&!!e.match(/^com\.apple\.fps/)}function Lr(e){return!!(e=e.licenseServerUri)&&e.startsWith("data:application/json;base64,")}H("shaka.config.CrossBoundaryStrategy",{KEEP:"keep",RESET:"reset",RESET_TO_ENCRYPTED:"reset_to_encrypted",RESET_ON_ENCRYPTION_CHANGE:"RESET_ON_ENCRYPTION_CHANGE"});var Dr=new Ie(function(){return Se(new Uint8Array([0]))}),Rr=new Map;function Nr(e,t){var n=2,i=1e3,r=2,a=.5;this.l=null==e.maxAttempts?n:e.maxAttempts,this.j=null==e.baseDelay?i:e.baseDelay,this.s=null==e.fuzzFactor?a:e.fuzzFactor,this.m=null==e.backoffFactor?r:e.backoffFactor,this.g=0,this.h=this.j,(this.i=void 0!==t&&t)&&(this.g=1)}function Or(e){var t,n;return L(function(i){if(1==i.g){if(e.g>=e.l){if(!e.i)throw new Ce(2,7,1010);e.g=1,e.h=e.j}return t=e.g,e.g++,0==t?i.return():(n=e.h*(1+(2*Math.random()-1)*e.s),_(i,new Promise(function(e){new zi(e).X(n/1e3)}),2))}e.h*=e.m,w(i)})}function Ur(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}}function Br(){var e,t,n=new Promise(function(n,i){e=n,t=i});return n.resolve=e,n.reject=t,n}function Fr(e,t){this.promise=e,this.i=t,this.g=null}function jr(e){return new Fr(Promise.reject(e),function(){return Promise.resolve()})}function Gr(){var e=Promise.reject(new Ce(2,7,7001));return e.catch(function(){}),new Fr(e,function(){return Promise.resolve()})}function Hr(e){return new Fr(Promise.resolve(e),function(){return Promise.resolve()})}function Vr(e){return new Fr(e,function(){return e.catch(function(){})})}function Wr(e){return new Fr(Promise.all(e.map(function(e){return e.promise})),function(){return Promise.all(e.map(function(e){return e.abort()}))})}function zr(){this.g=[]}function Kr(e,t){e.g.push(t.finally(function(){Qt(e.g,t)}))}function Xr(e,t,n,i,r,a,o){$.call(this),this.i=null,this.j=!1,this.u=new zr,this.g=new Set,this.h=new Set,this.s=e||null,this.m=t||null,this.B=n||null,this.C=i||null,this.D=r||null,this.G=a||null,this.F=o||null,this.l=new Map}function Yr(e,t,n,i){i=void 0!==i&&i,n=n||na;var r=ia.get(e);(!r||n>=r.priority)&&ia.set(e,{priority:n,Sf:t,Rl:i})}function qr(e,t){for(var n=l(e.g),i=n.next();!i.done;i=n.next())t.g.add(i.value);for(n=(e=l(e.h)).next();!n.done;n=e.next())t.h.add(n.value)}function Zr(e,t,n){return{uris:e,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:t,licenseRequestType:null,sessionId:null,drmInfo:null,initData:null,initDataType:null,streamDataCallback:void 0===n?null:n}}function Jr(e,t,n,i,r,a,o,s){e.i.forceHTTP&&(n.uris[a]=n.uris[a].replace("https://","http://")),e.i.forceHTTPS&&(n.uris[a]=n.uris[a].replace("http://","https://")),0this.h.byteLength)throw la();var t=Te(this.h,this.g,e);return this.g+=e,t},i.skip=function(e){if(this.g+e>this.h.byteLength)throw la();this.g+=e},i.xj=function(e){if(this.ge||e>this.h.byteLength)throw la();this.g=e},i.ld=function(){for(var e=this.g;this.Oa()&&0!=this.h.getUint8(this.g);)this.g+=1;return e=Te(this.h,e,this.g-e),this.g+=1,Ne(e)},H("shaka.util.DataViewReader",ua),ua.prototype.readTerminatedString=ua.prototype.ld,ua.prototype.seek=ua.prototype.seek,ua.prototype.rewind=ua.prototype.xj,ua.prototype.skip=ua.prototype.skip,ua.prototype.readBytes=ua.prototype.Zb,ua.prototype.readUint64=ua.prototype.Pd,ua.prototype.readInt32=ua.prototype.Oh,ua.prototype.readUint32=ua.prototype.W,ua.prototype.readUint16=ua.prototype.Ga,ua.prototype.readUint8=ua.prototype.aa,ua.prototype.getLength=ua.prototype.getLength,ua.prototype.getPosition=ua.prototype.Ua,ua.prototype.hasMoreData=ua.prototype.Oa;var ha=1;function ca(){this.i=new Map,this.h=new Map,this.g=!1}function da(e){for(var t=ba(e);e.reader.Oa()&&!e.parser.g;)e.parser.Kd(e.start+t,e.reader,e.partialOkay,e.stopOnPartial)}function pa(e){for(var t=ba(e),n=e.reader.W(),i=0;i>24&255,e>>16&255,e>>8&255,255&e)}function ba(e){return 8+(e.has64BitSize?8:0)+(null!=e.flags?4:0)}ua.Endianness={BIG_ENDIAN:0,LITTLE_ENDIAN:ha},(i=ca.prototype).box=function(e,t){return e=va(e),this.i.set(e,_a),this.h.set(e,t),this},i.V=function(e,t){return e=va(e),this.i.set(e,wa),this.h.set(e,t),this},i.stop=function(){this.g=!0},i.parse=function(e,t,n){for(e=new ua(e,0),this.g=!1;e.Oa()&&!this.g;)this.Kd(0,e,t,n)},i.Kd=function(e,t,n,i){var r=t.Ua();if(i&&r+8>t.getLength())this.g=!0;else{var a=t.W(),o=t.W(),s=ya(o),u=!1;switch(a){case 0:a=t.getLength()-r;break;case 1:if(i&&t.Ua()+8>t.getLength())return void(this.g=!0);a=t.Pd(),u=!0}var l=this.h.get(o);if(l){var h=null,c=null;if(this.i.get(o)==wa){if(i&&t.Ua()+4>t.getLength())return void(this.g=!0);h=(c=t.W())>>>24,c&=16777215}o=r+a,n&&o>t.getLength()&&(o=t.getLength()),i&&o>t.getLength()?this.g=!0:(o-=t.Ua(),l({name:s,parser:this,partialOkay:n||!1,stopOnPartial:i||!1,version:h,flags:c,reader:t=new ua(t=0i?s.setUint32(u,0):s.setUint32(u,16777216),u+=4,o.set(t,u),u+=t.length,0i&&(i+=Math.pow(2,32)),i="0x"+i.toString(16)}e.u(new Ce(2,6,6006,t.message,t,i))}})}(e,t,n,e.g.sessionType)}}function Ma(e){return e=ee(e=e.i.keys(),function(e){return e.sessionId}),Array.from(e)}function Pa(t,n){var i,r,a,o,s,u;return L(function(c){switch(c.g){case 1:if(i=new Map,r=function(e,t,n){for(var i=l(t),r=i.next();!r.done;r=i.next())for(var a=(r=l(Fa(r.value))).next();!a.done;a=r.next())a=a.value,n.has(a.keySystem)||n.set(a.keySystem,[]),n.get(a.keySystem).push(a);if(1==n.size&&n.has(""))throw new Ce(2,6,6e3);(i=e.h.preferredKeySystems).length||1==(r=oa(e.h.servers)).size&&(i=Array.from(r.keys()));var o=(r=l(i)).next();for(a={};!o.done;a={qj:void 0},o=r.next()){a.qj=o.value;for(var s=(o=l(t)).next();!s.done;s=o.next())if(s=s.value.decodingInfos.find(function(e){return function(t){return t.supported&&null!=t.keySystemAccess&&t.keySystemAccess.keySystem==e.qj}}(a)))return s.keySystemAccess}for(a=(r=l([!0,!1])).next();!a.done;a=r.next())for(a=a.value,s=(o=l(t)).next();!s.done;s=o.next())for(var u=(s=l(s.value.decodingInfos)).next();!u.done;u=s.next())if((u=u.value).supported&&u.keySystemAccess){var h=u.keySystemAccess.keySystem;if(!i.includes(h)){var c=n.get(h);for(!c&&e.h.keySystemsMapping[h]&&(c=n.get(e.h.keySystemsMapping[h])),c=(h=l(c)).next();!c.done;c=h.next())if(!!c.value.licenseServerUri==a)return u.keySystemAccess}}return null}(t,n,i),!r){if(!navigator.requestMediaKeySystemAccess)throw new Ce(2,6,6020);throw new Ce(2,6,6001)}aa(t.m),S(c,2),r.getConfiguration();var d=a=t.h.keySystemsMapping[r.keySystem]||r.keySystem,p=i.get(a),f=[],g=[],m=[],v=[],y=[],b=new Set,w=new Set;!function(t,n,i,r,a,o,s,u){for(var c=[],d=(t=l(t)).next(),p={};!d.done;p={Qa:void 0},d=t.next()){if(p.Qa=d.value,n.includes(p.Qa.encryptionScheme)||n.push(p.Qa.encryptionScheme),"org.w3.clearkey"==p.Qa.keySystem&&p.Qa.licenseServerUri.startsWith("data:application/json;base64,")?c.includes(p.Qa.licenseServerUri)||c.push(p.Qa.licenseServerUri):i.includes(p.Qa.licenseServerUri)||i.push(p.Qa.licenseServerUri),a.includes(p.Qa.serverCertificateUri)||a.push(p.Qa.serverCertificateUri),p.Qa.serverCertificate&&(r.some(function(e){return function(t){return we(t,e.Qa.serverCertificate)}}(p))||r.push(p.Qa.serverCertificate)),p.Qa.initData)for(var f=(d=l(p.Qa.initData)).next(),g={};!f.done;g={yh:void 0},f=d.next())g.yh=f.value,o.some(function(e){return function(t){var n=e.yh;return!(!t.keyId||t.keyId!=n.keyId)||t.initDataType==n.initDataType&&we(t.initData,n.initData)}}(g))||o.push(g.yh);if(p.Qa.keyIds)for(f=(d=l(p.Qa.keyIds)).next();!f.done;f=d.next())s.add(f.value);if(p.Qa.keySystemUris&&u)for(d=(p=l(p.Qa.keySystemUris)).next();!d.done;d=p.next())u.add(d.value)}if(1==c.length)i.push(c[0]);else if(0r||i&&1e3>r)&&n&&!n.Pb&&(e.i.delete(t),Ua(t)),ja(e)&&(e.l.resolve(),e.K.X(za))}function Ua(e){return L(function(t){return 1==t.g?(S(t,2),_(t,qi(Va,Promise.all([e.close().catch(function(){}),e.closed])),4)):2!=t.g?A(t,0):(E(t),void w(t))})}function Ba(e){var t;return L(function(n){return t=Array.from(e.i.entries()),e.i.clear(),_(n,Promise.all(t.map(function(t){var n=(t=l(t)).next().value,i=t.next().value;return L(function(t){return 1==t.g?(S(t,2),e.ba||e.C.has(n.sessionId)||"persistent-license"!==i.type||e.h.persistentSessionOnlinePlayback?_(t,Ua(n),5):_(t,n.remove(),5)):2!=t.g?A(t,0):(E(t),void w(t))})})),0)})}function Fa(e){return(e.video?e.video.drmInfos:[]).concat(e.audio?e.audio.drmInfos:[])}function ja(e){return function(e,t){for(var n=(e=l(e)).next();!n.done;n=e.next())if(!t(n.value))return!1;return!0}(e=e.i.values(),function(e){return e.loaded})}function Ga(t,n,i,r){var a=t.keySystem;!a||"org.w3.clearkey"==a&&t.licenseServerUri||(n.size&&n.get(a)&&(n=n.get(a),t.licenseServerUri=n),t.keyIds||(t.keyIds=new Set),(i=i.get(a))&&(t.distinctiveIdentifierRequired||(t.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),t.persistentStateRequired||(t.persistentStateRequired=i.persistentStateRequired),t.serverCertificate||(t.serverCertificate=i.serverCertificate),i.sessionType&&(t.sessionType=i.sessionType),t.serverCertificateUri||(t.serverCertificateUri=i.serverCertificateUri)),r[a]&&(t.keySystem=r[a]),e.cast&&e.cast.__platform__&&"com.microsoft.playready"==a&&(t.keySystem="com.chromecast.playready"))}function Ha(e,t){if(0!=(e=oa(e)).size){e=Qe(e);for(var n=(t=l(t)).next();!n.done;n=t.next())(n=n.value).video&&(n.video.drmInfos=[e]),n.audio&&(n.audio.drmInfos=[e])}}(i=Aa.prototype).destroy=function(){return this.m.destroy()},i.configure=function(e,t){this.h=e,t&&(this.P=t),this.F&&this.O&&this.g&&this.F.ya(this.h.updateExpirationTime)},i.bc=function(e){var t,n=this;return L(function(i){if(1==i.g)return n.j===e?i.return():n.B?(n.j=e,n.s.ra(n.j,"play",function(){for(var e=l(n.L),t=e.next();!t.done;t=e.next())Na(n,t.value);n.U=!0,n.L=[]}),n.j.remote?(n.s.o(n.j.remote,"connect",function(){return Ba(n)}),n.s.o(n.j.remote,"connecting",function(){return Ba(n)}),n.s.o(n.j.remote,"disconnect",function(){return Ba(n)})):"webkitCurrentPlaybackTargetIsWireless"in n.j&&n.s.o(n.j,"webkitcurrentplaybacktargetiswirelesschanged",function(){return Ba(n)}),n.G=n.g&&n.g.initData.find(function(e){return 0>10))+String.fromCharCode(96+((960&e)>>5))+String.fromCharCode(96+(31&e))}}function fo(e,t,n){var i=e.W(),r=[],a=null;1&n&&(a=e.Oh()),4&n&&e.skip(4);for(var o=0;oe?"0":"")+e}function bo(e){if(!Po){Po=!0;var t=new Uint8Array([105,115,111,109]),n=new Uint8Array([97,118,99,49]),i=new Uint8Array([0,0,0,1]);Vo=Mo("ftyp",t,i,t,n),t=Mo("dref",Wo),zo=Mo("dinf",t)}this.g=e}function _o(e){for(var t=[],n=l(e.g),i=n.next();!i.done;i=n.next()){var r=t,a=r.push,o=i.value;i=Mo;var s=o.id+1,u=o.stream.width||0,c=o.stream.height||0;"audio"==o.type&&(c=u=0);var d=o.duration*o.timescale,p=Math.floor(d/(Lo+1));switch(d=Math.floor(d%(Lo+1)),s=Mo("tkhd",s=new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(h(Co(s,4)),[0,0,0,0],h(Co(p,4)),h(Co(d,4)),[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0],h(Co(u,2)),[0,0],h(Co(c,2)),[0,0]))),u=Mo,p=o.duration*o.timescale,c=Math.floor(p/(Lo+1)),p=Math.floor(p%(Lo+1)),d=(d=o.stream.language).charCodeAt(0)-96<<10|d.charCodeAt(1)-96<<5|d.charCodeAt(2)-96,c=Mo("mdhd",c=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(h(Co(o.timescale,4)),h(Co(c,4)),h(Co(p,4)),h(Co(d,2)),[0,0]))),p=o,d=new Uint8Array([]),p.type){case"video":d=Ro;break;case"audio":d=No}p=Mo("hdlr",d);e:{switch(o.type){case"video":o=Mo("minf",Mo("vmhd",jo),zo,wo(o));break e;case"audio":o=Mo("minf",Mo("smhd",Go),zo,wo(o));break e}o=new Uint8Array([])}i=i("trak",s,o=u("mdia",c,p,o)),a.call(r,i)}for(t=qe.apply(Ve,h(t)),n=Mo,i=(a=e.g[0]).duration*a.timescale,r=Math.floor(i/(Lo+1)),i=Math.floor(i%(Lo+1)),r=Mo("mvhd",r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(h(Co(a.timescale,4)),h(Co(r,4)),h(Co(i,4)),[0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))),i=[],u=(e=l(e.g)).next();!u.done;u=e.next())s=(o=i).push,u=Mo("trex",u=new Uint8Array([0,0,0,0].concat(h(Co(u.value.id+1,4)),[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0]))),s.call(o,u);if(e=Mo("mvex",e=qe.apply(Ve,h(i))),i=[],a.encrypted){for(o=(a=l(a.stream.drmInfos)).next();!o.done;o=a.next())if((o=o.value).initData)for(s=(o=l(o.initData)).next();!s.done;s=o.next())i.push(s.value.initData);a=qe.apply(Ve,h(i))}else a=new Uint8Array([]);return e=n("moov",r,t,e,a),(t=new Uint8Array(Vo.byteLength+e.byteLength)).set(Vo),t.set(e,Vo.byteLength),t}function wo(e){var t=Mo,n="aac";e.codecs.includes("mp3")?n="mp3":e.codecs.includes("ac-3")?n=Me().ye()?"ec-3":"ac-3":e.codecs.includes("ec-3")?n="ec-3":e.codecs.includes("opus")&&(n="opus");var i=new Uint8Array([]);switch(e.type){case"video":if(e.codecs.includes("avc1")){if(n=e.stream.width||0,i=e.stream.height||0,0>8,a[d++]=255&o[u].length,a.set(o[u],d),d+=o[u].length;for(a[d++]=s.length,o=0;o>8,a[d++]=255&s[o].length,a.set(s[o],d),d+=s[o].length;r=r("avcC",a)}n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].concat(h(Co(n,2)),h(Co(i,2)),[0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17])),i="avc1",s=So(e),o=new Uint8Array([]),e.encrypted&&(o=Ao(0,e.stream,e.codecs),i="encv"),i=Mo(i,n,r,s,o)}else e.codecs.includes("hvc1")&&(i=e.stream.width||0,r=e.stream.height||0,n=new Uint8Array([]),0>>1,s<<7|r<<3,6,1,2])))),i="mp4a",r=new Uint8Array([]),e.encrypted&&(r=Ao(0,e.stream,e.codecs),i="enca"),e=Mo(i,To(e),n,r)),i=e}return t("stbl",e=Mo("stsd",Ho,i),Mo("stts",Oo),Mo("stsc",Uo),Mo("stsz",Fo),Mo("stco",Bo))}function So(e){if(!e.cb&&!e.fb)return new Uint8Array([]);var t=e.fb;return Mo("pasp",e=new Uint8Array([].concat(h(Co(e.cb,4)),h(Co(t,4)))))}function To(e){return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.stream.channelsCount||2,0,16,0,0,0,0].concat(h(Co(e.stream.audioSamplingRate||44100,2)),[0,0]))}function Ao(e,t,n){e=Mo,n=Mo("frma",n=new Uint8Array([].concat(h(Co(Io(n.split(".")[0]),4)))));var i="cenc",r=t.drmInfos[0];r&&r.encryptionScheme&&(i=r.encryptionScheme),i=Mo("schm",i=new Uint8Array([0,0,0,0].concat(h(Co(Io(i),4)),[0,1,0,0]))),r=Mo;for(var a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),o=(t=l(t.drmInfos)).next();!o.done;o=t.next())if((o=o.value)&&o.keyIds&&o.keyIds.size)for(var s=(o=l(o.keyIds)).next();!s.done;s=o.next())a=ko(s.value);return e("sinf",n,i,r("schi",t=Mo("tenc",t=new Uint8Array([0,0,0,0,0,0,1,8]),a)))}function Eo(e){for(var t=[],n=(e=l(e.g)).next();!n.done;n=e.next()){n=n.value;var i,r=t.push,a=r.apply,o=Mo,s=new Uint8Array([0,0,0,0].concat(h(Co(n.data?n.data.$b:0,4))));s=Mo("mfhd",s);var u=n.data?n.data.Cb:[],c=new Uint8Array(4+u.length);for(i=0;i>8*t&255);return n}function ko(e){for(var t=new Uint8Array(e.length/2),n=0;n>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=255&i,r.set(n,4),n=0,i=8;n>8*c&255);for(e.set(new Uint8Array(h),s),e.set(u,s+4),u=(s=l(o)).next();!u.done;u=s.next())Yo(e,(u=u.value).start,u.size+4)}}return e}function Xo(e,t,n,i,r,a){var o=Ao(new bo([]),e,i.name),s=t.subarray(i.start,i.start+i.size);for((e=new Uint8Array(i.size+o.byteLength)).set(s,0),Ee(e).setUint32(4,a),e.set(o,i.size),Yo(e,0,e.byteLength),a=new Uint8Array(t.byteLength+e.byteLength),i=Me().yf()?i.start:i.start+i.size,o=t.subarray(i),a.set(t.subarray(0,i)),a.set(e,i),a.set(o,i+e.byteLength),r=(t=l(r)).next();!r.done;r=t.next())Yo(a,(r=r.value).start,r.size+e.byteLength);return e=Ee(a,n.start),n=ba(n),t=e.getUint32(n),e.setUint32(n,t+1),a}function Yo(e,t,n){0!=(t=(e=Ee(e,t)).getUint32(0))&&(1==t?(e.setUint32(8,n>>32),e.setUint32(12,4294967295&n)):e.setUint32(0,n))}function qo(e,t,n,i,r,a,o,s){this.S=e,this.startByte=t,this.endByte=n,this.Id=void 0===i?null:i,this.timescale=void 0===r?null:r,this.h=void 0===a?null:a,this.aesKey=void 0===o?null:o,this.g=this.mimeType=this.codecs=null,this.encrypted=void 0!==s&&s}function Zo(e,t){return e===t||(e&&t?e.Kc()==t.Kc()&&e.Ic()==t.Ic()&&en(e.S().sort(),t.S().sort())&&we(e.ec(),t.ec()):e==t)}function Jo(e,t,n,i,r,a,o,s,u,h,c,d,p,f,g,m){for(h=void 0===h?[]:h,f=void 0===f?$o:f,this.startTime=e,this.j=this.endTime=t,this.D=n,this.startByte=i,this.endByte=r,this.ea=a,this.timestampOffset=o,this.appendWindowStart=s,this.appendWindowEnd=u,this.g=h,this.tilesLayout=void 0===c?"":c,this.C=void 0===d?null:d,this.h=void 0===p?null:p,this.status=f,this.preload=!1,this.l=!0,this.m=!1,this.aesKey=void 0===g?null:g,this.thumbnailSprite=null,this.i=-1,this.B=void 0!==m&&m,this.F=this.s=!1,t=(e=l(this.g)).next();!t.done;t=e.next())t.value.gj();this.B&&this.g.length&&this.g[this.g.length-1].fj(),this.u=this.bandwidth=this.mimeType=this.codecs=null,this.G=!1}function Qo(e,t){e.ea=t;for(var n=(e=l(e.g)).next();!n.done;n=e.next())Qo(n.value,t)}qo.prototype.Kc=function(){return this.startByte},qo.prototype.Ic=function(){return this.endByte},qo.prototype.Be=function(e){this.h=e},qo.prototype.ec=function(){return this.h},H("shaka.media.InitSegmentReference",qo),qo.prototype.getEndByte=qo.prototype.Ic,qo.prototype.getStartByte=qo.prototype.Kc,(i=Jo.prototype).S=function(){return this.D()},i.getStartTime=function(){return this.startTime},i.Hk=function(){return this.endTime},i.Kc=function(){return this.startByte},i.Ic=function(){return this.endByte},i.il=function(){return this.tilesLayout},i.hl=function(){return this.C},i.Lc=function(){return this.status},i.Jl=function(){this.status=es},i.Fh=function(){this.preload=!0},i.isPreload=function(){return this.preload},i.Hd=function(){this.l=!1},i.zl=function(){return this.l},i.gj=function(){this.s=!0},i.Bl=function(){return this.s},i.fj=function(){this.F=!0},i.Al=function(){return this.F},i.ej=function(){this.m=!0},i.vl=function(){return this.m},i.hg=function(e){this.thumbnailSprite=e},i.fl=function(){return this.thumbnailSprite},i.offset=function(e){this.startTime+=e,this.endTime+=e,this.j+=e;for(var t=l(this.g),n=t.next();!n.done;n=t.next())(n=n.value).startTime+=e,n.endTime+=e,n.j+=e},i.li=function(e){null==this.h?X("Sync attempted without sync time!"):(e=this.h-e-this.startTime,.001<=Math.abs(e)&&this.offset(e))},i.Be=function(e,t){this.u=e,this.G=void 0!==t&&t},i.ec=function(e){var t=this.u;return(void 0===e||e)&&this.G&&(this.u=null),t},H("shaka.media.SegmentReference",Jo),Jo.prototype.getSegmentData=Jo.prototype.ec,Jo.prototype.setSegmentData=Jo.prototype.Be,Jo.prototype.syncAgainst=Jo.prototype.li,Jo.prototype.offset=Jo.prototype.offset,Jo.prototype.getThumbnailSprite=Jo.prototype.fl,Jo.prototype.setThumbnailSprite=Jo.prototype.hg,Jo.prototype.hasByterangeOptimization=Jo.prototype.vl,Jo.prototype.markAsByterangeOptimization=Jo.prototype.ej,Jo.prototype.isLastPartial=Jo.prototype.Al,Jo.prototype.markAsLastPartial=Jo.prototype.fj,Jo.prototype.isPartial=Jo.prototype.Bl,Jo.prototype.markAsPartial=Jo.prototype.gj,Jo.prototype.isIndependent=Jo.prototype.zl,Jo.prototype.markAsNonIndependent=Jo.prototype.Hd,Jo.prototype.isPreload=Jo.prototype.isPreload,Jo.prototype.markAsPreload=Jo.prototype.Fh,Jo.prototype.markAsUnavailable=Jo.prototype.Jl,Jo.prototype.getStatus=Jo.prototype.Lc,Jo.prototype.getTileDuration=Jo.prototype.hl,Jo.prototype.getTilesLayout=Jo.prototype.il,Jo.prototype.getEndByte=Jo.prototype.Ic,Jo.prototype.getStartByte=Jo.prototype.Kc,Jo.prototype.getEndTime=Jo.prototype.Hk,Jo.prototype.getStartTime=Jo.prototype.getStartTime,Jo.prototype.getUris=Jo.prototype.S;var $o=0,es=1;function ts(e){return 1==e.length&&1e-4>e.end(0)-e.start(0)}function ns(e){return!e||ts(e)?null:e.length?e.end(e.length-1):null}function is(e,t){return!(!e||!e.length||ts(e)||t>e.end(e.length-1))&&t>=e.start(0)}function rs(e,t){if(!e||!e.length||ts(e))return 0;for(var n=0,i=(e=l(as(e))).next();!i.done;i=e.next()){var r=i.value;i=r.start,(r=r.end)>t&&(n+=r-Math.max(i,t))}return n}function as(e){if(!e)return[];for(var t=[],n=0;ne[t+3]&&255>e[t+4]&&128>e[t+6]&&128>e[t+7]&&128>e[t+8]&&128>e[t+9]}function vs(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&255>e[t+3]&&255>e[t+4]&&128>e[t+6]&&128>e[t+7]&&128>e[t+8]&&128>e[t+9]}function ys(e,t){var n=(127&e[t])<<21;return n|=(127&e[t+1])<<14,(n|=(127&e[t+2])<<7)|127&e[t+3]}function bs(e){var t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if("APIC"===e.type){if(2>e.size||3!==e.data[0])return null;var n=e.data.subarray(1).indexOf(0);if(-1===n)return null;var i=Ne(Te(e.data,1,n)),r=e.data[2+n],a=e.data.subarray(3+n).indexOf(0);if(-1===a)return null;var o,s=Ne(Te(e.data,3+n,a));return o="--\x3e"===i?Ne(Te(e.data,4+n+a)):Se(e.data.subarray(4+n+a)),t.mimeType=i,t.pictureType=r,t.description=s,t.data=o,t}return"TXXX"===e.type||"WXXX"===e.type?2>e.size||3!==e.data[0]||-1===(i=e.data.subarray(1).indexOf(0))?null:(n=Ne(Te(e.data,1,i)),e=Ne(Te(e.data,2+i)).replace(/\0*$/,""),t.description=n,t.data=e,t):"PRIV"===e.type?2>e.size||-1===(n=e.data.indexOf(0))?null:(n=Ne(Te(e.data,0,n)),t.description=n,"com.apple.streaming.transportStreamTimestamp"==n?(n=e.data.subarray(n.length+1),e=1&n[3],n=(n[4]<<23)+(n[5]<<15)+(n[6]<<7)+n[7],n/=45,e&&(n+=47721858.84),t.data=n):(e=Se(e.data.subarray(n.length+1)),t.data=e),t):"T"===e.type[0]?2>e.size||3!==e.data[0]?null:(e=Ne(e.data.subarray(1)).replace(/\0*$/,""),t.data=e,t):"W"===e.type[0]?(e=Ne(e.data).replace(/\0*$/,""),t.data=e,t):e.data?(t.data=Se(e.data),t):null}function _s(e){for(var t=0,n=[];ms(e,t);){var i=ys(e,t+6);for(e[t+5]>>6&1&&(t+=10),i=(t+=10)+i;t+10>6&1&&(i+=10),i+=10,i+=ys(e,t+6),vs(e,t+10)&&(i+=10),t+=i;return 0>>32-n;return e.g-=n,0>>t)return e.h<<=t,e.g-=t,t;return As(e),t+Cs(e)}function ks(e){Es(e,1+Cs(e))}function Is(e){return xs(e,Cs(e)+1)-1}function Ms(e){return 1&(e=Is(e))?1+e>>>1:-1*(e>>>1)}function Ps(e){return 1===xs(e,1)}function Ls(e){return xs(e,8)}function Ds(e,t){for(var n=8,i=8,r=0;rt.byteLength-6)return null;var i=t[7];if(192&i){var r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2;null==e.u&&(e.u=r),n.pts=Bs(r,e.u),e.u=n.pts,n.dts=n.pts,64&i&&(i=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,null==e.s&&(e.s=i),n.dts=n.pts!=r?Bs(i,e.s):i),e.s=n.dts}return e=t[8]+9,t.byteLength<=e?null:(n.data=t.subarray(e),n)}function Us(e){var t=e.fd();return 1t&&(n=-1);4294967296js(e))}function js(e){for(var t=Math.min(1e3,e.length-564),n=0;ne.length)return this;for(var t=Math.max(0,js(e)),n=e.length-(e.length+t)%188,i=!1,r=t;r>4){var s=r+5+e[r+4];if(s==r+188)continue}else s=r+4;switch(o){case 0:a&&(s+=e[s]+1),this.H=(31&e[s+10])<<8|e[s+11];break;case 17:case 8191:break;case this.H:a&&(s+=e[s]+1),o={audio:-1,video:-1,wf:-1,audioCodec:"",videoCodec:""};var u=s+3+((15&(a=e)[s+1])<<8|a[s+2])-4;for(s+=12+((15&a[s+10])<<8|a[s+11]);s>1&63:31&e[0],a=0,s=1);s>1&63:31&e[s],l=s,a=0):a=-1):a=0:a=3:a=c?0:1}return 0<=l&&0<=a&&u.push({data:e.subarray(l+r,i),fullData:e.subarray(l,i),type:h,time:n,state:a}),!u.length&&t.se&&(n=u.length?u[u.length-1]:t.se)&&(n.data=qe(n.data,e),n.fullData=qe(n.fullData,e)),t.state=a,u},i.getMetadata=function(){for(var e=[],t=l(this.l),n=t.next();!n.done;n=t.next())(n=Os(this,n=qe.apply(Ve,h(n.value))))&&e.push({cueTime:n.pts?n.pts/9e4:null,data:n.data,frames:_s(n.data),dts:n.dts,pts:n.pts});return e},i.zb=function(){if(this.i.length&&!this.h.length)for(var e=l(this.i),t=e.next();!t.done;t=e.next()){var n=qe.apply(Ve,h(t.value)),i=Os(this,n);t=this.h.length?this.h[this.h.length-1]:null,i&&null!=i.pts&&null!=i.dts&&(!t||t.pts!=i.pts&&t.dts!=i.dts)?this.h.push(i):this.h.length&&(n=i?i.data:n)&&((t=this.h.pop()).data=qe(t.data,n),this.h.push(t))}return this.h},i.fd=function(e){if(e=void 0===e||e,this.j.length&&!this.g.length){for(var t=l(this.j),n=t.next();!n.done;n=t.next()){var i=qe.apply(Ve,h(n.value)),r=Os(this,i);n=this.g.length?this.g[this.g.length-1]:null,r&&null!=r.pts&&null!=r.dts&&(!n||n.pts!=r.pts&&n.dts!=r.dts)?this.g.push(r):this.g.length&&(i=r?r.data:i)&&((n=this.g.pop()).data=qe(n.data,i),this.g.push(n))}if(e){for(t={se:null,state:null},n=[],r=(i=l(this.g)).next();!r.done;r=i.next())(r=r.value).nalus=this.Lh(r,t),r.nalus.length&&(n.push(r),t.se=r.nalus[r.nalus.length-1]);this.g=n}}return e?this.g:(e=this.g,this.g=[],e)},i.getStartTime=function(e){if("audio"==e){e=null;var t=this.zb();return t.length&&(e=t[0],e=Math.min(e.dts,e.pts)/9e4),e}return"video"==e?(e=null,(t=this.fd(!1)).length&&(e=t[0],e=Math.min(e.dts,e.pts)/9e4),e):null},i.ee=function(){return{audio:this.C,video:this.m}},i.vf=function(){for(var e=[],t=l(this.fd()),n=t.next();!n.done;n=t.next())e.push.apply(e,h(n.value.nalus));return e},i.ql=function(){kt("TsParser.getVideoResolution","Please use getVideoInfo function instead.");var e=this.sh();return{height:e.height,width:e.width}},i.sh=function(){return"hvc"==this.m?function(e){var t={height:null,width:null,codec:null,frameRate:null},n=e.vf();if(!n.length)return t;if(!(n=n.find(function(e){return 33==e.type})))return t;var i=new Ts(n.fullData,!0);Ls(i),Ls(i),xs(i,4);var r=xs(i,3);Ps(i);var a=xs(i,2),o=xs(i,1),s=xs(i,5),u=xs(i,32);n=Ls(i);for(var l=Ls(i),h=Ls(i),c=Ls(i),d=Ls(i),p=Ls(i),f=Ls(i),g=[],m=[],v=0;vv;v++)xs(i,2);for(v=0;vn;n++)t|=(e>>n&1)<<31-n;return t>>>0}(u),o=1==o?"H":"L",a="hvc1."+["","A","B","C"][a]+s,a+="."+i.toString(16).toUpperCase(),a+="."+o+f,p&&(a+="."+p.toString(16).toUpperCase()),d&&(a+="."+d.toString(16).toUpperCase()),c&&(a+="."+c.toString(16).toUpperCase()),h&&(a+="."+h.toString(16).toUpperCase()),l&&(a+="."+l.toString(16).toUpperCase()),n&&(a+="."+n.toString(16).toUpperCase()),t.codec=a,t.frameRate=Us(e),t}(this):function(e){var t={height:null,width:null,codec:null,frameRate:null},n=e.vf();if(!n.length)return t;if(!(n=n.find(function(e){return 7==e.type})))return t;var i=Ls(n=new Ts(n.data)),r=Ls(n),a=Ls(n);if(ks(n),Gs.includes(i)){var o=Is(n);if(3===o&&Es(n,1),ks(n),ks(n),Es(n,1),Ps(n)){o=3!==o?8:12;for(var s=0;ss?16:64)}}if(ks(n),0===(o=Is(n)))Is(n);else if(1===o)for(Es(n,1),ks(n),ks(n),o=Is(n),s=0;se.start(0)?0:e.length?e.start(0):null:null}function Zs(e,t){return e.l.size?t==nt?e.h.h:ns(Js(e,t)):null}function Js(e,t){if(e.F||e.K)return null;try{return e.l.get(t).buffered}catch(n){return e.l.has(t),null}}function Qs(e,t,n,i,r,a,o,s,u,c,d){var p,f,g,m,v,y,b,S,T,A,E,x,C,k,I,M;return o=void 0!==o&&o,s=void 0!==s&&s,u=void 0!==u&&u,c=void 0!==c&&c,L(function(P){switch(P.g){case 1:if(t!=(p=it).$a){P.A(2);break}if("HLS"!=e.U){P.A(3);break}return _(P,e.Na,4);case 4:f=P.h,e.h.u=f;case 3:return _(P,function(e,t,n,i,r){var a,o,s,u,h,c,d;return L(function(p){if(1==p.g)return _(p,Promise.resolve(),2);if(!e.i||!e.j)return p.return();if(null==n||null==i)return e.i.parseInit(Te(t)),p.return();for(a=e.C?n:e.u,o={periodStart:e.u,segmentStart:n,segmentEnd:i,vttOffset:a},s=e.i.parseMedia(Te(t),o,r,[]),u=l(s),h=u.next();!h.done;h=u.next())c=h.value,e.B(c,r||null,o);d=s.filter(function(t){return t.startTime>=e.l&&t.startTime=e.l&&u.startTimen&&(n+=.001),e.l.get(t).timestampOffset=n,ou(e,t)}function au(e,t,n,i){var r=e.l.get(t);r.appendWindowEnd===i&&r.appendWindowStart===n||(r.appendWindowStart=0,r.appendWindowEnd=i,r.appendWindowStart=n),ou(e,t)}function ou(e,t){if(e.F||e.H.g){var n=e.s.get(t);n&&n.length&&((n=n[0])&&n.p&&n.p.resolve(),e.s.set(t,[]))}else(n=e.s.get(t)[0])&&(n.p.resolve(),lu(e,t))}function su(e,t,n,i){return aa(e.H),n={start:n,p:new Br,uri:i},e.s.get(t).push(n),1==e.s.get(t).length&&hu(e,t),n.p}function uu(e,t){var n,i,r,a,o,s,u,h,c,d,p;return L(function(f){switch(f.g){case 1:for(aa(e.H),n=[],i=Array.from(e.l.keys()),r=l(i),a=r.next(),o={};!a.done;o={ready:void 0},a=r.next())s=a.value,o.ready=new Br,u={start:function(e){return function(){return e.ready.resolve()}}(o),p:o.ready,uri:null},(h=e.s.get(s)).push(u),n.push(o.ready),1==h.length&&u.start();return S(f,2),_(f,Promise.all(n),4);case 4:A(f,3);break;case 2:throw E(f);case 3:return S(f,5,6),_(f,t(),6);case 6:for(x(f),c=l(i),d=c.next();!d.done;d=c.next())p=d.value,lu(e,p);C(f,0);break;case 5:throw new Ce(2,3,3015,E(f),e.g.error||"No error in the media element",null)}})}function lu(e,t){e.s.get(t).shift(),hu(e,t)}function hu(e,t){var n=e.s.get(t)[0];if(n)try{n.start()}catch(i){"QuotaExceededError"==i.name?n.p.reject(new Ce(2,3,3017,t)):zs(e)?n.p.reject(new Ce(2,3,3015,i,e.g.error||"No error in the media element",n.uri)):n.p.reject(new Ce(2,3,3024,t)),lu(e,t)}}function cu(e,t){return uu(e,function(){return function(e,t){var n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S;return L(function(A){if(1==A.g){if(e.F||e.K)return A.return();for(n=it,e.F=!0,e.m=!1,i=e.g.currentTime,r=e.g.autoplay,e.g.paused||(e.gb=!0),e.eb&&(e.g.autoplay=!1),T(A,2),e.u.Sa(),a=l(e.j.values()),o=a.next();!o.done;o=a.next())o.value.destroy();for(s=l(e.l.values()),u=s.next();!u.done;u=s.next()){h=u.value;try{e.i.removeSourceBuffer(h)}catch(e){}}return e.j.clear(),e.l.clear(),c=e.i.duration,e.J=new Br,e.i=Vs(e,e.J),_(A,e.J,4)}if(2!=A.g){for(!isNaN(c)&&c?e.i.duration=c:!isNaN(e.qa)&&e.qa&&(e.i.duration=e.qa),d=new Br,p=e.i.sourceBuffers,f=t.size,g=0,m=function(){++g===f&&(d.resolve(),e.u.Da(p,"addsourcebuffer",m))},e.u.o(p,"addsourcebuffer",m),v=l(t.keys()),y=v.next();!y.done;y=v.next())b=y.value,w=t.get(b),Ws(e,b,w,w.codecs);return(S=t.get(n.ma))&&S.isAudioMuxedInVideo&&(e.m=!0),e.m&&!e.s.has(n.ma)&&e.s.set(n.ma,[]),e.g.currentTime=i,_(A,d,2)}return x(A),e.F=!1,aa(e.H),e.u.ra(e.g,"canplaythrough",function(){e.H.g||(e.g.autoplay=r,e.gb&&(e.gb=!1,e.g.play()))}),C(A,0)})}(e,t)})}function du(e,t,n,i){var r=!1,a=et("audio",(i||"").split(",")),o=et("video",(i||"").split(",")),s=o;"audio"==t&&(s=a),s||(s=i),i=xi(n,s);var u=Li(e.D.get(t)),l=e.B.forceTransmux;if(!Ot(i)||!e.G&&Oi.includes(i)?l=!0:l||n==u||(l="WEBKIT"===Me().Fa()&&Oi.includes(n)),l&&(n=bi(e=Ci(n,s)))){var h=n();a&&o&&(r=!0),i=h.convertCodecs(t,e)}return t=Mi(Di(i)),{mc:h,pm:r,Di:Li(i),codec:t,mimeType:i}}function pu(e,t,n,i,r){if(t==nt)return{type:mu,Lf:n,mc:null};var a=Mi(Di(e.D.get(t))),o=Li(e.D.get(t)),s=du(e,t,n,i),u=s.mc,l=s.pm,h=s.Di,c=s.codec;s=s.mimeType;var d=!0;return l&&e.D.has("audio")&&(n=du(e,"audio",n,i),i=Mi(Di(e.D.get("audio"))),d=Li(e.D.get("audio")),d=i==n.codec&&d==n.Di,n.mc&&n.mc.destroy()),a===c&&o===h&&d?{type:mu,Lf:s,mc:u}:(a=!0,(e.m&&!r.has("audio")||l&&u&&!e.j.has(t))&&(a=!1),a&&"smooth"===e.B.codecSwitchingStrategy&&Ut()?{type:yu,Lf:s,mc:u}:(u&&u.destroy(),{type:vu,Lf:s,mc:null}))}(i=Hs.prototype).destroy=function(){return this.H.destroy()},i.init=function(e,t,n,i){t=void 0!==t&&t,n=void 0===n?"UNKNOWN":n,i=void 0!==i&&i;var r,a,o,s,u,h,c=this;return L(function(d){if(1==d.g)return r=it,_(d,c.J,2);if(3!=d.g)return Xs(c)||Ys(c)?(X("Expected MediaSource to be open during init(); reopening the media source."),c.J=new Br,c.i=Vs(c,c.J),_(d,c.J,3)):d.A(3);for(c.G=t,c.U=n,c.Ya=i,c.Ta=!c.G&&"HLS"==c.U&&!c.Ya,c.Y.clear(),c.R=null,c.na=null,c.P=null,c.ba=null,c.$=new Br,a=l(e.keys()),o=a.next();!o.done;o=a.next())s=o.value,u=e.get(s),Ws(c,s,u,u.codecs),c.m?(c.s.set(r.ma,[]),c.s.set(r.Ha,[])):c.s.set(s,[]);(h=e.get(r.ma))&&h.isAudioMuxedInVideo&&(c.m=!0),w(d)})},i.configure=function(e){this.B=e,this.h&&(this.h.B=e.modifyCueCallback)},i.Sb=function(){var e={total:this.F?[]:as(this.g.buffered),audio:as(Js(this,"audio")),video:as(Js(this,"video")),text:[]};if(this.h){var t=this.h.g,n=this.h.h;null!=t&&null!=n&&e.text.push({start:t,end:n})}return e},i.remove=function(e,t,n,i){var r,a=this;return L(function(o){return 1==o.g?(e==(r=it).Ha&&a.I&&a.I.remove(i),e==r.$a?_(o,a.h.remove(t,n),0):n>t?_(o,su(a,e,function(){return nu(a,e,t,n)},null),5):o.A(0)):a.m?_(o,su(a,r.ma,function(){return nu(a,r.ma,t,n)},null),0):o.A(0)})},i.flush=function(e){var t,n=this;return L(function(i){return 1==i.g?e==(t=it).$a?i.return():_(i,su(n,e,function(){n.g.currentTime-=.001,ou(n,e)},null),2):n.m?_(i,su(n,t.ma,function(){var e=t.ma;n.g.currentTime-=.001,ou(n,e)},null),0):i.A(0)})},i.endOfStream=function(e){var t=this;return L(function(n){return _(n,uu(t,function(){Xs(t)||Ys(t)||(e?t.i.endOfStream(e):t.i.endOfStream())}),0)})},i.wb=function(e){var t=this;return L(function(n){return _(n,uu(t,function(){if(t.B.durationReductionEmitsUpdateEnd&&e=t.s&&i&&!t.i)&&(t.j&&t.j(t.g,r),t.i=!0,t.g=n.g.currentTime),t=!i}t&&(t=e.g.currentTime,i=function(e,t,n){return e&&e.length&&!ts(e)&&0<=(e=as(e).findIndex(function(e,i,r){return e.start>t&&(0==i||r[i-1].end-t<=n)}))?e:null}(n=e.g.buffered,t,e.h.gapDetectionThreshold),null==i||0==i&&!e.B||(r=n.start(i),(a=e.h.gapPadding)&&(r=Math.ceil(100*(r+a))/100),r>=e.C.Kb()||.001>r-t||(0!=i&&n.end(i-1),e.g.currentTime=r,t==e.j&&(e.j=r),e.D++,e.u(new V("gapjumped")))))}}}function Su(e,t,n){this.h=e,this.m=Au(e),this.g=e.g.currentTime,this.l=Date.now()/1e3,this.i=!1,this.s=t,this.j=n}function Tu(e){var t=this;this.g=e,this.h=new At,this.i=!1,this.h.o(this.g,"audiofocuspaused",function(){t.i=!0}),this.h.o(this.g,"audiofocusgranted",function(){t.i=!1}),this.h.o(this.g,"audiofocuslost",function(){t.i=!0})}function Au(e){if(e.g.paused||0==e.g.playbackRate||e.i||0==e.g.buffered.length)var t=!1;else e:{t=e.g.currentTime;for(var n=(e=l(as(e.g.buffered))).next();!n.done;n=e.next())if(!(t<(n=n.value).start-.1||t>n.end-.5)){t=!0;break e}t=!1}return t}function Eu(e,t,n,i){t==HTMLMediaElement.HAVE_NOTHING||e.readyState>=t?i():(t=xu.value().get(t),n.ra(e,t,i))}(i=bu.prototype).getDuration=function(){return this.l},i.Rk=function(){return this.h},i.Ij=function(e){this.i=e},i.wb=function(e){this.l=e},i.Xk=function(){return this.i},i.Fj=function(e){this.B=e},i.pd=function(e){e&&!this.C&&(this.I=!0),this.C=e},i.fg=function(e){this.u=e},i.uf=function(){return this.u},i.Zh=function(e){this.D=e},i.Gk=function(){return this.D},i.nj=function(e,t){if(0!=e.length){var n=(Date.now()+this.B)/1e3;if(0!=(e=e.filter(function(e){return e.start+tMath.abs(e.g.currentTime-t)?Pu(e):(e.h.ra(e.g,"seeking",function(){Pu(e)}),Du(e.i,e.g.currentTime&&0!=e.g.currentTime?e.g.currentTime:t))}function Pu(e){e.s=!0,e.h.o(e.g,"seeking",function(){return e.m()}),e.u(e.g.currentTime)}function Lu(e){var t=this;this.g=e,this.m=10,this.j=this.l=this.i=0,this.h=new zi(function(){0>=t.i||t.g.currentTime!=t.l||t.g.currentTime===t.j?t.h.stop():(t.g.currentTime=t.j,t.i--)})}function Du(e,t){e.l=e.g.currentTime,e.j=t,e.i=e.m,e.g.currentTime=t,e.h.ya(.1)}function Ru(e){this.g=e,this.i=!1,this.h=null,this.j=new At}function Nu(e){return e.g.getStartDate&&(e=e.g.getStartDate().getTime(),!isNaN(e))?e/1e3:null}function Ou(e,t){return 0<(e=e.g.seekable).length&&(t=Math.max(e.start(0),t),t=Math.min(e.end(e.length-1),t)),t}function Uu(e,t,n,i,r,a){var o=this;this.h=e,this.g=t.presentationTimeline,this.l=n,this.u=r,this.s=null,this.j=new _u(e,t.presentationTimeline,n,a),this.i=new Cu(e,function(){e:{var e=o.j;e.l=!0,e.B=!1,e.i&&e.i.ya(e.h.gapJumpTimerTime),wu(e);var t=ku(o.i);if(e=ju(o,t),!Bt()&&.001n-t&&(t=n-3),ee.g.getDuration()?e.g.dc():e.g.Kb():t instanceof Date?t=t.getTime()/1e3-(e.g.m||e.g.i):0>t&&(t=e.g.Kb()+t),Fu(e,Gu(e,t))}function Fu(e,t){var n=e.g.getDuration();return t>=n?n-e.l.durationBackoff:t}function ju(e,t){var n=e.l.rebufferingGoal,i=e.l.safeSeekOffset,r=e.g.dc(),a=e.g.Kb(),o=e.g.getDuration();3>a-r&&(r=a-3);var s=e.g.ge(n),u=e.g.ge(i);return n=e.g.ge(n+i),t>=o?Fu(e,t):t>a?a-e.l.safeSeekEndOffset:t=s||is(e.h.buffered,t)?t:n}function Gu(e,t){var n=e.g.dc();return t(e=e.g.Kb())?e:t}function Hu(e){this.g=e,this.m=null,this.i=0,this.s=!1}function Vu(e){return e.g[0]||null}function Wu(e,t,n){return new Hu([e=new Jo(e,e+t,function(){return n},0,null,null,e,e,e+t)])}function zu(e,t,n,i){this.i=e,this.h=t,this.g=n,this.reverse=i}function Ku(){Hu.call(this,[]),this.h=[]}function Xu(e){var t=this;this.g=e,this.j=!1,this.i=this.g.tf(),this.h=new zi(function(){t.g.jj(.25*t.i)})}function Yu(e){e.h.stop();var t=e.j?0:e.i;if(0<=t)try{return void(e.g.tf()!=t&&e.g.bi(t))}catch(e){}e.h.ya(.25),0!=e.g.tf()&&e.g.bi(0)}function qu(e){var t=this;this.j=e,this.h=new At,this.g=new Set,this.i=new zi(function(){Zu(t,!1)}).Ka(),e.paused||this.i.ya(.25),this.h.o(e,"playing",function(){t.i.Ka().ya(.25)}),this.h.o(e,"pause",function(){t.i.stop()})}function Zu(e,t){for(var n=e.j.currentTime,i=(e=l(e.g)).next();!i.done;i=e.next())i.value.j(n,t)}function Ju(e){$.call(this),this.g=new Map,this.h=e}function Qu(e,t,n){return!!((e=e.h()[n])&&0=e[0].start&&tt;){var i=n.pop();i&&hl(e,i)}ul(e)}function hl(e,t){var n=e.h;t instanceof qo&&(n=e.j),e=n.get(t),n.delete(t),e&&e.abort()}function cl(e){this.g=e,this.ve=this.ji=null}function dl(e,t,n){var i=new Uint8Array(0);return e.ve=e.g(t,n,function(t){return L(function(n){if(1==n.g)return i=0=e.length)return e;var t=e.find(function(e){return e.startsWith("dvav.")||e.startsWith("dva1.")||e.startsWith("dvh1.")||e.startsWith("dvhe.")||e.startsWith("dav1.")||e.startsWith("dvc1.")||e.startsWith("dvi1.")});return t?Ot('video/mp4; codecs="'+t+'"')?[t]:e.filter(function(e){return e!=t}):e}(i),t=t.concat(i).concat(e),n.length&&!t.length?n:t}function gl(t,n,i){var r,a,o,s,u;return L(function(l){if(1==l.g)return(r=n).cryptoKey?l.A(2):_(l,r.fetchKey(),3);if(!(a=r.iv))for(a=Te(new ArrayBuffer(16)),o=r.firstMediaSequenceNumber+i,s=a.byteLength-1;0<=s;s--)a[s]=255&o,o>>=8;return u="CBC"==n.blockCipherMode?{name:"AES-CBC",iv:a}:{name:"AES-CTR",counter:a,length:64},l.return(e.crypto.subtle.decrypt(u,r.cryptoKey,t))})}function ml(e,t,n,i,r){return e=Zr(e,i,r),0==t&&null==n||(e.headers.Range=n?"bytes="+t+"-"+n:"bytes="+t+"-"),e}function vl(e,t){var n=this;this.g=t,this.j=e,this.i=null,this.J=new Map,this.D=1,this.B=this.s=null,this.O=0,this.h=new Map,this.I=!1,this.P=null,this.C=!1,this.l=new ra(function(){return function(e){var t,n,i,r,a,o;return L(function(s){if(1==s.g){for(e.u&&e.u.stop(),e.u=null,e.H&&e.H.stop(),e.H=null,t=[],n=l(e.h.values()),i=n.next();!i.done;i=n.next())Ol(r=i.value),t.push(Ul(r)),r.ia&&(sl(r.ia),r.ia=null);for(a=l(e.m.values()),o=a.next();!o.done;o=a.next())sl(o.value);return _(s,Promise.all(t),2)}e.h.clear(),e.m.clear(),e.g=null,e.j=null,e.i=null,e.G=null,w(s)})}(n)}),this.L=Date.now()/1e3,this.m=new Map,this.N={projection:null,hfov:null},this.U=0,this.R=1/0,this.F=null,this.K=[],this.u=new zi(function(){if(n.j&&n.g)if(n.j.presentationTimeline.T()){var e=n.j.presentationTimeline.dc(),t=n.j.presentationTimeline.Kb();1e.g.Xa(),i=l(e.h.values()),r=i.next();!r.done;r=i.next())(r=r.value).Aa&&r.Aa.Td(n),r.ia&&r.ia.Td(n);for(r=(i=l(e.m.values())).next();!r.done;r=i.next())r.value.Td(n);(n=e.h.get("video"))&&(i=n.stream)&&(t?(t=i.trickModeVideo)&&!n.Pc&&(wl(e,t,!1,0,!1),n.Pc=i):(t=n.Pc)&&(n.Pc=null,wl(e,t,!0,0,!1)))}function bl(e,t,n,i,r,a){n=void 0!==n&&n,i=void 0===i?0:i,r=void 0!==r&&r,a=void 0!==a&&a,e.s=t,e.I&&(t.video&&wl(e,t.video,n,i,r,a),t.audio&&wl(e,t.audio,n,i,r,a))}function _l(e,t){L(function(n){if(1==n.g)return e.F=null,e.B=t,e.I?t.segmentIndex?n.A(2):_(n,t.createSegmentIndex(),2):n.return();wl(e,t,!0,0,!1),w(n)})}function wl(e,t,n,i,r,a){var o=e.h.get(t.type);o||t.type!=nt?o&&(o.Pc&&(t.trickModeVideo?(o.Pc=t,t=t.trickModeVideo):o.Pc=null),o.stream!=t||r)&&(e.m.has(t)?o.ia=e.m.get(t):o.ia&&function(e,t){t&&t!==e.i&&(sl(e),e.i=t)}(o.ia,t),t.type==nt&&o.stream!=t&&(r=xi(t.mimeType,t.codecs),Ks(e.g.ha,r,e.j.sequenceMode,t.external)),!e.m.has(o.stream)&&o.stream.closeSegmentIndex&&(o.Za?(r="("+o.type+":"+o.stream.id+")",e.J.has(r)||e.J.set(r,o.stream.closeSegmentIndex)):o.stream.closeSegmentIndex()),r=o.stream.isAudioMuxedInVideo!=t.isAudioMuxedInVideo,o.stream=t,o.Aa=null,o.Eg=!!a,t.dependencyStream?o.Hc=Al(e,t.dependencyStream):o.Hc=null,r&&(o.ub=null,o.vc=null,o.uc=null,t.isAudioMuxedInVideo&&(t=null,"video"===o.type?t=e.h.get("audio"):"audio"===o.type&&(t=e.h.get("video")),t&&(Ul(t).catch(function(){}),t.ub=null,t.vc=null,t.uc=null,Tl(e,t),Sl(e,t).catch(function(t){e.g&&e.g.onError(t)})))),n?o.Xc?o.vg=!0:o.Za?(o.Vc=!0,o.jf=i,o.vg=!0):(Ol(o),Rl(e,o,!0,i).catch(function(t){e.g&&e.g.onError(t)})):o.Za||o.Db||Nl(e,o,0),Sl(e,o).catch(function(t){e.g&&e.g.onError(t)})):function(e,t){var n,i,r,a,o;L(function(s){switch(s.g){case 1:return n=it,e.O++,i=e.O,S(s,2),_(s,$s(e.g.ha,n.$a),4);case 4:A(s,3);break;case 2:r=E(s),e.g&&e.g.onError(r);case 3:a=xi(t.mimeType,t.codecs),Ks(e.g.ha,a,e.j.sequenceMode,t.external),(e.g.ha.Z.isTextVisible()||e.i.alwaysStreamText)&&e.O==i&&(o=Al(e,t),e.h.set(n.$a,o),Nl(e,o,0)),w(s)}})}(e,t)}function Sl(e,t){var n,i,r;return L(function(a){if(1==a.g)return t.Nb?(n=t.stream,i=t.Nb,n.segmentIndex?a.A(2):_(a,n.createSegmentIndex(),2)):a.return();if(4!=a.g)return!(r=n.dependencyStream)||r.segmentIndex?a.A(4):_(a,r.createSegmentIndex(),4);if(t.Nb!=i||t.stream!=n)return a.return();var o=e.g.ed(),s=Zs(e.g.ha,t.type),u=t.stream.segmentIndex.find(t.Ra?t.Ra.endTime:o),l=null==u?null:t.stream.segmentIndex.get(u);u=l&&l.endByte?l.endByte-l.startByte:null,l&&!u&&(u=(l.endTime-l.getStartTime())*(t.stream.bandwidth||0)/8),u?((l=l.ea)&&(u+=(l.endByte?l.endByte-l.startByte:null)||0),o=8*u/(l=e.g.getBandwidthEstimate())<(s||0)-o-e.i.rebufferingGoal||t.Nb.h.g>u):o=!1,o&&t.Nb.abort(),w(a)})}function Tl(e,t){t.Xc||t.Vc||(t.Za?(t.Vc=!0,t.jf=0):null==qs(e.g.ha,t.type)?null==t.Db&&Nl(e,t,0):(Ol(t),Rl(e,t,!1,0).catch(function(t){e.g&&e.g.onError(t)})))}function Al(e,t){var n={stream:t,type:t.type,Aa:null,ia:El(e,t),Ra:null,ub:null,Ff:null,vc:null,uc:null,Df:null,Ef:null,Pc:null,endOfStream:!1,Za:!1,Db:null,Vc:!1,jf:0,vg:!1,Xc:!1,od:!0,Eg:!1,Ph:!1,je:!1,Nb:null,Hc:null};return t.dependencyStream&&(n.Hc=Al(e,t.dependencyStream)),n}function El(e,t){if("video"===t.type&&e.i.disableVideoPrefetch||"audio"===t.type&&e.i.disableAudioPrefetch||t.type===nt&&("application/cea-608"==t.mimeType||"application/cea-708"==t.mimeType)||t.type===nt&&e.i.disableTextPrefetch)return null;if(e.m.has(t))return e.m.get(t);var n=e.h.get(t.type);return(n=n&&n.ia)&&t===n.i?n:0e.g.Xa()):null}function xl(t,n){var i,r,a,o,s,u,h,c,d;return L(function(p){switch(p.g){case 1:if(aa(t.l),i=it,n.Za||null==n.Db||n.Xc)return p.return();if(n.Db=null,!n.Vc){p.A(2);break}return _(p,Rl(t,n,n.vg,n.jf),3);case 3:return p.return();case 2:if(function(e,t){for(var n=l(e.J.entries()),i=n.next();!i.done;i=n.next()){var r=l(i.value);i=r.next().value,r=r.next().value,i.includes(t.type)&&(r(),e.J.delete(i))}}(t,n),n.stream.segmentIndex){p.A(4);break}return r=n.stream,S(p,5),_(p,n.stream.createSegmentIndex(),7);case 7:A(p,6);break;case 5:return a=E(p),_(p,Bl(t,n,a),8);case 8:return p.return();case 6:if(r!=n.stream)return r.closeSegmentIndex&&r.closeSegmentIndex(),n.Za||n.Db||Nl(t,n,0),p.return();case 4:if(!n.Hc){p.A(9);break}if(n.Hc.stream.segmentIndex){p.A(9);break}return S(p,11),_(p,n.Hc.stream.createSegmentIndex(),13);case 13:A(p,9);break;case 11:E(p);case 9:S(p,14),o=function(t,n){if(Pl(n))return function(e,t){var n=Zs(e,"video")||0;Gi(e.h,t,n)}(t.g.ha,n.stream.originalId||""),null;if(n.type==nt&&function(e){e.h&&Gi(e.h,"",0)}(t.g.ha),n.stream.isAudioMuxedInVideo)return null;var i=t.i.updateIntervalSeconds/Math.max(1,Math.abs(t.g.Xa()));if(!zs(t.g.ha)&&n.type!=nt)return i/2;var r=t.g.ed();if("audio"===n.type)for(var a=l(t.m.keys()),o=a.next();!o.done;o=a.next())(o=t.m.get(o.value)).hb(r,!0),rl(o,r);a=n.Ra?n.Ra.endTime:r;var s=function(e,t,n){return t==nt?null==(e=e.h).h||e.hu&&h)return n.endOfStream=!0,"video"==n.type&&(t=t.h.get(nt))&&Pl(t)&&(t.endOfStream=!0),null;if(n.endOfStream=!1,s>=o)return i/2;if(u=!n.Aa,h=function(e,t,n,i){if(t.Aa)return(n=t.Aa.current())&&t.Ra&&.001>Math.abs(t.Ra.startTime-n.startTime)&&(n=t.Aa.next().value),n;if(t.Ra||i)return n=t.Ra?t.Ra.endTime:i,e=0>e.g.Xa(),t.stream.segmentIndex&&(t.Aa=t.stream.segmentIndex.cc(n,!1,e)),t.Aa&&t.Aa.next().value;i=e.j.sequenceMode||jl(e)?0:e.i.inaccurateManifestTolerance;var r=Math.max(n-i,0);e=0>e.g.Xa();var a=null;return i&&(t.stream.segmentIndex&&(t.Aa=t.stream.segmentIndex.cc(r,!1,e)),a=t.Aa&&t.Aa.next().value),a||(t.stream.segmentIndex&&(t.Aa=t.stream.segmentIndex.cc(n,!1,e)),a=t.Aa&&t.Aa.next().value),a}(t,n,r,h),!h)return i;s=n.ub;var c=h.ea;s&&c&&Zo(c,s)&&(s.g=c.g),s=!1,u&&n.Eg&&(s=!0,n.Eg=!1),u=1/0;for(var d=(c=l(c=Array.from(t.h.values()))).next();!d.done;d=c.next())Pl(d=d.value)||d.Aa&&!d.Aa.current()||(u=Math.min(u,d.Ra?d.Ra.endTime:r));return a>=u+t.j.presentationTimeline.h?i:(n.ia&&n.Aa&&!t.m.has(n.stream)&&(n.ia.hb(h.startTime+.001),rl(n.ia,h.startTime).catch(function(){})),jl(t)&&function(e,t,n){if(t.type===nt)return!1;var i=t.ub;if(!i)return!1;var r=n.ea;if(n=i.g!==r.g,"reset_to_encrypted"===e.i.crossBoundaryStrategy&&(i.encrypted||r.encrypted||(n=!1),i.encrypted&&(e.i.crossBoundaryStrategy="keep")),"RESET_ON_ENCRYPTION_CHANGE"===e.i.crossBoundaryStrategy&&i.encrypted==r.encrypted&&(n=!1),n&&t.od){var a=e.g.video,o=a.paused;Fl(e,!0).then(function(){var t=(new Map).set("oldEncrypted",i.encrypted).set("newEncrypted",r.encrypted);e.g.onEvent(new V("boundarycrossed",t)),o||a.play()})}return n}(t,n,h)||(function(t,n,i,r,a){var o,s,u,h,c,d,p,f,g,m,v,y,b,T,x,C;return L(function(k){switch(k.g){case 1:if(o=it,s=n.stream,u=n.Aa,n.Za=!0,S(k,2),2==r.Lc())throw new Ce(1,1,1011);return _(k,function(e,t,n,i){var r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w;return L(function(T){switch(T.g){case 1:if(r=it,a=null==t.Ra,o=[],s=Math.max(0,Math.max(n.appendWindowStart,e.U)-.1),u=Math.min(n.appendWindowEnd,e.R)+.1,h=n.codecs||t.stream.codecs,c=Pi(h),d=Li(n.mimeType||t.stream.mimeType),(p=n.timestampOffset)==t.Ff&&s==t.vc&&u==t.uc&&c==t.Df&&d==t.Ef){T.A(2);break}if(f=t.Df&&t.Ef&&function(e,t,n,i,r){return(e=pu(e,t,n,i,r)).mc&&e.mc.destroy(),e.type==vu}(e.g.ha,t.type,d,h,Hl(e)),!f){T.A(3);break}if(g=null,t.type===r.Ha?g=e.h.get(r.ma):t.type===r.ma&&(g=e.h.get(r.Ha)),!g){T.A(3);break}return _(T,Ul(g).catch(function(){}),5);case 5:g.ub=null,g.vc=null,g.uc=null,Tl(e,g);case 3:return _(T,kl(e,t,p,s,u,n,c,d),2);case 2:return Zo(n.ea,t.ub)||(t.ub=n.ea,n.l&&n.ea&&(m=Ll(e,t,n.ea),v=function(){var a,o,s,u,h,c,d,p,f;return L(function(g){switch(g.g){case 1:return S(g,2),_(g,m,4);case 4:return a=g.h,aa(e.l),o=null,s=new Map,u={projection:null,hfov:null},(h=new ca).box("moov",da).box("trak",da).box("mdia",da).V("mdhd",function(e){o=po(e.reader,e.version).timescale}).box("hdlr",function(e){switch((e=e.reader).skip(8),e.ld()){case"soun":s.set(r.ma,o);break;case"vide":s.set(r.Ha,o)}o=null}),t.type===r.Ha&&h.box("minf",da).box("stbl",da).V("stsd",pa).box("encv",fa).box("avc1",fa).box("avc3",fa).box("hev1",fa).box("hvc1",fa).box("dvav",fa).box("dva1",fa).box("dvh1",fa).box("dvhe",fa).box("dvc1",fa).box("dvi1",fa).box("vexu",da).box("proj",da).V("prji",function(e){e=e.reader.ld(),u.projection=e}).box("hfov",function(e){e=e.reader.W()/1e3,u.hfov=e}),h.parse(a,!0,!0),t.type===r.Ha&&function(e,t){if(e.N.projection!=t.projection||e.N.hfov!=t.hfov){if(null!=t.projection||null!=t.hfov){var n=(new Map).set("detail",t);n=new V("spatialvideoinfo",n)}else n=new V("nospatialvideoinfo");n.cancelable=!0,e.g.onEvent(n),e.N=t}}(e,u),s.has(t.type)?n.ea.timescale=s.get(t.type):null!=o&&(n.ea.timescale=o),(c=t.stream.segmentIndex)instanceof Ku&&(d=function(e,t){for(var n=(e=l(e.h)).next();!n.done;n=e.next())if(null!=(n=n.value).find(t))return n.kf();return-1}(c,n.startTime)),p=t.stream.closedCaptions&&0Math.abs(r-n)?a.return():(su(e,t,function(){return iu(e,t)},null),e.m&&su(e,i.ma,function(){return iu(e,i.ma)},null),_(a,su(e,t,function(){return ru(e,t,n)},null),2))):e.m?_(a,su(e,i.ma,function(){return ru(e,i.ma,n)},null),0):a.A(0)})}(e.g.ha,t.type,n.startTime)),_(T,Promise.all(o),0)}})}(t,n,r,a),4);case 4:return aa(t.l),t.C?k.return():(h="video/mp4"==s.mimeType||"audio/mp4"==s.mimeType,c=e.ReadableStream,t.i.lowLatencyMode&&t.j.isLowLatency&&c&&h&&("HLS"!=t.j.type||r.m)?(p=new Uint8Array(0),g=f=!1,v=function(e){var o,u,l;return L(function(h){switch(h.g){case 1:if(f)return h.return();if(g=!0,aa(t.l),t.C)return h.return();if(S(h,2),p=qe(p,e),o=!1,u=0,(new ca).box("mdat",function(e){u=e.size+e.start,o=!0}).parse(p,!1,!0),!o){h.A(4);break}return l=p.subarray(0,u),p=p.subarray(u),_(h,Il(t,n,i,s,r,l,!0,a),5);case 5:n.ia&&n.Aa&&rl(n.ia,r.startTime,!0);case 4:A(h,0);break;case 2:m=E(h),w(h)}})},_(k,Ll(t,n,r,v),9)):_(k,Ll(t,n,r),7));case 7:return d=k.h,aa(t.l),t.C?k.return():(aa(t.l),n.Vc?(n.Za=!1,Nl(t,n,0),k.return()):_(k,Il(t,n,i,s,r,d,!1,a),6));case 9:if(y=k.h,m)throw m;if(g){k.A(10);break}return f=!0,aa(t.l),t.C?k.return():n.Vc?(n.Za=!1,Nl(t,n,0),k.return()):_(k,Il(t,n,i,s,r,y,!1,a),10);case 10:n.ia&&n.Aa&&rl(n.ia,r.startTime,!0);case 6:if(aa(t.l),t.C)return k.return();n.Ra=r,u.next(),n.Za=!1,n.Ph=!1,b=t.g.ha.Sb(),T=b[n.type],JSON.stringify(T),n.Vc||(x=null,n.type===o.Ha?x=t.h.get(o.ma):n.type===o.ma&&(x=t.h.get(o.Ha)),x&&x.type==o.ma?t.g.Pf(r,n.stream,x.stream.isAudioMuxedInVideo):t.g.Pf(r,n.stream,n.stream.codecs.includes(","))),Ol(n),Nl(t,n,0),A(k,0);break;case 2:if(C=E(k),aa(t.l,C),t.C)return k.return();if(n.Za=!1,7001==C.code)n.Za=!1,Ol(n),Nl(t,n,0),k.A(0);else{if(n.type!=o.$a||!t.i.ignoreTextStreamFailures)return 3017==C.code?_(k,function(e,t,n){var i,r,a;return L(function(o){if(1==o.g){if(Array.from(e.h.values()).some(function(e){return e!=t&&e.Ph}))return o.A(2);if(i=0===e.i.maxDisabledTime&&1011==n.code?1:e.i.maxDisabledTime,e.g.disableStream(t.stream,i))return o.return();if(e.i.avoidEvictionOnQuotaExceededError)return Nl(e,t,4),o.return();if(20<(r=Math.round(100*e.D)))e.D-=.2;else{if(!(4f)return _(g,Cl(e,t,s.startTime,i),0);g.A(0)}})}function kl(e,t,n,i,r,a,o,s){var u,l,h,c,d;return L(function(p){switch(p.g){case 1:if(u=it,l=Hl(e),S(p,2),t.vc=i,t.uc=r,o&&(t.Df=o),s&&(t.Ef=s),t.Ff=n,h=e.j.sequenceMode||"HLS"==e.j.type,c=null,t.type===u.Ha?c=e.h.get(u.ma):t.type===u.ma&&(c=e.h.get(u.Ha)),!(c&&c.stream&&c.stream.isAudioMuxedInVideo)){p.A(4);break}return _(p,eu(e.g.ha,c.type,n,i,r,h,c.stream.mimeType,c.stream.codecs,l),4);case 4:return _(p,eu(e.g.ha,t.type,n,i,r,h,a.mimeType||t.stream.mimeType,a.codecs||t.stream.codecs,l),6);case 6:A(p,0);break;case 2:throw d=E(p),t.vc=null,t.uc=null,t.Df=null,t.Ef=null,t.Ff=null,d}})}function Il(e,t,n,i,r,a,o,s){var u,l,h,c;return o=void 0!==o&&o,s=void 0!==s&&s,L(function(d){switch(d.g){case 1:return u=i.closedCaptions&&0u&&(d=Math.max(s-a,h-u-o)),d<=u?p.return():_(p,e.g.ha.remove(t.type,o,o+d,r),2))):4!=p.g?(aa(e.l),e.F?_(p,Ml(e,e.F,n),4):p.A(0)):(aa(e.l),void w(p))})}function Pl(e){return e&&e.type==nt&&("application/cea-608"==e.stream.mimeType||"application/cea-708"==e.stream.mimeType)}function Ll(e,t,n,i){var r,a,o,s,u;return L(function(l){switch(l.g){case 1:if(r=n.ec())return l.return(r);if(a=null,t.ia){var h=t.ia,c=h.h;n instanceof qo&&(c=h.j),c.has(n)?(h=c.get(n),i&&(h.ji=i),a=h.ve):a=null}return a||(a=Dl(n,t.stream,i||null,e.i.retryParameters,e.g.yc)),o=0,t.Aa&&(o=t.Aa.h),t.Nb=a,_(l,a.promise,2);case 2:if(s=l.h,t.Nb=null,u=s.data,!n.aesKey){l.A(3);break}return _(l,gl(u,n.aesKey,o),4);case 4:u=l.h;case 3:return l.return(u)}})}function Dl(e,t,n,i,r,a){a=void 0!==a&&a;var o=e instanceof Jo?e:void 0,s=o?1:0;return(e=ml(e.S(),e.startByte,e.endByte,i,n)).contentType=t.type,r.request(ta,e,{type:s,stream:t,segment:o,isPreload:a})}function Rl(e,t,n,i){var r,a;return L(function(o){return 1==o.g?(t.Vc=!1,t.vg=!1,t.jf=0,t.Xc=!0,t.Ra=null,t.Aa=null,t.ia&&!e.m.has(t.stream)&&sl(t.ia),i?(r=e.g.ed(),a=e.g.ha.getDuration(),_(o,e.g.ha.remove(t.type,r+i,a),3)):_(o,$s(e.g.ha,t.type),4)):3!=o.g?(aa(e.l),n?_(o,e.g.ha.flush(t.type),3):o.A(3)):(aa(e.l),t.Xc=!1,t.endOfStream=!1,t.Za||t.Db||Nl(e,t,0),void w(o))})}function Nl(e,t,n){var i=t.type;(i!=nt||e.h.has(i))&&(t.Db=new Wi(function(){var n;return L(function(i){return 1==i.g?(S(i,2),_(i,xl(e,t),4)):2!=i.g?A(i,0):(n=E(i),e.g&&e.g.onError(n),void w(i))})}).X(n))}function Ol(e){null!=e.Db&&(e.Db.stop(),e.Db=null)}function Ul(e){return L(function(t){return e.Nb?_(t,e.Nb.abort(),0):t.A(0)})}function Bl(e,t,n){var i;return L(function(r){if(1==r.g)return 3024==n.code?(t.Za=!1,Ol(t),Nl(e,t,0),r.return()):_(r,Or(e.P),2);if(aa(e.l),1===n.category&&1003!=n.code){if(t.Pc)return yl(e,!1),r.return();i=0===e.i.maxDisabledTime&&1011==n.code?1:e.i.maxDisabledTime,n.handled=e.g.disableStream(t.stream,i),n.handled&&(n.severity=1)}n.handled&&1011==n.code||e.g.onError(n),n.handled||e.i.failureCallback(n),w(r)})}function Fl(e,t){t=void 0!==t&&t;var n,i,r,a,o,s=void 0===s||s;return L(function(u){if(1==u.g){if(n=Date.now()/1e3,i=e.i.minTimeBetweenRecoveries,!t){if(!e.i.allowMediaSourceRecoveries||n-e.L(t=n.g-t)||1(r=e.indexOf(".",r)));)0!=r&&"\\"==e[r-1]||(i[a=e.substring(a,r).replace(/\\\./g,".")]={},i=i[a],a=r+1),r+=1;return i[e.substring(a).replace(/\\\./g,".")]=t,n}function Kl(e,t){return e&&t}function Xl(e,t){function n(e){return e&&"object"==typeof e&&!Array.isArray(e)}return e=function e(t,i){return Object.keys(t).reduce(function(r,a){var o=t[a];return i.hasOwnProperty(a)?o instanceof HTMLElement&&i[a]instanceof HTMLElement?o.isEqualNode(i[a])||(r[a]=o):n(o)&&n(i[a])?(o=e(o,i[a]),(0t)}).sort(function(e,t){return e.audio||t.audio?e.audio?t.audio?(t.audio.channelsCount||0)-(e.audio.channelsCount||0):1:-1:0})}function th(e,t){return e.filter(function(e){return!e.audio||e.audio.codecs==t})}function nh(){}function ih(){var t=1/0,n=Me();navigator.connection&&navigator.connection.saveData&&(t=360);var i={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,persistentSessionOnlinePlayback:!1,persistentSessionsMetadata:[],initDataTransform:function(t,n,i){return"apple"===e.shakaMediaKeysPolyfill&&"skd"==n&&(n=i.serverCertificate,t=Zl(t,i=ql(t),n)),t},logLicenseExchange:!1,updateExpirationTime:1,preferredKeySystems:[],keySystemsMapping:{},parseInbandPsshEnabled:!1,minHdcpVersion:"",ignoreDuplicateInitData:!0,defaultAudioRobustnessForWidevine:"SW_SECURE_CRYPTO",defaultVideoRobustnessForWidevine:"SW_SECURE_DECODE"},r="reload",a=!1;Ut()&&n.sd()&&(r="smooth",a=!0);var o={trackSelectionCallback:function(e){return L(function(t){return t.return(e)})},downloadSizeCallback:function(e){var t;return L(function(n){return 1==n.g?navigator.storage&&navigator.storage.estimate?_(n,navigator.storage.estimate(),3):n.return(!0):(t=n.h,n.return(t.usage+e<.95*t.quota))})},progressCallback:function(e,t){return Kl([e,t])},usePersistentLicense:!0,numberOfParallelDownloads:5},s={drm:i,manifest:a={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,disableThumbnails:!1,disableIFrames:!1,defaultPresentationDelay:0,segmentRelativeVttTiming:!1,raiseFatalErrorOnManifestUpdateRequestFailure:!1,continueLoadingWhenPaused:!0,ignoreSupplementalCodecs:!1,updatePeriod:-1,ignoreDrmInfo:!1,dash:{clockSyncUri:"",disableXlinkProcessing:!0,xlinkFailGracefully:!1,ignoreMinBufferTime:!1,autoCorrectDrift:!0,initialSegmentLimit:1e3,ignoreSuggestedPresentationDelay:!1,ignoreEmptyAdaptationSet:!1,ignoreMaxSegmentDuration:!1,keySystemsByURI:{"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2":"com.apple.fps","urn:uuid:3d5e6d35-9b9a-41e8-b843-dd3c6e72c42c":"com.huawei.wiseplay"},manifestPreprocessor:ah,manifestPreprocessorTXml:oh,sequenceMode:!1,multiTypeVariantsAllowed:a,useStreamOnceInPeriodFlattening:!1,enableFastSwitching:!0},hls:{ignoreTextStreamFailures:!1,ignoreImageStreamFailures:!1,defaultAudioCodec:"mp4a.40.2",defaultVideoCodec:"avc1.42E01E",ignoreManifestProgramDateTime:!1,ignoreManifestProgramDateTimeForTypes:[],mediaPlaylistFullMimeType:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"',liveSegmentsDelay:3,sequenceMode:n.rd(),ignoreManifestTimestampsInSegmentsMode:!1,disableCodecGuessing:!1,disableClosedCaptionsDetection:!1,allowLowLatencyByteRangeOptimization:!0,allowRangeRequestsToGuessMimeType:!1},mss:{manifestPreprocessor:ah,manifestPreprocessorTXml:oh,sequenceMode:!1,keySystemsBySystemId:{"9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready"}}},streaming:{retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},failureCallback:function(e){return Kl([e])},rebufferingGoal:0,bufferingGoal:10,bufferBehind:30,evictionGoal:1,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,gapDetectionThreshold:.5,gapPadding:0,gapJumpTimerTime:.25,durationBackoff:1,safeSeekOffset:5,safeSeekEndOffset:0,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsForFairPlay:!0,inaccurateManifestTolerance:2,lowLatencyMode:!1,preferNativeDash:!1,preferNativeHls:!1,updateIntervalSeconds:1,observeQualityChanges:!1,maxDisabledTime:30,segmentPrefetchLimit:1,prefetchAudioLanguages:[],disableAudioPrefetch:!1,disableTextPrefetch:!1,disableVideoPrefetch:!1,liveSync:{enabled:!1,targetLatency:.5,targetLatencyTolerance:.5,maxPlaybackRate:1.1,minPlaybackRate:.95,panicMode:!1,panicThreshold:60,dynamicTargetLatency:{enabled:!1,stabilityThreshold:60,rebufferIncrement:.5,maxAttempts:10,maxLatency:4,minLatency:1}},allowMediaSourceRecoveries:!0,minTimeBetweenRecoveries:5,vodDynamicPlaybackRate:!1,vodDynamicPlaybackRateLowBufferRate:.95,vodDynamicPlaybackRateBufferRatio:.5,preloadNextUrlWindow:30,loadTimeout:30,clearDecodingCache:!1,dontChooseCodecs:!1,shouldFixTimestampOffset:!1,avoidEvictionOnQuotaExceededError:!1,crossBoundaryStrategy:"keep",returnToEndOfLiveWindowWhenOutside:!1},networking:{forceHTTP:!1,forceHTTPS:!1,minBytesForProgressEvents:16e3},mediaSource:{codecSwitchingStrategy:r,addExtraFeaturesToSourceBuffer:function(e){return Kl([e],"")},forceTransmux:!1,insertFakeEncryptionInInit:!0,correctEc3Enca:!1,modifyCueCallback:function(e,t){return Kl([e,t])},dispatchAllEmsgBoxes:!1,useSourceElements:!0,durationReductionEmitsUpdateEnd:!0},offline:o,abrFactory:function(){return new Ar},adaptationSetCriteriaFactory:function(){return new(Function.prototype.bind.apply($l,[null].concat(h(D.apply(0,arguments)))))},abr:{enabled:!0,useNetworkInformation:!0,defaultBandwidthEstimate:1e6,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:t,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0,minChannelsCount:0,maxChannelsCount:1/0},advanced:{minTotalBytes:128e3,minBytes:16e3,fastHalfLife:2,slowHalfLife:5},restrictToElementSize:!1,restrictToScreenSize:!1,ignoreDevicePixelRatio:!1,clearBufferSwitch:!1,safeMarginSwitch:0,cacheLoadThreshold:5,minTimeToSwitch:0,preferNetworkInformationBandwidth:!1,removeLatencyFromFirstPacketTime:!0},autoShowText:3,preferredAudioLanguage:"",preferredAudioLabel:"",preferredTextLanguage:"",preferredVariantRole:"",preferredTextRole:"",preferredAudioChannelCount:2,preferredVideoHdrLevel:"AUTO",preferredVideoLayout:"",preferredVideoLabel:"",preferredVideoCodecs:[],preferredAudioCodecs:[],preferredTextFormats:[],preferForcedSubs:!1,preferSpatialAudio:!1,preferredDecodingAttributes:[],restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0,minChannelsCount:0,maxChannelsCount:1/0},playRangeStart:0,playRangeEnd:1/0,textDisplayer:{captionsUpdatePeriod:.25,fontScaleFactor:1},textDisplayFactory:function(){return null},cmcd:{enabled:!1,sessionId:"",contentId:"",rtpSafetyFactor:5,useHeaders:!1,includeKeys:[],version:1},cmsd:{enabled:!0,applyMaximumSuggestedBitrate:!0,estimatedThroughputWeightRatio:.5},lcevc:{enabled:!1,dynamicPerformanceScaling:!0,logLevel:0,drawLogo:!1,poster:!0},ads:{customPlayheadTracker:!1,skipPlayDetection:!1,supportsMultipleMediaElements:!0,disableHLSInterstitial:!1,disableDASHInterstitial:!1,allowPreloadOnDomElements:!0,allowStartInMiddleOfInterstitial:!0},ignoreHardwareResolution:!1,queue:{preloadNextUrlWindow:30,repeatMode:0}};return o.trackSelectionCallback=function(e){return L(function(t){return t.return(function(e,t,n){var i=n;"AUTO"==i&&(n=e.some(function(e){return!(!e.hdr||"HLG"!=e.hdr)}),i=fv(n));var r=e.filter(function(e){return!("variant"!=e.type||e.hdr&&e.hdr!=i)});n=[];var a=gt(t,r.map(function(e){return e.language}));a&&(n=r.filter(function(e){return ht(e.language)==a})),0==n.length&&(n=r.filter(function(e){return e.primary})),0==n.length&&(r.map(function(e){return e.language}),n=r);var o=n.filter(function(e){return e.height&&480>=e.height});for(o.length&&(o.sort(function(e,t){return t.height-e.height}),n=o.filter(function(e){return e.height==o[0].height})),t=[],n.length&&(r=Math.floor(n.length/2),n.sort(function(e,t){return e.bandwidth-t.bandwidth}),t.push(n[r])),n=(e=l(e)).next();!n.done;n=e.next())(n=n.value).type!=nt&&"image"!=n.type||t.push(n);return t}(e,s.preferredAudioLanguage,s.preferredVideoHdrLevel))})},n.ab(s)}function rh(e,t,n){var i={".drm.keySystemsMapping":"",".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:[],audioRobustness:[],sessionType:"",serverCertificate:new Uint8Array(0),serverCertificateUri:"",individualizationServer:"",headers:{}}};return Wl(e,t,n||ih(),i,"")}function ah(e){return Kl([e],e)}function oh(e){return Kl([e],e)}function sh(){this.g=null,this.h=[]}function uh(e,t){var n=0;e.g&&e.g.state==t&&(n+=e.g.duration);for(var i=(e=l(e.h)).next();!i.done;i=e.next())n+=(i=i.value).state==t?i.duration:0;return n}function lh(){this.i=this.h=null,this.g=[]}function hh(e,t,n){e.i!=t&&(e.i=t,e.g.push({timestamp:Date.now()/1e3,id:t.id,type:"text",fromAdaptation:n,bandwidth:null}))}function ch(){this.C=this.U=NaN,this.l="",this.j=this.dj=this.u=this.B=this.J=this.D=this.s=this.m=this.I=this.F=this.i=this.P=this.R=this.L=this.N=this.O=NaN,this.K=0,this.G=this.H=NaN,this.g=new sh,this.h=new lh}function dh(e,t,n){e.U=t,e.C=n}function ph(e,t){e.j=isNaN(e.j)?t:e.j+t}function fh(e,t,n,i){$.call(this),this.N=e,this.U=t,this.La=i.networkingEngine,this.m=n,this.B=null,this.Ia=0,this.Ya=i.yd,this.F=i.Hl,this.eb=i.Il,this.g=i.config,this.l=this.G=this.h=null,this.qa=!1,this.H=i.Tl,this.sa=!1,this.i=null,this.ba=!1,this.j=this.D=null,this.Z=!1,this.L=new Map,this.ua=!1,this.Na=i.Sl,this.Y=new ch,this.na=new Br,this.u=new Br,this.O=null,this.s=!1,this.$=i.gk,this.R=this.J=null,this.Ta=i.fk,this.P=!1,this.K=[],this.I=[],this.C=!0}function gh(e,t,n){(e=t?e.I:e.K)?e.push(n):n()}function mh(e,t){if(e.O=t,e.P=!0,e.K)for(var n=(t=l(e.K)).next();!n.done;n=t.next())(n=n.value)();e.K=null}function vh(e){if(e.s)throw new Ce(2,7,7003)}function yh(e,t){e.dispatchEvent(new V("onstatechange",(new Map).set("state",t)))}function bh(e,t){var n,i,r;return L(function(a){switch(a.g){case 1:return!e.h||e.i?a.return():(yh(e,"drm-engine"),e.Ia=Date.now()/1e3,e.i=e.Ya(),e.F.h=e.i,e.i.configure(e.g.drm,function(){return e.C}),n=pr(e.h.variants),i=!0,e.h&&e.h.presentationTimeline&&(i=e.h.presentationTimeline.T()),_(a,Ea(e.i,n,e.h.offlineSessionIds,i),2));case 2:if(vh(e),!t){a.A(3);break}return _(a,e.i.bc(t),4);case 4:vh(e);case 3:return _(a,eo(e.F,e.h),5);case 5:if(!a.h){a.A(0);break}return r=new V("trackschanged",void 0),_(a,Promise.resolve(),7);case 7:e.dispatchEvent(r),w(a)}})}function _h(e){var t=pr(e.h.variants);return t=e.B.create(t),e.j.configure(e.g.abr),e.j.setVariants(Array.from(t.values())),e.j.chooseVariant()}function wh(e,t,n){var i,r,a,o,s;return L(function(u){return 1==u.g?(i=e.g.streaming.segmentPrefetchLimit||2,r=new nl(i,t,function(t,n,i){return Dl(t,n,i||null,e.g.streaming.retryParameters,e.La,e.C)},!1),e.L.set(t.id,r),t.segmentIndex?u.A(2):_(u,t.createSegmentIndex(),2)):(a="number"==typeof e.m?e.m:0,o=t.segmentIndex.cc(a),s=null,o&&((s=o.current())||(s=o.next().value)),s||(s=Vu(t.segmentIndex)),s?n?s.ea?_(u,al(r,s.ea),0):u.A(0):_(u,rl(r,s.startTime),0):u.A(0))})}function Sh(e,t){$.call(this);var n=this;this.i=e,this.l=t,this.g=new Map,this.m=[{wd:null,vd:Eh,gd:function(e,t){return Th(n,"enter",e,t)}},{wd:Ah,vd:Eh,gd:function(e,t){return Th(n,"enter",e,t)}},{wd:xh,vd:Eh,gd:function(e,t){return Th(n,"enter",e,t)}},{wd:Eh,vd:Ah,gd:function(e,t){return Th(n,"exit",e,t)}},{wd:Eh,vd:xh,gd:function(e,t){return Th(n,"exit",e,t)}},{wd:Ah,vd:xh,gd:function(e,t){t?Th(n,"skip",e,t):(Th(n,"enter",e,t),Th(n,"exit",e,t))}},{wd:xh,vd:Ah,gd:function(e,t){return Th(n,"skip",e,t)}}],this.h=new At,this.h.o(this.i,"regionremove",function(e){n.g.delete(e.region)})}function Th(e,t,n,i){t=new V(t,new Map([["region",n],["seeking",i]])),e.dispatchEvent(t)}Cu.prototype.release=function(){this.h&&(this.h.release(),this.h=null),null!=this.i&&(this.i.release(),this.i=null),this.m=function(){},this.g=null},Lu.prototype.release=function(){this.h&&(this.h.stop(),this.h=null),this.g=null},(i=Ru.prototype).ready=function(){var e=this;Eu(this.g,HTMLMediaElement.HAVE_FUTURE_DATA,this.j,function(){!function(){if(null==e.h||0==e.h&&1/0!=e.g.duration)e.i=!0;else{var t=e.g.currentTime,n=null;if("number"==typeof e.h)n=e.h;else if(e.h instanceof Date){var i=Nu(e);null!==i&&(n=e.h.getTime()/1e3-i,n=Ou(e,n))}null==n?e.i=!0:(0>n&&(n=Math.max(0,t+n)),t!=n?(e.j.ra(e.g,"seeking",function(){e.i=!0}),e.g.currentTime=n):e.i=!0)}}()})},i.release=function(){this.j&&(this.j.release(),this.j=null),this.g=null},i.yg=function(e){this.h=this.i?this.h:e},i.We=function(){var e=this.i?this.g.currentTime:this.h;return e instanceof Date&&(e=Ou(this,e=e.getTime()/1e3-(Nu(this)||0))),e||0},i.wi=function(){return 0},i.ti=function(){return 0},i.lj=function(){},i.$i=function(){var e=ns(this.g.buffered);return null!=e&&e>=this.g.duration-1},(i=Uu.prototype).ready=function(){this.m.ya(.25)},i.release=function(){this.i&&(this.i.release(),this.i=null),this.j&&(this.j.release(),this.j=null),this.m&&(this.m.stop(),this.m=null),this.h=this.i=this.g=this.l=null,this.u=function(){}},i.yg=function(e){Iu(this.i,Bu(this,e))},i.We=function(){var e=ku(this.i);return 0=e)return!0}return!1},(i=Hu.prototype).getNumReferences=function(){return this.g.length},i.getNumEvicted=function(){return this.i},i.release=function(){this.s||(this.g=[],this.m&&this.m.stop(),this.m=null)},i.Kl=function(){this.s=!0},i.Ib=function(e){for(var t=l(this.g),n=t.next();!n.done;n=t.next())e(n.value)},i.find=function(e){for(var t=this.g.length-1,n=t;0<=n;--n){var i=this.g[n],r=n=i.startTime&&e(e-=this.i)||e>=this.g.length?null:this.g[e]},i.offset=function(e){if(!this.s)for(var t=l(this.g),n=t.next();!n.done;n=t.next())n.value.offset(e)},i.If=function(e){if(!this.s&&e.length){var t=Math.round(1e3*e[0].startTime)/1e3;this.g=this.g.filter(function(e){return Math.round(1e3*e.startTime)/1e3t&&(0==n.g.length||e.endTime>n.g[0].startTime)}),this.If(e),this.hb(t)},i.hb=function(e){if(!this.s){var t=this.g.length;this.g=this.g.filter(function(t){return t.endTime>e}),this.i+=t-this.g.length}},i.Cd=function(e,t,n){if(n=void 0!==n&&n,!this.s){for(;this.g.length&&this.g[this.g.length-1].startTime>=t;)this.g.pop();for(;this.g.length&&this.g[0].endTime<=e;)this.g.shift(),n||this.i++;0!=this.g.length&&((t=new Jo((e=this.g[this.g.length-1]).startTime,t,e.D,e.startByte,e.endByte,e.ea,e.timestampOffset,e.appendWindowStart,e.appendWindowEnd,e.g,e.tilesLayout,e.C,e.h,e.status,e.aesKey)).mimeType=e.mimeType,t.codecs=e.codecs,t.i=e.i,this.g[this.g.length-1]=t)}},i.ng=function(e,t){var n=this;this.s||(this.m&&this.m.stop(),this.m=new zi(function(){var e=t();e?n.g.push.apply(n.g,h(e)):(n.m.stop(),n.m=null)}),this.m.ya(e))},Hu.prototype[Symbol.iterator]=function(){return this.cc(0)},Hu.prototype.cc=function(e,t,n){t=void 0!==t&&t,n=void 0!==n&&n;var i=this.find(e);if(null==i)return null;var r=this.get(i);n?i++:i--;var a=-1;if(r&&0=s.startTime&&e=e.g.length&&(this.h++,this.g=0,e=this.i.get(this.h)),e&&0this.g&&(this.h--,this.g=(e=this.i.get(this.h))&&0=this.g);)this.g--,t=e.g[this.g]},H("shaka.media.SegmentIterator",zu),zu.prototype.resetToLastIndependent=zu.prototype.Sh,zu.prototype.next=zu.prototype.next,zu.prototype.current=zu.prototype.current,zu.prototype.currentPosition=zu.prototype.pk,zu.prototype.setReverse=zu.prototype.Td,m(Ku,Hu),(i=Ku.prototype).clone=function(){var e=new Ku;return e.h=this.h.slice(),e.i=this.i,e},i.release=function(){for(var e=l(this.h),t=e.next();!t.done;t=e.next())t.value.release();this.h=[]},i.Ib=function(e){for(var t=l(this.h),n=t.next();!n.done;n=t.next())n.value.Ib(e)},i.find=function(e){for(var t=this.i,n=l(this.h),i=n.next();!i.done;i=n.next()){var r=(i=i.value).find(e);if(null!=r)return r+t;t+=i.getNumEvicted()+i.getNumReferences()}return null},i.get=function(e){for(var t=this.i,n=l(this.h),i=n.next();!i.done;i=n.next()){var r=(i=i.value).get(e-t);if(r)return r;r=i.getNumReferences(),t+=i.getNumEvicted()+r}return null},i.offset=function(){},i.If=function(){},i.hb=function(e){for(var t=l(this.h),n=t.next();!n.done;n=t.next())n.value.hb(e);for(;1(i=i.value).endTime&&hl(this,i);t&&ul(this)},nl.prototype.Td=function(e){this.s=e,this.g&&this.g.Td(e)},cl.prototype.abort=function(){this.ve&&this.ve.abort()},(i=vl.prototype).destroy=function(){return this.l.destroy()},i.configure=function(e){if(this.i=e,this.P=new Nr({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor,timeout:0,stallTimeout:0,connectionTimeout:0},!0),e.disableAudioPrefetch){var t=this.h.get("audio");t&&t.ia&&(sl(t.ia),t.ia=null);for(var n=(t=l(this.m.keys())).next();!n.done;n=t.next())n=n.value,sl(this.m.get(n)),this.m.delete(n)}for(e.disableTextPrefetch&&(t=this.h.get(nt))&&t.ia&&(sl(t.ia),t.ia=null),e.disableVideoPrefetch&&(t=this.h.get("video"))&&t.ia&&(sl(t.ia),t.ia=null),n=(t=l(this.h.keys())).next();!n.done;n=t.next())(n=this.h.get(n.value)).ia?(ll(n.ia,e.segmentPrefetchLimit),0=t||!n.some(function(e){return function(t){return st(e.Rb.audio.language,t)}}(a))||!(r=El(e,a.Rb.audio))||(a.Rb.audio.segmentIndex||a.Rb.audio.createSegmentIndex(),e.m.set(a.Rb.audio,r))}(this)},i.start=function(e){var t=this;return L(function(n){if(1==n.g)return _(n,function(e,t){var n,i,r,a,o,s,u;return L(function(h){if(1==h.g){if(!e.s)throw new Ce(2,5,5006);return n=Hl(e,!0),_(h,e.g.ha.init(n,e.j.sequenceMode,e.j.type,e.j.ignoreManifestTimestampsInSegmentsMode),2)}for(aa(e.l),e.updateDuration(),i=l(n.keys()),r=i.next();!r.done;r=i.next())a=r.value,o=n.get(a),e.h.has(a)||(s=Al(e,o),t.has(o.id)&&(il(u=t.get(o.id),function(t,n,i){return Dl(t,n,i||null,e.i.retryParameters,e.g.yc)}),s.ia=u),e.h.set(a,s),Nl(e,s,0));w(h)})}(t,e||new Map),2);aa(t.l),t.I=!0,w(n)})},i.od=function(){if(this.g){for(var e=this.g.ed(),t=l(this.h.keys()),n=t.next();!n.done;n=t.next()){var i=n.value;n=this.h.get(i);var r=this.g.ha;if(!(r=i==nt?null!=(r=r.h).g&&null!=r.h&&e>=r.g&&et?(e&&(this.u&&this.u.stop(),tu(this.g.ha)),this.g.ha.wb(t)):e?(this.u&&this.u.ya(.5),this.g.ha.wb(1/0)):this.g.ha.wb(Math.pow(2,32))},H("shaka.util.ConfigUtils",Vl),Vl.getDifferenceFromConfigObjects=Xl,Vl.convertToConfigObject=zl,Vl.mergeConfigObjects=Wl,H("shaka.config.RepeatMode",{OFF:0,ALL:1,SINGLE:2}),H("shaka.drm.FairPlay",Yl),Yl.commonFairPlayResponse=function(e,t){if(2===e&&(e=t.originalRequest.drmInfo)&&Pr(e.keySystem)){try{var n=Ne(t.data)}catch(e){return}if(e=!1,""===(n=n.trim()).substr(0,5)&&""===n.substr(-6)&&(n=n.slice(5,-6),e=!0),!e)try{var i=JSON.parse(n);i.ckc&&(n=i.ckc,e=!0),i.CkcMessage&&(n=i.CkcMessage,e=!0),i.License&&(n=i.License,e=!0)}catch(e){}e&&(t.data=Se(Ke(n)))}},Yl.muxFairPlayRequest=function(e,t){Ql(e,t)},Yl.expressplayFairPlayRequest=function(e,t){if(2===e){var n=t.drmInfo;n&&Pr(n.keySystem)&&Ql(e,t)}},Yl.conaxFairPlayRequest=function(e,t){Ql(e,t)},Yl.ezdrmFairPlayRequest=function(e,t){Ql(e,t)},Yl.verimatrixFairPlayRequest=function(e,t){2===e&&(e=t.drmInfo)&&Pr(e.keySystem)&&(e=ze(e=Te(t.body)),t.headers["Content-Type"]="application/x-www-form-urlencoded",t.body=Be("spc="+e))},Yl.muxInitDataTransform=function(e,t,n){return Jl(e,t,n)},Yl.expressplayInitDataTransform=function(e,t,n){return Jl(e,t,n)},Yl.conaxInitDataTransform=function(t,n,i){if("skd"!==n)return t;n=i.serverCertificate,i=Ue(t).split("skd://").pop().split("?").shift(),i=e.atob(i);var r=new ArrayBuffer(2*i.length);r=Ae(r);for(var a=0,o=i.length;ai.endTime?xh:Eh;this.g.set(i,a);for(var o=l(this.m),s=o.next();!s.done;s=o.next())(s=s.value).wd==r&&s.vd==a&&s.gd(i,t)}}};var Ah=1,Eh=2,xh=3;function Ch(e,t,n){var i,r,a,o,s,u,l;return L(function(h){switch(h.g){case 1:var c=new re(e).vb.split("/").pop().split(".");return i=1==c.length?"":c.pop().toLowerCase(),(r=kh.get(i))?h.return(r):(a=0,o=Zr([e],n),S(h,2),o.method="HEAD",_(h,t.request(a,o).promise,4));case 4:s=h.h,r=s.headers["content-type"],A(h,3);break;case 2:if(!(u=E(h))||1002!=u.code&&1001!=u.code){h.A(3);break}return o.method="GET",_(h,t.request(a,o).promise,6);case 6:l=h.h,r=l.headers["content-type"];case 3:return h.return(r?r.toLowerCase().split(";").shift():"")}})}for(var kh=(new Map).set("mp4","video/mp4").set("m4v","video/mp4").set("m4a","audio/mp4").set("webm","video/webm").set("weba","audio/webm").set("mkv","video/webm").set("ts","video/mp2t").set("ogv","video/ogg").set("ogg","audio/ogg").set("mpg","video/mpeg").set("mpeg","video/mpeg").set("mov","video/quicktime").set("m3u8","application/x-mpegurl").set("mpd","application/dash+xml").set("ism","application/vnd.ms-sstr+xml").set("mp3","audio/mpeg").set("aac","audio/aac").set("flac","audio/flac").set("wav","audio/wav").set("sbv","text/x-subviewer").set("srt","text/srt").set("vtt","text/vtt").set("webvtt","text/vtt").set("ttml","application/ttml+xml").set("lrc","application/x-subtitle-lrc").set("ssa","text/x-ssa").set("ass","text/x-ssa").set("jpeg","image/jpeg").set("jpg","image/jpeg").set("png","image/png").set("svg","image/svg+xml").set("webp","image/webp").set("avif","image/avif").set("html","text/html").set("htm","text/html"),Ih={ach:"Lwo",ady:"Адыгэбзэ",af:"Afrikaans","af-NA":"Afrikaans (Namibia)","af-ZA":"Afrikaans (South Africa)",ak:"Tɕɥi",ar:"العربية","ar-AR":"العربية","ar-MA":"العربية","ar-SA":"العربية (السعودية)","ay-BO":"Aymar aru",az:"Azərbaycan dili","az-AZ":"Azərbaycan dili","be-BY":"Беларуская",bg:"Български","bg-BG":"Български",bn:"বাংলা","bn-IN":"বাংলা (ভারত)","bn-BD":"বাংলা(বাংলাদেশ)","bs-BA":"Bosanski",ca:"Català","ca-ES":"Català",cak:"Maya Kaqchikel","ck-US":"ᏣᎳᎩ (tsalagi)",cs:"Čeština","cs-CZ":"Čeština",cy:"Cymraeg","cy-GB":"Cymraeg",da:"Dansk","da-DK":"Dansk",de:"Deutsch","de-AT":"Deutsch (Österreich)","de-DE":"Deutsch (Deutschland)","de-CH":"Deutsch (Schweiz)",dsb:"Dolnoserbšćina",el:"Ελληνικά","el-GR":"Ελληνικά",en:"English","en-GB":"English (UK)","en-AU":"English (Australia)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-IN":"English (India)","en-PI":"English (Pirate)","en-UD":"English (Upside Down)","en-US":"English (US)","en-ZA":"English (South Africa)","en@pirate":"English (Pirate)",eo:"Esperanto","eo-EO":"Esperanto",es:"Español","es-AR":"Español (Argentine)","es-419":"Español (Latinoamérica)","es-CL":"Español (Chile)","es-CO":"Español (Colombia)","es-EC":"Español (Ecuador)","es-ES":"Español (España)","es-LA":"Español (Latinoamérica)","es-NI":"Español (Nicaragua)","es-MX":"Español (México)","es-US":"Español (Estados Unidos)","es-VE":"Español (Venezuela)",et:"eesti keel","et-EE":"Eesti (Estonia)",eu:"Euskara","eu-ES":"Euskara",fa:"فارسی","fa-IR":"فارسی","fb-LT":"Leet Speak",ff:"Fulah",fi:"Suomi","fi-FI":"Suomi","fo-FO":"Føroyskt",fr:"Français","fr-CA":"Français (Canada)","fr-FR":"Français (France)","fr-BE":"Français (Belgique)","fr-CH":"Français (Suisse)","fy-NL":"Frysk",ga:"Gaeilge","ga-IE":"Gaeilge (Gaelic)",gl:"Galego","gl-ES":"Galego","gn-PY":"Avañe'ẽ","gu-IN":"ગુજરાતી","gx-GR":"Ἑλληνική ἀρχαία",he:"עברית‏","he-IL":"עברית‏",hi:"हिन्दी","hi-IN":"हिन्दी",hr:"Hrvatski","hr-HR":"Hrvatski",hsb:"Hornjoserbšćina",ht:"Kreyòl",hu:"Magyar","hu-HU":"Magyar","hy-AM":"Հայերեն",id:"Bahasa Indonesia","id-ID":"Bahasa Indonesia",is:"Íslenska","is-IS":"Íslenska (Iceland)",it:"Italiano","it-IT":"Italiano",ja:"日本語","ja-JP":"日本語","jv-ID":"Basa Jawa","ka-GE":"ქართული","kk-KZ":"Қазақша",km:"ភាសាខ្មែរ","km-KH":"ភាសាខ្មែរ",kab:"Taqbaylit",kn:"ಕನ್ನಡ","kn-IN":"ಕನ್ನಡ (India)",ko:"한국어","ko-KR":"한국어 (韩国)",ku:"Kurdî","ku-TR":"Kurdî",la:"Latin","la-VA":"Latin",lb:"Lëtzebuergesch","li-NL":"Lèmbörgs",lt:"Lietuvių","lt-LT":"Lietuvių",lv:"Latviešu","lv-LV":"Latviešu",mai:"मैथिली, মৈথিলী","mg-MG":"Malagasy",mk:"Македонски","mk-MK":"Македонски (Македонски)",ml:"മലയാളം","ml-IN":"മലയാളം","mn-MN":"Монгол",mr:"मराठी","mr-IN":"मराठी",ms:"Bahasa Melayu","ms-MY":"Bahasa Melayu",mt:"Malti","mt-MT":"Malti",my:"ဗမာစကာ",nb:"Norsk (bokmål)","nb-NO":"Norsk (bokmål)",ne:"नेपाली","ne-NP":"नेपाली",nl:"Nederlands","nl-BE":"Nederlands (België)","nl-NL":"Nederlands (Nederland)","nn-NO":"Norsk (nynorsk)",no:"Norsk",oc:"Occitan","or-IN":"ଓଡ଼ିଆ",pa:"ਪੰਜਾਬੀ","pa-IN":"ਪੰਜਾਬੀ (ਭਾਰਤ ਨੂੰ)",pl:"Polski","pl-PL":"Polski","ps-AF":"پښتو",pt:"Português","pt-BR":"Português (Brasil)","pt-PT":"Português (Portugal)","qu-PE":"Qhichwa","rm-CH":"Rumantsch",ro:"Română","ro-RO":"Română",ru:"Русский","ru-RU":"Русский","sa-IN":"संस्कृतम्","se-NO":"Davvisámegiella","si-LK":"පළාත",sk:"Slovenčina","sk-SK":"Slovenčina (Slovakia)",sl:"Slovenščina","sl-SI":"Slovenščina","so-SO":"Soomaaliga",sq:"Shqip","sq-AL":"Shqip",sr:"Српски","sr-RS":"Српски (Serbia)",su:"Basa Sunda",sv:"Svenska","sv-SE":"Svenska",sw:"Kiswahili","sw-KE":"Kiswahili",ta:"தமிழ்","ta-IN":"தமிழ்",te:"తెలుగు","te-IN":"తెలుగు",tg:"забо́ни тоҷикӣ́","tg-TJ":"тоҷикӣ",th:"ภาษาไทย","th-TH":"ภาษาไทย (ประเทศไทย)",tl:"Filipino","tl-PH":"Filipino",tlh:"tlhIngan-Hol",tr:"Türkçe","tr-TR":"Türkçe","tt-RU":"татарча",uk:"Українська","uk-UA":"Українська",ur:"اردو","ur-PK":"اردو",uz:"O'zbek","uz-UZ":"O'zbek",vi:"Tiếng Việt","vi-VN":"Tiếng Việt","xh-ZA":"isiXhosa",yi:"ייִדיש","yi-DE":"ייִדיש (German)",zh:"中文","zh-HANS":"中文简体","zh-HANT":"中文繁體","zh-CN":"中文(中国)","zh-HK":"中文(香港)","zh-SG":"中文(新加坡)","zh-TW":"中文(台灣)","zu-ZA":"isiZulu"},Mh=l(Object.keys(Ih)),Ph=Mh.next();!Ph.done;Ph=Mh.next()){var Lh=Ph.value;Ih[Lh.toLowerCase()]=Ih[Lh]}function Dh(e,t){if(e.lineBreak)return"\n";if(e.nestedCues.length)return e.nestedCues.map(function(t){return Dh(t,e)}).join("");if(!e.payload)return e.payload;var n=[],i=e.fontWeight>=ci,r=e.fontStyle==pi,a=e.textDecoration.includes(gi);return i&&n.push(["b"]),r&&n.push(["i"]),a&&n.push(["u"]),""==(r=e.color)&&t&&(r=t.color),i="",(r=Rh(r))&&(i+="."+r),""==(r=e.backgroundColor)&&t&&(r=t.backgroundColor),(t=Rh(r))&&(i+=".bg_"+t),i&&n.push(["c",i]),n.reduceRight(function(e,t){var n=l(t);return"<"+(t=n.next().value)+(void 0===(n=n.next().value)?"":n)+">"+e+""},e.payload)}function Rh(e){var t=(e=e.toLowerCase()).replace(/\s/g,"").match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i);switch(t?e="#"+(256|parseInt(t[1],10)).toString(16).slice(1)+(256|parseInt(t[2],10)).toString(16).slice(1)+(256|parseInt(t[3],10)).toString(16).slice(1):e.startsWith("#")&&7>>0).toString()}if(e.startTime>=e.endTime)return null;var n=new VTTCue(e.startTime,e.endTime,e.payload);n.id=t(e.startTime.toString())+t(e.endTime.toString())+t(e.payload),n.lineAlign=e.lineAlign,n.positionAlign=e.positionAlign,e.size&&(n.size=e.size);try{n.align=e.textAlign}catch(e){}return"center"==e.textAlign&&"center"!=n.align&&(n.align="middle"),"vertical-lr"==e.writingMode?n.vertical="lr":"vertical-rl"==e.writingMode&&(n.vertical="rl"),1==e.lineInterpretation&&(n.snapToLines=!1),null!=e.line&&(n.line=e.line),null!=e.position&&(n.position=e.position),n}function Bh(e,t){var n=Nh(t),i=[];t=e.cues?Array.from(e.cues):[];for(var r=(n=l(n)).next(),a={};!r.done;a={Ed:void 0},r=n.next())a.Ed=r.value,!t.some(function(e){return function(t){return t.startTime==e.Ed.startTime&&t.endTime==e.Ed.endTime&&t.text==e.Ed.payload}}(a))&&a.Ed.payload&&(r=Uh(a.Ed))&&i.push(r);for(n=(t=l(t=i.slice().sort(function(e,t){return e.startTime!=t.startTime?e.startTime-t.startTime:e.endTime!=t.endTime?e.endTime-t.startTime:"line"in VTTCue.prototype?i.indexOf(t)-i.indexOf(e):i.indexOf(e)-i.indexOf(t)}))).next();!n.done;n=t.next())e.addCue(n.value)}function Fh(e,t){var n=!1;"disabled"===e.mode&&(n=!0,e.mode="hidden");for(var i=0;in&&"hidden"===a.track.mode&&(n=r)}for(r=(i=l(t.h)).next();!r.done;r=i.next())r=(a=l(r.value)).next().value,a=a.next().value,r!==n&&"disabled"!==a.track.mode&&(a.track.mode="disabled");t.g!==n&&(t.g=n,-1i,d=h?h.bk:null;h&&(o.push(h.Qg),h.nd&&o.push(h.nd),c||(a=!0,e.l.delete(u),h=null)),c&&(s.push(u),h?Xh(e,d)||(a=!0):(Zh(e,u,r),d=(h=e.l.get(u)).bk,a=!0)),0e.u&&(s=32),i=0>i?100+i/s*100:i/s*100),1==o&&(a.position="absolute",n.writingMode==ri?(a.width="100%",n.lineAlign==oi?a.top=i+"%":"end"==n.lineAlign&&(a.bottom=100-i+"%")):"vertical-lr"==n.writingMode?(a.height="100%",n.lineAlign==oi?a.left=i+"%":"end"==n.lineAlign&&(a.right=100-i+"%")):(a.height="100%",n.lineAlign==oi?a.right=i+"%":"end"==n.lineAlign&&(a.left=100-i+"%")))),a.lineHeight=n.lineHeight,e=function(e){var t=e.direction,n=e.positionAlign;return e=e.textAlign,n!==Qn?n:"left"===e||"start"===e&&t===ii||"end"===e&&"rtl"===t?"line-left":"right"===e||"start"===e&&"rtl"===t||"end"===e&&t===ii?"line-right":"center"}(n),"line-left"==e?(a.cssFloat="left",null!==n.position&&(a.position="absolute",n.writingMode==ri?(a.left=n.position+"%",a.width="auto"):a.top=n.position+"%")):"line-right"==e?(a.cssFloat="right",null!==n.position&&(a.position="absolute",n.writingMode==ri?(a.right=100-n.position+"%",a.width="auto"):a.bottom=n.position+"%")):null!==n.position&&50!=n.position&&(a.position="absolute",n.writingMode==ri?(a.left=n.position+"%",a.width="auto"):a.top=n.position+"%"),a.textAlign=n.textAlign,a.textDecoration=n.textDecoration.join(" "),a.writingMode=n.writingMode,"writingMode"in document.documentElement.style&&a.writingMode==n.writingMode||(a.webkitWritingMode=n.writingMode),n.size&&(n.writingMode==ri?a.width=n.size+"%":a.height=n.size+"%")}(e,a,t,n,i),n=null,t.region&&t.region.id){var o=t.region,s=e.u===4/3?2.5:1.9;if(n=o.id+"_"+o.width+"x"+o.height+(o.heightUnits==qt?"%":"px")+"-"+o.viewportAnchorX+"x"+o.viewportAnchorY+(o.viewportAnchorUnits==qt?"%":"px"),e.F.has(n))n=e.F.get(n);else{r=ss("span");var u=o.heightUnits==qt?"%":"px",l=o.widthUnits==qt?"%":"px",h=o.viewportAnchorUnits==qt?"%":"px";r.id="shaka-text-region---"+n,r.classList.add("shaka-text-region"),r.style.position="absolute";var c=o.height,d=o.width;2===o.heightUnits&&(c=5.33*o.height,u="%"),2===o.widthUnits&&(d=o.width*s,l="%"),r.style.height=c+u,r.style.width=d+l,2===o.viewportAnchorUnits?(s=o.viewportAnchorY/75*100,u=o.viewportAnchorX/(e.u===4/3?160:210)*100,s-=o.regionAnchorY*c/100,u-=o.regionAnchorX*d/100,r.style.top=s+"%",r.style.left=u+"%"):(r.style.top=o.viewportAnchorY-o.regionAnchorY*c/100+h,r.style.left=o.viewportAnchorX-o.regionAnchorX*d/100+h),0!==o.heightUnits&&0!==o.widthUnits&&0!==o.viewportAnchorUnits&&(o=Math.max(0,Math.min(100-(parseInt(r.style.width.slice(0,-1),10)||0),parseInt(r.style.left.slice(0,-1),10)||0)),r.style.top=Math.max(0,Math.min(100-(parseInt(r.style.height.slice(0,-1),10)||0),parseInt(r.style.top.slice(0,-1),10)||0))+"%",r.style.left=o+"%"),r.style.display="flex",r.style.flexDirection="column",r.style.alignItems="center",r.style.justifyContent="before"==t.displayAlign?"flex-start":"center"==t.displayAlign?"center":"flex-end",e.F.set(n,r),n=r}}r=a,i&&((r=ss("span")).classList.add("shaka-text-wrapper"),r.style.backgroundColor=t.backgroundColor,r.style.lineHeight="normal",a.appendChild(r)),e.l.set(t,{Qg:a,bk:r,nd:n})}function Jh(e,t,n,i){i=void 0===i?1:i;var r=(r=new RegExp(/(\d*\.?\d+)([a-z]+|%+)/).exec(e))?{value:Number(r[1]),unit:r[2]}:null;if(!r)return e;switch(e=r.unit,i*=r.value,e){case"%":return i/100*n.clientHeight/t.cellResolution.rows+"px";case"c":return n.clientHeight*i/t.cellResolution.rows+"px";default:return i+e}}function Qh(e,t){this.h=e,this.g=t,this.i=void 0,this.u=!1,this.F=!0,this.l=this.C=!1,this.s=this.m=void 0,this.B=0,this.G=!1,this.D=new At,this.j=null}function $h(t){return t.g.sessionId||(t.g.sessionId=e.crypto.randomUUID()),{v:t.g.version,sf:t.i,sid:t.g.sessionId,cid:t.g.contentId,mtp:t.h.getBandwidthEstimate()/1e3}}function ec(e,t,n){n=void 0===n?{}:n;var i=void 0===i?e.g.useHeaders:i;if(e.g.enabled)if(e=function(e,t){t=void 0===t?{}:t,Object.assign(t,$h(e)),t.pr=e.h.Xa();var n=t.ot===ac||t.ot===oc;return e.C&&n&&(t.bs=!0,t.su=!0,e.C=!1),null==t.su&&(t.su=e.F),t.v===uc&&(e.h.T()&&(t.ltc=e.h.rf()),null!=(n=!e.G&&e.s&&e.m?e.s-(e.B||e.m):void 0)&&(t.msd=n,e.G=!0)),function(e,t){var n=e.g.includeKeys;return n.length?Object.keys(t).reduce(function(e,i){return n.includes(i)&&(e[i]=t[i]),e},{}):t}(e,t)}(e,n),i)i=function(e){for(var t=Object.keys(e),n={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,ltc:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,msd:2,bs:3,rtp:3},o=(t=l(t)).next();!o.done;o=t.next())r[null!=a[o=o.value]?a[o]:1][o]=e[o];for(e=0;e=n}))?1e3*(e.end-n):0}function nc(e){function t(e){return 100*n(e/100)}function n(e){return Math.round(e)}function i(e){return!Number.isNaN(e)&&null!=e&&""!==e&&!1!==e}for(var r=[],a={br:n,d:n,bl:t,dl:t,mtp:t,nor:function(e){return encodeURIComponent(e)},rtp:t,tb:n},o=Object.keys(e||{}).sort(),s=(o=l(o)).next();!s.done;s=o.next()){var u=e[s=s.value];if(i(u)&&("v"!==s||1!==u)&&("pr"!=s||1!==u)){var h,c=a[s];c&&(u=c(u)),h="string"==(c=typeof u)&&"ot"!==s&&"sf"!==s&&"st"!==s?s+"="+JSON.stringify(u):"boolean"===c?s:"symbol"===c?s+"="+u.description:s+"="+u,r.push(h)}}return r.join(",")}function ic(e,t){return!t||e.includes("offline:")?e:((e=new re(e)).g.set("CMCD",t),e.toString())}(i=jh.prototype).configure=function(){},i.remove=function(e,t){return!!this.i&&(this.h.has(this.g)&&Fh(this.h.get(this.g).track,function(n){return n.startTimee}),!0)},i.append=function(e){this.h.has(this.g)&&Bh(this.h.get(this.g).track,e)},i.destroy=function(){return this.i&&(this.j&&this.C(),this.i=null),this.l&&(this.l.release(),this.l=null),Promise.resolve()},i.isTextVisible=function(){return this.u},i.setTextVisibility=function(e){if(this.u=e,this.h.has(this.g)){var t=this.h.get(this.g).track;"disabled"!==t.mode&&(e=e?"showing":"hidden",t.mode!==e&&(t.mode=e))}else if(this.i&&3===this.i.m)if(t=Array.from(this.i.h.textTracks).filter(function(e){return["captions","subtitles","forced"].includes(e.kind)}),e){e=null;for(var n=(t=l(t)).next();!n.done;n=t.next()){if("showing"===(n=n.value).mode){e=null;break}e||"hidden"!==n.mode||(e=n)}e&&(e.mode="showing")}else for(t=(e=l(t)).next();!t.done;t=e.next())"showing"===(t=t.value).mode&&(t.mode="hidden")},i.setTextLanguage=function(){},i.enableTextDisplayer=function(){!this.j&&this.i&&2===this.i.m&&(this.j=this.i.h,this.l.ra(this.i,"unloading",this.C),this.l.o(this.i,"textchanged",this.m),this.l.o(this.j.textTracks,"change",this.B),this.m())},H("shaka.text.NativeTextDisplayer",jh),jh.prototype.enableTextDisplayer=jh.prototype.enableTextDisplayer,jh.prototype.setTextLanguage=jh.prototype.setTextLanguage,jh.prototype.setTextVisibility=jh.prototype.setTextVisibility,jh.prototype.isTextVisible=jh.prototype.isTextVisible,jh.prototype.destroy=jh.prototype.destroy,jh.prototype.append=jh.prototype.append,jh.prototype.remove=jh.prototype.remove,jh.prototype.configure=jh.prototype.configure,(i=Hh.prototype).configure=function(){},i.remove=function(e,t){return!!this.g&&(Fh(this.g,function(n){return n.startTimee}),!0)},i.append=function(e){this.g&&Bh(this.g,e)},i.destroy=function(){return this.g&&(Fh(this.g,function(){return!0}),this.g.mode="disabled"),this.g=this.h=null,Promise.resolve()},i.isTextVisible=function(){return!!this.g&&"showing"==this.g.mode},i.setTextVisibility=function(e){e&&!this.g&&Vh(this),this.g&&(this.g.mode=e?"showing":"hidden")},i.setTextLanguage=function(){},i.enableTextDisplayer=function(){Vh(this)},H("shaka.text.SimpleTextDisplayer",Hh),Hh.prototype.enableTextDisplayer=Hh.prototype.enableTextDisplayer,Hh.prototype.setTextLanguage=Hh.prototype.setTextLanguage,Hh.prototype.setTextVisibility=Hh.prototype.setTextVisibility,Hh.prototype.isTextVisible=Hh.prototype.isTextVisible,Hh.prototype.destroy=Hh.prototype.destroy,Hh.prototype.append=Hh.prototype.append,Hh.prototype.remove=Hh.prototype.remove,Hh.prototype.configure=Hh.prototype.configure,(i=Wh.prototype).configure=function(){},i.remove=function(){},i.append=function(){},i.destroy=function(){},i.isTextVisible=function(){return!1},i.setTextVisibility=function(){},i.setTextLanguage=function(){},i.enableTextDisplayer=function(){},H("shaka.text.StubTextDisplayer",Wh),Wh.prototype.enableTextDisplayer=Wh.prototype.enableTextDisplayer,Wh.prototype.setTextLanguage=Wh.prototype.setTextLanguage,Wh.prototype.setTextVisibility=Wh.prototype.setTextVisibility,Wh.prototype.isTextVisible=Wh.prototype.isTextVisible,Wh.prototype.destroy=Wh.prototype.destroy,Wh.prototype.append=Wh.prototype.append,Wh.prototype.remove=Wh.prototype.remove,Wh.prototype.configure=Wh.prototype.configure,(i=zh.prototype).configure=function(e){this.C=e,Kh(this),qh(this,!0)},i.append=function(e){for(var t=[].concat(h(this.h)),n=(e=l(Oh(e))).next(),i={};!n.done;i={Pg:void 0},n=e.next())i.Pg=n.value,t.some(function(e){return function(t){return Xn(t,e.Pg)}}(i))||this.h.push(i.Pg);this.h.length&&Kh(this),qh(this)},i.destroy=function(){return this.g?(this.g.parentElement&&this.s.removeChild(this.g),this.g=null,this.m=!1,this.h=[],this.B&&(this.B.stop(),this.B=null),this.l.clear(),this.i&&(this.i.release(),this.i=null),this.D&&(this.D.disconnect(),this.D=null),Promise.resolve()):Promise.resolve()},i.remove=function(e,t){if(!this.g)return!1;var n=this.h.length;return this.h=this.h.filter(function(n){return n.startTime=t}),qh(this,n>this.h.length),this.h.length||Kh(this),!0},i.isTextVisible=function(){return this.m},i.setTextVisibility=function(e){(this.m=e)?(this.g.parentElement||this.s.appendChild(this.g),qh(this,!0)):this.g.parentElement&&this.s.removeChild(this.g)},i.setTextLanguage=function(e){e&&"und"!=e?this.g.setAttribute("lang",e):this.g.setAttribute("lang","")},i.enableTextDisplayer=function(){},H("shaka.text.UITextDisplayer",zh),zh.prototype.enableTextDisplayer=zh.prototype.enableTextDisplayer,zh.prototype.setTextLanguage=zh.prototype.setTextLanguage,zh.prototype.setTextVisibility=zh.prototype.setTextVisibility,zh.prototype.isTextVisible=zh.prototype.isTextVisible,zh.prototype.remove=zh.prototype.remove,zh.prototype.destroy=zh.prototype.destroy,zh.prototype.append=zh.prototype.append,zh.prototype.configure=zh.prototype.configure,H("shaka.text.WebVttGenerator",function(){}),Qh.prototype.setMediaElement=function(e){this.j=e,function(e){e.D.ra(e.j,"play",function(){e.m||(e.m=Date.now())}),e.D.ra(e.j,"playing",function(){e.s||(e.s=Date.now())})}(this)},Qh.prototype.configure=function(e){this.g=e};var rc="a",ac="v",oc="av",sc="tt",uc=2,lc="d",hc="ld",cc="h",dc="lh";function pc(e){this.h=e,this.g=null}function fc(e){return!e||"false"!==e.toLowerCase()&&(/^[-0-9]/.test(e)?parseInt(e,10):e.replace(/["]+/g,""))}H("shaka.util.CmcdManager.StreamingFormat",{DASH:lc,Wm:hc,HLS:cc,Xm:dc,on:"s",OTHER:"o"}),(i=pc.prototype).configure=function(e){this.h=e},i.Ti=function(){return this.h.enabled&&this.h.applyMaximumSuggestedBitrate&&this.g&&this.g.has(mc)?1e3*this.g.get(mc):null},i.Si=function(){return this.h.enabled&&this.g&&this.g.has(gc)?1e3*this.g.get(gc):null},i.Yk=function(){return this.h.enabled&&this.g&&this.g.has(vc)?this.g.get(vc):null},i.Zk=function(){return this.h.enabled&&this.g&&this.g.has(yc)?this.g.get(yc):null},i.getBandwidthEstimate=function(e){var t=this.Si();if(!t)return e;var n=this.h.estimatedThroughputWeightRatio;return 0=n?e*(1-n)+t*n:e},H("shaka.util.CmsdManager",pc),pc.prototype.getBandwidthEstimate=pc.prototype.getBandwidthEstimate,pc.prototype.getRoundTripTime=pc.prototype.Zk,pc.prototype.getResponseDelay=pc.prototype.Yk,pc.prototype.getEstimatedThroughput=pc.prototype.Si,pc.prototype.getMaxBitrate=pc.prototype.Ti;var gc="etp",mc="mb",vc="rd",yc="rtt";function bc(){this.g=null,this.h=[]}function _c(e,t){return L(function(n){if(1==n.g)return e.g?_(n,new Promise(function(t){return e.h.push(t)}),2):n.A(2);e.g=t,w(n)})}function wc(t,n,i){n=void 0===n?null:n,$.call(this);var r=this;this.m=Ed,this.h=null,this.Pe=n,this.Y=!1,this.Ue=new At,this.Je=new At,this.j=new At,this.ic=new At,this.Nd=new At,this.F=this.G=this.D=this.I=null,this.Ve=0,this.ba=new bc,this.N=this.Z=this.U=this.i=this.zc=this.H=this.l=this.Ge=this.P=this.zi=this.qa=this.K=this.Ya=this.Ia=this.He=this.O=this.La=this.J=this.Mb=null,this.$=!1,this.Ta=this.u=null,this.Oe=1e9,this.Te=[],this.eb=[],this.zg=-1,this.g=Zc(this),this.Bg={streaming:{inaccurateManifestTolerance:0,segmentPrefetchLimit:2,updateIntervalSeconds:.1,maxDisabledTime:1,retryParameters:{baseDelay:100}},manifest:{dash:{autoCorrectDrift:!1},retryParameters:{baseDelay:100}},drm:{retryParameters:{baseDelay:100}}},this.R=null,this.Xe=-1,this.fc=null,this.sa={width:1/0,height:1/0},this.Ne=new $a(this.g,this.sa,null),this.Re=[],this.B=null,this.L=this.g.adaptationSetCriteriaFactory(),this.L.configure({language:this.g.preferredAudioLanguage,role:this.g.preferredVariantRole,channelCount:0,Nc:this.g.preferredVideoHdrLevel,spatialAudio:this.g.preferSpatialAudio,videoLayout:this.g.preferredVideoLayout,Wc:this.g.preferredAudioLabel,Vd:this.g.preferredVideoLabel,codecSwitchingStrategy:this.g.mediaSource.codecSwitchingStrategy,audioCodec:"",Xd:"",Ye:0,preferredAudioCodecs:this.g.preferredAudioCodecs,preferredAudioChannelCount:this.g.preferredAudioChannelCount}),this.Od=this.g.preferredTextLanguage,this.Me=this.g.preferredTextRole,this.Le=this.g.preferForcedSubs,this.Ke=[],i&&i(this),this.K=function(e){return new Qh({getBandwidthEstimate:function(){return e.u?e.u.getBandwidthEstimate():NaN},Sb:function(){return e.Sb()},getCurrentTime:function(){return e.h?e.h.currentTime:0},Xa:function(){return e.Xa()},Jb:function(){return e.Jb()},qb:function(){return e.qb()},T:function(){return e.T()},rf:function(){return e.rf()}},e.g.cmcd)}(this),this.qa=new pc(this.g.cmsd),this.I=Uc(this),this.Qd=this.na=this.ua=this.C=null,this.Dg=!1,this.Ag=[],this.Cg=new zi(function(){return L(function(e){return 1==e.g?r.na?_(e,r.bc(r.Qd,!0),3):e.A(0):4!=e.g?_(e,r.load(r.na),4):(r.Dg?r.Qd.pause():r.Qd.play(),r.na=null,r.Dg=!1,void w(e))})}),Md&&(this.C=Md(),this.C.configure(this.g.ads),this.Nd.o(this.C,"ad-content-pause-requested",function(e){var t;return L(function(n){if(1==n.g)return r.Cg.stop(),r.na?n.A(0):(r.Qd=r.h,r.Dg=r.isEnded(),t=e.saveLivePosition||!1,_(n,r.Ni(!0,t),3));r.na=n.h,w(n)})}),this.Nd.o(this.C,"ad-content-resume-requested",function(e){if(e=e.offset||0,r.na){var t=r.na;t.m&&e&&("number"==typeof t.m?t.m+=e:t.m.setTime(t.m.getTime()+1e3*e))}r.Cg.X(.1)}),this.Nd.o(this.C,"ad-content-attach-requested",function(){return L(function(e){return r.h||!r.Qd?e.A(0):_(e,r.bc(r.Qd,!0),0)})})),Pd&&(this.ua=Pd(this),this.ua.configure(this.g.queue)),this.Ue.o(e,"online",function(){gd(r),r.Th()}),this.Qe=new zi(function(){for(var e=Date.now()/1e3,t=!1,n=!0,i=l(r.i.variants),a=i.next();!a.done;a=i.next())0<(a=a.value).disabledUntilTime&&a.disabledUntilTime<=e&&(a.disabledUntilTime=0,t=!0),0o&&(o=a);for(var s=l(r.frames),u=s.next();!u.done;u=s.next())Oc(e,a,o,"org.id3",u.value);e.C&&e.C.onHlsTimedMetadata(r,a)}},Nl:function(t){e.Ya&&tl(e.Ya,{schemeIdUri:t.schemeIdUri,startTime:t.startTime,endTime:t.endTime,id:String(t.id),emsg:t})},onEvent:function(t){return e.dispatchEvent(t)},Pl:function(){e.H&&e.H.update&&e.H.update()}},e.P,e.g.mediaSource),n=e.g.manifest,i=n.segmentRelativeVttTiming,t.Ia=i,_(r,t.J,2);e.G=t,w(r)})}function Rc(e,t,n){function i(){return $c(e)}if(e.j.o(t,"playing",i),e.j.o(t,"pause",i),e.j.o(t,"ended",i),e.j.o(t,"ratechange",function(){var t=e.h.playbackRate;0!=t&&(e.J&&(e.J.set(t),e.m==xd&&e.u.playbackRateChanged(t),Qc(e,t)),t=Tc("ratechange"),e.dispatchEvent(t))}),t.remote&&(e.j.o(t.remote,"connect",function(){e.l&&"connected"==t.remote.state&&cd(e),sd(e)}),e.j.o(t.remote,"connecting",function(){return sd(e)}),e.j.o(t.remote,"disconnect",function(){return L(function(n){if(1==n.g)return e.l&&"disconnected"==t.remote.state?_(n,Fl(e.l),3):n.A(2);2!=n.g&&cd(e),sd(e),w(n)})})),t.audioTracks&&(e.j.o(t.audioTracks,"addtrack",function(){return sd(e)}),e.j.o(t.audioTracks,"removetrack",function(){return sd(e)}),e.j.o(t.audioTracks,"change",function(){return sd(e)})),t.videoTracks&&(e.j.o(t.videoTracks,"addtrack",function(){return sd(e)}),e.j.o(t.videoTracks,"removetrack",function(){return sd(e)}),e.j.o(t.videoTracks,"change",function(){return sd(e)})),t.textTracks){var r=function(){e.m===Cd&&e.s instanceof jh&&cd(e),sd(e)};e.j.o(t.textTracks,"addtrack",function(t){if(t.track)switch(t=t.track,t.kind){case"metadata":!function(e,t){if("metadata"==t.kind){t.mode="hidden",e.j.o(t,"cuechange",function(){if(t.activeCues)for(var n=l(t.activeCues),i=n.next();!i.done;i=n.next())i=i.value,Oc(e,i.startTime,i.endTime,i.type,i.value),e.C&&e.C.onCueMetadataChange(i.value);if(t.cues){n=[];for(var r=(i=l(t.cues)).next(),a={};!r.done;a={Gc:void 0},r=i.next())a.Gc=r.value,"com.apple.quicktime.HLS"==a.Gc.type&&null!=a.Gc.startTime&&(r=n.find(function(e){return function(t){return t.startTime==e.Gc.startTime&&t.endTime==e.Gc.endTime}}(a)),r||(r={startTime:a.Gc.startTime,endTime:a.Gc.endTime,values:[]},n.push(r)),r.values.push(a.Gc.value));for(i=(n=l(n)).next();!i.done;i=n.next())(i=i.value).values.some(function(e){return"X-ASSET-URI"==e.key||"X-ASSET-LIST"==e.key})&&e.C&&(i.values.push({key:"CUE",description:"",data:0!=i.startTime||e.T()?"ONCE":"ONCE,PRE",mimeType:null,pictureType:null}),e.C.onHLSInterstitialMetadata(e,e.h,i))}});var n=new zi(function(){for(var t=function(e){return Array.from(e.h.textTracks).filter(function(e){return"metadata"==e.kind})}(e),n=(t=l(t)).next();!n.done;n=t.next())n.value.mode="hidden"}).Ka().X(.5);e.Ke.push(function(){n.stop()})}}(e,t);break;case"chapters":!function(e,t){if(t&&"chapters"==t.kind){t.mode="hidden";var n=new zi(function(){t.mode="hidden"}).Ka().X(.5);e.Ke.push(function(){n.stop()})}}(e,t);break;default:r()}}),e.j.o(t.textTracks,"removetrack",r),e.j.o(t.textTracks,"change",r),"keep"!==e.g.streaming.crossBoundaryStrategy&&(e.j.o(t,"waiting",function(){e.l&&Gl(e.l)}),e.j.o(t,"timeupdate",function(){e.l&&Gl(e.l)}))}"none"!=t.preload&&e.j.ra(t,"loadedmetadata",function(){e.B.F=Date.now()/1e3-n})}function Nc(e,t,n){t=(new Map).set("startTime",t.startTime).set("endTime",t.endTime).set("metadataType",t.schemeIdUri).set("payload",t.payload),e.dispatchEvent(Tc(n,t))}function Oc(e,t,n,i,r){e.Ia&&((t={schemeIdUri:i,startTime:t,endTime:n||1/0,id:"",payload:r}).id=JSON.stringify(t),tl(e.Ia,t))}function Uc(e,t){function n(n){t()?t().dispatchEvent(n):e.dispatchEvent(n)}function i(e){t()?gh(t(),!0,e):e()}t||(t=function(){return null});var r=new Xr(function(n,i,r,a,o){var s=t()?t().j:e.u;s&&s.segmentDownloaded(n,i,r,a,o)},function(t,r,a){n(Tc("downloadheadersreceived",r=(new Map).set("headers",t).set("request",r).set("requestType",a))),i(function(){if(e.qa){var n=e.qa;if(n.h.enabled){var i=t["cmsd-static"];if(i)try{var r=new Map,a=i.split(",");for(i=0;i=n}))?1e3*(e.end-n):NaN}(i,d.type),h.ot!==sc)){var f=tc(i,d.type);h.dl=p?f/Math.abs(p):f}if(d.bandwidth&&(h.br=d.bandwidth/1e3),d.segmentIndex&&u){var g=d.segmentIndex.cc(u.endTime,!0,0>p);if(g){var m=g.next().value;if(m&&m!=u){if(s&&!en(u.S(),m.S())){var v=m.S()[0],y=new URL(v),b=new URL(s);if(y.origin!==b.origin)var _=v;else{for(var w=y.pathname.split("/").slice(1),S=b.pathname.split("/").slice(1,-1);w[0]===S[0];)w.shift(),S.shift();for(;S.length;)S.shift(),w.unshift("..");_=w.join("/")}h.nor=_}if((m.startByte||m.endByte)&&(u.startByte!=m.startByte||u.endByte!=m.endByte)){var T=m.startByte+"-";m.endByte&&(T+=m.endByte),h.nrr=T}}}var A=i.h.Xa()||1,E=tc(i,d.type)||500,x=d.bandwidth,C=x?x*(u.endTime-u.startTime)/1e3/(E/A/1e3)*i.g.rtpSafetyFactor:NaN;isNaN(C)||(h.rtp=C)}}c&&h.ot!==sc&&(h.tb=function(e,t){var n=e.h.qb();if(!n.length)return NaN;e=n[0];for(var i=(n=l(n)).next();!i.done;i=n.next())"variant"===(i=i.value).type&&i.bandwidth>e.bandwidth&&(e=i);switch(t){case ac:return e.videoBandwidth||NaN;case rc:return e.audioBandwidth||NaN;default:return e.bandwidth}}(i,h.ot)/1e3),ec(i,n,h)}}catch(e){q("CMCD_SEGMENT_ERROR","Could not generate segment CMCD data.",e)}break;case 2:case 5:case 6:ec(i,n,{ot:"k"});break;case 4:ec(i,n,{ot:"o"})}})},function(n,i,r,a){(n=t()?t().l:e.H)&&n.banLocation&&n.banLocation(a)},function(n,i){if(i.data){i=i.data.byteLength;var r=t()?t().getStats():e.B;r&&(ph(r,i),0===n&&(r.dj=i))}});return r.configure(e.g.networking),r}function Bc(e,t,n){e.O=new Za,e.O.g=Ja,Fc(e),Jc(e),e.La=new zi(function(){jc(e)}),e.g.streaming.rebufferingGoal&&e.La.ya(.25),e.j.o(t,"waiting",function(){return jc(e)}),e.j.o(t,"canplaythrough",function(){return jc(e)}),e.j.o(t,"playing",function(){return jc(e)}),e.j.o(t,"seeked",function(){return jc(e)}),n&&(e.j.o(t,"stalled",function(){return jc(e)}),e.j.o(t,"progress",function(){return jc(e)}),e.j.o(t,"timeupdate",function(){return jc(e)}))}function Fc(e){var t=e.g.streaming.rebufferingGoal;e.O.i.set(Qa,Math.min(.5,t/2)).set(Ja,t)}function jc(e){var t=!!e.G&&Xs(e.G),n=e.isEnded()||t||e.F.$i(),i=rs(e.h.buffered,e.h.currentTime),r=(t=e.O).i.get(t.g),a=t.g;n=n||i>=r&&0(e=Math.floor(n/3600))?"0":"")+e+":"+(10>(i=Math.floor(n/60%60))?"0":"")+i+":"+(10>(r=Math.floor(n%60))?"0":"")+r+"."+(100>(n=Math.floor(1e3*n%1e3))?10>n?"00":"0":"")+n}var i=Nh(e);e="WEBVTT\n\n";for(var r=(i=l(i)).next();!r.done;r=i.next())e+=n((r=r.value).startTime)+" --\x3e "+n(r.endTime)+function(e){var t=[];switch(e.textAlign){case"left":t.push("align:left");break;case"right":t.push("align:right");break;case $n:t.push("align:middle");break;case"start":t.push("align:start");break;case"end":t.push("align:end")}switch(e.writingMode){case"vertical-lr":t.push("vertical:lr");break;case"vertical-rl":t.push("vertical:rl")}return t.length?" "+t.join(" "):""}(r)+"\n",e+=r.payload+"\n\n";return e}(t=n.parseMedia(t,e,null,[]),i);throw new Ce(2,2,2014,n)}function Zc(e){var t=ih();return t.streaming.failureCallback=function(t){if(e.T()){var n=null;1001==t.code||1002==t.code?(n=1,e.g.streaming.lowLatencyMode&&(n=.1)):1003==t.code&&(n=.1),null!=n&&(t.severity=1,e.Th(n))}},t.textDisplayFactory=function(){var t=Me();return e.Pe&&(document.fullscreenEnabled||"WEBKIT"!==t.Fa())?new zh(e.h,e.Pe):"track"in document.createElement("track")?new jh(e):new Wh},t}function Jc(e){var t=e.zf();if(e.B&&e.O&&e.F){if(0==e.g.streaming.rebufferingGoal){var n=e.J;n.j=!1,Yu(n)}else(n=e.J).j=t,Yu(n);if(e.K&&(n=e.K,t||n.u||(n.u=!0),n.u&&t&&(n.C=!0),n.F=t),$c(e),n=e.g.streaming.liveSync.dynamicTargetLatency.maxAttempts,e.g.streaming.liveSync.dynamicTargetLatency.enabled&&t&&e.Xe=Math.floor(i.end)&&e.xd():Math.floor(n)<=Math.floor(i.start+a)&&e.xd()})}function $c(e){if(e.B&&e.O){var t=e.B.g,n="playing";e.O.g==Ja?n="buffering":e.isEnded()?n="ended":e.h.paused&&(n="paused");var i=n;if(null==t.g)t.g={timestamp:Date.now()/1e3,state:i,duration:0},t=!0;else{var r=Date.now()/1e3;t.g.duration=r-t.g.timestamp,t.g.state==i?t=!1:(t.h.push(t.g),t.g={timestamp:r,state:i,duration:0},t=!0)}t&&(n=(new Map).set("newstate",n),e.dispatchEvent(Tc("statechanged",n)))}}function ed(e){var t=e.h.playbackRate,n=e.T();if(e.g.streaming.vodDynamicPlaybackRate&&!n){var i=e.g.streaming.vodDynamicPlaybackRateLowBufferRate,r=e.Ri();r<=e.g.streaming.vodDynamicPlaybackRateBufferRatio?t!=i&&e.Uc(i,!1):1==r&&t!==e.J.dd()&&e.xd()}if(n&&(n=e.xa(),Number.isFinite(n.end)&&!(e.h.currentTime1e3*a&&(a=e.g.streaming.liveSync.dynamicTargetLatency.minLatency,e.R=Math.max(e.R-(o-a)/2,a+i),e.fc=Date.now()),r&&null!==e.R&&(s=e.R+i,u=e.R-i),o=n.end-e.h.currentTime,i=0,e.m==Cd&&0<(r=e.h.buffered).length&&(i=r.end(r.length-1),i=Math.max(l,i-n.end)),n=e.g.streaming.liveSync.panicMode,r=1e3*e.g.streaming.liveSync.panicThreshold,a=Date.now()-e.O.h,n&&!h&&(h=e.g.streaming.liveSync.minPlaybackRate),n&&h&&a<=r?t!=h&&e.Uc(h,!1):null!=s&&l&&o-i>s?(t!=l&&e.Uc(l,!1),e.fc=null):null!=u&&h&&o-it)&&e.zgt&&(t+=Math.pow(2,32)),t=t.toString(16)),new Ce(2,3,3016,n,t,e.h.error.message)):null}function _d(e,t,n){0t.end&&(t.end=n.end)}return t},b.Ia=new el(p),b.Ia.addEventListener("regionadd",function(e){Nc(b,e.region,"metadataadded")}),c?_(A,u(function(){return L(function(e){return _(e,function(e,t){var n,i,r;return L(function(a){return 1==a.g?(n=Date.now()/1e3,i=!0,e.D=e.yd({yc:e.I,onError:function(t){md(e,t)},Of:function(){},onExpirationUpdated:function(){var t=Tc("expirationupdated");e.dispatchEvent(t)},onEvent:function(t){e.dispatchEvent(t),"drmsessionupdate"==t.type&&i&&(i=!1,e.B.m=Date.now()/1e3-n)}}),e.D.configure(e.g.drm),r=br([t]),e.D.Z=!0,_(a,Ea(e.D,[r],[]),2)):_(a,e.D.bc(e.h),0)})}(b,i),0)})},"initializeSrcEqualsDrmInner_"),23):(b.Ya=new el(p),_(A,u(function(){return L(function(e){if(1==e.g)return _(e,Promise.race([r.na,r.u]),2);b.zc=r.G;var t=r;t.qa=!0,b.H=t.l,b.i=r.nh(),w(e)})},"waitForFinish"),15));case 15:if(b.G){A.A(16);break}return _(A,u(function(){return L(function(e){return _(e,Dc(b),0)})},"initializeMediaSourceEngineInner_"),16);case 16:return b.i&&b.i.textStreams.length&&(b.s.enableTextDisplayer?b.s.enableTextDisplayer():kt("Text displayer w/ enableTextDisplayer",'Text displayer should have a "enableTextDisplayer" method!')),_(A,u(function(){return L(function(e){return _(e,r.u,0)})},"waitForFinish"),18);case 18:if(b.g=r.getConfiguration(),b.Ne=r.F,b.H&&b.H.setMediaElement&&b.h&&b.H.setMediaElement(b.h),b.He=function(e){return e.sa=!0,e.H}(r),b.Ge=r.Na,(f=r.B)&&(b.L=f),h&&b.h&&"AUDIO"===b.h.nodeName&&(function(e){for(var t=l(e.i.variants),n=t.next();!n.done;n=t.next())(n=n.value).video&&(n.video.closeSegmentIndex(),n.video=null),n.bandwidth=n.audio&&n.audio.bandwidth?n.audio.bandwidth:0;e.i.variants=e.i.variants.filter(function(e){return e.audio})}(b),b.configure("manifest.disableVideo",!0)),r.i){A.A(19);break}return _(A,u(function(){return L(function(e){return _(e,bh(r,b.h),0)})},"drmEngine_.init"),19);case 19:return b.D=function(e){return e.ba=!0,e.i}(r),_(A,u(function(){return L(function(e){return _(e,b.D.bc(b.h),0)})},"drmEngine_.attach"),21);case 21:return!(g=r.D)||b.Ta&&b.Ta==g||(b.u=function(e){return e.Z=!0,e.j}(r),b.Ta=r.D,"function"!=typeof b.u.setMediaElement&&(kt("AbrManager w/o setMediaElement","Please use an AbrManager with setMediaElement function."),b.u.setMediaElement=function(){}),"function"!=typeof b.u.setCmsdManager&&(kt("AbrManager w/o setCmsdManager","Please use an AbrManager with setCmsdManager function."),b.u.setCmsdManager=function(){}),"function"!=typeof b.u.trySuggestStreams&&(kt("AbrManager w/o trySuggestStreams","Please use an AbrManager with trySuggestStreams function."),b.u.trySuggestStreams=function(){})),m=function(e){return e.ua=!0,e.L}(r),v=r.J,_(A,u(function(){return L(function(t){return _(t,function(t,n,i,r){var a,o,s,u,h,c,d,p,f,g,m,v,y,b,S,T,A,E,x,C,k,I,M,P,D,R,N;return L(function(O){switch(O.g){case 1:xc(t,"load"),a=t.h,t.J=new Xu({tf:function(){return a.playbackRate},dd:function(){return a.defaultPlaybackRate},bi:function(e){a.playbackRate=e},jj:function(e){a.currentTime+=e}}),Rc(t,a,n),"onchange"in e.screen&&t.j.o(e.screen,"change",function(){if(t.L.getConfiguration){var e=t.L.getConfiguration();"AUTO"==e.Nc?nd(t):"AUTO"==t.g.preferredVideoHdrLevel&&t.g.abr.enabled&&(e.Nc="AUTO",t.L.configure(e),nd(t))}}),o=!1,s=l(t.i.variants);for(u=s.next();!u.done;u=s.next())h=u.value,(c=h.video&&h.video.dependencyStream)&&(o=Nt(c));!function(e,t,n){n||t.lcevc.enabled?(Sc(e),null==e.P&&(e.P=new Lt(e.h,e.zi,t.lcevc,n),e.G&&(e.G.L=e.P))):Sc(e)}(t,t.g,o),t.Od=t.g.preferredTextLanguage,t.Me=t.g.preferredTextRole,t.Le=t.g.preferForcedSubs,_d(t.i.presentationTimeline,t.g.playRangeStart,t.g.playRangeEnd),t.u.init(function(e,n,i){t.i&&t.l&&e!=t.l.s&&rd(t,e,!0,void 0!==n&&n,void 0===i?0:i)}),t.u.setMediaElement(a),t.u.setCmsdManager(t.qa),t.l=function(e){return new vl(e.i,{ed:function(){return e.F?e.F.We():0},getBandwidthEstimate:function(){return e.u.getBandwidthEstimate()},Xa:function(){return e.Xa()},video:e.h,ha:e.G,yc:e.I,onError:function(t){return md(e,t)},onEvent:function(t){return e.dispatchEvent(t)},Pf:function(t,n,i){var r=t.startTime;if(t=t.endTime,(n=n.type)!=nt){if(e.F){e.F.lj();var a=qs(e.G,n);!e.T()&&e.h.paused&&!e.h.seeking&&null!=a&&0=i)})}else t.xe=[]}(e,i),e={Id:t,position:n},0<=(t=(i=i.xe).findIndex(function(e){return e.position>=n}))?i.splice(t,i[t].position==n?1:0,e):i.push(e)}(e.Ge,n,t)},Ei:function(t,n){var i=e.D;if(i.h.parseInbandPsshEnabled&&!i.G&&["audio","video"].includes(t)){t=new Sa(Te(n)),n=0;for(var r=l(t.data),a=r.next();!a.done;a=r.next())n+=a.value.length;if(0==n)i=Promise.resolve();else{for(n=new Uint8Array(n),r=0,a=(t=l(t.data)).next();!a.done;a=t.next())a=a.value,n.set(a,r),r+=a.length;Ia(i,"cenc",n),i=i.l}}else i=Promise.resolve();return i},disableStream:function(t,n){return e.disableStream(t,n)}})}(t),t.l.configure(t.g.streaming),t.m=xd,t.dispatchEvent(Tc("streaming")),d=i;case 2:for((f=t.l.s)||d||(d=nd(t)?t.u.chooseVariant():null),g=[],m=l([(p=f||d).video,p.audio]),v=m.next();!v.done;v=m.next())(y=v.value)&&!y.segmentIndex&&(g.push(y.createSegmentIndex()),y.dependencyStream&&g.push(y.dependencyStream.createSegmentIndex()));if(!(0k&&(A=k),_(O,function(e,t){var n,i,r,a,o;return L(function(s){return 1==s.g?(n=e.audio,i=e.video,r=function(e,t){var n,i,r;return L(function(a){return 1==a.g?e?e.segmentIndex?a.A(2):_(a,e.createSegmentIndex(),2):a.return(null):(i=(n=e.segmentIndex.cc(t))?n.next().value:null)?(r=i.startTime,a.return(r)):a.return(null)})},_(s,r(n,t),2)):3!=s.g?(a=s.h,_(s,r(i,t),3)):null!=(o=s.h)&&null!=a?s.return(Math.max(o,a)):null!=o?s.return(o):null!=a?s.return(a):s.return(t)})}(d,A),9);case 9:I=O.h,b(I);case 8:rd(t,d,!0,!1,0);case 7:return t.F.ready(),t.sc().find(function(e){return e.active})||((M=fr(t.i.textStreams,t.Od,t.Me,t.Le)[0]||null)&&hh(t.B.h,M,!0),d&&(M?(yr(d.audio,M,t.g)&&(t.Y=!0),t.Y&&t.s.setTextVisibility(!0)):(t.Y=!1,t.s.setTextVisibility(!1)),dd(t)),M&&(t.g.streaming.alwaysStreamText||t.jd())&&(_l(t.l,M),fd(t))),_(O,t.l.start(r),10);case 10:t.g.abr.enabled&&(t.u.enable(),pd(t)),sd(t),nd(t),t.i.variants.some(function(e){return e.primary}),((P=t.T())&&(t.g.streaming.liveSync&&t.g.streaming.liveSync.enabled||t.i.serviceDescription||t.g.streaming.liveSync.panicMode)||t.g.streaming.vodDynamicPlaybackRate)&&(D=function(){return ed(t)},t.j.o(a,"timeupdate",D)),P||(R=function(){return td(t)},t.j.o(a,"timeupdate",R),td(t),t.i.nextUrl&&(0, the browser will not load anything until play() is called. We are unable to measure load latency in a meaningful way, and we cannot provide track info yet. Please do not use preload="none" with Shaka Player.'),h.resolve()),e.j.ra(i,"error",function(){h.reject(bd(e))}),_(m,qi(e.g.streaming.loadTimeout,h),4);case 4:((d=e.T())&&(e.g.streaming.liveSync&&e.g.streaming.liveSync.enabled||e.g.streaming.liveSync.panicMode)||e.g.streaming.vodDynamicPlaybackRate)&&(p=function(){return ed(e)},e.j.o(i,"timeupdate",p)),d||(f=function(){return td(e)},e.j.o(i,"timeupdate",f),td(e)),e.C&&(e.C.onManifestUpdated(d),d&&(g=e.xa().end,e.j.o(i,"progress",function(){var t=e.xa().end;g!=t&&(e.C.onManifestUpdated(e.T()),g=t)}))),e.$=!0,w(m)}})}(b,d,i),0)})},"srcEqualsInner_"),14);case 14:b.dispatchEvent(Tc("loaded"));case 6:if(x(A),!r){A.A(25);break}return _(A,r.destroy(),25);case 25:b.Na=null,C(A,0);break;case 5:if(!(y=E(A))||7e3==y.code){A.A(27);break}return _(A,b.nc(!1),27);case 27:throw y}})},i.qm=function(e,t){e=void 0===e||e,t=void 0!==t&&t;var n,i=this;return L(function(r){return 1==r.g?_(r,kc(i),2):3!=r.g?(n=r.h,_(r,i.nc(e,t),3)):r.return(n)})},i.Ni=function(e,t){e=void 0!==e&&e,t=void 0!==t&&t;var n,i=this;return L(function(r){return 1==r.g?_(r,kc(i,t),2):3!=r.g?(n=r.h,_(r,i.detach(e),3)):r.return(n)})},i.preload=function(e,t,n,i){t=void 0===t?null:t;var r,a,o=this;return L(function(s){return 1==s.g?(rh(r=Zc(o),i||o.g,Zc(o)),_(s,Ic(o,e,t,n,!1,r),2)):((a=s.h)?a.start():md(o,new Ce(2,7,7005)),s.return(a))})},i.Tg=function(){var e,t,n,i,r=this;return L(function(a){for(e=[],t=l(r.Re),n=t.next();!n.done;n=t.next())(i=n.value).s||e.push(i.destroy());return r.Re=[],_(a,Promise.all(e),0)})},i.Xl=function(){for(var e=this.ba;e.g;)e.release()},i.yd=function(e){return new Aa(e)},i.configure=function(e,t){if(2==arguments.length&&"string"==typeof e&&(e=zl(e,t)),e.streaming&&"forceTransmuxTS"in e.streaming&&(kt("streaming.forceTransmuxTS configuration","Please Use mediaSource.forceTransmux instead."),e.mediaSource=e.mediaSource||{},e.mediaSource.mediaSource=e.streaming.forceTransmuxTS,delete e.streaming.forceTransmuxTS),e.streaming&&"forceTransmux"in e.streaming&&(kt("streaming.forceTransmux configuration","Please Use mediaSource.forceTransmux instead."),e.mediaSource=e.mediaSource||{},e.mediaSource.mediaSource=e.streaming.forceTransmux,delete e.streaming.forceTransmux),e.streaming&&"useNativeHlsOnSafari"in e.streaming){kt("streaming.useNativeHlsOnSafari configuration","Please Use streaming.useNativeHlsForFairPlay or streaming.preferNativeHls instead.");var n=Me();e.streaming.preferNativeHls=e.streaming.useNativeHlsOnSafari&&"WEBKIT"===n.Fa(),delete e.streaming.useNativeHlsOnSafari}if(e.streaming&&"boolean"==typeof e.streaming.liveSync&&(kt("streaming.liveSync","Please Use streaming.liveSync.enabled instead."),n=e.streaming.liveSync,e.streaming.liveSync={},e.streaming.liveSync.enabled=n),e.streaming&&(!e.streaming.liveSync||!("targetLatency"in e.streaming.liveSync))&&("liveSyncMinLatency"in e.streaming||"liveSyncMaxLatency"in e.streaming)){n=e.streaming.liveSyncMinLatency||0;var i=Math.abs((e.streaming.liveSyncMaxLatency||1)-n)/2;e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.targetLatency=n+i,e.streaming.liveSync.targetLatencyTolerance=i}if(e.streaming&&"liveSyncMaxLatency"in e.streaming&&(kt("streaming.liveSyncMaxLatency","Please Use streaming.liveSync.targetLatency and streaming.liveSync.targetLatencyTolerance instead. Or, set the values in your DASH manifest"),delete e.streaming.liveSyncMaxLatency),e.streaming&&"liveSyncMinLatency"in e.streaming&&(kt("streaming.liveSyncMinLatency","Please Use streaming.liveSync.targetLatency and streaming.liveSync.targetLatencyTolerance instead. Or, set the values in your DASH manifest"),delete e.streaming.liveSyncMinLatency),e.streaming&&"liveSyncTargetLatency"in e.streaming&&(kt("streaming.liveSyncTargetLatency","Please Use streaming.liveSync.targetLatency instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.targetLatency=e.streaming.liveSyncTargetLatency,delete e.streaming.liveSyncTargetLatency),e.streaming&&"liveSyncTargetLatencyTolerance"in e.streaming&&(kt("streaming.liveSyncTargetLatencyTolerance","Please Use streaming.liveSync.targetLatencyTolerance instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.targetLatencyTolerance=e.streaming.liveSyncTargetLatencyTolerance,delete e.streaming.liveSyncTargetLatencyTolerance),e.streaming&&"liveSyncPlaybackRate"in e.streaming&&(kt("streaming.liveSyncPlaybackRate","Please Use streaming.liveSync.maxPlaybackRate instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.maxPlaybackRate=e.streaming.liveSyncPlaybackRate,delete e.streaming.liveSyncPlaybackRate),e.streaming&&"liveSyncMinPlaybackRate"in e.streaming&&(kt("streaming.liveSyncMinPlaybackRate","Please Use streaming.liveSync.minPlaybackRate instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.minPlaybackRate=e.streaming.liveSyncMinPlaybackRate,delete e.streaming.liveSyncMinPlaybackRate),e.streaming&&"liveSyncPanicMode"in e.streaming&&(kt("streaming.liveSyncPanicMode","Please Use streaming.liveSync.panicMode instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.panicMode=e.streaming.liveSyncPanicMode,delete e.streaming.liveSyncPanicMode),e.streaming&&"liveSyncPanicThreshold"in e.streaming&&(kt("streaming.liveSyncPanicThreshold","Please Use streaming.liveSync.panicThreshold instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.panicThreshold=e.streaming.liveSyncPanicThreshold,delete e.streaming.liveSyncPanicThreshold),e.mediaSource&&"sourceBufferExtraFeatures"in e.mediaSource){kt("mediaSource.sourceBufferExtraFeatures configuration","Please Use mediaSource.addExtraFeaturesToSourceBuffer() instead.");var r=e.mediaSource.sourceBufferExtraFeatures;e.mediaSource.addExtraFeaturesToSourceBuffer=function(){return r},delete e.mediaSource.sourceBufferExtraFeatures}if(e.manifest&&e.manifest.hls&&"useSafariBehaviorForLive"in e.manifest.hls&&(kt("manifest.hls.useSafariBehaviorForLive configuration","Please Use liveSync config to keep on live Edge instead."),delete e.manifest.hls.useSafariBehaviorForLive),e.streaming&&"parsePrftBox"in e.streaming&&(kt("streaming.parsePrftBox configuration","Now fired without needing a configuration."),delete e.streaming.parsePrftBox),e.manifest&&e.manifest.dash&&"enableAudioGroups"in e.manifest.dash&&(kt("manifest.dash.enableAudioGroups configuration","It is now enabled by default and cannot be disabled."),delete e.manifest.dash.enableAudioGroups),e.streaming&&"dispatchAllEmsgBoxes"in e.streaming&&(kt("streaming.dispatchAllEmsgBoxes configuration","Please Use mediaSource.dispatchAllEmsgBoxes instead."),e.mediaSource=e.mediaSource||{},e.mediaSource.dispatchAllEmsgBoxes=e.streaming.dispatchAllEmsgBoxes,delete e.streaming.dispatchAllEmsgBoxes),e.streaming&&"autoLowLatencyMode"in e.streaming&&(kt("streaming.autoLowLatencyMode configuration","Please Use streaming.lowLatencyMode instead."),e.streaming.lowLatencyMode=e.streaming.autoLowLatencyMode,delete e.streaming.autoLowLatencyMode),e.manifest&&e.manifest.dash&&"ignoreSupplementalCodecs"in e.manifest.dash&&(kt("manifest.dash.ignoreSupplementalCodecs configuration","Please Use manifest.ignoreSupplementalCodecs instead."),e.manifest.ignoreSupplementalCodecs=e.manifest.dash.ignoreSupplementalCodecs,delete e.manifest.dash.ignoreSupplementalCodecs),e.manifest&&e.manifest.hls&&"ignoreSupplementalCodecs"in e.manifest.hls&&(kt("manifest.hls.ignoreSupplementalCodecs configuration","Please Use manifest.ignoreSupplementalCodecs instead."),e.manifest.ignoreSupplementalCodecs=e.manifest.hls.ignoreSupplementalCodecs,delete e.manifest.hls.ignoreSupplementalCodecs),e.manifest&&e.manifest.dash&&"updatePeriod"in e.manifest.dash&&(kt("manifest.dash.updatePeriod configuration","Please Use manifest.updatePeriod instead."),e.manifest.updatePeriod=e.manifest.dash.updatePeriod,delete e.manifest.dash.updatePeriod),e.manifest&&e.manifest.hls&&"updatePeriod"in e.manifest.hls&&(kt("manifest.hls.updatePeriod configuration","Please Use manifest.updatePeriod instead."),e.manifest.updatePeriod=e.manifest.hls.updatePeriod,delete e.manifest.hls.updatePeriod),e.manifest&&e.manifest.dash&&"ignoreDrmInfo"in e.manifest.dash&&(kt("manifest.dash.ignoreDrmInfo configuration","Please Use manifest.ignoreDrmInfo instead."),e.manifest.ignoreDrmInfo=e.manifest.dash.ignoreDrmInfo,delete e.manifest.dash.ignoreDrmInfo),e.drm&&e.drm.advanced){for(var a in n=!1,e.drm.advanced){var o=e.drm.advanced[a];i=o.videoRobustness,o=o.audioRobustness,"videoRobustness"in e.drm.advanced[a]&&!Array.isArray(e.drm.advanced[a].videoRobustness)&&(e.drm.advanced[a].videoRobustness=[i],n=!0),"audioRobustness"in e.drm.advanced[a]&&!Array.isArray(e.drm.advanced[a].audioRobustness)&&(e.drm.advanced[a].audioRobustness=[o],n=!0)}n&&kt("AdvancedDrmConfiguration's videoRobustness and audioRobustness","These properties are no longer strings but array of strings, please update your usage of these properties.")}return e.streaming&&"forceHTTP"in e.streaming&&(kt("streaming.forceHTTP configuration","Please Use networking.forceHTTP instead."),e.networking=e.networking||{},e.networking.forceHTTP=e.streaming.forceHTTP,delete e.streaming.forceHTTP),e.streaming&&"forceHTTPS"in e.streaming&&(kt("streaming.forceHTTPS configuration","Please Use networking.forceHTTP instead."),e.networking=e.networking||{},e.networking.forceHTTPS=e.streaming.forceHTTPS,delete e.streaming.forceHTTPS),e.streaming&&"minBytesForProgressEvents"in e.streaming&&(kt("streaming.minBytesForProgressEvents configuration","Please Use networking.minBytesForProgressEvents instead."),e.networking=e.networking||{},e.networking.minBytesForProgressEvents=e.streaming.minBytesForProgressEvents,delete e.streaming.minBytesForProgressEvents),a=rh(this.g,e,Zc(this)),Gc(this),a},i.nk=function(e){this.Bg=e},i.getConfiguration=function(){var e=Zc(this);return rh(e,this.g,Zc(this)),e},i.Ck=function(){return this.Bg},i.Ui=function(){return rh(Zc(this),this.g,Zc(this)),Xl(this.g,Zc(this))},i.Ri=function(){if(this.h){var e=this.h.buffered.length;e=e?this.h.buffered.end(e-1):0;var t=this.getConfiguration().streaming.bufferingGoal;if(e>=(t=Math.min(this.h.currentTime+t,this.xa().end)))return 1;if(!(e<=this.h.currentTime)&&eu(p,h))&&(d=p);d!=h&&(d?(h=or(d),s.Ae(h,!0,i||0)):id(s))}(),!this.Ca())||function(){if(s.h&&s.h.audioTracks){var n=fr(s.qb(),e,t||"",!1)[0];n&&s.Ae(n)}}()},i.Xh=function(e,t,n){var i,r=this;n=void 0!==n&&n,this.i&&this.F&&(function(){r.Od=e,r.Me=t||"",r.Le=n||!1;var i=fr(r.i.textStreams,r.Od,r.Me,r.Le)[0]||null;i&&i!=r.l.B&&(hh(r.B.h,i,!1),r.g.streaming.alwaysStreamText||r.jd())&&(_l(r.l,i),cd(r),fd(r))}(),!this.Ca())||(i=fr(r.sc(),e,t||"",n||!1)[0])&&r.dg(i)},i.fm=function(e,t,n){var i=this;t=void 0===t||t,n=void 0===n?0:n,this.i&&this.F&&(function(){for(var r=null,a=l(i.i.variants),o=a.next();!o.done;o=a.next())if((o=o.value).audio.label==e){r=o;break}null!=r&&(i.L=i.g.adaptationSetCriteriaFactory(),i.L.configure({language:r.language,role:"",channelCount:0,Nc:"",spatialAudio:!1,videoLayout:"",Vd:"",Wc:e,codecSwitchingStrategy:i.g.mediaSource.codecSwitchingStrategy,audioCodec:"",Xd:"",Ye:0,preferredAudioCodecs:i.g.preferredAudioCodecs,preferredAudioChannelCount:i.g.preferredAudioChannelCount}),id(i,t,n))}(),!this.Ca())||function(){if(i.h&&i.h.audioTracks){for(var t=Array.from(i.h.audioTracks),n=null,r=(t=l(t)).next();!r.done;r=t.next())(r=r.value).label==e&&(n=r);n&&ad(i,n)}}()},i.jd=function(){var e=this.Y;return this.s?this.s.isTextVisible():e},i.zk=function(){return this.eb.map(function(e){return sr(e)})},i.yk=function(e){if(kt("getChapters","Please use an getChaptersAsync."),!this.eb.length)return[];var t=ht(e);if(!(e=this.eb.filter(function(e){return ht(e.language)==t})).length)return[];for(var n=[],i=new Set,r=(e=l(e)).next();!r.done;r=e.next())(r=r.value).segmentIndex&&r.segmentIndex.Ib(function(e){var t=e.S()[0],r=e.startTime+"-"+e.endTime+"-"+t;e={id:r,title:t,startTime:e.startTime,endTime:e.endTime},i.has(r)||(n.push(e),i.add(r))});return n},i.kh=function(e){var t,n,i,r,a,o,s,u=this;return L(function(h){switch(h.g){case 1:if(!u.eb.length)return h.return([]);if(t=ht(e),!(n=u.eb.filter(function(e){return ht(e.language)==t})).length)return h.return([]);i=[],r=new Set,a=l(n),o=a.next();case 2:if(o.done){h.A(4);break}if((s=o.value).segmentIndex){h.A(5);break}return _(h,s.createSegmentIndex(),5);case 5:s.segmentIndex.Ib(function(e){var t=e.S()[0],n=e.startTime+"-"+e.endTime+"-"+t;e={id:n,title:t,startTime:e.startTime,endTime:e.endTime},r.has(n)||(i.push(e),r.add(n))}),o=a.next(),h.A(2);break;case 4:return h.return(i)}})},i.Ce=function(e){e=!!e,this.Y!=e&&(this.Y=e,this.m==xd?(this.s.setTextVisibility(e),this.g.streaming.alwaysStreamText||(e?this.l.B||0<(e=fr(this.i.textStreams,this.Od,this.Me,this.Le)).length&&(_l(this.l,e[0]),cd(this),fd(this)):function(e){var t=e.h.get(nt);t&&(Ol(t),Ul(t).catch(function(){}),e.F=e.h.get(nt),e.h.delete(nt),t.stream&&t.stream.closeSegmentIndex&&t.stream.closeSegmentIndex()),e.B=null}(this.l))):this.h&&this.h.src&&this.h.textTracks&&this.s.setTextVisibility(e),dd(this))},i.Uk=function(){if(this.F)var e=this.F.We();else{if(null==this.N)return new Date;if(this.N instanceof Date)return this.N;e=this.N}if(this.i&&!this.Ca()){var t=this.i.presentationTimeline;return new Date(1e3*((t.m||t.i)+e))}return this.h&&this.h.getStartDate?(t=this.h.getStartDate(),isNaN(t.getTime())?null:new Date(t.getTime()+1e3*e)):null},i.ph=function(){if(this.i&&!this.Ca()){var e=this.i.presentationTimeline;return new Date(1e3*(e.m||e.i))}return this.h&&this.h.getStartDate?(e=this.h.getStartDate(),isNaN(e.getTime())?null:e):null},i.uf=function(){return this.T()&&this.i?this.i.presentationTimeline.uf():null},i.Sb=function(){if(this.m==xd)return this.G.Sb();var e={total:[],audio:[],video:[],text:[]};return this.m==Cd&&(e.total=as(this.h.buffered)),e},i.rf=function(){if(!this.h||!this.h.currentTime)return null;var e=this.ph().getTime()+1e3*this.h.currentTime;return Math.floor(Date.now()-e)},i.getStats=function(){if(this.m!=xd&&this.m!=Cd)return{width:NaN,height:NaN,currentCodecs:"",streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,stallsDetected:NaN,gapsJumped:NaN,estimatedBandwidth:NaN,completionPercent:NaN,loadLatency:NaN,manifestTimeSeconds:NaN,drmTimeSeconds:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,liveLatency:NaN,maxSegmentDuration:NaN,manifestSizeBytes:NaN,bytesDownloaded:NaN,nonFatalErrorCount:NaN,manifestPeriodCount:NaN,manifestGapCount:NaN,switchHistory:[],stateHistory:[]};$c(this);var e=this.h,t=e.currentTime/e.duration;if(isNaN(t)||this.T()||function(e,t){e.i=isNaN(e.i)?t:Math.max(e.i,t)}(this.B,Math.round(100*t)),this.F&&(this.B.P=this.F.ti(),this.B.R=this.F.wi()),e.getVideoPlaybackQuality&&(t=e.getVideoPlaybackQuality(),function(e,t,n){e.O=t,e.N=n}(this.B,Number(t.droppedVideoFrames),Number(t.totalVideoFrames)),this.B.L=Number(t.corruptedVideoFrames)),this.B.s=this.D?function(e){return e.I?e.I:NaN}(this.D):NaN,dh(this.B,e.videoWidth||NaN,e.videoHeight||NaN),this.B.l="",this.T()&&null!=this.ph()&&(e=this.rf()||0,this.B.D=e/1e3),t=this.qb().find(function(e){return e.active}),e=this.sc().find(function(e){return e.active}),t){if(t.bandwidth){var n=this.J?this.J.i:1,i=n*t.bandwidth;e&&e.bandwidth&&(i+=n*e.bandwidth),this.B.B=i}t.width&&t.height&&dh(this.B,t.width||NaN,t.height||NaN),t=t.codecs,e&&(t+=","+(e.codecs||e.mimeType)),t&&(this.B.l=t)}return this.m!=xd||this.Ca()||(this.i&&(this.B.H=this.i.periodCount,this.B.G=this.i.gapCount,this.i.presentationTimeline&&(this.B.J=this.i.presentationTimeline.h)),e=this.u.getBandwidthEstimate(),this.B.u=e),this.m==Cd&&ph(this.B,NaN),function(e){for(var t=e.U,n=e.C,i=e.l,r=e.B,a=e.N,o=e.O,s=e.L,u=e.R,h=e.P,c=e.u,d=e.i,p=e.F,f=e.I,g=e.m,m=uh(e.g,"playing"),v=uh(e.g,"paused"),y=uh(e.g,"buffering"),b=e.s,_=e.D,w=e.J,S=e.dj,T=e.j,A=e.K,E=e.H,x=e.G,C=function(e){function t(e){return{timestamp:e.timestamp,state:e.state,duration:e.duration}}for(var n=[],i=l(e.h),r=i.next();!r.done;r=i.next())n.push(t(r.value));return e.g&&n.push(t(e.g)),n}(e.g),k=[],I=(e=l(e.h.g)).next();!I.done;I=e.next())I=I.value,k.push({timestamp:I.timestamp,id:I.id,type:I.type,fromAdaptation:I.fromAdaptation,bandwidth:I.bandwidth});return{width:t,height:n,currentCodecs:i,streamBandwidth:r,decodedFrames:a,droppedFrames:o,corruptedFrames:s,stallsDetected:u,gapsJumped:h,estimatedBandwidth:c,completionPercent:d,loadLatency:p,manifestTimeSeconds:f,drmTimeSeconds:g,playTime:m,pauseTime:v,bufferingTime:y,licenseTime:b,liveLatency:_,maxSegmentDuration:w,manifestSizeBytes:S,bytesDownloaded:T,nonFatalErrorCount:A,manifestPeriodCount:E,manifestGapCount:x,stateHistory:C,switchHistory:k}}(this.B)},i.Yd=function(e,t,n,i,r,a,o){o=void 0!==o&&o;var s,u,l,h,c,d,p,f,g,m,v=this;return L(function(y){switch(y.g){case 1:if(v.m!=xd&&v.m!=Cd)throw new Ce(1,7,7004);if("subtitles"!=n&&"captions"!=n&&Y("Using a kind value different of `subtitles` or `captions` can cause unwanted issues."),i){y.A(2);break}return _(y,Xc(v,e),3);case 3:i=y.h;case 2:if(s=[],v.C&&(s=v.C.getCuePoints()),v.m!=Cd){y.A(4);break}return u=Me(),o&&"WEBKIT"===u.Fa()&&(n="forced"),_(y,function(e,t,n,i,r,a,o){var s,u,l,h;return L(function(c){if(1==c.g)return"text/vtt"!=r||o.length?_(c,Yc(e,t,e.I,e.g.streaming.retryParameters),3):c.A(2);2!=c.g&&(s=c.h,u=qc(e,s,r,o),l=new Blob([u],{type:"text/vtt"}),t=fu(l),r="text/vtt"),h=document.createElement("track");var d=e.K,p=t;try{if(d.g.enabled){var f=$h(d);f.ot="c",f.su=!0;var g=ic(p,nc(f))}else g=p}catch(e){q("CMCD_TEXT_TRACK_ERROR","Could not generate text track CMCD data.",e),g=p}return h.src=g,h.label=a,h.kind=i,h.srclang=n,e.h.getAttribute("crossorigin")||e.h.setAttribute("crossorigin","anonymous"),e.h.appendChild(h),e.Ag.push(h),c.return(h)})}(v,e,t,n,i,a||"",s),5);case 5:if((l=y.h).track)return sd(v),y.return(hr(l.track));throw new Ce(1,2,2012);case 4:if(h=it,c=v.xa(),d=c.end-c.start,v.i&&(d=v.i.presentationTimeline.getDuration()),1/0==d)throw new Ce(1,4,4033);if(!s.length){y.A(6);break}return _(y,Yc(v,e,v.I,v.g.streaming.retryParameters),7);case 7:p=y.h,f=qc(v,p,i,s),g=new Blob([f],{type:"text/vtt"}),e=fu(g),i="text/vtt";case 6:if(m={id:v.Oe++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:Wu(0,d,[e]),mimeType:i||"",codecs:r||"",kind:n,encrypted:!1,drmInfos:[],keyIds:new Set,language:t,originalLanguage:t,label:a||null,type:h.$a,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!!o,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(i||"",r||"")]),isAudioMuxedInVideo:!1,baseOriginalId:null},!ji(xi(m.mimeType,m.codecs)))throw new Ce(2,2,2014,i);return v.i.textStreams.push(m),sd(v),y.return(sr(m))}})},i.$e=function(e,t){var n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S=this;return L(function(T){switch(T.g){case 1:if(S.m!=xd&&S.m!=Cd)throw new Ce(1,7,7004);if(t){T.A(2);break}return _(T,Xc(S,e),3);case 3:t=T.h;case 2:if("text/vtt"!=t)throw new Ce(1,2,2017,e);if(n=it,i=S.xa(),r=i.end-i.start,S.i&&(r=S.i.presentationTimeline.getDuration()),1/0==r)throw new Ce(1,4,4045);return _(T,Yc(S,e,S.I,S.g.streaming.retryParameters),4);case 4:if(a=T.h,!(o=Fi(t)))throw new Ce(2,2,2014,t);for(s=o(),u={periodStart:0,segmentStart:0,segmentEnd:r,vttOffset:0},h=Te(a),c=s.parseMedia(h,u,e,[]),d=[],p=l(c),f=p.next(),g={};!f.done;g={sg:void 0,zd:void 0},f=p.next())g.zd=f.value,g.sg=null,m=function(t){return function(){return null==t.sg&&(t.sg=Ze([e],[t.zd.payload])),t.sg||[]}}(g),v=new Jo(g.zd.startTime,g.zd.endTime,m,0,null,null,0,0,1/0),g.zd.payload.includes("#xywh")&&4===(y=g.zd.payload.split("#xywh=")[1].split(",")).length&&v.hg({height:parseInt(y[3],10),positionX:parseInt(y[0],10),positionY:parseInt(y[1],10),width:parseInt(y[2],10)}),d.push(v);if(b=t,!d.length){T.A(5);break}return _(T,Ch(d[0].S()[0],S.I,S.g.manifest.retryParameters),6);case 6:b=T.h;case 5:return w={id:S.Oe++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Hu(d),mimeType:b||"",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:n.wg,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,tilesLayout:"1x1",accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(b||"","")]),isAudioMuxedInVideo:!1,baseOriginalId:null},S.m==Cd?S.Te.push(w):S.i.imageStreams.push(w),sd(S),T.return(ur(w))}})},i.Ze=function(e,t,n){var i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b=this;return L(function(w){switch(w.g){case 1:if(b.m!=xd&&b.m!=Cd)throw new Ce(1,7,7004);if(n){w.A(2);break}return _(w,Xc(b,e),3);case 3:n=w.h;case 2:if(i=it,r=b.xa(),a=r.end-r.start,b.i&&(a=b.i.presentationTimeline.getDuration()),1/0==a)throw new Ce(1,4,4054);return _(w,Yc(b,e,b.I,b.g.streaming.retryParameters),4);case 4:if(o=w.h,!(s=Fi(n)))throw new Ce(2,2,2014,n);for(u=s(),h={periodStart:0,segmentStart:0,segmentEnd:a,vttOffset:0},c=Te(o),d=u.parseMedia(c,h,e,[]),p=[],f=l(d),g=f.next(),m={};!g.done;m={lf:void 0},g=f.next())m.lf=g.value,v=new Jo(m.lf.startTime,m.lf.endTime,function(e){return function(){return[e.lf.payload]}}(m),0,null,null,0,0,1/0),p.push(v);return y={id:b.Oe++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Hu(p),mimeType:"text/plain",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:t,originalLanguage:t,label:null,type:i.$a,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi("text/plain","")]),isAudioMuxedInVideo:!1,baseOriginalId:null},b.eb.push(y),sd(b),w.return(sr(y))}})},i.mm=function(e,t){this.sa.width=e,this.sa.height=t},i.Th=function(e){if(this.m==xd){var t=this.l;if(e=void 0===e?.1:e,t.l.g)t=!1;else if(t.C)t=!1;else{for(var n=l(t.h.values()),i=n.next();!i.done;i=n.next())!(i=i.value).je||i.Za||i.Db||(i.je=!1,Nl(t,i,e));t=!0}}else t=!1;return t},i.nh=function(){return Y("Shaka Player's internal Manifest structure is NOT covered by semantic versioning compatibility guarantees. It may change at any time! Please consider filing a feature request for whatever you use getManifest() for."),this.i},i.Qk=function(){return this.zc},i.Ik=function(){var e={video:null,audio:null,text:null};if(this.m!=xd)return e;for(var t=this.l.s,n=this.h.currentTime,i=(t=l([t.video,t.audio,this.l.B])).next();!i.done;i=t.next())if((i=i.value)&&i.segmentIndex){var r=i.segmentIndex.find(n);r={codecs:(r=i.segmentIndex.get(r)).codecs||i.codecs,mimeType:r.mimeType||i.mimeType,bandwidth:r.bandwidth||i.bandwidth},"video"==i.type?(r.width=i.width,r.height=i.height,e.video=r):"audio"==i.type?e.audio=r:i.type==nt&&(e.text=r)}return e},i.di=function(e){this.Pe=e},i.disableStream=function(e,t){if(!this.g.abr.enabled||this.m===Ad||!navigator.onLine||0==t||!this.i)return!1;if(this.i.variants.some(function(t){var n=t[e.type];return!(!n||n.id===e.id||t.disabledUntilTime||"audio"==e.type&&e.language!==n.language)})){for(var n=!1,i=!1,r=l(this.i.variants),a=r.next();!a.done;a=r.next()){var o=(a=a.value)[e.type];o&&(o.id===e.id?(a.disabledUntilTime=Date.now()/1e3+t,n=!0):o.trickModeVideo&&o.trickModeVideo.id==e.id&&(i=!0))}return!(!n&&i||(this.Qe.ya(1),t=this.Sb().video.reduce(function(e,t){return e+t.end-t.start},0),id(this,!1,t,!0,!1),0))}return!1},i.addFont=function(t,n){return function(t,n){var i,r,a,o,s;return L(function(u){if(1==u.g)return"fonts"in document&&"FontFace"in e?_(u,document.fonts.ready,2):u.return();if(!("entries"in document.fonts))return u.return();for(i=function(e){for(var t=[],n=(e=e.entries()).next();!1===n.done;)t.push(n.value),n=e.next();return t},r=l(i(document.fonts)),a=r.next();!a.done;a=r.next())if((o=a.value).family===t&&"swap"===o.display)return u.return();s=new FontFace(t,"url("+n+")",{display:"swap"}),document.fonts.add(s),w(u)})}(t,n)},i.Ca=function(){return!(!this.h||!this.h.remote)&&"disconnected"!=this.h.remote.state},i.isEnded=function(){return!(this.h&&!this.h.ended)||this.$&&!this.T()&&this.h.currentTime>=this.xa().end},H("shaka.Player",wc),wc.prototype.isEnded=wc.prototype.isEnded,wc.prototype.isRemotePlayback=wc.prototype.Ca,wc.prototype.addFont=wc.prototype.addFont,wc.prototype.setVideoContainer=wc.prototype.di,wc.prototype.getFetchedPlaybackInfo=wc.prototype.Ik,wc.prototype.getManifestParserFactory=wc.prototype.Qk,wc.prototype.getManifest=wc.prototype.nh,wc.prototype.retryStreaming=wc.prototype.Th,wc.prototype.setMaxHardwareResolution=wc.prototype.mm,wc.prototype.addChaptersTrack=wc.prototype.Ze,wc.prototype.addThumbnailsTrack=wc.prototype.$e,wc.prototype.addTextTrackAsync=wc.prototype.Yd,wc.prototype.getStats=wc.prototype.getStats,wc.prototype.getBufferedInfo=wc.prototype.Sb,wc.prototype.getSegmentAvailabilityDuration=wc.prototype.uf,wc.prototype.getPresentationStartTimeAsDate=wc.prototype.ph,wc.prototype.getPlayheadTimeAsDate=wc.prototype.Uk,wc.prototype.setTextTrackVisibility=wc.prototype.Ce,wc.prototype.getChaptersAsync=wc.prototype.kh,wc.prototype.getChapters=wc.prototype.yk,wc.prototype.getChaptersTracks=wc.prototype.zk,wc.prototype.isTextTrackVisible=wc.prototype.jd,wc.prototype.selectVariantsByLabel=wc.prototype.fm,wc.prototype.selectTextLanguage=wc.prototype.Xh,wc.prototype.selectAudioLanguage=wc.prototype.Aj,wc.prototype.getTextLanguages=wc.prototype.al,wc.prototype.getAudioLanguages=wc.prototype.tk,wc.prototype.getTextLanguagesAndRoles=wc.prototype.cl,wc.prototype.getAudioLanguagesAndRoles=wc.prototype.vk,wc.prototype.getVideoTracks=wc.prototype.getVideoTracks,wc.prototype.selectVideoTrack=wc.prototype.Cj,wc.prototype.getAudioTracks=wc.prototype.getAudioTracks,wc.prototype.selectAudioTrack=wc.prototype.Bj,wc.prototype.selectVariantTrack=wc.prototype.Ae,wc.prototype.selectTextTrack=wc.prototype.dg,wc.prototype.getThumbnails=wc.prototype.Vi,wc.prototype.getAllThumbnails=wc.prototype.rk,wc.prototype.getImageTracks=wc.prototype.mh,wc.prototype.getTextTracks=wc.prototype.sc,wc.prototype.getVariantTracks=wc.prototype.qb,wc.prototype.cancelTrickPlay=wc.prototype.xd,wc.prototype.trickPlay=wc.prototype.Uc,wc.prototype.useTrickPlayTrackIfAvailable=wc.prototype.si,wc.prototype.getPlaybackRate=wc.prototype.Xa,wc.prototype.isBuffering=wc.prototype.zf,wc.prototype.getKeyStatuses=wc.prototype.qf,wc.prototype.getActiveSessionsMetadata=wc.prototype.jh,wc.prototype.getExpiration=wc.prototype.fe,wc.prototype.drmInfo=wc.prototype.drmInfo,wc.prototype.keySystem=wc.prototype.keySystem,wc.prototype.isFullyLoaded=wc.prototype.xl,wc.prototype.goToLive=wc.prototype.rl,wc.prototype.seekRange=wc.prototype.xa,wc.prototype.isVideoOnly=wc.prototype.Dh,wc.prototype.isAudioOnly=wc.prototype.Fd,wc.prototype.isInProgress=wc.prototype.hd,wc.prototype.isLive=wc.prototype.T,wc.prototype.getQueueManager=wc.prototype.qh,wc.prototype.getAdManager=wc.prototype.pf,wc.prototype.getAssetUri=wc.prototype.cd,wc.prototype.getNetworkingEngine=wc.prototype.Jb,wc.prototype.getMediaElement=wc.prototype.Tk,wc.prototype.getManifestType=wc.prototype.oh,wc.prototype.getLoadMode=wc.prototype.Mk,wc.prototype.resetConfiguration=wc.prototype.vj,wc.prototype.getBufferFullness=wc.prototype.Ri,wc.prototype.getNonDefaultConfiguration=wc.prototype.Ui,wc.prototype.getConfigurationForLowLatency=wc.prototype.Ck,wc.prototype.getConfiguration=wc.prototype.getConfiguration,wc.prototype.configurationForLowLatency=wc.prototype.nk,wc.prototype.configure=wc.prototype.configure,wc.prototype.releaseAllMutexes=wc.prototype.Xl,wc.prototype.destroyAllPreloads=wc.prototype.Tg,wc.prototype.preload=wc.prototype.preload,wc.prototype.detachAndSavePreload=wc.prototype.Ni,wc.prototype.unloadAndSavePreload=wc.prototype.qm,wc.prototype.load=wc.prototype.load,wc.prototype.updateStartTime=wc.prototype.um,wc.prototype.unload=wc.prototype.nc,wc.prototype.detach=wc.prototype.detach,wc.prototype.attachCanvas=wc.prototype.Bi,wc.prototype.attach=wc.prototype.bc,wc.probeSupport=function(t){var n,i,r,a,o;return t=void 0===t||t,L(function(s){switch(s.g){case 1:if(n={},!t){s.A(2);break}return _(s,function(){var t,n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M,P,D,R,N,O,U,B,F,j,G;return L(function(H){if(1==H.g){if(t="org.w3.clearkey com.widevine.alpha com.widevine.alpha.experiment com.microsoft.playready com.microsoft.playready.hardware com.microsoft.playready.recommendation com.microsoft.playready.recommendation.3000 com.microsoft.playready.recommendation.3000.clearlead com.chromecast.playready com.apple.fps.1_0 com.apple.fps com.huawei.wiseplay".split(" "),!(e.MediaKeys&&e.navigator&&e.navigator.requestMediaKeySystemAccess&&e.MediaKeySystemAccess&&e.MediaKeySystemAccess.prototype.getConfiguration)){for(n={},i=l(t),r=i.next();!r.done;r=i.next())a=r.value,n[a]=null;return H.return(n)}for(o="1.0 1.1 1.2 1.3 1.4 2.0 2.1 2.2 2.3".split(" "),u={"com.widevine.alpha":s=["SW_SECURE_CRYPTO","SW_SECURE_DECODE","HW_SECURE_CRYPTO","HW_SECURE_DECODE","HW_SECURE_ALL"],"com.widevine.alpha.experiment":s,"com.microsoft.playready.recommendation":["150","2000","3000"]},d={videoCapabilities:h=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],audioCapabilities:c=[{contentType:'audio/mp4; codecs="mp4a.40.2"'},{contentType:'audio/webm; codecs="opus"'}],initDataTypes:["cenc","sinf","skd","keyids"]},p=[null,"cenc","cbcs"],f=new Map,g=Me(),m=function(e,t){var n,i,r,a,s,u,h,c,d,p,m,v,y;return L(function(b){switch(b.g){case 1:return S(b,2),_(b,t.createMediaKeys(),5);case 5:n=b.h;case 4:A(b,3);break;case 2:return E(b),b.return();case 3:if(r=!!(i=t.getConfiguration().sessionTypes)&&i.includes("persistent-license"),g.ij()&&(r=!1),a=t.getConfiguration().videoCapabilities,s=t.getConfiguration().audioCapabilities,u={persistentState:r,encryptionSchemes:[],videoRobustnessLevels:[],audioRobustnessLevels:[],minHdcpVersions:[]},f.has(e)&&f.get(e)?u=f.get(e):f.set(e,u),(h=a[0].encryptionScheme)&&!u.encryptionSchemes.includes(h)&&u.encryptionSchemes.push(h),(c=a[0].robustness)&&!u.videoRobustnessLevels.includes(c)&&u.videoRobustnessLevels.push(c),(d=s[0].robustness)&&!u.audioRobustnessLevels.includes(d)&&u.audioRobustnessLevels.push(d),"getStatusForPolicy"in n){for(p=[],m=l(o),v=m.next(),y={};!v.done;y={ke:void 0},v=m.next())y.ke=v.value,u.minHdcpVersions.includes(y.ke)||p.push(n.getStatusForPolicy({minHdcpVersion:y.ke}).then(function(e){return function(t){"usable"!=t||u.minHdcpVersions.includes(e.ke)||u.minHdcpVersions.push(e.ke)}}(y)));return _(b,Promise.all(p),0)}b.A(0)}})},v=function(e,t,n,i){var r,a,o,s,u,h,c,p,f,g;return L(function(v){switch(v.g){case 1:for(S(v,2),r=hn(d),a=l(r.videoCapabilities),o=a.next();!o.done;o=a.next())(s=o.value).encryptionScheme=t,s.robustness=n;for(u=l(r.audioCapabilities),h=u.next();!h.done;h=u.next())(c=h.value).encryptionScheme=t,c.robustness=i;return(p=hn(r)).persistentState="required",p.sessionTypes=["persistent-license"],f=[p,r],"MOBILE"==Me().Ja()?_(v,qi(5,navigator.requestMediaKeySystemAccess(e,f)),7):_(v,navigator.requestMediaKeySystemAccess(e,f),6);case 6:g=v.h,v.A(5);break;case 7:g=v.h;case 5:return _(v,m(e,g),8);case 8:A(v,0);break;case 2:E(v),w(v)}})},y=function(e,t,n,i){var r,a,o;return L(function(s){switch(s.g){case 1:return S(s,2),r={type:"media-source",video:{contentType:h[0].contentType,width:640,height:480,bitrate:1,framerate:1},audio:{contentType:c[0].contentType,channels:2,bitrate:1,samplerate:1},keySystemConfiguration:{keySystem:e,video:{encryptionScheme:t,robustness:n},audio:{encryptionScheme:t,robustness:i}}},"MOBILE"==Me().Ja()?_(s,qi(5,navigator.mediaCapabilities.decodingInfo(r)),7):_(s,navigator.mediaCapabilities.decodingInfo(r),6);case 6:a=s.h,s.A(5);break;case 7:a=s.h;case 5:return o=a.keySystemAccess,_(s,m(e,o),8);case 8:A(s,0);break;case 2:E(s),w(s)}})},b=l(t),T=b.next();!T.done;T=b.next())x=T.value,f.set(x,null);for(C=function(e){return"WEBKIT"!==Me().Fa()||"org.w3.clearkey"!==e},k=[],I=l(p),M=I.next();!M.done;M=I.next())for(P=M.value,D=l(t),R=D.next();!R.done;R=D.next())N=R.value,C(N)&&(k.push(v(N,P,"","")),k.push(y(N,P,"","")));for(O=l(t),U=O.next();!U.done;U=O.next())for(B=U.value,F=l(u[B]||[]),j=F.next();!j.done;j=F.next())G=j.value,C(B)&&(k.push(v(B,null,G,"")),k.push(v(B,null,"",G)),k.push(y(B,null,G,"")),k.push(y(B,null,"",G)));return _(H,Promise.all(k),2)}return H.return(sa(f))})}(),3);case 3:n=s.h;case 2:return i=function(){var e={};if(Me(),pv())for(var t=l(lo.keys()),n=t.next();!n.done;n=t.next())e[n.value]=!0;for(n=(t=l(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"])).next();!n.done;n=t.next())e[n=n.value]=pv()?lo.has(n):""!=ds().canPlayType(n);return e}(),r=function(){var e='video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",video/mp4; codecs="dvh1.05.01",video/mp4; codecs="dvh1.20.01",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="ac-4.02.01.01",audio/mp4; codecs="opus",audio/mp4; codecs="flac",audio/mp4; codecs="dtsc",audio/mp4; codecs="dtse",audio/mp4; codecs="dtsx",audio/mp4; codecs="apac.31.00",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").concat(h(Oi)),t={};Me();for(var n=(e=l(e)).next();!n.done;n=e.next()){ji(n=n.value)?t[n]=!0:t[n]=pv()?Ot(n)||!!bi(n):""!=ds().canPlayType(n);var i=n.split(";")[0];t[i]=t[i]||t[n]}return t}(),_(s,Me().qc(),4);case 4:return a=s.h,o={manifest:i,media:r,drm:n,hardwareResolution:a},Id.forEach(function(e,t){o[t]=e()}),s.return(o)}})},wc.isBrowserSupported=Ec,wc.setQueueManagerFactory=function(e){Pd=e},wc.setAdManagerFactory=function(e){Md=e},wc.registerSupportPlugin=Ac,wc.prototype.destroy=wc.prototype.destroy;var Ad=0,Ed=1,xd=2,Cd=3;wc.LoadMode={DESTROYED:Ad,NOT_LOADED:Ed,MEDIA_SOURCE:xd,SRC_EQUALS:Cd},wc.version="v4.15.8";var kd=["4","15"];Pt=new function(e){this.g=e,this.i=It,this.h=Mt}(new Ct(Number(kd[0]),Number(kd[1])));var Id=new Map,Md=null,Pd=null;function Ld(){this.g=[],this.i=this.m=this.l=this.j=this.h=0}function Dd(e){return e.g.length?e.g.reduce(function(e,t){return e+t},0)/e.g.length:0}function Rd(e,t,n){var i=this;this.g=e,this.h=t,this.m=n,this.i=!1,this.j=this.h.getVolume(),this.l=new At,this.l.o(this.h,google.ima.AdEvent.Type.PAUSED,function(){i.i=!0}),this.l.o(this.h,google.ima.AdEvent.Type.RESUMED,function(){i.i=!1})}function Nd(){}function Od(e,t){for(var n=[],i=(e=l(yn(e,"Ad"))).next();!i.done;i=e.next())if((i=Sn(i.value,"InLine"))&&(i=Sn(i,"Creatives")))for(var r=(i=l(yn(i,"Creative"))).next();!r.done;r=i.next()){var a=Sn(r=r.value,"Linear");if(a&&Ud(n,t,a),r=Sn(r,"NonLinearAds"))for(var o=(r=l(r=yn(r,"NonLinear"))).next();!o.done;o=r.next())e:{a=n;var s=t,u=o.value,h=Sn(u,"StaticResource");if(h)o=h.attributes.creativeType;else{if(!(h=Sn(u,"HTMLResource")))break e;o="text/html"}if(h=_n(h)){"text/html"===o&&(h="data:text/html;charset=UTF-8,"+encodeURIComponent(h));var c=An(u,"width",Pn)||An(u,"expandedWidth",Pn),d=An(u,"height",Pn)||An(u,"expandedHeight",Pn);if(c||d){var p=null;(u=u.attributes.minSuggestedDuration)&&(p=sn(u)),u=0,null!=s&&(u=s),a.push({id:null,groupId:null,startTime:u,endTime:null,uri:h,mimeType:o,isSkippable:!1,skipOffset:null,skipFor:null,canJump:!1,resumeOffset:0,playoutLimit:p,once:!0,pre:null==s,post:1/0==s,timelineRange:!1,loop:!1,overlay:{viewport:{x:0,y:0},topLeft:{x:0,y:0},size:{x:c||0,y:d||0}},displayOnBackground:!1,currentVideo:null,background:null})}}}}return n}function Ud(e,t,n){var i=0;null!=t&&(i=t);var r=null;if(n.attributes.skipoffset&&(r=sn(n.attributes.skipoffset),isNaN(r)&&(r=null)),n=Sn(n,"MediaFiles")){var a=yn(n,"MediaFile");for(n=a,(a=a.filter(function(e){return"streaming"==e.attributes.delivery})).length&&(n=a),n=n.sort(function(e,t){return(parseInt(t.attributes.height,10)||0)-(parseInt(e.attributes.height,10)||0)}),a=(n=l(n)).next();!a.done;a=n.next())if(!(a=a.value).attributes.apiFramework){var o=_n(a);if(o){e.push({id:null,groupId:null,startTime:i,endTime:null,uri:o,mimeType:a.attributes.type||null,isSkippable:null!=r,skipOffset:r,skipFor:null,canJump:!1,resumeOffset:0,playoutLimit:null,once:!0,pre:null==t,post:1/0==t,timelineRange:!1,loop:!1,overlay:null,displayOnBackground:!1,currentVideo:null,background:null});break}}}}function Bd(t,n,i,r,a){var o=this;this.u=t,this.i=n,this.F=!1,this.B=this.s=null,this.G=NaN,this.l=a,this.j=null,this.h=new At,google.ima.settings.setLocale(i),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0),this.D=new google.ima.AdDisplayContainer(this.u,this.i),this.D.initialize(),this.m=new google.ima.AdsLoader(this.D),this.m.getSettings().setPlayerType("shaka-player"),this.m.getSettings().setPlayerVersion("v4.15.8"),this.g=null,this.C=r||new google.ima.AdsRenderingSettings,this.h.o(this.m,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,function(t){!function(t,n){if(t.l(new V("ads-loaded",(new Map).set("loadTime",Date.now()/1e3-t.G))),t.s.customPlayheadTracker){var i={currentTime:t.i.currentTime};t.g=n.getAdsManager(i,t.C),t.i.muted?t.g.setVolume(0):t.g.setVolume(t.i.volume),t.h.o(t.i,"timeupdate",function(){t.i.duration&&(i.currentTime=t.i.currentTime)}),t.h.o(t.i,"volumechange",function(){t.j&&(t.j.setVolume(t.i.volume),t.i.muted&&t.j.setMuted(!0))})}else t.g=n.getAdsManager(t.i,t.C);t.l(new V("ima-ad-manager-loaded",(new Map).set("imaAdManager",t.g)));var r=t.g.getCuePoints();if(r.length){n=[];for(var a=(r=l(r)).next();!a.done;a=r.next())n.push({start:a.value,end:null});t.l(new V("ad-cue-points-changed",(new Map).set("cuepoints",n)))}!function(e){function t(t,n){t=(new Map).set("originalEvent",t),e.l(new V(n,t))}e.h.o(e.g,google.ima.AdErrorEvent.Type.AD_ERROR,function(t){Fd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,function(t){jd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.STARTED,function(t){jd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.FIRST_QUARTILE,function(e){t(e,"ad-first-quartile")}),e.h.o(e.g,google.ima.AdEvent.Type.MIDPOINT,function(e){t(e,"ad-midpoint")}),e.h.o(e.g,google.ima.AdEvent.Type.THIRD_QUARTILE,function(e){t(e,"ad-third-quartile")}),e.h.o(e.g,google.ima.AdEvent.Type.COMPLETE,function(e){t(e,"ad-complete")}),e.h.o(e.g,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,function(t){Gd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(t){Gd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.SKIPPED,function(e){t(e,"ad-skipped")}),e.h.o(e.g,google.ima.AdEvent.Type.VOLUME_CHANGED,function(e){t(e,"ad-volume-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.VOLUME_MUTED,function(e){t(e,"ad-muted")}),e.h.o(e.g,google.ima.AdEvent.Type.PAUSED,function(n){e.j&&(e.j.i=!0,t(n,"ad-paused"))}),e.h.o(e.g,google.ima.AdEvent.Type.RESUMED,function(n){e.j&&(e.j.i=!1,t(n,"ad-resumed"))}),e.h.o(e.g,google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,function(n){e.j&&t(n,"ad-skip-state-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.CLICK,function(e){t(e,"ad-clicked")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_PROGRESS,function(e){t(e,"ad-progress")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_BUFFERING,function(e){t(e,"ad-buffering")}),e.h.o(e.g,google.ima.AdEvent.Type.IMPRESSION,function(e){t(e,"ad-impression")}),e.h.o(e.g,google.ima.AdEvent.Type.DURATION_CHANGE,function(e){t(e,"ad-duration-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.USER_CLOSE,function(e){t(e,"ad-closed")}),e.h.o(e.g,google.ima.AdEvent.Type.LOADED,function(e){t(e,"ad-loaded")}),e.h.o(e.g,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(e){t(e,"all-ads-completed")}),e.h.o(e.g,google.ima.AdEvent.Type.LINEAR_CHANGED,function(e){t(e,"ad-linear-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_METADATA,function(e){t(e,"ad-metadata")}),e.h.o(e.g,google.ima.AdEvent.Type.LOG,function(e){t(e,"ad-recoverable-error")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_BREAK_READY,function(e){t(e,"ad-break-ready")}),e.h.o(e.g,google.ima.AdEvent.Type.INTERACTION,function(e){t(e,"ad-interaction")})}(t);try{t.g.init(t.i.offsetWidth,t.i.offsetHeight),t.h.o(t.i,"loadeddata",function(){t.g.resize(t.i.offsetWidth,t.i.offsetHeight)}),"ResizeObserver"in e?(t.B=new ResizeObserver(function(){t.g.resize(t.i.offsetWidth,t.i.offsetHeight)}),t.B.observe(t.i)):t.h.o(document,"fullscreenchange",function(){t.g.resize(t.i.offsetWidth,t.i.offsetHeight)}),t.F||t.s.skipPlayDetection?t.g.start():t.h.ra(t.i,"play",function(){t.F=!0,t.g.start()})}catch(e){Gd(t,null)}}(o,t)}),this.h.o(this.m,google.ima.AdErrorEvent.Type.AD_ERROR,function(e){Fd(o,e)}),this.h.o(this.i,"ended",function(){o.m.contentComplete()}),this.h.ra(this.i,"play",function(){o.F=!0})}function Fd(e,t){t.getError(),t=(new Map).set("originalEvent",t),e.l(new V("ad-error",t)),Gd(e,null),e.l(new V("ad-cue-points-changed",(new Map).set("cuepoints",[])))}function jd(e,t){var n=t.getAd();n?(e.j=new Rd(n,e.g,e.i),t.type!=google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED||e.s.supportsMultipleMediaElements||e.l(new V("ad-content-pause-requested")),t=(new Map).set("ad",e.j).set("sdkAdObject",n).set("originalEvent",t),e.l(new V("ad-started",t)),e.j.isLinear()&&(e.u.setAttribute("ad-active","true"),e.s.customPlayheadTracker||e.i.pause(),e.i.muted?((t=e.j).j=e.i.volume,t.h.setVolume(0)):e.j.setVolume(e.i.volume))):Y("The IMA SDK fired a "+t.type+" event with no associated ad. Unable to play ad!")}function Gd(e,t){t&&t.type==google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED&&!e.s.supportsMultipleMediaElements&&e.l(new V("ad-content-resume-requested")),e.l(new V("ad-stopped",(new Map).set("originalEvent",t))),e.j&&e.j.isLinear()&&(e.u.removeAttribute("ad-active"),e.s.customPlayheadTracker||e.i.ended||e.i.play())}function Hd(e,t,n,i,r,a){this.g=e,this.i=t,this.j=(this.h=t.isSkippable)?t.skipOffset||0:t.skipOffset,this.l=t.skipFor,this.B=n,this.s=i,this.m=r,this.u=a,this.C=t.overlay}function Vd(e,t,n){this.g=e,this.j=t,this.h=n,this.i=null==e.overlay}function Wd(e,t,n,i){var r=this;this.L=null,this.C=e,this.D=t,this.g=n,this.G=null,this.B=!0,this.h=this.g,this.i=i,this.R=new Set,this.H=new Set,this.F=new Map,this.K=new Map,this.j=new wc,$d(this),this.I=new At,this.l=new At,this.J=!1,this.Z=this.s=this.u=this.m=null,this.$=!1,this.O=-1,this.Y=function(){if(!r.J&&r.m&&!r.D.Ca()){r.m=r.g.currentTime;var e=Yd(r);e&&qd(r,e,1,1,Date.now())}},this.U=function(){if(!(r.J||r.m||r.D.Ca())){r.m=r.g.currentTime;var e=Yd(r,!0);e&&qd(r,e,1,1,Date.now())}},this.ba=function(){if(!r.J&&r.m&&!r.D.Ca()){var e=r.g.currentTime;r.u&&!r.u.pre&&!r.u.post&&e<(r.u.endTime||r.u.startTime)&&(r.u=null)}},this.P=new zi(this.Y),this.N=new zi(function(){var e,t,n,i,a,o,s,u,h,c,d;return L(function(p){switch(p.g){case 1:if(!r.H.size||null==r.m){p.A(0);break}if((e=r.D.m)==Ad||e==Ed)return p.return();t=!1,n=Array.from(r.H),i=r.D.xa(),a=l(n),o=a.next();case 3:if(o.done){p.A(5);break}if((s=o.value)==r.u){p.A(4);break}if(u=s.endTime||s.startTime,!(1<=i.start-u)){0<(h=s.startTime-r.m)&&10>=h&&(!r.F.has(s)&&tp(s)&&r.F.set(s,r.j.preload(s.uri,null,s.mimeType||void 0)),ip(r,s)),p.A(4);break}if(!r.F.has(s)){p.A(7);break}return _(p,r.F.get(s),8);case 8:(c=p.h)&&c.destroy(),r.F.delete(s);case 7:rp(r,s),d=JSON.stringify(s),r.R.has(d)&&r.R.delete(d),r.H.delete(s),zd(r),s.overlay||(t=!0);case 4:o=a.next(),p.A(3);break;case 5:t&&Qd(r),w(p)}})}),this.configure(this.D.getConfiguration().ads)}function zd(e){e.$&&!e.H.size&&(e.I.Da(e.g,"playing",e.U),e.I.Da(e.g,"timeupdate",e.U),e.I.Da(e.g,"seeked",e.ba),e.I.Da(e.g,"ended",e.Y),-1!=e.O&&(e.g.cancelVideoFrameCallback(e.O),e.O=-1),e.P&&e.P.stop(),e.N&&e.N.stop(),e.$=!1)}function Kd(e){if(e.C&&e.L&&!e.J){var t=e.L.supportsMultipleMediaElements,n=e.g;n.webkitPresentationMode&&"inline"!==n.webkitPresentationMode&&(t=!1),e.B==t&&(e.B=!t,e.B?(e.h=e.g,e.G&&(e.G.parentElement&&e.C.removeChild(e.G),e.G=null)):(e.G||((t=document.createElement(e.g.tagName)).autoplay=!0,t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.display="none",t.setAttribute("playsinline",""),e.G=t),e.h=e.G))}else e.B=!0}function Xd(e,t){var n,i,r,a,o,s,u,h;L(function(c){switch(c.g){case 1:n=!1,i=l(t),r=i.next();case 2:if(r.done){c.A(4);break}if(!(a=r.value).uri){Y("Missing URL in interstitial",a),c.A(3);break}if(a.mimeType){c.A(5);break}return S(c,6),o=e.j.Jb(),_(c,Ch(a.uri,o,e.D.getConfiguration().streaming.retryParameters),8);case 8:a.mimeType=c.h,A(c,5);break;case 6:E(c);case 5:if(s=a.id||JSON.stringify(a),e.R.has(s)){c.A(3);break}a.loop&&!a.overlay&&Y("Loop is only supported in overlay interstitials",a),a.overlay||(n=!0),e.R.add(s),e.H.add(a),u=!1,a.pre&&null==e.m?u=!0:0!=a.startTime||a.canJump?null!=e.m&&0<(h=a.startTime-e.m)&&10>=h&&(u=!0):u=!0,u&&(!e.F.has(a)&&tp(a)&&e.F.set(a,e.j.preload(a.uri,null,a.mimeType||void 0)),ip(e,a));case 3:r=i.next(),c.A(2);break;case 4:n&&Qd(e),function(e){if(!e.$&&e.H.size){if(e.I.o(e.g,"playing",e.U),e.I.o(e.g,"timeupdate",e.U),e.I.o(e.g,"seeked",e.ba),e.I.o(e.g,"ended",e.Y),"requestVideoFrameCallback"in e.g&&!np()){var t=e.g,n=function(){-1!=e.O&&(e.Y(),-1!=e.O&&(e.O=t.requestVideoFrameCallback(n)))};e.O=t.requestVideoFrameCallback(n)}else e.P.ya(.025);e.N&&e.N.ya(1),e.$=!0}}(e),w(c)}})}function Yd(e,t,n){t=void 0!==t&&t,n=void 0===n?null:n;var i=0,r=null;if(e.H.size&&null!=e.m){var a=e.g.ended,o=Array.from(e.H).sort(function(e,t){return t.startTime-e.startTime}),s=o;for(s=t?o.filter(function(e){return e.pre}):a?o.filter(function(e){return e.post}):o.filter(function(e){return!e.pre&&!e.post}),s=(o=l(s)).next();!s.done;s=o.next()){s=s.value;var u=!1;if(t)u=s.pre;else if(a)u=s.post;else if(!s.pre&&!s.post){var h=e.m-Math.round(1e3*s.startTime)/1e3,c=1;e.L.allowStartInMiddleOfInterstitial&&s.endTime&&1/0!=s.endTime&&(c=s.endTime-s.startTime),0=s.startTime))}u&&(!e.u||s.startTime>=e.u.startTime)&&(i==(n||0)?r=s:r&&!s.canJump&&.001Math.abs(e.startTime-t.startTime)}).length),t.once&&(a++,e.H.delete(t),zd(e),t.overlay||Qd(e)),t.mimeType&&(t.mimeType.startsWith("image/")||"text/html"===t.mimeType)?t.overlay?function(e,t,n,i,r){function a(){e.s&&(e.s.stop(),e.s=null),e.C.removeChild(u),Jd(e,t),e.i(new V("ad-stopped")),e.l.Sa();var a=Yd(e,t.pre,i-r);a?qd(e,a,n,++i,Date.now(),r):e.J=!1}e.J=!0;var o=t.overlay,s="text/html"==t.mimeType?"iframe":"img",u=document.createElement(s);u.style.objectFit="contain",u.style.position="absolute",u.style.border="none",Zd(e,t),e.i(new V("ad-started",(new Map).set("ad",new Vd(t,n,i)))),"iframe"==s?u.src=t.uri:(u.src=t.uri,u.onerror=function(t){e.i(new V("ad-error",(new Map).set("originalEvent",t))),a()});var l=o.viewport,h=o.topLeft;o=o.size,0==l.x&&0==l.y?(u.width=t.overlay.size.x,u.height=t.overlay.size.y,u.style.bottom="10%",u.style.left="0",u.style.right="0",u.style.width="100%",t.overlay.size.y||"iframe"!=s||(u.style.height="auto")):(u.style.height=o.y/l.y*100+"%",u.style.left=h.x/l.x*100+"%",u.style.top=h.y/l.y*100+"%",u.style.width=o.x/l.x*100+"%"),e.C.appendChild(u);var c=Date.now();e.s&&e.s.stop(),e.s=new zi(function(){t.playoutLimit&&(Date.now()-c)/1e3>t.playoutLimit||t.endTime&&e.g.currentTime>t.endTime?(e.i(new V("ad-complete")),a()):e.g.currentTimet.endTime)&&(e.s&&e.s.stop(),e.i(new V("ad-skipped")),a())})}(e,t,n,i,a):Y("Unsupported interstitial",t):e.B&&t.overlay?Y("Unsupported interstitial",t):function(e,t,n,i,r,a){var o,s,u,l,h,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M;L(function(P){switch(P.g){case 1:if(o=Date.now(),e.J=!0,s=!1,u=function(){if(!e.B&&!t.overlay&&null==t.resumeOffset)if(t.timelineRange&&t.endTime&&1/0!=t.endTime)e.g.currentTime!=t.endTime&&(e.g.currentTime=t.endTime);else{var n=Date.now();e.g.currentTime+=(n-r)/1e3,r=n}},l=function(o){var s,l;return L(function(h){if(1==h.g){if(u(),s=Yd(e,t.pre,i-a),o&&t.groupId)for(;s&&s.groupId==t.groupId;)i++,s=Yd(e,t.pre,i-a);return e.s&&(!t.groupId||s&&s.groupId!=t.groupId)&&(e.s.stop(),e.s=null),Jd(e,t),s&&!s.overlay?h.A(2):(t.post&&(e.m=null,e.u=null),e.B?_(h,e.j.detach(),4):_(h,e.j.nc(),4))}2!=h.g&&(e.B&&(null==(l=t.resumeOffset)&&(l=t.timelineRange&&t.endTime&&1/0!=t.endTime?t.endTime-(e.m||0):(Date.now()-r)/1e3),e.i(new V("ad-content-resume-requested",(new Map).set("offset",l)))),e.i(new V("ad-stopped")),e.l.Sa(),e.J=!1,e.B?Qd(e):(e.h.style.display="none",u(),e.g.ended||e.g.play())),Kd(e),s&&(e.i(new V("ad-stopped")),e.l.Sa(),qd(e,s,n,++i,r,a)),w(h)})},h=function(t){return L(function(n){return s?n.return():(s=!0,e.i(new V("ad-error",(new Map).set("originalEvent",t))),_(n,l(!1),0))})},c=function(){return L(function(t){if(1==t.g)return s?t.return():(s=!0,_(t,l(!1),2));e.i(new V("ad-complete")),w(t)})},e.Z=function(){return L(function(t){return s?t.return():(s=!0,e.i(new V("ad-skipped")),_(t,l(!0),0))})},d=new Hd(e.h,t,e.Z,n,i,!e.B),e.B||(d.setMuted(e.g.muted),d.setVolume(e.g.volume)),e.i(new V("ad-started",(new Map).set("ad",d))),(p=d.canSkipNow())&&e.i(new V("ad-skip-state-changed")),e.l.ra(e.j,"error",h),e.l.o(e.h,"timeupdate",function(){if(e.h.duration){var t=d.canSkipNow();p!=t&&0=t.playRangeEnd?c():e.i(new V("ad-paused"))}),e.l.o(e.h,"volumechange",function(){e.h.muted?e.i(new V("ad-muted")):e.i(new V("ad-volume-changed"))}),!e.B||1!=i){P.A(2);break}return e.i(new V("ad-content-pause-requested",(new Map).set("saveLivePosition",!0))),f=new Br,g=function(t){return L(function(n){if(1==n.g)return"detach"!=t.state?n.A(0):np()?_(n,new Promise(function(e){return new zi(e).X(.1)}),3):n.A(3);f.resolve(),e.l.Da(e.D,"onstatechange",g),w(n)})},e.l.o(e.D,"onstatechange",g),_(P,f,2);case 2:return Zd(e,t),e.B||(e.h.style.display="",t.overlay?(e.h.loop=t.loop,m=t.overlay.viewport,v=t.overlay.topLeft,y=t.overlay.size,e.h.style.height=y.y/m.y*100+"%",e.h.style.left=v.x/m.x*100+"%",e.h.style.top=v.y/m.y*100+"%",e.h.style.width=y.x/m.x*100+"%"):(e.g.pause(),null!=t.resumeOffset&&0!=t.resumeOffset&&(e.g.currentTime+=t.resumeOffset),e.h.loop=!1,e.h.style.height="100%",e.h.style.left="0",e.h.style.top="0",e.h.style.width="100%")),S(P,4),$d(e),t.startTime&&t.endTime&&1/0!=t.endTime&&t.startTime!=t.endTime&&0<(b=t.endTime-t.startTime)&&e.j.configure("playRangeEnd",b),t.playoutLimit&&!e.s&&(e.s=new zi(function(){e.Z()}).X(t.playoutLimit),e.j.configure("playRangeEnd",t.playoutLimit)),_(P,e.j.bc(e.h),6);case 6:return T=null,e.L.allowStartInMiddleOfInterstitial&&null!=e.m&&(x=e.m-t.startTime,.25t.endTime)&&e.Z()})),A(P,0);break;case 4:if(M=E(P),!e.J)return P.return();h(M),w(P)}})}(e,t,n,i,r,a)}function Zd(e,t){if(t.displayOnBackground&&(e.g.style.zIndex="1"),null!=t.currentVideo){var n=t.currentVideo;e.g.style.transformOrigin="top left";var i=!0,r=[],a=n.topLeft.x/n.viewport.x*100;0=a&&(r.push("translateX("+a+"%)"),i=!1),0<(a=n.topLeft.y/n.viewport.y*100)&&100>=a&&(r.push("translateY("+a+"%)"),i=!1),1>(a=n.size.x/n.viewport.x)&&r.push("scaleX("+a+")"),n=n.size.y/n.viewport.y,1>a&&r.push("scaleY("+n+")"),r.length&&(e.g.style.transform=r.join(" ")),i&&(e.g.style.transition="transform 250ms")}e.C&&(e.C.style.pointerEvents="none",t.background&&(e.C.style.background=t.background)),e.G&&(e.G.style.background=t.overlay?"":"rgb(0, 0, 0)")}function Jd(e,t){t&&!t.displayOnBackground||(e.g.style.zIndex=""),t&&null==t.currentVideo||(e.g.style.transformOrigin="",e.g.style.transition="",e.g.style.transform=""),e.C&&(e.C.style.pointerEvents="",!t||t.background)&&(e.C.style.background=""),e.G&&(e.G.style.background="")}function Qd(e){for(var t=[],n=l(e.H),i=n.next(),r={};!i.done;r={Dc:void 0},i=n.next())(i=i.value).overlay||(r.Dc={start:i.startTime,end:null},i.pre?(r.Dc.start=0,r.Dc.end=null):i.post?(r.Dc.start=-1,r.Dc.end=null):i.timelineRange&&(r.Dc.end=i.endTime),t.find(function(e){return function(t){return e.Dc.start==t.start&&e.Dc.end==t.end}}(r))||t.push(r.Dc));e.i(new V("ad-cue-points-changed",(new Map).set("cuepoints",t)))}function $d(e){e.j.configure(e.D.Ui()),e.j.configure("ads.disableHLSInterstitial",!0),e.j.configure("ads.disableDASHInterstitial",!0),e.j.configure("playRangeEnd",1/0),qr(e.D.Jb(),e.j.Jb())}function ep(e,t,n){var i,r;return L(function(a){return 1==a.g?(i=Zr([t],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}),_(a,e.D.Jb().request(7,i,n).promise,2)):(r=a.h,a.return(r.data))})}function tp(e){return!(e=e.mimeType)||!e.startsWith("image/")&&"text/html"!==e}function np(){var e=Me().Ja();return"TV"==e||"CONSOLE"==e||"CAST"==e}function ip(e,t){if(!(e.K.has(t)||e.L&&!e.L.allowPreloadOnDomElements)){var n=function(e){var t=document.createElement("link");return t.rel="preload",t.href=e,t.as="image",document.head.appendChild(t),t},i=[];if(t.background){var r=t.background.match(/url\(('|")?([^'"()]+)('|")\)?/);r&&i.push(n(r[2]))}t.mimeType.startsWith("image/")&&i.push(n(t.uri)),e.K.set(t,i)}}function rp(e,t){if(e.K.has(t)){for(var n=e.K.get(t),i=(n=l(n)).next();!i.done;i=n.next())(i=i.value).parentNode.removeChild(i);e.K.delete(t)}}function ap(e,t,n,i,r){this.h=e,this.j=sn(this.h.skipOffset),this.g=r,this.i=t,this.l=n,this.s=i,this.m=!1}function op(e,t,n,i){this.C=e,this.J=t,this.h=n,this.l=null,this.O=NaN,this.i=i,this.I=!1,this.B=null,this.j=[],this.L=[],this.K=this.D=this.g=null,this.F=new Map,this.m=[],this.u=[],this.G="",this.N=!0,this.H="",this.s=new At}function sp(e,t){var n,i,r,a,o,s,u,l;L(function(h){return 1==h.g?t.staticResource?(n=up(t),e.F.get(n)?h.return():(i={type:9},r=Zr([t.staticResource],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}),a=e.J.request(7,r,i),S(h,2),e.F.set(n,[]),_(h,a.promise,4))):h.return():2!=h.g?(o=h.h,s=Ne(o.data),u=JSON.parse(s),l=u.apps,e.F.set(n,l),A(h,0)):(E(h),e.F.delete(n),void w(h))})}function up(e){return[e.adId,e.adParameters,e.adSystem,e.adTitle,e.creativeAdId,e.creativeId,e.creativeSequence,e.height,e.width,e.staticResource].join("")}function lp(e){var t=e.h.currentTime;if(0!=t&&null==e.B){for(var n,i,r=l(e.j),a=r.next();!a.done;a=r.next())for(var o=l((a=a.value).ads),s=o.next();!s.done;s=o.next())if(s=s.value,i){if(s.startTimeInSecondsi.startTimeInSeconds+i.durationInSeconds){i=s,n=a;break}}else s.startTimeInSeconds=i.startTimeInSeconds+.25*i.durationInSeconds&&!e.u.includes("firstQuartile")?(e.u.push("firstQuartile"),pp(e,"firstQuartile")):t>=r&&!e.u.includes("midpoint")?(e.u.push("midpoint"),pp(e,"midpoint")):t>=a&&!e.u.includes("thirdQuartile")&&(e.u.push("thirdQuartile"),pp(e,"thirdQuartile")),i=e.g.getRemainingTime(),r=e.g.getDuration(),e.g.canSkipNow()&&0=i||i>r)&&cp(e)}if(!e.g||!e.g.isLinear()){e:for(i=l(e.j),r=i.next();!r.done&&(r=r.value,!e.g||!e.g.isLinear());r=i.next())for(a=0;at){if(e.L.includes(o.adId)){if(e.h.ended)continue;e.h.currentTime=s;break e}cp(e),e.K=r,e.g=new ap(o,a+1,r.ads.length,!0,e.h),e.D=o,0===a&&pp(e,"breakStart"),dp(e);break}}if(!e.g)for(r=(i=l(e.j)).next();!r.done&&(r=r.value,!e.g);r=i.next())for(a=0;at&&(e.h.currentTime=e.B),e.B=null)}}}function cp(e){if(e.g){for(;e.C.lastChild;)e.C.removeChild(e.C.firstChild);e.I||e.L.push(e.D.adId);var t=e.g.m;pp(e,void 0!==t&&t?"skip":"complete");for(var n=(t=l(e.m)).next();!n.done;n=t.next())n=n.value,e.s.Da(n.target,n.type,n.listener);e.m=[],e.u=[],(t=e.g.getPositionInSequence())===(n=e.g.getSequenceLength())&&pp(e,"breakEnd"),e.g=null,e.D=null,e.K=null}}function dp(e){var t=!1;e.h.paused?t=!0:(pp(e,"impression"),pp(e,"start")),e.m.push({target:e.h,type:"volumechange",listener:function(){e.h.muted&&pp(e,"mute")}}),e.m.push({target:e.h,type:"volumechange",listener:function(){e.h.muted||pp(e,"unmute")}}),e.m.push({target:e.h,type:"play",listener:function(){t?(pp(e,"impression"),pp(e,"start"),t=!1):pp(e,"resume")}}),e.m.push({target:e.h,type:"pause",listener:function(){pp(e,"pause")}});for(var n=l(e.m),i=n.next();!i.done;i=n.next())i=i.value,e.s.o(i.target,i.type,i.listener)}function pp(e,t){var n=e.D.trackingEvents.find(function(e){return e.eventType==t});if(n||(n=e.K.adBreakTrackingEvents.find(function(e){return e.eventType==t})),n)for(var i={type:10},r=(n=l(n.beaconUrls)).next();!r.done;r=n.next())(r=r.value)&&""!=r&&((r=Zr([r],Ur())).method="POST",e.J.request(7,r,i));switch(t){case"impression":e.i(new V("ad-impression"));break;case"start":e.i(new V("ad-started",(new Map).set("ad",e.g)));break;case"mute":e.i(new V("ad-muted"));break;case"unmute":e.i(new V("ad-volume-changed"));break;case"resume":e.i(new V("ad-resumed"));break;case"pause":e.i(new V("ad-paused"));break;case"firstQuartile":e.i(new V("ad-first-quartile"));break;case"midpoint":e.i(new V("ad-midpoint"));break;case"thirdQuartile":e.i(new V("ad-third-quartile"));break;case"complete":e.i(new V("ad-complete")),e.i(new V("ad-stopped"));break;case"skip":e.i(new V("ad-skipped")),e.i(new V("ad-stopped"));break;case"breakStart":e.C.setAttribute("ad-active","true");break;case"breakEnd":e.C.removeAttribute("ad-active");break;case"skipStateChanged":e.i(new V("ad-skip-state-changed"))}}function fp(e,t){this.g=e,this.i=null,this.h=t}function gp(e,t,n,i){var r=this;this.u=e,this.l=t,this.j=null,this.F=NaN,this.i=i,this.G=!1,this.B=this.m=this.s=null,this.C="",this.D=[],this.h=new At,(e=new google.ima.dai.api.UiSettings).setLocale(n),this.g=new google.ima.dai.api.StreamManager(this.l,this.u,e),this.i(new V("ima-stream-manager-loaded",(new Map).set("imaStreamManager",this.g))),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.LOADED,function(e){!function(e,t){e.i(new V("ads-loaded",(new Map).set("loadTime",Date.now()/1e3-e.F))),t=t.getStreamData().url,e.j.resolve(t),e.j=null,e.G||e.h.o(e.l,"seeked",function(){var t=e.l.currentTime;if(0!=t){e.g.streamTimeForContentTime(t);var n=e.g.previousCuePointForStreamTime(t);n&&!n.played&&(e.s=t,e.l.currentTime=n.start)}})}(r,e)}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.ERROR,function(){r.C.length?r.j.resolve(r.C):r.j.reject("IMA Stream request returned an error and there was no backup asset uri provided."),r.j=null}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,function(){}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.STARTED,function(e){e=e.getAd(),r.m=new fp(e,r.l),r.B&&(r.m.i=r.B),r.i(new V("ad-started",(new Map).set("ad",r.m))),r.u.setAttribute("ad-active","true")}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,function(){r.u.removeAttribute("ad-active");var e=r.l.currentTime;r.s&&r.s>e&&(r.l.currentTime=r.s,r.s=null)}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,function(e){r.B=e.getStreamData().adProgressData,r.m&&(r.m.i=r.B)}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.FIRST_QUARTILE,function(){r.i(new V("ad-first-quartile"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.MIDPOINT,function(){r.i(new V("ad-midpoint"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.THIRD_QUARTILE,function(){r.i(new V("ad-third-quartile"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.COMPLETE,function(){r.i(new V("ad-complete")),r.i(new V("ad-stopped")),r.u.removeAttribute("ad-active"),r.m=null}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.SKIPPED,function(){r.i(new V("ad-skipped")),r.i(new V("ad-stopped"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.CUEPOINTS_CHANGED,function(e){var t=e.getStreamData();e=[];for(var n=(t=l(t.cuepoints)).next();!n.done;n=t.next())n=n.value,e.push({start:n.start,end:n.end});r.D=e,r.i(new V("ad-cue-points-changed",(new Map).set("cuepoints",e)))})}function mp(){$.call(this),this.h=this.i=this.j=this.g=null,this.m=new Ld,this.s=navigator.language,this.l=null}function vp(e,t){if(t&&t.type)switch(t.type){case"ads-loaded":e.m.g.push(t.loadTime);break;case"ad-started":e.m.h++;var n=t.ad;n&&!n.isLinear()&&e.m.j++;break;case"ad-complete":e.m.l++;break;case"ad-skipped":e.m.m++;break;case"ad-error":e.m.i++}e.dispatchEvent(t)}function yp(e){return JSON.stringify(e,function(e,t){if("function"!=typeof t){if(t instanceof Event||t instanceof V){var n={};for(i in t)(e=t[i])&&"object"==typeof e?"detail"==i&&(n[i]=e):i in Event||(n[i]=e);return n}if(t instanceof Error){var i=new Set(["name","message","stack"]);for(n in t)i.add(n);for(e=(n=l(Object.getOwnPropertyNames(t))).next();!e.done;e=n.next())i.add(e.value);for(n={},e=(i=l(i)).next();!e.done;e=i.next())n[e=e.value]=t[e];t={__type__:"Error",contents:n}}else if(t instanceof TimeRanges){for(i={__type__:"TimeRanges",length:t.length,start:[],end:[]},n=(t=l(as(t))).next();!n.done;n=t.next())e=(n=n.value).end,i.start.push(n.start),i.end.push(e);t=i}else t=ArrayBuffer.isView(t)&&1===t.BYTES_PER_ELEMENT?{__type__:"Uint8Array",entries:Array.from(t)}:"number"==typeof t?isNaN(t)?"NaN":isFinite(t)?t:0>t?"-Infinity":"Infinity":t;return t}})}function bp(e){return JSON.parse(e,function(e,t){if("NaN"==t)var n=NaN;else if("-Infinity"==t)n=-1/0;else if("Infinity"==t)n=1/0;else if(t&&"object"==typeof t&&"TimeRanges"==t.__type__)n=function(e){return{length:e.length,start:function(t){return e.start[t]},end:function(t){return e.end[t]}}}(t);else if(t&&"object"==typeof t&&"Uint8Array"==t.__type__)n=new Uint8Array(t.entries);else if(t&&"object"==typeof t&&"Error"==t.__type__){for(n in e=t.contents,t=Error(e.message),e)t[n]=e[n];n=t}else n=t;return n})}(i=Rd.prototype).needsSkipUI=function(){return!1},i.isClientRendering=function(){return!0},i.hasCustomClick=function(){return!0},i.isUsingAnotherMediaElement=function(){return!0},i.getDuration=function(){return this.g.getDuration()},i.getMinSuggestedDuration=function(){return this.g.getMinSuggestedDuration()},i.getRemainingTime=function(){return this.h.getRemainingTime()},i.isPaused=function(){return this.i},i.isSkippable=function(){return 0<=this.g.getSkipTimeOffset()},i.getTimeUntilSkippable=function(){var e=this.g.getSkipTimeOffset();return e=this.getRemainingTime()-e,Math.max(e,0)},i.canSkipNow=function(){return this.h.getAdSkippableState()},i.skip=function(){return this.h.skip()},i.pause=function(){return this.h.pause()},i.play=function(){return this.h.resume()},i.getVolume=function(){return this.h.getVolume()},i.setVolume=function(e){return this.m.volume=e,this.h.setVolume(e)},i.isMuted=function(){return 0==this.h.getVolume()},i.isLinear=function(){return this.g.isLinear()},i.resize=function(e,t){this.h.resize(e,t)},i.setMuted=function(e){(this.m.muted=e)?(this.j=this.getVolume(),this.h.setVolume(0)):this.h.setVolume(this.j)},i.getSequenceLength=function(){var e=this.g.getAdPodInfo();return null==e?1:e.getTotalAds()},i.getPositionInSequence=function(){var e=this.g.getAdPodInfo();return null==e?1:e.getAdPosition()},i.getTitle=function(){return this.g.getTitle()},i.getDescription=function(){return this.g.getDescription()},i.getVastMediaBitrate=function(){return this.g.getVastMediaBitrate()},i.getVastMediaHeight=function(){return this.g.getVastMediaHeight()},i.getVastMediaWidth=function(){return this.g.getVastMediaWidth()},i.getVastAdId=function(){return""},i.getAdId=function(){return this.g.getAdId()},i.getCreativeAdId=function(){return this.g.getCreativeAdId()},i.getAdvertiserName=function(){return this.g.getAdvertiserName()},i.getMediaUrl=function(){return this.g.getMediaUrl()},i.getTimeOffset=function(){var e=this.g.getAdPodInfo();return null==e?0:e.getTimeOffset()},i.getPodIndex=function(){var e=this.g.getAdPodInfo();return null==e?0:e.getPodIndex()},i.release=function(){this.h=this.g=null},H("shaka.ads.ClientSideAd",Rd),Rd.prototype.release=Rd.prototype.release,Rd.prototype.getPodIndex=Rd.prototype.getPodIndex,Rd.prototype.getTimeOffset=Rd.prototype.getTimeOffset,Rd.prototype.getMediaUrl=Rd.prototype.getMediaUrl,Rd.prototype.getAdvertiserName=Rd.prototype.getAdvertiserName,Rd.prototype.getCreativeAdId=Rd.prototype.getCreativeAdId,Rd.prototype.getAdId=Rd.prototype.getAdId,Rd.prototype.getVastAdId=Rd.prototype.getVastAdId,Rd.prototype.getVastMediaWidth=Rd.prototype.getVastMediaWidth,Rd.prototype.getVastMediaHeight=Rd.prototype.getVastMediaHeight,Rd.prototype.getVastMediaBitrate=Rd.prototype.getVastMediaBitrate,Rd.prototype.getDescription=Rd.prototype.getDescription,Rd.prototype.getTitle=Rd.prototype.getTitle,Rd.prototype.getPositionInSequence=Rd.prototype.getPositionInSequence,Rd.prototype.getSequenceLength=Rd.prototype.getSequenceLength,Rd.prototype.setMuted=Rd.prototype.setMuted,Rd.prototype.resize=Rd.prototype.resize,Rd.prototype.isLinear=Rd.prototype.isLinear,Rd.prototype.isMuted=Rd.prototype.isMuted,Rd.prototype.setVolume=Rd.prototype.setVolume,Rd.prototype.getVolume=Rd.prototype.getVolume,Rd.prototype.play=Rd.prototype.play,Rd.prototype.pause=Rd.prototype.pause,Rd.prototype.skip=Rd.prototype.skip,Rd.prototype.canSkipNow=Rd.prototype.canSkipNow,Rd.prototype.getTimeUntilSkippable=Rd.prototype.getTimeUntilSkippable,Rd.prototype.isSkippable=Rd.prototype.isSkippable,Rd.prototype.isPaused=Rd.prototype.isPaused,Rd.prototype.getRemainingTime=Rd.prototype.getRemainingTime,Rd.prototype.getMinSuggestedDuration=Rd.prototype.getMinSuggestedDuration,Rd.prototype.getDuration=Rd.prototype.getDuration,Rd.prototype.isUsingAnotherMediaElement=Rd.prototype.isUsingAnotherMediaElement,Rd.prototype.hasCustomClick=Rd.prototype.hasCustomClick,Rd.prototype.isClientRendering=Rd.prototype.isClientRendering,Rd.prototype.needsSkipUI=Rd.prototype.needsSkipUI,H("shaka.ads.Utils",Nd),Nd.ADS_LOADED="ads-loaded",Nd.AD_STARTED="ad-started",Nd.AD_FIRST_QUARTILE="ad-first-quartile",Nd.AD_MIDPOINT="ad-midpoint",Nd.AD_THIRD_QUARTILE="ad-third-quartile",Nd.AD_COMPLETE="ad-complete",Nd.AD_STOPPED="ad-stopped",Nd.AD_SKIPPED="ad-skipped",Nd.AD_VOLUME_CHANGED="ad-volume-changed",Nd.AD_MUTED="ad-muted",Nd.AD_PAUSED="ad-paused",Nd.AD_RESUMED="ad-resumed",Nd.AD_SKIP_STATE_CHANGED="ad-skip-state-changed",Nd.CUEPOINTS_CHANGED="ad-cue-points-changed",Nd.IMA_AD_MANAGER_LOADED="ima-ad-manager-loaded",Nd.IMA_STREAM_MANAGER_LOADED="ima-stream-manager-loaded",Nd.AD_CLICKED="ad-clicked",Nd.AD_PROGRESS="ad-progress",Nd.AD_BUFFERING="ad-buffering",Nd.AD_IMPRESSION="ad-impression",Nd.AD_DURATION_CHANGED="ad-duration-changed",Nd.AD_CLOSED="ad-closed",Nd.AD_LOADED="ad-loaded",Nd.ALL_ADS_COMPLETED="all-ads-completed",Nd.AD_LINEAR_CHANGED="ad-linear-changed",Nd.AD_METADATA="ad-metadata",Nd.AD_RECOVERABLE_ERROR="ad-recoverable-error",Nd.AD_ERROR="ad-error",Nd.AD_BREAK_READY="ad-break-ready",Nd.AD_INTERACTION="ad-interaction",Nd.AD_CONTENT_PAUSE_REQUESTED="ad-content-pause-requested",Nd.AD_CONTENT_RESUME_REQUESTED="ad-content-resume-requested",Nd.AD_CONTENT_ATTACH_REQUESTED="ad-content-attach-requested",Bd.prototype.configure=function(e){this.s=e},Bd.prototype.stop=function(){this.g&&this.g.stop(),this.u&&cs(this.u)},Bd.prototype.release=function(){this.stop(),this.B&&this.B.disconnect(),this.h&&this.h.release(),this.g&&this.g.destroy(),this.m.destroy(),this.D.destroy()},(i=Hd.prototype).needsSkipUI=function(){return!0},i.isClientRendering=function(){return!0},i.hasCustomClick=function(){return!1},i.isUsingAnotherMediaElement=function(){return this.u},i.getDuration=function(){var e=this.g.duration;return isNaN(e)?-1:e},i.getMinSuggestedDuration=function(){return this.getDuration()},i.getRemainingTime=function(){var e=this.g.duration;return isNaN(e)?-1:e-this.g.currentTime},i.isPaused=function(){return this.g.paused},i.isSkippable=function(){return this.h&&null!=this.l?this.getDuration()-this.getRemainingTime()=r)return null;for(var a=-1,o=-1,s=0;sn||127n||0>t))if(t>=n)for(--i;0<=i;i--)e.i[t+i]=e.i[n+i].map(function(e){return e});else for(var r=0;rt;t++)e.i.push(jf())}function jf(){for(var e=[],t=0;42>t;t++)e.push(null);return e}function Gf(e,t){Hf(e)&&(e.i[e.h][e.g]=new _f(t,e.D,e.B,e.u,e.C),e.g++)}function Hf(e){var t=e.g=t.g&&0>=t.h||(0>=t.g?(t.g=t.m-1,t.h--):t.g--,t.i[t.h][t.g]=null);break;case 13:t.isVisible()&&(r=Vf(t,i,e.i)),t.h+1>=t.s?function(e){for(var t=0,n=1;16>n;n++,t++)e.i[t]=e.i[n];for(n=0;1>n;n++,t++)e.i[t]=jf()}(t):t.h++,t.g=0;break;case 14:t.isVisible()&&(r=Vf(t,i,e.i)),t.i[t.h]=jf(),t.g=0;break;case 12:t.isVisible()&&(r=Vf(t,i,e.i)),Ff(t),t.h=0,t.g=0}return r?[r]:[]}function Zf(e,t,n,i){if(128<=n&&135>=n)i=7&n,e.h[i]&&(e.g=e.h[i]);else{if(136===n){n=Xf(t).value,t=[];for(var r=(n=l(Jf(e,n))).next();!r.done;r=n.next()){if((r=e.h[r.value]).isVisible()){var a=Vf(r,i,e.i);a&&t.push(a)}Ff(r)}return t}if(137===n)for(n=(t=l(Jf(e,t=Xf(t).value))).next();!n.done;n=t.next())(n=e.h[n.value]).isVisible()||(n.j=i),n.display();else{if(138===n){for(n=Xf(t).value,t=null,r=(n=l(Jf(e,n))).next();!r.done;r=n.next())(r=e.h[r.value]).isVisible()&&(t=Vf(r,i,e.i)),r.l=!1;return t?[t]:[]}if(139===n){for(n=Xf(t).value,t=null,r=(n=l(Jf(e,n))).next();!r.done;r=n.next())(r=e.h[r.value]).isVisible()?t=Vf(r,i,e.i):r.j=i,r.l=!r.l;return t?[t]:[]}if(140===n)return Qf(e,t=Xf(t).value,i);if(143===n)return i=Qf(e,255,i),$f(e),i;if(144===n)t.skip(1),i=Xf(t).value,e.g&&(e.g.B=0<(128&i),e.g.D=0<(64&i));else if(145===n)i=Xf(t).value,n=Xf(t).value,t.skip(1),e.g&&(t=eg((48&n)>>4,(12&n)>>2,3&n),e.g.C=eg((48&i)>>4,(12&i)>>2,3&i),e.g.u=t);else if(146===n)i=Xf(t).value,t=Xf(t).value,e.g&&((e=e.g).h=15&i,e.g=63&t);else if(151===n)t.skip(1),t.skip(1),i=Xf(t).value,t.skip(1),e.g&&(e.g.F=3&i);else if(152<=n&&159>=n){n=(15&n)-8,(r=null!==e.h[n])||((a=new Bf(n,e.i)).j=i,e.h[n]=a),i=Xf(t).value,a=Xf(t).value;var o=Xf(t).value,s=Xf(t).value,u=Xf(t).value;t=Xf(t).value,r&&!(7&t)||((t=e.h[n]).h=0,t.g=0,t.D=!1,t.B=!1,t.C="white",t.u="black"),(t=e.h[n]).l=0<(32&i),t.K=127&a,t.H=o,t.G=(240&s)>>4,t.J=0<(128&a),t.s=1+(15&s),t.m=1+(63&u),e.g=e.h[n]}}}return[]}function Jf(e,t){for(var n=[],i=0;8>i;i++)!(1&~t)&&e.h[i]&&n.push(i),t>>=1;return n}function Qf(e,t,n){for(var i=[],r=(t=l(Jf(e,t))).next();!r.done;r=t.next()){r=r.value;var a=e.h[r];a.isVisible()&&(a=Vf(a,n,e.i))&&i.push(a),e.h[r]=null}return i}function $f(e){e.g=null,e.h=[null,null,null,null,null,null,null,null]}function eg(e,t,n){var i={0:0,1:0,2:1,3:1};return ng[(e=i[e])<<2|(t=i[t])<<1|(n=i[n])]}Bf.prototype.isVisible=function(){return this.l},Bf.prototype.display=function(){this.l=!0},Kf.prototype.Oa=function(){return this.gthis.h.length)throw new Ce(2,2,3e3);this.g+=e},Kf.prototype.xj=function(e){if(0>this.g-e)throw new Ce(2,2,3e3);this.g-=e};var tg=new Map([[32," "],[33," "],[37,"…"],[42,"Š"],[44,"Œ"],[48,"█"],[49,"‘"],[50,"’"],[51,"“"],[52,"”"],[53,"•"],[57,"™"],[58,"š"],[60,"œ"],[61,"℠"],[63,"Ÿ"],[118,"⅛"],[119,"⅜"],[120,"⅝"],[121,"⅞"],[122,"│"],[123,"┐"],[124,"└"],[125,"─"],[126,"┘"],[127,"┌"]]),ng="black blue green cyan red magenta yellow white".split(" ");function ig(){this.h=[],this.g=[],this.i=new Wf,this.l=0,this.m=new Map([["CC1",new Lf(0,0)],["CC2",new Lf(0,1)],["CC3",new Lf(1,0)],["CC4",new Lf(1,1)]]),this.u=this.s=0,this.j=new Map,this.C=!0,this.B=new Set,rg(this)}function rg(e){e.s=0,e.u=0;for(var t=l(e.m.values()),n=t.next();!n.done;n=t.next())(n=n.value).h=0,n.g=n.j,n.m=null,Tf(n.i),Tf(n.j),Tf(n.s);e.C=!0}function ag(e,t){var n=t.type;if(16==(112&t.Fb)){var i=t.Fb>>3&1;0===n?e.s=i:e.u=i}if(i="CC"+(1+(n<<1|(n?e.u:e.s))),n=e.m.get(i),255===t.Fb&&255===t.pc||!t.Fb&&!t.pc||!sg(t.Fb)||!sg(t.pc))return 45<=++e.l&&rg(e),null;e.l=0,t.Fb&=127,t.pc&=127;var r=t.Fb;if(1<=r&&15>=r||!t.Fb&&!t.pc)return null;if(r=null,16==(112&t.Fb))e:{if(e.B.add(i),i=t.Fb,e=t.pc,n.m===(i<<8|e))n.m=null;else if(n.m=i<<8|e,16==(240&i)&&64==(192&e)){t=[11,11,1,2,3,4,12,13,14,15,5,6,7,8,9,10][(7&i)<<1|e>>5&1],i="white",r=!1;var a=null,o=95=o?i=Uf[Math.floor(o/2)]:15>=o?r=!0:a=Math.floor((o-16)/2),e=!(1&~e),4!==n.h&&(o=n.g,3===n.h&&t!==o.g&&(Ef(o,n=1+t-o.h,1+o.g-o.h,o.h),xf(o,0,n-1),xf(o,t+1,15-t)),o.g=t,o.m=e,o.j=r,o.l=i,o.u=a,o.s="black")}else if(17==(247&i)&&32==(240&e))n.g.m=!1,n.g.j=!1,n.g.l="white",Af(n.g,0,32),i=!1,"white_italics"===(t=Uf[(14&e)>>1])&&(t="white",i=!0),n.g.m=!(1&~e),n.g.j=i,n.g.l=t;else if(16==(247&i)&&32==(240&e)||23==(247&i)&&45==(255&e))t="black",!(7&i)&&(t=Of[(14&e)>>1]),n.g.s=t;else if(17==(247&i)&&48==(240&e))Af(n.g,1,e);else if(18==(246&i)&&32==(224&e))Af(n.g,1&i?3:2,e);else{if(20==(246&i)&&32==(240&e)){switch(e=t.pts,i=null,t.pc){case 32:Rf(n);break;case 33:(n=n.g).i[n.g].pop();break;case 37:i=Df(n,2,e);break;case 38:i=Df(n,3,e);break;case 39:i=Df(n,4,e);break;case 40:Af(n.g,0,32);break;case 41:n.h=2,n.g=n.i,n.g.h=0,n.l=e;break;case 42:Tf(n.s),Nf(n);break;case 43:Nf(n);break;case 44:t=n.i,i=null,4!==n.h&&(i=Sf(t,n.l,e)),xf(t,0,15);break;case 45:t=n.g,3!==n.h?i=null:(i=Sf(t,n.l,e),Ef(t,(r=t.g-t.h+1)-1,r,t.h),xf(t,0,r-1),xf(t,t.g,15-t.g),n.l=e);break;case 46:xf(n.j,0,15);break;case 47:t=null,4!==n.h&&(t=Sf(n.i,n.l,e)),i=n.j,n.j=n.i,n.i=i,Rf(n),n.l=e,i=t}r=i;break e}(23==i||31==i)&&33<=e&&35>=e&&(n.g.B=e-32)}r=null}else e=t.pc,Af(n.g,0,t.Fb),Af(n.g,0,e);return r}function og(e,t){var n=[];try{for(;t.Oa();){var i=Xf(t).value,r=(224&i)>>5,a=31&i;if(7===r&&0!=a&&(r=63&Xf(t).value),0!=r){e.B.add("svc"+r),e.j.has(r)||e.j.set(r,new Yf(r));for(var o=e.j.get(r),s=t.Ua();t.Ua()-s=c)var p=qf(r,u,c,d);else if(128<=c&&159>=c)p=Zf(r,u,c,d);else{if(4096<=c&&4127>=c)r=u,8<=(u=255&c)&&15>=u?r.skip(1):16<=u&&23>=u?r.skip(2):24<=u&&31>=u&&r.skip(3);else if(4224<=c&&4255>=c)r=u,128<=(u=255&c)&&135>=u?r.skip(4):136<=u&&143>=u&&r.skip(5);else if(32<=c&&127>=c)u=c,r.g&&Gf(r.g,127===u?"♪":String.fromCharCode(u));else if(160<=c&&255>=c)r.g&&Gf(r.g,String.fromCharCode(c));else if(4128<=c&&4223>=c){if(u=255&c,r.g)if(tg.has(u)){var f=tg.get(u);Gf(r.g,f)}else Gf(r.g,"_")}else 4256<=c&&4351>=c&&r.g&&Gf(r.g,160!=(255&c)?"_":"[CC]");p=[]}n.push.apply(n,h(p))}}}}catch(e){if(!(e instanceof Ce&&3e3===e.code))throw e;q("CEA708_INVALID_DATA","Buffer read out of bounds / invalid CEA-708 Data.")}return n}function sg(e){for(var t=0;e;)t^=1&e,e>>=1;return 1===t}function ug(e){for(var t=[],n=e,i=e=0;i>1&63)||40==g;break;case fg:s=2,t.skip(1),g=23==(g=f>>1&63)||24==g;break;default:return}if(g)for(f=0,c(e=new ua(e,0)).getLength())&&181===e.aa()&&49===e.Ga()&&1195456820===e.W()&&3===e.aa()&&64&(n=e.aa()))for(n&=31,e.skip(1),i=0;i>2,o=e.aa(),s=e.aa();a&&(0==(r&=3)||1===r?this.h.push({pts:t,type:r,Fb:o,pc:s,order:this.h.length}):(this.g.push({pts:t,type:r,value:o,order:this.g.length}),this.g.push({pts:t,type:2,value:s,order:this.g.length})))}},ig.prototype.decode=function(){function e(e,t){return e.pts-t.pts||e.order-t.order}var t=[];this.h.sort(e),this.g.sort(e);for(var n=l(this.h),i=n.next();!i.done;i=n.next())(i=ag(this,i.value))&&t.push(i);for(i=(n=l(this.g)).next();!i.done;i=n.next())zf(this.i,i.value);for(i=(n=l(this.i.i)).next();!i.done;i=n.next())i=og(this,i.value),t.push.apply(t,h(i));return this.i.i=[],this.h=[],this.g=[],t},ig.prototype.getStreams=function(){return Array.from(this.B)},H("shaka.cea.CeaDecoder",ig),Xt=function(){return new ig},lg.prototype.init=function(e){function t(e){e=e.name,gg.has(e)&&(n.g=gg.get(e))}var n=this,i=[],r=[];if((new ca).box("moov",da).box("mvex",da).V("trex",function(e){var t=e.reader;t.skip(4),t.skip(4),e=t.W(),t=t.W(),n.h=e,n.i=t}).box("trak",da).V("tkhd",function(e){var t=e.reader;1==(e=e.version)?(t.skip(8),t.skip(8)):(t.skip(4),t.skip(4));var n=t.W();1==e?t.skip(8):t.skip(4),t.skip(4),t.skip(8),t.skip(2),t.skip(2),t.skip(2),t.skip(2),t.skip(36),t.Ga(),t.Ga(),t.Ga(),t.Ga(),i.push(n)}).box("mdia",da).V("mdhd",function(e){e=po(e.reader,e.version),r.push(e.timescale)}).box("minf",da).box("stbl",da).V("stsd",pa).box("avc1",t).box("avc3",t).box("dvav",t).box("dva1",t).box("hev1",t).box("hvc1",t).box("dvh1",t).box("dvhe",t).box("vvc1",t).box("vvi1",t).box("dvc1",t).box("dvi1",t).box("encv",fa).box("sinf",da).box("frma",function(e){e=mo(e.reader).codec,gg.has(e)&&(n.g=gg.get(e))}).parse(e,!0,!0),!i.length||!r.length||i.length!=r.length)throw new Ce(2,2,2010);this.g==cg&&Y("Unable to determine bitstream format for CEA parsing!"),i.forEach(function(e,t){n.j.set(e,r[t])})},lg.prototype.parse=function(e){var t=this;if(this.g==cg)return[];var n=[],i=0,r=[];return(new ca).box("moof",function(e){i=e.start,r=[],da(e)}).box("traf",function(e){r.push({baseMediaDecodeTime:null,be:t.h,ce:t.i,oj:[],timescale:9e4}),da(e)}).V("trun",function(e){var t=r[r.length-1];e=fo(e.reader,e.version,e.flags),t.oj.push(e)}).V("tfhd",function(e){var n=r[r.length-1];e=ho(e.reader,e.flags),n.be=e.be||t.h,n.ce=e.ce||t.i,e=e.trackId,t.j.has(e)&&(n.timescale=t.j.get(e))}).V("tfdt",function(e){var t=r[r.length-1];e=co(e.reader,e.version),t.baseMediaDecodeTime=e.baseMediaDecodeTime}).box("mdat",function(e){for(var a=i-e.start-8,o=e.reader.Ua(),s=l(r),u=s.next();!u.done;u=s.next())null===(u=u.value).baseMediaDecodeTime?Y("Unable to find base media decode time for CEA captions!"):(e.reader.seek(o),hg(t,e.reader,u.baseMediaDecodeTime,u.timescale,u.be,u.ce,a,u.oj,n))}).parse(e,!1,!0),n},H("shaka.cea.Mp4CeaParser",lg);var cg=0,dg=1,pg=2,fg=3,gg=(new Map).set("avc1",dg).set("avc3",dg).set("dvav",dg).set("dva1",dg).set("hev1",pg).set("hvc1",pg).set("dvh1",pg).set("dvhe",pg).set("vvc1",fg).set("vvi1",fg).set("dvc1",fg).set("dvi1",fg);function mg(){this.g=null}function vg(e){return(e=function(e){var t=0,n=Ee(e),i=n.getUint32(t,!0);if(i!=e.byteLength)return[];e:{for(e=t+6,t=[];en.byteLength){n=[];break e}var a=Te(n,e,r);t.push({type:i,value:a}),e+=r}n=t}return n}(e=Ke(bn(e))).filter(function(e){return e.type===bg})[0])&&(e=fn(e=Oe(e.value,!0),"WRMHEADER"))?e:null}function yg(e){try{var t=vg(e);if(t)e:{for(var n=l(wn(t,"DATA")),i=n.next();!i.done;i=n.next()){var r=i.value;if(r.children)for(var a=l(r.children),o=a.next();!o.done;o=a.next()){var s=o.value;if("LA_URL"==s.tagName){var u=bn(s);break e}}}u=""}else u="";return u}catch(e){return""}}Wt("video/mp4",function(){return new lg}),mg.prototype.init=function(){},mg.prototype.parse=function(e){this.g?this.g.clearData():this.g=new Ns;var t=[];if(!Fs(e=Te(e)))return t;var n=(e=this.g.parse(e)).ee(),i=e.vf();switch(e=[],n.video){case"avc":e.push(6);break;case"hvc":e.push(39),e.push(40)}if(!e.length)return t;for(i=(n=l(i)).next();!i.done;i=n.next())if(i=i.value,e.includes(i.type)&&null!=i.time)for(var r=l(ug(i.data)),a=r.next();!a.done;a=r.next())t.push({packet:a.value,pts:i.time});return t},H("shaka.cea.TsCeaParser",mg),Wt("video/mp2t",function(){return new mg});var bg=1;function _g(t,n,i){var r=function(e){for(var t=[],n=(e=l(e)).next();!n.done;n=e.next())(n=Sg(n.value))&&t.push(n);return t}(t),a=null;t=[];var o=[],s=null,u=new Set(r.map(function(e){return e.keyId}));u.delete(null);var h="cenc";if(1"+(e=We(e=Te(t,e+4)))+""))}return""}function Sg(e){var t=e.attributes.schemeIdUri,n=En(e,"urn:mpeg:cenc:2013","default_KID"),i=xn(e,"urn:mpeg:cenc:2013","pssh").map(_n),r=e.attributes.value;if(!t)return null;if(t=t.toLowerCase(),n&&(n=n.replace(/-/g,"").toLowerCase()).includes(" "))throw new Ce(2,4,4009);var a=[];try{a=i.map(function(e){return{initDataType:"cenc",initData:Ke(e),keyId:null}})}catch(e){throw new Ce(2,4,4007)}return{node:e,Rd:t,keyId:n,init:0(m=m||0))if(p){if(null==(p=An(p,"t",Dn)))break;if(f>=p)break;m=Math.ceil((p-f)/g)-1}else{if(1/0==e)break;if(f/a>=e)break;m=Math.ceil((e*a-f)/g)-1}for(0>>31;d&=2147483647;var f=o.reader.W();if(o.reader.skip(4),1==p)throw new Ce(2,3,3006);s.push(new Jo(l/u+n,(l+f)/u+n,function(){return a},e,e+d-1,t,n,i,r)),l+=f,e+=d}return o.parser.stop(),s}(t,i,r,a,o,n,e)});if(e&&u.parse(e),s)return s;throw new Ce(2,3,3004)}(v,r,i,n,w,S,T);else{k=v;var I=new Mg(y);if(440786851!=Pg(I).id)throw new Ce(2,3,3008);var M=Pg(I);if(408125543!=M.id)throw new Ce(2,3,3009);I=M.g.byteOffset,M=new Mg(M.g);for(var P=null;M.Oa();){var L=Pg(M);if(357149030==L.id){P=L;break}}if(!P)throw new Ce(2,3,3010);for(P=new Mg(P.g),L=1e6,M=null;P.Oa();){var D=Pg(P);if(2807729==D.id)L=Ng(D);else if(17545==D.id)if(4==D.g.byteLength)M=D.g.getFloat32(0);else{if(8!=D.g.byteLength)throw new Ce(2,3,3003);M=D.g.getFloat64(0)}}if(null==M)throw new Ce(2,3,3011);if(M*=P=L/1e9,475249515!=(k=Pg(new Mg(k))).id)throw new Ce(2,3,3007);k=function(e,t,n,i,r,a,o,s,u){function l(){return r}var h=[];e=new Mg(e.g);for(var c=null,d=null;e.Oa();){var p=Pg(e);if(187==p.id){var f=Og(p);f&&(p=n*f.tm,f=t+f.Wl,null!=c&&h.push(new Jo(c+o,p+o,l,d,f-1,a,o,s,u)),c=p,d=f)}}return null!=c&&h.push(new Jo(c+o,i+o,l,d,null,a,o,s,u)),h}(k,I,P,M,i,n,w,S,T)}for(A=l(b=k),E=A.next();!E.done;E=A.next())(x=E.value).codecs=e.M.codecs,x.mimeType=e.M.mimeType,x.bandwidth=e.bandwidth;return s.ue(b),f=new Hu(b),u&&f.Cd(S,T,!0),C.return(f)})}function Fg(e){return e.Sd}function jg(e){var t=kg(e,Fg,"RepresentationIndex");return e=Mn((e=Cg(e,Fg,"indexRange"))||""),t&&(e=An(t,"range",Mn,e)),e}function Gg(e,t){var n=e.M.mimeType.split("/")[1];if(e.M.contentType!=nt&&"mp4"!=n&&"webm"!=n)throw new Ce(2,4,4006);if("webm"==n&&!t)throw new Ce(2,4,4005)}function Hg(e){var t=e.M;return{bandwidth:e.bandwidth,audioSamplingRate:t.audioSamplingRate,codecs:t.codecs,contentType:t.contentType,frameRate:t.frameRate||null,height:t.height||null,mimeType:t.mimeType,channelsCount:t.Nf,pixelAspectRatio:t.pixelAspectRatio||null,width:t.width||null,label:e.va.label||null,roles:e.roles||null,language:e.va.language||null}}function Vg(e){return e.Cc}function Wg(t,n,i,r,a,o,s,u,h,c){h||t.M.xf||(t.M.xf=Cg(t,zg,"initialization"));var d=t.M.xf?function(e,t){var n=e.M.xf;if(n||(n=Cg(e,zg,"initialization")),!n)return null;n=Ge(n);var i=e.M.originalId,r=e.bandwidth||null,a=e.M.jb,o=e.Qb;return t=new qo(function(){var e=Ag(n,i,null,null,r,null);return Ze(a(),[e],o())},0,null,Hg(e),null,null,t,e.va.encrypted),t.codecs=e.M.codecs,t.mimeType=e.M.mimeType,e.oa&&!e.oa.Af&&(t.g=e.oa.start+e.oa.duration),t}(t,s):null,p=function(e){var t=Eg(e,zg),n=Cg(e,zg,"media"),i=Cg(e,zg,"index"),r=Cg(e,zg,"k"),a=0;return r&&(a=parseInt(r,10)),{mg:t.mg,mb:t.mb,timescale:t.timescale,De:t.De,Ob:t.Ob,td:t.td,timeline:t.timeline,hc:n&&Ge(n),me:i,mimeType:e.M.mimeType,codecs:e.M.codecs,bandwidth:e.bandwidth,Ml:a}}(t);!function(e){var t=e.me?1:0;if(t+=e.timeline?1:0,0==(t+=e.mb?1:0))throw new Ce(2,4,4002);if(1!=t&&(e.me&&(e.timeline=null),e.mg=null,e.mb=null),!e.me&&!e.hc)throw new Ce(2,4,4002)}(p);var f=cn(t);if(p.me)return Gg(t,d),{endTime:-1,timeline:-1,bd:function(){var e=Ag(p.me,f.M.originalId,null,null,f.bandwidth||null,null);return e=Ze(f.M.jb(),[e]),Bg(f,n,d,e,0,null,p.Ob)},timescale:p.timescale};if(p.mb)return r||"image"===t.va.contentType||"text"===t.va.contentType||(r=t.oa.start,c=t.za.id,i=t.oa.duration,c=(c=null!=c&&o.get(c)||i)?r+c:1/0,t.presentationTimeline.Hh(p.mb),t.presentationTimeline.mj(r,c)),{endTime:-1,timeline:-1,bd:function(){return function(t,n,i,r,a,o,s,u){function h(i){var a=i-y,s=a*v,l=n.mg,h=a*l;"BigInt"in e&&h>Number.MAX_SAFE_INTEGER&&(h=BigInt(a)*BigInt(l)),a=(s+=f)+v,l=Math.min(a,d());var c=[],p=n.Ml;if(p)for(var g=(l-s)/p,m={},E=0;Ed()&&!n.length?null:n})}return Promise.resolve(k)}(f,p,a,d,o,s,u,t.M.cg)},timescale:p.timescale};var g=null;r=r=null,t.za.id&&t.M.id&&(r=t.za.id+","+t.M.id,r=i.get(r))&&(g=r.segmentIndex);var m=t.oa.start,v=t.oa.duration?m+t.oa.duration:1/0;if(g)Xg(c=g,p,m,v,d,t.Hb),c.hb(t.presentationTimeline.Lb());else{if(i=0,h=-1,null!=t.za.id&&null!=t.M.id){var y=c.get(t.za.id);if(y)h=y.timeline;else for(y=(c=l(c.values())).next();!y.done;y=c.next()){if(y=y.value,Math.abs(p.Ob-y.endTime)<=rt&&y.Qh.includes(t.M.id)){h=y.timeline;break}y.timeline>=i&&(i=y.timeline+1)}}-1==h&&(h=i),g=new Kg(t.Hb,p,t.M.originalId,t.bandwidth,t.M.jb,t.Qb,m,v,d,s,t.M.cg,h)}return p.timeline&&"image"!==t.va.contentType&&"text"!==t.va.contentType&&t.presentationTimeline.nj(g.h?g.h.timeline:[],m),r&&t.Hb&&(r.segmentIndex=g),r=(r=(r=p.timeline)&&r[r.length-1])?r.end+p.Ob:-1,c=-1,g instanceof Kg&&(c=g.kf()),{endTime:r,timeline:c,bd:function(){return g instanceof Kg&&0==g.getNumReferences()&&Xg(g,p,m,v,d,t.Hb),Promise.resolve(g)},timescale:p.timescale}}function zg(e){return e.Qc}function Kg(e,t,n,i,r,a,o,s,u,l,h,c){Hu.call(this,[]),this.D=e,this.h=t,this.G=n,this.C=i,this.F=r,this.I=a,this.j=o,this.l=s,this.u=u,this.B=l,this.H=h,this.J=c,Yg(this)}function Xg(e,t,n,i,r,a){if(function(e,t){if(e.u!==t){e.u=t;for(var n=(e=l(e.g)).next();!n.done;n=e.next())(n=n.value)&&Qo(n,t)}}(e,r),e.D=a,e.h){if(e.h.td!==t.td&&(e.h.timeline=t.timeline,e.h.td=t.td,e.h.Ob=t.Ob),e.h.hc!==t.hc&&(e.h.hc=t.hc),(n=e.h.timeline).length){var o=n[n.length-1];t=t.timeline.filter(function(e){return e.end>o.end})}else t=t.timeline.slice();0=e.l||0>=i.end||t.push(i);e.h.timeline=t,e.hb(e.j)}}function qg(e,t,n,i,r,a,o,s){return e=Ag(e,t,n,a,i||null,r),Ze(o(),[e],s()).map(function(e){return e.toString()})}function Zg(e){this.s=null,this.B=e,this.G=new zr,this.i=[],this.h=null,this.m=[],this.C=null,this.F=[],this.D=300,this.l=new Map,this.j=new Map,this.g=null,this.u="UNKNOWN"}function Jg(e,t){var n,i,r,a,o,s,u;return L(function(l){return 1==l.g?(n=Ze(e.i,[Qg(e,t)]),i=Zr(n,e.s.retryParameters),r=e.B.networkingEngine.request(8,i),Kr(e.G,r),S(l,2),_(l,r.promise,4)):2!=l.g?(a=l.h,o=Ne(a.data),1==(s=JSON.parse(o)).VERSION&&function(e,t,n){null!=e.g&&(e.g.stop(),e.g=null);var i=t["RELOAD-URI"]||n;e.g=new zi(function(){Jg(e,i)}),(n=t.TTL)&&(e.D=n),e.g.X(e.D),e.m=t["PATHWAY-PRIORITY"]||[],e.F=t["PATHWAY-CLONES"]||[]}(e,s,a.uri),A(l,0)):(u=E(l))&&7001==u.code?l.return():(null!=e.g&&(e.g.stop(),e.g=null),e.g=new zi(function(){Jg(e,t)}),e.g.X(e.D),void w(l))})}function Qg(e,t){if(!e.m.length)return t;t=new re(t);var n=e.C||e.m[0],i=Math.round(e.B.getBandwidthEstimate()),r=t.g;return"DASH"==e.u?(r.add("_DASH_pathway",n),r.add("_DASH_throughput",String(i))):"HLS"==e.u&&(r.add("_HLS_pathway",n),r.add("_HLS_throughput",String(i))),be(r)&&ue(t,r),t.toString()}function $g(e,t,n,i){var r=e.l.get(t);r||(r=new Map),r.set(n,i),e.l.set(t,r)}function em(e,t,n){n=void 0!==n&&n,t=e.l.get(t)||new Map;for(var i=[],r=l(e.m),a=r.next(),o={};!a.done;o={Ld:void 0},a=r.next())if(o.Ld=a.value,a=t.get(o.Ld))i.push({Mh:o.Ld,location:a});else if(a=e.F.find(function(e){return function(t){return t.Rm==e.Ld}}(o))){var s=t.get(a["BASE-ID"]);s&&(a["URI-REPLACEMENT"].ck?(oe(s=new re(s),a["URI-REPLACEMENT"].ck),i.push({Mh:o.Ld,location:s.toString()})):i.push({Mh:o.Ld,location:s}))}for(r=Date.now(),a=(o=l(e.j.keys())).next();!a.done;a=o.next())a=a.value,r>(s=e.j.get(a))&&e.j.delete(a);if(i=i.filter(function(t){for(var n=l(e.j.keys()),i=n.next();!i.done;i=n.next())if(i.value.includes(new re(t.location).Gb))return!1;return!0}),i.length&&(e.C=i[0].Mh),i=i.map(function(e){return e.location}),!i.length&&e.h)for(o=(r=l(e.h.split(","))).next();!o.done;o=r.next())(o=t.get(o.value))&&(e.C=e.h,i.push(o));if(!i.length)for(r=(t=l(t.values())).next();!r.done;r=t.next())i.push(r.value);return n?i:Ze(e.i,i)}function tm(){this.l=[],this.h=[],this.g=[],this.j=[],this.i=[],this.u=this.s=!1,this.m=new Set}function nm(e,t){for(var n=[],i=[],r=[],a=[],o=(e=l(e)).next();!o.done;o=e.next()){var s=o.value;o=new Map(s.audioStreams.map(function(e){return[Im(e),e]}));var u=new Map(s.videoStreams.map(function(e){return[km(e),e]})),h=new Map(s.textStreams.map(function(e){return[Mm(e),e]}));if(s=new Map(s.imageStreams.map(function(e){return[Pm(e),e]})),t){var c=Tm(nt);h.set(Mm(c),c),c=Tm("image"),s.set(Pm(c),c)}n.push(o),i.push(u),r.push(h),a.push(s)}return{Ci:n,Zj:i,Uj:r,Zi:a}}function im(e){var t,n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S,T,A,E,x,C,k,I,M,P;return L(function(L){switch(L.g){case 1:if(t=it,1==e.length)return L.return(e[0]);for(n=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.ma}).map(function(e){return[Im(e),e]}))}),i=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.Ha}).map(function(e){return[km(e),e]}))}),r=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.$a}).map(function(e){return[Mm(e),e]}))}),a=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.wg}).map(function(e){return[Pm(e),e]}))}),o=l(r),s=o.next();!s.done;s=o.next())u=s.value,h=Sm(t.$a),u.set(Mm(h),h);for(c=l(a),d=c.next();!d.done;d=c.next())p=d.value,f=Sm(t.wg),p.set(Pm(f),f);return _(L,rm(g=new tm,[],n,0,lm,cm,0),2);case 2:return m=L.h,_(L,rm(g,[],i,0,lm,cm,0),3);case 3:return v=L.h,_(L,rm(g,[],r,0,lm,cm,0),4);case 4:return y=L.h,_(L,rm(g,[],a,0,lm,cm,0),5);case 5:if(b=L.h,w=0,v.length&&m.length)for(E=l(m),x=E.next();!x.done;x=E.next())for(C=x.value,k=l(v),I=k.next();!I.done;I=k.next())M=I.value,P=w++,M.variantIds.push(P),C.variantIds.push(P);else for(S=v.concat(m),T=l(S),A=T.next();!A.done;A=T.next())A.value.variantIds=[w++];return L.return(v.concat(m).concat(y).concat(b))}})}function rm(e,t,n,i,r,a,o){var s,u,h,c,d,p,f,g,m,v,y,b,w,S,T,A,E,x;return L(function(C){switch(C.g){case 1:for(s=[],u=0;u=i?s.push(new Set(n[u].values())):s.push(new Set);h=l(t),c=h.next();case 2:if(c.done){C.A(4);break}return d=c.value,_(C,function(e,t,n,i,r,a,o){return L(function(s){return 1==s.g?(dm(e,n,t,0i)return!0;if(ri.length)return!0;if(r.lengthi)return!0;if(ri.length)return!0;if(r.lengthe){if(n<=e||n-et-e)return Nm}else{if(n>e)return Nm;if(e-ne-t)return Nm}return Rm}function Em(e,t,n){var i=e.mimeType===t.mimeType&&e.codecs===t.codecs,r=e.mimeType===n.mimeType&&e.codecs===n.codecs;return i&&!r?Nm:!i&&r?Dm:(t=fm(e,t),e=fm(e,n),t&&!e?Nm:!t&&e?Dm:Rm)}function xm(e,t,n){return t=Math.abs(e-t),(e=Math.abs(e-n))=t&&(this.g=this.g.slice(t)),this.i+=t,0===this.getNumReferences()&&this.release())}},i.find=function(e){if(this.h&&this.h.timeline&&this.h.timeline.length&&e=this.l)return null;for(var n=t.length-1,i=0;i=a&&e(e-=this.i)||e>=this.getNumReferences()||!this.h)return null;var n=this.g[e];if(!n){var i=(n=this.h.timeline[e]).em,r=n.ri+this.h.td,a=this.j-this.h.Ob,o=this.j+n.end,s=o;e===this.getNumReferences()-1&&1/0!==this.l&&(s=this.D&&.1n}).map(_n).filter(Yi);return i.length?Ze(e.B,i):[]}(e),r=e.B,i.length?(r=i,n="Patch",t=6):1v&&m>g&&e.L++,null==m&&(m=g),!(null!==e.N&&null!==f&&null!==p&&pe.N)&&(e.N=p),u=Zm(e,t,n,{start:p,duration:m,node:c,Af:null==m||!d}),s.push(u),t.za.id&&m&&e.qa.set(t.za.id,m),null==m){u=null;break}u=p+m}}if(r)for(n=(t=l(s)).next();!n.done;n=t.next())n=n.value.id,e.F.includes(n)||e.F.push(n);else e.F=s.map(function(e){return e.id});return null!=a?{periods:s,duration:a+o,Oi:!1}:{periods:s,duration:u,Oi:!0}}function Zm(e,t,n,i){t.za=nv(e,i.node,null,n),t.oa=i,t.za.xb=t.xb,t.za.id||(t.za.id="__shaka_period_"+i.start);var r=yn(i.node,"EventStream");n=t.presentationTimeline.Lb();for(var a=(r=l(r)).next();!a.done;a=r.next())rv(e,i.start,i.duration,a.value,n);for(r=(n=l(n=yn(i.node,"SupplementalProperty"))).next();!r.done;r=n.next())"urn:mpeg:dash:urlparam:2014"==(r=r.value).attributes.schemeIdUri&&(r=$m(e,r))&&(t.Qb=r);if(n=yn(i.node,"AdaptationSet").map(function(n,i){return Qm(e,t,i,n)}).filter(Yi),t.Hb){r=[];for(var o=(a=l(n)).next();!o.done;o=a.next())for(var s=(o=l(o.value.$l)).next();!s.done;s=o.next())r.push(s.value);if(r.length!=new Set(r).size)throw new Ce(2,4,4018)}for(r=new Map,o=(a=l(n)).next();!o.done;o=a.next())for(s=(o=l(o.value.qk)).next();!s.done;s=o.next()){var u=l(s.value);s=u.next().value,u=u.next().value,r.set(s,u)}if(r.size)for(a=null,s=(o=l(n)).next();!s.done;s=o.next()){u=[];for(var c=l((s=s.value).streams),d=c.next(),p={};!d.done;p={ii:void 0},d=c.next())if(p.ii=d.value,r.has(p.ii.originalId)){a||(a=yn(i.node,"AdaptationSet").map(function(n,i){return Qm(e,t,i,n)}).filter(Yi));for(var f=(d=l(a)).next();!f.done;f=d.next())(f=f.value.streams.find(function(e){return function(t){return t.originalId==e.ii.originalId}}(p)))&&(f.dependencyStream=r.get(f.originalId),f.originalId+=f.dependencyStream.originalId,u.push(f))}u.length&&s.streams.push.apply(s.streams,h(u))}if(i=n.filter(function(e){return!e.pi}),n=n.filter(function(e){return e.pi}),!e.g.disableIFrames)for(r=(n=l(n)).next();!r.done;r=n.next())for(a=(r=r.value).pi.split(" "),s=(o=l(i)).next();!s.done;s=o.next())if(s=s.value,a.includes(s.id))for(u=(s=l(s.streams)).next();!u.done;u=s.next())mr(u.value,r.streams);if(n=Jm(e.g.disableAudio,i,"audio"),r=Jm(e.g.disableVideo,i,"video"),a=Jm(e.g.disableText,i,nt),i=Jm(e.g.disableThumbnails,i,"image"),0===r.length&&0===n.length)throw new Ce(2,4,4004);return{id:t.za.id,audioStreams:n,videoStreams:r,textStreams:a,imageStreams:i}}function Jm(e,t,n){return e||!t.length?[]:t.reduce(function(e,t){return t.contentType!=n||e.push.apply(e,h(t.streams)),e},[])}function Qm(t,n,i,r){function a(e){var i=e.attributes["dvb:fontFamily"];e=e.attributes["dvb:url"],i&&e&&(e=Ze(n.va.jb(),[e],n.Qb()),t.j.addFont(i,e[0]))}function o(e){switch(e){case 1:case 5:case 6:case 7:return"srgb";case 9:return"rec2020";case 11:case 12:return"p3"}}function s(e){switch(e){case 1:case 6:case 13:case 14:case 15:return"SDR";case 16:return"PQ";case 18:return"HLG"}}n.va=nv(t,r,n.za,null),n.va.position=i;var u=!1,c=(i=yn(r,"Role")).map(function(e){return e.attributes.value}).filter(Yi),d=void 0,p=n.va.contentType==nt;p&&(d="subtitle");for(var f=(i=l(i)).next();!f.done;f=i.next()){var g=(f=f.value).attributes.schemeIdUri;if(null==g||"urn:mpeg:dash:role:2011"==g)switch(f=f.attributes.value,f){case"main":u=!0;break;case"caption":case"subtitle":d=f}}var m=yn(r,"EssentialProperty");i=null;var v=!1;f=null,g=!1;for(var y=(m=l(m)).next();!y.done;y=m.next()){var b=(y=y.value).attributes.schemeIdUri;if("http://dashif.org/guidelines/trickmode"==b)i=y.attributes.value;else if("urn:mpeg:mpegB:cicp:TransferCharacteristics"==b)var S=s(parseInt(y.attributes.value,10));else if("urn:mpeg:mpegB:cicp:ColourPrimaries"==b)var T=o(parseInt(y.attributes.value,10));else"urn:mpeg:mpegB:cicp:MatrixCoefficients"!=b&&("urn:mpeg:dash:ssr:2023"==b&&t.g.dash.enableFastSwitching?v=!0:"urn:dvb:dash:fontdownload:2014"==b?a(y):"urn:mpeg:dash:urlparam:2014"==b&&(f=$m(t,y))||(g=!0))}if(g)return null;var A=null;for(m=(g=l(g=yn(r,"SupplementalProperty"))).next();!m.done;m=g.next())"http://dashif.org/guidelines/last-segment-number"==(y=(m=m.value).attributes.schemeIdUri)?A=parseInt(m.attributes.value,10)-1:"urn:mpeg:mpegB:cicp:TransferCharacteristics"==y?S=s(parseInt(m.attributes.value,10)):"urn:mpeg:mpegB:cicp:ColourPrimaries"==y?T=o(parseInt(m.attributes.value,10)):"urn:dvb:dash:fontdownload:2014"==y?a(m):"urn:mpeg:dash:urlparam:2014"==y&&(f=$m(t,m));f&&(n.Qb=f),f=yn(r,"Accessibility");var E,x=new Map;for(g=(f=l(f)).next();!g.done;g=f.next())if(g=(m=g.value).attributes.schemeIdUri,m=m.attributes.value,"urn:scte:dash:cc:cea-608:2015"!=g||t.g.disableText)if("urn:scte:dash:cc:cea-708:2015"!=g||t.g.disableText)"urn:mpeg:dash:role:2011"==g?null!=m&&(c.push(m),"captions"==m&&(d="caption")):"urn:tva:metadata:cs:AudioPurposeCS:2007"==g&&("1"==m?E="visually impaired":"2"==m?E="hard of hearing":"9"==m&&(E="spoken subtitles"));else if(g=1,null!=m)for(y=(m=l(m.split(";"))).next();!y.done;y=m.next()){b=y.value;var C=y=void 0;b.includes("=")?(y="svc"+(b=b.split("="))[0],C=b[1].split(",")[0].split(":").pop()):(y="svc"+g,g++,C=b),x.set(y,ht(C))}else x.set("svc1","und");else if(g=1,null!=m)for(b=(y=l(m=m.split(";"))).next();!b.done;b=y.next()){C=b.value;var k=b=void 0;C.includes("=")?(b=(C=C.split("="))[0].startsWith("CC")?C[0]:"CC"+C[0],k=C[1]||"und"):(b="CC"+g,2==m.length?g+=2:g++,k=C),x.set(b,ht(k))}else x.set("CC1","und");var I=_g(f=yn(r,"ContentProtection"),t.g.ignoreDrmInfo,t.g.dash.keySystemsByURI);n.va.encrypted=0e.J)){var n=e.J;0<=e.g.updatePeriod&&(n=e.g.updatePeriod),e.K.X(Math.max(n-t,St(e.sa)))}}function nv(e,t,n,i){n=n||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,pixelAspectRatio:void 0,Nf:null,audioSamplingRate:null,xb:0,cg:1,encrypted:!1},i=i||n.jb;var r,a=t.attributes.id,o=t.attributes.supplementalId,s=yn(t,"BaseURL"),u=!1;if(e.i)for(var h=l(s),c=h.next();!c.done;c=h.next()){var d=c.value;c=d.attributes.serviceLocation,d=_n(d),c&&d&&($g(e.i,a,c,d),u=!0)}u&&e.i||(r=s.map(_n));var p=e.i;e=t.attributes.contentType||n.contentType,h=t.attributes.mimeType||n.mimeType,c=fl([t.attributes.codecs||n.codecs]).join(","),d=An(t,"frameRate",On)||n.frameRate;var f=t.attributes.sar||n.pixelAspectRatio,g=function(e,t){t=t.slice();for(var n=(e=l(e)).next();!n.done;n=e.next())n=n.value.attributes.schemeIdUri,t.includes(n)||t.push(n);return t}(yn(t,"InbandEventStream"),n.emsgSchemeIdUris),m=yn(t,"AudioChannelConfiguration");m=function(e){for(var t=(e=l(e)).next();!t.done;t=e.next()){var n=(t=t.value).attributes.schemeIdUri;if(n&&(t=t.attributes.value))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return t.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(t=parseInt(t,10)))continue;return t;case"tag:dolby.com,2015:dash:audio_channel_configuration:2015":if(n=[2,1,2,2,2,2,1,2,2,1,1,1,1,2,1,1,2,2],!(t=parseInt(t,16)))continue;for(var i=0,r=0;rthis.g&&e.push("opus"),e},i.hj=function(){return!0},i.ij=function(){return 3===this.Ea()},navigator.userAgent.includes("Tizen")&&(Pe=function(){return new Av}),m(Ev,dv),Ev.prototype.Ea=function(){return null},Ev.prototype.Tb=function(){return"Vizio"},Ev.prototype.Ja=function(){return"TV"},Ev.prototype.kc=function(){return!1},navigator.userAgent.includes("VIZIO SmartCast")&&(Pe=function(){return new Ev}),m(xv,dv),(i=xv.prototype).Ea=function(){return this.g.value()},i.Tb=function(){return"WebKit STB"},i.Ja=function(){return"TV"},i.Fa=function(){return"WEBKIT"},i.kc=function(){return!1},i.rd=function(){var e=this.g.value();return null===e||15<=e},i.qc=function(){return Promise.resolve({width:e.screen.width*e.devicePixelRatio,height:e.screen.height*e.devicePixelRatio})},i.jg=function(){return!this.h.value()},(navigator.userAgent.includes("DT_STB_BCM")||navigator.userAgent.includes("DT_STB_BCM")||!(!(navigator.vendor||"").includes("Apple")||/(?:iPhone|iPad|iPod)/.test(navigator.userAgent)||1n.length||"data"!=n[0])throw new Ce(2,1,1004,t);if(2>(n=n.slice(1).join(":").split(",")).length)throw new Ce(2,1,1004,t);var i=n[0];t=e.decodeURIComponent(n.slice(1).join(",")),n=i.split(";"),i=n[0];var r=!1;return 1",ze(e),""].join("\n")))&&(n.licenseServerUri=yg(e)),n=Promise.resolve(n)}else n=Promise.resolve(null);return n}).set("urn:uuid:3d5e6d35-9b9a-41e8-b843-dd3c6e72c42c",function(e){var t=Nv(e,"METHOD");if(["SAMPLE-AES","SAMPLE-AES-CTR"].includes(t)){var n="cenc";"SAMPLE-AES"==t&&(n="cbcs"),n=Je("com.huawei.wiseplay",n,[{initDataType:"cenc",initData:t=Te((t=Qv((t=Nv(e,"URI")).split("?")[0])).data)}]),(e=Rv(e,"KEYID"))&&n.keyIds.add(e.toLowerCase().substr(2)),e=Promise.resolve(n)}else e=Promise.resolve(null);return e}),this.Ya=new Set,this.i=new Map,this.l=null,this.F="",this.gb=new zv,this.K=-1,this.Z=1/0,this.Y=this.zc=this.Ta=!1,this.D=new zi(function(){t.R&&!t.g.continueLoadingWhenPaused&&(t.P.Da(t.R,"timeupdate"),t.R.paused)?t.P.ra(t.R,"timeupdate",function(){return Oy(t)}):Oy(t)}),this.ua=Zy,this.m=null,this.Na=0,this.s=1/0,this.La=this.Ia=this.O=0,this.U=new zr,this.H=new Map,this.I=new Map,this.sa=new Map,this.ba=new Map,this.L=new Map,this.na=new Map,this.qa=new Map,this.ic=this.$=!1,this.eb=new wt(5),this.j=null,this.N=!0,this.P=new At,this.u=this.R=null,this.Mb=function(){return!1}}function ey(e,t){return Uy(e)?e.C.get(t.type):t.Hf}function ty(e,t){var n,i,r,a,o,s,u,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M,P,D,R,N,O,U,B,F,j,G,H,V,W;return L(function(L){switch(L.g){case 1:if(t.stream.isAudioMuxedInVideo)return L.return();for(n=[],i=l(t.S()),r=i.next();!r.done;r=i.next())a=r.value,o=new re(a),s=o.g,t.gf&&(0<=t.Xb&&s.add("_HLS_msn",String(t.Xb)),0<=t.Yb&&s.add("_HLS_part",String(t.Yb))),t.hf&&s.add("_HLS_skip","YES"),be(s)&&ue(o,le(s.toString())),n.push(o.toString());return S(L,2),_(L,Ny(e,n,!0).promise,4);case 4:u=L.h,A(L,3);break;case 2:throw c=E(L),e.h&&e.h.disableStream(t.stream),c;case 3:if(!t.stream.segmentIndex)return L.return();if(1!=(d=Kv(e.gb,u.data)).type)throw new Ce(2,4,4017);return(p=u.uri)==u.originalUri||t.S().includes(p)||t.Xf.push(p),f=Bv(d.ka,"EXT-X-DEFINE"),g=oy(e,f,p),m=t.stream,v=ey(e,t),_(L,wy(e,d,m.mimeType,t.S,g),5);case 5:for(y=L.h,b=y.keyIds,T=y.drmInfos,x=y.encrypted,C=y.Ai,m.encrypted||!x||C||(m.encrypted=!0),function(e,t){return e.size===t.size&&[].concat(h(e)).every(function(e){return t.has(e)})}(m.keyIds,b)||(m.keyIds=b,m.drmInfos=T,e.h.newDrmInfo(m)),k=My(e,d,v,g,t.S,t.type),I=k.segments,(M=k.bandwidth)&&(m.bandwidth=M),P=$u(m),D=l(I),R=D.next();!R.done;R=D.next())(N=R.value).ea&&(N.ea.Id=P);m.segmentIndex.re(I,e.l.Lb()),I.length&&(O=Gv(d.ka,"EXT-X-MEDIA-SEQUENCE",0),B=(U=jv(d.ka,"EXT-X-SKIP"))?Number(Rv(U,"SKIPPED-SEGMENTS")):0,F=by(O,I),j=F.Xb,G=F.Yb,t.Xb=j+B,t.Yb=G,H=v.get(O),m.segmentIndex.hb(H)),(V=Vu(m.segmentIndex))&&(t.kd=V.startTime,W=I[I.length-1],t.wc=W.endTime),jv(d.ka,"EXT-X-ENDLIST")&&(t.ie=!0),Ay(e,d),Iy(e,d.ka,m.type,g,t.S),w(L)}})}function ny(e,t,n){n=void 0!==n&&n;for(var i=-1==e.K,r=l(t),a=r.next();!a.done;a=r.next()){var o=(a=a.value).stream.segmentIndex,s=ey(e,a);if(o=Vu(o))for(var u=(s=l(s)).next();!u.done;u=s.next()){var h=(u=l(u.value)).next().value;if(u.next().value==o.startTime){i&&(e.K=Math.max(e.K,h)),a.Ug=h;break}}}if(!(0>e.K))for(i=(t=l(t)).next();!i.done;i=t.next())(vy(e,(i=i.value).type)||n)&&(r=i.stream.segmentIndex)&&0<(a=e.K-i.Ug)&&(r.g.splice(0,a),r=Vu(r))&&(r=-r.startTime,i.stream.segmentIndex.offset(r),iy(e,i,r))}function iy(e,t,n){if(!(.001>Math.abs(n))){t.kd+=n,t.wc+=n;for(var i=l(e=ey(e,t)),r=i.next();!r.done;r=i.next()){var a=l(r.value);r=a.next().value,a=a.next().value,e.set(r,a+n)}t.S()}}function ry(e,t,n){var i,r,a,o,s;return L(function(u){switch(u.g){case 1:return t?(i=ta,r=ml(t.S(),t.Kc(),t.Ic(),e.g.retryParameters),_(u,Fy(e,r,i,{type:t instanceof Jo?1:0}).promise,2)):u.return({mimeType:null,data:null});case 2:if(a=u.h,o=a.data,!t.aesKey){u.A(3);break}return _(u,gl(o,t.aesKey,n),4);case 4:o=u.h;case 3:return t instanceof Jo?t.Be(o,!0):t.Be(o),(s=a.headers["content-type"])&&(s=s.split(";")[0].toLowerCase()),u.return({mimeType:s,data:o})}})}function ay(e){if(Uy(e)){if(e.ua==Qy){for(var t=1/0,n=1/0,i=l(e.i.values()),r=i.next();!r.done;r=i.next())(r=r.value).stream.segmentIndex&&"text"!=r.stream.type&&!r.stream.isAudioMuxedInVideo&&(t=Math.min(t,r.wc),n=Math.min(n,r.kd));t=t-n||0,isNaN(e.g.availabilityWindowOverride)||(t=e.g.availabilityWindowOverride),e.l.fg(t)}}else e.l.wb(fy(e));if(!e.l.s)for(n=(t=l(e.i.values())).next();!n.done;n=t.next())!(n=n.value).stream.segmentIndex||"audio"!=n.type&&"video"!=n.type||(n=Vu(n.stream.segmentIndex))&&n.h&&e.l.ai(n.h);e.l.Gf()}function oy(e,t,n){n=new re(n).g;for(var i=new Map,r=(t=l(t)).next();!r.done;r=t.next()){var a=r.value,o=Rv(a,"NAME"),s=Rv(a,"VALUE");r=Rv(a,"QUERYPARAM"),a=Rv(a,"IMPORT"),o&&s&&(i.has(o)||i.set(o,s)),r&&(o=n.get(r)[0])&&!i.has(o)&&i.set(r,o),a&&(r=e.B.get(a))&&i.set(a,r)}return i}function sy(e){var t=new Set([xi(e.mimeType,e.codecs)]);e.segmentIndex&&e.segmentIndex.Ib(function(n){n.mimeType&&t.add(xi(n.mimeType,e.codecs))}),e.fullMimeTypes=t}function uy(e,t,n){for(var i={audio:[],video:[]},r=new Map,a=[],o=!1,s=!1,u=l(t),c=u.next();!c.done;c=u.next()){var d=c.value;c=Rv(d,"AUDIO");var p=Rv(d,"VIDEO"),f=c||p;f&&(a.includes(f)||a.push(f),(d=Rv(d,"PATHWAY-ID"))&&r.set(f,d),c?o=!0:p&&(s=!0))}a.length&&n.length&&function(e,t,n){t=t.filter(function(e){var t=Rv(e,"URI")||"";return"SUBTITLES"!=(e=Rv(e,"TYPE"))&&(""!=t||"AUDIO"==e)});for(var i={},r=(t=l(t)).next();!r.done;r=t.next()){var a=Lv(r=r.value,!e.j);i[a]?i[a].push(r):i[a]=[r]}for(var o in i)cy(e,i[o],n,!1)}(e,n=n.filter(function(e){return a.includes(Nv(e,"GROUP-ID"))}),r),n=(r=a.sort().join(","))&&e.J.has(r)?e.J.get(r):[],o?i.audio.push.apply(i.audio,h(n)):s&&i.video.push.apply(i.video,h(n)),o=!1;var g=t.map(function(e){return Nv(e,"URI")});return c=i.audio.find(function(e){return e&&e.S().find(function(e){return g.includes(e)})}),n=et("video",s=ly(e,t[0])),(u=et("audio",s))&&!n?(c="audio",o=0>3)&&e.Oa()&&(n=32+((7&t)<<3)+((224&e.aa())>>5)),i+="."+n)),s.push(i),h=!0}).box("ac-3",r).box("ec-3",r).box("ac-4",r).box("Opus",r).box("fLaC",r).box("apac",r).box("avc1",i).box("avc3",i).box("hev1",i).box("hvc1",i).box("dva1",i).box("dvav",i).box("dvh1",i).box("dvhe",i).box("vp09",i).box("av01",i).box("avcC",function(e){var t=o||"";switch(o){case"dvav":t="avc3";break;case"dva1":t="avc1"}(e=e.reader).skip(1),e=t+"."+vo(e.aa())+vo(e.aa())+vo(e.aa()),u.push(e),c=!0}).box("hvcC",function(e){var t=o||"";switch(o){case"dvh1":t="hvc1";break;case"dvhe":t="hev1"}var n=e.reader;n.skip(1);var i=["","A","B","C"][(e=n.aa())>>6],r=31&e,a=n.W(),s=(32&e)>>5?"H":"L";e=[n.aa(),n.aa(),n.aa(),n.aa(),n.aa(),n.aa()],n=n.aa();for(var l=0,h=0;32>h&&(l|=1&a,31!=h);h++)l<<=1,a>>=1;for(t=t+"."+i+r+"."+vo(l,!0),t+="."+s+n,i="",r=e.length;r--;)((s=e[r])||i)&&(i="."+s.toString(16).toUpperCase()+i);t+=i,u.push(t),c=!0}).box("dvcC",function(e){var t=o||"";switch(o){case"hvc1":t="dvh1";break;case"hev1":t="dvhe";break;case"avc1":t="dva1";break;case"avc3":t="dvav";break;case"av01":t="dav1"}var n=e.reader;n.skip(2),e=n.aa(),n=n.aa(),u.push(t+"."+yo(e>>1&127)+"."+yo(e<<5&32|n>>3&31)),c=!0}).box("dvvC",function(e){var t=o||"";switch(o){case"hvc1":t="dvh1";break;case"hev1":t="dvhe";break;case"avc1":t="dva1";break;case"avc3":t="dvav";break;case"av01":t="dav1"}var n=e.reader;n.skip(2),e=n.aa(),n=n.aa(),u.push(t+"."+yo(e>>1&127)+"."+yo(e<<5&32|n>>3&31)),c=!0}).V("vpcC",function(e){var t=o||"",n=e.reader;e=n.aa();var i=n.aa();n=n.aa()>>4&15,u.push(t+"."+yo(e)+"."+yo(i)+"."+yo(n)),c=!0}).box("av1C",function(e){var t=o||"";"dav1"===o&&(t="av01");var n=e.reader;n.skip(1);var i=(e=n.aa())>>>5,r=(64&(n=n.aa()))>>6;u.push(t+"."+i+"."+yo(31&e)+(n>>>7?"H":"M")+"."+yo(2===i&&r?(32&n)>>5?12:10:r?10:8)+"."+((16&n)>>4)+"."+((8&n)>>3)+((4&n)>>2)+(3&n)+"."+yo(1)+"."+yo(1)+"."+yo(1)+".0"),c=!0}).box("enca",ga).box("encv",fa).box("sinf",da).box("frma",function(e){a(e=mo(e.reader).codec)}).box("colr",function(e){u=u.map(function(t){if(t.startsWith("av01.")){var n=e.reader,i=n.Ua(),r=n.Zb(4),a=String.fromCharCode(r[0]);if(a+=String.fromCharCode(r[1]),a+=String.fromCharCode(r[2]),"nclx"===(a+=String.fromCharCode(r[3]))){r=n.Ga(),a=n.Ga();var o=n.Ga(),s=n.aa()>>7,u=t.split(".");10==u.length&&(u[6]=yo(r),u[7]=yo(a),u[8]=yo(o),u[9]=String(s),t=u.join("."))}n.seek(i)}return t});var t=function(e){var t=null,n=null,i=e.Zb(4),r=String.fromCharCode(i[0]);if(r+=String.fromCharCode(i[1]),r+=String.fromCharCode(i[2]),"nclx"===(r+=String.fromCharCode(i[3]))){switch(e.Ga()){case 1:case 5:case 6:case 7:t="srgb";break;case 9:t="rec2020";break;case 11:case 12:t="p3"}switch(i=e.Ga(),e.Ga(),i){case 1:case 6:case 13:case 14:case 15:n="SDR";break;case 16:n="PQ";break;case 18:n="HLG"}}return{colorGamut:t,Ie:n}}(e.reader),n=t.colorGamut;v=t.Ie,y=n}).parse(e||t,!0,!0),!s.length&&!u.length)return null;var b=h&&!c,_=new Map;if(c&&!n){n=new Vt("video/mp4"),e&&n.init(e);try{n.Rf(t);for(var w=l(n.xg()),S=w.next();!S.done;S=w.next()){var T=S.value;_.set(T,T)}}catch(e){}n.Wd()}return{type:b?"audio":"video",mimeType:b?"audio/mp4":"video/mp4",codecs:fl(s.concat(u)).join(", "),language:d,height:p,width:f,channelCount:g,sampleRate:m,closedCaptions:_,Ie:v,colorGamut:y,frameRate:null}}(f,g,e.g.disableText)))return S.return(w);return p?S.return(pl(p)):S.return(n)})}(e,k),3);case 3:O=t.h,o!=O.type&&Uy(e)&&(e.C.set(O.type,e.C.get(o)),e.C.set(o,new Map)),o=O.type,s=O.language,c=O.channelCount,g=O.sampleRate,e.g.disableText||(d=O.closedCaptions),P=O.height,M=O.width,D=O.Ie,R=O.colorGamut,N=O.frameRate,b&&(v=O.mimeType,a=O.codecs);case 2:if(v){t.A(4);break}return _(t,function(e,t,n,i){var r,a,o,s,u,l,h,c,d,p,f,g,m;return L(function(v){switch(v.g){case 1:return r=ta,a=Dy(e,i),2==(o=a.segment).status?v.return(Ly(t)):(s=o.S(),u=new re(s[0]),l=u.vb.split(".").pop(),h=Yy.get(t),(c=h.get(l))||(c=Vy.get(l))||(c=Py(t,n))?v.return(c):(p=1,f=Zr(s,e.g.retryParameters),S(v,2),f.method="HEAD",_(v,Fy(e,f,r,{type:p}).promise,4)));case 4:g=v.h,d=g.headers["content-type"],A(v,3);break;case 2:if(!(m=E(v))||1002!=m.code&&1001!=m.code){v.A(3);break}return f.method="GET",e.g.hls.allowRangeRequestsToGuessMimeType&&(f.headers.Range="bytes=0-0"),_(v,Fy(e,f,r,{type:p}).promise,6);case 6:g=v.h,d=g.headers["content-type"];case 3:if(!d){v.A(7);break}if("application/octet-stream"!=(c=d.toLowerCase().split(";")[0])){v.A(8);break}if(g.data.byteLength){v.A(9);break}return f.method="GET",_(v,Fy(e,f,r,{type:p}).promise,10);case 10:g=v.h;case 9:Fs(Te(g.data))&&(c="video/mp2t");case 8:if("application/octet-stream"!=c)return v.return(c);case 7:return v.return(Ly(t))}})}(e,o,a,k),5);case 5:v=t.h,o!=nt||a||"application/mp4"!=v||!k[0]||k[0].ea||(v="text/vtt");case 4:return _(t,wy(e,i,v,r,n),6);case 6:if(U=t.h,B=U.drmInfos,F=U.keyIds,j=U.encrypted,G=U.Ai,j&&!B.length&&!G)throw new Ce(2,4,4026);return(H=_y(e,a,o,s,u,h,c,d,p,f,g,m)).encrypted=j&&!G,H.drmInfos=B,H.keyIds=F,H.mimeType=v,I&&(H.bandwidth=I),sy(H),"video"==o&&(M||P||D||R)&&Ry(H,M,P,N,D,null,R),Uy(e)&&Ay(e,i),V=k[0].startTime,W=k[k.length-1],z=W.endTime,K=new Hu(k),H.segmentIndex=K,Y=!!(X=jv(i.ka,"EXT-X-SERVER-CONTROL"))&&null!=Dv(X,"CAN-SKIP-UNTIL"),q=!!X&&null!=Dv(X,"CAN-BLOCK-RELOAD"),Z=Gv(i.ka,"EXT-X-MEDIA-SEQUENCE",0),J=by(Z,k),Q=J.Xb,$=J.Yb,t.return({stream:H,type:o,Xf:[],S:r,kd:V,wc:z,hf:Y,gf:q,ie:!1,Ug:-1,Xb:Q,Yb:$,Hf:x})}})}function by(e,t){e=e+t.length-1;var n=-1;if(!t.length)return{Xb:++e,Yb:n};var i=(t=t[t.length-1]).g;return t.g.length?(n=i.length-1,i[i.length-1].isPreload()||(e++,n=0),{Xb:e,Yb:n}):(e++,t.m&&(n=0),{Xb:e,Yb:n})}function _y(e,t,n,i,r,a,o,s,u,h,c,d){var p=Py(n,t)||Ly(n),f=[];if(u)for(var g=(u=l(u.split(","))).next();!g.done;g=u.next())f.push(g.value);return u=void 0,g=null,n==nt?u=f.includes("public.accessibility.transcribes-spoken-dialog")&&f.includes("public.accessibility.describes-music-and-sound")?"caption":"subtitle":f.includes("public.accessibility.describes-video")&&(g="visually impaired"),f.length||"subtitle"!==u||f.push("subtitle"),sy(e={id:e.G++,originalId:a,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:null,mimeType:p,codecs:t,kind:n==nt?"subtitle":void 0,encrypted:!1,drmInfos:[],keyIds:new Set,language:ht(i||"und"),originalLanguage:i,label:a,type:n,primary:r,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,frameRate:void 0,pixelAspectRatio:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:f,forced:h,channelsCount:o,audioSamplingRate:c,spatialAudio:d,closedCaptions:s,hdr:void 0,colorGamut:void 0,videoLayout:void 0,tilesLayout:void 0,accessibilityPurpose:g,external:!1,fastSwitching:!1,fullMimeTypes:new Set,isAudioMuxedInVideo:!1,baseOriginalId:null}),e}function wy(e,t,n,i,r){var a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S,T,A,E,x,C,k,I,M,P,D,R,N,O;return L(function(L){switch(L.g){case 1:if(a=new Map,!e.g.ignoreDrmInfo&&t.segments)for(o=l(t.segments),s=o.next();!s.done;s=o.next())if(u=s.value,h=Bv(u.ka,"EXT-X-KEY"),c=null,h.length)for(c=xy(e,t,u.ka,i,r),d=l(h),p=d.next();!p.done;p=d.next())f=p.value,a.set(f,c);m=g=!1,v=[],y=new Set,b=l(a),w=b.next();case 2:if(w.done){L.A(4);break}if(S=w.value,T=l(S),A=T.next().value,E=T.next().value,C=E,"NONE"==(k=Nv(x=A,"METHOD"))){L.A(3);break}if(g=!0,I=Rv(x,"KEYFORMAT")||"identity",M=null,jy(k)){m=!0,L.A(3);break}if("identity"==I)return _(L,Gy(e,x,n,i,C,r),11);if(!(P=e.fc.get(I))){D=null,L.A(9);break}return _(L,P(x,n,C),10);case 10:D=L.h;case 9:M=D,L.A(6);break;case 11:M=L.h;case 6:if(M){if(M.keyIds)for(R=l(M.keyIds),N=R.next();!N.done;N=R.next())O=N.value,y.add(O);v.push(M)}case 3:w=b.next(),L.A(2);break;case 4:return L.return({drmInfos:v,keyIds:y,encrypted:g,Ai:m})}})}function Sy(t,n,i,r,a){if(!e.crypto||!e.crypto.subtle)throw Y("Web Crypto API is not available to decrypt AES. (Web Crypto only exists in secure origins like https)"),new Ce(2,4,4042);var o=0,s=Rv(n,"IV","");if(s){var u=Xe(s.substr(2));if(16!=u.byteLength)throw new Ce(2,4,4048)}else o=Gv(i.ka,"EXT-X-MEDIA-SEQUENCE",0);var l=Hv(r(),Nv(n,"URI"),a),h=l.sort().join("");if(i=n.toString()+"-"+o+"-"+h,!t.ba.has(i)){var c={bitsKey:128,blockCipherMode:"CBC",iv:u,firstMediaSequenceNumber:o};switch(Nv(n,"METHOD")){case"AES-256":c.bitsKey=256;break;case"AES-256-CTR":c.bitsKey=256,c.blockCipherMode="CTR"}c.fetchKey=function(){var n,i,r,a;return L(function(o){if(1==o.g)return t.L.has(h)||(n=Zr(l,t.g.retryParameters),i=Fy(t,n,6).promise,t.L.set(h,i)),_(o,t.L.get(h),2);if(3!=o.g){if(!(r=o.h).data||r.data.byteLength!=c.bitsKey/8)throw new Ce(2,4,4049);return a={name:"CTR"==c.blockCipherMode?"AES-CTR":"AES-CBC",length:c.bitsKey},_(o,e.crypto.subtle.importKey("raw",r.data,a,!0,["decrypt"]),3)}c.cryptoKey=o.h,c.fetchKey=void 0,w(o)})},t.ba.set(i,c)}return t.ba.get(i)}function Ty(e,t){null==e.u&&(t=jv(t.ka,"EXT-X-START"))&&(e.u=Number(Nv(t,"TIME-OFFSET")))}function Ay(e,t){var n=1/0,i=t.segments;if(i.length)for(var r=i.length-1;0<=r;){var a=jv(i[r].ka,"EXTINF");if(a){n=Number(a.value.split(",")[0]);break}r--}if(!(i=jv(t.ka,"EXT-X-TARGETDURATION")))throw new Ce(2,4,4024,"EXT-X-TARGETDURATION");i=Number(i.value),(r=jv(t.ka,"EXT-X-PART-INF"))&&(e.O=Number(Nv(r,"PART-TARGET"))),t=jv(t.ka,"EXT-X-SERVER-CONTROL"),e.$&&e.O?(e.s=e.ic?5*e.O<=n?Math.min(e.O,e.s):Math.min(n,e.s):Math.min(e.O,e.s),e.La=t?Number(Nv(t,"PART-HOLD-BACK")):0):(e.s=Math.min(n,e.s),n=t?Dv(t,"HOLD-BACK"):null,e.Ia=n?Number(n.value):0),e.Na=Math.max(i,e.Na)}function Ey(e,t){var n=0;if(e.g.defaultPresentationDelay)n=e.g.defaultPresentationDelay;else if(e.La)n=e.La;else if(e.Ia)n=e.Ia;else for(var i=t.segments.length,r=i-Math.min(i,e.g.hls.liveSegmentsDelay);re.u&&(n=Math.min(-e.u,n),e.u+=n),e.l.Ij(0),e.l.Zh(n),e.l.pd(!1)}function xy(e,t,n,i,r){var a=jv(n,"EXT-X-MAP");if(!a)return null;var o=Nv(a,"URI"),s=Hv(i(),o,r);if(o=[s.toString(),Rv(a,"BYTERANGE","")].join("-"),!e.sa.has(o)){for(var u=void 0,h=null,c=!1,d=(n=l(n)).next();!d.done;d=n.next())"EXT-X-KEY"==(d=d.value).name?jy(c=Nv(d,"METHOD"))&&d.idt?1:0}),n=0;n(h=d-a))continue}if(null==h){var p=Rv(o,"DURATION")||Rv(o,"PLANNED-DURATION");if(p){var f=parseFloat(p);if(isNaN(f)||(h=u+f),0>s-a+f)continue}}var g=Rv(o,"CLASS")||"com.apple.quicktime.HLS",m="YES"==Rv(o,"END-ON-NEXT");if(null==h&&m){for(var v=n+1;vs){h=Math.max(0,y-a);break}}if(null==h)continue}v=["CLASS","START-DATE","END-DATE","DURATION","END-ON-NEXT"];for(var b=[],_=l(o.attributes),w=_.next();!w.done;w=_.next()){var S=w.value;if(!v.includes(S.name)){var T=Wv(S.value,i);"X-ASSET-URI"!=S.name&&"X-ASSET-LIST"!=S.name||(T=Hv(r(),S.value,i)[0]),b.push({key:S.name,description:"",data:T,mimeType:null,pictureType:null})}}1C)if(k){if(null==(k=An(k,"t",Dn)))break;if(I>=k)break;C=Math.ceil((k-I)/M)-1}else{if(1/0==S)break;if(I/y>=S)break;C=Math.ceil((S*y-I)/M)-1}for(k=0;k<=C;++k)E=I+M,A.push({start:I/y,end:E/y,ri:I}),I=E}for(y=A,S=(b=l(b)).next();!S.done;S=b.next())(S=rb(e,v,S.value,y,g,c))&&("audio"!=S.type||e.g.disableAudio?"video"!=S.type||e.g.disableVideo?S.type!=nt||e.g.disableText||d.push(S):p.push(S):m.push(S))}for(f=[],g=(m=l(0>1,n[1]=i<<7|t<<3|e>>1,n[2]=e<<7|8,n[3]=0,(t=new Uint16Array(2))[0]=(n[0]<<8)+n[1],t[1]=(n[2]<<8)+n[3],t[0].toString(16)+t[1].toString(16)):((n=new Uint8Array(2))[0]=16|i>>1,n[1]=i<<7|t<<3,(t=new Uint16Array(1))[0]=(n[0]<<8)+n[1],t[0].toString(16))}(n,o,r,v),v.mssPrivateData.codecPrivateData=n,o){case"audio":if(!n)return Y("Quality unsupported without CodecPrivateData",o),null;v.type="audio",v.mimeType="mss/audio/mp4",v.codecs=function(e,t){var n=0;return"AACH"===e&&(n=5),t?0===n&&(n=(248&parseInt(t.substr(0,2),16))>>3):(n=2,"AACH"===e&&(n=5)),"mp4a.40."+n}(r,n);break;case"video":if(!n)return Y("Quality unsupported without CodecPrivateData",o),null;v.type="video",v.mimeType="mss/video/mp4",v.codecs=function(e){var t=/00000001[0-9]7/.exec(e);return t.length&&e?"avc1."+e.substr(e.indexOf(t[0])+10,6):""}(n);break;case"text":v.type=nt,v.mimeType="application/mp4",("TTML"===r||"DFXP"===r)&&(v.codecs="stpp")}return v.fullMimeTypes.add(xi(v.mimeType,v.codecs)),v.createSegmentIndex=function(){if(v.segmentIndex)return Promise.resolve();if(e.m.has(v.id))var n=e.m.get(v.id);else n=[],"video"==v.type&&(n=v.mssPrivateData.codecPrivateData.split("00000001").slice(1)),n=_o(new bo([n={id:v.id,type:v.type,codecs:v.codecs,encrypted:v.encrypted,timescale:v.mssPrivateData.timescale,duration:v.mssPrivateData.duration,Eb:n,Ma:new Uint8Array([]),Wa:new Uint8Array([]),cb:0,fb:0,data:null,stream:v}])),e.m.set(v.id,n);return n=function(e,t,n,i,r){var a=i.attributes.Url.replace("{bitrate}",String(n.bandwidth));i=[];for(var o=(r=l(r)).next(),s={};!o.done;s={kg:void 0},o=r.next())s.kg=o.value,i.push(new Jo(s.kg.start,s.kg.end,function(t){return function(){return Ze(e.l,[a.replace("{start time}",String(t.kg.ri))])}}(s),0,null,t,0,0,n.mssPrivateData.duration));return i}(e,new qo(function(){return[]},0,null,$u(v),v.mssPrivateData.timescale,n,null,v.encrypted),v,t,i),v.segmentIndex=new Hu(n),Promise.resolve()},v.closeSegmentIndex=function(){v.segmentIndex&&(v.segmentIndex.release(),v.segmentIndex=null)},v}(i=nb.prototype).configure=function(e,t){this.g=e,t&&(this.B=t)},i.start=function(e,t){var n=this;return L(function(i){if(1==i.g)return n.l=[e],n.h=t,_(i,ib(n),2);if(!n.h)throw new Ce(2,7,7001);return i.return(n.j)})},i.stop=function(){return this.g=this.h=null,this.l=[],this.j=null,null!=this.s&&(this.s.stop(),this.s=null),this.m.clear(),this.C.destroy()},i.update=function(){var e,t=this;return L(function(n){return 1==n.g?(S(n,2),_(n,ib(t),4)):2!=n.g?A(n,0):(e=E(n),t.h&&e?(t.h.onError(e),void w(n)):n.return())})},i.onExpirationUpdated=function(){},i.onInitialVariantChosen=function(){},i.banLocation=function(){},i.setMediaElement=function(){},H("shaka.mss.MssParser",nb);var ab="AAC AACL AACH AACP AVC1 H264 TTML DFXP".split(" "),ob=(new Map).set("CAPT","main").set("SUBT","alternate").set("DESC","main");function sb(e,t,n,i,r,a,o){if(200<=n&&299>=n&&202!=n||304==n)return{uri:r||i,originalUri:i,data:t,status:n,headers:e,fromCache:!!e["x-shaka-from-cache"],originalRequest:a};a=null;try{a=Ue(t)}catch(e){}throw new Ce(401==n||403==n?2:1,1,1001,i,n,a,e,o,r||i)}function ub(){}function lb(e,t,n,i,r,a){var o=new fb;oa(t.headers).forEach(function(e,t){o.append(t,e)});var s=new db,u={Fi:!1,Wj:!1};if(e=function(e,t,n,i,r,a,o,s,u){var l,h,c,d,p,f,g,m,v,y,b,T,x,C;return L(function(k){switch(k.g){case 1:return l=cb,h=pb,d=new ArrayBuffer(0),f=p=0,g={},m=Date.now(),S(k,2),_(k,l(e,i),4);case 4:if(c=k.h,g=function(e){var t={};return e.forEach(function(e,n){t[n.trim()]=e}),t}(c.headers),o(g),"HEAD"==i.method){k.A(5);break}return y=(v=c.headers.get("Content-Length"))?parseInt(v,10):0,c.body?(b=c.clone().body.getReader(),new h({start:function(e){!function t(){var n,i,r,o;return L(function(l){switch(l.g){case 1:return S(l,2),_(l,b.read(),4);case 4:n=l.h,A(l,3);break;case 2:return E(l),l.return();case 3:if(n.done){l.A(5);break}if(p+=n.value.byteLength,!s){l.A(5);break}return _(l,s(n.value),5);case 5:i=Date.now(),r=p-f,(100=u||n.done)&&(o=n.done?0:y-p,a(i-m,r,o),f=p,m=i),n.done?e.close():(e.enqueue(n.value),t()),w(l)}})}()}}),_(k,c.arrayBuffer(),8)):_(k,c.arrayBuffer(),9);case 8:d=k.h,k.A(5);break;case 9:d=k.h,T=Date.now(),a(T-m,d.byteLength,0);case 5:t.headers.Range&&2==(x=t.headers.Range.replace("bytes=","").split("-").filter(function(e){return e}).map(function(e){return parseInt(e,10)})).length&&d.byteLength!=x[1]-x[0]+1&&Y("Payload length does not match range requested bytes",t,c),A(k,3);break;case 2:if(C=E(k),r.Fi)throw new Ce(1,1,7001,e,n);if(r.Wj)throw new Ce(1,1,1003,e,n);throw new Ce(1,1,1002,e,C,n);case 3:return k.return(sb(g,d,c.status,e,c.url,t,n))}})}(e,t,n,{body:t.body||void 0,headers:o,method:t.method,signal:s.signal,credentials:t.allowCrossSiteCredentials?"include":void 0},u,i,r,t.streamDataCallback,a.minBytesForProgressEvents||0),e=new Fr(e,function(){return u.Fi=!0,s.abort(),Promise.resolve()}),t=t.retryParameters.timeout){var l=new zi(function(){u.Wj=!0,s.abort()});l.X(t/1e3),e.finally(function(){l.stop()})}return e}function hb(){if(!e.ReadableStream)return!1;try{new ReadableStream({})}catch(e){return!1}return!!e.Response&&!!new Response("").body&&!(!e.fetch||"polyfill"in e.fetch||!e.AbortController)}so("application/vnd.ms-sstr+xml",function(){return new nb}),H("shaka.net.HttpFetchPlugin",ub),ub.isSupported=hb,ub.parse=lb;var cb=e.fetch,db=e.AbortController,pb=e.ReadableStream,fb=e.Headers;function gb(){}function mb(e,t,n,i,r,a){var o=new vb,s=Date.now(),u=0;return new Fr(new Promise(function(h,c){o.open(t.method,e,!0),o.responseType="arraybuffer",o.timeout=t.retryParameters.timeout,o.withCredentials=t.allowCrossSiteCredentials;var d={};for(var p in o.onabort=function(){c(new Ce(1,1,7001,e,n))},o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.HEADERS_RECEIVED){for(var e=o.getAllResponseHeaders().trim().split("\r\n"),t={},n=(e=l(e)).next();!n.done;n=e.next())t[(n=n.value.split(": "))[0].toLowerCase()]=n.slice(1).join(": ");r(d=t)}},o.onload=function(r){var a=o.response;try{i(Date.now()-s,r.loaded-u,0);var l=sb(d,a,o.status,e,o.responseURL,t,n);h(l)}catch(e){c(e)}},o.onerror=function(t){c(new Ce(1,1,1002,e,t,n))},o.ontimeout=function(){c(new Ce(1,1,1003,e,n))},o.onprogress=function(e){var t=Date.now(),n=a.minBytesForProgressEvents||0,r=e.loaded-u;(100=n||e.lengthComputable&&e.loaded==e.total)&&(i(t-s,r,4==o.readyState?0:e.total-e.loaded),u=e.loaded,s=t)},t.headers)o.setRequestHeader(p.toLowerCase(),t.headers[p]);o.send(t.body)}),function(){return o.abort(),Promise.resolve()})}hb()&&(Yr("http",lb,2,!0),Yr("https",lb,2,!0),Yr("blob",lb,2,!0)),H("shaka.net.HttpXHRPlugin",gb),gb.parse=mb;var vb=e.XMLHttpRequest;function yb(e,t,n,i,r){this.g=e,this.i=t,this.groupId=n,this.h=i,this.j=r}function bb(e){var t=e.ec(!1);return t?ze(t):e.S().map(function(e){return"{"+encodeURI(e.split("#xywh=")[0])+"}"}).join("")+":"+e.startByte+":"+e.endByte}function _b(e,t){return ml(e.g.S(),e.g.startByte,e.g.endByte,t.streaming.retryParameters)}function wb(){this.g=this.j=this.i=0,this.h=new Map,this.l=0}function Sb(e,t){e.i+=t;var n=e.l;return e.l++,e.h.set(n,t),n}function Tb(e){return 0==e.i?0:e.j/e.i}function Ab(e){var t=this;this.u=e,this.i=new Map,this.h=new ra(function(){return Eb(t).catch(function(){})}),this.j=[],this.s=function(){},this.m=function(){},this.g=new wb,this.l=!1}function Eb(e){e.l=!0;var t=e.j.map(function(e){return e()});return e.j=[],Promise.all(t)}function xb(e,t,n,i,r,a){aa(e.h);var o=(e.i.get(t)||Promise.resolve()).then(function(){if(e.h.g)throw new Ce(2,9,7001);if(r){var t=Te(n);for(var o in(t=new Sa(t)).data){var s=Number(o);e.m(t.data[s],t.g[s])}}return e.g.close(i,n.byteLength),e.s(Tb(e.g),e.g.g),a(n)});e.i.set(t,o)}function Cb(e,t){var n=this;this.i=e,this.h=e.objectStore(t),this.g=new Br,e.onabort=function(e){e.preventDefault(),n.g.reject()},e.onerror=function(e){e.preventDefault(),n.g.reject()},e.oncomplete=function(){n.g.resolve()}}function kb(e,t){return new Promise(function(n,i){var r=e.h.openCursor();r.onerror=i,r.onsuccess=function(){var e;return L(function(i){if(1==i.g)return null==r.result?(n(),i.return()):(e=r.result,_(i,t(e.key,e.value,e),2));e.continue(),w(i)})}})}function Ib(e){this.h=e,this.g=[]}function Mb(e,t){return Pb(e,t,"readwrite")}function Pb(e,t,n){var i=new Cb(n=e.h.transaction([t],n),t);return e.g.push(i),i.promise().then(function(){Qt(e.g,i)},function(){Qt(e.g,i)}),i}function Lb(e,t,n){this.h=new Ib(e),this.i=t,this.g=n}function Db(e){return Promise.reject(new Ce(2,9,9011,"Cannot add new value to "+e))}function Rb(e,t,n,i){t=(e=Mb(e.h,t)).store();for(var r=(n=l(n)).next(),a={};!r.done;a={Eh:void 0},r=n.next())a.Eh=r.value,t.delete(a.Eh).onsuccess=function(e){return function(){return i(e.Eh)}}(a);return e.promise()}function Nb(e,t,n){var i,r,a,o,s,u,h;return L(function(c){if(1==c.g){for(i=Pb(e.h,t,"readonly"),r=i.store(),a={},o=[],s=l(n),u=s.next(),h={};!u.done;h={Zf:void 0,Cf:void 0},u=s.next())h.Cf=u.value,h.Zf=r.get(h.Cf),h.Zf.onsuccess=function(e){return function(){null==e.Zf.result&&o.push(e.Cf),a[e.Cf]=e.Zf.result}}(h);return _(c,i.promise(),2)}if(o.length)throw new Ce(2,9,9012,"Could not find values for "+o);return c.return(n.map(function(e){return a[e]}))})}function Ob(e){this.g=new Ib(e)}function Ub(){this.g=new Map}function Bb(e){var t=null;if(e.g.forEach(function(e,n){e.getCells().forEach(function(e,i){e.hasFixedKeySpace()||t||(t={path:{Wb:n,ib:i},ib:e})})}),t)return t;throw new Ce(2,9,9013,"Could not find a cell that supports add-operations")}function Fb(e,t,n){if(!(e=e.g.get(t)))throw new Ce(2,9,9013,"Could not find mechanism with name "+t);if(!(t=e.getCells().get(n)))throw new Ce(2,9,9013,"Could not find cell with name "+n);return t}function jb(e,t){Gb.set(e,t)}Yr("http",mb,1,!0),Yr("https",mb,1,!0),Yr("blob",mb,1,!0),wb.prototype.close=function(e,t){if(this.h.has(e)){var n=this.h.get(e);this.h.delete(e),this.j+=n,this.g+=t}},Ab.prototype.destroy=function(){return this.h.destroy()},Ab.prototype.queue=function(e,t,n,i,r){var a=this;aa(this.h);var o=(this.i.get(e)||Promise.resolve()).then(function(){var e,o,s,u,l,h,c;return L(function(d){if(1==d.g)return _(d,function(e,t){var n,i,r,a;return L(function(o){return 1==o.g?(n=ta,i=e.u.request(n,t),r=function(){return i.abort()},e.j.push(r),_(o,i.promise,2)):(a=o.h,Qt(e.j,r),o.return(a.data))})}(a,t),2);if(e=d.h,a.h.g)throw new Ce(2,9,7001);if(i)for(u in o=Te(e),(s=new Sa(o)).data)l=Number(u),h=s.data[l],c=s.g[l],a.m(h,c);return a.g.close(n,e.byteLength),a.s(Tb(a.g),a.g.g),d.return(r(e))})});return this.i.set(e,o),o},Cb.prototype.abort=function(){var e=this;return L(function(t){if(1==t.g){try{e.i.abort()}catch(e){}return S(t,2),_(t,e.g,4)}if(2!=t.g)return A(t,0);E(t),w(t)})},Cb.prototype.store=function(){return this.h},Cb.prototype.promise=function(){return this.g},Ib.prototype.destroy=function(){return Promise.all(this.g.map(function(e){return e.abort()}))},(i=Lb.prototype).destroy=function(){return this.h.destroy()},i.hasFixedKeySpace=function(){return!0},i.addSegments=function(){return Db(this.i)},i.removeSegments=function(e,t){return Rb(this,this.i,e,t)},i.getSegments=function(e){var t,n=this;return L(function(i){return 1==i.g?_(i,Nb(n,n.i,e),2):(t=i.h,i.return(t.map(function(e){return n.Ki(e)})))})},i.addManifests=function(){return Db(this.g)},i.updateManifest=function(){return Promise.reject(new Ce(2,9,9016,"Cannot modify values in "+this.g))},i.updateManifestExpiration=function(e,t){var n=Mb(this.h,this.g),i=n.store();return i.get(e).onsuccess=function(n){(n=n.target.result)&&(n.expiration=t,i.put(n,e))},n.promise()},i.removeManifests=function(e,t){return Rb(this,this.g,e,t)},i.getManifests=function(e){var t,n=this;return L(function(i){return 1==i.g?_(i,Nb(n,n.g,e),2):(t=i.h,i.return(Promise.all(t.map(function(e){return n.$d(e)}))))})},i.getAllManifests=function(){var e,t,n=this;return L(function(i){return 1==i.g?(e=Pb(n.h,n.g,"readonly"),t=new Map,_(i,kb(e,function(e,i){var r;return L(function(a){if(1==a.g)return _(a,n.$d(i),2);r=a.h,t.set(e,r),w(a)})}),2)):3!=i.g?_(i,e.promise(),3):i.return(t)})},i.Ki=function(e){return e},i.$d=function(e){return Promise.resolve(e)},i.add=function(e,t){var n,i,r,a,o,s,u,h=this;return L(function(c){if(1==c.g){for(n=Mb(h.h,e),i=n.store(),r=[],a=l(t),o=a.next(),s={};!o.done;s={Rh:void 0},o=a.next())u=o.value,s.Rh=i.add(u),s.Rh.onsuccess=function(e){return function(){r.push(e.Rh.result)}}(s);return _(c,n.promise(),2)}return c.return(r)})},Ob.prototype.destroy=function(){return this.g.destroy()},Ob.prototype.getAll=function(){var e,t,n=this;return L(function(i){return 1==i.g?(e=Pb(n.g,"session-ids","readonly"),t=[],_(i,kb(e,function(e,n){t.push(n)}),2)):3!=i.g?_(i,e.promise(),3):i.return(t)})},Ob.prototype.add=function(e){for(var t=Mb(this.g,"session-ids"),n=t.store(),i=(e=l(e)).next();!i.done;i=e.next())n.add(i.value);return t.promise()},Ob.prototype.remove=function(e){var t,n=this;return L(function(i){return 1==i.g?_(i,kb(t=Mb(n.g,"session-ids"),function(t,n,i){e.includes(n.sessionId)&&i.delete()}),2):_(i,t.promise(),0)})},Ub.prototype.destroy=function(){for(var e=[],t=l(this.g.values()),n=t.next();!n.done;n=t.next())e.push(n.value.destroy());return this.g.clear(),Promise.all(e)},Ub.prototype.init=function(){var e=this;Gb.forEach(function(t,n){(t=t())&&e.g.set(n,t)});for(var t=[],n=l(this.g.values()),i=n.next();!i.done;i=n.next())t.push(i.value.init());return Promise.all(t)},H("shaka.offline.StorageMuxer",Ub),Ub.unregister=function(e){Gb.delete(e)},Ub.register=jb,Ub.prototype.destroy=Ub.prototype.destroy;var Gb=new Map;function Hb(){Lb.apply(this,arguments)}function Vb(e,t){!function(e){var t=e.streams.filter(function(e){return"audio"==e.contentType});if(e=e.streams.filter(function(e){return"video"==e.contentType}),!t.every(function(e){return e.variantIds})||!e.every(function(e){return e.variantIds})){for(var n=l(t),i=n.next();!i.done;i=n.next())i.value.variantIds=[];for(i=(n=l(e)).next();!i.done;i=n.next())i.value.variantIds=[];if(n=0,e.length&&!t.length){i=n++;for(var r=l(e),a=r.next();!a.done;a=r.next())a.value.variantIds.push(i)}if(!e.length&&t.length)for(i=n++,a=(r=l(t)).next();!a.done;a=r.next())a.value.variantIds.push(i);if(e.length&&t.length)for(i=(t=l(t)).next();!i.done;i=t.next())for(i=i.value,a=(r=l(e)).next();!a.done;a=r.next()){a=a.value;var o=n++;i.variantIds.push(o),a.variantIds.push(o)}}}(e);for(var n=l(e.streams),i=n.next();!i.done;i=n.next());return e.streams.map(function(n){return function(e,t,n){var i=e.initSegmentUri?Wb(e.initSegmentUri):null,r=t+e.presentationTimeOffset,a=t+n;return{id:e.id,originalId:null,groupId:null,primary:e.primary,type:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:void 0,hdr:void 0,colorGamut:void 0,videoLayout:void 0,kind:e.kind,language:e.language,originalLanguage:e.language||null,label:e.label,width:e.width,height:e.height,initSegmentKey:i,encrypted:e.encrypted,keyIds:new Set([e.keyId]),segments:e.segments.map(function(e){var n=Wb(e.uri);return{startTime:t+e.startTime,endTime:t+e.endTime,dataKey:n,initSegmentKey:i,appendWindowStart:t,appendWindowEnd:a,timestampOffset:r,tilesLayout:"",mimeType:null,codecs:null,thumbnailSprite:null}}),variantIds:e.variantIds,roles:[],forced:!1,audioSamplingRate:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,tilesLayout:void 0,external:!1,fastSwitching:!1,isAudioMuxedInVideo:!1}}(n,e.startTime,t)})}function Wb(e){var t;if((t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(e))||(t=/^offline:segment\/([0-9]+)$/.exec(e)))return Number(t[1]);throw new Ce(2,9,9004,"Could not parse uri "+e)}function zb(){Lb.apply(this,arguments)}function Kb(e,t,n){return{id:e.id,originalId:e.originalId,groupId:null,primary:e.primary,type:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:e.pixelAspectRatio,hdr:void 0,colorGamut:void 0,videoLayout:void 0,kind:e.kind,language:e.language,originalLanguage:e.language||null,label:e.label,width:e.width,height:e.height,encrypted:e.encrypted,keyIds:new Set([e.keyId]),segments:e.segments.map(function(i){return{startTime:t+i.startTime,endTime:t+i.endTime,initSegmentKey:e.initSegmentKey,appendWindowStart:t,appendWindowEnd:n,timestampOffset:t-e.presentationTimeOffset,dataKey:i.dataKey,tilesLayout:"",mimeType:null,codecs:null,thumbnailSprite:null}}),variantIds:e.variantIds,roles:[],forced:!1,audioSamplingRate:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,tilesLayout:void 0,external:!1,fastSwitching:!1,isAudioMuxedInVideo:!1}}function Xb(){Lb.apply(this,arguments)}function Yb(){this.m=this.j=this.i=this.h=this.g=this.l=null}m(Hb,Lb),Hb.prototype.updateManifestExpiration=function(e,t){var n,i,r,a=this;return L(function(o){return n=Mb(a.h,a.g),i=n.store(),r=new Br,i.get(e).onsuccess=function(n){(n=n.target.result)?(n.expiration=t,i.put(n),r.resolve()):r.reject(new Ce(2,9,9012,"Could not find values for "+e))},_(o,Promise.all([n.promise(),r]),0)})},Hb.prototype.$d=function(e){var t,n,i,r,a,o;return L(function(s){if(1==s.g){for(t=[],n=0;n=a&&(a=t.bandwidth),e.g.set(n.id,r),e.g.set(i.id,a)}}function h_(e,t){e.g.set(t.id,t.bandwidth||2048)}function c_(e,t){return null==(e=e.g.get(t))&&(e=0),e}function d_(e){var t=this;if(e&&e.constructor!=wc)throw new Ce(2,9,9008);this.g=this.h=null,e?(this.h=e.g,this.g=e.Jb()):(this.h=ih(),this.g=new Xr,this.g.configure(this.h.networking)),this.i=[],this.l=[];var n=!e;this.j=new ra(function(){var e,i,r,a,o;return L(function(s){switch(s.g){case 1:return _(s,Promise.all(t.l.map(function(e){return Eb(e)})),2);case 2:for(e=function(){},i=[],r=l(t.i),a=r.next();!a.done;a=r.next())o=a.value,i.push(o.then(e,e));return _(s,Promise.all(i),3);case 3:if(!n){s.A(4);break}return _(s,t.g.destroy(),4);case 4:t.h=null,t.g=null,w(s)}})}),this.m=1e9}function p_(){if(pv(Me()))e:{for(var e=l(Gb.values()),t=e.next();!t.done;t=e.next())if(t=(t=t.value)()){t.destroy(),e=!0;break e}e=!1}else e=!1;return e}function f_(e){var t,n,i;return L(function(r){switch(r.g){case 1:return _(r,(t=new Ub).init(),2);case 2:return _(r,Bb(t),3);case 3:return n=r.h,i=new Zb("manifest",n.path.Wb,n.path.ib,e),_(r,t.destroy(),4);case 4:return _(r,(new d_).remove(i.toString()),0)}})}function g_(e,t,n,i,r,a){var o,s,u,h,c,d,p,f,g,m,v;return L(function(y){switch(y.g){case 1:for(o=!1,S(y,2),s=!0,u=l(n.streams),h=u.next();!h.done;h=u.next())for(c=h.value,d=l(c.segments),p=d.next();!p.done;p=d.next())f=p.value,null!=(g=f.pendingSegmentRefId?i[f.pendingSegmentRefId]:null)&&(f.dataKey=g,f.pendingSegmentRefId=void 0),null!=(g=f.pendingInitSegmentRefId?i[f.pendingInitSegmentRefId]:null)&&(f.initSegmentKey=g,f.pendingInitSegmentRefId=void 0),f.pendingSegmentRefId&&(s=!1),f.pendingInitSegmentRefId&&(s=!1);return n.size+=r,s&&(n.isIncomplete=!1),_(y,e.updateManifest(t,n),4);case 4:o=!0,a(),A(y,0);break;case 2:return m=E(y),_(y,f_(t),5);case 5:if(o){y.A(6);break}return v=Object.values(i),_(y,e.removeSegments(v,function(){}),6);case 6:throw m}})}function m_(e){return e.variants.some(function(e){var t=e.audio&&e.audio.encrypted;return e.video&&e.video.encrypted||t})}function v_(e){return e.variants.some(function(e){return(e.video?e.video.drmInfos:[]).concat(e.audio?e.audio.drmInfos:[]).some(function(e){return e.initData&&e.initData.length})})}function y_(e,t,n,i){if(t.expiration=n.fe(),n=Ma(n),t.sessionIds=i?n:[],m_(e)&&i&&!n.length)throw new Ce(2,9,9007)}function b_(e,t){for(var n=[],i=l(e.streams),r=i.next();!r.done;r=i.next())r=r.value,t&&"video"==r.type?n.push({contentType:xi(r.mimeType,r.codecs),robustness:e.drmInfo.videoRobustness}):t||"audio"!=r.type||n.push({contentType:xi(r.mimeType,r.codecs),robustness:e.drmInfo.audioRobustness});return n}function __(e,t,n){return L(function(i){return _(i,function(e,t,n,i){var r,a,o;return L(function(s){return 1==s.g?i.drmInfo?(r=function(e){var t=Array.from(e.g.keys());if(!t.length)throw new Ce(2,9,9e3,"No supported storage mechanisms found");return e.g.get(t[0]).getEmeSessionCell()}(n),a=i.sessionIds.map(function(e){return{sessionId:e,keySystem:i.drmInfo.keySystem,licenseUri:i.drmInfo.licenseServerUri,serverCertificate:i.drmInfo.serverCertificate,audioCapabilities:b_(i,!1),videoCapabilities:b_(i,!0)}}),_(s,r_(t,e,a),2)):s.return():3!=s.g?(o=s.h,_(s,r.remove(o),3)):_(s,r.add(a.filter(function(e){return!o.includes(e.sessionId)})),0)})}(e.g,e.h.drm,n,t),0)})}function w_(e,t,n){function i(){}var r=function(e){for(var t=new Set,n=(e=l(e.streams)).next();!n.done;n=e.next())for(var i=(n=l(n.value.segments)).next();!i.done;i=n.next())null!=(i=i.value).initSegmentKey&&t.add(i.initSegmentKey),t.add(i.dataKey);return Array.from(t)}(n);return o_(t,n),Promise.all([e.removeSegments(r,i),e.removeManifests([t.key()],i)])}function S_(e,t){var n;return L(function(i){switch(i.g){case 1:return S(i,2),_(i,Ch(t,e.g,e.h.streaming.retryParameters),4);case 4:n=i.h,A(i,3);break;case 2:E(i);case 3:if(n)return i.return(n);throw new Ce(1,2,2011,t)}})}function T_(e,t,n,i,r,a){var o={id:i.id,originalId:i.originalId,groupId:i.groupId,primary:i.primary,type:i.type,mimeType:i.mimeType,codecs:i.codecs,frameRate:i.frameRate,pixelAspectRatio:i.pixelAspectRatio,hdr:i.hdr,colorGamut:i.colorGamut,videoLayout:i.videoLayout,kind:i.kind,language:i.language,originalLanguage:i.originalLanguage,label:i.label,width:i.width||null,height:i.height||null,encrypted:i.encrypted,keyIds:i.keyIds,segments:[],variantIds:[],roles:i.roles,forced:i.forced,channelsCount:i.channelsCount,audioSamplingRate:i.audioSamplingRate,spatialAudio:i.spatialAudio,closedCaptions:i.closedCaptions,tilesLayout:i.tilesLayout,mssPrivateData:i.mssPrivateData,external:i.external,fastSwitching:i.fastSwitching,isAudioMuxedInVideo:i.isAudioMuxedInVideo},s=r.offline.numberOfParallelDownloads,u=0===s?i.id:0;return function(e,t,n){if(null!=(t=e.segmentIndex.find(t)))for(var i=e.segmentIndex.get(t);i;)n(i,t),i=e.segmentIndex.get(++t)}(i,n.presentationTimeline.Lb(),function(n,r){var l=bb(n),h=void 0;if(!a.has(l)){var c=n.endTime-n.startTime;c=c_(t,i.id)*c,c=Sb(e.g,c),a.set(l,new yb(n,c,u,!1,r))}n.ea&&(h=bb(n.ea),a.has(h)||(c=.5*c_(t,i.id),c=Sb(e.g,c),a.set(h,new yb(n.ea,c,u,!0,r)))),o.segments.push({pendingInitSegmentRefId:h,initSegmentKey:h?0:null,startTime:n.startTime,endTime:n.endTime,appendWindowStart:n.appendWindowStart,appendWindowEnd:n.appendWindowEnd,timestampOffset:n.timestampOffset,tilesLayout:n.tilesLayout,pendingSegmentRefId:l,dataKey:0,mimeType:n.mimeType,codecs:n.codecs,thumbnailSprite:n.thumbnailSprite}),0!==s&&(u=(u+1)%s)}),o}function A_(e){if(e.j.g)throw new Ce(2,9,7001)}function E_(){if(!p_())throw new Ce(2,9,9e3)}function x_(e,t){return L(function(n){return 1==n.g?(e.i.push(t),T(n,2),_(n,t,4)):2!=n.g?n.return(n.h):(x(n),Qt(e.i,t),C(n,0))})}function C_(e){for(var t=new Set,n=l(e.variants),i=n.next();!i.done;i=n.next())(i=i.value).audio&&t.add(i.audio),i.video&&t.add(i.video);for(i=(n=l(e.textStreams)).next();!i.done;i=n.next())t.add(i.value);for(n=(e=l(e.imageStreams)).next();!n.done;n=e.next())t.add(n.value);return t}H("shaka.offline.indexeddb.StorageMechanismOpenTimeout",qb),jb("idb",function(){return Me().ki()?new Yb:null}),Zb.prototype.Wb=function(){return this.i},Zb.prototype.ib=function(){return this.h},Zb.prototype.key=function(){return this.l},Zb.prototype.toString=function(){return this.j},(i=t_.prototype).configure=function(){},i.start=function(e,t){var n,i,r,a,o,s,u=this;return L(function(l){switch(l.g){case 1:if(n=Jb(e),u.g=n,null==n||"manifest"!=n.g)throw new Ce(2,1,9004,e);return i=new Ub,T(l,2),_(l,i.init(),4);case 4:return _(l,Fb(i,n.Wb(),n.ib()),5);case 5:return _(l,l.h.getManifests([n.key()]),6);case 6:return r=l.h,a=r[0],o=new Qb(n.Wb(),n.ib()),s=$b(o,a),t.makeTextStreamsForClosedCaptions(s),l.return(s);case 2:return x(l),_(l,i.destroy(),7);case 7:C(l,0)}})},i.stop=function(){return Promise.resolve()},i.update=function(){},i.onExpirationUpdated=function(e,t){var n,i,r,a,o,s,u,l=this;return L(function(h){switch(h.g){case 1:return n=l.g,i=new Ub,S(h,2,3),_(h,i.init(),5);case 5:return _(h,Fb(i,n.Wb(),n.ib()),6);case 6:return _(h,(r=h.h).getManifests([n.key()]),7);case 7:if(a=h.h,o=a[0],s=o.sessionIds.includes(e),u=null==o.expiration||o.expiration>t,!s||!u){h.A(3);break}return _(h,r.updateManifestExpiration(n.key(),t),3);case 3:return x(h),_(h,i.destroy(),10);case 10:C(h,0);break;case 2:E(h),h.A(3)}})},i.onInitialVariantChosen=function(){},i.banLocation=function(){},i.setMediaElement=function(){},so("application/x-offline-manifest",function(){return new t_}),H("shaka.offline.OfflineScheme",n_),n_.plugin=i_,Yr("offline",i_),(i=d_.prototype).destroy=function(){return this.j.destroy()},i.configure=function(e,t){return 2==arguments.length&&"string"==typeof e&&(e=zl(e,t)),rh(this.h,e)},i.getConfiguration=function(){var e=ih();return rh(e,this.h,ih()),e},i.Jb=function(){return this.g},i.store=function(e,t,n,i,r){var a=this,o=this.getConfiguration(),s=new Ab(this.g);return this.l.push(s),t=function(e,t,n,i,r,a,o,s){var u,h,c,d,p,f,g,m,v,y,b,T,k,I,M,P,D,R,N,O,U,B,F;return L(function(j){switch(j.g){case 1:return E_(),h=u=null,c=new Ub,f=p=d=null,S(j,2,3),_(j,a(),5);case 5:return u=j.h,_(j,function(e,t,n,i){var r,a,o,s,u;return L(function(l){if(1==l.g)return r=null,a=e.g,o={networkingEngine:a,filter:function(){return Promise.resolve()},makeTextStreamsForClosedCaptions:function(){},onTimelineRegionAdded:function(){},onEvent:function(){},onError:function(e){r=e},isLowLatencyMode:function(){return!1},updateDuration:function(){},newDrmInfo:function(){},onManifestUpdated:function(){},getBandwidthEstimate:function(){return i.abr.defaultBandwidthEstimate},onMetadata:function(){},disableStream:function(){},addFont:function(){}},n.configure(i.manifest),A_(e),_(l,n.start(t,o),2);if(3!=l.g)return s=l.h,A_(e),u=C_(s),_(l,Promise.all(ee(u,function(e){return e.createSegmentIndex()})),3);if(A_(e),r)throw r;return l.return(s)})}(e,t,u,o),6);case 6:if(g=j.h,A_(e),g.presentationTimeline.T()||g.presentationTimeline.hd())throw new Ce(2,9,9005,t);m=l(i),v=m.next();case 7:if(v.done){j.A(9);break}return y=v.value,_(j,function(e,t,n){var i,r,a,o,s,u,h,c,d,p,f,g,m,v,y;return L(function(b){switch(b.g){case 1:return _(b,S_(e,t),2);case 2:if("text/vtt"!=(i=b.h))throw new Ce(1,2,2017,t);return _(b,function(e,t,n){var i,r,a;return L(function(o){return 1==o.g?(i=ta,(r=Zr([e],n)).method="GET",_(o,t.request(i,r).promise,2)):(a=o.h,o.return(a.data))})}(t,e.g,e.h.streaming.retryParameters),3);case 3:if(r=b.h,!(a=Fi(i)))throw new Ce(2,2,2014,i);for(o=a(),s={periodStart:0,segmentStart:0,segmentEnd:n.presentationTimeline.getDuration(),vttOffset:0},u=Te(r),h=o.parseMedia(u,s,t,[]),c=[],d=l(h),p=d.next(),f={};!p.done;f={rg:void 0,Bd:void 0},p=d.next())f.Bd=p.value,f.rg=null,g=function(e){return function(){return null==e.rg&&(e.rg=Ze([t],[e.Bd.payload])),e.rg||[]}}(f),m=new Jo(f.Bd.startTime,f.Bd.endTime,g,0,null,null,0,0,1/0),f.Bd.payload.includes("#xywh")&&4===(v=f.Bd.payload.split("#xywh=")[1].split(",")).length&&m.hg({height:parseInt(v[3],10),positionX:parseInt(v[0],10),positionY:parseInt(v[1],10),width:parseInt(v[2],10)}),c.push(m);if(y=i,!c.length){b.A(4);break}return _(b,Ch(c[0].S()[0],e.g,e.h.manifest.retryParameters),5);case 5:y=b.h;case 4:return b.return({id:e.m++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Hu(c),mimeType:y||"",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:"image",primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,tilesLayout:"1x1",accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(y||"","")]),isAudioMuxedInVideo:!1,baseOriginalId:null})}})}(e,y,g),10);case 10:b=j.h,g.imageStreams.push(b),A_(e),v=m.next(),j.A(7);break;case 9:T=l(r),k=T.next();case 11:return k.done?(Ha(o.drm.clearKeys,g.variants),P=g.variants.some(function(e){if(e.audio)for(var t=l(e.audio.drmInfos),n=t.next();!n.done;n=t.next())if(n.value.licenseServerUri.startsWith("data:"))return!0;if(e.video)for(t=(e=l(e.video.drmInfos)).next();!t.done;t=e.next())if(t.value.licenseServerUri.startsWith("data:"))return!0;return!1}),D=o.offline.usePersistentLicense,P&&(D=!1),_(j,e.yd(g,function(e){f=f||e},o,D),15)):(I=k.value,_(j,function(e,t,n,i,r,a,o){var s;return L(function(u){if(1==u.g)return a?u.A(2):_(u,S_(e,n),3);if(2!=u.g&&(a=u.h),s={id:e.m++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:Wu(0,t.presentationTimeline.getDuration(),[n]),mimeType:a||"",codecs:o||"",kind:r,encrypted:!1,drmInfos:[],keyIds:new Set,language:i,originalLanguage:i,label:null,type:nt,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(a||"",o||"")]),isAudioMuxedInVideo:!1,baseOriginalId:null},!ji(xi(s.mimeType,s.codecs)))throw new Ce(2,2,2014,a);return u.return(s)})}(e,g,I.uri,I.language,I.kind,I.mime,I.codecs),14));case 14:M=j.h,g.textStreams.push(M),A_(e),k=T.next(),j.A(11);break;case 15:if(h=j.h,A_(e),f)throw f;return _(j,function(e,t,n,i){var r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M,P,D,R,N,O,U,B,F;return L(function(L){switch(L.g){case 1:return r={width:1/0,height:1/0},function(e,t,n){e.variants=e.variants.filter(function(e){return Qi(e,t,n)})}(e,n.restrictions,r),_(L,$i(t,e,i,n.drm.preferredKeySystems,n.drm.keySystemsMapping),2);case 2:for(a=[],o=n.preferredDecodingAttributes,s=n.preferredVideoCodecs,u=n.preferredAudioCodecs,h=n.preferredTextFormats,Ji(e,s,u,o,h),c=l(e.variants),d=c.next();!d.done;d=c.next())p=d.value,a.push(or(p));for(f=l(e.textStreams),g=f.next();!g.done;g=f.next())m=g.value,a.push(sr(m));for(v=l(e.imageStreams),y=v.next();!y.done;y=v.next())b=y.value,a.push(ur(b));return _(L,n.offline.trackSelectionCallback(a),3);case 3:for(T=L.h,x=e.presentationTimeline.getDuration(),C=0,k=l(T),I=k.next();!I.done;I=k.next())M=I.value,P=M.bandwidth*x/8,C+=P;return S(L,4),_(L,n.offline.downloadSizeCallback(C),6);case 6:if(!L.h)throw new Ce(2,9,9014);A(L,5);break;case 4:if((D=E(L))instanceof Ce)throw D;throw new Ce(2,9,9015);case 5:for(R=new Set,N=new Set,O=new Set,U=l(T),B=U.next();!B.done;B=U.next())"variant"==(F=B.value).type&&R.add(F.id),"text"==F.type&&N.add(F.id),"image"==F.type&&O.add(F.id);e.variants=e.variants.filter(function(e){return R.has(e.id)}),e.textStreams=e.textStreams.filter(function(e){return N.has(e.id)}),e.imageStreams=e.imageStreams.filter(function(e){return O.has(e.id)}),function(e){e.variants.map(function(e){return e.video});var t=new Set(e.variants.map(function(e){return e.audio}));e=e.textStreams;for(var n=l(t),i=n.next();!i.done;i=n.next())for(var r=(i=l(t)).next();!r.done;r=i.next());for(n=(t=l(e)).next();!n.done;n=t.next())for(i=(n=l(e)).next();!i.done;i=n.next());}(e),w(L)}})}(g,h,o,D),16);case 16:return _(j,c.init(),17);case 17:return A_(e),_(j,Bb(c),18);case 18:return d=j.h,A_(e),R=function(e,t,n,i,r,a,o){var s=function(e,t,n){return{offlineUri:null,originalManifestUri:e,duration:t.presentationTimeline.getDuration(),size:0,expiration:1/0,tracks:t=s_(t),appMetadata:n,isIncomplete:!1}}(n,t,i),u=r.offline.progressCallback;!function(e,t,n){e.s=function(e,t){s.size=t,u(s,e)},e.m=n}(a,0,function(t,n){h&&o&&c==n&&Ia(e,"cenc",t)});var h=m_(t)&&!v_(t),c=null;h&&(c=k_.get(e.g.keySystem));for(var d=new u_,p=l(t.textStreams),f=p.next();!f.done;f=p.next())d.g.set(f.value.id,52);for(f=(p=l(t.imageStreams)).next();!f.done;f=p.next())h_(d,f.value);for(f=(p=l(t.variants)).next();!f.done;f=p.next())l_(d,f.value);return a=function(e,t,n,i){for(var r=new Map,a=C_(n),o=new Map,s=(a=l(a)).next();!s.done;s=a.next()){var u=T_(e,t,n,s=s.value,i,r);o.set(s.id,u)}for(t=(e=l(n.variants)).next();!t.done;t=e.next())(t=t.value).audio&&o.get(t.audio.id).variantIds.push(t.id),t.video&&o.get(t.video.id).variantIds.push(t.id);return{streams:Array.from(o.values()),oi:Array.from(r.values())}}(a,d,t,r),r=a.streams,a=a.oi,(d=e.g)&&o&&(d.initData=[]),{Gl:{creationTime:Date.now(),originalManifestUri:n,duration:t.presentationTimeline.getDuration(),size:0,expiration:e.fe(),streams:r,sessionIds:o?Ma(e):[],drmInfo:d,appMetadata:i,isIncomplete:!0,sequenceMode:t.sequenceMode,type:t.type},oi:a}}(h,g,t,n,o,s,D),N=R.Gl,O=R.oi,_(j,d.ib.addManifests([N]),19);case 19:if(U=j.h,A_(e),p=U[0],A_(e),f)throw f;return _(j,function(e,t,n,i,r,a,o,s,u,h){var c,d,p,f,g,m,v,y,b,T,x;return L(function(C){switch(C.g){case 1:if(c={},d=0,p=function(){if(e.j.g||r.l)throw new Ce(2,9,7001)},f=function(e,t){var f,g,m,v,y,b,S,T,A;return L(function(E){if(1==E.g){for(f=l(e),g=f.next(),m={};!g.done;m={rc:void 0},g=f.next())m.rc=g.value,p(),v=_b(m.rc,a),y=m.rc.i,b=m.rc.h,S=function(e){return function(t){var n,i,r,a;return L(function(s){switch(s.g){case 1:if(n=e.rc.g,i=n.ec(!1),!n.aesKey||i){s.A(2);break}return _(s,gl(t,n.aesKey,e.rc.j),3);case 3:t=s.h;case 2:return r=bb(n),_(s,o.addSegments([{data:t}]),4);case 4:a=s.h,p(),c[r]=a[0],d+=t.byteLength,w(s)}})}}(m),T=m.rc.g,(A=T.ec(!1))?xb(r,m.rc.groupId,A,y,b,S):r.queue(m.rc.groupId,v,y,b,S);return _(E,function(e){return L(function(t){return 1==t.g?_(t,Promise.all(e.i.values()),2):t.return(e.g.g)})}(r),2)}return p(),!t||r.l?E.A(0):(y_(s,i,u,h),_(E,o.updateManifest(n,i),0))})},g=!1,S(C,2),!m_(s)||!g||v_(s)){C.A(4);break}return _(C,f(t.filter(function(e){return e.h}),!0),5);case 5:return p(),t=t.filter(function(e){return!e.h}),m=c,v=d,c={},d=0,_(C,g_(o,n,i,m,v,function(){return A_(e)}),6);case 6:p();case 4:if(g){C.A(7);break}return _(C,f(t,!1),8);case 8:return p(),y=c,b=d,c={},d=0,_(C,g_(o,n,i,y,b,function(){return p()}),9);case 9:p();case 7:A(C,0);break;case 2:return T=E(C),x=Object.values(c),_(C,o.removeSegments(x,function(){}),10);case 10:throw T}})}(e,O,p,N,s,o,d.ib,g,h,D),20);case 20:return A_(e),y_(g,N,h,D),_(j,d.ib.updateManifest(p,N),21);case 21:return A_(e),B=new Zb("manifest",d.path.Wb,d.path.ib,p),j.return(o_(B,N));case 3:return x(j),_(j,c.destroy(),22);case 22:if(!u){j.A(23);break}return _(j,u.stop(),23);case 23:if(!h){j.A(25);break}return _(j,h.destroy(),25);case 25:C(j,0);break;case 2:if(F=E(j),null==p){j.A(27);break}return _(j,f_(p),27);case 27:throw f||F}})}(this,e,t||{},i||[],r||[],function(){var t;return L(function(i){return 1==i.g?n?i.A(2):_(i,Ch(e,a.g,o.manifest.retryParameters),3):(2!=i.g&&(n=i.h),t=uo(e,n||null),i.return(t()))})},o,s),(t=new Fr(t,function(){return Eb(s)})).finally(function(){Qt(a.l,s)}),function(e,t){var n=t.promise;return e.i.push(n),t.finally(function(){Qt(e.i,n)})}(this,t)},i.remove=function(e){return x_(this,function(e,t){var n,i,r,a,o,s;return L(function(u){switch(u.g){case 1:if(E_(),null==(n=Jb(t))||"manifest"!=n.g)throw new Ce(2,9,9004,t);return i=n,r=new Ub,T(u,2),_(u,r.init(),4);case 4:return _(u,Fb(r,i.Wb(),i.ib()),5);case 5:return _(u,(a=u.h).getManifests([i.key()]),6);case 6:return o=u.h,s=o[0],_(u,Promise.all([__(e,s,r),w_(a,i,s)]),2);case 2:return x(u),_(u,r.destroy(),8);case 8:C(u,0)}})}(this,e))},i.Zl=function(){return x_(this,function(e){var t,n,i,r,a,o,s,u,h,c;return L(function(d){switch(d.g){case 1:return E_(),t=e.g,n=e.h.drm,i=new Ub,r=!1,T(d,2),_(d,i.init(),4);case 4:a=[],function(e){e.g.forEach(function(e){var t;t=e.getEmeSessionCell(),a.push(t)})}(i),o=l(a),s=o.next();case 5:if(s.done){d.A(2);break}return _(d,(u=s.value).getAll(),8);case 8:return h=d.h,_(d,r_(n,t,h),9);case 9:return c=d.h,_(d,u.remove(c),10);case 10:c.length!=h.length&&(r=!0),s=o.next(),d.A(5);break;case 2:return x(d),_(d,i.destroy(),11);case 11:C(d,3);break;case 3:return d.return(!r)}})}(this))},i.list=function(){return x_(this,L(function(i){switch(i.g){case 1:return E_(),e=[],t=new Ub,T(i,2),_(i,t.init(),4);case 4:return n=Promise.resolve(),function(e,t){e.g.forEach(function(e,n){e.getCells().forEach(function(e,i){t({Wb:n,ib:i},e)})})}(t,function(t,i){n=n.then(function(){return L(function(n){if(1==n.g)return _(n,i.getAllManifests(),2);n.h.forEach(function(n,i){n=o_(new Zb("manifest",t.Wb,t.ib,i),n),e.push(n)}),w(n)})})}),_(i,n,2);case 2:return x(i),_(i,t.destroy(),6);case 6:C(i,3);break;case 3:return i.return(e)}}));var e,t,n},i.yd=function(e,t,n,i){var r,a=this;return L(function(o){return 1==o.g?((r=new Aa({yc:a.g,onError:t,Of:function(){},onExpirationUpdated:function(){},onEvent:function(){}})).configure(n.drm),_(o,function(e,t,n){return e.ba=!0,e.C=new Map,e.N=n,xa(e,t,!1)}(r,e.variants,i),2)):3!=o.g?_(o,ka(r),3):o.return(r)})},H("shaka.offline.Storage",d_),d_.deleteAll=function(){var e;return L(function(t){return 1==t.g?(e=new Ub,T(t,2),_(t,function(e){var t,n;return L(function(i){return 1==i.g?(t=Array.from(e.g.values()),(n=0=n?(pw(),function(){var e=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(t,n){return e.call(this,t,n-.001)}}()):15>=n&&pw()),n=(t=l(t.rj())).next();!n.done;n=t.next())fw(n.value);(e.MediaSource||e.ManagedMediaSource)&&function(){if(e.MediaSource){var t=MediaSource.isTypeSupported.bind(MediaSource);MediaSource.isTypeSupported=function(e){return"mp2t"!=Ii(e)&&t(e)}}if(e.ManagedMediaSource){var n=ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);e.ManagedMediaSource.isTypeSupported=function(e){return"mp2t"!=Ii(e)&&n(e)}}}(),e.MediaSource&&MediaSource.isTypeSupported('video/webm; codecs="vp9"')&&!MediaSource.isTypeSupported('video/webm; codecs="vp09.00.10.08"')&&function(){var e=MediaSource.isTypeSupported;Me().Tj()&&(MediaSource.isTypeSupported=function(t){var n=t.split(/ *; */),i=n.findIndex(function(e){return e.startsWith("codecs=")});if(0>i)return e(t);var r=n[i].replace("codecs=","").replace(/"/g,"").split(/\s*,\s*/),a=r.findIndex(function(e){return e.startsWith("vp09")});return 0<=a&&(r[a]="vp9",n[i]='codecs="'+r.join(",")+'"',t=n.join("; ")),e(t)})}()}function pw(){var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=e.apply(this,D.apply(0,arguments));return t.abort=function(){},t}}function fw(t){var n=MediaSource.isTypeSupported.bind(MediaSource);if(MediaSource.isTypeSupported=function(e){return Pi(e)!=t&&n(e)},e.ManagedMediaSource){var i=ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);e.ManagedMediaSource.isTypeSupported=function(e){return Pi(e)!=t&&i(e)}}}function gw(){}function mw(){screen.orientation&&screen.orientation.unlock||(null!=screen.orientation?(void 0===screen.orientation.lock&&(screen.orientation.lock=function(){return Promise.resolve()}),void 0===screen.orientation.unlock&&(screen.orientation.unlock=function(){})):null!=e.orientation&&function(){function t(){switch(e.orientation){case-90:n.type="landscape-secondary",n.angle=270;break;case 0:n.type="portrait-primary",n.angle=0;break;case 90:n.type="landscape-primary",n.angle=90;break;case 180:n.type="portrait-secondary",n.angle=180}}var n=new vw;screen.orientation=n,t(),e.addEventListener("orientationchange",function(){t();var e=new V("change");n.dispatchEvent(e)})}())}function vw(){$.call(this),this.type="",this.angle=0}function yw(){}function bw(t){e.HTMLVideoElement&&e.WebKitMediaKeys&&e.shakaMediaKeysPolyfill!=Iw&&(void 0!==t&&t&&(rw=!0,aw=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"mediaKeys"),ow=HTMLMediaElement.prototype.setMediaKeys,sw=e.MediaKeys,uw=e.MediaKeySystemAccess,lw=navigator.requestMediaKeySystemAccess),delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ww,e.MediaKeys=Aw,e.MediaKeySystemAccess=Tw,navigator.requestMediaKeySystemAccess=_w,e.shakaMediaKeysPolyfill=Iw,_r.clear(),Rr.clear())}function _w(e,t){try{var n=new Tw(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function ww(e){var t=this.mediaKeys;return t&&t!=e&&Ew(t,null),delete this.mediaKeys,(this.mediaKeys=e)?Ew(e,this):Promise.resolve()}function Sw(e){if(Ee(e=Te(e.initData)).getUint32(0,!0)+4!=e.byteLength)throw new RangeError("Malformed FairPlay init data");e=Be(e=Oe(e.subarray(4),!0));var t=new Event("encrypted");t.initDataType="skd",t.initData=Se(e),this.dispatchEvent(t)}function Tw(e,t){if(this.keySystem=e,e.startsWith("com.apple.fps"))for(t=(e=l(t)).next();!t.done;t=e.next()){var n=t.value;if("required"==n.persistentState)t=null;else{t={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:n.initDataTypes,sessionTypes:["temporary"],label:n.label};var i=!1,r=!1;if(n.audioCapabilities)for(var a=l(n.audioCapabilities),o=a.next();!o.done;o=a.next())(o=o.value).contentType&&(i=!0,WebKitMediaKeys.isTypeSupported(this.keySystem,o.contentType.split(";")[0])&&(t.audioCapabilities.push(o),r=!0));if(n.videoCapabilities)for(a=(n=l(n.videoCapabilities)).next();!a.done;a=n.next())(a=a.value).contentType&&(i=!0,WebKitMediaKeys.isTypeSupported(this.keySystem,a.contentType.split(";")[0])&&(t.videoCapabilities.push(a),r=!0));i||(r=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),t=r?t:null}if(t)return void(this.g=t)}throw(e=Error("Unsupported keySystem")).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,e}function Aw(e){this.h=new WebKitMediaKeys(e),this.g=new At}function Ew(e,t){if(e.g.Sa(),!t)return Promise.resolve();e.g.o(t,"webkitneedkey",Sw);try{return Eu(t,HTMLMediaElement.HAVE_METADATA,e.g,function(){t.webkitSetMediaKeys(e.h)}),Promise.resolve()}catch(e){return Promise.reject(e)}}function xw(e){$.call(this),this.i=null,this.l=e,this.g=this.h=null,this.j=new At,this.sessionId="",this.expiration=NaN,this.closed=new Br,this.keyStatuses=new kw}function Cw(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,t=new V("keystatuseschange"),e.dispatchEvent(t)}function kw(){this.size=0,this.g=void 0}P_(nw,-1),I_.MediaSource=cw,cw.install=dw,P_(dw),I_.Orientation=gw,gw.install=mw,m(vw,$),vw.prototype.lock=function(e){function t(e){return screen.lockOrientation?screen.lockOrientation(e):screen.mozLockOrientation?screen.mozLockOrientation(e):!!screen.msLockOrientation&&screen.msLockOrientation(e)}var n=!1;switch(e){case"natural":n=t("default");break;case"any":n=!0,this.unlock();break;default:n=t(e)}return n?Promise.resolve():((e=Error("screen.orientation.lock() is not available on this device")).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,Promise.reject(e))},vw.prototype.unlock=function(){screen.unlockOrientation?screen.unlockOrientation():screen.mozUnlockOrientation?screen.mozUnlockOrientation():screen.msUnlockOrientation&&screen.msUnlockOrientation()},P_(mw),I_.PatchedMediaKeysApple=yw,yw.uninstall=function(){e.shakaMediaKeysPolyfill==Iw&&rw&&(rw=!1,Object.defineProperty(HTMLMediaElement.prototype,"mediaKeys",aw),HTMLMediaElement.prototype.setMediaKeys=ow,e.MediaKeys=sw,e.MediaKeySystemAccess=uw,navigator.requestMediaKeySystemAccess=lw,aw=lw=ow=uw=sw=null,e.shakaMediaKeysPolyfill="",_r.clear(),Rr.clear())},yw.install=bw,Tw.prototype.createMediaKeys=function(){var e=new Aw(this.keySystem);return Promise.resolve(e)},Tw.prototype.getConfiguration=function(){return this.g},Aw.prototype.createSession=function(e){if("temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new xw(this.h,e)},Aw.prototype.setServerCertificate=function(){return Promise.resolve(!1)},Aw.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},m(xw,$),(i=xw.prototype).generateRequest=function(e,t){var n=this;this.h=new Br;try{var i=this.l.createSession("video/mp4",Te(t));this.i=i,this.sessionId=i.sessionId||"",this.j.o(this.i,"webkitkeymessage",function(e){n.h&&(n.h.resolve(),n.h=null),e=new V("message",e=(new Map).set("messageType",null==n.keyStatuses.Lc()?"license-request":"license-renewal").set("message",Se(e.message))),n.dispatchEvent(e)}),this.j.o(i,"webkitkeyadded",function(){n.g&&(Cw(n,"usable"),n.g.resolve(),n.g=null)}),this.j.o(i,"webkitkeyerror",function(){var e=Error("EME PatchedMediaKeysApple key error");if(e.errorCode=n.i.error,null!=n.h)n.h.reject(e),n.h=null;else if(null!=n.g)n.g.reject(e),n.g=null;else switch(n.i.error.code){case WebKitMediaKeyError.MEDIA_KEYERR_OUTPUT:case WebKitMediaKeyError.MEDIA_KEYERR_HARDWARECHANGE:Cw(n,"output-not-allowed");break;default:Cw(n,"internal-error")}}),Cw(this,"status-pending")}catch(e){this.h.reject(e)}return this.h},i.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},i.update=function(e){this.g=new Br;try{this.i.update(Te(e))}catch(e){this.g.reject(e)}return this.g},i.close=function(){try{this.i.close(),this.closed.resolve(),this.j.Sa()}catch(e){this.closed.reject(e)}return this.closed},i.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},(i=kw.prototype).Lc=function(){return this.g},i.forEach=function(e){this.g&&e(this.g,Dr.value())},i.get=function(e){if(this.has(e))return this.g},i.has=function(e){var t=Dr.value();return!(!this.g||!we(e,t))},i.entries=function(){},i.keys=function(){},i.values=function(){};var Iw="apple";function Mw(){}function Pw(){if(e.MediaKeys){var t=Me();MediaKeys.prototype.setServerCertificate&&t.Ee()||(MediaKeys.prototype.setServerCertificate=Lw)}}function Lw(){return Promise.resolve(!1)}function Dw(){}function Rw(){if(!(!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration)){if(HTMLMediaElement.prototype.webkitGenerateKeyRequest)Xw="webkit";else if(!HTMLMediaElement.prototype.generateKeyRequest)return;navigator.requestMediaKeySystemAccess=Ow,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Uw,e.MediaKeys=Fw,e.MediaKeySystemAccess=Bw,e.shakaMediaKeysPolyfill=Yw}}function Nw(e){return Xw?Xw+e.charAt(0).toUpperCase()+e.slice(1):e}function Ow(e,t){try{var n=new Bw(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function Uw(e){var t=this.mediaKeys;return t&&t!=e&&jw(t,null),delete this.mediaKeys,(this.mediaKeys=e)&&jw(e,this),Promise.resolve()}function Bw(e,t){this.g=this.keySystem=e;var n=!1;"org.w3.clearkey"==e&&(this.g="webkit-org.w3.clearkey",n=!1);var i=!1,r=document.getElementsByTagName("video");r=r.length?r[0]:document.createElement("video");for(var a=(t=l(t)).next();!a.done;a=t.next()){var o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:(a=a.value).initDataTypes,sessionTypes:["temporary"],label:a.label},s=!1;if(a.audioCapabilities)for(var u=l(a.audioCapabilities),h=u.next();!h.done;h=u.next())(h=h.value).contentType&&(s=!0,r.canPlayType(h.contentType.split(";")[0],this.g)&&(o.audioCapabilities.push(h),i=!0));if(a.videoCapabilities)for(h=(u=l(a.videoCapabilities)).next();!h.done;h=u.next())(h=h.value).contentType&&(s=!0,r.canPlayType(h.contentType,this.g)&&(o.videoCapabilities.push(h),i=!0));if(s||(i=r.canPlayType("video/mp4",this.g)||r.canPlayType("video/webm",this.g)),"required"==a.persistentState&&(n?(o.persistentState="required",o.sessionTypes=["persistent-license"]):i=!1),i)return void(this.h=o)}throw n="Unsupported keySystem","org.w3.clearkey"!=e&&"com.widevine.alpha"!=e||(n="None of the requested configurations were supported."),(e=Error(n)).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,e}function Fw(e){this.l=e,this.h=null,this.g=new At,this.i=[],this.j=new Map}function jw(e,t){e.h=t,e.g.Sa();var n=Xw;t&&(e.g.o(t,n+"needkey",function(t){var n=new CustomEvent("encrypted");n.initDataType="cenc",n.initData=Se(t.initData),e.h.dispatchEvent(n)}),e.g.o(t,n+"keymessage",function(t){var n=Gw(e,t.sessionId);n&&(t=new V("message",t=(new Map).set("messageType",null==n.keyStatuses.Lc()?"licenserequest":"licenserenewal").set("message",t.message)),n.h&&(n.h.resolve(),n.h=null),n.dispatchEvent(t))}),e.g.o(t,n+"keyadded",function(t){(t=Gw(e,t.sessionId))&&t.ready()}),e.g.o(t,n+"keyerror",function(t){var n=Gw(e,t.sessionId);if(n){var i=Error("EME v0.1b key error"),r=t.errorCode;r.systemCode=t.systemCode,i.errorCode=r,!t.sessionId&&n.h?(45==t.systemCode&&(i.message="Unsupported session type."),n.h.reject(i),n.h=null):t.sessionId&&n.g?(n.g.reject(i),n.g=null):(i=t.systemCode,t.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?zw(n,"output-restricted"):zw(n,1==i?"expired":"internal-error"))}}))}function Gw(e,t){var n=e.j.get(t);return n||((n=e.i.shift())?(n.sessionId=t,e.j.set(t,n),n):null)}function Hw(e,t,n){$.call(this),this.j=e,this.m=!1,this.g=this.h=null,this.i=t,this.l=n,this.sessionId="",this.expiration=NaN,this.closed=new Br,this.keyStatuses=new Kw}function Vw(e,t,n){if(e.m)return Promise.reject(Error("The session is already initialized."));e.m=!0;try{if("persistent-license"==e.l)if(n)var i=Te(Be("LOAD_SESSION|"+n));else{var r=Be("PERSISTENT|");i=qe(r,t)}else i=Te(t)}catch(e){return Promise.reject(e)}e.h=new Br;var a=Nw("generateKeyRequest");try{e.j[a](e.i,i)}catch(t){if("InvalidStateError"!=t.name)return e.h=null,Promise.reject(t);new zi(function(){try{e.j[a](e.i,i)}catch(t){e.h.reject(t),e.h=null}}).X(.01)}return e.h}function Ww(e,t,n){if(e.g)e.g.then(function(){return Ww(e,t,n)}).catch(function(){return Ww(e,t,n)});else{if(e.g=t,"webkit-org.w3.clearkey"==e.i){var i=Ne(n),r=JSON.parse(i);"oct"!=r.keys[0].kty&&(e.g.reject(Error("Response is not a valid JSON Web Key Set.")),e.g=null),i=Ke(r.keys[0].k),r=Ke(r.keys[0].kid)}else i=Te(n),r=null;var a=Nw("addKey");try{e.j[a](e.i,i,r,e.sessionId)}catch(t){e.g.reject(t),e.g=null}}}function zw(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,t=new V("keystatuseschange"),e.dispatchEvent(t)}function Kw(){this.size=0,this.g=void 0}P_(function(){e.HTMLVideoElement&&e.WebKitMediaKeys&&(navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||bw())}),I_.PatchedMediaKeysCert=Mw,Mw.install=Pw,P_(Pw),I_.PatchedMediaKeysWebkit=Dw,Dw.install=Rw,Bw.prototype.createMediaKeys=function(){var e=new Fw(this.g);return Promise.resolve(e)},Bw.prototype.getConfiguration=function(){return this.h},Fw.prototype.createSession=function(e){if("temporary"!=(e=e||"temporary")&&"persistent-license"!=e)throw new TypeError("Session type "+e+" is unsupported on this platform.");var t=this.h||document.createElement("video");return t.src||(t.src="about:blank"),e=new Hw(t,this.l,e),this.i.push(e),e},Fw.prototype.setServerCertificate=function(){return Promise.resolve(!1)},Fw.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},m(Hw,$),(i=Hw.prototype).ready=function(){zw(this,"usable"),this.g&&this.g.resolve(),this.g=null},i.generateRequest=function(e,t){return Vw(this,t,null)},i.load=function(e){return"persistent-license"==this.l?Vw(this,null,e):Promise.reject(Error("Not a persistent session."))},i.update=function(e){var t=new Br;return Ww(this,t,e),t},i.close=function(){if("persistent-license"!=this.l){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var e=Nw("cancelKeyRequest");try{this.j[e](this.i,this.sessionId)}catch(e){}}return this.closed.resolve(),this.closed},i.remove=function(){return"persistent-license"!=this.l?Promise.reject(Error("Not a persistent session.")):this.close()},(i=Kw.prototype).Lc=function(){return this.g},i.forEach=function(e){this.g&&e(this.g,Dr.value())},i.get=function(e){if(this.has(e))return this.g},i.has=function(e){var t=Dr.value();return!(!this.g||!we(e,t))},i.entries=function(){},i.keys=function(){},i.values=function(){};var Xw="",Yw="webkit";function qw(){}function Zw(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;t.requestPictureInPicture&&document.exitPictureInPicture||!t.webkitSupportsPresentationMode||(document.pictureInPictureEnabled=!0,document.pictureInPictureElement=null,t.requestPictureInPicture=Qw,Object.defineProperty(t,"disablePictureInPicture",{get:eS,set:tS,enumerable:!0,configurable:!0}),document.exitPictureInPicture=$w,document.addEventListener("webkitpresentationmodechanged",Jw,!0))}}function Jw(e){if("picture-in-picture"==(e=e.target).webkitPresentationMode){document.pictureInPictureElement=e;var t=new Event("enterpictureinpicture");e.dispatchEvent(t)}else document.pictureInPictureElement==e&&(document.pictureInPictureElement=null),t=new Event("leavepictureinpicture"),e.dispatchEvent(t)}function Qw(){return this.webkitSupportsPresentationMode("picture-in-picture")?(this.webkitSetPresentationMode("picture-in-picture"),document.pictureInPictureElement=this,Promise.resolve()):Promise.reject(Error("PiP not allowed by video element"))}function $w(){var e=document.pictureInPictureElement;return e?(e.webkitSetPresentationMode("inline"),document.pictureInPictureElement=null,Promise.resolve()):Promise.reject(Error("No picture in picture element found"))}function eS(){return!!this.hasAttribute("disablePictureInPicture")||!this.webkitSupportsPresentationMode("picture-in-picture")}function tS(e){e?this.setAttribute("disablePictureInPicture",""):this.removeAttribute("disablePictureInPicture")}function nS(){}function iS(){e.crypto&&("randomUUID"in e.crypto||(e.crypto.randomUUID=rS))}function rS(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)}function aS(){}function oS(){var e=Symbol.prototype;"description"in e||Object.defineProperty(e,"description",{get:sS})}function sS(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}function uS(){}function lS(){for(var e=l([Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array]),t=e.next();!t.done;t=e.next())(t=t.value).prototype.indexOf||(t.prototype.indexOf=hS),t.prototype.lastIndexOf||(t.prototype.lastIndexOf=cS),t.prototype.includes||(t.prototype.includes=dS)}function hS(e,t){return Array.prototype.indexOf.call(this,e,t)}function cS(e,t){return Array.prototype.lastIndexOf.call(this,e,t)}function dS(e,t){return-1!==this.indexOf(e,t)}function pS(){}function fS(){if(e.HTMLMediaElement){var t=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var e=t.apply(this);return e&&e.catch(function(){}),e}}}function gS(){}function mS(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;!t.getVideoPlaybackQuality&&("webkitDroppedFrameCount"in t||"number"==typeof ds().webkitDroppedFrameCount)&&(t.getVideoPlaybackQuality=vS)}}function vS(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function yS(){}function bS(){if(!e.VTTCue&&e.TextTrackCue){var t=null,n=TextTrackCue.length;if(3==n)t=_S;else if(6==n)t=wS;else{try{var i=!!_S(1,2,"")}catch(e){i=!1}i&&(t=_S)}t&&(e.VTTCue=function(e,n,i){return t(e,n,i)})}}function _S(t,n,i){return new e.TextTrackCue(t,n,i)}function wS(t,n,i){return new e.TextTrackCue(t+"-"+n+"-"+i,t,n,i)}function SS(e){$.call(this),this.h=e,this.l=null,this.g=[],this.i=-1,this.j=null,this.m=new At}function TS(){}P_(Rw),I_.PiPWebkit=qw,qw.install=Zw,P_(Zw),I_.RandomUUID=nS,nS.install=iS,P_(iS),I_.Symbol=aS,aS.install=oS,P_(oS),I_.TypedArray=uS,uS.install=lS,P_(lS),I_.VideoPlayPromise=pS,pS.install=fS,P_(fS),I_.VideoPlaybackQuality=gS,gS.install=mS,P_(mS),I_.VTTCue=yS,yS.install=bS,P_(bS),m(SS,$),(i=SS.prototype).destroy=function(){var e=this;return L(function(t){if(1==t.g)return _(t,e.removeAllItems(),2);e.h=null,e.m&&(e.m.release(),e.m=null),$.prototype.release.call(e),w(t)})},i.configure=function(e){this.l=e},i.getConfiguration=function(){return this.l},i.getCurrentItem=function(){return this.g.length&&0<=this.i&&this.i=m.g.length)throw new Ce(2,7,7007);return t=m.g[e],m.i!=e&&(m.i=e,m.dispatchEvent(new V("currentitemchanged"))),n=m.h.h,0<(i=m.l?m.l.preloadNextUrlWindow:0)&&(r=!1,m.m.o(n,"timeupdate",function(){var e,t,a,o;return L(function(s){switch(s.g){case 1:if(m.j||1>=m.g.length||r||m.h.T()||!n.duration)return s.return();if(e=m.h.xa().end-n.currentTime,isNaN(e)){s.A(0);break}if(!(e<=i)){s.A(0);break}if(t=m.l&&m.l.repeatMode,a=null,m.i+1=p.length)return null;v=p[v]}else d&&y&&!y.startsWith("#")&&(b=new re(d),y=new re(y),(y=b.resolve(y).toString())&&(v=y));if(("p"==e.tagName||m||v)&&(c=!0),e=c,y="default"==(g.attributes["xml:space"]||(s?"default":"preserve")),s=[],!(b=g.children.every(mn)))for(var _=l(g.children),w=_.next();!w.done;w=_.next())(w=CS(w.value,t,n,i,r,a,o,y,u,g,c,d,p))&&s.push(w);if(i=null!=h,d=bn(g),d=g.children.length&&d&&/\S/.test(d),!((_=g.attributes.begin||g.attributes.end||g.attributes.dur)||d||"br"==g.tagName||0!=s.length||i&&!y))return null;for(d=(p=US(g,n)).start,p=p.end;f&&f.tagName&&"tt"!=f.tagName;)d=(p=OS(f,n,d,p)).start,p=p.end,f=f.parent;if(null==d&&(d=0),d+=t.periodStart,p=null==p?1/0:p+t.periodStart,d=Math.max(d,t.segmentStart),p=Math.min(p,t.segmentEnd),!_&&0n.length)return a;var o=e;for(e=null;!e&&!(e=r?En(o,r,t):o.attributes[t])&&(o=o.parent););if(t=e)for(r=(t=l(t.split(" "))).next();!r.done;r=t.next())for(r=r.value,o=(e=l(n)).next();!o.done;o=e.next())if(i+(o=o.value).attributes["xml:id"]==r){a.push(o);break}return a}function OS(e,t,n,i){return e=US(e,t),null==n?n=e.start:null!=e.start&&(n+=e.start),null==i?i=e.end:null!=e.start&&(i+=e.start),{start:n,end:i}}function US(e,t){var n=BS(e.attributes.begin,t),i=BS(e.attributes.end,t);return e=BS(e.attributes.dur,t),null==i&&null!=e&&(i=n+e),{start:n,end:i}}function BS(e,t){var n=null;if(zS.test(e)){e=zS.exec(e),n=Number(e[1]);var i=Number(e[2]),r=Number(e[3]),a=Number(e[4]);n=(r+=(a+=(Number(e[5])||0)/t.h)/t.frameRate)+60*i+3600*n}else if(KS.test(e))n=FS(KS,e);else if(XS.test(e))n=FS(XS,e);else if(YS.test(e))e=YS.exec(e),n=Number(e[1])/t.frameRate;else if(qS.test(e))e=qS.exec(e),n=Number(e[1])/t.g;else if(ZS.test(e))n=FS(ZS,e);else if(e)throw new Ce(2,2,2001,"Could not parse cue time range in TTML");return n}function FS(e,t){return null==(e=e.exec(t))||""==e[0]?null:(Number(e[4])||0)/1e3+(Number(e[3])||0)+60*(Number(e[2])||0)+3600*(Number(e[1])||0)}function jS(e,t,n,i){this.frameRate=Number(e)||30,this.h=Number(t)||1,this.g=Number(i),0==this.g&&(this.g=e?this.frameRate*this.h:1),n&&(e=/^(\d+) (\d+)$/g.exec(n))&&(this.frameRate*=Number(e[1])/Number(e[2]))}Bi("application/x-subtitle-lrc",function(){return new TS}),xS.prototype.parseInit=function(){},xS.prototype.setSequenceMode=function(){},xS.prototype.setManifestType=function(){},xS.prototype.parseMedia=function(e,t,n,i){var r=Ne(e);if(e=[],""==r)return e;var a=fn(r,"tt",!0);if(!a)throw new Ce(2,2,2005,"Failed to parse TTML.");if(!(r=wn(a,"body")[0]))return[];var o=Cn(a,$S,"frameRate"),s=Cn(a,$S,"subFrameRate"),u=Cn(a,$S,"frameRateMultiplier"),h=Cn(a,$S,"tickRate"),c=Cn(a,$S,"cellResolution"),d=a.attributes["xml:space"]||"default",p=Cn(a,eT,"extent");if("default"!=d&&"preserve"!=d)throw new Ce(2,2,2005,"Invalid xml:space value: "+d);d="default"==d,o=new jS(o,s,u,h),c=function(e){return e&&(e=/^(\d+) (\d+)$/.exec(e))?{Yc:parseInt(e[1],10),rows:parseInt(e[2],10)}:null}(c),s=((s=wn(a,"metadata")[0])?s.children:[]).filter(function(e){return"\n"!=e}),u=wn(a,"style"),h=[];for(var f=l(a=wn(a,"region")),g=f.next();!g.done;g=f.next())(g=kS(g.value,u,p))&&h.push(g);if(yn(r,"p").length)throw new Ce(2,2,2001,"

can only be inside

in TTML");for(f=(p=l(yn(r,"div"))).next();!f.done;f=p.next())if(yn(f.value,"span").length)throw new Ce(2,2,2001," can only be inside

in TTML");return(t=CS(r,t,o,s,u,a,h,d,c,null,!1,n,i))&&(t.backgroundColor||(t.backgroundColor="transparent"),e.push(t)),e},H("shaka.text.TtmlTextParser",xS),xS.prototype.parseMedia=xS.prototype.parseMedia,xS.prototype.setManifestType=xS.prototype.setManifestType,xS.prototype.setSequenceMode=xS.prototype.setSequenceMode,xS.prototype.parseInit=xS.prototype.parseInit;var GS=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,HS=/^(\d{1,4}(?:\.\d+)?|100)%$/,VS=/^(\d+px|\d+em|\d*\.?\d+c)$/,WS=/^(\d+)px (\d+)px$/,zS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,KS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,XS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,YS=/^(\d*(?:\.\d*)?)f$/,qS=/^(\d*(?:\.\d*)?)t$/,ZS=RegExp("^(?:(\\d*(?:\\.\\d*)?)h)?(?:(\\d*(?:\\.\\d*)?)m)?(?:(\\d*(?:\\.\\d*)?)s)?(?:(\\d*(?:\\.\\d*)?)ms)?$"),JS=(new Map).set("left",oi).set("center","center").set("right","end").set("start",oi).set("end","end"),QS=(new Map).set("left","line-left").set("center","center").set("right","line-right"),$S=["http://www.w3.org/ns/ttml#parameter","http://www.w3.org/2006/10/ttaf1#parameter"],eT=["http://www.w3.org/ns/ttml#styling","http://www.w3.org/2006/10/ttaf1#styling"],tT=["http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt","http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"];function nT(){this.g=new xS}function iT(){this.g="UNKNOWN"}function rT(e,t,n){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(t))?(t=i[1],e.textAlign="middle"==t?$n:ei[t.toUpperCase()]):(i=/^vertical:(lr|rl)$/.exec(t))?e.writingMode="lr"==i[1]?"vertical-lr":"vertical-rl":(i=/^size:([\d.]+)%$/.exec(t))?e.size=Number(i[1]):(i=/^position:([\d.]+)%(?:,(line-left|line-right|middle|center|start|end|auto))?$/.exec(t))?(e.position=Number(i[1]),i[2]&&(t=i[2],e.positionAlign="line-left"==t||"start"==t?"line-left":"line-right"==t||"end"==t?"line-right":"center"==t||"middle"==t?"center":Qn)):(i=/^region:(.*)$/.exec(t))?(t=function(e,t){return e=e.filter(function(e){return e.id==t}),e.length?e[0]:null}(n,i[1]))&&(e.region=t):(n=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(t))?(e.lineInterpretation=1,e.line=Number(n[1]),n[2]&&(e.lineAlign=si[n[2].toUpperCase()])):(n=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(t))&&(e.lineInterpretation=ai,e.line=Number(n[1]),n[2]&&(e.lineAlign=si[n[2].toUpperCase()]))}function aT(){this.g=null}function oT(e,t,n){var i,r,a;return(new ca).box("payl",ma(function(e){i=Ne(e)})).box("iden",ma(function(e){r=Ne(e)})).box("sttg",ma(function(e){a=Ne(e)})).parse(e),i?function(e,t,n,i,r){if(Yn(e=new zn(i,r,e)),t&&(e.id=t),n)for(n=an(t=new tn(n));n;)rT(e,n,[]),nn(t),n=an(t);return e}(i,r,a,t,n):null}function sT(){}function uT(){this.g=new iT}function lT(e){var t="WEBVTT\n\n";if(""==e)return t;for(var n=(e=l((e=(e=e.replace(/\r+/g,"")).trim()).split("\n\n"))).next();!n.done;n=e.next())(n=n.value.split(/\n/))[0].match(/\d+/)&&n.shift(),n[0]=n[0].replace(/,/g,"."),t+=n.join("\n").replace(/{b}/g,"").replace(/{\/b}/g,"").replace(/{i}/g,"").replace(/{\/i}/g,"").replace(/{u}/g,"").replace(/{\/u}/g,"")+"\n\n";return t}function hT(){}function cT(e,t){var n=t.Fontname;if(n&&(e.fontFamily=n),(n=t.Fontsize)&&(e.fontSize=n+"px"),(n=t.PrimaryColour)&&(n=dT(n))&&(e.color=n),(n=t.BackColour)&&(n=dT(n))&&(e.backgroundColor=n),t.Bold&&(e.fontWeight=ci),t.Italic&&(e.fontStyle=pi),t.Underline&&e.textDecoration.push(gi),(n=t.Spacing)&&(e.letterSpacing=n+"px"),n=t.Alignment)switch(parseInt(n,10)){case 1:e.displayAlign=ti,e.textAlign="start";break;case 2:e.displayAlign=ti,e.textAlign=$n;break;case 3:e.displayAlign=ti,e.textAlign="end";break;case 5:e.displayAlign="before",e.textAlign="start";break;case 6:e.displayAlign="before",e.textAlign=$n;break;case 7:e.displayAlign="before",e.textAlign="end";break;case 9:e.displayAlign="center",e.textAlign="start";break;case 10:e.displayAlign="center",e.textAlign=$n;break;case 11:e.displayAlign="center",e.textAlign="end"}(t=t.AlphaLevel)&&(e.opacity=parseFloat(t))}function dT(e){return 0<=(e=parseInt(e.replace("&H",""),16))?"rgba("+(255&e)+","+(e>>8&255)+","+(e>>16&255)+","+(e>>24&255^255)/255+")":null}function pT(e){return 3600*((e=vT.exec(e))[1]?parseInt(e[1].replace(":",""),10):0)+60*parseInt(e[2],10)+parseFloat(e[3])}Bi("application/ttml+xml",function(){return new xS}),nT.prototype.parseInit=function(e){var t=!1;if((new ca).box("moov",da).box("trak",da).box("mdia",da).box("minf",da).box("stbl",da).V("stsd",pa).box("stpp",function(e){t=!0,e.parser.stop()}).parse(e),!t)throw new Ce(2,2,2007)},nT.prototype.setSequenceMode=function(){},nT.prototype.setManifestType=function(){},nT.prototype.parseMedia=function(e,t,n){var i=[],r=null,a=[],o=new Map,s=[];if((new ca).box("moof",da).box("traf",da).V("tfhd",function(e){r=ho(e.reader,e.flags).ce}).V("trun",function(e){for(var t=(e=l((e=fo(e.reader,e.version,e.flags)).Vh)).next();!t.done;t=e.next())s.push(t.value.sampleSize||r||0)}).V("subs",function(e){for(var t=e.reader,n=t.W(),i=-1,r=0;r>>5)-n)?{le:n,wa:e}:null}function bT(e,t){var n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=(60&e[t+2])>>>2;if(i>n.length-1)return null;var r=((192&e[t+2])>>>6)+1,a=(1&e[t+2])<<2;return a|=(192&e[t+3])>>>6,{sampleRate:n[i],channelCount:a,codec:"mp4a.40."+r}}function _T(e,t){if(t+1=e.length)return!1;var i=(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5;return!(i<=n)&&((t+=i)===e.length||t+1e.length||11!==e[t]||119!==e[t+1])return null;var n=e[t+4]>>6;if(3<=n)return null;var i=63&e[t+4],r=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*i+n];if(t+r>e.length)return null;var a=e[t+6]>>5,o=0;2===a?o+=2:(1&a&&1!==a&&(o+=2),4&a&&(o+=2)),o=(e[t+6]<<8|e[t+7])>>12-o&1;var s=7&e[t+5];return e=new Uint8Array([n<<6|e[t+5]>>3<<1|s>>2,(3&s)<<6|a<<3|o<<2|i>>4,i<<4&224]),{sampleRate:[48e3,44100,32e3][n],channelCount:[2,1,2,3,3,4,4,5][a]+o,Ma:e,wa:r}}function TT(e,t){if(11===e[t]&&119===e[t+1]){var n,i,r=0,a=5;for(t+=a;0>>24+s<>s,r=r?r<r)return!0}return!1}function AT(e){this.j=e,this.h=0,this.g=new Map,this.i=null}function ET(e,t){if(t+8>e.length||2935!=(e[t]<<8|e[t+1]))return null;var n=new Ts(e.subarray(t+2));Es(n,2),Es(n,3);var i=xs(n,11)+1<<1,r=xs(n,2);if(3==r){r=[24e3,22060,16e3][r=xs(n,2)];var a=3}else r=[48e3,44100,32e3][r],a=xs(n,2);var o=xs(n,3),s=xs(n,1);return n=xs(n,5),t+i>e.byteLength?null:(e=Math.floor(i*r/(16*[1,2,3,6][a])),e=new Uint8Array([(8160&e)>>5,(31&e)<<3,r<<6|n<<1,o<<1|s,0]),{sampleRate:r,channelCount:[2,1,2,3,3,4,4,5][o]+s,Ma:e,wa:i})}function xT(e){this.j=e,this.h=0,this.g=new Map,this.i=null}Bi("text/x-ssa",function(){return new hT}),(i=wT.prototype).destroy=function(){this.g.clear()},i.isSupported=function(e){return"audio/aac"==e.toLowerCase().split(";")[0]&&Ot(this.convertCodecs("audio",e))},i.convertCodecs=function(e,t){return"audio/aac"==t.toLowerCase().split(";")[0]?'audio/mp4; codecs="'+(Di(t)||"mp4a.40.2")+'"':t},i.getOriginalMimeType=function(){return this.j},i.transmux=function(e,t,n,i){for(var r=Te(e),a=ws(r),o=a.length;o>3&3,i=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==n&&0!==r&&15!==r&&3!==a){var o=e[t+3]>>6;r=1e3*PT[14*(3===n?3-i:3===i?3:4)+r-1],a=LT[3*(3===n?0:2===n?1:2)+a],n=DT[n][i];var s=RT[i],u=Math.floor(n*r/a+(e[t+2]>>1&1))*s,l=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);return(l=l?parseInt(l[1],10):0)&&87>=l&&2===i&&224e3<=r&&0===o&&(e[t+3]|=128),{sampleRate:a,channelCount:3===o?1:2,wa:u,bm:8*n*s}}return null}function IT(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function MT(e,t){if(t+1n;n++)this.usertype[n]!==FT[n]&&(e=!1);e&&(this._parsing&&(this.type="sepiff"),t.call(this))})}(this)}function BT(e,t){for(var n=8,i=0;i>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,e.push(o),e.push(n.fullData)}r.data=qe.apply(Ve,h(e)),i.push(r)}}for(var i=[],r=null,a=!1,o=0;or?16:64)}if(ks(n),0===(i=Is(n)))Is(n);else if(1===i)for(Es(n,1),ks(n),ks(n),i=Is(n),r=0;r=p?(i=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][p-1],r=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][p-1]):255===p&&(i=xs(n,16),r=xs(n,16))}return n=(2-s)*(o+1)*16-2*c-2*d,a=16*(a+1)-2*u-2*l,u=[],t=t.fullData,u.push(t.byteLength>>>8&255),u.push(255&t.byteLength),u=u.concat.apply(u,h(t)),t=[],e=e.fullData,t.push(e.byteLength>>>8&255),t.push(255&e.byteLength),t=t.concat.apply(t,h(e)),{height:n,width:a,Wa:e=new Uint8Array([1,u[3],u[4],u[5],255,225].concat(u,[1],t)),cb:i,fb:r}}(w);if(!A||null==g)throw new Ce(2,3,3018,n?n.S()[0]:null);t.height=A.height,t.width=A.width,p={id:t.id,type:"video",codecs:"avc1",encrypted:t.encrypted&&0>24&255,j[1]=F>>16&255,j[2]=F>>8&255,j[3]=255&F,D.push(j),D.push(U.fullData)}}var G,H=D.length?{data:qe.apply(Ve,h(D)),isKeyframe:L}:null;if(H)null==x&&null!=M.dts&&(x=M.dts),G=I+1S;S++)xs(e,2);for(S=0;Sx;x++)for(var C=0;C<(3===x?2:6);C++)if(Ps(e)){var k=Math.min(64,1<<4+(x<<1));1=k?(E=I[k-1],x=M[k-1]):255===k&&(E=xs(e,16),x=xs(e,16))),Ps(e)&&Ps(e),Ps(e)&&(xs(e,3),Ps(e),Ps(e)&&(Ls(e),Ls(e),Ls(e))),Ps(e)&&(Is(e),Is(e)),Ps(e),Ps(e),Ps(e),(k=Ps(e))&&(Is(e),Is(e),Is(e),Is(e)),Ps(e)&&(xs(e,32),xs(e,32),Ps(e)&&Is(e),Ps(e)))for(M=!1,k=Ps(e),I=Ps(e),(k||I)&&((M=Ps(e))&&(Ls(e),xs(e,5),Ps(e),xs(e,5)),xs(e,4),xs(e,4),M&&xs(e,4),xs(e,5),xs(e,5),xs(e,5)),P=0;P<=a;P++){var D=!0;L=1,Ps(e)||(D=Ps(e));var R=!1;if(D?Is(e):R=Ps(e),R||(L=Is(e)+1),k){for(D=0;D>8,r[14]=255&i.Jf,r[15]=252|3&i.Kh,r[16]=252|3&i.Lg,r[17]=248|7&i.Hg,r[18]=248|7&i.Gg,r[19]=0,r[20]=0,r[21]=(3&i.Ng)<<6|(7&i.Ih)<<3|(i.mi?1:0)<<2|3,r[22]=3,r[23]=160,r[24]=0,r[25]=1,r[26]=(65280&e.byteLength)>>8,r[27]=255&e.byteLength,r.set(e,28),r[23+(5+e.byteLength)]=161,r[e.byteLength+29]=0,r[e.byteLength+30]=1,r[e.byteLength+31]=(65280&t.byteLength)>>8,r[e.byteLength+32]=255&t.byteLength,r.set(t,e.byteLength+33),r[23+(e.byteLength+10+t.byteLength)]=162,r[e.byteLength+10+t.byteLength+24]=0,r[e.byteLength+10+t.byteLength+25]=1,r[e.byteLength+10+t.byteLength+26]=(65280&n.byteLength)>>8,r[e.byteLength+10+t.byteLength+27]=255&n.byteLength,r.set(n,e.byteLength+10+t.byteLength+28),r}(t.fullData,n.fullData,i.fullData,{Ih:r.Ih,mi:r.mi,hh:e.hh,ih:e.ih,ah:e.ah,gh:e.gh,bh:e.bh,dh:e.dh,eh:e.eh,fh:e.fh,Vg:e.Vg,Wg:e.Wg,Xg:e.Xg,Yg:e.Yg,Zg:e.Zg,$g:e.$g,Ng:e.Ng,Jf:e.Jf,Lg:e.Lg,Hg:e.Hg,Gg:e.Gg,Kh:a.Kh}),{height:e.height,width:e.width,Wa:t,cb:e.dm,fb:e.cm}}(C);if(!V||null==x)throw new Ce(2,3,3018,n?n.S()[0]:null);t.height=V.height,t.width=V.width,p={id:t.id,type:"video",codecs:"hvc1",encrypted:t.encrypted&&0>>24&255,Xe.sampleRate>>>17&255,Xe.sampleRate>>>8&255,Xe.sampleRate>>>0&255,0,0].concat(h(Ye))),Je=Xe.sampleRate,Qe=l(u.zb()),$e=Qe.next();!$e.done;$e=Qe.next()){var tt=$e.value,nt=tt.data;null==Ke&&null!==tt.pts&&(Ke=tt.pts);for(var it=0;it(e=Math.floor(e%60))&&(e="0"+e),e=r+":"+e,t&&(10>r&&(e="0"+e),e=i+":"+e,0i&&(e="0"+e),e=n+":"+e)),e}function JT(e,t){WT.call(this,e,t);var n=this;this.g=us(),this.g.classList.add("shaka-ad-info"),this.g.disabled=!0,this.parent.appendChild(this.g),this.h=new zi(function(){if(n.ad.isLinear()){var e="",t=n.ad.getSequenceLength();1Date.now()){n.l.stop(),n.s=Date.now();var t=parseInt(n.h.textContent,10);t=n.m?t-e:t+e,n.h.textContent=t.toString()+"s",n.g.style.opacity="1",n.l.X(.5)}}else n.C=!0,n.s=Date.now(),n.l.X(.5)})}function aA(e,t){rA.call(this,e,t),this.g.classList.add("shaka-fast-forward-container"),this.i.textContent="fast_forward",this.m=!1}function oA(e,t){rA.call(this,e,t),this.g.classList.add("shaka-rewind-container"),this.i.textContent="fast_rewind",this.m=!0}function sA(e,t,n,i){WT.call(this,e,t);var r=this;this.container=ss("div"),this.container.classList.add("shaka-range-container"),this.container.classList.add.apply(this.container.classList,h(n)),this.i=!1,this.bar=document.createElement("input"),this.F=new zi(function(){r.onChangeEnd(),r.i=!1}),this.bar.classList.add("shaka-range-element"),this.bar.classList.add.apply(this.bar.classList,h(i)),this.bar.type="range",this.bar.step="any",this.bar.min="0",this.bar.max="1",this.bar.value="0",this.bar.disabled=!this.controls.Ba(),this.container.appendChild(this.bar),this.parent.appendChild(this.container),this.K=new zi(function(){r.bar.disabled=!1}),this.eventManager.o(this.controls,"showingui",function(){r.K.X(0)}),this.eventManager.o(this.controls,"hidingui",function(){r.K.stop(),r.bar.disabled=!0}),this.eventManager.o(this.bar,"mousedown",function(e){r.bar.disabled||(r.i=!0,r.onChangeStart(),e.stopPropagation())}),this.eventManager.o(this.bar,"touchstart",function(e){r.bar.disabled||(r.i=!0,lA(r,e),r.onChangeStart(),e.stopPropagation())}),this.eventManager.o(this.bar,"input",function(){r.onChange()}),this.eventManager.o(this.bar,"touchmove",function(e){r.i&&(lA(r,e),r.onChange(),e.stopPropagation())}),this.eventManager.o(this.bar,"touchend",function(e){r.i&&(r.i=!1,lA(r,e),r.onChangeEnd(),e.stopPropagation())}),this.eventManager.o(this.bar,"touchcancel",function(e){r.i&&(r.i=!1,lA(r,e),r.onChangeEnd(),e.stopPropagation())}),this.eventManager.o(this.bar,"mouseup",function(e){r.i&&(r.i=!1,r.onChangeEnd(),e.stopPropagation())}),this.eventManager.o(this.bar,"blur",function(){r.i&&(r.i=!1,r.onChangeEnd())}),this.eventManager.o(this.bar,"contextmenu",function(e){e.preventDefault(),e.stopPropagation()})}function uA(e,t){var n=e.bar.getBoundingClientRect(),i=parseFloat(e.bar.min),r=parseFloat(e.bar.max);e=parseFloat(e.bar.step)||1;var a=n.left+6;return n=n.right-6,t=i+(Math.max(a,Math.min(n,t))-a)/(n-a)*(r-i),t=Math.round((t-i)/e)*e+i,Math.min(r,Math.max(i,t))}function lA(e,t){t.preventDefault(),e.bar.value=uA(e,t.changedTouches[0].clientX)}function hA(e,t){sA.call(this,e,t,["shaka-seek-bar-container"],["shaka-seek-bar","shaka-no-propagation","shaka-show-controls-on-mouse-over"]);var n=this;this.D=ss("div"),this.D.classList.add("shaka-ad-markers"),this.container.insertBefore(this.D,this.container.childNodes[0]),this.H=this.controls.g,this.B=new zi(function(){var e=n.getValue();n.player.T()||e==n.video.duration&&(e-=.001),n.video.currentTime=e}),this.C=new zi(function(){cA(n)}),this.L=!1,this.h=ss("div"),this.h.id="shaka-player-ui-thumbnail-container",this.g=ss("img"),this.g.id="shaka-player-ui-thumbnail-image",this.g.draggable=!1,this.J=ss("div"),this.J.id="shaka-player-ui-thumbnail-time-container",this.G=ss("div"),this.G.id="shaka-player-ui-thumbnail-time",this.J.appendChild(this.G),this.h.appendChild(this.g),this.h.appendChild(this.J),this.container.appendChild(this.h),this.j=ss("div"),this.j.id="shaka-player-ui-time-container",this.container.appendChild(this.j),this.l=this.s=null,this.I=!1,this.u=new zi(function(){vA(n)}),this.m=[],this.eventManager.o(this.bar,"input",function(){n.controls.Oc()}),this.eventManager.o(this.localization,"locale-updated",function(){return fA(n)}),this.eventManager.o(this.localization,"locale-changed",function(){return fA(n)}),this.eventManager.o(this.adManager,"ad-started",function(){pA(n)||qT(n.container,!1)}),this.eventManager.o(this.adManager,"ad-stopped",function(){pA(n)&&qT(n.container,!0)}),this.eventManager.o(this.adManager,"ad-cue-points-changed",function(e){n.m=e.cuepoints,dA(n)}),this.eventManager.o(this.player,"unloading",function(){n.m=[],dA(n),n.l&&(n.l.abort(),n.l=null),n.s=null,vA(n),yA(n)}),this.eventManager.o(this.bar,"mousemove",function(e){if(n.controls.Ec())yA(n),vA(n);else{var t=uA(n,e.clientX),i=n.bar.getBoundingClientRect();e=Math.max(0,e.clientX-i.left),n.player.mh().length?(yA(n),mA(n,e,t)):(vA(n),gA(n,e,t))}}),this.eventManager.o(this.container,"mouseleave",function(){yA(n),n.u.stop(),n.u.X(.25)}),this.setValue(this.video.currentTime),this.update(),fA(this),this.ad&&qT(this.container,!1)}function cA(e){if(e.m.length){for(var t=e.player.xa(),n=t.end-t.start,i=["to right"],r=[],a=e.H.seekBarColors.adBreaks,o=!1,s=l(e.m),u=s.next();!u.done;u=s.next())if(-1!=(u=u.value).start||u.end){if(!u.end&&u.start>=t.start||"number"==typeof u.end&&u.end>t.start){var h=(Math.max(u.start,t.start)-t.start)/n||0,c=h+.01;u.end&&(c=(u.end-t.start)/n||0),r.push({start:h,end:c})}}else o=!0;for(n=(t=l(r=r.sort(function(e,t){return e.start-t.start}))).next();!n.done;n=t.next())n=n.value,i.push("transparent "+100*n.start+"%"),i.push(a+" "+100*n.start+"%"),i.push(a+" "+100*n.end+"%"),i.push("transparent "+100*n.end+"%");o&&(i.push("transparent 99%"),i.push(a+" 99%")),e.D.style.background="linear-gradient("+i.join(",")+")"}else e.D.style.background="transparent",e.C.stop()}function dA(e){function t(){cA(e);var t=e.player.xa();t=t.end-t.start,e.player.T()&&5t||!isFinite(t))||null!=e.ad&&e.ad.isLinear())}function fA(e){e.bar.ariaLabel=e.localization.resolve("SEEK")}function gA(e,t,n){var i=e.j.clientWidth;e.j.style.width="auto",e.j.style.height="20px",e.j.style.top="-30px",e.j.style.left=Math.min(e.bar.offsetWidth-i,Math.max(0,t-i/2))+"px",e.j.style.right="",e.j.style.visibility="visible",t=e.player.xa(),e.player.T()?1>(n=t.end-n)?(e.j.textContent=e.localization.resolve("LIVE"),e.j.style.left="",e.j.style.right="0px"):e.j.textContent="-"+ZT(n,3600<=n):(n-=t.start,e.j.textContent=ZT(n,3600<=n))}function mA(e,t,n){var i,r,a,o,s,u,l,h,c,d,p,f,g,m,v,y,b;L(function(T){switch(T.g){case 1:return 0>n&&(n=0),i=!1,e.m.length&&(i=e.m.some(function(e){return!!e.end&&n>=e.start&&n<=e.end})),i?(vA(e),gA(e,t,n),T.return()):(r=e.player.xa(),a=Math.max(Math.ceil(r.start),Math.min(Math.floor(r.end),n)),e.player.T()?(o=r.end-n,e.G.textContent=1>o?e.localization.resolve("LIVE"):"-"+ZT(o,3600<=o)):e.G.textContent=ZT(n,3600<=n),_(T,e.player.Vi(null,a),2));case 2:if(!(s=T.h)||!s.uris||!s.uris.length)return vA(e),gA(e,t,n),T.return();if(s.widths&&o>t?(t=2*Math.sqrt(1+o-s-t),e[3]=(a-l)/t,e[0]=.25*t,e[1]=(n+r)/t,e[2]=(u+i)/t):s>t?(t=2*Math.sqrt(1+s-o-t),e[3]=(u-i)/t,e[0]=(n+r)/t,e[1]=.25*t,e[2]=(a+l)/t):(t=2*Math.sqrt(1+t-o-s),e[3]=(n-r)/t,e[0]=(u+i)/t,e[1]=(a+l)/t,e[2]=.25*t)}function kA(e,t){var n=t[0],i=t[1],r=t[2],a=n+n,o=i+i,s=r+r;n*=a;var u=i*a;i*=o;var l=r*a,h=r*o;r*=s,a*=t=t[3],o*=t,t*=s,e[0]=1-i-r,e[1]=u+t,e[2]=l-o,e[3]=0,e[4]=u-t,e[5]=1-n-r,e[6]=h+a,e[7]=0,e[8]=l+o,e[9]=h-a,e[10]=1-n-i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}function IA(){var e=new Float32Array(4);return e[3]=1,e}function MA(e){var t=[],n=[],i=[],r=Math.PI;e=void 0!==e&&e?r/2:r;for(var a=0;100>=a;a++){var o=a*r/100,s=Math.sin(o);o=Math.cos(o);for(var u=0;100>=u;u++){var l=2*u*e/100;t.push(Math.sin(l)*s,o,Math.cos(l)*s),n.push(u/100,a/100)}}for(r=0;100>r;r++)for(e=0;100>e;e++)s=(a=101*r+e)+101,i.push(a,s,a+1),i.push(s,s+1,a+1);return{Yj:t,Vj:n,indices:i}}function PA(e,t,n,i,r){this.i=e,this.qa=t,this.s=n,this.g=i,this.u=new At,this.L=IA(),this.h=IA(),this.ba=this.na=this.$=this.l=null,this.D=AA(),this.I=AA(),this.N=AA(),this.Y=AA(),this.C=null,this.O=!1,this.J=this.B=null,this.sa=this.ua=0,this.Z=this.P=this.R=this.K=null,this.H=this.G=0,this.j=75,this.U=0,this.m=r,this.F=-1,function(e){(function(e){var t=e.D,n=[0,0,0],i=[1,0,0],r=[0,1,0],a=n[0],o=n[1];n=n[2];var s=r[0],u=r[1],l=r[2],h=i[0];r=i[1];var c=i[2];if(1e-6>Math.abs(a-h)&&1e-6>Math.abs(o-r)&&1e-6>Math.abs(n-c))for(a=0;16>a;a++)t[a]=0==a%5?1:0;else{i=a-h,r=o-r,h=n-c;var d=1/Math.sqrt(i*i+r*r+h*h);c=u*(h*=d)-l*(r*=d),l=l*(i*=d)-s*h,s=s*r-u*i,(d=Math.sqrt(c*c+l*l+s*s))?(c*=d=1/d,l*=d,s*=d):s=l=c=0,u=r*s-h*l;var p=h*c-i*s,f=i*l-r*c;(d=Math.sqrt(u*u+p*p+f*f))?(u*=d=1/d,p*=d,f*=d):f=p=u=0,t[0]=c,t[1]=u,t[2]=i,t[3]=0,t[4]=l,t[5]=p,t[6]=r,t[7]=0,t[8]=s,t[9]=f,t[10]=h,t[11]=0,t[12]=-(c*a+l*o+s*n),t[13]=-(u*a+p*o+f*n),t[14]=-(i*a+r*o+h*n),t[15]=1}CA(e.L,e.D),e=t=e.Y,a=(n=[4,4,4])[0],o=n[1],n=n[2],t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]})(e),function(e){RA(e),e.g.viewport(0,0,e.g.drawingBufferWidth,e.g.drawingBufferHeight),e.g.clearColor(0,0,0,1),e.g.enable(e.g.CULL_FACE),e.g.cullFace(e.g.FRONT),e.g.clear(e.g.COLOR_BUFFER_BIT)}(e),function(e){var t=LA(e,e.g.VERTEX_SHADER),n=LA(e,e.g.FRAGMENT_SHADER);e.l=e.g.createProgram(),e.g.attachShader(e.l,t),e.g.attachShader(e.l,n),e.g.linkProgram(e.l),"cubemap"==e.m?(e.R=e.g.getAttribLocation(e.l,"aVertexPosition"),e.P=e.g.getAttribLocation(e.l,"aTextureCoord")):(e.R=e.g.getAttribLocation(e.l,"a_vPosition"),e.g.enableVertexAttribArray(e.R),e.P=e.g.getAttribLocation(e.l,"a_TexCoordinate"),e.g.enableVertexAttribArray(e.P))}(e),function(e){e.K="cubemap"==e.m?{Yj:[-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1],Vj:[2/3,.5,1/3,.5,1/3,0,2/3,0,2/3,.5,2/3,0,1,0,1,.5,1,1,2/3,1,2/3,.5,1,.5,0,.5,0,0,1/3,0,1/3,.5,0,.5,1/3,.5,1/3,1,0,1,1/3,1,1/3,.5,2/3,.5,2/3,1],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}:"halfequirectangular"==e.m?MA(!0):MA(),e.$=e.g.createBuffer(),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.$),e.g.bufferData(e.g.ARRAY_BUFFER,new Float32Array(e.K.Yj),e.g.STATIC_DRAW),e.na=e.g.createBuffer(),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.na),e.g.bufferData(e.g.ARRAY_BUFFER,new Float32Array(e.K.Vj),e.g.STATIC_DRAW),e.ba=e.g.createBuffer(),e.g.bindBuffer(e.g.ELEMENT_ARRAY_BUFFER,e.ba),e.g.bufferData(e.g.ELEMENT_ARRAY_BUFFER,new Uint16Array(e.K.indices),e.g.STATIC_DRAW)}(e),function(e){e.Z=e.g.createTexture(),e.g.bindTexture(e.g.TEXTURE_2D,e.Z),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_WRAP_S,e.g.CLAMP_TO_EDGE),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_WRAP_T,e.g.CLAMP_TO_EDGE),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_MIN_FILTER,e.g.NEAREST),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_MAG_FILTER,e.g.NEAREST)}(e),Eu(e.i,HTMLMediaElement.HAVE_CURRENT_DATA,e.u,function(){if(e.i.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA&&DA(e),"requestVideoFrameCallback"in e.i){var t=function(){-1!=e.F&&(DA(e),-1!=e.F&&(e.F=e.i.requestVideoFrameCallback(t)))};e.F=e.i.requestVideoFrameCallback(t)}else{var n;e.u.o(e.i,"canplaythrough",function(){DA(e)}),e.u.o(e.i,"playing",function(){if(e.B&&e.B.stop(),!n)for(var t=e.qa.qb(),i=(t=l(t)).next();!i.done;i=t.next())(i=i.value.frameRate)&&(!n||ne.i.readyState||!n&&0==e.i.playbackRate||(EA(e.I,e.j*Math.PI/180,1.5625),"cubemap"==e.m?EA(e.I,e.j*Math.PI/180,2.5):EA(e.I,e.j*Math.PI/180,1.5625),e.g.useProgram(e.l),e.g.clear(e.g.COLOR_BUFFER_BIT),RA(e),t&&(e.g.activeTexture(e.g.TEXTURE0),e.g.bindTexture(e.g.TEXTURE_2D,e.Z),e.g.pixelStorei(e.g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.g.texImage2D(e.g.TEXTURE_2D,0,e.g.RGBA,e.g.RGBA,e.g.UNSIGNED_BYTE,e.i)),"equirectangular"!=e.m&&"halfequirectangular"!=e.m||(xA(e.N,e.D,e.Y),xA(e.N,e.I,e.N)),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.$),e.g.vertexAttribPointer(e.R,3,e.g.FLOAT,!1,0,0),e.g.enableVertexAttribArray(e.R),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.na),e.g.vertexAttribPointer(e.P,2,e.g.FLOAT,!1,0,0),e.g.enableVertexAttribArray(e.P),e.g.bindBuffer(e.g.ELEMENT_ARRAY_BUFFER,e.ba),"cubemap"==e.m?(e.g.uniformMatrix4fv(e.g.getUniformLocation(e.l,"uProjectionMatrix"),!1,e.I),e.g.uniformMatrix4fv(e.g.getUniformLocation(e.l,"uModelViewMatrix"),!1,e.N)):e.g.uniformMatrix4fv(e.g.getUniformLocation(e.l,"u_VPMatrix"),!1,e.N),e.g.uniform1i(e.g.getUniformLocation(e.l,"uSampler"),0),e.O&&e.g.viewport(0,0,e.s.width/2,e.s.height),e.g.drawElements(e.g.TRIANGLES,e.K.indices.length,e.g.UNSIGNED_SHORT,0),e.O&&(e.g.viewport(e.s.width/2,0,e.s.width/2,e.s.height),e.g.drawElements(e.g.TRIANGLES,e.K.indices.length,e.g.UNSIGNED_SHORT,0)))}function RA(e){var t=e.i.videoWidth;t||(t=e.s.scrollWidth);var n=e.i.videoHeight;if(n||(n=e.s.scrollHeight),e.ua!==t||e.sa!==n){e.s.width=t,e.s.height=n,e.ua=t,e.sa=n;var i=t/n,r=e.I,a=-i,o=1/(i-a);r[0]=0*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=(i+a)*o,r[9]=0,r[10]=-1,r[11]=-1,r[12]=0,r[13]=0,r[14]=-0,r[15]=0,e.I=r,e.g.viewport(0,0,t,n)}}function NA(e,t,n,i){var r=1/0,a=90*Math.PI/180;"halfequirectangular"==e.m&&(r=90*Math.PI/180,a/=2);var o="cubemap"==e.m?e.N:e.D;if(e.G+=t,e.H+=n,e.G-r){r=Math.sin(t),t=Math.cos(t);var s=o[0],u=o[1],l=o[2],h=o[3],c=o[8],d=o[9],p=o[10],f=o[11];o!=o&&(o[4]=o[4],o[5]=o[5],o[6]=o[6],o[7]=o[7],o[12]=o[12],o[13]=o[13],o[14]=o[14],o[15]=o[15]),o[0]=s*t-c*r,o[1]=u*t-d*r,o[2]=l*t-p*r,o[3]=h*t-f*r,o[8]=s*r+c*t,o[9]=u*r+d*t,o[10]=l*r+p*t,o[11]=h*r+f*t}else e.G-=t;e.H-a?(a=AA(),r=AA(),t=-1*n,n=Math.sin(t),t=Math.cos(t),s=r[4],u=r[5],l=r[6],h=r[7],c=r[8],d=r[9],p=r[10],f=r[11],r!==a&&(a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=r[3],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[4]=s*t+c*n,a[5]=u*t+d*n,a[6]=l*t+p*n,a[7]=h*t+f*n,a[8]=c*t-s*n,a[9]=d*t-u*n,a[10]=p*t-l*n,a[11]=f*t-h*n,xA(o,a,o)):e.H-=n,n=AA(),a=AA(),r=Math.sin(i),i=Math.cos(i),t=a[0],s=a[1],u=a[2],l=a[3],h=a[4],c=a[5],d=a[6],p=a[7],a!==n&&(n[8]=a[8],n[9]=a[9],n[10]=a[10],n[11]=a[11],n[12]=a[12],n[13]=a[13],n[14]=a[14],n[15]=a[15]),n[0]=t*i+h*r,n[1]=s*i+c*r,n[2]=u*i+d*r,n[3]=l*i+p*r,n[4]=h*i-t*r,n[5]=c*i-s*r,n[6]=d*i-u*r,n[7]=p*i-l*r,xA(o,n,o),DA(e,!1)}function OA(e,t){(void 0===t||t)&&(CA(e.h,e.D),e.U=0,e.C=IA(),e.C[0]=(e.h[0]-e.L[0])/20,e.C[1]=(e.h[1]-e.L[1])/20,e.C[2]=(e.h[2]-e.L[2])/20,e.C[3]=(e.h[3]-e.L[3])/20),e.h[0]-=e.C[0],e.h[1]-=e.C[1],e.h[2]-=e.C[2],e.h[3]-=e.C[3],t=AA(),function(e,t){var n=t[0],i=t[1],r=t[2],a=n*n+i*i+r*r+(t=t[3])*t;0e.U?e.J=new zi(function(){OA(e,!1),e.G=0,e.H=0,e.U++,DA(e,!1)}).X(.025):(kA(t,e.L),e.D=t)}function UA(e,t,n,i,r){$.call(this);var a=this;this.i=e,this.l=t,this.F=n,this.J=i,this.u=r,this.s=new At,this.h=new At,this.B=jA(this.l),this.g=null,this.m=!1,this.I=this.H=this.G=this.D=this.C=0,this.j=null,this.s.o(i,"loading",function(){a.g&&OA(a.g),BA(a)}),this.s.o(i,"spatialvideoinfo",function(e){switch((e=e.detail).projection){case"rect":default:a.j=null;break;case"equi":a.j="equirectangular";break;case"hequ":switch(e.hfov){case 360:a.j="equirectangular";break;case 180:a.j="halfequirectangular";break;default:null==e.hfov?a.j="halfequirectangular":a.j=null}break;case"fish":a.j="halfequirectangular"}BA(a)}),this.s.o(i,"nospatialvideoinfo",function(){a.j=null,BA(a)}),this.s.o(i,"unloading",function(){a.j=null,BA(a)}),BA(this)}function BA(e){if(e.u.displayInVrMode||e.j){e.l||(e.l=document.createElement("canvas"),e.l.classList.add("shaka-vr-canvas-container"),e.F.parentElement.insertBefore(e.l,e.F.nextElementSibling),e.B=jA(e.l));var t=e.j||e.u.defaultVrProjectionMode;e.g?e.g.m!=t&&(e.h.Sa(),e.g.release(),FA(e,t)):(e.l.style.display="",FA(e,t),e.dispatchEvent(new V("vrstatuschanged",(new Map).set("newStatus",e.Vb()))))}else!e.u.displayInVrMode&&!e.j&&e.l&&e.g&&(e.l.style.display="none",e.h.Sa(),e.g.release(),e.g=null,e.dispatchEvent(new V("vrstatuschanged",(new Map).set("newStatus",e.Vb()))))}function FA(t,n){t.B&&t.l&&(t.g=new PA(t.F,t.J,t.l,t.B,n),function(t){t.h.o(t.i,"mousedown",function(e){if(!t.m){var n=e.clientX;e=e.clientY,t.m=!0,t.C=n,t.D=e}}),0=n.j&&(n.j+=i),20>n.j?n.j=20:100n?n:eMath.abs(n-e)&&(n=1/0);try{navigator.mediaSession.setPositionState({duration:Math.max(0,n),playbackRate:t.B.playbackRate,position:Math.max(0,e)})}catch(e){}}},r=function(){try{navigator.mediaSession.setPositionState()}catch(e){}},a=function(e){var n=t.g.keyboardSeekDistance;switch(e.action){case"pause":case"play":JA(t);break;case"seekbackward":if(e.seekOffset&&!isFinite(e.seekOffset))break;t.j&&t.j.isLinear()||aE(t,t.u.getValue()-(e.seekOffset||n));break;case"seekforward":if(e.seekOffset&&!isFinite(e.seekOffset))break;t.j&&t.j.isLinear()||aE(t,t.u.getValue()+(e.seekOffset||n));break;case"seekto":if(e.seekTime&&!isFinite(e.seekTime))break;t.j&&t.j.isLinear()||aE(t,t.s.xa().start+e.seekTime);break;case"stop":t.s.nc();break;case"enterpictureinpicture":t.j&&t.j.isLinear()||t.Sc()}};n("pause",a),n("play",a),n("seekbackward",a),n("seekforward",a),n("seekto",a),n("stop",a),("documentPictureInPicture"in e||document.pictureInPictureEnabled)&&n("enterpictureinpicture",a),n=function(){t.s.T()||0!=t.s.xa().start?(i(),t.h.o(t.B,"timeupdate",i)):r()},t.s.$&&n(),t.h.o(t.s,"loaded",n),t.h.o(t.s,"unloading",function(){t.h.Da(t.B,"timeupdate",i)}),t.h.o(t.s,"metadata",function(e){var n,i;(e=e.payload)&&("TIT2"==e.key&&e.data&&(n=e.data),"APIC"==e.key&&"--\x3e"==e.mimeType&&(i=e.data),n&&(e={title:n,artwork:[]},navigator.mediaSession.metadata&&((e=navigator.mediaSession.metadata).title=n),navigator.mediaSession.metadata=new MediaMetadata(e)),i&&(i!=(n=t.m).poster&&(n.poster=i),n={title:"",artwork:[{src:i}]},navigator.mediaSession.metadata&&((n=navigator.mediaSession.metadata).artwork=[{src:i}]),navigator.mediaSession.metadata=new MediaMetadata(n)))})}}(this),this.ba=new Set,nE(this),this.ua.ya(this.g.refreshTickInSeconds),this.h.o(this.sa,"locale-changed",function(e){e=e.locales[0],o.na.setLocale(e),o.l.setAttribute("lang",e)}),this.na.initInterstitial(this.G,this.Z,this.m),this.h.o(this.s,"texttrackvisibility",function(){$A(o)}),this.h.o(this.s,"unloading",function(){o.j||(o.tc()&&ZA(o),o.Gd()&&o.Sc())})}function zA(e){for(var t=l(e.H),n=t.next();!n.done;n=t.next())n.value.release();e.H=[]}function KA(e,t){sE.set(e,t)}function XA(e){return!(!document.fullscreenEnabled||e.m.webkitSupportsFullscreen&&e.g.preferVideoFullScreenInVisionOS&&"APPLE_VR"==Me().Ja())}function YA(t){return"documentPictureInPicture"in e&&t.g.preferDocumentPictureInPicture}function qA(e){var t,n;return L(function(i){switch(i.g){case 1:if(S(i,2),!XA(e)){(t=e.m).webkitSupportsFullscreen&&t.webkitEnterFullscreen(),i.A(4);break}if(!e.Gd()){i.A(5);break}return _(i,e.Sc(),6);case 6:if(!YA(e)){i.A(5);break}return _(i,new Promise(function(e){new zi(e).X(.05)}),5);case 5:return _(i,e.g.fullScreenElement.requestFullscreen({navigationUI:"hide"}),9);case 9:if(!e.g.forceLandscapeOnFullscreen||!screen.orientation){i.A(4);break}return S(i,11),_(i,screen.orientation.lock("landscape"),13);case 13:A(i,4,2);break;case 11:E(i,2);case 4:A(i,0);break;case 2:n=E(i),e.dispatchEvent(new V("error",(new Map).set("detail",n))),w(i)}})}function ZA(e){var t;return L(function(n){return XA(e)?(screen.orientation&&screen.orientation.unlock(),_(n,document.exitFullscreen(),0)):((t=e.m).webkitSupportsFullscreen&&t.webkitExitFullscreen(),n.A(0))})}function JA(e){if(e.Y){if(e.j&&(e.j&&e.j.isPaused()?e.j.play():e.j&&e.j.pause(),e.j.isLinear()))return;e.B.duration&&(e.B.paused&&!e.R?(e.s.isEnded()&&(e.B.currentTime=e.s.xa().start),e.B.play()):e.B.pause())}}function QA(e,t){"mousemove"==t.type&&(e.i.classList.remove("shaka-keyboard-navigation"),eE(e)),"touchstart"==t.type||"touchmove"==t.type||"touchend"==t.type||"keyup"==t.type?e.O=Date.now():e.O+1e3\n \n \n \n \n \n \n \n ')}(this),this.g.seekOnTaps&&(function(e){var t=ss("div");t.classList.add("shaka-hidden-fast-forward-container"),e.i.appendChild(t),e.Ya=new aA(t,e),e.H.push(e.Ya)}(this),function(e){var t=ss("div");t.classList.add("shaka-hidden-rewind-container"),e.i.appendChild(t),e.eb=new oA(t,e),e.H.push(e.eb)}(this)),this.Ia=ss("div"),this.Ia.classList.add("shaka-server-side-ad-container"),this.i.appendChild(this.Ia),function(e){e.L=ss("div"),e.L.classList.add("shaka-bottom-controls"),e.L.classList.add("shaka-no-propagation"),e.i.appendChild(e.L),e.h.o(e.L,"click",function(t){t.target.closest(".shaka-overflow-button")||e.Oc()}),function(e){e.P=ss("div"),e.P.classList.add("shaka-ad-controls");var t=null!=e.j&&e.j.isLinear();qT(e.P,t),e.L.appendChild(e.P),t=new _A(e.P,e),e.H.push(t)}(e),function(e){if(e.g.addSeekBar)e.u=uE.create(e.L,e),e.H.push(e.u);else{for(var t=l(e.I),n=t.next();!n.done;n=t.next())n.value.classList.add("shaka-low-position");(e=e.F).classList.contains("shaka-tooltips-on")&&e.classList.add("shaka-tooltips-low-position")}}(e),e.F=ss("div"),e.F.classList.add("shaka-controls-button-panel"),e.F.classList.add("shaka-show-controls-on-mouse-over"),e.g.enableTooltips&&e.F.classList.add("shaka-tooltips-on"),e.L.appendChild(e.F);for(var t=l(e.g.controlPanelElements),n=t.next();!n.done;n=t.next())if(n=n.value,sE.get(n)){var i=sE.get(n).create(e.F,e);e.H.push(i),"time_and_duration"==n&&(n=new JT(e.F,e),e.H.push(n))}else Y("Unrecognized control panel element requested:",n)}(this),this.I=Array.from(this.l.getElementsByClassName("shaka-settings-menu")),this.I.push.apply(this.I,h(Array.from(this.l.getElementsByClassName("shaka-overflow-menu")))),this.Ta=Array.from(this.l.getElementsByClassName("shaka-show-controls-on-mouse-over")),eE(this);for(var n=(e=l(this.l.getElementsByClassName("shaka-no-propagation"))).next();!n.done;n=e.next()){n=n.value;var i=function(e){return e.stopPropagation()};this.h.o(n,"click",i),this.h.o(n,"dblclick",i),0.499995*o?(o=Math.PI/2,e=2*Math.atan2(n,e)):s<-.499995*o?(o=-Math.PI/2,e=2*Math.atan2(n,e)):(o=Math.asin(2*(e*i-t*n)),e=Math.atan2(2*(e*t+n*i),1-2*(r+a))),e=180*Math.acos(Math.cos(e)*Math.cos(o))/Math.PI}else Y("Not playing VR content"),e=null;return e},i.jl=function(){var e=this.C;return e.g?e=e.g.j:(Y("Not playing VR content"),e=null),e},i.nm=function(e){var t=this.C;t.g?(0>e?(Y("Field of view should be greater than 0"),e=0):100=t.alpha&&(o="display");break;case"display":0>=--s&&(o="fadeOut");break;case"fadeOut":0>=(a=Math.max(0,a-u))&&(o="transition",r=n(),s=Math.round(60*t.displayDuration),o="fadeIn")}0t&&(t=(n=l([n,t])).next().value,n=n.next().value),t/n>16/9&&(n=Math.round(9*t/16)),e=e.controls.g.qualityMarks,8640<=n?n+"p":4320<=n?e[4320]:2160<=n?e[2160]:1440<=n?e[1440]:1080<=n?e[1080]:720<=n?e[720]:""):""}function Fx(e){var t=zT(e.menu);cs(e.menu),e.menu.appendChild(t),t=0,t=e.player.Fd()?function(e){var t=[];e.player.m==Cd||e.player.Ca()||(t=e.player.qb()||[]);var n=t.find(function(e){return e.active});n&&(t=t.filter(function(t){if(t.language!=n.language||e.controls.g.showAudioChannelCountVariants&&t.channelsCount&&n.channelsCount&&t.channelsCount!=n.channelsCount)return!1;var i=e.controls.g.trackLabelFormat;return!((1==i||2==i)&&JSON.stringify(t.audioRoles)!=JSON.stringify(n.audioRoles)||3==i&&t.label!=n.label||!t.bandwidth)})),t=t.filter(function(e,n){return t.findIndex(function(t){return t.bandwidth==e.bandwidth})==n}),t.sort(function(e,t){return t.bandwidth-e.bandwidth});for(var i=e.player.getConfiguration().abr.enabled,r=l(t),a=r.next(),o={};!a.done;o={Fe:void 0},a=r.next()){o.Fe=a.value,(a=us()).classList.add("explicit-resolution"),e.eventManager.o(a,"click",function(t){return function(){var n=t.Fe;e.player.configure({abr:{enabled:!1}}),e.player.Ae(n,e.controls.g.clearBufferOnQualityChange)}}(o));var s=ss("span");s.textContent=o.Fe.bandwidth?Gx(e,o.Fe,t):"Unknown",a.appendChild(s),i||o.Fe!=n||(a.ariaSelected="true",a.appendChild(YT()),s.classList.add("shaka-chosen-item"),e.currentSelection.textContent=s.textContent),e.menu.appendChild(a)}return t.length}(e):function(e){var t=e.player.getVideoTracks()||[],n=t.find(function(e){return e.active});(t=t.filter(function(n,i){return t.findIndex(function(t){var i=t.height==n.height&&t.bandwidth==n.bandwidth&&t.frameRate==n.frameRate&&t.hdr==n.hdr&&t.videoLayout==n.videoLayout;return i&&e.controls.g.showVideoCodec&&t.codecs&&n.codecs&&(i=Mi(t.codecs)==Mi(n.codecs)),i})==i})).sort(function(e,t){return t.height==e.height||null==e.height||null==t.height?t.bandwidth-e.bandwidth:t.height-e.height});for(var i=e.player.getConfiguration().abr.enabled,r=l(t),a=r.next(),o={};!a.done;o={lc:void 0},a=r.next()){o.lc=a.value,(a=us()).classList.add("explicit-resolution"),e.eventManager.o(a,"click",function(t){return function(){var n=t.lc;e.player.configure({abr:{enabled:!1}}),e.player.Cj(n,e.controls.g.clearBufferOnQualityChange)}}(o));var s=ss("span");s.textContent=o.lc.height&&o.lc.width?jx(e,o.lc,t):o.lc.bandwidth?Math.round(o.lc.bandwidth/1e3)+" kbits/s":"Unknown",a.appendChild(s);var u=Bx(e,o.lc.width,o.lc.height);if(""!==u){var h=ss("sup");h.classList.add("shaka-quality-mark"),h.textContent=u,a.appendChild(h)}i||o.lc!=n||(a.ariaSelected="true",a.appendChild(YT()),s.classList.add("shaka-chosen-item"),e.currentSelection.textContent=s.textContent),e.menu.appendChild(a)}return t.length}(e);var n=us();n.classList.add("shaka-enable-abr-button"),e.eventManager.o(n,"click",function(){e.player.configure({abr:{enabled:!0}}),Fx(e)}),e.l=ss("span"),e.l.textContent=e.localization.resolve("AUTO_QUALITY"),n.appendChild(e.l),e.player.getConfiguration().abr.enabled&&(n.ariaSelected="true",n.appendChild(YT()),e.l.classList.add("shaka-chosen-item"),e.currentSelection.textContent=e.localization.resolve("AUTO_QUALITY")),e.button.setAttribute("shaka-status",e.currentSelection.textContent),e.menu.appendChild(n),XT(e.menu),e.controls.dispatchEvent(new V("resolutionselectionupdated")),Hx(e),qT(e.button,0a&&(a=(r=l([r,a])).next().value,r=r.next().value);var o=r;a/r>16/9&&(o=Math.round(9*a/16)),a=o+"p",r=new Set;for(var s=(o=l(n)).next();!s.done;s=o.next())(s=s.value).frameRate&&r.add(Math.round(s.frameRate));if(1=r)&&(a+=Math.round(t.frameRate)),"PQ"!=t.hdr&&"HLG"!=t.hdr||(a+=" HDR"),(t.videoLayout||"").includes("CH-STEREO")&&(a+=" 3D"),n.some(function(e){return i(t,e)})&&(n.some(function(e){return i(t,e)&&e.bandwidth==t.bandwidth})||(a+=" ("+Math.round(t.bandwidth/1e3)+" kbits/s)"),e.controls.g.showVideoCodec)){var u=function(e){var t="";return e&&(t=(e=Mi(e)).startsWith("dovi-")?"Dolby Vision":e.toUpperCase()),t?" "+t:t};n.some(function(e){return i(t,e)&&u(e.codecs)!=u(t.codecs)})&&(a+=u(t.codecs))}return a}function Gx(e,t,n){var i=Math.round(t.bandwidth/1e3)+" kbits/s";if(e.controls.g.showAudioCodec){var r=function(e){var t="";return e&&(t=Mi(e).toUpperCase()),t?" "+t:t};n.some(function(e){return r(e.codecs)!=r(t.codecs)})&&(i+=r(t.codecs))}return i}function Hx(e){var t=e.player.Fd()?"QUALITY":"RESOLUTION";e.button.ariaLabel=e.localization.resolve(t),e.backButton.ariaLabel=e.localization.resolve(t),e.backSpan.textContent=e.localization.resolve(t),e.nameSpan.textContent=e.localization.resolve(t),e.l.textContent=e.localization.resolve("AUTO_QUALITY"),e.player.getConfiguration().abr.enabled&&(e.currentSelection.textContent=e.localization.resolve("AUTO_QUALITY"))}function Vx(){}function Wx(e,t){WT.call(this,e,t);var n=this;this.g=us(),this.g.classList.add("material-icons-round"),this.g.classList.add("shaka-rewind-button"),this.g.classList.add("shaka-tooltip-status"),this.g.setAttribute("shaka-status",this.localization.resolve("OFF")),this.g.textContent="fast_rewind",this.parent.appendChild(this.g),zx(this),this.h=this.controls.g.rewindRates,this.eventManager.o(this.localization,"locale-updated",function(){zx(n)}),this.eventManager.o(this.localization,"locale-changed",function(){zx(n)}),this.eventManager.o(this.g,"click",function(){if(n.controls.Ba()&&n.video.duration){var e=n.h.indexOf(n.player.Xa())+1;e=e!=n.h.length?n.h[e]:n.h[0],n.video.paused&&n.video.play(),n.player.Uc(e),n.g.setAttribute("shaka-status",e+"x")}}),this.eventManager.o(this.player,"ratechange",function(){n.g.setAttribute("shaka-status",n.player.Xa()+"x")})}function zx(e){e.g.ariaLabel=e.localization.resolve("REWIND")}function Kx(){}function Xx(e,t){WT.call(this,e,t);var n=this;this.l=this.controls.D,this.g=us(),this.g.classList.add("shaka-save.video-frame-button"),this.g.classList.add("shaka-tooltip"),this.h=ss("i"),this.h.classList.add("material-icons-round"),this.h.textContent="download",this.g.appendChild(this.h),(e=ss("label")).classList.add("shaka-overflow-button-label"),e.classList.add("shaka-overflow-menu-only"),this.i=ss("span"),this.i.textContent=this.localization.resolve("DOWNLOAD_VIDEO_FRAME"),e.appendChild(this.i),this.j=ss("span"),this.j.classList.add("shaka-current-selection-span"),e.appendChild(this.j),this.g.appendChild(e),qx(this),this.parent.appendChild(this.g),this.eventManager.o(this.localization,"locale-updated",function(){qx(n)}),this.eventManager.o(this.localization,"locale-changed",function(){qx(n)}),this.eventManager.o(this.g,"click",function(){var e=document.createElement("canvas"),t=e.getContext("2d"),i=n.controls.m;e.width=i.videoWidth,e.height=i.videoHeight,t.drawImage(i,0,0,e.width,e.height),e=e.toDataURL("image/png"),(t=document.createElement("a")).href=e,t.download="videoframe_"+i.currentTime.toFixed(3)+".png",t.click()}),this.eventManager.o(this.controls.C,"vrstatuschanged",function(){Yx(n)}),this.eventManager.o(this.adManager,"ad-started",function(){Yx(n)}),this.eventManager.o(this.adManager,"ad-stopped",function(){Yx(n)}),this.eventManager.o(this.player,"unloading",function(){Yx(n)}),this.eventManager.o(this.player,"loaded",function(){Yx(n)}),this.eventManager.o(this.video,"play",function(){Yx(n)}),this.eventManager.o(this.video,"pause",function(){Yx(n)}),this.eventManager.o(this.video,"seeking",function(){Yx(n)}),this.eventManager.o(this.controls,"caststatuschanged",function(){Yx(n)}),Yx(this)}function Yx(e){var t=!0;e.controls.Vb()&&(t=!1),t&&e.l.Pa()&&(t=!1),t&&(e.player.drmInfo()||e.player.Fd())&&(t=!1),t&&e.ad&&(t=!1),t&&e.video.remote&&"disconnected"!=e.video.remote.state&&(t=!1),qT(e.g,t)}function qx(e){e.g.ariaLabel=e.localization.resolve("DOWNLOAD_VIDEO_FRAME"),e.i.textContent=e.localization.resolve("DOWNLOAD_VIDEO_FRAME")}function Zx(){}function Jx(e,t){WT.call(this,e,t);var n=this;(this.h=this.player.qh())&&(this.g=us(),this.g.classList.add("shaka-skip-next-button"),this.g.classList.add("material-icons-round"),this.g.classList.add("shaka-tooltip"),this.g.textContent="skip_next",this.parent.appendChild(this.g),Qx(this),$x(this),this.eventManager.o(this.localization,"locale-updated",function(){Qx(n)}),this.eventManager.o(this.localization,"locale-changed",function(){Qx(n)}),this.eventManager.o(this.g,"click",function(){n.controls.Ba()&&n.h.playItem(n.h.getCurrentItemIndex()+1)}),this.eventManager.o(this.h,"currentitemchanged",function(){$x(n)}),this.eventManager.o(this.h,"itemsinserted",function(){$x(n)}),this.eventManager.o(this.h,"itemsremoved",function(){$x(n)}),this.eventManager.o(this.player,"loading",function(){$x(n)}))}function Qx(e){e.g.ariaLabel=e.localization.resolve("SKIP_NEXT")}function $x(e){var t=e.h.getItems().length;t=1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const i=n(8871);class r{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new r(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){const t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.m[0]*t+this.m[2]*n,r=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,o=this.m[1]*-n+this.m[3]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=a,this.m[3]=o,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){const n=this.m[0]+this.m[2]*t,i=this.m[1]+this.m[3]*t,r=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=i,this.m[2]=r,this.m[3]=a,this}multiply(e){const t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],r=this.m[1]*e.m[2]+this.m[3]*e.m[3],a=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],o=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=a,this.m[5]=o,this}invert(){const e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,i=-this.m[2]*e,r=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=a,this.m[5]=o,this}getMatrix(){return this.m}decompose(){const e=this.m[0],n=this.m[1],i=this.m[2],r=this.m[3],a=e*r-n*i,o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=n){const t=Math.sqrt(e*e+n*n);o.rotation=n>0?Math.acos(e/t):-Math.acos(e/t),o.scaleX=t,o.scaleY=a/t,o.skewX=(e*i+n*r)/a,o.skewY=0}else if(0!=i||0!=r){const t=Math.sqrt(i*i+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-i/t):-Math.acos(i/t)),o.scaleX=a/t,o.scaleY=t,o.skewX=0,o.skewY=(e*i+n*r)/a}return o.rotation=t.Util._getRotation(o.rotation),o}}t.Transform=r;const a=Math.PI/180,o=180/Math.PI,s="Konva error: ",u={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},l=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let h=[];const c="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)};t.Util={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;const t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){h.push(e),1===h.length&&c(function(){const e=h;h=[],e.forEach(function(e){e()})})},createCanvasElement(){const e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,n){const i=t.Util.createImageElement();i.onload=function(){n(i)},i.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){let e=(16777215*Math.random()|0).toString(16);for(;e.length<6;)e="0"+e;return"#"+e},getRGB(e){let t;return e in u?(t=u[e],{r:t[0],g:t[1],b:t[2]}):"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=l.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",t.Util._namedColorToRBA(e)||t.Util._hex3ColorToRGBA(e)||t.Util._hex4ColorToRGBA(e)||t.Util._hex6ColorToRGBA(e)||t.Util._hex8ColorToRGBA(e)||t.Util._rgbColorToRGBA(e)||t.Util._rgbaColorToRGBA(e)||t.Util._hslColorToRGBA(e)),_namedColorToRBA(e){const t=u[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){const t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){const t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if("#"===e[0]&&9===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if("#"===e[0]&&5===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),i=Number(n[0])/360,r=Number(n[1])/100,a=Number(n[2])/100;let o,s,u;if(0===r)return u=255*a,{r:Math.round(u),g:Math.round(u),b:Math.round(u),a:1};o=a<.5?a*(1+r):a+r-a*r;const l=2*a-o,h=[0,0,0];for(let e=0;e<3;e++)s=i+1/3*-(e-1),s<0&&s++,s>1&&s--,u=6*s<1?l+6*(o-l)*s:2*s<1?o:3*s<2?l+(o-l)*(2/3-s)*6:l,h[e]=255*u;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.heighte.slice(0),degToRad:e=>e*a,radToDeg:e=>e*o,_degToRad:e=>(t.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),t.Util.degToRad(e)),_radToDeg:e=>(t.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),t.Util.radToDeg(e)),_getRotation:e=>i.Konva.angleDeg?t.Util.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(s+e)},error(e){console.error(s+e)},warn(e){i.Konva.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e1?(o=n,s=i,u=(n-r)*(n-r)+(i-a)*(i-a)):(o=e+h*(n-e),s=t+h*(i-t),u=(o-r)*(o-r)+(s-a)*(s-a))}return[o,s,u]},_getProjectionToLine(e,n,i){const r=t.Util.cloneObject(e);let a=Number.MAX_VALUE;return n.forEach(function(o,s){if(!i&&s===n.length-1)return;const u=n[(s+1)%n.length],l=t.Util._getProjectionToSegment(o.x,o.y,u.x,u.y,e.x,e.y),h=l[0],c=l[1],d=l[2];dn.length){const t=n;n=e,e=t}for(let t=0;te.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){i.Konva.releaseCanvasOnDestroy&&e.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,n,i){let r=0,a=0,o=0,s=0;"number"==typeof i?r=a=o=s=Math.min(i,t/2,n/2):(r=Math.min(i[0]||0,t/2,n/2),a=Math.min(i[1]||0,t/2,n/2),s=Math.min(i[2]||0,t/2,n/2),o=Math.min(i[3]||0,t/2,n/2)),e.moveTo(r,0),e.lineTo(t-a,0),e.arc(t-a,a,a,3*Math.PI/2,0,!1),e.lineTo(t,n-s),e.arc(t-s,n-s,s,0,Math.PI/2,!1),e.lineTo(o,n),e.arc(o,n-o,o,Math.PI/2,Math.PI,!1),e.lineTo(0,r),e.arc(r,r,r,Math.PI,3*Math.PI/2,!1)}}},4357:(e,t,n)=>{const i=n(208);function r(e){this.mode=i.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,i;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),i=parseInt(n,10),e.put(i,10);const r=this.data.length-t;r>0&&(n=this.data.substr(t),i=parseInt(n,10),e.put(i,3*r+1))},e.exports=r},4473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Container=void 0;const i=n(4892),r=n(6536),a=n(5483);class o extends r.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){const t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(0===e.length)return this;if(e.length>1){for(let t=0;t0?t[0]:void 0}_generalFind(e,t){const n=[];return this._descendants(i=>{const r=i._isMatch(e);return r&&n.push(i),!(!r||!t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const i of n){if(t=e(i),t)return!0;if(i.hasChildren()&&(t=i._descendants(e),t))return!0}return!1}toObject(){const e=r.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){const t=r.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach(function(t){t._clearSelfAndDescendantCache(e)})}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t,n){const i=this.getLayer(),r=e||i&&i.getCanvas(),a=r&&r.getContext(),o=this._getCanvasCache(),s=o&&o.scene,u=r&&r.isCache;if(!this.isVisible()&&!u)return this;if(s){a.save();const e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",r,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),i=e||n&&n.hitCanvas,r=i&&i.getContext(),a=this._getCanvasCache();if(a&&a.hit){r.save();const e=this.getAbsoluteTransform(t).getMatrix();r.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(r),r.restore()}else this._drawChildren("drawHit",i,t);return this}_drawChildren(e,t,n,i){var r;const a=t&&t.getContext(),o=this.clipWidth(),s=this.clipHeight(),u=this.clipFunc(),l="number"==typeof o&&"number"==typeof s||u,h=n===this;if(l){a.save();const e=this.getAbsoluteTransform(n);let t,i=e.getMatrix();if(a.transform(i[0],i[1],i[2],i[3],i[4],i[5]),a.beginPath(),u)t=u.call(this,a,this);else{const e=this.clipX(),t=this.clipY();a.rect(e||0,t||0,o,s)}a.clip.apply(a,t),i=e.copy().invert().getMatrix(),a.transform(i[0],i[1],i[2],i[3],i[4],i[5])}const c=!h&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;c&&(a.save(),a._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach(function(r){r[e](t,n,i)}),c&&a.restore(),l&&a.restore()}getClientRect(e={}){var t;const n=e.skipTransform,i=e.relativeTo;let r,a,o,s,u={x:1/0,y:1/0,width:0,height:0};const l=this;null===(t=this.children)||void 0===t||t.forEach(function(t){if(!t.visible())return;const n=t.getClientRect({relativeTo:l,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===n.width&&0===n.height||(void 0===r?(r=n.x,a=n.y,o=n.x+n.width,s=n.y+n.height):(r=Math.min(r,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)))});const h=this.find("Shape");let c=!1;for(let e=0;e{const i=n(6886),r=i.getBCHDigit(1335);t.getEncodedBits=function(e,t){const n=e.bit<<3|t;let a=n<<10;for(;i.getBCHDigit(a)-r>=0;)a^=1335<{const i=n(2731);t.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let r=0;r=0;){const e=n[0];for(let r=0;r{var i,r;void 0===(r="function"==typeof(i=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){i=i.call(t)},n:function(){var e=i.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==i.return||i.return()}finally{if(u)throw o}}}}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},s.apply(null,arguments)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}!function(e){e.AbortSignal,e.AbortController}("undefined"!=typeof self?self:n.g);var d=function(){return a(function e(){i(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})},[{key:"addEventListener",value:function(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}},{key:"removeEventListener",value:function(e,t){if(e in this.listeners)for(var n=this.listeners[e],i=0,r=n.length;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const i=n(8871),r=n(4060),a=n(4892),o=n(6536),s=n(5483),u=n(8871),l=n(8722),h="hasShadow",c="shadowRGBA",d="patternImage",p="linearGradient",f="radialGradient";let g;function m(){return g||(g=r.Util.createCanvasElement().getContext("2d"),g)}t.shapes={};class v extends o.Node{constructor(e){let n;for(super(e);n=r.Util.getRandomColor(),!n||n in t.shapes;);this.colorKey=n,t.shapes[n]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=m().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new r.Transform;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(i.Konva.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),a="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(a)}return e}}_getLinearGradient(){return this._getCache(p,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=m(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=t.createLinearGradient(n.x,n.y,i.x,i.y);for(let t=0;tthis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return o.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(null!==(t=this.attrs.perfectDrawEnabled)&&void 0!==t&&!t)return!1;const n=e||this.hasFill(),i=this.hasStroke(),r=1!==this.getAbsoluteOpacity();if(n&&i&&r)return!0;const a=this.hasShadow(),o=this.shadowForStrokeEnabled();return!!(n&&i&&a&&o)}setStrokeHitEnabled(e){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const i=e.skipTransform,r=e.relativeTo||t&&this.getStage()||void 0,a=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=a.width+o,u=a.height+o,l=!e.skipShadow&&this.hasShadow(),h=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,d=s+Math.abs(h),p=u+Math.abs(c),f=l&&this.shadowBlur()||0,g={width:d+2*f,height:p+2*f,x:-(o/2+f)+Math.min(h,0)+a.x,y:-(o/2+f)+Math.min(c,0)+a.y};return i?g:this._transformedRect(g,r)}drawScene(e,t,n){const i=this.getLayer(),r=(e||i.getCanvas()).getContext(),a=this._getCanvasCache(),o=this.getSceneFunc(),s=this.hasShadow();let u;const l=t===this;if(!this.isVisible()&&!l)return this;if(a){r.save();const e=this.getAbsoluteTransform(t).getMatrix();return r.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(r),r.restore(),this}if(!o)return this;if(r.save(),this._useBufferCanvas()){u=this.getStage();const e=n||u.bufferCanvas,i=e.getContext();i.clear(),i.save(),i._applyLineJoin(this);const a=this.getAbsoluteTransform(t).getMatrix();i.transform(a[0],a[1],a[2],a[3],a[4],a[5]),o.call(this,i,this),i.restore();const l=e.pixelRatio;s&&r._applyShadow(this),r._applyOpacity(this),r._applyGlobalCompositeOperation(this),r.drawImage(e._canvas,e.x||0,e.y||0,e.width/l,e.height/l)}else{if(r._applyLineJoin(this),!l){const e=this.getAbsoluteTransform(t).getMatrix();r.transform(e[0],e[1],e[2],e[3],e[4],e[5]),r._applyOpacity(this),r._applyGlobalCompositeOperation(this)}s&&r._applyShadow(this),o.call(this,r,this)}return r.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const i=this.getLayer(),a=e||i.hitCanvas,o=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),u=this._getCanvasCache(),l=u&&u.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){o.save();const e=this.getAbsoluteTransform(t).getMatrix();return o.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),o._applyLineJoin(this),this!==t){const e=this.getAbsoluteTransform(t).getMatrix();o.transform(e[0],e[1],e[2],e[3],e[4],e[5])}return s.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),i=t.hit,a=i.getContext(),o=i.getWidth(),s=i.getHeight();a.clear(),a.drawImage(n._canvas,0,0,o,s);try{const t=a.getImageData(0,0,o,s),n=t.data,i=n.length,u=r.Util._hexToRgb(this.colorKey);for(let t=0;te?(n[t]=u.r,n[t+1]=u.g,n[t+2]=u.b,n[t+3]=255):n[t+3]=0;a.putImageData(t,0,0)}catch(e){r.Util.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return l.hasPointerCapture(e,this)}setPointerCapture(e){l.setPointerCapture(e,this)}releaseCapture(e){l.releaseCapture(e,this)}}t.Shape=v,v.prototype._fillFunc=function(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()},v.prototype._strokeFunc=function(e){e.stroke()},v.prototype._fillFuncHit=function(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()},v.prototype._strokeFuncHit=function(e){e.stroke()},v.prototype._centroid=!1,v.prototype.nodeType="Shape",(0,u._registerNode)(v),v.prototype.eventListeners={},v.prototype.on.call(v.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(h)}),v.prototype.on.call(v.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(c)}),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",function(){this._clearCache(d)}),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",function(){this._clearCache(p)}),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",function(){this._clearCache(f)}),a.Factory.addGetterSetter(v,"stroke",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(v,"strokeWidth",2,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(v,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(v,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(v,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(v,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(v,"lineJoin"),a.Factory.addGetterSetter(v,"lineCap"),a.Factory.addGetterSetter(v,"sceneFunc"),a.Factory.addGetterSetter(v,"hitFunc"),a.Factory.addGetterSetter(v,"dash"),a.Factory.addGetterSetter(v,"dashOffset",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"shadowColor",void 0,(0,s.getStringValidator)()),a.Factory.addGetterSetter(v,"shadowBlur",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"shadowOpacity",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(v,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(v,"shadowOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"shadowOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternImage"),a.Factory.addGetterSetter(v,"fill",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(v,"fillPatternX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(v,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(v,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(v,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(v,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(v,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(v,"fillEnabled",!0),a.Factory.addGetterSetter(v,"strokeEnabled",!0),a.Factory.addGetterSetter(v,"shadowEnabled",!0),a.Factory.addGetterSetter(v,"dashEnabled",!0),a.Factory.addGetterSetter(v,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(v,"fillPriority","color"),a.Factory.addComponentsGetterSetter(v,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(v,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(v,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(v,"fillPatternScaleX",1,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternScaleY",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(v,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(v,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(v,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(v,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(v,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(v,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(v,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(v,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(v,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(v,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(v,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(v,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(v,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(v,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(v,"fillPatternRotation",0),a.Factory.addGetterSetter(v,"fillRule",void 0,(0,s.getStringValidator)()),a.Factory.backCompat(v,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})},4764:(e,t,n)=>{const i=n(4713);function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=i.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=i.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){const e=new Uint8Array(this.degree);return e.set(n,r),e}return n},e.exports=r},4861:(e,t,n)=>{const i=n(208),r=n(6886);function a(e){this.mode=i.KANJI,this.data=e}a.getBitsLength=function(e){return 13*e},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},e.exports=a},4892:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const i=n(4060),r=n(5483),a="get",o="set";t.Factory={addGetterSetter(e,n,i,r,a){t.Factory.addGetter(e,n,i),t.Factory.addSetter(e,n,r,a),t.Factory.addOverloadedGetterSetter(e,n)},addGetter(e,t,n){const r=a+i.Util._capitalize(t);e.prototype[r]=e.prototype[r]||function(){const e=this.attrs[t];return void 0===e?n:e}},addSetter(e,n,r,a){const s=o+i.Util._capitalize(n);e.prototype[s]||t.Factory.overWriteSetter(e,n,r,a)},overWriteSetter(e,t,n,r){const a=o+i.Util._capitalize(t);e.prototype[a]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,n,s,u,l){const h=s.length,c=i.Util._capitalize,d=a+c(n),p=o+c(n);e.prototype[d]=function(){const e={};for(let t=0;t{this._setAttr(n+c(e),void 0)}),this._fireChangeEvent(n,t,e),l&&l.call(this),this},t.Factory.addOverloadedGetterSetter(e,n)},addOverloadedGetterSetter(e,t){const n=i.Util._capitalize(t),r=o+n,s=a+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[s]()}},addDeprecatedGetterSetter(e,n,r,o){i.Util.error("Adding deprecated "+n);const s=a+i.Util._capitalize(n),u=n+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[s]=function(){i.Util.error(u);const e=this.attrs[n];return void 0===e?r:e},t.Factory.addSetter(e,n,o,function(){i.Util.error(u)}),t.Factory.addOverloadedGetterSetter(e,n)},backCompat(e,t){i.Util.each(t,function(t,n){const r=e.prototype[n],s=a+i.Util._capitalize(t),u=o+i.Util._capitalize(t);function l(){r.apply(this,arguments),i.Util.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=l,e.prototype[s]=l,e.prototype[u]=l})},afterSetFilter(){this._filterUpToDate=!1}}},5155:(e,t,n)=>{"use strict";t.r=void 0;const i=n(4892),r=n(4723),a=n(8871),o=n(4060),s=n(5483);class u extends r.Shape{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),i=this.height();e.beginPath(),t?o.Util.drawRoundedRectPath(e,n,i,t):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}}t.r=u,u.prototype.className="Rect",(0,a._registerNode)(u),i.Factory.addGetterSetter(u,"cornerRadius",0,(0,s.getNumberOrArrayOfNumbersValidator)(4))},5483:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RGBComponent=function(e){return e>255?255:e<0?0:Math.round(e)},t.alphaComponent=function(e){return e>1?1:e<1e-4?1e-4:e},t.getNumberValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isNumber(e)||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}},t.getNumberOrArrayOfNumbersValidator=function(e){if(i.Konva.isUnminified)return function(t,n){let i=r.Util._isNumber(t),o=r.Util._isArray(t)&&t.length==e;return i||o||r.Util.warn(a(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}},t.getNumberOrAutoValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isNumber(e)||"auto"===e||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}},t.getStringValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isString(e)||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}},t.getStringOrGradientValidator=function(){if(i.Konva.isUnminified)return function(e,t){const n=r.Util._isString(e),i="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||i||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}},t.getFunctionValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isFunction(e)||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}},t.getNumberArrayValidator=function(){if(i.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(r.Util._isArray(e)?e.forEach(function(e){r.Util._isNumber(e)||r.Util.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")}):r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}},t.getBooleanValidator=function(){if(i.Konva.isUnminified)return function(e,t){return!0===e||!1===e||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}},t.getComponentValidator=function(e){if(i.Konva.isUnminified)return function(t,n){return null==t||r.Util.isObject(t)||r.Util.warn(a(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}};const i=n(8871),r=n(4060);function a(e){return r.Util._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||r.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}},5822:(e,t,n)=>{const i=n(208);function r(e){this.mode=i.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return 8*e},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Layer=void 0;const i=n(4060),r=n(4473),a=n(6536),o=n(4892),s=n(8604),u=n(5483),l=n(4723),h=n(8871),c=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d=c.length;class p extends r.Container{constructor(e){super(e),this.canvas=new s.SceneCanvas,this.hitCanvas=new s.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let i=0;i0?{antialiased:!0}:{}}drawScene(e,t,n){const i=this.getLayer(),a=e||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),r.Container.prototype.drawScene.call(this,a,t,n),this._fire("draw",{node:this}),this}drawHit(e,t){const n=this.getLayer(),i=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),r.Container.prototype.drawHit.call(this,i,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){i.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return i.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return i.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}t.Layer=p,p.prototype.nodeType="Layer",(0,h._registerNode)(p),o.Factory.addGetterSetter(p,"imageSmoothingEnabled",!0),o.Factory.addGetterSetter(p,"clearBeforeDraw",!0),o.Factory.addGetterSetter(p,"hitGraphEnabled",!0,(0,u.getBooleanValidator)())},6320:e=>{"use strict";var t={single_source_shortest_paths:function(e,n,i){var r={},a={};a[n]=0;var o,s,u,l,h,c,d,p=t.PriorityQueue.make();for(p.push(n,0);!p.empty();)for(u in s=(o=p.pop()).value,l=o.cost,h=e[s]||{})h.hasOwnProperty(u)&&(c=l+h[u],d=a[u],(void 0===a[u]||d>c)&&(a[u]=c,p.push(u,c),r[u]=s));if(void 0!==i&&void 0===a[i]){var f=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(f)}return r},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],i=t;i;)n.push(i),e[i],i=e[i];return n.reverse(),n},find_path:function(e,n,i){var r=t.single_source_shortest_paths(e,n,i);return t.extract_shortest_path_from_predecessor_list(r,i)},PriorityQueue:{make:function(e){var n,i=t.PriorityQueue,r={};for(n in e=e||{},i)i.hasOwnProperty(n)&&(r[n]=i[n]);return r.queue=[],r.sorter=e.sorter||i.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},6421:(e,t,n)=>{const i=n(6886).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,n=i(e),r=145===n?26:2*Math.ceil((n-13)/(2*t-2)),a=[n-7];for(let e=1;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Node=void 0;const i=n(8604),r=n(1268),a=n(4892),o=n(8871),s=n(4060),u=n(5483),l="absoluteOpacity",h="allEventListeners",c="absoluteTransform",d="absoluteScale",p="canvas",f="listening",g="Shape",m=" ",v="stage",y="transform",b="visible",_=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(m);let w=1;class S{constructor(e){this._id=w++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==y&&e!==c||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){let n=this._cache.get(e);return(void 0===n||(e===y||e===c)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map(e=>e+"Change.konva").join(m);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(p)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===c&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(p)){const{scene:e,filter:t,hit:n,buffer:i}=this._cache.get(p);s.Util.releaseCanvas(e,t,n,i),this._cache.delete(p)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const t=e||{};let n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(t.width||n.width),a=Math.ceil(t.height||n.height),o=t.pixelRatio,u=void 0===t.x?Math.floor(n.x):t.x,h=void 0===t.y?Math.floor(n.y):t.y,c=t.offset||0,f=t.drawBorder||!1,g=t.hitCanvasPixelRatio||1;if(!r||!a)return void s.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");r+=2*c+(Math.abs(Math.round(n.x)-u)>.5?1:0),a+=2*c+(Math.abs(Math.round(n.y)-h)>.5?1:0),u-=c,h-=c;const m=new i.SceneCanvas({pixelRatio:o,width:r,height:a}),v=new i.SceneCanvas({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),y=new i.HitCanvas({pixelRatio:g,width:r,height:a}),b=m.getContext(),_=y.getContext(),w=new i.SceneCanvas({width:m.width/m.pixelRatio+Math.abs(u),height:m.height/m.pixelRatio+Math.abs(h),pixelRatio:m.pixelRatio}),S=w.getContext();return y.isCache=!0,m.isCache=!0,this._cache.delete(p),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),b.save(),_.save(),S.save(),b.translate(-u,-h),_.translate(-u,-h),S.translate(-u,-h),w.x=u,w.y=h,this._isUnderCache=!0,this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(d),this.drawScene(m,this,w),this.drawHit(y,this),this._isUnderCache=!1,b.restore(),_.restore(),f&&(b.save(),b.beginPath(),b.rect(0,0,r,a),b.closePath(),b.setAttr("strokeStyle","red"),b.setAttr("lineWidth",5),b.stroke(),b.restore()),this._cache.set(p,{scene:m,filter:v,hit:y,buffer:w,x:u,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(p)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){const n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,r=1/0,a=-1/0,o=-1/0;const s=this.getAbsoluteTransform(t);return n.forEach(function(e){const t=s.point(e);void 0===i&&(i=a=t.x,r=o=t.y),i=Math.min(i,t.x),r=Math.min(r,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)}),{x:i,y:r,width:a-i,height:o-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);const n=this._getCachedSceneCanvas(),i=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/i,n.height/i),e.restore()}_drawCachedHitCanvas(e){const t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e,t,n,i,r=this.filters(),a=this._getCanvasCache(),o=a.scene,u=a.filter,l=u.getContext();if(r){if(!this._filterUpToDate){const a=o.pixelRatio;u.setSize(o.width/o.pixelRatio,o.height/o.pixelRatio);try{for(e=r.length,l.clear(),l.drawImage(o._canvas,0,0,o.getWidth()/a,o.getHeight()/a),t=l.getImageData(0,0,u.getWidth(),u.getHeight()),n=0;n{let t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+s.Util._capitalize(t),s.Util._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(f,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(b,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);const n=this.getLayer();let i=!1;r.DD._dragElements.forEach(e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(i=!0)});const a=!t&&!o.Konva.hitOnDragEnabled&&(i||o.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e,t,n,i,r=this.getDepth(),a=this,o=0;const s=this.getStage();return"Stage"!==a.nodeType&&s&&function s(u){for(e=[],t=u.length,n=0;n0&&e[0].getDepth()<=r&&s(e)}(s.getChildren()),o}getDepth(){let e=0,t=this.parent;for(;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(y),this._clearSelfAndDescendantCache(c)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const t=e.getPointerPosition();if(!t)return null;const n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),r=new s.Transform,a=this.offset();return r.m=i.slice(),r.translate(a.x,a.y),r.getTranslation()}setAbsolutePosition(e){const{x:t,y:n,...i}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache(y);const r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(y),this._clearSelfAndDescendantCache(c),this}_setTransform(e){let t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let t=e.x,n=e.y,i=this.x(),r=this.y();return void 0!==t&&(i+=t),void 0!==n&&(r+=n),this.setPosition({x:i,y:r}),this}_eachAncestorReverse(e,t){let n,i,r=[],a=this.getParent();if(!t||t._id!==this._id){for(r.unshift(this);a&&(!t||a._id!==t._id);)r.unshift(a),a=a.parent;for(n=r.length,i=0;i0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return s.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return s.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&s.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(l,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e,t,n,i,r,a=this.getAttrs();const o={attrs:{},className:this.getClassName()};for(e in a)t=a[e],r=s.Util.isObject(t)&&!s.Util._isPlainObject(t)&&!s.Util._isArray(t),r||(n="function"==typeof this[e]&&this[e],delete a[e],i=n?n.call(this):null,a[e]=t,i!==t&&(o.attrs[e]=t));return s.Util._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){const i=[];t&&this._isMatch(e)&&i.push(this);let r=this.parent;for(;r;){if(r===n)return i;r._isMatch(e)&&i.push(r),r=r.parent}return i}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);let t,n,i=e.replace(/ /g,"").split(","),r=i.length;for(t=0;t{try{const n=null==e?void 0:e.callback;n&&delete e.callback,s.Util._urlToImage(this.toDataURL(e),function(e){t(e),null==n||n(e)})}catch(e){n(e)}})}toBlob(e){return new Promise((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob(e=>{t(e),null==n||n(e)},null==e?void 0:e.mimeType,null==e?void 0:e.quality)}catch(e){n(e)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():o.Konva.dragDistance}_off(e,t,n){let i,r,a,o=this.eventListeners[e];for(i=0;i=0))return;if(this.isDragging())return;let t=!1;r.DD._dragElements.forEach(e=>{this.isAncestorOf(e.node)&&(t=!0)}),t||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=r.DD._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&r.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return s.Util.haveIntersection(n,this.getClientRect())}static create(e,t){return s.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){let n,i,r,a=S.prototype.getClassName.call(e),u=e.children;if(t&&(e.attrs.container=t),o.Konva[a]||(s.Util.warn('Can not find a node with class name "'+a+'". Fallback to "Shape".'),a="Shape"),n=new(0,o.Konva[a])(e.attrs),u)for(i=u.length,r=0;r{const i=n(2726);function r(e,t){const n=e.a/255,i=t+'="'+e.hex+'"';return n<1?i+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':i}function a(e,t,n){let i=e+t;return void 0!==n&&(i+=" "+n),i}t.render=function(e,t,n){const o=i.getOptions(t),s=e.modules.size,u=e.modules.data,l=s+2*o.margin,h=o.color.light.a?"':"",c="0&&l>0&&e[u-1]||(i+=o?a("M",l+n,.5+h+n):a("m",r,0),r=0,o=!1),l+1',d='viewBox="0 0 '+l+" "+l+'"',p=''+h+c+"\n";return"function"==typeof n&&n(null,p),p}},6886:(e,t)=>{let n;const i=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return i[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},7007:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise(function(n,i){function r(n){e.removeListener(t,a),i(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)})},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,n,i){var r,a,o,l;if(s(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]),void 0===o)o=a[t]=n,++e._eventsCount;else if("function"==typeof o?o=a[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=u(e))>0&&o.length>r&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,l=h,console&&console.warn&&console.warn(l)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)i(u,this,t);else{var l=u.length,h=f(u,l);for(n=0;n=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,r=a;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},7044:(e,t)=>{const n="[0-9]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+")(?:.|[\r\n]))+";t.KANJI=new RegExp(i,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(r,"g"),t.NUMERIC=new RegExp(n,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const a=new RegExp("^"+i+"$"),o=new RegExp("^"+n+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return a.test(e)},t.testNumeric=function(e){return o.test(e)},t.testAlphanumeric=function(e){return s.test(e)}},7324:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const i=n(4060),r=n(4892),a=n(4473),o=n(8871),s=n(8604),u=n(1268),l=n(8871),h=n(8722),c="mouseleave",d="mouseover",p="mouseenter",f="mousemove",g="mousedown",m="mouseup",v="pointermove",y="pointerdown",b="pointerup",_="pointercancel",w="pointerout",S="pointerleave",T="pointerover",A="pointerenter",E="contextmenu",x="touchstart",C="touchend",k="touchmove",I="touchcancel",M="wheel",P=[[p,"_pointerenter"],[g,"_pointerdown"],[f,"_pointermove"],[m,"_pointerup"],[c,"_pointerleave"],[x,"_pointerdown"],[k,"_pointermove"],[C,"_pointerup"],[I,"_pointercancel"],[d,"_pointerover"],[M,"_wheel"],[E,"_contextmenu"],[y,"_pointerdown"],[v,"_pointermove"],[b,"_pointerup"],[_,"_pointercancel"],[S,"_pointerleave"],["lostpointercapture","_lostpointercapture"]],L={mouse:{[w]:"mouseout",[S]:c,[T]:d,[A]:p,[v]:f,[y]:g,[b]:m,[_]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[w]:"touchout",[S]:"touchleave",[T]:"touchover",[A]:"touchenter",[v]:k,[y]:x,[b]:C,[_]:I,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[w]:w,[S]:S,[T]:T,[A]:A,[v]:v,[y]:y,[b]:b,[_]:_,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},D=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",R=e=>{const t=D(e);return"pointer"===t?o.Konva.pointerEventsEnabled&&L.pointer:"touch"===t?L.touch:"mouse"===t?L.mouse:void 0};function N(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&i.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}t.stages=[];class O extends a.Container{constructor(e){super(N(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{N(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||i.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){let t;if("."===e.charAt(0)){const t=e.slice(1);e=document.getElementsByClassName(t)[0]}else t="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(t);if(!e)throw"Can not find container in document with id "+t}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,t=e.length;for(let n=0;n-1&&t.stages.splice(n,1),i.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(i.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const t=new s.SceneCanvas({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,i=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),i.forEach(function(t){if(!t.isVisible())return;const i=t._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}),t}getIntersection(e){if(!e)return null;const t=this.children;for(let n=t.length-1;n>=0;n--){const i=t[n].getIntersection(e);if(i)return i}return null}_resizeDOM(){const e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let e=0;e5&&i.Util.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),o.Konva.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return h.hasPointerCapture(e,this)}setPointerCapture(e){h.setPointerCapture(e,this)}releaseCapture(e){h.releaseCapture(e,this)}getLayers(){return this.children}_bindContentEvents(){o.Konva.isBrowser&&P.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=R(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=R(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=R(e.type),n=D(e.type);if(!t)return;this.setPointersPositions(e);const i=this._getTargetShape(n),r=!(o.Konva.isDragging()||o.Konva.isTransforming())||o.Konva.hitOnDragEnabled;i&&r?(i._fireAndBubble(t.pointerout,{evt:e}),i._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):r&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const t=R(e.type),n=D(e.type);if(!t)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(r=>{const a=this.getIntersection(r);if(u.DD.justDragged=!1,o.Konva["_"+n+"ListenClick"]=!0,!a||!a.isListening())return void(this[n+"ClickStartShape"]=void 0);o.Konva.capturePointerEventsEnabled&&a.setPointerCapture(r.id),this[n+"ClickStartShape"]=a,a._fireAndBubble(t.pointerdown,{evt:e,pointerId:r.id}),i=!0;const s=e.type.indexOf("touch")>=0;a.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),i||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const t=R(e.type),n=D(e.type);if(!t)return;if(o.Konva.isDragging()&&u.DD.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),(o.Konva.isDragging()||o.Konva.isTransforming())&&!o.Konva.hitOnDragEnabled)return;const i={};let r=!1;const a=this._getTargetShape(n);this._changedPointerPositions.forEach(o=>{const s=h.getCapturedShape(o.id)||this.getIntersection(o),u=o.id,l={evt:e,pointerId:u},c=a!==s;if(c&&a&&(a._fireAndBubble(t.pointerout,{...l},s),a._fireAndBubble(t.pointerleave,{...l},s)),s){if(i[s._id])return;i[s._id]=!0}s&&s.isListening()?(r=!0,c&&(s._fireAndBubble(t.pointerover,{...l},a),s._fireAndBubble(t.pointerenter,{...l},a),this[n+"targetShape"]=s),s._fireAndBubble(t.pointermove,{...l})):a&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),r||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=R(e.type),n=D(e.type);if(!t)return;this.setPointersPositions(e);const i=this[n+"ClickStartShape"],r=this[n+"ClickEndShape"],a={};let s=!1;this._changedPointerPositions.forEach(l=>{const c=h.getCapturedShape(l.id)||this.getIntersection(l);if(c){if(c.releaseCapture(l.id),a[c._id])return;a[c._id]=!0}const d=l.id,p={evt:e,pointerId:d};let f=!1;o.Konva["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):u.DD.justDragged||(o.Konva["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){o.Konva["_"+n+"InDblClickWindow"]=!1},o.Konva.dblClickWindow),c&&c.isListening()?(s=!0,this[n+"ClickEndShape"]=c,c._fireAndBubble(t.pointerup,{...p}),o.Konva["_"+n+"ListenClick"]&&i&&i===c&&(c._fireAndBubble(t.pointerclick,{...p}),f&&r&&r===c&&c._fireAndBubble(t.pointerdblclick,{...p}))):(this[n+"ClickEndShape"]=null,o.Konva["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:d}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:d}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),o.Konva["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&"pointer"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(E,{evt:e}):this._fire(E,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(M,{evt:e}):this._fire(M,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=h.getCapturedShape(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(b,h.createEvent(e)),h.releaseCapture(e.pointerId)}_lostpointercapture(e){h.releaseCapture(e.pointerId)}setPointersPositions(e){const t=this._getContentPosition();let n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:i.Util._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:i.Util._getFirstPointerId(e)}])}_setPointerPosition(e){i.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!o.Konva.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return i.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}}t.Stage=O,O.prototype.nodeType="Stage",(0,l._registerNode)(O),r.Factory.addGetterSetter(O,"container"),o.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(e=>{e.batchDraw()})})},7457:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FastLayer=void 0;const i=n(4060),r=n(6267),a=n(8871);class o extends r.Layer{constructor(e){super(e),this.listening(!1),i.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}t.FastLayer=o,o.prototype.nodeType="FastLayer",(0,a._registerNode)(o)},7518:(e,t,n)=>{const i=n(9953),r=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case i.L:return r[4*(e-1)+0];case i.M:return r[4*(e-1)+1];case i.Q:return r[4*(e-1)+2];case i.H:return r[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case i.L:return a[4*(e-1)+0];case i.M:return a[4*(e-1)+1];case i.Q:return a[4*(e-1)+2];case i.H:return a[4*(e-1)+3];default:return}}},7583:(e,t,n)=>{const i=n(1333),r=n(157),a=n(7899),o=n(6756);function s(e,t,n,a,o){const s=[].slice.call(arguments,1),u=s.length,l="function"==typeof s[u-1];if(!l&&!i())throw new Error("Callback required as last argument");if(!l){if(u<1)throw new Error("Too few arguments provided");return 1===u?(n=t,t=a=void 0):2!==u||t.getContext||(a=n,n=t,t=void 0),new Promise(function(i,o){try{const o=r.create(n,a);i(e(o,t,a))}catch(e){o(e)}})}if(u<2)throw new Error("Too few arguments provided");2===u?(o=n,n=t,t=a=void 0):3===u&&(t.getContext&&void 0===o?(o=a,a=void 0):(o=a,a=n,n=t,t=void 0));try{const i=r.create(n,a);o(null,e(i,t,a))}catch(e){o(e)}}t.create=r.create,t.toCanvas=s.bind(null,a.render),t.toDataURL=s.bind(null,a.renderToDataURL),t.toString=s.bind(null,function(e,t,n){return o.render(e,n)})},7756:(e,t,n)=>{const i=n(6886).getSymbolSize;t.getPositions=function(e){const t=i(e);return[[0,0],[t-7,0],[0,t-7]]}},7899:(e,t,n)=>{const i=n(2726);t.render=function(e,t,n){let r=n,a=t;void 0!==r||t&&t.getContext||(r=t,t=void 0),t||(a=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),r=i.getOptions(r);const o=i.getImageWidth(e.modules.size,r),s=a.getContext("2d"),u=s.createImageData(o,o);return i.qrToImageData(u.data,e,r),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(s,a,o),s.putImageData(u,0,0),a},t.renderToDataURL=function(e,n,i){let r=i;void 0!==r||n&&n.getContext||(r=n,n=void 0),r||(r={});const a=t.render(e,n,r),o=r.type||"image/png",s=r.rendererOpts||{};return a.toDataURL(o,s.quality)}},7949:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Group=void 0;const i=n(4060),r=n(4473),a=n(8871);class o extends r.Container{_validateAdd(e){const t=e.getType();"Group"!==t&&"Shape"!==t&&i.Util.throw("You may only add groups and shapes to groups.")}}t.Group=o,o.prototype.nodeType="Group",(0,a._registerNode)(o)},8228:(e,t,n)=>{"use strict";n.d(t,{A:()=>De});var i=n(663),r=n.n(i),a=n(3443),o=n(5155),s=n(1958),u=n(9696),l=n(317);function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,i,a,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,a||e,o),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,a=i.length,o=new Array(a);r0&&n.push(o),n.push(a%60),n.push(r%60);for(var s=0;s0&&(n+="."+g(i,t)),n}function v(e,t,n){return en?n:e}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function b(e,t){for(var n in t)y(t,n)&&(e[n]=t[n]);return e}function _(e){return"number"==typeof e}function w(e){return"number"==typeof e&&Number.isFinite(e)}function S(e){return null!==e&&"object"===p(e)&&!Array.isArray(e)}function T(e){return"string"==typeof e}function A(e){return null==e}function E(e){return!0===e||!1===e}function x(e){return e instanceof HTMLElement}function C(e){return S(e)&&y(e,"linearGradientStart")&&y(e,"linearGradientEnd")&&y(e,"linearGradientColorStops")&&_(e.linearGradientStart)&&_(e.linearGradientEnd)&&function(e){return Array.isArray(e)}(e.linearGradientColorStops)&&2===e.linearGradientColorStops.length}function k(e){for(;null!==e.parent;){if(e.parent instanceof r().Layer)return e;e=e.parent}return null}f.POINT=0,f.SEGMENT_START=1,f.SEGMENT_END=2,f.sorter=function(e,t){return e.time-t.time};var I=/HeadlessChrome/.test(navigator.userAgent),M=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,P=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame,L={forward:{},reverse:{}};L.forward[f.POINT]=0,L.forward[f.SEGMENT_START]=1,L.forward[f.SEGMENT_END]=2,L.reverse[f.POINT]=0,L.reverse[f.SEGMENT_START]=2,L.reverse[f.SEGMENT_END]=1;var D={0:"points.enter",1:"segments.enter",2:"segments.exit"},R={};function N(e,t){switch(t.type){case f.POINT:return e.points.getPoint(t.id);case f.SEGMENT_START:case f.SEGMENT_END:return e.segments.getSegment(t.id);default:throw new Error("getPointOrSegment: id not found?")}}function O(e){this._cues=[],this._peaks=e,this._previousTime=-1,this._updateCues=this._updateCues.bind(this),this._onPlaying=this._onPlaying.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onTimeUpdate=this._onTimeUpdate.bind(this),this._onAnimationFrame=this._onAnimationFrame.bind(this),this._rAFHandle=null,this._activeSegments={},this._attachEventHandlers()}function U(e){return function(t){return t.id===e}}R[0]="point",R[1]="segment",R[2]="segment",O.prototype._updateCues=function(){var e=this,t=e._peaks.points.getPoints(),n=e._peaks.segments.getSegments();e._cues.length=0,t.forEach(function(t){e._cues.push(new f(t.time,f.POINT,t.id))}),n.forEach(function(t){e._cues.push(new f(t.startTime,f.SEGMENT_START,t.id)),e._cues.push(new f(t.endTime,f.SEGMENT_END,t.id))}),e._cues.sort(f.sorter);var i=e._peaks.player.getCurrentTime();e._updateActiveSegments(i)},O.prototype._onUpdate=function(e,t){var n,i,r,a=e>t;a?(n=0,i=this._cues.length,r=1):(n=this._cues.length-1,i=-1,r=-1);for(var o=n;a?oi;o+=r){var s=this._cues[o];if(a?s.time>t:s.timee:s.time=e&&this.time=t.startTime&&e0?function(n){return n.startTime===e&&n.endTime===t}:function(t){return t.startTime===e},this._removeSegments(n)},Y.prototype.removeAll=function(){this._segments=[],this._segmentsById={},this._segmentsByPid={},this._peaks.emit("segments.remove_all")},Y.prototype.setInserting=function(e){this._isInserting=e},Y.prototype.isInserting=function(){return this._isInserting};var q=["OBJECT","TEXTAREA","INPUT","SELECT","OPTION"],Z=[32,9,37,39];function J(e){this.eventEmitter=e,this._handleKeyEvent=this._handleKeyEvent.bind(this),document.addEventListener("keydown",this._handleKeyEvent),document.addEventListener("keypress",this._handleKeyEvent),document.addEventListener("keyup",this._handleKeyEvent)}function Q(e){this._mediaElement=e}function $(e,t){this._eventEmitter=e,this._mediaElement=t,this._playerCanPlayHandler=this._playerCanPlayHandler.bind(this),this._playerErrorHandler=this._playerErrorHandler.bind(this)}function ee(e,t){this._peaks=e,this._playingSegment=!1,this._segment=null,this._loop=!1,this._playSegmentTimerCallback=this._playSegmentTimerCallback.bind(this),function(e){var t=function(e){for(var t=[],n=e;n;)Object.getOwnPropertyNames(n).forEach(function(e){t.push(e)}),n=Object.getPrototypeOf(n);return t}(e);["init","destroy","play","pause","isPlaying","isSeeking","getCurrentTime","getDuration","seek"].forEach(function(n){if(!t.includes(n))throw new TypeError("Peaks.init(): Player method "+n+" is undefined");if("function"!=typeof e[n])throw new TypeError("Peaks.init(): Player method "+n+" is not a function")})}(t),this._adapter=t}function te(e){this._options=e,this._draggable=e.editable}function ne(e){this._options=e,this._editable=e.editable}function ie(e){return"zoomview"===e.view?new ne(e):null}function re(e){return new s.EY({x:12,y:12,text:e.segment.labelText,textAlign:"center",fontFamily:e.fontFamily||"sans-serif",fontSize:e.fontSize||12,fontStyle:e.fontStyle||"normal",fill:"#000"})}function ae(e){return new te(e)}function oe(e,t){this._view=e,this._offset=t.highlightOffset,this._color=t.highlightColor,this._layer=new(r().Layer)({listening:!1}),this._highlightRect=null,this._startTime=null,this._endTime=null,this._strokeColor=t.highlightStrokeColor,this._opacity=t.highlightOpacity,this._cornerRadius=t.highlightCornerRadius}function se(e){this._point=e.point,this._marker=e.marker,this._draggable=e.draggable,this._onDragStart=e.onDragStart,this._onDragMove=e.onDragMove,this._onDragEnd=e.onDragEnd,this._dragBoundFunc=e.dragBoundFunc,this._onMouseEnter=e.onMouseEnter,this._onMouseLeave=e.onMouseLeave,this._group=new(r().Group)({name:"point-marker",point:this._point,draggable:this._draggable,dragBoundFunc:e.dragBoundFunc}),this._bindDefaultEventHandlers(),this._marker.init(this._group)}function ue(e,t,n){this._peaks=e,this._view=t,this._allowEditing=n,this._pointMarkers={},this._layer=new(r().Layer),this._onPointsDrag=this._onPointsDrag.bind(this),this._onPointMarkerDragStart=this._onPointMarkerDragStart.bind(this),this._onPointMarkerDragMove=this._onPointMarkerDragMove.bind(this),this._onPointMarkerDragEnd=this._onPointMarkerDragEnd.bind(this),this._pointMarkerDragBoundFunc=this._pointMarkerDragBoundFunc.bind(this),this._onPointMarkerMouseEnter=this._onPointMarkerMouseEnter.bind(this),this._onPointMarkerMouseLeave=this._onPointMarkerMouseLeave.bind(this),this._onPointsUpdate=this._onPointsUpdate.bind(this),this._onPointsAdd=this._onPointsAdd.bind(this),this._onPointsRemove=this._onPointsRemove.bind(this),this._onPointsRemoveAll=this._onPointsRemoveAll.bind(this),this._peaks.on("points.update",this._onPointsUpdate),this._peaks.on("points.add",this._onPointsAdd),this._peaks.on("points.remove",this._onPointsRemove),this._peaks.on("points.remove_all",this._onPointsRemoveAll),this._peaks.on("points.dragstart",this._onPointsDrag),this._peaks.on("points.dragmove",this._onPointsDrag),this._peaks.on("points.dragend",this._onPointsDrag)}function le(e,t,n){this._player=e,this._view=t,this._playheadPixel=0,this._playheadLineAnimation=null,this._playheadVisible=!1,this._playheadColor=n.playheadColor,this._playheadTextColor=n.playheadTextColor,this._playheadBackgroundColor=n.playheadBackgroundColor,this._playheadPadding=n.playheadPadding,this._playheadWidth=n.playheadWidth,this._playheadFontFamily=n.playheadFontFamily,this._playheadFontSize=n.playheadFontSize,this._playheadFontStyle=n.playheadFontStyle,this._playheadLayer=new(r().Layer),this._createPlayhead(),n.showPlayheadTime&&this._createPlayheadText(),this.fitToView(),this.zoomLevelChanged()}function he(e){this._options=e}function ce(e){var t=this;t._segment=e.segment,t._marker=e.marker,t._segmentShape=e.segmentShape,t._editable=e.editable,t._startMarker=e.startMarker,t._onDragStart=e.onDragStart,t._onDragMove=e.onDragMove,t._onDragEnd=e.onDragEnd,t._group=new(r().Group)({name:"segment-marker",segment:t._segment,draggable:t._editable,visible:t._editable,dragBoundFunc:function(n){return e.dragBoundFunc(t,n)}}),t._bindDefaultEventHandlers(),t._marker.init(t._group)}function de(e){this._color=e.color;var t={};if(T(e.color))t.fill=e.color;else{if(!C(e.color))throw new TypeError("Unknown type for color property");var n=e.view._height*(e.color.linearGradientStart/100),i=e.view._height*(e.color.linearGradientEnd/100);t.fillLinearGradientStartPointY=n,t.fillLinearGradientEndPointY=i,t.fillLinearGradientColorStops=[0,e.color.linearGradientColorStops[0],1,e.color.linearGradientColorStops[1]]}this._shape=new(r().Shape)(t),this._view=e.view,this._segment=e.segment,this._shape.sceneFunc(this._sceneFunc.bind(this))}J.prototype._handleKeyEvent=function(e){if(-1===q.indexOf(e.target.nodeName))if(Z.indexOf(e.type)>-1&&e.preventDefault(),"keydown"===e.type||"keypress"===e.type)switch(e.keyCode){case 32:this.eventEmitter.emit("keyboard.space");break;case 9:this.eventEmitter.emit("keyboard.tab")}else if("keyup"===e.type)switch(e.keyCode){case 37:e.shiftKey?this.eventEmitter.emit("keyboard.shift_left"):this.eventEmitter.emit("keyboard.left");break;case 39:e.shiftKey?this.eventEmitter.emit("keyboard.shift_right"):this.eventEmitter.emit("keyboard.right")}},J.prototype.destroy=function(){document.removeEventListener("keydown",this._handleKeyEvent),document.removeEventListener("keypress",this._handleKeyEvent),document.removeEventListener("keyup",this._handleKeyEvent)},Q.prototype._addMediaListener=function(e,t){this._listeners.push({type:e,callback:t}),this._mediaElement.addEventListener(e,t)},Q.prototype.init=function(e){var t,n=this;return n._eventEmitter=e,n._listeners=[],n._duration=n.getDuration(),n._addMediaListener("timeupdate",function(){n._eventEmitter.emit("player.timeupdate",n.getCurrentTime())}),n._addMediaListener("playing",function(){n._eventEmitter.emit("player.playing",n.getCurrentTime())}),n._addMediaListener("pause",function(){n._eventEmitter.emit("player.pause",n.getCurrentTime())}),n._addMediaListener("ended",function(){n._eventEmitter.emit("player.ended")}),n._addMediaListener("seeked",function(){n._eventEmitter.emit("player.seeked",n.getCurrentTime())}),n._addMediaListener("canplay",function(){n._eventEmitter.emit("player.canplay")}),n._addMediaListener("error",function(e){n._eventEmitter.emit("player.error",e.target.error)}),n._interval=null,(t=n._mediaElement).src||t.querySelector("source")?n._mediaElement.error&&n._mediaElement.error.code===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED?Promise.reject(n._mediaElement.error):new Promise(function(e,t){function i(r){n._mediaElement.removeEventListener("loadedmetadata",i),n._mediaElement.removeEventListener("error",i),"loadedmetadata"===r.type?e():t(r.target.error)}n._mediaElement.readyState===HTMLMediaElement.HAVE_NOTHING?(n._mediaElement.addEventListener("loadedmetadata",i),n._mediaElement.addEventListener("error",i),n._mediaElement.load()):e()}):Promise.resolve()},Q.prototype.destroy=function(){for(var e=0;e=this._segment.endTime){if(!this._loop)return this.pause(),this._peaks.emit("player.ended"),void(this._playingSegment=!1);this.seek(this._segment.startTime)}window.requestAnimationFrame(this._playSegmentTimerCallback)}else this._playingSegment=!1},ee.prototype._setSource=function(e){return this._adapter.setSource(e)},te.prototype.init=function(e){"zoomview"===this._options.view&&(this._label=new s.EY({x:2,y:0,text:this._options.point.labelText,textAlign:"left",fontFamily:this._options.fontFamily||"sans-serif",fontSize:this._options.fontSize||10,fontStyle:this._options.fontStyle||"normal",fill:"#000"})),this._handle=new o.r({x:-4.5,y:0,width:10,height:20,fill:this._options.color,visible:this._draggable}),this._line=new a.N({x:0,y:0,stroke:this._options.color,strokeWidth:1}),this._time=new s.EY({x:-24,y:0,text:this._options.layer.formatTime(this._options.point.time),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center"}),this._time.hide(),e.add(this._handle),e.add(this._line),this._label&&e.add(this._label),e.add(this._time),this.fitToView(),this.bindEventHandlers(e)},te.prototype.bindEventHandlers=function(e){var t=this;t._handle.on("mouseover touchstart",function(){t._draggable&&(t._time.setX(-24-t._time.getWidth()),t._time.show())}),t._handle.on("mouseout touchend",function(){t._draggable&&t._time.hide()}),e.on("dragstart",function(){t._time.setX(-24-t._time.getWidth()),t._time.show()}),e.on("dragend",function(){t._time.hide()})},te.prototype.fitToView=function(){var e=this._options.layer.getHeight();this._line.points([.5,0,.5,e]),this._label&&this._label.y(12),this._handle&&this._handle.y(e/2-10.5),this._time&&this._time.y(e/2-5)},te.prototype.update=function(e){void 0!==e.time&&this._time&&this._time.setText(this._options.layer.formatTime(e.time)),void 0!==e.labelText&&this._label&&this._label.text(e.labelText),void 0!==e.color&&(this._handle&&this._handle.fill(e.color),this._line.stroke(e.color)),void 0!==e.editable&&(this._draggable=e.editable,this._handle.visible(this._draggable))},ne.prototype.init=function(e){var t=this._options.startMarker?-24:24,n=this._options.startMarker?this._options.segment.startTime:this._options.segment.endTime;this._label=new s.EY({x:t,y:0,text:this._options.layer.formatTime(n),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center",visible:this._editable}),this._label.hide(),this._handle=new o.r({x:-4.5,y:0,width:10,height:20,fill:this._options.color,stroke:this._options.color,strokeWidth:1,visible:this._editable}),this._line=new a.N({x:0,y:0,stroke:this._options.color,strokeWidth:1,visible:this._editable}),e.add(this._label),e.add(this._line),e.add(this._handle),this.fitToView(),this.bindEventHandlers(e)},ne.prototype.bindEventHandlers=function(e){var t=this,n=t._options.startMarker?-24:24;e.on("dragstart",function(){t._options.startMarker&&t._label.setX(n-t._label.getWidth()),t._label.show()}),e.on("dragend",function(){t._label.hide()}),t._handle.on("mouseover touchstart",function(){t._options.startMarker&&t._label.setX(n-t._label.getWidth()),t._label.show()}),t._handle.on("mouseout touchend",function(){t._label.hide()})},ne.prototype.fitToView=function(){var e=this._options.layer.getHeight();this._label.y(e/2-5),this._handle.y(e/2-10.5),this._line.points([.5,0,.5,e])},ne.prototype.update=function(e){void 0!==e.startTime&&this._options.startMarker&&this._label.text(this._options.layer.formatTime(e.startTime)),void 0===e.endTime||this._options.startMarker||this._label.text(this._options.layer.formatTime(e.endTime)),void 0!==e.editable&&(this._editable=e.editable,this._label.visible(this._editable),this._handle.visible(this._editable),this._line.visible(this._editable))},oe.prototype.addToStage=function(e){e.add(this._layer)},oe.prototype.showHighlight=function(e,t){this._highlightRect||this._createHighlightRect(e,t),this._update(e,t)},oe.prototype._update=function(e,t){this._startTime=e,this._endTime=t;var n=this._view.timeToPixels(e),i=this._view.timeToPixels(t);this._highlightRect.setAttrs({x:n,width:i-n})},oe.prototype._createHighlightRect=function(e,t){this._startTime=e,this._endTime=t;var n=this._view.timeToPixels(e),i=this._view.timeToPixels(t);this._highlightRect=new o.r({x:n,y:0,width:i-n,height:0,stroke:this._strokeColor,strokeWidth:1,fill:this._color,opacity:this._opacity,cornerRadius:this._cornerRadius}),this.fitToView(),this._layer.add(this._highlightRect)},oe.prototype.removeHighlight=function(){this._highlightRect&&(this._highlightRect.destroy(),this._highlightRect=null)},oe.prototype.updateHighlight=function(){this._highlightRect&&this._update(this._startTime,this._endTime)},oe.prototype.fitToView=function(){if(this._highlightRect){var e=this._view.getHeight(),t=v(this._offset,0,Math.floor(e/2));this._highlightRect.setAttrs({y:t,height:e-2*t})}},se.prototype._bindDefaultEventHandlers=function(){var e=this;e._group.on("dragstart",function(t){e._onDragStart(t,e._point)}),e._group.on("dragmove",function(t){e._onDragMove(t,e._point)}),e._group.on("dragend",function(t){e._onDragEnd(t,e._point)}),e._group.on("mouseenter",function(t){e._onMouseEnter(t,e._point)}),e._group.on("mouseleave",function(t){e._onMouseLeave(t,e._point)})},se.prototype.addToLayer=function(e){e.add(this._group)},se.prototype.fitToView=function(){this._marker.fitToView()},se.prototype.getPoint=function(){return this._point},se.prototype.getX=function(){return this._group.getX()},se.prototype.setX=function(e){this._group.setX(e)},se.prototype.getWidth=function(){return this._group.getWidth()},se.prototype.getAbsolutePosition=function(){return this._group.getAbsolutePosition()},se.prototype.update=function(e){void 0!==e.editable&&this._group.draggable(e.editable),this._marker.update&&this._marker.update(e)},se.prototype.destroy=function(){this._marker.destroy&&this._marker.destroy(),this._group.destroyChildren(),this._group.destroy()},ue.prototype.addToStage=function(e){e.add(this._layer)},ue.prototype.enableEditing=function(e){this._allowEditing=e},ue.prototype.getPointMarker=function(e){return this._pointMarkers[e.pid]},ue.prototype.formatTime=function(e){return this._view.formatTime(e)},ue.prototype._onPointsUpdate=function(e,t){var n=this._view.getStartTime(),i=this._view.getEndTime(),r=this.getPointMarker(e),a=e.isVisible(n,i);if(r&&!a)this._removePoint(e);else if(!r&&a)this._updatePoint(e);else if(r&&a){if(y(t,"time")){var o=this._view.timeToPixels(e.time)-this._view.getFrameOffset();r.setX(o)}r.update(t)}},ue.prototype._onPointsAdd=function(e){var t=this,n=t._view.getStartTime(),i=t._view.getEndTime();e.points.forEach(function(e){e.isVisible(n,i)&&t._updatePoint(e)})},ue.prototype._onPointsRemove=function(e){var t=this;e.points.forEach(function(e){t._removePoint(e)})},ue.prototype._onPointsRemoveAll=function(){this._layer.removeChildren(),this._pointMarkers={}},ue.prototype._createPointMarker=function(e){var t=this._allowEditing&&e.editable;return new se({point:e,draggable:t,marker:this._peaks.options.createPointMarker({point:e,editable:t,color:e.color,fontFamily:this._peaks.options.fontFamily||"sans-serif",fontSize:this._peaks.options.fontSize||10,fontStyle:this._peaks.options.fontStyle||"normal",layer:this,view:this._view.getName()}),onDragStart:this._onPointMarkerDragStart,onDragMove:this._onPointMarkerDragMove,onDragEnd:this._onPointMarkerDragEnd,dragBoundFunc:this._pointMarkerDragBoundFunc,onMouseEnter:this._onPointMarkerMouseEnter,onMouseLeave:this._onPointMarkerMouseLeave})},ue.prototype.getHeight=function(){return this._view.getHeight()},ue.prototype._addPointMarker=function(e){var t=this._createPointMarker(e);return this._pointMarkers[e.pid]=t,t.addToLayer(this._layer),t},ue.prototype._onPointsDrag=function(e){this._updatePoint(e.point).update({time:e.point.time})},ue.prototype._onPointMarkerMouseEnter=function(e,t){this._peaks.emit("points.mouseenter",{point:t,evt:e.evt})},ue.prototype._onPointMarkerMouseLeave=function(e,t){this._peaks.emit("points.mouseleave",{point:t,evt:e.evt})},ue.prototype._onPointMarkerDragStart=function(e,t){this._dragPointMarker=this.getPointMarker(t),this._peaks.emit("points.dragstart",{point:t,evt:e.evt})},ue.prototype._onPointMarkerDragMove=function(e,t){var n=this._pointMarkers[t.pid],i=n.getX()+n.getWidth();t._setTime(this._view.pixelOffsetToTime(i)),this._peaks.emit("points.dragmove",{point:t,evt:e.evt})},ue.prototype._onPointMarkerDragEnd=function(e,t){this._dragPointMarker=null,this._peaks.emit("points.dragend",{point:t,evt:e.evt})},ue.prototype._pointMarkerDragBoundFunc=function(e){return{x:v(e.x,0,this._view.getWidth()),y:this._dragPointMarker.getAbsolutePosition().y}},ue.prototype.updatePoints=function(e,t){this._peaks.points.find(e,t).forEach(this._updatePoint.bind(this)),this._removeInvisiblePoints(e,t)},ue.prototype._updatePoint=function(e){var t=this.getPointMarker(e);t||(t=this._addPointMarker(e));var n=this._view.timeToPixels(e.time)-this._view.getFrameOffset();return t.setX(n),t},ue.prototype._removeInvisiblePoints=function(e,t){for(var n in this._pointMarkers)if(y(this._pointMarkers,n)){var i=this._pointMarkers[n].getPoint();i.isVisible(e,t)||this._removePoint(i)}},ue.prototype._removePoint=function(e){var t=this.getPointMarker(e);t&&(t.destroy(),delete this._pointMarkers[e.pid])},ue.prototype.setVisible=function(e){this._layer.setVisible(e)},ue.prototype.destroy=function(){this._peaks.off("points.update",this._onPointsUpdate),this._peaks.off("points.add",this._onPointsAdd),this._peaks.off("points.remove",this._onPointsRemove),this._peaks.off("points.remove_all",this._onPointsRemoveAll),this._peaks.off("points.dragstart",this._onPointsDrag),this._peaks.off("points.dragmove",this._onPointsDrag),this._peaks.off("points.dragend",this._onPointsDrag)},ue.prototype.fitToView=function(){for(var e in this._pointMarkers)y(this._pointMarkers,e)&&this._pointMarkers[e].fitToView()},ue.prototype.draw=function(){this._layer.draw()},le.prototype.addToStage=function(e){e.add(this._playheadLayer)},le.prototype.zoomLevelChanged=function(){var e=this._view.timeToPixels(1);if(this._useAnimation=e>=5,this._useAnimation)this._player.isPlaying()&&!this._playheadLineAnimation&&this._start();else if(this._playheadLineAnimation){var t=this._player.getCurrentTime();this.stop(t)}},le.prototype.fitToView=function(){var e=this._view.getHeight();this._playheadLine.points([.5,0,.5,e]),this._playheadText&&this._playheadText.y(12)},le.prototype._createPlayhead=function(){this._playheadLine=new a.N({stroke:this._playheadColor,strokeWidth:this._playheadWidth}),this._playheadGroup=new(r().Group)({x:0,y:0}),this._playheadGroup.add(this._playheadLine),this._playheadLayer.add(this._playheadGroup)},le.prototype._createPlayheadText=function(){var e=this,t=e._player.getCurrentTime(),n=e._view.formatTime(t);e._playheadText=new s.EY({x:0,y:0,padding:e._playheadPadding,text:n,fontSize:e._playheadFontSize,fontFamily:e._playheadFontFamily,fontStyle:e._playheadFontStyle,fill:e._playheadTextColor,align:"right",sceneFunc:function(t,n){var i=n.width(),r=n.height()+2*e._playheadPadding;t.fillStyle=e._playheadBackgroundColor,t.fillRect(0,-e._playheadPadding,i,r),n._sceneFunc(t)}}),e._playheadGroup.add(e._playheadText)},le.prototype.updatePlayheadTime=function(e){this._syncPlayhead(e),this._player.isPlaying()&&this._start()},le.prototype._syncPlayhead=function(e){var t=this._view.timeToPixels(e),n=this._view.getFrameOffset(),i=this._view.getWidth(),r=t>=n&&t<=n+i;if(this._playheadPixel=t,r){var a=this._playheadPixel-n;if(this._playheadVisible||(this._playheadVisible=!0,this._playheadGroup.show()),this._playheadGroup.setX(a),this._playheadText){var o=this._view.formatTime(e),s=this._playheadText.width();this._playheadText.setText(o),s+a>i-2?this._playheadText.setX(-s):s+as&&(r=s),r>t.length-1&&(r=t.length-1);for(var u=t.channels,l=0,h=Math.floor(o/u),c=0;c=i;s--)u=t.max_sample(s),l=s-n+.5,h=a+de.scaleY(u,o,c)+1,e.lineTo(l,h);e.closePath(),e.fillShape(this._shape)},de.prototype.addToLayer=function(e){e.add(this._shape)},de.prototype.destroy=function(){this._shape.destroy(),this._shape=null},de.prototype.on=function(e,t){this._shape.on(e,t)},de.prototype.off=function(e,t){this._shape.off(e,t)},de.scaleY=function(e,t,n){var i=-(t-1)*(e*n+128)/255+(t-1);return v(Math.floor(i),0,t-1)};var pe="sans-serif",fe="normal";function ge(e,t,n,i){this._segment=e,this._peaks=t,this._layer=n,this._view=i,this._label=null,this._startMarker=null,this._endMarker=null,this._color=e.color,this._borderColor=e.borderColor,this._draggable=this._segment.editable&&this._view.isSegmentDraggingEnabled(),this._dragging=!1;var a=i.getViewOptions().segmentOptions;this._overlayOffset=a.overlayOffset,a.overlay||(this._waveformShape=new de({color:e.color,view:i,segment:e})),this._onMouseEnter=this._onMouseEnter.bind(this),this._onMouseLeave=this._onMouseLeave.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._dragBoundFunc=this._dragBoundFunc.bind(this),this._onSegmentDragStart=this._onSegmentDragStart.bind(this),this._onSegmentDragMove=this._onSegmentDragMove.bind(this),this._onSegmentDragEnd=this._onSegmentDragEnd.bind(this),this._onSegmentMarkerDragStart=this._onSegmentMarkerDragStart.bind(this),this._onSegmentMarkerDragMove=this._onSegmentMarkerDragMove.bind(this),this._onSegmentMarkerDragEnd=this._onSegmentMarkerDragEnd.bind(this),this._segmentMarkerDragBoundFunc=this._segmentMarkerDragBoundFunc.bind(this),this._label=this._peaks.options.createSegmentLabel({segment:e,view:this._view.getName(),layer:this._layer,fontFamily:this._peaks.options.fontFamily,fontSize:this._peaks.options.fontSize,fontStyle:this._peaks.options.fontStyle}),this._label&&this._label.hide();var o,s,u,l,h,c=this._view.timeToPixelOffset(this._segment.startTime),d=this._view.timeToPixelOffset(this._segment.endTime),p=v(0,this._view.getHeight()-2*this._overlayOffset);this._overlay=new(r().Group)({name:"segment-overlay",segment:this._segment,x:c,y:0,width:d-c,height:this._view.getHeight(),clipX:0,clipY:this._overlayOffset,clipWidth:d-c,clipHeight:p,draggable:this._draggable,dragBoundFunc:this._dragBoundFunc}),a.overlay&&(o=this._borderColor||a.overlayBorderColor,s=a.overlayBorderWidth,u=this._color||a.overlayColor,l=a.overlayOpacity,h=a.overlayCornerRadius),this._overlayRect=new(r().Rect)({x:0,y:this._overlayOffset,width:d-c,stroke:o,strokeWidth:s,height:p,fill:u,opacity:l,cornerRadius:h}),this._overlay.add(this._overlayRect),a.overlay&&(this._overlayText=new(r().Text)({x:0,y:this._overlayOffset,text:this._segment.labelText,fontFamily:a.overlayFontFamily,fontSize:a.overlayFontSize,fontStyle:a.overlayFontStyle,fill:a.overlayLabelColor,listening:!1,align:a.overlayLabelAlign,width:d-c,verticalAlign:a.overlayLabelVerticalAlign,height:p,padding:a.overlayLabelPadding}),this._overlay.add(this._overlayText)),this._overlay.on("mouseenter",this._onMouseEnter),this._overlay.on("mouseleave",this._onMouseLeave),this._overlay.on("mousedown",this._onMouseDown),this._overlay.on("mouseup",this._onMouseUp),this._draggable&&(this._overlay.on("dragstart",this._onSegmentDragStart),this._overlay.on("dragmove",this._onSegmentDragMove),this._overlay.on("dragend",this._onSegmentDragEnd)),this._createMarkers()}function me(e){return new he(e)}function ve(e){return e.endTime-e.startTime}function ye(e,t,n){this._peaks=e,this._view=t,this._allowEditing=n,this._segmentShapes={},this._layer=new(r().Layer),this._onSegmentsUpdate=this._onSegmentsUpdate.bind(this),this._onSegmentsAdd=this._onSegmentsAdd.bind(this),this._onSegmentsRemove=this._onSegmentsRemove.bind(this),this._onSegmentsRemoveAll=this._onSegmentsRemoveAll.bind(this),this._onSegmentsDragged=this._onSegmentsDragged.bind(this),this._peaks.on("segments.update",this._onSegmentsUpdate),this._peaks.on("segments.add",this._onSegmentsAdd),this._peaks.on("segments.remove",this._onSegmentsRemove),this._peaks.on("segments.remove_all",this._onSegmentsRemoveAll),this._peaks.on("segments.dragged",this._onSegmentsDragged)}function be(e,t){var n=this;n._axisGridlineColor=t.axisGridlineColor,n._axisLabelColor=t.axisLabelColor,n._showAxisLabels=t.showAxisLabels,n._axisTopMarkerHeight=t.axisTopMarkerHeight,n._axisBottomMarkerHeight=t.axisBottomMarkerHeight,t.formatAxisTime?n._formatAxisTime=t.formatAxisTime:n._formatAxisTime=function(e){return m(e,0)},n._axisLabelFont=be._buildFontString(t.fontFamily,t.fontSize,t.fontStyle),n._axisShape=new(r().Shape)({sceneFunc:function(t){n._drawAxis(t,e)}})}function _e(e,t,n,i){var a=this;a._container=t,a._peaks=n,a._options=n.options,a._viewOptions=i,a._originalWaveformData=e,a._data=e,a._frameOffset=0,a._width=t.clientWidth,a._height=t.clientHeight,a._amplitudeScale=1,a._waveformColor=a._viewOptions.waveformColor,a._playedWaveformColor=a._viewOptions.playedWaveformColor,a._timeLabelPrecision=a._viewOptions.timeLabelPrecision,a._viewOptions.formatPlayheadTime?a._formatPlayheadTime=a._viewOptions.formatPlayheadTime:a._formatPlayheadTime=function(e){return m(e,a._timeLabelPrecision)},a._enableSeek=!0,a.initWaveform(),r().showWarnings=!1,a._stage=new(r().Stage)({container:t,width:a._width,height:a._height}),a._createWaveform(),a._viewOptions.enableSegments&&(a._segmentsLayer=new ye(n,a,a._viewOptions.enableEditing),a._segmentsLayer.addToStage(a._stage)),a._viewOptions.enablePoints&&(a._pointsLayer=new ue(n,a,a._viewOptions.enableEditing),a._pointsLayer.addToStage(a._stage)),a.initHighlightLayer(),a._createAxisLabels(),a._playheadLayer=new le(a._peaks.player,a,a._viewOptions),a._playheadLayer.addToStage(a._stage),a._onClick=a._onClick.bind(a),a._onDblClick=a._onDblClick.bind(a),a._onContextMenu=a._onContextMenu.bind(a),a._stage.on("click",a._onClick),a._stage.on("dblclick",a._onDblClick),a._stage.on("contextmenu",a._onContextMenu)}function we(e,t){this._stage=e,this._handlers=t,this._dragging=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseUp=this._mouseUp.bind(this),this._mouseMove=this._mouseMove.bind(this),this._stage.on("mousedown",this._mouseDown),this._stage.on("touchstart",this._mouseDown),this._lastMouseClientX=null}function Se(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._mouseDragHandler=new we(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove})}function Te(e,t,n){var i=this;_e.call(i,e,t,n,n.options.overview),i._onTimeUpdate=i._onTimeUpdate.bind(i),i._onPlaying=i._onPlaying.bind(i),i._onPause=i._onPause.bind(i),i._onZoomviewDisplaying=i._onZoomviewDisplaying.bind(i),n.on("player.timeupdate",i._onTimeUpdate),n.on("player.playing",i._onPlaying),n.on("player.pause",i._onPause),n.on("zoomview.displaying",i._onZoomviewDisplaying);var r=i._peaks.player.getCurrentTime();i._playheadLayer.updatePlayheadTime(r),i._mouseDragHandler=new Se(n,i)}function Ae(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new we(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function Ee(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new we(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function xe(e,t,n){var i=this;_e.call(i,e,t,n,n.options.zoomview),i._onTimeUpdate=i._onTimeUpdate.bind(i),i._onPlaying=i._onPlaying.bind(i),i._onPause=i._onPause.bind(i),i._onKeyboardLeft=i._onKeyboardLeft.bind(i),i._onKeyboardRight=i._onKeyboardRight.bind(i),i._onKeyboardShiftLeft=i._onKeyboardShiftLeft.bind(i),i._onKeyboardShiftRight=i._onKeyboardShiftRight.bind(i),i._peaks.on("player.timeupdate",i._onTimeUpdate),i._peaks.on("player.playing",i._onPlaying),i._peaks.on("player.pause",i._onPause),i._peaks.on("keyboard.left",i._onKeyboardLeft),i._peaks.on("keyboard.right",i._onKeyboardRight),i._peaks.on("keyboard.shift_left",i._onKeyboardShiftLeft),i._peaks.on("keyboard.shift_right",i._onKeyboardShiftRight),i._autoScroll=i._viewOptions.autoScroll,i._autoScrollOffset=i._viewOptions.autoScrollOffset,i._enableSegmentDragging=!1,i._segmentDragMode="overlap",i._minSegmentDragWidth=0,i._insertSegmentShape=null,i._playheadClickTolerance=i._viewOptions.playheadClickTolerance,i._zoomLevelAuto=!1,i._zoomLevelSeconds=null;var r=i._peaks.player.getCurrentTime();i._syncPlayhead(r),i._mouseDragHandler=new Ee(n,i),i._onWheel=i._onWheel.bind(i),i._onWheelCaptureVerticalScroll=i._onWheelCaptureVerticalScroll.bind(i),i.setWheelMode(i._viewOptions.wheelMode),i._peaks.emit("zoomview.displaying",0,i.getEndTime())}function Ce(e,t,n){this._waveformData=e,this._container=t,this._peaks=n,this._options=n.options.scrollbar,this._zoomview=n.views.getView("zoomview"),this._dragBoundFunc=this._dragBoundFunc.bind(this),this._onScrollboxDragStart=this._onScrollboxDragStart.bind(this),this._onScrollboxDragMove=this._onScrollboxDragMove.bind(this),this._onScrollboxDragEnd=this._onScrollboxDragEnd.bind(this),this._onZoomviewDisplaying=this._onZoomviewDisplaying.bind(this),this._onScrollbarClick=this._onScrollbarClick.bind(this),n.on("zoomview.displaying",this._onZoomviewDisplaying),this._width=t.clientWidth,this._height=t.clientHeight,this._stage=new(r().Stage)({container:t,width:this._width,height:this._height}),this._layer=new(r().Layer),this._stage.on("click",this._onScrollbarClick),this._stage.add(this._layer),this._color=this._options.color,this._scrollboxX=0,this._minScrollboxWidth=this._options.minWidth,this._offsetY=0,this._scrollbox=new(r().Group)({draggable:!0,dragBoundFunc:this._dragBoundFunc}),this._scrollboxRect=new o.r({x:this._scrollboxX,y:this._offsetY,width:0,height:this._height,fill:this._color}),this._scrollbox.add(this._scrollboxRect),this._setScrollboxWidth(),this._scrollbox.on("dragstart",this._onScrollboxDragStart),this._scrollbox.on("dragmove",this._onScrollboxDragMove),this._scrollbox.on("dragend",this._onScrollboxDragEnd),this._layer.add(this._scrollbox),this._layer.draw()}function ke(e){this._peaks=e,this._overview=null,this._zoomview=null,this._scrollbar=null}function Ie(e,t){this._peaks=e,this._zoomLevels=t,this._zoomLevelIndex=0}ge.prototype._createMarkers=function(){var e=this._layer.isEditingEnabled()&&this._segment.editable,t=this._view.getViewOptions().segmentOptions,n=t.markers?this._peaks.options.createSegmentMarker:me,i=n({segment:this._segment,editable:e,startMarker:!0,color:t.startMarkerColor,fontFamily:this._peaks.options.fontFamily||pe,fontSize:this._peaks.options.fontSize||10,fontStyle:this._peaks.options.fontStyle||fe,layer:this._layer,view:this._view.getName(),segmentOptions:this._view.getViewOptions().segmentOptions});i&&(this._startMarker=new ce({segment:this._segment,segmentShape:this,editable:e,startMarker:!0,marker:i,onDragStart:this._onSegmentMarkerDragStart,onDragMove:this._onSegmentMarkerDragMove,onDragEnd:this._onSegmentMarkerDragEnd,dragBoundFunc:this._segmentMarkerDragBoundFunc}));var r=n({segment:this._segment,editable:e,startMarker:!1,color:t.endMarkerColor,fontFamily:this._peaks.options.fontFamily||pe,fontSize:this._peaks.options.fontSize||10,fontStyle:this._peaks.options.fontStyle||fe,layer:this._layer,view:this._view.getName(),segmentOptions:this._view.getViewOptions().segmentOptions});r&&(this._endMarker=new ce({segment:this._segment,segmentShape:this,editable:e,startMarker:!1,marker:r,onDragStart:this._onSegmentMarkerDragStart,onDragMove:this._onSegmentMarkerDragMove,onDragEnd:this._onSegmentMarkerDragEnd,dragBoundFunc:this._segmentMarkerDragBoundFunc}))},ge.prototype._dragBoundFunc=function(e){return{x:e.x,y:0}},ge.prototype.update=function(e){var t,n=this._view.timeToPixelOffset(this._segment.startTime),i=this._view.timeToPixelOffset(this._segment.endTime),r=i-n;(t=this.getStartMarker())&&(t.setX(n-t.getWidth()),e&&t.update(e)),(t=this.getEndMarker())&&(t.setX(i),e&&t.update(e)),this._color=this._segment.color,this._borderColor=this._segment.bordercolor,this._overlayText&&this._overlayText.text(this._segment.labelText),this._view.getViewOptions().segmentOptions.overlay?(this._color&&this._overlayRect.fill(this._color),this._borderColor&&this._overlayRect.stroke(this._borderColor)):this._waveformShape.setWaveformColor(this._segment.color),this._dragging||this._overlay&&(this._overlay.setAttrs({x:n,width:r,clipWidth:r<1?1:r}),this._overlayRect.setAttrs({x:0,width:r}),this._overlayText&&this._overlayText.setAttrs({width:r}))},ge.prototype.getSegment=function(){return this._segment},ge.prototype.getStartMarker=function(){return this._startMarker},ge.prototype.getEndMarker=function(){return this._endMarker},ge.prototype.addToLayer=function(e){this._waveformShape&&this._waveformShape.addToLayer(e),this._label&&e.add(this._label),this._overlay&&e.add(this._overlay),this._startMarker&&this._startMarker.addToLayer(e),this._endMarker&&this._endMarker.addToLayer(e)},ge.prototype.isDragging=function(){return this._dragging},ge.prototype._onMouseEnter=function(e){this._label&&(this._label.moveToTop(),this._label.show()),this._peaks.emit("segments.mouseenter",{segment:this._segment,evt:e.evt})},ge.prototype._onMouseLeave=function(e){this._label&&this._label.hide(),this._peaks.emit("segments.mouseleave",{segment:this._segment,evt:e.evt})},ge.prototype._onMouseDown=function(e){this._peaks.emit("segments.mousedown",{segment:this._segment,evt:e.evt})},ge.prototype._onMouseUp=function(e){this._peaks.emit("segments.mouseup",{segment:this._segment,evt:e.evt})},ge.prototype.segmentClicked=function(e,t){this._moveToTop(),this._peaks.emit("segments."+e,t)},ge.prototype._moveToTop=function(){this._overlay.moveToTop(),this._layer.moveSegmentMarkersToTop()},ge.prototype.enableSegmentDragging=function(e){this._segment.editable&&(!this._draggable&&e?(this._overlay.on("dragstart",this._onSegmentDragStart),this._overlay.on("dragmove",this._onSegmentDragMove),this._overlay.on("dragend",this._onSegmentDragEnd)):this._draggable&&!e&&(this._overlay.off("dragstart",this._onSegmentDragStart),this._overlay.off("dragmove",this._onSegmentDragMove),this._overlay.off("dragend",this._onSegmentDragEnd)),this._overlay.draggable(e),this._draggable=e)},ge.prototype._setPreviousAndNextSegments=function(){"overlap"!==this._view.getSegmentDragMode()?(this._nextSegment=this._peaks.segments.findNextSegment(this._segment),this._previousSegment=this._peaks.segments.findPreviousSegment(this._segment)):(this._nextSegment=null,this._previousSegment=null)},ge.prototype._onSegmentDragStart=function(e){this._setPreviousAndNextSegments(),this._dragging=!0,this._dragStartX=this._overlay.getX(),this._dragStartTime=this._segment.startTime,this._dragEndTime=this._segment.endTime,this._peaks.emit("segments.dragstart",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt})},ge.prototype._onSegmentDragMove=function(e){var t,n=this._overlay.getX()-this._dragStartX,i=this._view.pixelsToTime(n),r=this._dragStartTime+i,a=this._dragEndTime+i,o=this._segment.endTime-this._segment.startTime,s=this._view.getMinSegmentDragWidth(),u=this._view.pixelsToTime(s),l=!1,h=!1;if(r<0&&(r=0,a=o,this._overlay.setX(this._view.timeToPixelOffset(r))),this._previousSegment){var c=this._view.timeToPixelOffset(this._previousSegment.endTime);if(rthis._nextSegment.startTime)if("no-overlap"===(t=this._view.getSegmentDragMode())||"compress"===t&&!this._nextSegment.editable)r=(a=this._nextSegment.startTime)-o,this._overlay.setX(f-this._overlay.getWidth());else if("compress"===t){var g=a,m=this._nextSegment.endTime-u;g>m&&(g=m,f=this._view.timeToPixelOffset(g),this._overlay.setX(f-this._overlay.getWidth()),r=(a=g)-o),this._nextSegment.update({startTime:g}),h=!0}}this._segment._setStartTime(r),this._segment._setEndTime(a),this._peaks.emit("segments.dragged",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt}),l?this._peaks.emit("segments.dragged",{segment:this._previousSegment,marker:!1,startMarker:!1,evt:e.evt}):h&&this._peaks.emit("segments.dragged",{segment:this._nextSegment,marker:!1,startMarker:!1,evt:e.evt})},ge.prototype._onSegmentDragEnd=function(e){this._dragging=!1,this._peaks.emit("segments.dragend",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt})},ge.prototype.moveMarkersToTop=function(){this._startMarker&&this._startMarker.moveToTop(),this._endMarker&&this._endMarker.moveToTop()},ge.prototype.startDrag=function(){this._endMarker&&this._endMarker.startDrag()},ge.prototype.stopDrag=function(){this._endMarker&&this._endMarker.stopDrag()},ge.prototype._onSegmentMarkerDragStart=function(e,t){this._setPreviousAndNextSegments(),this._moveToTop(),this._startMarkerX=this._startMarker.getX(),this._endMarkerX=this._endMarker.getX(),this._peaks.emit("segments.dragstart",{segment:this._segment,marker:!0,startMarker:e.isStartMarker(),evt:t.evt})},ge.prototype._onSegmentMarkerDragMove=function(e,t){e.isStartMarker()?(this._segmentStartMarkerDragMove(e,t),e.update({startTime:this._segment.startTime})):(this._segmentEndMarkerDragMove(e,t),e.update({endTime:this._segment.endTime}))},ge.prototype._segmentStartMarkerDragMove=function(e,t){var n=this._view.getWidth(),i=this._startMarker.getX(),r=this._endMarker.getX(),a=this._view.pixelsToTime(50),o=this._view.getMinSegmentDragWidth(),s=this._endMarker.getX()-o;s>n&&(s=n);var u,l=!1,h=!1;if(this._previousSegment&&(l=(u=this._view.timeToPixelOffset(this._previousSegment.endTime))>=0),i>s)e.setX(s),this._overlay.clipWidth(s-r),0===o&&s0?this._segment._setEndTime(this._segment.startTime):this._segment._setEndTime(this._view.pixelOffsetToTime(s));else if(this._nextSegment&&l){var c=this._view.getSegmentDragMode(),d="no-overlap"===c||"compress"===c&&!this._nextSegment.editable,p="compress"===c&&this._nextSegment.editable;if(r>=u){if(d)e.setX(u),this._overlay.clipWidth(u-i),this._segment._setEndTime(this._nextSegment.startTime);else if(p){var f=ve(this._nextSegment);fg&&(r=g),e.setX(r),this._overlay.clipWidth(r-i),this._segment._setEndTime(this._view.pixelOffsetToTime(r)),this._nextSegment.update({startTime:this._view.pixelOffsetToTime(r)}),h=!0}}else r>n&&(r=n),e.setX(r),this._overlay.clipWidth(r-i),this._segment._setEndTime(this._view.pixelOffsetToTime(r))}else r>n&&(r=n),e.setX(r),this._overlay.clipWidth(r-i),this._segment._setEndTime(this._view.pixelOffsetToTime(r));this._peaks.emit("segments.dragged",{segment:this._segment,marker:!0,startMarker:!1,evt:t.evt}),h&&this._peaks.emit("segments.dragged",{segment:this._nextSegment,marker:!0,startMarker:!0,evt:t.evt})},ge.prototype._onSegmentMarkerDragEnd=function(e,t){this._nextSegment=null,this._previousSegment=null;var n=e.isStartMarker();this._peaks.emit("segments.dragend",{segment:this._segment,marker:!0,startMarker:n,evt:t.evt})},ge.prototype._segmentMarkerDragBoundFunc=function(e,t){return{x:t.x,y:e.getAbsolutePosition().y}},ge.prototype.fitToView=function(){if(this._startMarker&&this._startMarker.fitToView(),this._endMarker&&this._endMarker.fitToView(),this._overlay){var e=this._view.getHeight(),t=v(0,e-2*this._overlayOffset);this._overlay.setAttrs({y:0,height:e,clipY:this._overlayOffset,clipHeight:t}),this._overlayRect.setAttrs({y:this._overlayOffset,height:t}),this._overlayText&&this._overlayText.setAttrs({y:this._overlayOffset,height:t})}},ge.prototype.destroy=function(){this._waveformShape&&this._waveformShape.destroy(),this._label&&this._label.destroy(),this._startMarker&&this._startMarker.destroy(),this._endMarker&&this._endMarker.destroy(),this._overlay&&this._overlay.destroy()},ye.prototype.addToStage=function(e){e.add(this._layer)},ye.prototype.enableEditing=function(e){this._allowEditing=e},ye.prototype.isEditingEnabled=function(){return this._allowEditing},ye.prototype.enableSegmentDragging=function(e){for(var t in this._segmentShapes)y(this._segmentShapes,t)&&this._segmentShapes[t].enableSegmentDragging(e)},ye.prototype.getSegmentShape=function(e){return this._segmentShapes[e.pid]},ye.prototype.formatTime=function(e){return this._view.formatTime(e)},ye.prototype._onSegmentsUpdate=function(e,t){var n=this._view.getStartTime(),i=this._view.getEndTime(),r=this.getSegmentShape(e),a=e.isVisible(n,i);r&&!a?r.isDragging()||this._removeSegment(e):!r&&a?r=this._updateSegment(e):r&&a&&r.update(t)},ye.prototype._onSegmentsAdd=function(e){var t=this,n=t._view.getStartTime(),i=t._view.getEndTime();e.segments.forEach(function(e){e.isVisible(n,i)&&t._addSegmentShape(e).update()}),this.moveSegmentMarkersToTop()},ye.prototype._onSegmentsRemove=function(e){var t=this;e.segments.forEach(function(e){t._removeSegment(e)})},ye.prototype._onSegmentsRemoveAll=function(){this._layer.removeChildren(),this._segmentShapes={}},ye.prototype._onSegmentsDragged=function(e){this._updateSegment(e.segment)},ye.prototype._createSegmentShape=function(e){return new ge(e,this._peaks,this,this._view)},ye.prototype._addSegmentShape=function(e){var t=this._createSegmentShape(e);return t.addToLayer(this._layer),this._segmentShapes[e.pid]=t,t},ye.prototype.updateSegments=function(e,t){this._peaks.segments.find(e,t).forEach(this._updateSegment.bind(this)),this._removeInvisibleSegments(e,t)},ye.prototype._updateSegment=function(e){var t=this.getSegmentShape(e);t||(t=this._addSegmentShape(e)),t.update()},ye.prototype._removeInvisibleSegments=function(e,t){for(var n in this._segmentShapes)if(y(this._segmentShapes,n)){var i=this._segmentShapes[n].getSegment();i.isVisible(e,t)||this._removeSegment(i)}},ye.prototype._removeSegment=function(e){var t=this._segmentShapes[e.pid];t&&(t.destroy(),delete this._segmentShapes[e.pid])},ye.prototype.moveSegmentMarkersToTop=function(){for(var e in this._segmentShapes)y(this._segmentShapes,e)&&this._segmentShapes[e].moveMarkersToTop()},ye.prototype.setVisible=function(e){this._layer.setVisible(e)},ye.prototype.segmentClicked=function(e,t){var n=this._segmentShapes[t.segment.pid];n&&n.segmentClicked(e,t)},ye.prototype.destroy=function(){this._peaks.off("segments.update",this._onSegmentsUpdate),this._peaks.off("segments.add",this._onSegmentsAdd),this._peaks.off("segments.remove",this._onSegmentsRemove),this._peaks.off("segments.remove_all",this._onSegmentsRemoveAll),this._peaks.off("segments.dragged",this._onSegmentsDragged)},ye.prototype.fitToView=function(){for(var e in this._segmentShapes)y(this._segmentShapes,e)&&this._segmentShapes[e].fitToView()},ye.prototype.draw=function(){this._layer.draw()},ye.prototype.getHeight=function(){return this._layer.getHeight()},be._buildFontString=function(e,t,n){return t||(t=11),e||(e="sans-serif"),n||(n="normal"),n+" "+t+"px "+e},be.prototype.addToLayer=function(e){e.add(this._axisShape)},be.prototype.showAxisLabels=function(e,t){this._showAxisLabels=e,t&&(y(t,"topMarkerHeight")&&(this._axisTopMarkerHeight=t.topMarkerHeight),y(t,"bottomMarkerHeight")&&(this._axisBottomMarkerHeight=t.bottomMarkerHeight))},be.prototype._getAxisLabelScale=function(e){for(var t,n=1,i=[1,2,5,10,20,30],r=0;t=n*i[r],e.timeToPixels(t)<60;)++r===i.length&&(n*=60,r=0);return t},be.prototype._drawAxis=function(e,t){var n=t.getStartTime(),i=this._getAxisLabelScale(t),r=function(e,t){if(0===t)return 0;var n=1;return e<0&&(n=-1,e=-e),n*((Math.ceil(e)+t-1)/t|0)*t}(n,i),a=r-n,o=t.timeToPixels(a);e.setAttr("strokeStyle",this._axisGridlineColor),e.setAttr("lineWidth",1),e.setAttr("font",this._axisLabelFont),e.setAttr("fillStyle",this._axisLabelColor),e.setAttr("textAlign","left"),e.setAttr("textBaseline","bottom");for(var s=t.getWidth(),u=t.getHeight(),l=r;;){var h=o+t.timeToPixels(l-r);if(h>=s)break;if(this._axisTopMarkerHeight>0&&(e.beginPath(),e.moveTo(h+.5,0),e.lineTo(h+.5,0+this._axisTopMarkerHeight),e.stroke()),this._axisBottomMarkerHeight&&(e.beginPath(),e.moveTo(h+.5,u),e.lineTo(h+.5,u-this._axisBottomMarkerHeight),e.stroke()),this._showAxisLabels){var c=this._formatAxisTime(l),d=h-e.measureText(c).width/2,p=u-1-this._axisBottomMarkerHeight;d>=0&&e.fillText(c,d,p)}l+=i}},_e.prototype.getViewOptions=function(){return this._viewOptions},_e.prototype.getWaveformData=function(){return this._data},_e.prototype.setWaveformData=function(e){this._data=e},_e.prototype.timeToPixels=function(e){return Math.floor(e*this._data.sample_rate/this._data.scale)},_e.prototype.pixelsToTime=function(e){return e*this._data.scale/this._data.sample_rate},_e.prototype.pixelOffsetToTime=function(e){return(this._frameOffset+e)*this._data.scale/this._data.sample_rate},_e.prototype.timeToPixelOffset=function(e){return Math.floor(e*this._data.sample_rate/this._data.scale)-this._frameOffset},_e.prototype.getFrameOffset=function(){return this._frameOffset},_e.prototype.getWidth=function(){return this._width},_e.prototype.getHeight=function(){return this._height},_e.prototype.getStartTime=function(){return this.pixelOffsetToTime(0)},_e.prototype.getEndTime=function(){return this.pixelOffsetToTime(this._width)},_e.prototype._getDuration=function(){return this._peaks.player.getDuration()},_e.prototype._createWaveform=function(){this._waveformLayer=new(r().Layer)({listening:!1}),this._createWaveformShapes(),this._stage.add(this._waveformLayer)},_e.prototype._createWaveformShapes=function(){if(this._waveformShape||(this._waveformShape=new de({color:this._waveformColor,view:this}),this._waveformShape.addToLayer(this._waveformLayer)),this._playedWaveformColor&&!this._playedWaveformShape){var e=this._peaks.player.getCurrentTime();this._playedSegment={startTime:0,endTime:e},this._unplayedSegment={startTime:e,endTime:this._getDuration()},this._waveformShape.setSegment(this._unplayedSegment),this._playedWaveformShape=new de({color:this._playedWaveformColor,view:this,segment:this._playedSegment}),this._playedWaveformShape.addToLayer(this._waveformLayer)}},_e.prototype.setWaveformColor=function(e){this._waveformColor=e,this._waveformShape.setWaveformColor(e)},_e.prototype.setPlayedWaveformColor=function(e){this._playedWaveformColor=e,e?(this._playedWaveformShape||this._createWaveformShapes(),this._playedWaveformShape.setWaveformColor(e)):this._playedWaveformShape&&this._destroyPlayedWaveformShape()},_e.prototype._destroyPlayedWaveformShape=function(){this._waveformShape.setSegment(null),this._playedWaveformShape.destroy(),this._playedWaveformShape=null,this._playedSegment=null,this._unplayedSegment=null},_e.prototype._createAxisLabels=function(){this._axisLayer=new(r().Layer)({listening:!1}),this._axis=new be(this,this._viewOptions),this._axis.addToLayer(this._axisLayer),this._stage.add(this._axisLayer)},_e.prototype.showAxisLabels=function(e,t){this._axis.showAxisLabels(e,t),this._axisLayer.draw()},_e.prototype.showPlayheadTime=function(e){this._playheadLayer.showPlayheadTime(e)},_e.prototype.setTimeLabelPrecision=function(e){this._timeLabelPrecision=e,this._playheadLayer.updatePlayheadText()},_e.prototype.formatTime=function(e){return this._formatPlayheadTime(e)},_e.prototype.setAmplitudeScale=function(e){if(!_(e)||"number"!=typeof(t=e)||t!=t||t===1/0||t===-1/0)throw new Error("view.setAmplitudeScale(): Scale must be a valid number");var t;this._amplitudeScale=e,this.drawWaveformLayer(),this._segmentsLayer&&this._segmentsLayer.draw()},_e.prototype.getAmplitudeScale=function(){return this._amplitudeScale},_e.prototype.enableSeek=function(e){this._enableSeek=e},_e.prototype.isSeekEnabled=function(){return this._enableSeek},_e.prototype._onClick=function(e){this._clickHandler(e,"click")},_e.prototype._onDblClick=function(e){this._clickHandler(e,"dblclick")},_e.prototype._onContextMenu=function(e){this._clickHandler(e,"contextmenu")},_e.prototype._clickHandler=function(e,t){var n=!0;if(e.target!==this._stage){var i=k(e.target);if(i)if("point-marker"===i.attrs.name){var r=i.getAttr("point");r&&this._peaks.emit("points."+t,{point:r,evt:e.evt,preventViewEvent:function(){n=!1}})}else if("segment-overlay"===i.attrs.name){var a=i.getAttr("segment");if(a){var o={segment:a,evt:e.evt,preventViewEvent:function(){n=!1}};this._segmentsLayer&&this._segmentsLayer.segmentClicked(t,o)}}}if(n){var s=e.evt.layerX,u=this.pixelOffsetToTime(s),l=this.getName();this._peaks.emit(l+"."+t,{time:u,evt:e.evt})}},_e.prototype.updatePlayheadTime=function(e){this._playheadLayer.updatePlayheadTime(e)},_e.prototype.playheadPosChanged=function(e){this._playedWaveformShape&&(this._playedSegment.endTime=e,this._unplayedSegment.startTime=e,this.drawWaveformLayer())},_e.prototype.drawWaveformLayer=function(){this._waveformLayer.draw()},_e.prototype.enableMarkerEditing=function(e){this._segmentsLayer&&this._segmentsLayer.enableEditing(e),this._pointsLayer&&this._pointsLayer.enableEditing(e)},_e.prototype.fitToContainer=function(){if(0!==this._container.clientWidth||0!==this._container.clientHeight){var e=!1;this._container.clientWidth!==this._width&&(this._width=this._container.clientWidth,this._stage.setWidth(this._width),e=this.containerWidthChange()),this._container.clientHeight!==this._height&&(this._height=this._container.clientHeight,this._stage.height(this._height),this._waveformShape.fitToView(),this._playheadLayer.fitToView(),this._segmentsLayer&&this._segmentsLayer.fitToView(),this._pointsLayer&&this._pointsLayer.fitToView(),this.containerHeightChange()),e&&this.updateWaveform(this._frameOffset)}},_e.prototype.destroy=function(){this._playheadLayer.destroy(),this._segmentsLayer&&this._segmentsLayer.destroy(),this._pointsLayer&&this._pointsLayer.destroy(),this._stage&&(this._stage.destroy(),this._stage=null)},we.prototype._mouseDown=function(e){var t=null;if("mousedown"!==e.type||0===e.evt.button){var n=k(e.target);if(n){if("point-marker"===n.attrs.name||"segment-marker"===n.attrs.name)return;"segment-overlay"===n.attrs.name&&(t=n)}if(this._lastMouseClientX=Math.floor("touchstart"===e.type?e.evt.touches[0].clientX:e.evt.clientX),this._handlers.onMouseDown){var i=this._getMousePosX(this._lastMouseClientX);this._handlers.onMouseDown(i,t)}window.addEventListener("mousemove",this._mouseMove,{capture:!1,passive:!0}),window.addEventListener("touchmove",this._mouseMove,{capture:!1,passive:!0}),window.addEventListener("mouseup",this._mouseUp,{capture:!1,passive:!0}),window.addEventListener("touchend",this._mouseUp,{capture:!1,passive:!0}),window.addEventListener("blur",this._mouseUp,{capture:!1,passive:!0})}},we.prototype._mouseMove=function(e){var t=Math.floor("touchmove"===e.type?e.changedTouches[0].clientX:e.clientX);if(t!==this._lastMouseClientX&&(this._lastMouseClientX=t,this._dragging=!0,this._handlers.onMouseMove)){var n=this._getMousePosX(t);this._handlers.onMouseMove(n)}},we.prototype._mouseUp=function(e){var t;if("touchend"===e.type?(t=Math.floor(e.changedTouches[0].clientX),e.cancelable&&e.preventDefault()):t=Math.floor(e.clientX),this._handlers.onMouseUp){var n=this._getMousePosX(t);this._handlers.onMouseUp(n)}window.removeEventListener("mousemove",this._mouseMove,{capture:!1}),window.removeEventListener("touchmove",this._mouseMove,{capture:!1}),window.removeEventListener("mouseup",this._mouseUp,{capture:!1}),window.removeEventListener("touchend",this._mouseUp,{capture:!1}),window.removeEventListener("blur",this._mouseUp,{capture:!1}),this._dragging=!1},we.prototype._getMousePosX=function(e){return e-this._stage.getContainer().getBoundingClientRect().left},we.prototype.isDragging=function(){return this._dragging},we.prototype.destroy=function(){this._stage.off("mousedown",this._mouseDown),this._stage.off("touchstart",this._mouseDown)},Se.prototype._onMouseDown=function(e){this._seek(e)},Se.prototype._onMouseMove=function(e){this._seek(e)},Se.prototype._seek=function(e){if(this._view.isSeekEnabled()){e=v(e,0,this._width);var t=this._view.pixelsToTime(e),n=this._peaks.player.getDuration();t>n&&(t=n),this._view.updatePlayheadTime(t),this._peaks.player.seek(t)}},Se.prototype.destroy=function(){this._mouseDragHandler.destroy()},Te.prototype=Object.create(_e.prototype),Te.prototype.initWaveform=function(){0!==this._width&&this._resampleAndSetWaveformData(this._originalWaveformData,this._width)},Te.prototype.initHighlightLayer=function(){this._highlightLayer=new oe(this,this._viewOptions),this._highlightLayer.addToStage(this._stage)},Te.prototype.isSegmentDraggingEnabled=function(){return!1},Te.prototype.getName=function(){return"overview"},Te.prototype._onTimeUpdate=function(e){this._playheadLayer.updatePlayheadTime(e)},Te.prototype._onPlaying=function(e){this._playheadLayer.updatePlayheadTime(e)},Te.prototype._onPause=function(e){this._playheadLayer.stop(e)},Te.prototype._onZoomviewDisplaying=function(e,t){this.showHighlight(e,t)},Te.prototype.showHighlight=function(e,t){this._highlightLayer.showHighlight(e,t)},Te.prototype.setWaveformData=function(e){this._originalWaveformData=e,0!==this._width?this._resampleAndSetWaveformData(e,this._width):this._data=e,this.updateWaveform()},Te.prototype._resampleAndSetWaveformData=function(e,t){try{return this._data=e.resample({width:t}),!0}catch(t){return this._data=e,!1}},Te.prototype.removeHighlightRect=function(){this._highlightLayer.removeHighlight()},Te.prototype.updateWaveform=function(){this._waveformLayer.draw(),this._axisLayer.draw();var e=this._peaks.player.getCurrentTime();this._playheadLayer.updatePlayheadTime(e),this._highlightLayer.updateHighlight();var t=this.pixelsToTime(this._width);this._pointsLayer&&this._pointsLayer.updatePoints(0,t),this._segmentsLayer&&this._segmentsLayer.updateSegments(0,t)},Te.prototype.containerWidthChange=function(){return this._resampleAndSetWaveformData(this._originalWaveformData,this._width)},Te.prototype.containerHeightChange=function(){this._highlightLayer.fitToView()},Te.prototype.destroy=function(){this._peaks.off("player.playing",this._onPlaying),this._peaks.off("player.pause",this._onPause),this._peaks.off("player.timeupdate",this._onTimeUpdate),this._peaks.off("zoomview.displaying",this._onZoomviewDisplaying),this._mouseDragHandler.destroy(),_e.prototype.destroy.call(this)},Ae.prototype.isDragging=function(){return this._mouseDragHandler.isDragging()},Ae.prototype._reset=function(){this._insertSegment=null,this._insertSegmentShape=null,this._segmentIsDraggable=!1,this._peaks.segments.setInserting(!1)},Ae.prototype._onMouseDown=function(e,t){if(this._reset(),this._segment=t,this._segment){if("overlap"!==this._view.getSegmentDragMode())return;this._segmentIsDraggable=this._segment.draggable(),this._segment.draggable(!1)}var n=this._view.pixelsToTime(e+this._view.getFrameOffset());this._peaks.segments.setInserting(!0),this._insertSegment=this._peaks.segments.add({startTime:n,endTime:n,editable:!0}),this._insertSegmentShape=this._view._segmentsLayer.getSegmentShape(this._insertSegment),this._insertSegmentShape&&(this._insertSegmentShape.moveMarkersToTop(),this._insertSegmentShape.startDrag())},Ae.prototype._onMouseMove=function(){},Ae.prototype._onMouseUp=function(){this._insertSegment&&(this._insertSegmentShape&&(this._insertSegmentShape.stopDrag(),this._insertSegmentShape=null),this._segment&&this._segmentIsDraggable&&this._segment.draggable(!0),this._peaks.emit("segments.insert",{segment:this._insertSegment}),this._peaks.segments.setInserting(!1))},Ae.prototype.destroy=function(){this._mouseDragHandler.destroy()},Ee.prototype.isDragging=function(){return this._mouseDragHandler.isDragging()},Ee.prototype._onMouseDown=function(e,t){this._seeking=!1,t&&!t.attrs.draggable?this._segment=null:this._segment=t;var n=this._view.getPlayheadOffset();if(this._view.isSeekEnabled()&&Math.abs(e-n)<=this._view.getPlayheadClickTolerance()&&(this._seeking=!0,this._segment&&(this._segmentIsDraggable=this._segment.draggable(),this._segment.draggable(!1))),this._seeking){e=v(e,0,this._view.getWidth());var i=this._view.pixelsToTime(e+this._view.getFrameOffset());this._seek(i)}else this._initialFrameOffset=this._view.getFrameOffset(),this._mouseDownX=e},Ee.prototype._onMouseMove=function(e){if(!this._segment||this._seeking)if(this._seeking){e=v(e,0,this._view.getWidth());var t=this._view.pixelsToTime(e+this._view.getFrameOffset());this._seek(t)}else if(!this._view.isAutoZoom()){var n=this._mouseDownX-e,i=this._initialFrameOffset+n;i!==this._initialFrameOffset&&this._view.updateWaveform(i)}},Ee.prototype._onMouseUp=function(){if(!this._seeking&&this._view._enableSeek&&!this._mouseDragHandler.isDragging()){var e=this._view.pixelOffsetToTime(this._mouseDownX);this._seek(e)}this._segment&&this._seeking&&this._segmentIsDraggable&&this._segment.draggable(!0)},Ee.prototype._seek=function(e){var t=this._peaks.player.getDuration();e>t&&(e=t),this._view.updatePlayheadTime(e),this._peaks.player.seek(e)},Ee.prototype.destroy=function(){this._mouseDragHandler.destroy()},xe.prototype=Object.create(_e.prototype),xe.prototype.initWaveform=function(){this._enableWaveformCache=this._options.waveformCache,this._initWaveformCache();var e=this._peaks.zoom.getZoomLevel();this._resampleData({scale:e})},xe.prototype._initWaveformCache=function(){this._enableWaveformCache&&(this._waveformData=new Map,this._waveformData.set(this._originalWaveformData.scale,this._originalWaveformData),this._waveformScales=[this._originalWaveformData.scale])},xe.prototype.initHighlightLayer=function(){},xe.prototype.setWheelMode=function(e,t){t||(t={}),e===this._wheelMode&&t.captureVerticalScroll===this._captureVerticalScroll||(this._stage.off("wheel"),this._wheelMode=e,this._captureVerticalScroll=t.captureVerticalScroll,"scroll"!==e)||(t.captureVerticalScroll?this._stage.on("wheel",this._onWheelCaptureVerticalScroll):this._stage.on("wheel",this._onWheel))},xe.prototype._onWheel=function(e){var t,n=e.evt;if(n.shiftKey)if(0!==n.deltaY)t=n.deltaY;else{if(0===n.deltaX)return;t=n.deltaX}else{if(Math.abs(n.deltaX)=this._frameOffset+this._width-this._autoScrollOffset||t=0&&a=this._zoomLevels.length&&(e=this._zoomLevels.length-1),e<0&&(e=0),t||e!==this._zoomLevelIndex){this._zoomLevelIndex=e;var n=this._peaks.views.getView("zoomview");n&&n.setZoom({scale:this._zoomLevels[e]})}},Ie.prototype.getZoom=function(){return this._zoomLevelIndex},Ie.prototype.getZoomLevel=function(){return this._zoomLevels[this._zoomLevelIndex]};var Me="withCredentials"in new XMLHttpRequest;function Pe(e){this._peaks=e}function Le(e){var t=e.getResponseHeader("content-range");if(!t)return!1;var n=t.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(n&&4===n.length){var i=parseInt(n[1],10),r=parseInt(n[2],10),a=parseInt(n[3],10);return 0===i&&r+1===a}return!1}function De(){return d.call(this),this.options={zoomLevels:[512,1024,2048,4096],waveformCache:!0,mediaElement:null,mediaUrl:null,dataUri:null,withCredentials:!1,waveformData:null,webAudio:null,nudgeIncrement:1,pointMarkerColor:"#39cccc",createSegmentMarker:ie,createSegmentLabel:re,createPointMarker:ae,logger:console.error.bind(console)},this}Pe.prototype.init=function(e,t){if(!(e.dataUri&&(e.webAudio||e.audioContext)||e.waveformData&&(e.webAudio||e.audioContext)||e.dataUri&&e.waveformData))return e.audioContext&&(this._peaks._logger("Peaks.init(): The audioContext option is deprecated, please pass a webAudio object instead"),e.webAudio={audioContext:e.audioContext}),e.dataUri?this._getRemoteWaveformData(e,t):e.waveformData?this._buildWaveformFromLocalData(e,t):e.webAudio?e.webAudio.audioBuffer?this._buildWaveformDataFromAudioBuffer(e,t):this._buildWaveformDataUsingWebAudio(e,t):void t(new Error("Peaks.init(): You must pass an audioContext, or dataUri, or waveformData to render waveform data"));t(new TypeError("Peaks.init(): You may only pass one source (webAudio, dataUri, or waveformData) to render waveform data."))},Pe.prototype._getRemoteWaveformData=function(e,t){var n,i=this,r=null,a=null;S(e.dataUri)?(r=e.dataUri,["ArrayBuffer","JSON"].some(function(e){if(window[e])return a=e.toLowerCase(),n=r[a],Boolean(n)}),n?(i._xhr=i._createXHR(n,a,e.withCredentials,function(e){if(4===this.readyState)if(200===this.status||206===this.status&&Le(this)){i._xhr=null;var n=l.A.create(e.target.response);1===n.channels||2===n.channels?8===n.bits?t(null,n):t(new Error("Peaks.init(): 16-bit waveform data is not supported")):t(new Error("Peaks.init(): Only mono or stereo waveforms are currently supported"))}else t(new Error("Unable to fetch remote data. HTTP status "+this.status))},function(){t(new Error("XHR failed"))},function(){t(new Error("XHR aborted"))}),i._xhr.send()):t(new Error("Peaks.init(): Unable to determine a compatible dataUri format for this browser"))):t(new TypeError("Peaks.init(): The dataUri option must be an object"))},Pe.prototype._buildWaveformFromLocalData=function(e,t){var n,i=null,r=null;if(S(e.waveformData))if(S((i=e.waveformData).json)?r=i.json:(n=i.arraybuffer,Object.prototype.toString.call(n).includes("ArrayBuffer")&&(r=i.arraybuffer)),r)try{var a=l.A.create(r);if(1!==a.channels&&2!==a.channels)return void t(new Error("Peaks.init(): Only mono or stereo waveforms are currently supported"));if(8!==a.bits)return void t(new Error("Peaks.init(): 16-bit waveform data is not supported"));t(null,a)}catch(e){t(e)}else t(new Error("Peaks.init(): Unable to determine a compatible waveformData format"));else t(new Error("Peaks.init(): The waveformData option must be an object"))},Pe.prototype._buildWaveformDataUsingWebAudio=function(e,t){var n=this,i=window.AudioContext||window.webkitAudioContext;if(e.webAudio.audioContext instanceof i){var r=e.webAudio;r.scale!==e.zoomLevels[0]&&(r.scale=e.zoomLevels[0]);var a=n._peaks.options.mediaElement.currentSrc;a?n._requestAudioAndBuildWaveformData(a,r,e.withCredentials,t):n._peaks.once("player.canplay",function(){n._requestAudioAndBuildWaveformData(n._peaks.options.mediaElement.currentSrc,r,e.withCredentials,t)})}else t(new TypeError("Peaks.init(): The webAudio.audioContext option must be a valid AudioContext"))},Pe.prototype._buildWaveformDataFromAudioBuffer=function(e,t){var n=e.webAudio;n.scale!==e.zoomLevels[0]&&(n.scale=e.zoomLevels[0]);var i={audio_buffer:n.audioBuffer,split_channels:n.multiChannel,scale:n.scale,disable_worker:!0};l.A.createFromAudio(i,t)},Pe.prototype._requestAudioAndBuildWaveformData=function(e,t,n,i){var r=this;e?(r._xhr=r._createXHR(e,"arraybuffer",n,function(e){if(4===this.readyState)if(200===this.status||206===this.status&&Le(this)){r._xhr=null;var n={audio_context:t.audioContext,array_buffer:e.target.response,split_channels:t.multiChannel,scale:t.scale};l.A.createFromAudio(n,i)}else i(new Error("Unable to fetch remote data. HTTP status "+this.status))},function(){i(new Error("XHR failed"))},function(){i(new Error("XHR aborted"))}),r._xhr.send()):r._peaks._logger("Peaks.init(): The mediaElement src is invalid")},Pe.prototype.abort=function(){this._xhr&&this._xhr.abort()},Pe.prototype._createXHR=function(e,t,n,i,r,a){var o=new XMLHttpRequest;if(o.open("GET",e,!0),Me)try{o.responseType=t}catch(e){}return o.onload=i,o.onerror=r,Me&&n&&(o.withCredentials=!0),o.addEventListener("abort",a),o},De.prototype=Object.create(d.prototype);var Re={playheadColor:"#111111",playheadTextColor:"#aaaaaa",playheadBackgroundColor:"transparent",playheadPadding:2,playheadWidth:1,axisGridlineColor:"#cccccc",showAxisLabels:!0,axisTopMarkerHeight:10,axisBottomMarkerHeight:10,axisLabelColor:"#aaaaaa",fontFamily:"sans-serif",fontSize:11,fontStyle:"normal",timeLabelPrecision:2,enablePoints:!0,enableSegments:!0},Ne={playheadClickTolerance:3,waveformColor:"rgba(0, 225, 128, 1)",wheelMode:"none",autoScroll:!0,autoScrollOffset:100,enableEditing:!0},Oe={waveformColor:"rgba(0, 0, 0, 0.2)",highlightColor:"#aaaaaa",highlightStrokeColor:"transparent",highlightOpacity:.3,highlightOffset:11,highlightCornerRadius:2,enableEditing:!1},Ue={overlay:!1,markers:!0,startMarkerColor:"#aaaaaa",endMarkerColor:"#aaaaaa",waveformColor:"#0074d9",overlayColor:"#ff0000",overlayOpacity:.3,overlayBorderColor:"#ff0000",overlayBorderWidth:2,overlayCornerRadius:5,overlayOffset:25,overlayLabelAlign:"left",overlayLabelVerticalAlign:"top",overlayLabelPadding:8,overlayLabelColor:"#000000",overlayFontFamily:"sans-serif",overlayFontSize:12,overlayFontStyle:"normal"},Be={color:"#888888",minWidth:50};function Fe(e,t){for(var n in t)y(t,n)&&y(e,n)&&(e[n]=t[n]);return e}function je(e){var t=e.zoomview.container,n=e.overview.container;return x(t)||x(n)?t&&(t.clientWidth<=0||t.clientHeight<=0)?new Error("Peaks.init(): The zoomview container must be visible and have non-zero width and height"):n&&(n.clientWidth<=0||n.clientHeight<=0)?new Error("Peaks.init(): The overview container must be visible and have non-zero width and height"):void 0:new TypeError("Peaks.init(): The zoomview and/or overview container options must be valid HTML elements")}De.init=function(e,t){var n=new De,i=n._setOptions(e);if(i||(i=je(n.options)),!i){var r=null;if(n.options.scrollbar){if(!x(r=n.options.scrollbar.container))return void t(new TypeError("Peaks.init(): The scrollbar container option must be a valid HTML element"));if(r.clientWidth<=0)return void t(new TypeError("Peaks.init(): The scrollbar container must be visible and have non-zero width"))}e.keyboard&&(n._keyboardHandler=new J(n));var a=e.player?e.player:new Q(n.options.mediaElement);return n.player=new ee(n,a),n.segments=new Y(n),n.points=new V(n),n.zoom=new Ie(n,n.options.zoomLevels),n.views=new ke(n),n._waveformBuilder=new Pe(n),n.player.init(n).then(function(){n._waveformBuilder.init(n.options,function(i,a){if(i)t&&t(i);else if(i=je(n.options))t&&t(i);else{n._waveformBuilder=null,n._waveformData=a;var o=n.options.zoomview.container,s=n.options.overview.container;s&&n.views.createOverview(s),o&&n.views.createZoomview(o),r&&n.views.createScrollbar(r),e.segments&&n.segments.add(e.segments),e.points&&n.points.add(e.points),e.emitCueEvents&&(n._cueEmitter=new O(n)),setTimeout(function(){n.emit("peaks.ready")},0),t(null,n)}})}).catch(function(e){t&&t(e)}),n}t(i)},De.prototype._setOptions=function(e){if(!S(e))return new TypeError("Peaks.init(): The options parameter should be an object");if(!e.player){if(!e.mediaElement)return new Error("Peaks.init(): Missing mediaElement option");if(!(e.mediaElement instanceof HTMLMediaElement))return new TypeError("Peaks.init(): The mediaElement option should be an HTMLMediaElement")}return e.logger&&"function"!=typeof e.logger?new TypeError("Peaks.init(): The logger option should be a function"):e.segments&&!Array.isArray(e.segments)?new TypeError("Peaks.init(): options.segments must be an array of segment objects"):e.points&&!Array.isArray(e.points)?new TypeError("Peaks.init(): options.points must be an array of point objects"):(Fe(this.options,e),this.options.overview=function(e){var t={};return e.overview&&e.overview.showPlayheadTime&&(t.showPlayheadTime=e.overview.showPlayheadTime),["container","waveformColor","playedWaveformColor","playheadColor","playheadTextColor","playheadBackgroundColor","playheadPadding","playheadWidth","formatPlayheadTime","timeLabelPrecision","axisGridlineColor","showAxisLabels","axisTopMarkerHeight","axisBottomMarkerHeight","axisLabelColor","formatAxisTime","fontFamily","fontSize","fontStyle","highlightColor","highlightStrokeColor","highlightOpacity","highlightCornerRadius","highlightOffset","enablePoints","enableSegments","enableEditing"].forEach(function(n){e.overview&&y(e.overview,n)?t[n]=e.overview[n]:y(e,n)?t[n]=e[n]:y(t,n)||(y(Oe,n)?t[n]=Oe[n]:y(Re,n)&&(t[n]=Re[n]))}),t}(e),this.options.zoomview=function(e){var t={};return e.showPlayheadTime?t.showPlayheadTime=e.showPlayheadTime:e.zoomview&&e.zoomview.showPlayheadTime&&(t.showPlayheadTime=e.zoomview.showPlayheadTime),["container","waveformColor","playedWaveformColor","playheadColor","playheadTextColor","playheadBackgroundColor","playheadPadding","playheadWidth","formatPlayheadTime","playheadClickTolerance","timeLabelPrecision","axisGridlineColor","showAxisLabels","axisTopMarkerHeight","axisBottomMarkerHeight","axisLabelColor","formatAxisTime","fontFamily","fontSize","fontStyle","wheelMode","autoScroll","autoScrollOffset","enablePoints","enableSegments","enableEditing"].forEach(function(n){e.zoomview&&y(e.zoomview,n)?t[n]=e.zoomview[n]:y(e,n)?t[n]=e[n]:y(t,n)||(y(Ne,n)?t[n]=Ne[n]:y(Re,n)&&(t[n]=Re[n]))}),t}(e),this.options.scrollbar=function(e){if(!y(e,"scrollbar"))return null;var t={};return["container","color","minWidth"].forEach(function(n){y(e.scrollbar,n)?t[n]=e.scrollbar[n]:t[n]=Be[n]}),t}(e),function(e,t){e.segmentOptions={},b(e.segmentOptions,Ue),t.segmentOptions&&Fe(e.segmentOptions,t.segmentOptions),e.zoomview.segmentOptions={},b(e.zoomview.segmentOptions,e.segmentOptions),t.zoomview&&t.zoomview.segmentOptions&&Fe(e.zoomview.segmentOptions,t.zoomview.segmentOptions),e.overview.segmentOptions={},b(e.overview.segmentOptions,e.segmentOptions),t.overview&&t.overview.segmentOptions&&Fe(e.overview.segmentOptions,t.overview.segmentOptions)}(this.options,e),Array.isArray(this.options.zoomLevels)?0===this.options.zoomLevels.length?new Error("Peaks.init(): The zoomLevels array must not be empty"):function(e){if(0===e.length)return!0;for(var t=e[0],n=1;n=e[n])return!1;t=e[n]}return!0}(this.options.zoomLevels)?void(this._logger=this.options.logger):new Error("Peaks.init(): The zoomLevels array must be sorted in ascending order"):new TypeError("Peaks.init(): The zoomLevels option should be an array"))},De.prototype.setSource=function(e,t){var n=this;n.player._setSource(e).then(function(){e.zoomLevels||(e.zoomLevels=n.options.zoomLevels),n._waveformBuilder=new Pe(n),n._waveformBuilder.init(e,function(i,r){i?t(i):(n._waveformBuilder=null,n._waveformData=r,["overview","zoomview"].forEach(function(e){var t=n.views.getView(e);t&&t.setWaveformData(r)}),n.zoom.setZoomLevels(e.zoomLevels),t())})}).catch(function(e){t(e)})},De.prototype.getWaveformData=function(){return this._waveformData},De.prototype.destroy=function(){this._waveformBuilder&&this._waveformBuilder.abort(),this._keyboardHandler&&this._keyboardHandler.destroy(),this.views&&this.views.destroy(),this.player&&this.player.destroy(),this._cueEmitter&&this._cueEmitter.destroy()}},8604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HitCanvas=t.SceneCanvas=t.Canvas=void 0;const i=n(4060),r=n(9869),a=n(8871);let o;class s{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||a.Konva.pixelRatio||function(){if(o)return o;const e=i.Util.createCanvasElement(),t=e.getContext("2d");return o=(a.Konva._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),i.Util.releaseCanvas(e),o}();this.pixelRatio=t,this._canvas=i.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return i.Util.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}t.Canvas=s,t.SceneCanvas=class extends s{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new r.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},t.HitCanvas=class extends s{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new r.HitContext(this),this.setSize(e.width,e.height)}}},8665:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const i=n(4060),r=n(9696),a=n(6536),o=n(8871),s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},u=["fill","stroke","shadowColor"];let l=0;class h{constructor(e,t,n,i,r,a,o){this.prop=e,this.propFunc=t,this.begin=i,this._pos=i,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=o,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=r-this.begin,this.pause()}fire(e){const t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class c{constructor(e){const n=this,a=e.node,u=a._id,d=e.easing||t.Easings.Linear,p=!!e.yoyo;let f,g;f=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=a,this._id=l++;const m=a.getLayer()||(a instanceof o.Konva.Stage?a.getLayers():null);for(g in m||i.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new r.Animation(function(){n.tween.onEnterFrame()},m),this.tween=new h(g,function(e){n._tweenFunc(e)},d,0,1,1e3*f,p),this._addListeners(),c.attrs[u]||(c.attrs[u]={}),c.attrs[u][this._id]||(c.attrs[u][this._id]={}),c.tweens[u]||(c.tweens[u]={}),e)void 0===s[g]&&this._addAttr(g,e[g]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){const n=this.node,r=n._id;let a,o,s,l,h;const d=c.tweens[r][e];d&&delete c.attrs[r][d][e];let p=n.getAttr(e);if(i.Util._isArray(t))if(a=[],o=Math.max(t.length,p.length),"points"===e&&t.length!==p.length&&(t.length>p.length?(l=p,p=i.Util._prepareArrayForTween(p,t,n.closed())):(s=t,t=i.Util._prepareArrayForTween(t,p,n.closed()))),0===e.indexOf("fill"))for(let e=0;e{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const e=this.node,t=c.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const e=this.node,t=c.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const e=this.node._id,t=this._id,n=c.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const t in n)delete c.tweens[e][t];delete c.attrs[e][t],c.tweens[e]&&(0===Object.keys(c.tweens[e]).length&&delete c.tweens[e],0===Object.keys(c.attrs[e]).length&&delete c.attrs[e])}}t.Tween=c,c.attrs={},c.tweens={},a.Node.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new c(e).play()},t.Easings={BackEaseIn(e,t,n,i){const r=1.70158;return n*(e/=i)*e*((r+1)*e-r)+t},BackEaseOut(e,t,n,i){const r=1.70158;return n*((e=e/i-1)*e*((r+1)*e+r)+1)+t},BackEaseInOut(e,t,n,i){let r=1.70158;return(e/=i/2)<1?n/2*(e*e*((1+(r*=1.525))*e-r))+t:n/2*((e-=2)*e*((1+(r*=1.525))*e+r)+2)+t},ElasticEaseIn(e,t,n,i,r,a){let o=0;return 0===e?t:1===(e/=i)?t+n:(a||(a=.3*i),!r||r(e/=i)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,n,i,r)=>i-t.Easings.BounceEaseOut(r-e,0,i,r)+n,BounceEaseInOut:(e,n,i,r)=>en*(e/=i)*e+t,EaseOut:(e,t,n,i)=>-n*(e/=i)*(e-2)+t,EaseInOut:(e,t,n,i)=>(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,i)=>n*(e/=i)*e*e*e*e+t,StrongEaseOut:(e,t,n,i)=>n*((e=e/i-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,i)=>(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,i)=>n*e/i+t}},8722:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCapturedShape=function(e){return r.get(e)},t.createEvent=o,t.hasPointerCapture=function(e,t){return r.get(e)===t},t.setPointerCapture=function(e,t){s(e),t.getStage()&&(r.set(e,t),a&&t._fire("gotpointercapture",o(new PointerEvent("gotpointercapture"))))},t.releaseCapture=s;const i=n(8871),r=new Map,a=void 0!==i.Konva._global.PointerEvent;function o(e){return{evt:e,pointerId:e.pointerId}}function s(e,t){const n=r.get(e);if(!n)return;const i=n.getStage();i&&i.content,r.delete(e),a&&n._fire("lostpointercapture",o(new PointerEvent("lostpointercapture")))}},8820:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,n,i){const r=e*this.size+t;this.data[r]=n,i&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},8871:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const i=Math.PI/180;t.glob=void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>t.Konva.angleDeg?e*i:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>t.Konva.DD.isDragging,isTransforming(){var e;return null===(e=t.Konva.Transformer)||void 0===e?void 0:e.isTransforming()},isDragReady:()=>!!t.Konva.DD.node,releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(e){t.glob.Konva=e}},t._registerNode=e=>{t.Konva[e.prototype.getClassName()]=e},t.Konva._injectGlobal(t.Konva)},9696:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Animation=void 0;const i=n(8871),r=n(4060),a=i.glob.performance&&i.glob.performance.now?function(){return i.glob.performance.now()}:function(){return(new Date).getTime()};class o{constructor(e,t){this.id=o.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:a(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){const t=this.layers,n=t.length;for(let i=0;i{const i=n(208),r=n(4357),a=n(1433),o=n(5822),s=n(4861),u=n(7044),l=n(6886),h=n(6320);function c(e){return unescape(encodeURIComponent(e)).length}function d(e,t,n){const i=[];let r;for(;null!==(r=e.exec(n));)i.push({data:r[0],index:r.index,mode:t,length:r[0].length});return i}function p(e){const t=d(u.NUMERIC,i.NUMERIC,e),n=d(u.ALPHANUMERIC,i.ALPHANUMERIC,e);let r,a;return l.isKanjiModeEnabled()?(r=d(u.BYTE,i.BYTE,e),a=d(u.KANJI,i.KANJI,e)):(r=d(u.BYTE_KANJI,i.BYTE,e),a=[]),t.concat(n,r,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,t){switch(t){case i.NUMERIC:return r.getBitsLength(e);case i.ALPHANUMERIC:return a.getBitsLength(e);case i.KANJI:return s.getBitsLength(e);case i.BYTE:return o.getBitsLength(e)}}function g(e,t){let n;const u=i.getBestModeForData(e);if(n=i.from(t,u),n!==i.BYTE&&n.bit=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[]))},t.rawSplit=function(e){return t.fromArray(p(e,l.isKanjiModeEnabled()))}},9869:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HitContext=t.SceneContext=t.Context=void 0;const i=n(4060),r=n(8871),a=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class o{constructor(e){this.canvas=e,r.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n,r,a,o,s=this.traceArr,u=s.length,l="";for(n=0;n"number"==typeof e?Math.floor(e):e)),l+="("+o.join(",")+")")):(l+=r.property,e||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){let t,n=this.traceArr;n.push(e),t=n.length,t>=100&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,i,r,a){this._context.arc(e,t,n,i,r,a)}arcTo(e,t,n,i,r){this._context.arcTo(e,t,n,i,r)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,i,r,a){this._context.bezierCurveTo(e,t,n,i,r,a)}clearRect(e,t,n,i){this._context.clearRect(e,t,n,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,i){return this._context.createLinearGradient(e,t,n,i)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,i,r,a){return this._context.createRadialGradient(e,t,n,i,r,a)}drawImage(e,t,n,i,r,a,o,s,u){const l=arguments,h=this._context;3===l.length?h.drawImage(e,t,n):5===l.length?h.drawImage(e,t,n,i,r):9===l.length&&h.drawImage(e,t,n,i,r,a,o,s,u)}ellipse(e,t,n,i,r,a,o,s){this._context.ellipse(e,t,n,i,r,a,o,s)}isPointInPath(e,t,n,i){return n?this._context.isPointInPath(n,e,t,i):this._context.isPointInPath(e,t,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,i){this._context.fillRect(e,t,n,i)}strokeRect(e,t,n,i){this._context.strokeRect(e,t,n,i)}fillText(e,t,n,i){i?this._context.fillText(e,t,n,i):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,i){return this._context.getImageData(e,t,n,i)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,i){this._context.rect(e,t,n,i)}roundRect(e,t,n,i,r){this._context.roundRect(e,t,n,i,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,i){this._context.quadraticCurveTo(e,t,n,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,i,r,a){this._context.setTransform(e,t,n,i,r,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,i){this._context.strokeText(e,t,n,i)}transform(e,t,n,i,r,a){this._context.transform(e,t,n,i,r,a)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e,t,n=this,r=a.length,o=this.setAttr;const s=function(e){let r,a=n[e];n[e]=function(){return t=function(e){const t=[],n=e.length,r=i.Util;for(let i=0;i{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},9953:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return n}}}}]); +(self.webpackChunkkitodo_presentation=self.webpackChunkkitodo_presentation||[]).push([[951],{157:(e,t,n)=>{const i=n(6886),r=n(9953),a=n(9899),o=n(8820),s=n(6421),u=n(7756),l=n(1332),h=n(7518),c=n(4764),d=n(1427),p=n(4565),f=n(208),g=n(9801);function m(e,t,n){const i=e.size,r=p.getEncodedBits(t,n);let a,o;for(a=0;a<15;a++)o=1==(r>>a&1),a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(i-15+a,8,o,!0),a<8?e.set(8,i-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(i-8,8,1,!0)}function v(e,t,n,r){let p;if(Array.isArray(e))p=g.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let i=t;if(!i){const t=g.rawSplit(e);i=d.getBestVersionForData(t,n)}p=g.fromString(e,i||40)}}const v=d.getBestVersionForData(p,n);if(!v)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t=0&&t<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===t||6===t)||t>=2&&t<=4&&i>=2&&i<=4?e.set(r+t,a+i,!0,!0):e.set(r+t,a+i,!1,!0))}}(_,t),function(e){const t=e.size;for(let n=8;n=7&&function(e,t){const n=e.size,i=d.getEncodedBits(t);let r,a,o;for(let t=0;t<18;t++)r=Math.floor(t/3),a=t%3+n-8-3,o=1==(i>>t&1),e.set(r,a,o,!0),e.set(a,r,o,!0)}(_,t),function(e,t){const n=e.size;let i=-1,r=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(r,s-n)){let i=!1;o>>a&1)),e.set(r,s-n,i),a--,-1===a&&(o++,a=7)}if(r+=i,r<0||n<=r){r-=i,i=-i;break}}}(_,y),isNaN(r)&&(r=l.getBestMask(_,m.bind(null,_,n))),l.applyMask(r,_),m(_,n,r),{modules:_,version:t,errorCorrectionLevel:n,maskPattern:r,segments:p}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,a,o=r.M;return void 0!==t&&(o=r.from(t.errorCorrectionLevel,r.M),n=d.from(t.version),a=l.from(t.maskPattern),t.toSJISFunc&&i.setToSJISFunction(t.toSJISFunc)),v(e,n,o,a)}},208:(e,t,n)=>{const i=n(1878),r=n(7044);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!i.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return r.testNumeric(e)?t.NUMERIC:r.testAlphanumeric(e)?t.ALPHANUMERIC:r.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},317:(e,t,n)=>{"use strict";function i(e,t){this._waveformData=e,this._channelIndex=t}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e){return null==e}function o(e,t,n){var i;return function(r){return i=i||function(e,t,n){var i=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var i=new Uint8Array(n.length),r=0,a=n.length;ru}),i.prototype.min_sample=function(e){var t=2*(e*this._waveformData.channels+this._channelIndex);return this._waveformData._at(t)},i.prototype.max_sample=function(e){var t=2*(e*this._waveformData.channels+this._channelIndex)+1;return this._waveformData._at(t)},i.prototype.set_min_sample=function(e,t){var n=2*(e*this._waveformData.channels+this._channelIndex);return this._waveformData._set_at(n,t)},i.prototype.set_max_sample=function(e,t){var n=2*(e*this._waveformData.channels+this._channelIndex)+1;return this._waveformData._set_at(n,t)},i.prototype.min_array=function(){for(var e=this._waveformData.length,t=[],n=0;n0&&n++,n}(r,t),l=8===e.bits?1:2,h=new ArrayBuffer(24+2*u*l*s),c=new DataView(h),d=0,p=24,f=new Array(s),g=new Array(s),m=0;mg[0]&&(g[0]=_,g[0]>y&&(g[0]=y))}else for(var S=0;Sg[S]&&(g[S]=_,g[S]>y&&(g[S]=y));if(++d===t){for(var T=0;T0)for(var A=0;A0?(this._min[o]=this._inputData.channel(o).min_sample(this._input_index),this._max[o]=this._inputData.channel(o).max_sample(this._input_index)):(this._min[o]=0,this._max[o]=0);this._min_value=8===this._inputData.bits?-128:-32768,this._max_value=8===this._inputData.bits?127:32767,this._where=0,this._prev_where=0,this._stop=0,this._last_input_index=0}u.create=function(e){return new u(e)},u.createFromAudio=function(e,t){var n=function(e){return{scale:e.scale||512,bits:e.bits||8,amplitude_scale:e.amplitude_scale||1,split_channels:e.split_channels||false,disable_worker:e.disable_worker||false}}(e);if(e.audio_context&&e.array_buffer)return function(e,t,n,i){function r(e){e||(e=new DOMException("EncodingError")),i(e),i=function(){}}var a=e.decodeAudioData(t,function(e){l(e,n,i)},r);a&&a.catch(r)}(e.audio_context,e.array_buffer,n,t);if(e.audio_buffer)return l(e.audio_buffer,n,t);throw new TypeError("WaveformData.createFromAudio(): Pass either an AudioContext and ArrayBuffer, or an AudioBuffer object")},h.prototype.sample_at_pixel=function(e){return Math.floor(e*this._output_samples_per_pixel)},h.prototype.next=function(){for(var e,t=0,n=this._inputData.channels;this._input_index0)for(var i=0;ithis._input_buffer_size&&(this._stop=this._input_buffer_size);this._input_indexthis._max[a]&&(this._max[a]=o)}this._input_index++}t++}if(this._input_indexthis.length&&(t=this.length),n>this.length&&(n=this.length),t>n&&(t=n);var i=n-t,r=8===this.bits?1:2,o=24+2*i*this.channels*r,s=new ArrayBuffer(o),l=new DataView(s);l.setInt32(0,2,!0),l.setUint32(4,8===this.bits,!0),l.setInt32(8,this.sample_rate,!0),l.setInt32(12,this.scale,!0),l.setInt32(16,i,!0),l.setInt32(20,this.channels,!0);for(var h=0;h=0&&e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var i=n(680);Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return i.Konva}});const r=n(680);e.exports=r.Konva},680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const i=n(8871),r=n(4060),a=n(6536),o=n(4473),s=n(7324),u=n(6267),l=n(7457),h=n(7949),c=n(1268),d=n(4723),p=n(9696),f=n(8665),g=n(9869),m=n(8604);t.Konva=r.Util._assign(i.Konva,{Util:r.Util,Transform:r.Transform,Node:a.Node,Container:o.Container,Stage:s.Stage,stages:s.stages,Layer:u.Layer,FastLayer:l.FastLayer,Group:h.Group,DD:c.DD,Shape:d.Shape,shapes:d.shapes,Animation:p.Animation,Tween:f.Tween,Easings:f.Easings,Context:g.Context,Canvas:m.Canvas}),t.default=t.Konva},1268:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const i=n(8871),r=n(4060);t.DD={get isDragging(){let e=!1;return t.DD._dragElements.forEach(t=>{"dragging"===t.dragStatus&&(e=!0)}),e},justDragged:!1,get node(){let e;return t.DD._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const n=[];t.DD._dragElements.forEach((t,i)=>{const{node:a}=t,o=a.getStage();o.setPointersPositions(e),void 0===t.pointerId&&(t.pointerId=r.Util._getFirstPointerId(e));const s=o._changedPointerPositions.find(e=>e.id===t.pointerId);if(s){if("dragging"!==t.dragStatus){const n=a.dragDistance();if(Math.max(Math.abs(s.x-t.startPointerPos.x),Math.abs(s.y-t.startPointerPos.y)){t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)})},_endDragBefore(e){const n=[];t.DD._dragElements.forEach(r=>{const{node:a}=r,o=a.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(e=>e.id===r.pointerId))return;"dragging"!==r.dragStatus&&"stopped"!==r.dragStatus||(t.DD.justDragged=!0,i.Konva._mouseListenClick=!1,i.Konva._touchListenClick=!1,i.Konva._pointerListenClick=!1,r.dragStatus="stopped");const s=r.node.getLayer()||r.node instanceof i.Konva.Stage&&r.node;s&&-1===n.indexOf(s)&&n.push(s)}),n.forEach(e=>{e.draw()})},_endDragAfter(e){t.DD._dragElements.forEach((n,i)=>{"stopped"===n.dragStatus&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0),"dragging"!==n.dragStatus&&t.DD._dragElements.delete(i)})}},i.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))},1332:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(e,n,i){switch(e){case t.Patterns.PATTERN000:return(n+i)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return i%3==0;case t.Patterns.PATTERN011:return(n+i)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(i/3))%2==0;case t.Patterns.PATTERN101:return n*i%2+n*i%3==0;case t.Patterns.PATTERN110:return(n*i%2+n*i%3)%2==0;case t.Patterns.PATTERN111:return(n*i%3+(n+i)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let n=0,i=0,r=0,a=null,o=null;for(let s=0;s=5&&(n+=i-5+3),a=t,i=1),t=e.get(u,s),t===o?r++:(r>=5&&(n+=r-5+3),o=t,r=1)}i>=5&&(n+=i-5+3),r>=5&&(n+=r-5+3)}return n},t.getPenaltyN2=function(e){const t=e.size;let n=0;for(let i=0;i=10&&(1488===i||93===i)&&n++,r=r<<1&2047|e.get(o,a),o>=10&&(1488===r||93===r)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let i=0;i{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1427:(e,t,n)=>{const i=n(6886),r=n(7518),a=n(9953),o=n(208),s=n(1878),u=i.getBCHDigit(7973);function l(e,t){return o.getCharCountIndicator(e,t)+4}function h(e,t){let n=0;return e.forEach(function(e){const i=l(e.mode,t);n+=i+e.getBitsLength()}),n}t.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!s.isValid(e))throw new Error("Invalid QR Code version");void 0===n&&(n=o.BYTE);const a=8*(i.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,t));if(n===o.MIXED)return a;const u=a-l(n,e);switch(n){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},t.getBestVersionForData=function(e,n){let i;const r=a.from(n,a.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let i=1;i<=40;i++)if(h(e,i)<=t.getCapacity(i,n,o.MIXED))return i}(e,r);if(0===e.length)return 1;i=e[0]}else i=e;return function(e,n,i){for(let r=1;r<=40;r++)if(n<=t.getCapacity(r,i,e))return r}(i.mode,i.getLength(),r)},t.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;i.getBCHDigit(t)-u>=0;)t^=7973<{const i=n(208),r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(e){this.mode=i.ALPHANUMERIC,this.data=e}a.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*r.indexOf(this.data[t]);n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},e.exports=a},1878:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},1958:(e,t,n)=>{"use strict";t.EY=void 0;const i=n(4060),r=n(4892),a=n(4723),o=n(8871),s=n(5483),u=n(8871);function l(e){return[...e].reduce((e,t,n,i)=>{if(/\p{Emoji}/u.test(t)){const r=i[n+1];r&&/\p{Emoji_Modifier}|\u200D/u.test(r)?(e.push(t+r),i[n+1]=""):e.push(t)}else/\p{Regional_Indicator}{2}/u.test(t+(i[n+1]||""))?e.push(t+i[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(t)?e[e.length-1]+=t:t&&e.push(t);return e},[])}const h="auto",c="inherit",d="justify",p="left",f="middle",g="normal",m=" ",v="none",y=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],b=y.length;let _;function w(){return _||(_=i.Util.createCanvasElement().getContext("2d"),_)}class S extends a.Shape{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(let e=0;e1&&(T+=s)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=i.Util._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===h||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===h||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return i.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,i,r,a,o,s,u,l,h,c;let d,p=w(),f=this.fontSize();p.save(),p.font=this._getContextFont(),d=p.measureText(e),p.restore();const g=f/100;return{actualBoundingBoxAscent:null!==(t=d.actualBoundingBoxAscent)&&void 0!==t?t:71.58203125*g,actualBoundingBoxDescent:null!==(n=d.actualBoundingBoxDescent)&&void 0!==n?n:0,actualBoundingBoxLeft:null!==(i=d.actualBoundingBoxLeft)&&void 0!==i?i:-7.421875*g,actualBoundingBoxRight:null!==(r=d.actualBoundingBoxRight)&&void 0!==r?r:75.732421875*g,alphabeticBaseline:null!==(a=d.alphabeticBaseline)&&void 0!==a?a:0,emHeightAscent:null!==(o=d.emHeightAscent)&&void 0!==o?o:100*g,emHeightDescent:null!==(s=d.emHeightDescent)&&void 0!==s?s:-20*g,fontBoundingBoxAscent:null!==(u=d.fontBoundingBoxAscent)&&void 0!==u?u:91*g,fontBoundingBoxDescent:null!==(l=d.fontBoundingBoxDescent)&&void 0!==l?l:21*g,hangingBaseline:null!==(h=d.hangingBaseline)&&void 0!==h?h:72.80000305175781*g,ideographicBaseline:null!==(c=d.ideographicBaseline)&&void 0!==c?c:-21*g,width:d.width,height:f}}_getContextFont(){return this.fontStyle()+m+this.fontVariant()+m+(this.fontSize()+"px ")+this.fontFamily().split(",").map(e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e}).join(", ")}_addTextLine(e){this.align()===d&&(e=e.trim());const t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){const t=this.letterSpacing(),n=e.length;return w().measureText(e).width+t*n}_setTextData(){let e=this.text().split("\n"),t=+this.fontSize(),n=0,i=this.lineHeight()*t,r=this.attrs.width,a=this.attrs.height,o=r!==h&&void 0!==r,s=a!==h&&void 0!==a,u=this.padding(),c=r-2*u,d=a-2*u,p=0,f=this.wrap(),g="char"!==f&&f!==v,y=this.ellipsis();this.textArr=[],w().font=this._getContextFont();const b=y?this._getTextWidth("…"):0;for(let t=0,r=e.length;tc)for(;a.length>0;){let e=0,t=l(a).length,r="",o=0;for(;e>>1,u=l(a).slice(0,n+1).join(""),h=this._getTextWidth(u);(y&&s&&p+i>d?h+b:h)<=c?(e=n+1,r=u,o=h):t=n}if(!r)break;if(g){const t=l(a),n=l(r),i=t[n.length];let s;if((i===m||"-"===i)&&o<=c)s=n.length;else{const e=n.lastIndexOf(m),t=n.lastIndexOf("-");s=Math.max(e,t)+1}s>0&&(e=s,r=t.slice(0,e).join(""),o=this._getTextWidth(r))}if(r=r.trimRight(),this._addTextLine(r),n=Math.max(n,o),p+=i,this._shouldHandleEllipsis(p)){this._tryToAddEllipsisToLastLine();break}if(a=l(a).slice(e).join("").trimLeft(),a.length>0&&(u=this._getTextWidth(a),u<=c)){this._addTextLine(a),p+=i,n=Math.max(n,u);break}}else this._addTextLine(a),p+=i,n=Math.max(n,u),this._shouldHandleEllipsis(p)&&td)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,i=this.attrs.height,r=i!==h&&void 0!==i,a=i-2*this.padding();return!(this.wrap()!==v)||r&&e+n>a}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==h&&void 0!==e,n=e-2*this.padding(),i=this.ellipsis(),r=this.textArr[this.textArr.length-1];r&&i&&(t&&(this._getTextWidth(r.text+"…"){"use strict";n.d(t,{Ay:()=>Pe});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n1)throw new RangeError("integer-width stems only accept a single optional option");r.options[0].replace(B,function(e,n,i,r,a,o){if(n)t.minimumIntegerDigits=i.length;else{if(r&&a)throw new Error("We currently do not support maximum integer digits");if(o)throw new Error("We currently do not support exact integer digits")}return""});continue}if(F.test(r.stem))t.minimumIntegerDigits=r.stem.length;else if(O.test(r.stem)){if(r.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");r.stem.replace(O,function(e,n,i,r,a,o){return"*"===i?t.minimumFractionDigits=n.length:r&&"#"===r[0]?t.maximumFractionDigits=r.length:a&&o?(t.minimumFractionDigits=a.length,t.maximumFractionDigits=a.length+o.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),""});var o=r.options[0];"w"===o?t=a(a({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=a(a({},t),j(o)))}else if(U.test(r.stem))t=a(a({},t),j(r.stem));else{var s=G(r.stem);s&&(t=a(a({},t),s));var u=H(r.stem);u&&(t=a(a({},t),u))}}return t}var z,K={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function X(e){var t=e.hourCycle;if(void 0===t&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n,i=e.language;return"root"!==i&&(n=e.maximize().region),(K[n||""]||K[i||""]||K["".concat(i,"-001")]||K["001"])[0]}var Y=new RegExp("^".concat(P.source,"*")),q=new RegExp("".concat(P.source,"*$"));function Z(e,t){return{start:e,end:t}}var J=!!String.prototype.startsWith&&"_a".startsWith("a",1),Q=!!String.fromCodePoint,$=!!Object.fromEntries,ee=!!String.prototype.codePointAt,te=!!String.prototype.trimStart,ne=!!String.prototype.trimEnd,ie=Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},re=!0;try{re="a"===(null===(z=de("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu").exec("a"))||void 0===z?void 0:z[0])}catch(e){re=!1}var ae,oe=J?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},se=Q?String.fromCodePoint:function(){for(var e=[],t=0;ta;){if((n=e[a++])>1114111)throw RangeError(n+" is not a valid code point");i+=n<65536?String.fromCharCode(n):String.fromCharCode(55296+((n-=65536)>>10),n%1024+56320)}return i},ue=$?Object.fromEntries:function(e){for(var t={},n=0,i=e;n=n)){var i,r=e.charCodeAt(t);return r<55296||r>56319||t+1===n||(i=e.charCodeAt(t+1))<56320||i>57343?r:i-56320+(r-55296<<10)+65536}},he=te?function(e){return e.trimStart()}:function(e){return e.replace(Y,"")},ce=ne?function(e){return e.trimEnd()}:function(e){return e.replace(q,"")};function de(e,t){return new RegExp(e,t)}if(re){var pe=de("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");ae=function(e,t){var n;return pe.lastIndex=t,null!==(n=pe.exec(e)[1])&&void 0!==n?n:""}}else ae=function(e,t){for(var n=[];;){var i=le(e,t);if(void 0===i||ye(i)||be(i))break;n.push(i),t+=i>=65536?2:1}return se.apply(void 0,n)};var fe,ge=function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,n){for(var i=[];!this.isEOF();){var r=this.char();if(123===r){if((a=this.parseArgument(e,n)).err)return a;i.push(a.val)}else{if(125===r&&e>0)break;if(35!==r||"plural"!==t&&"selectordinal"!==t){if(60===r&&!this.ignoreTag&&47===this.peek()){if(n)break;return this.error(d.UNMATCHED_CLOSING_TAG,Z(this.clonePosition(),this.clonePosition()))}if(60===r&&!this.ignoreTag&&me(this.peek()||0)){if((a=this.parseTag(e,t)).err)return a;i.push(a.val)}else{var a;if((a=this.parseLiteral(e,t)).err)return a;i.push(a.val)}}else{var o=this.clonePosition();this.bump(),i.push({type:p.pound,location:Z(o,this.clonePosition())})}}}return{val:i,err:null}},e.prototype.parseTag=function(e,t){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:p.literal,value:"<".concat(i,"/>"),location:Z(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var r=this.parseMessage(e+1,t,!0);if(r.err)return r;var a=r.val,o=this.clonePosition();if(this.bumpIf("")?{val:{type:p.tag,value:i,children:a,location:Z(n,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,Z(o,this.clonePosition())))}return this.error(d.UNCLOSED_TAG,Z(n,this.clonePosition()))}return this.error(d.INVALID_TAG,Z(n,this.clonePosition()))},e.prototype.parseTagName=function(){var e=this.offset();for(this.bump();!this.isEOF()&&ve(this.char());)this.bump();return this.message.slice(e,this.offset())},e.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),i="";;){var r=this.tryParseQuote(t);if(r)i+=r;else{var a=this.tryParseUnquoted(e,t);if(a)i+=a;else{var o=this.tryParseLeftAngleBracket();if(!o)break;i+=o}}}var s=Z(n,this.clonePosition());return{val:{type:p.literal,value:i,location:s},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60!==this.char()||!this.ignoreTag&&(me(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e},e.prototype.tryParseQuote=function(e){if(this.isEOF()||39!==this.char())return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if("plural"===e||"selectordinal"===e)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(39===n){if(39!==this.peek()){this.bump();break}t.push(39),this.bump()}else t.push(n);this.bump()}return se.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return 60===n||123===n||35===n&&("plural"===t||"selectordinal"===t)||125===n&&e>0?null:(this.bump(),se(n))},e.prototype.parseArgument=function(e,t){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(n,this.clonePosition()));if(125===this.char())return this.bump(),this.error(d.EMPTY_ARGUMENT,Z(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(d.MALFORMED_ARGUMENT,Z(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:p.argument,value:i,location:Z(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(n,this.clonePosition())):this.parseArgumentOptions(e,t,i,n);default:return this.error(d.MALFORMED_ARGUMENT,Z(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=ae(this.message,t),i=t+n.length;return this.bumpTo(i),{value:n,location:Z(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,n,i){var r,o=this.clonePosition(),s=this.parseIdentifierIfPossible().value,u=this.clonePosition();switch(s){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,Z(o,u));case"number":case"date":case"time":this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var h=this.clonePosition();if((w=this.parseSimpleArgStyleIfPossible()).err)return w;if(0===(v=ce(w.val)).length)return this.error(d.EXPECT_ARGUMENT_STYLE,Z(this.clonePosition(),this.clonePosition()));l={style:v,styleLocation:Z(h,this.clonePosition())}}if((S=this.tryParseArgumentClose(i)).err)return S;var c=Z(i,this.clonePosition());if(l&&oe(null==l?void 0:l.style,"::",0)){var g=he(l.style.slice(2));if("number"===s)return(w=this.parseNumberSkeletonFromString(g,l.styleLocation)).err?w:{val:{type:p.number,value:n,location:c,style:w.val},err:null};if(0===g.length)return this.error(d.EXPECT_DATE_TIME_SKELETON,c);var m=g;this.locale&&(m=function(e,t){for(var n="",i=0;i>1),u=X(t);for("H"!=u&&"k"!=u||(s=0);s-- >0;)n+="a";for(;o-- >0;)n=u+n}else n+="J"===r?"H":r}return n}(g,this.locale));var v={type:f.dateTime,pattern:m,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?D(m):{}};return{val:{type:"date"===s?p.date:p.time,value:n,location:c,style:v},err:null}}return{val:{type:"number"===s?p.number:"date"===s?p.date:p.time,value:n,location:c,style:null!==(r=null==l?void 0:l.style)&&void 0!==r?r:null},err:null};case"plural":case"selectordinal":case"select":var y=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,Z(y,a({},y)));this.bumpSpace();var b=this.parseIdentifierIfPossible(),_=0;if("select"!==s&&"offset"===b.value){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Z(this.clonePosition(),this.clonePosition()));var w;if(this.bumpSpace(),(w=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return w;this.bumpSpace(),b=this.parseIdentifierIfPossible(),_=w.val}var S,T=this.tryParsePluralOrSelectOptions(e,s,t,b);if(T.err)return T;if((S=this.tryParseArgumentClose(i)).err)return S;var A=Z(i,this.clonePosition());return"select"===s?{val:{type:p.select,value:n,options:ue(T.val),location:A},err:null}:{val:{type:p.plural,value:n,options:ue(T.val),offset:_,pluralType:"plural"===s?"cardinal":"ordinal",location:A},err:null};default:return this.error(d.INVALID_ARGUMENT_TYPE,Z(o,u))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||125!==this.char()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,Z(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var n=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Z(n,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var n=[];try{n=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");for(var t=[],n=0,i=e.split(R).filter(function(e){return e.length>0});n=48&&o<=57))break;r=!0,a=10*a+(o-48),this.bump()}var s=Z(i,this.clonePosition());return r?ie(a*=n)?{val:a,err:null}:this.error(t,s):this.error(e,s)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var t=le(this.message,e);if(void 0===t)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();10===e?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(oe(this.message,e,this.offset())){for(var t=0;t=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&ye(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset(),n=this.message.charCodeAt(t+(e>=65536?2:1));return null!=n?n:null},e}();function me(e){return e>=97&&e<=122||e>=65&&e<=90}function ve(e){return 45===e||46===e||e>=48&&e<=57||95===e||e>=97&&e<=122||e>=65&&e<=90||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function ye(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}function be(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function _e(e){e.forEach(function(e){if(delete e.location,E(e)||x(e))for(var t in e.options)delete e.options[t].location,_e(e.options[t].value);else S(e)&&I(e.style)||(T(e)||A(e))&&M(e.style)?delete e.style.location:k(e)&&_e(e.children)})}function we(e,t){void 0===t&&(t={}),t=a({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new ge(e,t).parse();if(n.err){var i=SyntaxError(d[n.err.kind]);throw i.location=n.err.location,i.originalMessage=n.err.message,i}return(null==t?void 0:t.captureLocation)||_e(n.val),n.val}!function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"}(fe||(fe={}));var Se,Te=function(e){function t(t,n,i){var r=e.call(this,t)||this;return r.code=n,r.originalMessage=i,r}return r(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Ae=function(e){function t(t,n,i,r){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(n,'". Options are "').concat(Object.keys(i).join('", "'),'"'),fe.INVALID_VALUE,r)||this}return r(t,e),t}(Te),Ee=function(e){function t(t,n,i){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(n),fe.INVALID_VALUE,i)||this}return r(t,e),t}(Te),xe=function(e){function t(t,n){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(n,'"'),fe.MISSING_VALUE,n)||this}return r(t,e),t}(Te);function Ce(e){return"function"==typeof e}function ke(e,t,n,i,r,a,o){if(1===e.length&&_(e[0]))return[{type:Se.literal,value:e[0].value}];for(var s=[],u=0,l=e;u0?new Intl.Locale(t[0]):new Intl.Locale("string"==typeof e?e:e[0])}},e.__parse=we,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();const Pe=Me},2726:(e,t)=>{function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:i,scale:i?4:r,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){const i=t.getScale(e,n);return Math.floor((e+2*n.margin)*i)},t.qrToImageData=function(e,n,i){const r=n.modules.size,a=n.modules.data,o=t.getScale(r,i),s=Math.floor((r+2*i.margin)*o),u=i.margin*o,l=[i.color.light,i.color.dark];for(let t=0;t=u&&n>=u&&t{const n=new Uint8Array(512),i=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)n[t]=e,i[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)n[e]=n[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return i[e]},t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[i[e]+i[t]]}},3318:(e,t)=>{!function(){"use strict";var n={};function i(e){return c(">"+p("B",e.length),e)}function r(e){return c(">"+p("H",e.length),e)}function a(e){return c(">"+p("L",e.length),e)}function o(e,t,n){var o,s,u,l,h="",d="";if("Byte"==t)(o=e.length)<=4?d=i(e)+p("\0",4-o):(d=c(">L",[n]),h=i(e));else if("Short"==t)(o=e.length)<=2?d=r(e)+p("\0\0",2-o):(d=c(">L",[n]),h=r(e));else if("Long"==t)(o=e.length)<=1?d=a(e):(d=c(">L",[n]),h=a(e));else if("Ascii"==t)(o=(s=e+"\0").length)>4?(d=c(">L",[n]),h=s):d=s+p("\0",4-o);else if("Rational"==t){if("number"==typeof e[0])o=1,u=e[0],l=e[1],s=c(">L",[u])+c(">L",[l]);else{o=e.length,s="";for(var f=0;fL",[u])+c(">L",[l])}d=c(">L",[n]),h=s}else if("SRational"==t){if("number"==typeof e[0])o=1,u=e[0],l=e[1],s=c(">l",[u])+c(">l",[l]);else for(o=e.length,s="",f=0;fl",[u])+c(">l",[l]);d=c(">L",[n]),h=s}else"Undefined"==t&&((o=e.length)>4?(d=c(">L",[n]),h=e):d=e+p("\0",4-o));return[c(">L",[o]),d,h]}function s(e,t,n){var i,r=Object.keys(e).length,a=c(">H",[r]);i=["0th","1st"].indexOf(t)>-1?2+12*r+4:2+12*r;var s="",u="";for(var l in e)if("string"==typeof l&&(l=parseInt(l)),!("0th"==t&&[34665,34853].indexOf(l)>-1||"Exif"==t&&40965==l||"1st"==t&&[513,514].indexOf(l)>-1)){var h=e[l],d=c(">H",[l]),p=m[t][l].type,f=c(">H",[g[p]]);"number"==typeof h&&(h=[h]);var v=o(h,p,8+i+n+u.length);s+=d+f+v[0]+v[1],u+=v[2]}return[a+s,u]}function u(e){var t;if("ÿØ"==e.slice(0,2))t=function(e){for(var t,n=0;n-1)this.tiftag=e;else{if("Exif"!=e.slice(0,4))throw new Error("Given file is neither JPEG nor TIFF.");this.tiftag=e.slice(6)}}if(n.version="1.0.4",n.remove=function(e){var t=!1;if("ÿØ"==e.slice(0,2));else{if("data:image/jpeg;base64,"!=e.slice(0,23)&&"data:image/jpg;base64,"!=e.slice(0,22))throw new Error("Given data is not jpeg.");e=h(e.split(",")[1]),t=!0}var n=f(e).filter(function(e){return!("ÿá"==e.slice(0,2)&&"Exif\0\0"==e.slice(4,10))}).join("");return t&&(n="data:image/jpeg;base64,"+l(n)),n},n.insert=function(e,t){var n=!1;if("Exif\0\0"!=e.slice(0,6))throw new Error("Given data is not exif.");if("ÿØ"==t.slice(0,2));else{if("data:image/jpeg;base64,"!=t.slice(0,23)&&"data:image/jpg;base64,"!=t.slice(0,22))throw new Error("Given data is not jpeg.");t=h(t.split(",")[1]),n=!0}var i="ÿá"+c(">H",[e.length+2])+e,r=function(e,t){var n=!1,i=[];return e.forEach(function(r,a){"ÿá"==r.slice(0,2)&&"Exif\0\0"==r.slice(4,10)&&(n?i.unshift(a):(e[a]=t,n=!0))}),i.forEach(function(t){e.splice(t,1)}),!n&&t&&(e=[e[0],t].concat(e.slice(1))),e.join("")}(f(t),i);return n&&(r="data:image/jpeg;base64,"+l(r)),r},n.load=function(e){var t;if("string"!=typeof e)throw new Error("'load' gots invalid type argument.");if("ÿØ"==e.slice(0,2))t=e;else if("data:image/jpeg;base64,"==e.slice(0,23)||"data:image/jpg;base64,"==e.slice(0,22))t=h(e.split(",")[1]);else{if("Exif"!=e.slice(0,4))throw new Error("'load' gots invalid file data.");t=e.slice(6)}var n={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null},i=new u(t);if(null===i.tiftag)return n;"II"==i.tiftag.slice(0,2)?i.endian_mark="<":i.endian_mark=">";var r=d(i.endian_mark+"L",i.tiftag.slice(4,8))[0];n["0th"]=i.get_ifd(r,"0th");var a=n["0th"].first_ifd_pointer;if(delete n["0th"].first_ifd_pointer,34665 in n["0th"]&&(r=n["0th"][34665],n.Exif=i.get_ifd(r,"Exif")),34853 in n["0th"]&&(r=n["0th"][34853],n.GPS=i.get_ifd(r,"GPS")),40965 in n.Exif&&(r=n.Exif[40965],n.Interop=i.get_ifd(r,"Interop")),"\0\0\0\0"!=a&&(r=d(i.endian_mark+"L",a)[0],n["1st"]=i.get_ifd(r,"1st"),513 in n["1st"]&&514 in n["1st"])){var o=n["1st"][513]+n["1st"][514],s=i.tiftag.slice(n["1st"][513],o);n.thumbnail=s}return n},n.dump=function(e){var t,i,r,a,o,u,l=(t=e,JSON.parse(JSON.stringify(t))),h=!1,d=!1,p=!1,m=!1;i="0th"in l?l["0th"]:{},"Exif"in l&&Object.keys(l.Exif).length||"Interop"in l&&Object.keys(l.Interop).length?(i[34665]=1,h=!0,r=l.Exif,"Interop"in l&&Object.keys(l.Interop).length?(r[40965]=1,p=!0,a=l.Interop):Object.keys(r).indexOf(n.ExifIFD.InteroperabilityTag.toString())>-1&&delete r[40965]):Object.keys(i).indexOf(n.ImageIFD.ExifTag.toString())>-1&&delete i[34665],"GPS"in l&&Object.keys(l.GPS).length?(i[n.ImageIFD.GPSTag]=1,d=!0,o=l.GPS):Object.keys(i).indexOf(n.ImageIFD.GPSTag.toString())>-1&&delete i[n.ImageIFD.GPSTag],"1st"in l&&"thumbnail"in l&&null!=l.thumbnail&&(m=!0,l["1st"][513]=1,l["1st"][514]=1,u=l["1st"]);var v,y,b,_=s(i,"0th",0),w=_[0].length+12*h+12*d+4+_[1].length,S="",T=0,A="",E=0,x="",C=0,k="";if(h&&(T=(v=s(r,"Exif",w))[0].length+12*p+v[1].length),d&&(E=(A=s(o,"GPS",w+T).join("")).length),p&&(C=(x=s(a,"Interop",w+T+E).join("")).length),m&&(y=s(u,"1st",w+T+E+C),(b=function(e){for(var t=f(e);"ÿà"<=t[1].slice(0,2)&&t[1].slice(0,2)<="ÿï";)t=[t[0]].concat(t.slice(2));return t.join("")}(l.thumbnail)).length>64e3))throw new Error("Given thumbnail is too large. max 64kB");var I="",M="",P="",L="\0\0\0\0";if(h){var D=c(">L",[R=8+w]);I=c(">H",[34665])+c(">H",[g.Long])+c(">L",[1])+D}if(d&&(D=c(">L",[R=8+w+T]),M=c(">H",[34853])+c(">H",[g.Long])+c(">L",[1])+D),p&&(D=c(">L",[R=8+w+T+E]),P=c(">H",[40965])+c(">H",[g.Long])+c(">L",[1])+D),m){var R;L=c(">L",[R=8+w+T+E+C]);var N="\0\0\0\0"+c(">L",[R+y[0].length+24+4+y[1].length]),O="\0\0\0\0"+c(">L",[b.length]);k=y[0]+N+O+"\0\0\0\0"+y[1]+b}var U=_[0]+I+M+L+_[1];return h&&(S=v[0]+P+v[1]),"Exif\0\0MM\0*\0\0\0\b"+U+S+A+x+k},u.prototype={get_ifd:function(e,t){var n,i={},r=d(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],a=e+2;n=["0th","1st"].indexOf(t)>-1?"Image":t;for(var o=0;o4?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("B",r),this.tiftag.slice(t,t+r))):n=d(this.endian_mark+p("B",r),a.slice(0,r));else if(2==i)r>4?(t=d(this.endian_mark+"L",a)[0],n=this.tiftag.slice(t,t+r-1)):n=a.slice(0,r-1);else if(3==i)r>2?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("H",r),this.tiftag.slice(t,t+2*r))):n=d(this.endian_mark+p("H",r),a.slice(0,2*r));else if(4==i)r>1?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("L",r),this.tiftag.slice(t,t+4*r))):n=d(this.endian_mark+p("L",r),a);else if(5==i)if(t=d(this.endian_mark+"L",a)[0],r>1){n=[];for(var o=0;o4?(t=d(this.endian_mark+"L",a)[0],n=this.tiftag.slice(t,t+r)):n=a.slice(0,r);else if(9==i)r>1?(t=d(this.endian_mark+"L",a)[0],n=d(this.endian_mark+p("l",r),this.tiftag.slice(t,t+4*r))):n=d(this.endian_mark+p("l",r),a);else{if(10!=i)throw new Error("Exif might be wrong. Got incorrect value type to decode. type:"+i);if(t=d(this.endian_mark+"L",a)[0],r>1)for(n=[],o=0;o>2,a=(3&t)<<4|(n=e.charCodeAt(l++))>>4,o=(15&n)<<2|(i=e.charCodeAt(l++))>>6,s=63&i,isNaN(n)?o=s=64:isNaN(i)&&(s=64),u=u+h.charAt(r)+h.charAt(a)+h.charAt(o)+h.charAt(s);return u}),"undefined"!=typeof window&&"function"==typeof window.atob)var h=window.atob;function c(e,t){if(!(t instanceof Array))throw new Error("'pack' error. Got invalid type argument.");if(e.length-1!=t.length)throw new Error("'pack' error. "+(e.length-1)+" marks, "+t.length+" elements.");var n;if("<"==e[0])n=!0;else{if(">"!=e[0])throw new Error("");n=!1}for(var i="",r=1,a=null,o=null,s=null;o=e[r];){if("b"==o.toLowerCase()){if(a=t[r-1],"b"==o&&a<0&&(a+=256),a>255||a<0)throw new Error("'pack' error.");s=String.fromCharCode(a)}else if("H"==o){if((a=t[r-1])>65535||a<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(a%65536/256))+String.fromCharCode(a%256),n&&(s=s.split("").reverse().join(""))}else{if("l"!=o.toLowerCase())throw new Error("'pack' error.");if(a=t[r-1],"l"==o&&a<0&&(a+=4294967296),a>4294967295||a<0)throw new Error("'pack' error.");s=String.fromCharCode(Math.floor(a/16777216))+String.fromCharCode(Math.floor(a%16777216/65536))+String.fromCharCode(Math.floor(a%65536/256))+String.fromCharCode(a%256),n&&(s=s.split("").reverse().join(""))}i+=s,r+=1}return i}function d(e,t){if("string"!=typeof t)throw new Error("'unpack' error. Got invalid type argument.");for(var n,i=0,r=1;r"!=e[0])throw new Error("'unpack' error.");n=!1}for(var a=[],o=0,s=1,u=null,l=null,h=null,c="";l=e[s];){if("b"==l.toLowerCase())h=1,u=(c=t.slice(o,o+h)).charCodeAt(0),"b"==l&&u>=128&&(u-=256);else if("H"==l)h=2,c=t.slice(o,o+h),n&&(c=c.split("").reverse().join("")),u=256*c.charCodeAt(0)+c.charCodeAt(1);else{if("l"!=l.toLowerCase())throw new Error("'unpack' error. "+l);h=4,c=t.slice(o,o+h),n&&(c=c.split("").reverse().join("")),u=16777216*c.charCodeAt(0)+65536*c.charCodeAt(1)+256*c.charCodeAt(2)+c.charCodeAt(3),"l"==l&&u>=2147483648&&(u-=4294967296)}a.push(u),o+=h,s+=1}return a}function p(e,t){for(var n="",i=0;iH",e.slice(t+2,t+4))[0]+2;if(n.push(e.slice(t,i)),(t=i)>=e.length)throw new Error("Wrong JPEG data.")}return n}void 0===h&&(h=function(e){var t,n,i,r,a,o,s="",u=0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u>4,n=(15&r)<<4|(a=l.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(o=l.indexOf(e.charAt(u++))),s+=String.fromCharCode(t),64!=a&&(s+=String.fromCharCode(n)),64!=o&&(s+=String.fromCharCode(i));return s});var g={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10},m={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};m["0th"]=m.Image,m["1st"]=m.Image,n.TAGS=m,n.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041},n.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240},n.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31},n.InteropIFD={InteroperabilityIndex:1},n.GPSHelper={degToDmsRational:function(e){var t=Math.abs(e),n=t%1*60,i=n%1*60;return[[Math.floor(t),1],[Math.floor(n),1],[Math.round(100*i),100]]},dmsRationalToDeg:function(e,t){var n="S"===t||"W"===t?-1:1;return(e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600)*n}},e.exports&&(t=e.exports=n),t.piexif=n}()},3443:(e,t,n)=>{"use strict";t.N=void 0;const i=n(4892),r=n(8871),a=n(4723),o=n(5483);function s(e,t,n,i,r,a,o){const s=Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2)),u=Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2)),l=o*s/(s+u),h=o*u/(s+u);return[n-l*(r-e),i-l*(a-t),n+h*(r-e),i+h*(a-t)]}function u(e,t){const n=e.length,i=[];for(let r=2;r4){const i=this.getTensionPoints(),a=i.length;for(o=r?0:4,r||e.quadraticCurveTo(i[0],i[1],i[2],i[3]);o{!function(){var e="undefined"!=typeof window?window:n.g,i={};for(var r in function(e,t,n){var i;function r(e){var t=0;return function(){return t>>0)+"_",i=0;return function e(r){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(r||"")+"_"+i++,r)}}),s("Symbol.iterator",function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var t="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),n=0;n(t=t||0)&&(t=Math.max(t+i,0));ti||1114111=i?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode(i>>>10&1023|55296),t+=String.fromCharCode(1023&i|56320))}return t}}),s("Array.prototype.findIndex",function(e){return e||function(e,t){return U(this,e,t).Yi}}),s("WeakSet",function(e){function t(e){if(this.g=new WeakMap,e){e=l(e);for(var t;!(t=e.next()).done;)this.add(t.value)}}return function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),i=new e([t]);return!(!i.has(t)||i.has(n))&&(i.delete(t),i.add(n),!i.has(t)&&i.has(n))}catch(e){return!1}}()?e:(t.prototype.add=function(e){return this.g.set(e,!0),this},t.prototype.has=function(e){return this.g.has(e)},t.prototype.delete=function(e){return this.g.delete(e)},t)}),s("Array.prototype.find",function(e){return e||function(e,t){return U(this,e,t).v}}),s("String.prototype.startsWith",function(e){return e||function(e,t){var n=O(this,e,"startsWith"),i=n.length,r=e.length;t=Math.max(0,Math.min(0|t,n.length));for(var a=0;a=r}}),s("Object.entries",function(e){return e||function(e){var t,n=[];for(t in e)R(e,t)&&n.push([t,e[t]]);return n}});var B="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n(e=Math.trunc(e)||0)&&(e+=this.length),!(0>e||e>=this.length))return this[e]}function j(e){return e||F}s("Object.assign",function(e){return e||B}),s("Promise.prototype.finally",function(e){return e||function(e){return this.then(function(t){return Promise.resolve(e()).then(function(){return t})},function(t){return Promise.resolve(e()).then(function(){throw t})})}}),s("Array.prototype.entries",function(e){return e||function(){return N(this,function(e,t){return[e,t]})}}),s("Number.isNaN",function(e){return e||function(e){return"number"==typeof e&&isNaN(e)}}),s("String.prototype.repeat",function(e){return e||function(e){var t=O(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return n}}),s("Number.EPSILON",function(){return Math.pow(2,-52)}),s("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991}),s("Number.isFinite",function(e){return e||function(e){return"number"==typeof e&&!isNaN(e)&&1/0!==e&&-1/0!==e}}),s("Object.values",function(e){return e||function(e){var t,n=[];for(t in e)R(e,t)&&n.push(e[t]);return n}}),s("Math.log2",function(e){return e||function(e){return Math.log(e)/Math.LN2}}),s("String.prototype.endsWith",function(e){return e||function(e,t){var n=O(this,e,"endsWith");void 0===t&&(t=n.length),t=Math.max(0,Math.min(0|t,n.length));for(var i=e.length;0=i}}),s("Math.trunc",function(e){return e||function(e){if(e=Number(e),isNaN(e)||1/0===e||-1/0===e||0===e)return e;var t=Math.floor(Math.abs(e));return 0>e?-t:t}}),s("Array.prototype.at",function(e){return e||F}),s("Int8Array.prototype.at",j),s("Uint8Array.prototype.at",j),s("Uint8ClampedArray.prototype.at",j),s("Int16Array.prototype.at",j),s("Uint16Array.prototype.at",j),s("Int32Array.prototype.at",j),s("Uint32Array.prototype.at",j),s("Float32Array.prototype.at",j),s("Float64Array.prototype.at",j),s("String.prototype.at",function(e){return e||F});var G=this||self;function H(e,t){e=e.split(".");var n,i=G;e[0]in i||void 0===i.execScript||i.execScript("var "+e[0]);for(;e.length&&(n=e.shift());)e.length||void 0===t?i=i[n]&&i[n]!==Object.prototype[n]?i[n]:i[n]={}:i[n]=t}function V(t,n){if(n)if(n instanceof Map)for(var i=l(n.keys()),r=i.next();!r.done;r=i.next())r=r.value,Object.defineProperty(this,r,{value:n.get(r),writable:!0,enumerable:!0});else for(i in n)Object.defineProperty(this,i,{value:n[i],writable:!0,enumerable:!0});this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=e.performance&&e.performance.now?e.performance.now():Date.now(),this.type=t,this.isTrusted=!1,this.target=this.currentTarget=null,this.g=!1}function W(e){var t,n=new V(e.type);for(t in e)Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0});return n}V.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},V.prototype.stopImmediatePropagation=function(){this.g=!0},V.prototype.stopPropagation=function(){},H("shaka.util.FakeEvent",V);var z={ym:"abrstatuschanged",zm:"adaptation",Am:"audiotrackchanged",Bm:"audiotrackschanged",Cm:"boundarycrossed",Dm:"buffering",Em:"canupdatestarttime",Fm:"complete",Gm:"currentitemchanged",Hm:"downloadcompleted",Im:"downloadfailed",Jm:"downloadheadersreceived",Km:"drmsessionupdate",Mm:"emsg",Sm:"itemsinserted",Tm:"itemsremoved",mn:"prft",Error:"error",Nm:"expirationupdated",Om:"firstquartile",Pm:"gapjumped",Um:"keystatuschanged",Ym:"loaded",Zm:"loading",an:"manifestparsed",cn:"manifestupdated",dn:"mediaqualitychanged",fn:"mediasourcerecovered",gn:"metadataadded",Metadata:"metadata",hn:"midpoint",jn:"nospatialvideoinfo",ln:"onstatechange",nn:"ratechange",qn:"segmentappended",rn:"sessiondata",sn:"spatialvideoinfo",tn:"stalldetected",un:"started",vn:"statechanged",wn:"streaming",xn:"textchanged",yn:"texttrackvisibility",zn:"thirdquartile",An:"timelineregionadded",Bn:"timelineregionenter",Cn:"timelineregionexit",Dn:"trackschanged",Fn:"unloading",Hn:"variantchanged"};function K(){}function X(){}function Y(){}function q(e){var t=D.apply(1,arguments);J.has(e)||(J.add(e),Y.apply(K,h(t)))}function Z(){}var J=new Set;function Q(){this.g=new Map}function $(){this.gb=new Q,this.Se=this}function ee(e,t){for(var n=[],i=(e=l(e)).next();!i.done;i=e.next())n.push(t(i.value));return n}function te(e,t){for(var n=(e=l(e)).next();!n.done;n=e.next())if(t(n.value))return!0;return!1}function ne(e,t){for(var n=[],i=(e=l(e)).next();!i.done;i=e.next())t(i=i.value)&&n.push(i);return n}e.console&&((new Map).set(1,function(){return console.error.apply(console,h(D.apply(0,arguments)))}).set(2,function(){return console.warn.apply(console,h(D.apply(0,arguments)))}).set(3,function(){return console.info.apply(console,h(D.apply(0,arguments)))}).set(4,function(){return console.log.apply(console,h(D.apply(0,arguments)))}).set(5,function(){return console.debug.apply(console,h(D.apply(0,arguments)))}).set(6,function(){return console.debug.apply(console,h(D.apply(0,arguments)))}),Y=function(){return console.warn.apply(console,h(D.apply(0,arguments)))},X=function(){console.error.apply(console,h(D.apply(0,arguments)))}),(i=Q.prototype).push=function(e,t){this.g.has(e)?this.g.get(e).push(t):this.g.set(e,[t])},i.get=function(e){return this.g.has(e)?this.g.get(e).slice():null},i.remove=function(e,t){if(this.g.has(e)){var n=this.g.get(e).filter(function(e){return e!=t});this.g.set(e,n),n.length||this.g.delete(e)}},i.forEach=function(e){this.g.forEach(function(t,n){e(n,t)})},i.size=function(){return this.g.size},i.keys=function(){return Array.from(this.g.keys())},$.prototype.addEventListener=function(e,t){this.gb&&this.gb.push(e,t)},$.prototype.removeEventListener=function(e,t){this.gb&&this.gb.remove(e,t)},$.prototype.dispatchEvent=function(e){if(!this.gb)return!0;var t=this.gb.get(e.type)||[],n=this.gb.get("All");for(n&&(t=t.concat(n)),n=(t=l(t)).next();!n.done;n=t.next()){n=n.value,e.target=this.Se,e.currentTarget=this.Se;try{n.handleEvent?n.handleEvent(e):n.call(this,e)}catch(e){}if(e.g)break}return e.defaultPrevented},$.prototype.release=function(){this.gb=null};var ie=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");function re(e){var t;e instanceof re?(ae(this,e.jc),this.ud=e.ud,oe(this,e.Gb),se(this,e.Md),this.vb=e.vb,ue(this,e.g.clone()),this.$c=e.$c):e&&(t=String(e).match(ie))?(ae(this,t[1]||"",!0),this.ud=le(t[2]||""),oe(this,t[3]||"",!0),se(this,t[4]),this.vb=le(t[5]||"",!0),ue(this,t[6]||"",!0),this.$c=le(t[7]||"")):this.g=new ve(null)}function ae(e,t,n){e.jc=n?le(t,!0):t,e.jc&&(e.jc=e.jc.replace(/:$/,""))}function oe(e,t,n){e.Gb=n?le(t,!0):t}function se(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.Md=t}else e.Md=null}function ue(e,t,n){t instanceof ve?e.g=t:(n||(t=he(t,ge)),e.g=new ve(t))}function le(e,t){return e?t?decodeURI(e):decodeURIComponent(e):""}function he(e,t,n){return null!=e?(e=encodeURI(e).replace(t,ce),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ce(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}(i=re.prototype).jc="",i.ud="",i.Gb="",i.Md=null,i.vb="",i.$c="",i.toString=function(){var e=[],t=this.jc;if(t&&e.push(he(t,de,!0),":"),t=this.Gb){e.push("//");var n=this.ud;n&&e.push(he(n,de,!0),"@"),e.push(encodeURIComponent(t).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(t=this.Md)&&e.push(":",String(t))}return(t=this.vb)&&(this.Gb&&"/"!=t.charAt(0)&&e.push("/"),e.push(he(t,"/"==t.charAt(0)?fe:pe,!0))),(t=this.g.toString())&&e.push("?",t),(t=this.$c)&&e.push("#",he(t,me)),e.join("")},i.resolve=function(e){var t=this.clone();"data"===t.jc&&(t=new re);var n=!!e.jc;n?ae(t,e.jc):n=!!e.ud,n?t.ud=e.ud:n=!!e.Gb,n?oe(t,e.Gb):n=null!=e.Md;var i=e.vb;if(n)se(t,e.Md);else if(n=!!e.vb){if("/"!=i.charAt(0))if(this.Gb&&!this.vb)i="/"+i;else{var r=t.vb.lastIndexOf("/");-1!=r&&(i=t.vb.substr(0,r+1)+i)}if(".."==i||"."==i)i="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var a=[],o=0;o=i+2&&192==(224&t[i])&&128==(192&t[i+1])?(r=(31&t[i])<<6|63&t[i+1],i+=1):t.length>=i+3&&224==(240&t[i])&&128==(192&t[i+1])&&128==(192&t[i+2])?(r=(15&t[i])<<12|(63&t[i+1])<<6|63&t[i+2],i+=2):t.length>=i+4&&240==(241&t[i])&&128==(192&t[i+1])&&128==(192&t[i+2])&&128==(192&t[i+3])&&(r=(7&t[i])<<18|(63&t[i+1])<<12|(63&t[i+2])<<6|63&t[i+3],i+=3):r=t[i],65535>=r)n+=String.fromCharCode(r);else{var a=1023&(r-=65536);n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+a)}}return n}function Oe(e,t,n){if(!e)return"";if(!n&&0!=e.byteLength%2)throw new Ce(2,2,2004);n=Math.floor(e.byteLength/2);var i=new Uint16Array(n);e=Ee(e);for(var r=0;r=n[e]}if(!e)return"";var n=Te(e);if(239==n[0]&&187==n[1]&&191==n[2])return Ne(n);if(254==n[0]&&255==n[1])return Oe(n.subarray(2),!1);if(255==n[0]&&254==n[1])return Oe(n.subarray(2),!0);if(0==n[0]&&0==n[2])return Oe(e,!1);if(0==n[1]&&0==n[3])return Oe(e,!0);if(t(0)&&t(1)&&t(2)&&t(3))return Ne(e);throw new Ce(2,2,2003)}function Be(t){if(e.TextEncoder&&!Me().ei()){var n=new TextEncoder;return Se(n.encode(t))}t=encodeURIComponent(t),t=unescape(t),n=new Uint8Array(t.length);for(var i=0;i",""":'"',"'":"'"," ":" ","‎":"‎","‏":"‏"},n=/&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g,i=RegExp(n.source);return e&&i.test(e)?e.replace(n,function(e){return"#"==e[1]?0<=(e="x"==e[2]||"X"==e[2]?parseInt(e.substring(3),16):parseInt(e.substring(2),10))&&1114111>=e?String.fromCodePoint(e):"":t[e]||"'"}):e||""}H("shaka.util.StringUtils",Re),Re.resetFromCharCode=function(){He.g=void 0},Re.toUTF16=Fe,Re.toUTF8=Be,Re.fromBytesAutoDetect=Ue,Re.fromUTF16=Oe,Re.fromUTF8=Ne;var He=new Ie(function(){function e(e){try{var t=new Uint8Array(e);return 0/= ".indexOf(e[i])&&e[i];)i++;return e.slice(t,i)}var i=0;return function r(a,o){o=void 0!==o&&o;for(var s=[];e[i];)if(60==e.charCodeAt(i)){if(47===e.charCodeAt(i+1)){o=i+2,i=e.indexOf(">",i);var u=(o=e.substring(o,i)).indexOf(a);if(-1==u){var l=a.indexOf(".");0",i+1);-1===i&&(i=e.length)}else if(91===e.charCodeAt(i+2)&&91===e.charCodeAt(i+8)&&"cdata"===e.substr(i+3,5).toLowerCase()){-1==(u=e.indexOf("]]>",i))?(s.push(e.substr(i+9)),i=e.length):(s.push(e.substring(i+9,u)),i=u+3);continue}i++;continue}e:{l=o,i++;var c=n(),d={};for(u=[];62!==e.charCodeAt(i)&&e[i];){var p=e.charCodeAt(i);if(64p||96p){p=n();for(var f=e.charCodeAt(i);f&&39!==f&&34!==f&&!(64f||96f)&&62!==f;)i++,f=e.charCodeAt(i);var g=i+1;if(i=e.indexOf(e[i],g),g=e.slice(g,i),39===f||34===f){if(-1===i){if(l={tagName:c,attributes:d,children:u,parent:null},t)for(c=0;cMath.abs(e.startTime-t.startTime)&&.001>Math.abs(e.endTime-t.endTime)))return!1;for(var n in e)if("startTime"!=n&&"endTime"!=n&&"payload"!=n)if("nestedCues"==n){if(!en(e.nestedCues,t.nestedCues,Xn))return!1}else if("region"==n||"cellResolution"==n){for(var i in e[n])if(e[n][i]!=t[n][i])return!1}else if(Array.isArray(e[n])){if(!en(e[n],t[n]))return!1}else if(e[n]!=t[n])return!1;return!0}function Yn(e,t){t=void 0===t?new Map:t;var n=e.payload;if(n.includes("<")){0===t.size&&qn(t);var i=n;n=[];for(var r=-1,a=0;a"===i[a]&&0",'

'),i+="
";e:{a=i,r=[];var o=-1;n="",i=!1;for(var s=0;s",s);if(-1===u){n=a;break e}if((u=a.substring(s+1,u))&&"v"==u){i=!0;var h=null;if(r.length&&(h=r[r.length-1]),h){if(h===u)n+="/"+u+">";else{if(!h.startsWith("v")){n+=a[s];continue}n+="/"+h+">"}s+=u.length+1}else n+=a[s]}else n+=a[s]}else"<"===a[s]?"v"!=a[o=s+1]&&(o=-1):">"===a[s]&&0","<"+o+">")).replace("",""),i||(n+="")}n=function(e){var t={"< ":""," >":" >"},n=/(< +>|<\s|\s>)/g,i=RegExp(n.source);return e&&i.test(e)?e.replace(n,function(e){return t[e]||""}):e||""}(n),e.payload="";try{var c=fn(""+n+"","span")}catch(e){}if(c)if(1!=(c=c.children).length||c[0].tagName)for(n=(c=l(c)).next();!n.done;n=c.next())Zn(n.value,e,t);else e.payload=Ge(n);else e.payload=Ge(n)}else e.payload=Ge(n)}function qn(e){for(var t=l(Object.entries(ui)),n=t.next();!n.done;n=t.next()){var i=l(n.value);n=i.next().value,i=i.next().value;var r=new zn(0,0,"");r.color=i,e.set("."+n,r)}for(n=(t=l(Object.entries(li))).next();!n.done;n=t.next())n=(i=l(n.value)).next().value,i=i.next().value,(r=new zn(0,0,"")).backgroundColor=i,e.set("."+n,r)}function Zn(e,t,n){var i=t.clone();if(i.nestedCues=[],i.payload="",i.rubyTag="",i.line=null,i.region=new Yt,i.position=null,i.size=0,i.textAlign=$n,e.tagName)for(var r=l(e.tagName.split(/(?=[ .])+/g)),a=r.next();!a.done;a=r.next()){var o=a=a.value;if(o.startsWith(".voice-")){var s=o.split("-").pop();o='v[voice="'+s+'"]',n.has(o)||(o="v[voice="+s+"]")}switch(n.has(o)&&(s=i,o=n.get(o))&&(s.backgroundColor=Jn(o.backgroundColor,s.backgroundColor),s.color=Jn(o.color,s.color),s.fontFamily=Jn(o.fontFamily,s.fontFamily),s.fontSize=Jn(o.fontSize,s.fontSize),s.textShadow=Jn(o.textShadow,s.textShadow),s.fontWeight=o.fontWeight,s.fontStyle=o.fontStyle,s.opacity=o.opacity,s.rubyTag=o.rubyTag,s.textCombineUpright=o.textCombineUpright,s.wrapLine=o.wrapLine),a){case"br":return i=Kn(i.startTime,i.endTime),void t.nestedCues.push(i);case"b":i.fontWeight=ci;break;case"i":i.fontStyle=pi;break;case"u":i.textDecoration.push(gi);break;case"font":(a=e.attributes.color)&&(i.color=a);break;case"div":if(!(a=e.attributes.time))break;(a=sn(a))&&(i.startTime=a);break;case"ruby":case"rp":case"rt":i.rubyTag=a}}if(r=e.children,mn(e)||1==r.length&&mn(r[0]))for(n=bn(e).split("\n"),e=!0,r=(n=l(n)).next();!r.done;r=n.next())r=r.value,e||(e=Kn(i.startTime,i.endTime),t.nestedCues.push(e)),0=n.h||(e<=n.g&&t>=n.h?n.g=n.h=null:e<=n.g&&tn.g&&t>=n.h&&(n.h=e)),w(i)})},H("shaka.text.TextEngine",Ui),Ui.prototype.destroy=Ui.prototype.destroy,Ui.findParser=Fi,Ui.unregisterParser=function(e){Vi.delete(e)},Ui.registerParser=Bi;var Vi=new Map;function Wi(e){this.h=e,this.g=null}function zi(e){this.h=e,this.g=null}function Ki(e,t){return e.concat(t)}function Xi(){}function Yi(e){return null!=e}function qi(e,t){return Promise.race([t,new Promise(function(t,n){new zi(n).X(e)})])}function Zi(){}function Ji(e,t,n,i,r){function a(e){var t=String(e.width||"")+String(e.height||"")+String(Math.round(e.frameRate||0))+(e.hdr||"")+e.fastSwitching;return e.dependencyStream&&(t+=e.dependencyStream.baseOriginalId||""),t}function o(e){var t=e.language+(e.channelsCount||0)+(e.audioSamplingRate||0)+e.roles.join(",")+e.label+e.groupId+e.fastSwitching;return e.dependencyStream&&(t+=e.dependencyStream.baseOriginalId||""),t}if(r.length){for(var s=e.textStreams,u=(r=l(r)).next(),c={};!u.done;c={ni:void 0},u=r.next())if(c.ni=u.value,(u=s.filter(function(e){return function(t){return!(!t.codecs.startsWith(e.ni)&&!t.mimeType.startsWith(e.ni))}}(c))).length){s=u;break}e.textStreams=s}if(s=e.variants,(t.length||n.length)&&(s=function(e,t,n){for(var i=(t=l(t)).next(),r={};!i.done;r={videoCodec:void 0},i=t.next())if(r.videoCodec=i.value,i=e.filter(function(e){return function(t){return t.video&&t.video.codecs.startsWith(e.videoCodec)}}(r)),i.length){e=i;break}for(t=(n=l(n)).next(),i={};!t.done;i={audioCodec:void 0},t=n.next())if(i.audioCodec=t.value,t=e.filter(function(e){return function(t){return t.audio&&t.audio.codecs.startsWith(e.audioCodec)}}(i)),t.length){e=t;break}return e}(s,t,n)),i.length){for(t=new Q,s=(n=l(s)).next();!s.done;s=n.next())s=s.value,t.push(String(s.video.width||0),s);var d=[];t.forEach(function(e,t){e=0;for(var n=[],r=(t=l(t)).next(),a={};!r.done;a={ug:void 0},r=t.next())a.ug=r.value,(r=i.filter(function(e){return function(t){return e.ug.decodingInfos[0][t]}}(a)).length)>e?(e=r,n=[a.ug]):r==e&&n.push(a.ug);d.push.apply(d,h(n))}),s=d}for(n=new Set,t=new Set,r=(s=l(s)).next();!r.done;r=s.next())(r=r.value).audio&&n.add(r.audio),r.video&&t.add(r.video);s=Array.from(n).sort(function(e,t){return e.bandwidth-t.bandwidth});var p=[];for(n=new Map,r=(s=l(s)).next();!r.done;r=s.next()){if(u=o(r=r.value),(c=n.get(u)||[]).length){var f=c[c.length-1],g=Mi(f.codecs),m=Mi(r.codecs);g!=m||r.bandwidth&&f.bandwidth&&!(r.bandwidth>f.bandwidth)||(c.push(r),p.push(r.id))}else c.push(r),p.push(r.id);n.set(u,c)}var v={vp8:1,avc:1,"dovi-avc":.95,vp9:.9,vp09:.9,hevc:.85,"dovi-hevc":.8,"dovi-p5":.75,av01:.7,"dovi-av1":.65,vvc:.6};s=Array.from(t).sort(function(e,t){if(!e.bandwidth||!t.bandwidth||e.bandwidth==t.bandwidth){if(e.codecs&&t.codecs&&e.codecs!=t.codecs&&e.width==t.width){var n=Mi(e.codecs),i=Mi(t.codecs);if(n!=i)return(v[n]||1)-(v[i]||1)}return e.width-t.width}return e.bandwidth-t.bandwidth}),t=Ut();var y=[];for(n=new Map,r=(s=l(s)).next();!r.done;r=s.next()){if(u=a(r=r.value),(c=n.get(u)||[]).length){if(f=c[c.length-1],!t&&(g=Mi(f.codecs))!==(m=Mi(r.codecs)))continue;(g=Mi(f.codecs))!=(m=Mi(r.codecs))||r.bandwidth&&f.bandwidth&&!(r.bandwidth>f.bandwidth)||(c.push(r),y.push(r.id))}else c.push(r),y.push(r.id);n.set(u,c)}e.variants=e.variants.filter(function(e){var t=e.audio;return e=e.video,!(t&&!p.includes(t.id)||e&&!y.includes(e.id))})}function Qi(e,t,n){function i(e,t,n){return e>=t&&e<=n}var r=e.video;if(r&&r.width&&r.height){var a=r.width,o=r.height;if(o>a&&(a=(o=l([o,a])).next().value,o=o.next().value),!i(a,t.minWidth,Math.min(t.maxWidth,n.width))||!i(o,t.minHeight,Math.min(t.maxHeight,n.height))||!i(r.width*r.height,t.minPixels,t.maxPixels))return!1}return!(e&&e.video&&e.video.frameRate&&!i(e.video.frameRate,t.minFrameRate,t.maxFrameRate)||e&&e.audio&&e.audio.channelsCount&&!i(e.audio.channelsCount,t.minChannelsCount,t.maxChannelsCount)||!i(e.bandwidth,t.minBandwidth,t.maxBandwidth))}function $i(e,t,n,i,r){var a,o;return L(function(s){if(1==s.g)return Me().Lj()&&function(e){for(var t=(new Map).set("dvav","avc3").set("dva1","avc1").set("dvhe","hev1").set("dvh1","hvc1").set("dvc1","vvc1").set("dvi1","vvi1"),n=new Set,i=(e=l(e)).next();!i.done;i=e.next())(i=i.value).video&&n.add(i.video);for(e=(n=l(n)).next();!e.done;e=n.next()){e=e.value;for(var r=(i=l(t)).next();!r.done;r=i.next()){var a=l(r.value);if(r=a.next().value,a=a.next().value,e.codecs.includes(r)){e.codecs=e.codecs.replace(r,a);break}}}}(t.variants),_(s,nr(t.variants,n,!1,i),2);a=null,e&&(o=e.g)&&(a=o.keySystem),t.variants=t.variants.filter(function(e){var t=function(e,t,n){if(!e.decodingInfos.some(function(e){return!(!e.supported||t&&(e=e.keySystemAccess)&&(n[e.keySystem]||e.keySystem)!=t)}))return!1;var i=Me(),r="Xbox"===i.Sb();i="MOBILE"===i.Ja()&&"GECKO"===i.Fa();var a=e.video,o=a&&a.width||0,s=a&&a.height||0;return!(r&&a&&(1920=t.i))return;e.I=!0,e.u-=1e3*(e.g.switchInterval-e.g.minTimeToSwitch)}Date.now()-e.u<1e3*e.g.switchInterval||(t=e.chooseVariant(),e.getBandwidthEstimate(),t&&e.G(t,e.g.clearBufferSwitch,e.g.safeMarginSwitch))}function xr(e,t,n,i,r){if(e.D){var a=e.D.Ti();a&&(n=n.filter(function(e){return!e.bandwidth||!a||e.bandwidth<=a}))}return t&&(n=n.filter(function(e){return Qi(e,t,{width:r,height:i})})),n.sort(function(e,t){return e.bandwidth-t.bandwidth})}(i=Ar.prototype).stop=function(){this.G=null,this.l=!1,this.F=[],this.H=1,this.m=this.u=null,this.h&&(this.h.disconnect(),this.h=null),this.B.stop(),this.D=this.i=null},i.release=function(){this.j.release(),this.B=null},i.init=function(e){this.G=e},i.chooseVariant=function(){var e=1/0,t=1/0;if(this.g.restrictToScreenSize){var n=this.g.ignoreDevicePixelRatio?1:this.C.devicePixelRatio;e=this.C.screen.height*n,t=this.C.screen.width*n}if(this.h&&this.g.restrictToElementSize){n=this.g.ignoreDevicePixelRatio?1:this.C.devicePixelRatio;var i=this.m.clientHeight,r=this.m.clientWidth;this.i&&document.pictureInPictureElement&&document.pictureInPictureElement==this.m&&(i=this.i.height,r=this.i.width),e=Math.min(e,i*n),t=Math.min(t,r*n)}if((n=this.F.filter(function(e){return e&&!(e.audio&&e.audio.fastSwitching||e.video&&e.video.fastSwitching)})).length||(n=this.F),i=n,n.length!=this.F.length&&(i=this.F.filter(function(e){return e&&!!(e.audio&&e.audio.fastSwitching||e.video&&e.video.fastSwitching)})),n=xr(this,this.g.restrictions,i,1/0,1/0),1/0!=e||1/0!=t){for(n=function(e){for(var t=[],n=(e=l(e)).next();!n.done;n=e.next())(n=n.value.video)&&n.height&&n.width&&t.push({height:n.height,width:n.width});return t.sort(function(e,t){return e.width-t.width})}(n),r=(n=l(n)).next();!r.done;r=n.next())if((r=r.value).height>=e&&r.width>=t){e=r.height,t=r.width;break}n=xr(this,this.g.restrictions,i,e,t)}for(e=this.getBandwidthEstimate(),i.length&&!n.length&&(n=[(n=xr(this,null,i,1/0,1/0))[0]]),t=n[0]||null,i=0;i=o&&e<=a&&(t.bandwidth!=r.bandwidth||t.bandwidth==r.bandwidth&&t.video&&r.video&&(t.video.width=this.g.cacheLoadThreshold&&this.s.sample(r,t),n&&null!=this.u&&this.l&&Er(this)},i.trySuggestStreams=function(){null!=this.u&&this.l&&Er(this)},i.getBandwidthEstimate=function(){var e=this.g.defaultBandwidthEstimate;return navigator.connection&&navigator.connection.downlink&&this.g.useNetworkInformation&&(e=1e6*navigator.connection.downlink),navigator.connection&&navigator.connection.downlink&&this.g.useNetworkInformation&&this.g.preferNetworkInformationBandwidth?e:(e=this.s.getBandwidthEstimate(e),this.D?this.D.getBandwidthEstimate(e):e)},i.setVariants=function(e){this.F=e},i.playbackRateChanged=function(e){this.H=e},i.setMediaElement=function(t){function n(){i.B.X(Cr)}var i=this;this.m=t,this.h&&(this.h.disconnect(),this.h=null),this.m&&"ResizeObserver"in e&&(this.h=new ResizeObserver(n),this.h.observe(this.m)),this.j.o(t,"enterpictureinpicture",function(e){e.pictureInPictureWindow&&(i.i=e.pictureInPictureWindow,i.j.o(i.i,"resize",n))}),this.j.o(t,"leavepictureinpicture",function(){i.i&&i.j.Da(i.i,"resize",n),i.i=null})},i.setCmsdManager=function(e){this.D=e},i.configure=function(e){this.g=e,this.s&&this.g&&this.s.configure(this.g.advanced)},H("shaka.abr.SimpleAbrManager",Ar),Ar.prototype.configure=Ar.prototype.configure,Ar.prototype.setCmsdManager=Ar.prototype.setCmsdManager,Ar.prototype.setMediaElement=Ar.prototype.setMediaElement,Ar.prototype.playbackRateChanged=Ar.prototype.playbackRateChanged,Ar.prototype.setVariants=Ar.prototype.setVariants,Ar.prototype.getBandwidthEstimate=Ar.prototype.getBandwidthEstimate,Ar.prototype.trySuggestStreams=Ar.prototype.trySuggestStreams,Ar.prototype.segmentDownloaded=Ar.prototype.segmentDownloaded,Ar.prototype.disable=Ar.prototype.disable,Ar.prototype.enable=Ar.prototype.enable,Ar.prototype.chooseVariant=Ar.prototype.chooseVariant,Ar.prototype.init=Ar.prototype.init,Ar.prototype.release=Ar.prototype.release,Ar.prototype.stop=Ar.prototype.stop;var Cr=1;function kr(e,t){if(e===t||!e.length||!t.length)return!0;for(var n=(e=l(e)).next();!n.done;n=e.next()){if(Lr(n=n.value))return!0;for(var i=l(t),r=i.next();!r.done;r=i.next())if(r=r.value,n.keySystem===r.keySystem||Lr(r))return!0}return!1}function Ir(e,t){if(!e.length)return t;if(!t.length)return e;for(var n=[],i=(e=l(e)).next();!i.done;i=e.next()){i=i.value;for(var r=l(t),a=r.next();!a.done;a=r.next()){if(a=a.value,i.keySystem==a.keySystem){r=new Map;for(var o=l((i.initData||[]).concat(a.initData||[])),s=o.next();!s.done;s=o.next())s=s.value,r.set(s.keyId,s);r=Array.from(r.values()),o=i.keyIds&&a.keyIds?new Set([].concat(h(i.keyIds),h(a.keyIds))):i.keyIds||a.keyIds,n.push({keySystem:i.keySystem,licenseServerUri:i.licenseServerUri||a.licenseServerUri,distinctiveIdentifierRequired:i.distinctiveIdentifierRequired||a.distinctiveIdentifierRequired,persistentStateRequired:i.persistentStateRequired||a.persistentStateRequired,videoRobustness:i.videoRobustness||a.videoRobustness,audioRobustness:i.audioRobustness||a.audioRobustness,serverCertificate:i.serverCertificate||a.serverCertificate,serverCertificateUri:i.serverCertificateUri||a.serverCertificateUri,initData:r,keyIds:o});break}Lr(i)?n.push(i):Lr(a)&&n.push(a)}}return n}function Mr(e){return!!e&&!!e.match(/^com\.(microsoft|chromecast)\.playready/)}function Pr(e){return!!e&&!!e.match(/^com\.apple\.fps/)}function Lr(e){return!!(e=e.licenseServerUri)&&e.startsWith("data:application/json;base64,")}H("shaka.config.CrossBoundaryStrategy",{KEEP:"keep",RESET:"reset",RESET_TO_ENCRYPTED:"reset_to_encrypted",RESET_ON_ENCRYPTION_CHANGE:"RESET_ON_ENCRYPTION_CHANGE"});var Dr=new Ie(function(){return Se(new Uint8Array([0]))}),Rr=new Map;function Nr(e,t){var n=2,i=1e3,r=2,a=.5;this.l=null==e.maxAttempts?n:e.maxAttempts,this.j=null==e.baseDelay?i:e.baseDelay,this.s=null==e.fuzzFactor?a:e.fuzzFactor,this.m=null==e.backoffFactor?r:e.backoffFactor,this.g=0,this.h=this.j,(this.i=void 0!==t&&t)&&(this.g=1)}function Or(e){var t,n;return L(function(i){if(1==i.g){if(e.g>=e.l){if(!e.i)throw new Ce(2,7,1010);e.g=1,e.h=e.j}return t=e.g,e.g++,0==t?i.return():(n=e.h*(1+(2*Math.random()-1)*e.s),_(i,new Promise(function(e){new zi(e).X(n/1e3)}),2))}e.h*=e.m,w(i)})}function Ur(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}}function Br(){var e,t,n=new Promise(function(n,i){e=n,t=i});return n.resolve=e,n.reject=t,n}function Fr(e,t){this.promise=e,this.i=t,this.g=null}function jr(e){return new Fr(Promise.reject(e),function(){return Promise.resolve()})}function Gr(){var e=Promise.reject(new Ce(2,7,7001));return e.catch(function(){}),new Fr(e,function(){return Promise.resolve()})}function Hr(e){return new Fr(Promise.resolve(e),function(){return Promise.resolve()})}function Vr(e){return new Fr(e,function(){return e.catch(function(){})})}function Wr(e){return new Fr(Promise.all(e.map(function(e){return e.promise})),function(){return Promise.all(e.map(function(e){return e.abort()}))})}function zr(){this.g=[]}function Kr(e,t){e.g.push(t.finally(function(){Qt(e.g,t)}))}function Xr(e,t,n,i,r,a,o){$.call(this),this.i=null,this.j=!1,this.u=new zr,this.g=new Set,this.h=new Set,this.s=e||null,this.m=t||null,this.B=n||null,this.C=i||null,this.D=r||null,this.G=a||null,this.F=o||null,this.l=new Map}function Yr(e,t,n,i){i=void 0!==i&&i,n=n||na;var r=ia.get(e);(!r||n>=r.priority)&&ia.set(e,{priority:n,Sf:t,Rl:i})}function qr(e,t){for(var n=l(e.g),i=n.next();!i.done;i=n.next())t.g.add(i.value);for(n=(e=l(e.h)).next();!n.done;n=e.next())t.h.add(n.value)}function Zr(e,t,n){return{uris:e,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:t,licenseRequestType:null,sessionId:null,drmInfo:null,initData:null,initDataType:null,streamDataCallback:void 0===n?null:n}}function Jr(e,t,n,i,r,a,o,s){e.i.forceHTTP&&(n.uris[a]=n.uris[a].replace("https://","http://")),e.i.forceHTTPS&&(n.uris[a]=n.uris[a].replace("http://","https://")),0this.h.byteLength)throw la();var t=Te(this.h,this.g,e);return this.g+=e,t},i.skip=function(e){if(this.g+e>this.h.byteLength)throw la();this.g+=e},i.xj=function(e){if(this.ge||e>this.h.byteLength)throw la();this.g=e},i.ld=function(){for(var e=this.g;this.Oa()&&0!=this.h.getUint8(this.g);)this.g+=1;return e=Te(this.h,e,this.g-e),this.g+=1,Ne(e)},H("shaka.util.DataViewReader",ua),ua.prototype.readTerminatedString=ua.prototype.ld,ua.prototype.seek=ua.prototype.seek,ua.prototype.rewind=ua.prototype.xj,ua.prototype.skip=ua.prototype.skip,ua.prototype.readBytes=ua.prototype.Yb,ua.prototype.readUint64=ua.prototype.Pd,ua.prototype.readInt32=ua.prototype.Oh,ua.prototype.readUint32=ua.prototype.W,ua.prototype.readUint16=ua.prototype.Ga,ua.prototype.readUint8=ua.prototype.aa,ua.prototype.getLength=ua.prototype.getLength,ua.prototype.getPosition=ua.prototype.Ua,ua.prototype.hasMoreData=ua.prototype.Oa;var ha=1;function ca(){this.i=new Map,this.h=new Map,this.g=!1}function da(e){for(var t=ba(e);e.reader.Oa()&&!e.parser.g;)e.parser.Kd(e.start+t,e.reader,e.partialOkay,e.stopOnPartial)}function pa(e){for(var t=ba(e),n=e.reader.W(),i=0;i>24&255,e>>16&255,e>>8&255,255&e)}function ba(e){return 8+(e.has64BitSize?8:0)+(null!=e.flags?4:0)}ua.Endianness={BIG_ENDIAN:0,LITTLE_ENDIAN:ha},(i=ca.prototype).box=function(e,t){return e=va(e),this.i.set(e,_a),this.h.set(e,t),this},i.V=function(e,t){return e=va(e),this.i.set(e,wa),this.h.set(e,t),this},i.stop=function(){this.g=!0},i.parse=function(e,t,n){for(e=new ua(e,0),this.g=!1;e.Oa()&&!this.g;)this.Kd(0,e,t,n)},i.Kd=function(e,t,n,i){var r=t.Ua();if(i&&r+8>t.getLength())this.g=!0;else{var a=t.W(),o=t.W(),s=ya(o),u=!1;switch(a){case 0:a=t.getLength()-r;break;case 1:if(i&&t.Ua()+8>t.getLength())return void(this.g=!0);a=t.Pd(),u=!0}var l=this.h.get(o);if(l){var h=null,c=null;if(this.i.get(o)==wa){if(i&&t.Ua()+4>t.getLength())return void(this.g=!0);h=(c=t.W())>>>24,c&=16777215}o=r+a,n&&o>t.getLength()&&(o=t.getLength()),i&&o>t.getLength()?this.g=!0:(o-=t.Ua(),l({name:s,parser:this,partialOkay:n||!1,stopOnPartial:i||!1,version:h,flags:c,reader:t=new ua(t=0i?s.setUint32(u,0):s.setUint32(u,16777216),u+=4,o.set(t,u),u+=t.length,0i&&(i+=Math.pow(2,32)),i="0x"+i.toString(16)}e.u(new Ce(2,6,6006,t.message,t,i))}})}(e,t,n,e.g.sessionType)}}function Ma(e){return e=ee(e=e.i.keys(),function(e){return e.sessionId}),Array.from(e)}function Pa(t,n){var i,r,a,o,s,u;return L(function(c){switch(c.g){case 1:if(i=new Map,r=function(e,t,n){for(var i=l(t),r=i.next();!r.done;r=i.next())for(var a=(r=l(Fa(r.value))).next();!a.done;a=r.next())a=a.value,n.has(a.keySystem)||n.set(a.keySystem,[]),n.get(a.keySystem).push(a);if(1==n.size&&n.has(""))throw new Ce(2,6,6e3);(i=e.h.preferredKeySystems).length||1==(r=oa(e.h.servers)).size&&(i=Array.from(r.keys()));var o=(r=l(i)).next();for(a={};!o.done;a={qj:void 0},o=r.next()){a.qj=o.value;for(var s=(o=l(t)).next();!s.done;s=o.next())if(s=s.value.decodingInfos.find(function(e){return function(t){return t.supported&&null!=t.keySystemAccess&&t.keySystemAccess.keySystem==e.qj}}(a)))return s.keySystemAccess}for(a=(r=l([!0,!1])).next();!a.done;a=r.next())for(a=a.value,s=(o=l(t)).next();!s.done;s=o.next())for(var u=(s=l(s.value.decodingInfos)).next();!u.done;u=s.next())if((u=u.value).supported&&u.keySystemAccess){var h=u.keySystemAccess.keySystem;if(!i.includes(h)){var c=n.get(h);for(!c&&e.h.keySystemsMapping[h]&&(c=n.get(e.h.keySystemsMapping[h])),c=(h=l(c)).next();!c.done;c=h.next())if(!!c.value.licenseServerUri==a)return u.keySystemAccess}}return null}(t,n,i),!r){if(!navigator.requestMediaKeySystemAccess)throw new Ce(2,6,6020);throw new Ce(2,6,6001)}aa(t.l),S(c,2),r.getConfiguration();var d=a=t.h.keySystemsMapping[r.keySystem]||r.keySystem,p=i.get(a),f=[],g=[],m=[],v=[],y=[],b=new Set,w=new Set;!function(t,n,i,r,a,o,s,u){for(var c=[],d=(t=l(t)).next(),p={};!d.done;p={Qa:void 0},d=t.next()){if(p.Qa=d.value,n.includes(p.Qa.encryptionScheme)||n.push(p.Qa.encryptionScheme),"org.w3.clearkey"==p.Qa.keySystem&&p.Qa.licenseServerUri.startsWith("data:application/json;base64,")?c.includes(p.Qa.licenseServerUri)||c.push(p.Qa.licenseServerUri):i.includes(p.Qa.licenseServerUri)||i.push(p.Qa.licenseServerUri),a.includes(p.Qa.serverCertificateUri)||a.push(p.Qa.serverCertificateUri),p.Qa.serverCertificate&&(r.some(function(e){return function(t){return we(t,e.Qa.serverCertificate)}}(p))||r.push(p.Qa.serverCertificate)),p.Qa.initData)for(var f=(d=l(p.Qa.initData)).next(),g={};!f.done;g={yh:void 0},f=d.next())g.yh=f.value,o.some(function(e){return function(t){var n=e.yh;return!(!t.keyId||t.keyId!=n.keyId)||t.initDataType==n.initDataType&&we(t.initData,n.initData)}}(g))||o.push(g.yh);if(p.Qa.keyIds)for(f=(d=l(p.Qa.keyIds)).next();!f.done;f=d.next())s.add(f.value);if(p.Qa.keySystemUris&&u)for(d=(p=l(p.Qa.keySystemUris)).next();!d.done;d=p.next())u.add(d.value)}if(1==c.length)i.push(c[0]);else if(0r||i&&1e3>r)&&n&&!n.Pb&&(e.i.delete(t),Ua(t)),ja(e)&&(e.m.resolve(),e.K.X(za))}function Ua(e){return L(function(t){return 1==t.g?(S(t,2),_(t,qi(Va,Promise.all([e.close().catch(function(){}),e.closed])),4)):2!=t.g?A(t,0):(E(t),void w(t))})}function Ba(e){var t;return L(function(n){return t=Array.from(e.i.entries()),e.i.clear(),_(n,Promise.all(t.map(function(t){var n=(t=l(t)).next().value,i=t.next().value;return L(function(t){return 1==t.g?(S(t,2),e.ba||e.C.has(n.sessionId)||"persistent-license"!==i.type||e.h.persistentSessionOnlinePlayback?_(t,Ua(n),5):_(t,n.remove(),5)):2!=t.g?A(t,0):(E(t),void w(t))})})),0)})}function Fa(e){return(e.video?e.video.drmInfos:[]).concat(e.audio?e.audio.drmInfos:[])}function ja(e){return function(e,t){for(var n=(e=l(e)).next();!n.done;n=e.next())if(!t(n.value))return!1;return!0}(e=e.i.values(),function(e){return e.loaded})}function Ga(t,n,i,r){var a=t.keySystem;!a||"org.w3.clearkey"==a&&t.licenseServerUri||(n.size&&n.get(a)&&(n=n.get(a),t.licenseServerUri=n),t.keyIds||(t.keyIds=new Set),(i=i.get(a))&&(t.distinctiveIdentifierRequired||(t.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),t.persistentStateRequired||(t.persistentStateRequired=i.persistentStateRequired),t.serverCertificate||(t.serverCertificate=i.serverCertificate),i.sessionType&&(t.sessionType=i.sessionType),t.serverCertificateUri||(t.serverCertificateUri=i.serverCertificateUri)),r[a]&&(t.keySystem=r[a]),e.cast&&e.cast.__platform__&&"com.microsoft.playready"==a&&(t.keySystem="com.chromecast.playready"))}function Ha(e,t){if(0!=(e=oa(e)).size){e=Qe(e);for(var n=(t=l(t)).next();!n.done;n=t.next())(n=n.value).video&&(n.video.drmInfos=[e]),n.audio&&(n.audio.drmInfos=[e])}}(i=Aa.prototype).destroy=function(){return this.l.destroy()},i.configure=function(e,t){this.h=e,t&&(this.R=t),this.F&&this.P&&this.g&&this.F.ya(this.h.updateExpirationTime)},i.ac=function(e){var t,n=this;return L(function(i){if(1==i.g)return n.j===e?i.return():n.B?(n.j=e,n.s.ra(n.j,"play",function(){for(var e=l(n.L),t=e.next();!t.done;t=e.next())Na(n,t.value);n.Y=!0,n.L=[]}),n.j.remote?(n.s.o(n.j.remote,"connect",function(){return Ba(n)}),n.s.o(n.j.remote,"connecting",function(){return Ba(n)}),n.s.o(n.j.remote,"disconnect",function(){return Ba(n)})):"webkitCurrentPlaybackTargetIsWireless"in n.j&&n.s.o(n.j,"webkitcurrentplaybacktargetiswirelesschanged",function(){return Ba(n)}),n.G=n.g&&n.g.initData.find(function(e){return 0>10))+String.fromCharCode(96+((960&e)>>5))+String.fromCharCode(96+(31&e))}}function fo(e,t,n){var i=e.W(),r=[],a=null;1&n&&(a=e.Oh()),4&n&&e.skip(4);for(var o=0;oe?"0":"")+e}function bo(e){this.g=e}function _o(e){for(var t=[],n=l(e.g),i=n.next();!i.done;i=n.next()){var r=t,a=r.push,o=i.value;i=Mo;var s=o.id+1,u=o.stream.width||0,c=o.stream.height||0;"audio"==o.type&&(c=u=0);var d=o.duration*o.timescale,p=Math.floor(d/(Po+1));switch(d=Math.floor(d%(Po+1)),s=Mo("tkhd",s=new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(h(Co(s,4)),[0,0,0,0],h(Co(p,4)),h(Co(d,4)),[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0],h(Co(u,2)),[0,0],h(Co(c,2)),[0,0]))),u=Mo,p=o.duration*o.timescale,c=Math.floor(p/(Po+1)),p=Math.floor(p%(Po+1)),d=(d=o.stream.language).charCodeAt(0)-96<<10|d.charCodeAt(1)-96<<5|d.charCodeAt(2)-96,c=Mo("mdhd",c=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(h(Co(o.timescale,4)),h(Co(c,4)),h(Co(p,4)),h(Co(d,2)),[0,0]))),p=o,d=new Uint8Array([]),p.type){case"video":d=Do.value();break;case"audio":d=Ro.value()}p=Mo("hdlr",d);e:{switch(o.type){case"video":o=Mo("minf",Mo("vmhd",Fo.value()),Vo.value(),wo(o));break e;case"audio":o=Mo("minf",Mo("smhd",jo.value()),Vo.value(),wo(o));break e}o=new Uint8Array([])}i=i("trak",s,o=u("mdia",c,p,o)),a.call(r,i)}for(t=qe.apply(Ve,h(t)),n=Mo,i=(a=e.g[0]).duration*a.timescale,r=Math.floor(i/(Po+1)),i=Math.floor(i%(Po+1)),r=Mo("mvhd",r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(h(Co(a.timescale,4)),h(Co(r,4)),h(Co(i,4)),[0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))),i=[],u=(e=l(e.g)).next();!u.done;u=e.next())s=(o=i).push,u=Mo("trex",u=new Uint8Array([0,0,0,0].concat(h(Co(u.value.id+1,4)),[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0]))),s.call(o,u);if(e=Mo("mvex",e=qe.apply(Ve,h(i))),i=[],a.encrypted){for(o=(a=l(a.stream.drmInfos)).next();!o.done;o=a.next())if((o=o.value).initData)for(s=(o=l(o.initData)).next();!s.done;s=o.next())i.push(s.value.initData);a=qe.apply(Ve,h(i))}else a=new Uint8Array([]);return e=n("moov",r,t,e,a),t=Ho.value(),(n=new Uint8Array(t.byteLength+e.byteLength)).set(t),n.set(e,t.byteLength),n}function wo(e){var t=Mo,n="aac";e.codecs.includes("mp3")?n="mp3":e.codecs.includes("ac-3")?n=Me().ye()?"ec-3":"ac-3":e.codecs.includes("ec-3")?n="ec-3":e.codecs.includes("opus")&&(n="opus");var i=new Uint8Array([]);switch(e.type){case"video":if(e.codecs.includes("avc1")){if(n=e.stream.width||0,i=e.stream.height||0,0>8,a[d++]=255&o[u].length,a.set(o[u],d),d+=o[u].length;for(a[d++]=s.length,o=0;o>8,a[d++]=255&s[o].length,a.set(s[o],d),d+=s[o].length;r=r("avcC",a)}n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].concat(h(Co(n,2)),h(Co(i,2)),[0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17])),i="avc1",s=So(e),o=new Uint8Array([]),e.encrypted&&(o=Ao(e.stream,e.codecs),i="encv"),i=Mo(i,n,r,s,o)}else e.codecs.includes("hvc1")&&(i=e.stream.width||0,r=e.stream.height||0,n=new Uint8Array([]),0>>1,s<<7|r<<3,6,1,2])))),i="mp4a",r=new Uint8Array([]),e.encrypted&&(r=Ao(e.stream,e.codecs),i="enca"),e=Mo(i,To(e),n,r)),i=e}return t("stbl",e=Mo("stsd",Go.value(),i),Mo("stts",No.value()),Mo("stsc",Oo.value()),Mo("stsz",Bo.value()),Mo("stco",Uo.value()))}function So(e){if(!e.cb&&!e.fb)return new Uint8Array([]);var t=e.fb;return Mo("pasp",e=new Uint8Array([].concat(h(Co(e.cb,4)),h(Co(t,4)))))}function To(e){return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.stream.channelsCount||2,0,16,0,0,0,0].concat(h(Co(e.stream.audioSamplingRate||44100,2)),[0,0]))}function Ao(e,t){var n=Mo;t=Mo("frma",t=new Uint8Array([].concat(h(Co(Io(t.split(".")[0]),4)))));var i="cenc",r=e.drmInfos[0];r&&r.encryptionScheme&&(i=r.encryptionScheme),i=Mo("schm",i=new Uint8Array([0,0,0,0].concat(h(Co(Io(i),4)),[0,1,0,0]))),r=Mo;for(var a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),o=(e=l(e.drmInfos)).next();!o.done;o=e.next())if((o=o.value)&&o.keyIds&&o.keyIds.size)for(var s=(o=l(o.keyIds)).next();!s.done;s=o.next())a=ko(s.value);return n("sinf",t,i,r("schi",a=Mo("tenc",e=new Uint8Array([0,0,0,0,0,0,1,8]),a)))}function Eo(e){for(var t=[],n=(e=l(e.g)).next();!n.done;n=e.next()){n=n.value;var i,r=t.push,a=r.apply,o=Mo,s=new Uint8Array([0,0,0,0].concat(h(Co(n.data?n.data.Zb:0,4))));s=Mo("mfhd",s);var u=n.data?n.data.Cb:[],c=new Uint8Array(4+u.length);for(i=0;i>8*t&255);return n}function ko(e){for(var t=new Uint8Array(e.length/2),n=0;n>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=255&i,r.set(n,4),n=0,i=8;n>8*c&255);for(e.set(new Uint8Array(h),s),e.set(u,s+4),u=(s=l(o)).next();!u.done;u=s.next())Ko(e,(u=u.value).start,u.size+4)}}return e}function zo(e,t,n,i,r,a){var o=Ao(e,i.name),s=t.subarray(i.start,i.start+i.size);for((e=new Uint8Array(i.size+o.byteLength)).set(s,0),Ee(e).setUint32(4,a),e.set(o,i.size),Ko(e,0,e.byteLength),a=new Uint8Array(t.byteLength+e.byteLength),i=Me().yf()?i.start:i.start+i.size,o=t.subarray(i),a.set(t.subarray(0,i)),a.set(e,i),a.set(o,i+e.byteLength),r=(t=l(r)).next();!r.done;r=t.next())Ko(a,(r=r.value).start,r.size+e.byteLength);return e=Ee(a,n.start),n=ba(n),t=e.getUint32(n),e.setUint32(n,t+1),a}function Ko(e,t,n){0!=(t=(e=Ee(e,t)).getUint32(0))&&(1==t?(e.setUint32(8,n>>32),e.setUint32(12,4294967295&n)):e.setUint32(0,n))}function Xo(e,t,n,i,r,a,o,s){this.S=e,this.startByte=t,this.endByte=n,this.Id=void 0===i?null:i,this.timescale=void 0===r?null:r,this.h=void 0===a?null:a,this.aesKey=void 0===o?null:o,this.g=this.mimeType=this.codecs=null,this.encrypted=void 0!==s&&s}function Yo(e,t){return e===t||(e&&t?e.Kc()==t.Kc()&&e.Ic()==t.Ic()&&en(e.S().sort(),t.S().sort())&&we(e.ec(),t.ec()):e==t)}function qo(e,t,n,i,r,a,o,s,u,h,c,d,p,f,g,m){for(h=void 0===h?[]:h,f=void 0===f?Jo:f,this.startTime=e,this.j=this.endTime=t,this.D=n,this.startByte=i,this.endByte=r,this.ea=a,this.timestampOffset=o,this.appendWindowStart=s,this.appendWindowEnd=u,this.g=h,this.tilesLayout=void 0===c?"":c,this.C=void 0===d?null:d,this.h=void 0===p?null:p,this.status=f,this.preload=!1,this.l=!0,this.m=!1,this.aesKey=void 0===g?null:g,this.thumbnailSprite=null,this.i=-1,this.B=void 0!==m&&m,this.F=this.s=!1,t=(e=l(this.g)).next();!t.done;t=e.next())t.value.gj();this.B&&this.g.length&&this.g[this.g.length-1].fj(),this.u=this.bandwidth=this.mimeType=this.codecs=null,this.G=!1}function Zo(e,t){e.ea=t;for(var n=(e=l(e.g)).next();!n.done;n=e.next())Zo(n.value,t)}Xo.prototype.Kc=function(){return this.startByte},Xo.prototype.Ic=function(){return this.endByte},Xo.prototype.Be=function(e){this.h=e},Xo.prototype.ec=function(){return this.h},H("shaka.media.InitSegmentReference",Xo),Xo.prototype.getEndByte=Xo.prototype.Ic,Xo.prototype.getStartByte=Xo.prototype.Kc,(i=qo.prototype).S=function(){return this.D()},i.getStartTime=function(){return this.startTime},i.Hk=function(){return this.endTime},i.Kc=function(){return this.startByte},i.Ic=function(){return this.endByte},i.il=function(){return this.tilesLayout},i.hl=function(){return this.C},i.Lc=function(){return this.status},i.Jl=function(){this.status=Qo},i.Fh=function(){this.preload=!0},i.isPreload=function(){return this.preload},i.Hd=function(){this.l=!1},i.zl=function(){return this.l},i.gj=function(){this.s=!0},i.Bl=function(){return this.s},i.fj=function(){this.F=!0},i.Al=function(){return this.F},i.ej=function(){this.m=!0},i.vl=function(){return this.m},i.hg=function(e){this.thumbnailSprite=e},i.fl=function(){return this.thumbnailSprite},i.offset=function(e){this.startTime+=e,this.endTime+=e,this.j+=e;for(var t=l(this.g),n=t.next();!n.done;n=t.next())(n=n.value).startTime+=e,n.endTime+=e,n.j+=e},i.li=function(e){null==this.h?X("Sync attempted without sync time!"):(e=this.h-e-this.startTime,.001<=Math.abs(e)&&this.offset(e))},i.Be=function(e,t){this.u=e,this.G=void 0!==t&&t},i.ec=function(e){var t=this.u;return(void 0===e||e)&&this.G&&(this.u=null),t},H("shaka.media.SegmentReference",qo),qo.prototype.getSegmentData=qo.prototype.ec,qo.prototype.setSegmentData=qo.prototype.Be,qo.prototype.syncAgainst=qo.prototype.li,qo.prototype.offset=qo.prototype.offset,qo.prototype.getThumbnailSprite=qo.prototype.fl,qo.prototype.setThumbnailSprite=qo.prototype.hg,qo.prototype.hasByterangeOptimization=qo.prototype.vl,qo.prototype.markAsByterangeOptimization=qo.prototype.ej,qo.prototype.isLastPartial=qo.prototype.Al,qo.prototype.markAsLastPartial=qo.prototype.fj,qo.prototype.isPartial=qo.prototype.Bl,qo.prototype.markAsPartial=qo.prototype.gj,qo.prototype.isIndependent=qo.prototype.zl,qo.prototype.markAsNonIndependent=qo.prototype.Hd,qo.prototype.isPreload=qo.prototype.isPreload,qo.prototype.markAsPreload=qo.prototype.Fh,qo.prototype.markAsUnavailable=qo.prototype.Jl,qo.prototype.getStatus=qo.prototype.Lc,qo.prototype.getTileDuration=qo.prototype.hl,qo.prototype.getTilesLayout=qo.prototype.il,qo.prototype.getEndByte=qo.prototype.Ic,qo.prototype.getStartByte=qo.prototype.Kc,qo.prototype.getEndTime=qo.prototype.Hk,qo.prototype.getStartTime=qo.prototype.getStartTime,qo.prototype.getUris=qo.prototype.S;var Jo=0,Qo=1;function $o(e){return 1==e.length&&1e-4>e.end(0)-e.start(0)}function es(e){return!e||$o(e)?null:1==e.length&&0>e.start(0)?0:e.length?e.start(0):null}function ts(e){return!e||$o(e)?null:e.length?e.end(e.length-1):null}function ns(e,t){return!(!e||!e.length||$o(e)||t>e.end(e.length-1))&&t>=e.start(0)}function is(e,t){if(!e||!e.length||$o(e))return 0;for(var n=0,i=(e=l(rs(e))).next();!i.done;i=e.next()){var r=i.value;i=r.start,(r=r.end)>t&&(n+=r-Math.max(i,t))}return n}function rs(e){if(!e)return[];for(var t=[],n=0;ne[t+3]&&255>e[t+4]&&128>e[t+6]&&128>e[t+7]&&128>e[t+8]&&128>e[t+9]}function ms(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&255>e[t+3]&&255>e[t+4]&&128>e[t+6]&&128>e[t+7]&&128>e[t+8]&&128>e[t+9]}function vs(e,t){var n=(127&e[t])<<21;return n|=(127&e[t+1])<<14,(n|=(127&e[t+2])<<7)|127&e[t+3]}function ys(e){var t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if("APIC"===e.type){if(2>e.size||3!==e.data[0])return null;var n=e.data.subarray(1).indexOf(0);if(-1===n)return null;var i=Ne(Te(e.data,1,n)),r=e.data[2+n],a=e.data.subarray(3+n).indexOf(0);if(-1===a)return null;var o,s=Ne(Te(e.data,3+n,a));return o="--\x3e"===i?Ne(Te(e.data,4+n+a)):Se(e.data.subarray(4+n+a)),t.mimeType=i,t.pictureType=r,t.description=s,t.data=o,t}return"TXXX"===e.type||"WXXX"===e.type?2>e.size||3!==e.data[0]||-1===(i=e.data.subarray(1).indexOf(0))?null:(n=Ne(Te(e.data,1,i)),e=Ne(Te(e.data,2+i)).replace(/\0*$/,""),t.description=n,t.data=e,t):"PRIV"===e.type?2>e.size||-1===(n=e.data.indexOf(0))?null:(n=Ne(Te(e.data,0,n)),t.description=n,"com.apple.streaming.transportStreamTimestamp"==n?(n=e.data.subarray(n.length+1),e=1&n[3],n=(n[4]<<23)+(n[5]<<15)+(n[6]<<7)+n[7],n/=45,e&&(n+=47721858.84),t.data=n):(e=Se(e.data.subarray(n.length+1)),t.data=e),t):"T"===e.type[0]?2>e.size||3!==e.data[0]?null:(e=Ne(e.data.subarray(1)).replace(/\0*$/,""),t.data=e,t):"W"===e.type[0]?(e=Ne(e.data).replace(/\0*$/,""),t.data=e,t):e.data?(t.data=Se(e.data),t):null}function bs(e){for(var t=0,n=[];gs(e,t);){var i=vs(e,t+6);for(e[t+5]>>6&1&&(t+=10),i=(t+=10)+i;t+10>6&1&&(i+=10),i+=10,i+=vs(e,t+6),ms(e,t+10)&&(i+=10),t+=i;return 0>>32-n;return e.g-=n,0>>t)return e.h<<=t,e.g-=t,t;return Ts(e),t+xs(e)}function Cs(e){As(e,1+xs(e))}function ks(e){return Es(e,xs(e)+1)-1}function Is(e){return 1&(e=ks(e))?1+e>>>1:-1*(e>>>1)}function Ms(e){return 1===Es(e,1)}function Ps(e){return Es(e,8)}function Ls(e,t){for(var n=8,i=8,r=0;rt.byteLength-6)return null;var i=t[7];if(192&i){var r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2;null==e.u&&(e.u=r),n.pts=Us(r,e.u),e.u=n.pts,n.dts=n.pts,64&i&&(i=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,null==e.s&&(e.s=i),n.dts=n.pts!=r?Us(i,e.s):i),e.s=n.dts}return e=t[8]+9,t.byteLength<=e?null:(n.data=t.subarray(e),n)}function Os(e){var t=e.fd();return 1t&&(n=-1);4294967296Fs(e))}function Fs(e){for(var t=Math.min(1e3,e.length-564),n=0;ne.length)return this;for(var t=Math.max(0,Fs(e)),n=e.length-(e.length+t)%188,i=!1,r=t;r>4){var s=r+5+e[r+4];if(s==r+188)continue}else s=r+4;switch(o){case 0:a&&(s+=e[s]+1),this.H=(31&e[s+10])<<8|e[s+11];break;case 17:case 8191:break;case this.H:a&&(s+=e[s]+1),o={audio:-1,video:-1,wf:-1,audioCodec:"",videoCodec:""};var u=s+3+((15&(a=e)[s+1])<<8|a[s+2])-4;for(s+=12+((15&a[s+10])<<8|a[s+11]);s>1&63:31&e[0],a=0,s=1);s>1&63:31&e[s],l=s,a=0):a=-1):a=0:a=3:a=c?0:1}return 0<=l&&0<=a&&u.push({data:e.subarray(l+r,i),fullData:e.subarray(l,i),type:h,time:n,state:a}),!u.length&&t.se&&(n=u.length?u[u.length-1]:t.se)&&(n.data=qe(n.data,e),n.fullData=qe(n.fullData,e)),t.state=a,u},i.getMetadata=function(){for(var e=[],t=l(this.l),n=t.next();!n.done;n=t.next())(n=Ns(this,n=qe.apply(Ve,h(n.value))))&&e.push({cueTime:n.pts?n.pts/9e4:null,data:n.data,frames:bs(n.data),dts:n.dts,pts:n.pts});return e},i.zb=function(){if(this.i.length&&!this.h.length)for(var e=l(this.i),t=e.next();!t.done;t=e.next()){var n=qe.apply(Ve,h(t.value)),i=Ns(this,n);t=this.h.length?this.h[this.h.length-1]:null,i&&null!=i.pts&&null!=i.dts&&(!t||t.pts!=i.pts&&t.dts!=i.dts)?this.h.push(i):this.h.length&&(n=i?i.data:n)&&((t=this.h.pop()).data=qe(t.data,n),this.h.push(t))}return this.h},i.fd=function(e){if(e=void 0===e||e,this.j.length&&!this.g.length){for(var t=l(this.j),n=t.next();!n.done;n=t.next()){var i=qe.apply(Ve,h(n.value)),r=Ns(this,i);n=this.g.length?this.g[this.g.length-1]:null,r&&null!=r.pts&&null!=r.dts&&(!n||n.pts!=r.pts&&n.dts!=r.dts)?this.g.push(r):this.g.length&&(i=r?r.data:i)&&((n=this.g.pop()).data=qe(n.data,i),this.g.push(n))}if(e){for(t={se:null,state:null},n=[],r=(i=l(this.g)).next();!r.done;r=i.next())(r=r.value).nalus=this.Lh(r,t),r.nalus.length&&(n.push(r),t.se=r.nalus[r.nalus.length-1]);this.g=n}}return e?this.g:(e=this.g,this.g=[],e)},i.getStartTime=function(e){if("audio"==e){e=null;var t=this.zb();return t.length&&(e=t[0],e=Math.min(e.dts,e.pts)/9e4),e}return"video"==e?(e=null,(t=this.fd(!1)).length&&(e=t[0],e=Math.min(e.dts,e.pts)/9e4),e):null},i.ee=function(){return{audio:this.C,video:this.m}},i.vf=function(){for(var e=[],t=l(this.fd()),n=t.next();!n.done;n=t.next())e.push.apply(e,h(n.value.nalus));return e},i.ql=function(){kt("TsParser.getVideoResolution","Please use getVideoInfo function instead.");var e=this.sh();return{height:e.height,width:e.width}},i.sh=function(){return"hvc"==this.m?function(e){var t={height:null,width:null,codec:null,frameRate:null},n=e.vf();if(!n.length)return t;if(!(n=n.find(function(e){return 33==e.type})))return t;var i=new Ss(n.fullData,!0);Ps(i),Ps(i),Es(i,4);var r=Es(i,3);Ms(i);var a=Es(i,2),o=Es(i,1),s=Es(i,5),u=Es(i,32);n=Ps(i);for(var l=Ps(i),h=Ps(i),c=Ps(i),d=Ps(i),p=Ps(i),f=Ps(i),g=[],m=[],v=0;vv;v++)Es(i,2);for(v=0;vn;n++)t|=(e>>n&1)<<31-n;return t>>>0}(u),o=1==o?"H":"L",a="hvc1."+["","A","B","C"][a]+s,a+="."+i.toString(16).toUpperCase(),a+="."+o+f,p&&(a+="."+p.toString(16).toUpperCase()),d&&(a+="."+d.toString(16).toUpperCase()),c&&(a+="."+c.toString(16).toUpperCase()),h&&(a+="."+h.toString(16).toUpperCase()),l&&(a+="."+l.toString(16).toUpperCase()),n&&(a+="."+n.toString(16).toUpperCase()),t.codec=a,t.frameRate=Os(e),t}(this):function(e){var t={height:null,width:null,codec:null,frameRate:null},n=e.vf();if(!n.length)return t;if(!(n=n.find(function(e){return 7==e.type})))return t;var i=Ps(n=new Ss(n.data)),r=Ps(n),a=Ps(n);if(Cs(n),js.includes(i)){var o=ks(n);if(3===o&&As(n,1),Cs(n),Cs(n),As(n,1),Ms(n)){o=3!==o?8:12;for(var s=0;ss?16:64)}}if(Cs(n),0===(o=ks(n)))ks(n);else if(1===o)for(As(n,1),Cs(n),Cs(n),o=ks(n),s=0;s=e.l&&t.startTime=e.l&&u.startTimen&&(n+=.001),e.l.get(t).timestampOffset=n,au(e,t)}function ru(e,t,n,i){var r=e.l.get(t);r.appendWindowEnd===i&&r.appendWindowStart===n||(r.appendWindowStart=0,r.appendWindowEnd=i,r.appendWindowStart=n),au(e,t)}function au(e,t){if(e.F||e.H.g){var n=e.s.get(t);n&&n.length&&((n=n[0])&&n.p&&n.p.resolve(),e.s.set(t,[]))}else(n=e.s.get(t)[0])&&(n.p.resolve(),uu(e,t))}function ou(e,t,n,i){return aa(e.H),n={start:n,p:new Br,uri:i},e.s.get(t).push(n),1==e.s.get(t).length&&lu(e,t),n.p}function su(e,t){var n,i,r,a,o,s,u,h,c,d,p;return L(function(f){switch(f.g){case 1:for(aa(e.H),n=[],i=Array.from(e.l.keys()),r=l(i),a=r.next(),o={};!a.done;o={ready:void 0},a=r.next())s=a.value,o.ready=new Br,u={start:function(e){return function(){return e.ready.resolve()}}(o),p:o.ready,uri:null},(h=e.s.get(s)).push(u),n.push(o.ready),1==h.length&&u.start();return S(f,2),_(f,Promise.all(n),4);case 4:A(f,3);break;case 2:throw E(f);case 3:return S(f,5,6),_(f,t(),6);case 6:for(x(f),c=l(i),d=c.next();!d.done;d=c.next())p=d.value,uu(e,p);C(f,0);break;case 5:throw new Ce(2,3,3015,E(f),e.g.error||"No error in the media element",null)}})}function uu(e,t){e.s.get(t).shift(),lu(e,t)}function lu(e,t){var n=e.s.get(t)[0];if(n)try{n.start()}catch(i){"QuotaExceededError"==i.name?n.p.reject(new Ce(2,3,3017,t)):Ws(e)?n.p.reject(new Ce(2,3,3015,i,e.g.error||"No error in the media element",n.uri)):n.p.reject(new Ce(2,3,3024,t)),uu(e,t)}}function hu(e,t){return su(e,function(){return function(e,t){var n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S;return L(function(A){if(1==A.g){if(e.F||e.K)return A.return();for(n=it,e.F=!0,e.m=!1,i=e.g.currentTime,r=e.g.autoplay,e.g.paused||(e.gb=!0),e.eb&&(e.g.autoplay=!1),T(A,2),e.u.Sa(),a=l(e.j.values()),o=a.next();!o.done;o=a.next())o.value.destroy();for(s=l(e.l.values()),u=s.next();!u.done;u=s.next()){h=u.value;try{e.i.removeSourceBuffer(h)}catch(e){}}return e.j.clear(),e.l.clear(),c=e.i.duration,e.J=new Br,e.i=Hs(e,e.J),_(A,e.J,4)}if(2!=A.g){for(!isNaN(c)&&c?e.i.duration=c:!isNaN(e.qa)&&e.qa&&(e.i.duration=e.qa),d=new Br,p=e.i.sourceBuffers,f=t.size,g=0,m=function(){++g===f&&(d.resolve(),e.u.Da(p,"addsourcebuffer",m))},e.u.o(p,"addsourcebuffer",m),v=l(t.keys()),y=v.next();!y.done;y=v.next())b=y.value,w=t.get(b),Vs(e,b,w,w.codecs);return(S=t.get(n.ma))&&S.isAudioMuxedInVideo&&(e.m=!0),e.m&&!e.s.has(n.ma)&&e.s.set(n.ma,[]),e.g.currentTime=i,_(A,d,2)}return x(A),e.F=!1,aa(e.H),e.u.ra(e.g,"canplaythrough",function(){e.H.g||(e.g.autoplay=r,e.gb&&(e.gb=!1,e.g.play()))}),C(A,0)})}(e,t)})}function cu(e,t,n,i){var r=!1,a=et("audio",(i||"").split(",")),o=et("video",(i||"").split(",")),s=o;"audio"==t&&(s=a),s||(s=i),i=xi(n,s);var u=Li(e.D.get(t)),l=e.B.forceTransmux;if(!Ot(i)||!e.G&&Oi.includes(i)?l=!0:l||n==u||(l="WEBKIT"===Me().Fa()&&Oi.includes(n)),l&&(n=bi(e=Ci(n,s)))){var h=n();a&&o&&(r=!0),i=h.convertCodecs(t,e)}return t=Mi(Di(i)),{mc:h,pm:r,Di:Li(i),codec:t,mimeType:i}}function du(e,t,n,i,r){if(t==nt)return{type:gu,Lf:n,mc:null};var a=Mi(Di(e.D.get(t))),o=Li(e.D.get(t)),s=cu(e,t,n,i),u=s.mc,l=s.pm,h=s.Di,c=s.codec;s=s.mimeType;var d=!0;return l&&e.D.has("audio")&&(n=cu(e,"audio",n,i),i=Mi(Di(e.D.get("audio"))),d=Li(e.D.get("audio")),d=i==n.codec&&d==n.Di,n.mc&&n.mc.destroy()),a===c&&o===h&&d?{type:gu,Lf:s,mc:u}:(a=!0,(e.m&&!r.has("audio")||l&&u&&!e.j.has(t))&&(a=!1),a&&"smooth"===e.B.codecSwitchingStrategy&&Ut()?{type:vu,Lf:s,mc:u}:(u&&u.destroy(),{type:mu,Lf:s,mc:null}))}(i=Gs.prototype).destroy=function(){return this.H.destroy()},i.init=function(e,t,n,i){t=void 0!==t&&t,n=void 0===n?"UNKNOWN":n,i=void 0!==i&&i;var r,a,o,s,u,h,c=this;return L(function(d){if(1==d.g)return r=it,_(d,c.J,2);if(3!=d.g)return Ks(c)||Xs(c)?(X("Expected MediaSource to be open during init(); reopening the media source."),c.J=new Br,c.i=Hs(c,c.J),_(d,c.J,3)):d.A(3);for(c.G=t,c.U=n,c.Ya=i,c.Ta=!c.G&&"HLS"==c.U&&!c.Ya,c.Y.clear(),c.R=null,c.na=null,c.P=null,c.ba=null,c.$=new Br,a=l(e.keys()),o=a.next();!o.done;o=a.next())s=o.value,u=e.get(s),Vs(c,s,u,u.codecs),c.m?(c.s.set(r.ma,[]),c.s.set(r.Ha,[])):c.s.set(s,[]);(h=e.get(r.ma))&&h.isAudioMuxedInVideo&&(c.m=!0),w(d)})},i.configure=function(e){this.B=e,this.h&&(this.h.B=e.modifyCueCallback)},i.bc=function(){var e={total:this.F?[]:rs(this.g.buffered),audio:rs(Zs(this,"audio")),video:rs(Zs(this,"video")),text:[]};if(this.h){var t=this.h.g,n=this.h.h;null!=t&&null!=n&&e.text.push({start:t,end:n})}return e},i.remove=function(e,t,n,i){var r,a=this;return L(function(o){return 1==o.g?(e==(r=it).Ha&&a.I&&a.I.remove(i),e==r.$a?_(o,a.h.remove(t,n),0):n>t?_(o,ou(a,e,function(){return tu(a,e,t,n)},null),5):o.A(0)):a.m?_(o,ou(a,r.ma,function(){return tu(a,r.ma,t,n)},null),0):o.A(0)})},i.flush=function(e){var t,n=this;return L(function(i){return 1==i.g?e==(t=it).$a?i.return():_(i,ou(n,e,function(){n.g.currentTime-=.001,au(n,e)},null),2):n.m?_(i,ou(n,t.ma,function(){var e=t.ma;n.g.currentTime-=.001,au(n,e)},null),0):i.A(0)})},i.endOfStream=function(e){var t=this;return L(function(n){return _(n,su(t,function(){Ks(t)||Xs(t)||(e?t.i.endOfStream(e):t.i.endOfStream())}),0)})},i.wb=function(e){var t=this;return L(function(n){return _(n,su(t,function(){if(t.B.durationReductionEmitsUpdateEnd&&e=t.s&&i&&!t.i)&&(t.j&&t.j(t.g,r),t.i=!0,t.g=n.g.currentTime),t=!i}t&&(t=e.g.currentTime,i=function(e,t,n){return e&&e.length&&!$o(e)&&0<=(e=rs(e).findIndex(function(e,i,r){return e.start>t&&(0==i||r[i-1].end-t<=n)}))?e:null}(n=e.g.buffered,t,e.h.gapDetectionThreshold),null==i||0==i&&!e.B||(r=n.start(i),(a=e.h.gapPadding)&&(r=Math.ceil(100*(r+a))/100),r>=e.C.Kb()||.001>r-t||(0!=i&&n.end(i-1),e.g.currentTime=r,t==e.j&&(e.j=r),e.D++,e.u(new V("gapjumped")))))}}}function wu(e,t,n){this.h=e,this.m=Tu(e),this.g=e.g.currentTime,this.l=Date.now()/1e3,this.i=!1,this.s=t,this.j=n}function Su(e){var t=this;this.g=e,this.h=new At,this.i=!1,this.h.o(this.g,"audiofocuspaused",function(){t.i=!0}),this.h.o(this.g,"audiofocusgranted",function(){t.i=!1}),this.h.o(this.g,"audiofocuslost",function(){t.i=!0})}function Tu(e){if(e.g.paused||0==e.g.playbackRate||e.i||0==e.g.buffered.length)var t=!1;else e:{t=e.g.currentTime;for(var n=(e=l(rs(e.g.buffered))).next();!n.done;n=e.next())if(!(t<(n=n.value).start-.1||t>n.end-.5)){t=!0;break e}t=!1}return t}function Au(e,t,n,i){t==HTMLMediaElement.HAVE_NOTHING||e.readyState>=t?i():(t=Eu.value().get(t),n.ra(e,t,i))}(i=yu.prototype).getDuration=function(){return this.l},i.Rk=function(){return this.h},i.Ij=function(e){this.i=e},i.wb=function(e){this.l=e},i.Xk=function(){return this.i},i.Fj=function(e){this.B=e},i.pd=function(e){e&&!this.C&&(this.I=!0),this.C=e},i.fg=function(e){this.u=e},i.uf=function(){return this.u},i.Zh=function(e){this.D=e},i.Gk=function(){return this.D},i.nj=function(e,t){if(0!=e.length){var n=(Date.now()+this.B)/1e3;if(0!=(e=e.filter(function(e){return e.start+tMath.abs(e.g.currentTime-t)?Mu(e):(e.h.ra(e.g,"seeking",function(){Mu(e)}),Lu(e.i,e.g.currentTime&&0!=e.g.currentTime?e.g.currentTime:t))}function Mu(e){e.s=!0,e.h.o(e.g,"seeking",function(){return e.m()}),e.u(e.g.currentTime)}function Pu(e){var t=this;this.g=e,this.m=10,this.j=this.l=this.i=0,this.h=new zi(function(){0>=t.i||t.g.currentTime!=t.l||t.g.currentTime===t.j?t.h.stop():(t.g.currentTime=t.j,t.i--)})}function Lu(e,t){e.l=e.g.currentTime,e.j=t,e.i=e.m,e.g.currentTime=t,e.h.ya(.1)}function Du(e){this.g=e,this.i=!1,this.h=null,this.j=new At}function Ru(e){return e.g.getStartDate&&(e=e.g.getStartDate().getTime(),!isNaN(e))?e/1e3:null}function Nu(e,t){return 0<(e=e.g.seekable).length&&(t=Math.max(e.start(0),t),t=Math.min(e.end(e.length-1),t)),t}function Ou(e,t,n,i,r,a){var o=this;this.h=e,this.g=t.presentationTimeline,this.l=n,this.u=r,this.s=null,this.j=new bu(e,t.presentationTimeline,n,a),this.i=new xu(e,function(){e:{var e=o.j;e.l=!0,e.B=!1,e.i&&e.i.ya(e.h.gapJumpTimerTime),_u(e);var t=Cu(o.i);if(e=Fu(o,t),!Bt()&&.001n-t&&(t=n-3),ee.g.getDuration()?e.g.dc():e.g.Kb():t instanceof Date?t=t.getTime()/1e3-(e.g.m||e.g.i):0>t&&(t=e.g.Kb()+t),Bu(e,ju(e,t))}function Bu(e,t){var n=e.g.getDuration();return t>=n?n-e.l.durationBackoff:t}function Fu(e,t){var n=e.l.rebufferingGoal,i=e.l.safeSeekOffset,r=e.g.dc(),a=e.g.Kb(),o=e.g.getDuration();3>a-r&&(r=a-3);var s=e.g.ge(n),u=e.g.ge(i);return n=e.g.ge(n+i),t>=o?Bu(e,t):t>a?a-e.l.safeSeekEndOffset:t=s||ns(e.h.buffered,t)?t:n}function ju(e,t){var n=e.g.dc();return t(e=e.g.Kb())?e:t}function Gu(e){this.g=e,this.m=null,this.i=0,this.s=!1}function Hu(e){return e.g[0]||null}function Vu(e,t,n){return new Gu([e=new qo(e,e+t,function(){return n},0,null,null,e,e,e+t)])}function Wu(e,t,n,i){this.i=e,this.h=t,this.g=n,this.reverse=i}function zu(){Gu.call(this,[]),this.h=[]}function Ku(e){var t=this;this.g=e,this.j=!1,this.i=this.g.tf(),this.h=new zi(function(){t.g.jj(.25*t.i)})}function Xu(e){e.h.stop();var t=e.j?0:e.i;if(0<=t)try{return void(e.g.tf()!=t&&e.g.bi(t))}catch(e){}e.h.ya(.25),0!=e.g.tf()&&e.g.bi(0)}function Yu(e){var t=this;this.j=e,this.h=new At,this.g=new Set,this.i=new zi(function(){qu(t,!1)}).Ka(),e.paused||this.i.ya(.25),this.h.o(e,"playing",function(){t.i.Ka().ya(.25)}),this.h.o(e,"pause",function(){t.i.stop()})}function qu(e,t){for(var n=e.j.currentTime,i=(e=l(e.g)).next();!i.done;i=e.next())i.value.j(n,t)}function Zu(e){$.call(this),this.g=new Map,this.h=e}function Ju(e,t,n){return!!((e=e.h()[n])&&0=e[0].start&&tt;){var i=n.pop();i&&ll(e,i)}sl(e)}function ll(e,t){var n=e.h;t instanceof Xo&&(n=e.j),e=n.get(t),n.delete(t),e&&e.abort()}function hl(e){this.g=e,this.ve=this.ji=null}function cl(e,t,n){var i=new Uint8Array(0);return e.ve=e.g(t,n,function(t){return L(function(n){if(1==n.g)return i=0=e.length)return e;var t=e.find(function(e){return e.startsWith("dvav.")||e.startsWith("dva1.")||e.startsWith("dvh1.")||e.startsWith("dvhe.")||e.startsWith("dav1.")||e.startsWith("dvc1.")||e.startsWith("dvi1.")});return t?Ot('video/mp4; codecs="'+t+'"')?[t]:e.filter(function(e){return e!=t}):e}(i),t=t.concat(i).concat(e),n.length&&!t.length?n:t}function fl(t,n,i){var r,a,o,s,u;return L(function(l){if(1==l.g)return(r=n).cryptoKey?l.A(2):_(l,r.fetchKey(),3);if(!(a=r.iv))for(a=Te(new ArrayBuffer(16)),o=r.firstMediaSequenceNumber+i,s=a.byteLength-1;0<=s;s--)a[s]=255&o,o>>=8;return u="CBC"==n.blockCipherMode?{name:"AES-CBC",iv:a}:{name:"AES-CTR",counter:a,length:64},l.return(e.crypto.subtle.decrypt(u,r.cryptoKey,t))})}function gl(e,t,n,i,r){return e=Zr(e,i,r),0==t&&null==n||(e.headers.Range=n?"bytes="+t+"-"+n:"bytes="+t+"-"),e}function ml(e,t){var n=this;this.g=t,this.j=e,this.i=null,this.J=new Map,this.D=1,this.B=this.s=null,this.O=0,this.h=new Map,this.I=!1,this.P=null,this.C=!1,this.l=new ra(function(){return function(e){var t,n,i,r,a,o;return L(function(s){if(1==s.g){for(e.u&&e.u.stop(),e.u=null,e.H&&e.H.stop(),e.H=null,t=[],n=l(e.h.values()),i=n.next();!i.done;i=n.next())Nl(r=i.value),t.push(Ol(r)),r.ia&&(ol(r.ia),r.ia=null);for(a=l(e.m.values()),o=a.next();!o.done;o=a.next())ol(o.value);return _(s,Promise.all(t),2)}e.h.clear(),e.m.clear(),e.g=null,e.j=null,e.i=null,e.G=null,w(s)})}(n)}),this.L=Date.now()/1e3,this.m=new Map,this.N={projection:null,hfov:null},this.U=0,this.R=1/0,this.F=null,this.K=[],this.u=new zi(function(){if(n.j&&n.g)if(n.j.presentationTimeline.T()){var e=n.j.presentationTimeline.dc(),t=n.j.presentationTimeline.Kb();1e.g.Xa(),i=l(e.h.values()),r=i.next();!r.done;r=i.next())(r=r.value).Aa&&r.Aa.Td(n),r.ia&&r.ia.Td(n);for(r=(i=l(e.m.values())).next();!r.done;r=i.next())r.value.Td(n);(n=e.h.get("video"))&&(i=n.stream)&&(t?(t=i.trickModeVideo)&&!n.Pc&&(_l(e,t,!1,0,!1),n.Pc=i):(t=n.Pc)&&(n.Pc=null,_l(e,t,!0,0,!1)))}function yl(e,t,n,i,r,a){n=void 0!==n&&n,i=void 0===i?0:i,r=void 0!==r&&r,a=void 0!==a&&a,e.s=t,e.I&&(t.video&&_l(e,t.video,n,i,r,a),t.audio&&_l(e,t.audio,n,i,r,a))}function bl(e,t){L(function(n){if(1==n.g)return e.F=null,e.B=t,e.I?t.segmentIndex?n.A(2):_(n,t.createSegmentIndex(),2):n.return();_l(e,t,!0,0,!1),w(n)})}function _l(e,t,n,i,r,a){var o=e.h.get(t.type);o||t.type!=nt?o&&(o.Pc&&(t.trickModeVideo?(o.Pc=t,t=t.trickModeVideo):o.Pc=null),o.stream!=t||r)&&(e.m.has(t)?o.ia=e.m.get(t):o.ia&&function(e,t){t&&t!==e.i&&(ol(e),e.i=t)}(o.ia,t),t.type==nt&&o.stream!=t&&(r=xi(t.mimeType,t.codecs),zs(e.g.ha,r,e.j.sequenceMode,t.external)),!e.m.has(o.stream)&&o.stream.closeSegmentIndex&&(o.Za?(r="("+o.type+":"+o.stream.id+")",e.J.has(r)||e.J.set(r,o.stream.closeSegmentIndex)):o.stream.closeSegmentIndex()),r=o.stream.isAudioMuxedInVideo!=t.isAudioMuxedInVideo,o.stream=t,o.Aa=null,o.Eg=!!a,t.dependencyStream?o.Hc=Tl(e,t.dependencyStream):o.Hc=null,r&&(o.ub=null,o.vc=null,o.uc=null,t.isAudioMuxedInVideo&&(t=null,"video"===o.type?t=e.h.get("audio"):"audio"===o.type&&(t=e.h.get("video")),t&&(Ol(t).catch(function(){}),t.ub=null,t.vc=null,t.uc=null,Sl(e,t),wl(e,t).catch(function(t){e.g&&e.g.onError(t)})))),n?o.Xc?o.vg=!0:o.Za?(o.Vc=!0,o.jf=i,o.vg=!0):(Nl(o),Dl(e,o,!0,i).catch(function(t){e.g&&e.g.onError(t)})):o.Za||o.Db||Rl(e,o,0),wl(e,o).catch(function(t){e.g&&e.g.onError(t)})):function(e,t){var n,i,r,a,o;L(function(s){switch(s.g){case 1:return n=it,e.O++,i=e.O,S(s,2),_(s,Qs(e.g.ha,n.$a),4);case 4:A(s,3);break;case 2:r=E(s),e.g&&e.g.onError(r);case 3:a=xi(t.mimeType,t.codecs),zs(e.g.ha,a,e.j.sequenceMode,t.external),(e.g.ha.Z.isTextVisible()||e.i.alwaysStreamText)&&e.O==i&&(o=Tl(e,t),e.h.set(n.$a,o),Rl(e,o,0)),w(s)}})}(e,t)}function wl(e,t){var n,i,r;return L(function(a){if(1==a.g)return t.Nb?(n=t.stream,i=t.Nb,n.segmentIndex?a.A(2):_(a,n.createSegmentIndex(),2)):a.return();if(4!=a.g)return!(r=n.dependencyStream)||r.segmentIndex?a.A(4):_(a,r.createSegmentIndex(),4);if(t.Nb!=i||t.stream!=n)return a.return();var o=e.g.ed(),s=qs(e.g.ha,t.type),u=t.stream.segmentIndex.find(t.Ra?t.Ra.endTime:o),l=null==u?null:t.stream.segmentIndex.get(u);u=l&&l.endByte?l.endByte-l.startByte:null,l&&!u&&(u=(l.endTime-l.getStartTime())*(t.stream.bandwidth||0)/8),u?((l=l.ea)&&(u+=(l.endByte?l.endByte-l.startByte:null)||0),o=8*u/(l=e.g.getBandwidthEstimate())<(s||0)-o-e.i.rebufferingGoal||t.Nb.h.g>u):o=!1,o&&t.Nb.abort(),w(a)})}function Sl(e,t){t.Xc||t.Vc||(t.Za?(t.Vc=!0,t.jf=0):null==Ys(e.g.ha,t.type)?null==t.Db&&Rl(e,t,0):(Nl(t),Dl(e,t,!1,0).catch(function(t){e.g&&e.g.onError(t)})))}function Tl(e,t){var n={stream:t,type:t.type,Aa:null,ia:Al(e,t),Ra:null,ub:null,Ff:null,vc:null,uc:null,Df:null,Ef:null,Pc:null,endOfStream:!1,Za:!1,Db:null,Vc:!1,jf:0,vg:!1,Xc:!1,od:!0,Eg:!1,Ph:!1,je:!1,Nb:null,Hc:null};return t.dependencyStream&&(n.Hc=Tl(e,t.dependencyStream)),n}function Al(e,t){if("video"===t.type&&e.i.disableVideoPrefetch||"audio"===t.type&&e.i.disableAudioPrefetch||t.type===nt&&("application/cea-608"==t.mimeType||"application/cea-708"==t.mimeType)||t.type===nt&&e.i.disableTextPrefetch)return null;if(e.m.has(t))return e.m.get(t);var n=e.h.get(t.type);return(n=n&&n.ia)&&t===n.i?n:0e.g.Xa()):null}function El(t,n){var i,r,a,o,s,u,h,c,d;return L(function(p){switch(p.g){case 1:if(aa(t.l),i=it,n.Za||null==n.Db||n.Xc)return p.return();if(n.Db=null,!n.Vc){p.A(2);break}return _(p,Dl(t,n,n.vg,n.jf),3);case 3:return p.return();case 2:if(function(e,t){for(var n=l(e.J.entries()),i=n.next();!i.done;i=n.next()){var r=l(i.value);i=r.next().value,r=r.next().value,i.includes(t.type)&&(r(),e.J.delete(i))}}(t,n),n.stream.segmentIndex){p.A(4);break}return r=n.stream,S(p,5),_(p,n.stream.createSegmentIndex(),7);case 7:A(p,6);break;case 5:return a=E(p),_(p,Ul(t,n,a),8);case 8:return p.return();case 6:if(r!=n.stream)return r.closeSegmentIndex&&r.closeSegmentIndex(),n.Za||n.Db||Rl(t,n,0),p.return();case 4:if(!n.Hc){p.A(9);break}if(n.Hc.stream.segmentIndex){p.A(9);break}return S(p,11),_(p,n.Hc.stream.createSegmentIndex(),13);case 13:A(p,9);break;case 11:E(p);case 9:S(p,14),o=function(t,n){if(Ml(n))return function(e,t){var n=qs(e,"video")||0;Gi(e.h,t,n)}(t.g.ha,n.stream.originalId||""),null;if(n.type==nt&&function(e){e.h&&Gi(e.h,"",0)}(t.g.ha),n.stream.isAudioMuxedInVideo&&"audio"==n.type)return null;var i=t.i.updateIntervalSeconds/Math.max(1,Math.abs(t.g.Xa()));if(!Ws(t.g.ha)&&n.type!=nt)return i/2;var r=t.g.ed();if("audio"===n.type)for(var a=l(t.m.keys()),o=a.next();!o.done;o=a.next())(o=t.m.get(o.value)).hb(r,!0),il(o,r);a=n.Ra?n.Ra.endTime:r;var s=function(e,t,n){return t==nt?null==(e=e.h).h||e.hu&&h)return n.endOfStream=!0,"video"==n.type&&(t=t.h.get(nt))&&Ml(t)&&(t.endOfStream=!0),null;if(n.endOfStream=!1,s>=o)return i/2;if(u=!n.Aa,h=function(e,t,n,i){if(t.Aa)return(n=t.Aa.current())&&t.Ra&&.001>Math.abs(t.Ra.startTime-n.startTime)&&(n=t.Aa.next().value),n;if(t.Ra||i)return n=t.Ra?t.Ra.endTime:i,e=0>e.g.Xa(),t.stream.segmentIndex&&(t.Aa=t.stream.segmentIndex.cc(n,!1,e)),t.Aa&&t.Aa.next().value;i=e.j.sequenceMode||Fl(e)?0:e.i.inaccurateManifestTolerance;var r=Math.max(n-i,0);e=0>e.g.Xa();var a=null;return i&&(t.stream.segmentIndex&&(t.Aa=t.stream.segmentIndex.cc(r,!1,e)),a=t.Aa&&t.Aa.next().value),a||(t.stream.segmentIndex&&(t.Aa=t.stream.segmentIndex.cc(n,!1,e)),a=t.Aa&&t.Aa.next().value),a}(t,n,r,h),!h)return i;s=n.ub;var c=h.ea;s&&c&&Yo(c,s)&&(s.g=c.g),s=!1,u&&n.Eg&&(s=!0,n.Eg=!1),u=1/0;for(var d=(c=l(c=Array.from(t.h.values()))).next();!d.done;d=c.next())Ml(d=d.value)||d.Aa&&!d.Aa.current()||(u=Math.min(u,d.Ra?d.Ra.endTime:r));return a>=u+t.j.presentationTimeline.h?i:(n.ia&&n.Aa&&!t.m.has(n.stream)&&(n.ia.hb(h.startTime+.001),il(n.ia,h.startTime).catch(function(){})),Fl(t)&&function(e,t,n){if(t.type===nt)return!1;var i=t.ub;if(!i)return!1;var r=n.ea;if(n=i.g!==r.g,"reset_to_encrypted"===e.i.crossBoundaryStrategy&&(i.encrypted||r.encrypted||(n=!1),i.encrypted&&(e.i.crossBoundaryStrategy="keep")),"RESET_ON_ENCRYPTION_CHANGE"===e.i.crossBoundaryStrategy&&i.encrypted==r.encrypted&&(n=!1),n&&t.od){var a=e.g.video,o=a.paused;Bl(e,!0).then(function(){var t=(new Map).set("oldEncrypted",i.encrypted).set("newEncrypted",r.encrypted);e.g.onEvent(new V("boundarycrossed",t)),o||a.play()})}return n}(t,n,h)||(function(t,n,i,r,a){var o,s,u,h,c,d,p,f,g,m,v,y,b,T,x,C;return L(function(k){switch(k.g){case 1:if(o=it,s=n.stream,u=n.Aa,n.Za=!0,S(k,2),2==r.Lc())throw new Ce(1,1,1011);return _(k,function(e,t,n,i){var r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w;return L(function(T){switch(T.g){case 1:if(r=it,a=null==t.Ra,o=[],s=Math.max(0,Math.max(n.appendWindowStart,e.U)-.1),u=Math.min(n.appendWindowEnd,e.R)+.1,h=n.codecs||t.stream.codecs,c=Pi(h),d=Li(n.mimeType||t.stream.mimeType),(p=n.timestampOffset)==t.Ff&&s==t.vc&&u==t.uc&&c==t.Df&&d==t.Ef){T.A(2);break}if(f=t.Df&&t.Ef&&function(e,t,n,i,r){return(e=du(e,t,n,i,r)).mc&&e.mc.destroy(),e.type==mu}(e.g.ha,t.type,d,h,Gl(e)),!f){T.A(3);break}if(g=null,t.type===r.Ha?g=e.h.get(r.ma):t.type===r.ma&&(g=e.h.get(r.Ha)),!g){T.A(3);break}return _(T,Ol(g).catch(function(){}),5);case 5:g.ub=null,g.vc=null,g.uc=null,Sl(e,g);case 3:return _(T,Cl(e,t,p,s,u,n,c,d),2);case 2:return Yo(n.ea,t.ub)||(t.ub=n.ea,n.l&&n.ea&&(m=Pl(e,t,n.ea),v=function(){var a,o,s,u,h,c,d,p,f;return L(function(g){switch(g.g){case 1:return S(g,2),_(g,m,4);case 4:return a=g.h,aa(e.l),o=null,s=new Map,u={projection:null,hfov:null},(h=new ca).box("moov",da).box("trak",da).box("mdia",da).V("mdhd",function(e){o=po(e.reader,e.version).timescale}).box("hdlr",function(e){switch((e=e.reader).skip(8),e.ld()){case"soun":s.set(r.ma,o);break;case"vide":s.set(r.Ha,o)}o=null}),t.type===r.Ha&&h.box("minf",da).box("stbl",da).V("stsd",pa).box("encv",fa).box("avc1",fa).box("avc3",fa).box("hev1",fa).box("hvc1",fa).box("dvav",fa).box("dva1",fa).box("dvh1",fa).box("dvhe",fa).box("dvc1",fa).box("dvi1",fa).box("vexu",da).box("proj",da).V("prji",function(e){e=e.reader.ld(),u.projection=e}).box("hfov",function(e){e=e.reader.W()/1e3,u.hfov=e}),h.parse(a,!0,!0),t.type===r.Ha&&function(e,t){if(e.N.projection!=t.projection||e.N.hfov!=t.hfov){if(null!=t.projection||null!=t.hfov){var n=(new Map).set("detail",t);n=new V("spatialvideoinfo",n)}else n=new V("nospatialvideoinfo");n.cancelable=!0,e.g.onEvent(n),e.N=t}}(e,u),s.has(t.type)?n.ea.timescale=s.get(t.type):null!=o&&(n.ea.timescale=o),(c=t.stream.segmentIndex)instanceof zu&&(d=function(e,t){for(var n=(e=l(e.h)).next();!n.done;n=e.next())if(null!=(n=n.value).find(t))return n.kf();return-1}(c,n.startTime)),p=t.stream.closedCaptions&&0Math.abs(r-n)?a.return():(ou(e,t,function(){return nu(e,t)},null),e.m&&ou(e,i.ma,function(){return nu(e,i.ma)},null),_(a,ou(e,t,function(){return iu(e,t,n)},null),2))):e.m?_(a,ou(e,i.ma,function(){return iu(e,i.ma,n)},null),0):a.A(0)})}(e.g.ha,t.type,n.startTime)),_(T,Promise.all(o),0)}})}(t,n,r,a),4);case 4:return aa(t.l),t.C?k.return():(h="video/mp4"==s.mimeType||"audio/mp4"==s.mimeType,c=e.ReadableStream,t.i.lowLatencyMode&&t.j.isLowLatency&&c&&h&&("HLS"!=t.j.type||r.m)?(p=new Uint8Array(0),g=f=!1,v=function(e){var o,u,l;return L(function(h){switch(h.g){case 1:if(f)return h.return();if(g=!0,aa(t.l),t.C)return h.return();if(S(h,2),p=qe(p,e),o=!1,u=0,(new ca).box("mdat",function(e){u=e.size+e.start,o=!0}).parse(p,!1,!0),!o){h.A(4);break}return l=p.subarray(0,u),p=p.subarray(u),_(h,kl(t,n,i,s,r,l,!0,a),5);case 5:n.ia&&n.Aa&&il(n.ia,r.startTime,!0);case 4:A(h,0);break;case 2:m=E(h),w(h)}})},_(k,Pl(t,n,r,v),9)):_(k,Pl(t,n,r),7));case 7:return d=k.h,aa(t.l),t.C?k.return():(aa(t.l),n.Vc?(n.Za=!1,Rl(t,n,0),k.return()):_(k,kl(t,n,i,s,r,d,!1,a),6));case 9:if(y=k.h,m)throw m;if(g){k.A(10);break}return f=!0,aa(t.l),t.C?k.return():n.Vc?(n.Za=!1,Rl(t,n,0),k.return()):_(k,kl(t,n,i,s,r,y,!1,a),10);case 10:n.ia&&n.Aa&&il(n.ia,r.startTime,!0);case 6:if(aa(t.l),t.C)return k.return();n.Ra=r,u.next(),n.Za=!1,n.Ph=!1,b=t.g.ha.bc(),T=b[n.type],JSON.stringify(T),n.Vc||(x=null,n.type===o.Ha?x=t.h.get(o.ma):n.type===o.ma&&(x=t.h.get(o.Ha)),x&&x.type==o.ma?t.g.Pf(r,n.stream,x.stream.isAudioMuxedInVideo):t.g.Pf(r,n.stream,n.stream.codecs.includes(","))),Nl(n),Rl(t,n,0),A(k,0);break;case 2:if(C=E(k),aa(t.l,C),t.C)return k.return();if(n.Za=!1,7001==C.code)n.Za=!1,Nl(n),Rl(t,n,0),k.A(0);else{if(n.type!=o.$a||!t.i.ignoreTextStreamFailures)return 3017==C.code?_(k,function(e,t,n){var i,r,a;return L(function(o){if(1==o.g){if(Array.from(e.h.values()).some(function(e){return e!=t&&e.Ph}))return o.A(2);if(i=0===e.i.maxDisabledTime&&1011==n.code?1:e.i.maxDisabledTime,e.g.disableStream(t.stream,i))return o.return();if(e.i.avoidEvictionOnQuotaExceededError)return Rl(e,t,4),o.return();if(20<(r=Math.round(100*e.D)))e.D-=.2;else{if(!(4f)return _(g,xl(e,t,s.startTime,i),0);g.A(0)}})}function Cl(e,t,n,i,r,a,o,s){var u,l,h,c,d;return L(function(p){switch(p.g){case 1:if(u=it,l=Gl(e),S(p,2),t.vc=i,t.uc=r,o&&(t.Df=o),s&&(t.Ef=s),t.Ff=n,h=e.j.sequenceMode||"HLS"==e.j.type,c=null,t.type===u.Ha?c=e.h.get(u.ma):t.type===u.ma&&(c=e.h.get(u.Ha)),!(c&&c.stream&&c.stream.isAudioMuxedInVideo)){p.A(4);break}return _(p,$s(e.g.ha,c.type,n,i,r,h,c.stream.mimeType,c.stream.codecs,l),4);case 4:return _(p,$s(e.g.ha,t.type,n,i,r,h,a.mimeType||t.stream.mimeType,a.codecs||t.stream.codecs,l),6);case 6:A(p,0);break;case 2:throw d=E(p),t.vc=null,t.uc=null,t.Df=null,t.Ef=null,t.Ff=null,d}})}function kl(e,t,n,i,r,a,o,s){var u,l,h,c;return o=void 0!==o&&o,s=void 0!==s&&s,L(function(d){switch(d.g){case 1:return u=i.closedCaptions&&0u&&(d=Math.max(s-a,h-u-o)),d<=u?p.return():_(p,e.g.ha.remove(t.type,o,o+d,r),2))):4!=p.g?(aa(e.l),e.F?_(p,Il(e,e.F,n),4):p.A(0)):(aa(e.l),void w(p))})}function Ml(e){return e&&e.type==nt&&("application/cea-608"==e.stream.mimeType||"application/cea-708"==e.stream.mimeType)}function Pl(e,t,n,i){var r,a,o,s,u;return L(function(l){switch(l.g){case 1:if(r=n.ec())return l.return(r);if(a=null,t.ia){var h=t.ia,c=h.h;n instanceof Xo&&(c=h.j),c.has(n)?(h=c.get(n),i&&(h.ji=i),a=h.ve):a=null}return a||(a=Ll(n,t.stream,i||null,e.i.retryParameters,e.g.yc)),o=0,t.Aa&&(o=t.Aa.h),t.Nb=a,_(l,a.promise,2);case 2:if(s=l.h,t.Nb=null,u=s.data,!n.aesKey){l.A(3);break}return _(l,fl(u,n.aesKey,o),4);case 4:u=l.h;case 3:return l.return(u)}})}function Ll(e,t,n,i,r,a){a=void 0!==a&&a;var o=e instanceof qo?e:void 0,s=o?1:0;return(e=gl(e.S(),e.startByte,e.endByte,i,n)).contentType=t.type,r.request(ta,e,{type:s,stream:t,segment:o,isPreload:a})}function Dl(e,t,n,i){var r,a;return L(function(o){return 1==o.g?(t.Vc=!1,t.vg=!1,t.jf=0,t.Xc=!0,t.Ra=null,t.Aa=null,t.ia&&!e.m.has(t.stream)&&ol(t.ia),i?(r=e.g.ed(),a=e.g.ha.getDuration(),_(o,e.g.ha.remove(t.type,r+i,a),3)):_(o,Qs(e.g.ha,t.type),4)):3!=o.g?(aa(e.l),n?_(o,e.g.ha.flush(t.type),3):o.A(3)):(aa(e.l),t.Xc=!1,t.endOfStream=!1,t.Za||t.Db||Rl(e,t,0),void w(o))})}function Rl(e,t,n){var i=t.type;(i!=nt||e.h.has(i))&&(t.Db=new Wi(function(){var n;return L(function(i){return 1==i.g?(S(i,2),_(i,El(e,t),4)):2!=i.g?A(i,0):(n=E(i),e.g&&e.g.onError(n),void w(i))})}).X(n))}function Nl(e){null!=e.Db&&(e.Db.stop(),e.Db=null)}function Ol(e){return L(function(t){return e.Nb?_(t,e.Nb.abort(),0):t.A(0)})}function Ul(e,t,n){var i;return L(function(r){if(1==r.g)return 3024==n.code?(t.Za=!1,Nl(t),Rl(e,t,0),r.return()):_(r,Or(e.P),2);if(aa(e.l),1===n.category&&1003!=n.code){if(t.Pc)return vl(e,!1),r.return();i=0===e.i.maxDisabledTime&&1011==n.code?1:e.i.maxDisabledTime,n.handled=e.g.disableStream(t.stream,i),n.handled&&(n.severity=1)}n.handled&&1011==n.code||e.g.onError(n),n.handled||e.i.failureCallback(n),w(r)})}function Bl(e,t){t=void 0!==t&&t;var n,i,r,a,o,s=void 0===s||s;return L(function(u){if(1==u.g){if(n=Date.now()/1e3,i=e.i.minTimeBetweenRecoveries,!t){if(!e.i.allowMediaSourceRecoveries||n-e.L(t=n.g-t)||1(r=e.indexOf(".",r)));)0!=r&&"\\"==e[r-1]||(i[a=e.substring(a,r).replace(/\\\./g,".")]={},i=i[a],a=r+1),r+=1;return i[e.substring(a).replace(/\\\./g,".")]=t,n}function zl(e,t){return e&&t}function Kl(e,t){function n(e){return e&&"object"==typeof e&&!Array.isArray(e)}return e=function e(t,i){return Object.keys(t).reduce(function(r,a){var o=t[a];return i.hasOwnProperty(a)?o instanceof HTMLElement&&i[a]instanceof HTMLElement?o.isEqualNode(i[a])||(r[a]=o):n(o)&&n(i[a])?(o=e(o,i[a]),(0t)}).sort(function(e,t){return e.audio||t.audio?e.audio?t.audio?(t.audio.channelsCount||0)-(e.audio.channelsCount||0):1:-1:0})}function eh(e,t){return e.filter(function(e){return!e.audio||e.audio.codecs==t})}function th(){}function nh(){var t=1/0,n=Me();navigator.connection&&navigator.connection.saveData&&(t=360);var i={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,persistentSessionOnlinePlayback:!1,persistentSessionsMetadata:[],initDataTransform:function(t,n,i){return"apple"===e.shakaMediaKeysPolyfill&&"skd"==n&&(n=i.serverCertificate,t=ql(t,i=Yl(t),n)),t},logLicenseExchange:!1,updateExpirationTime:1,preferredKeySystems:[],keySystemsMapping:{},parseInbandPsshEnabled:!1,minHdcpVersion:"",ignoreDuplicateInitData:!0,defaultAudioRobustnessForWidevine:"SW_SECURE_CRYPTO",defaultVideoRobustnessForWidevine:"SW_SECURE_DECODE"},r="reload",a=!1;Ut()&&n.sd()&&(r="smooth",a=!0);var o={trackSelectionCallback:function(e){return L(function(t){return t.return(e)})},downloadSizeCallback:function(e){var t;return L(function(n){return 1==n.g?navigator.storage&&navigator.storage.estimate?_(n,navigator.storage.estimate(),3):n.return(!0):(t=n.h,n.return(t.usage+e<.95*t.quota))})},progressCallback:function(e,t){return zl([e,t])},usePersistentLicense:!0,numberOfParallelDownloads:5},s={drm:i,manifest:a={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,disableThumbnails:!1,disableIFrames:!1,defaultPresentationDelay:0,segmentRelativeVttTiming:!1,raiseFatalErrorOnManifestUpdateRequestFailure:!1,continueLoadingWhenPaused:!0,ignoreSupplementalCodecs:!1,updatePeriod:-1,ignoreDrmInfo:!1,dash:{clockSyncUri:"",disableXlinkProcessing:!0,xlinkFailGracefully:!1,ignoreMinBufferTime:!1,autoCorrectDrift:!0,initialSegmentLimit:1e3,ignoreSuggestedPresentationDelay:!1,ignoreEmptyAdaptationSet:!1,ignoreMaxSegmentDuration:!1,keySystemsByURI:{"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2":"com.apple.fps","urn:uuid:3d5e6d35-9b9a-41e8-b843-dd3c6e72c42c":"com.huawei.wiseplay"},manifestPreprocessor:rh,manifestPreprocessorTXml:ah,sequenceMode:!1,multiTypeVariantsAllowed:a,useStreamOnceInPeriodFlattening:!1,enableFastSwitching:!0},hls:{ignoreTextStreamFailures:!1,ignoreImageStreamFailures:!1,defaultAudioCodec:"mp4a.40.2",defaultVideoCodec:"avc1.42E01E",ignoreManifestProgramDateTime:!1,ignoreManifestProgramDateTimeForTypes:[],mediaPlaylistFullMimeType:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"',liveSegmentsDelay:3,sequenceMode:n.rd(),ignoreManifestTimestampsInSegmentsMode:!1,disableCodecGuessing:!1,disableClosedCaptionsDetection:!1,allowLowLatencyByteRangeOptimization:!0,allowRangeRequestsToGuessMimeType:!1},mss:{manifestPreprocessor:rh,manifestPreprocessorTXml:ah,sequenceMode:!1,keySystemsBySystemId:{"9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready"}}},streaming:{retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},failureCallback:function(e){return zl([e])},rebufferingGoal:0,bufferingGoal:10,bufferBehind:30,evictionGoal:1,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,gapDetectionThreshold:.5,gapPadding:0,gapJumpTimerTime:.25,durationBackoff:1,safeSeekOffset:5,safeSeekEndOffset:0,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsForFairPlay:!0,inaccurateManifestTolerance:2,lowLatencyMode:!1,preferNativeDash:!1,preferNativeHls:!1,updateIntervalSeconds:1,observeQualityChanges:!1,maxDisabledTime:30,segmentPrefetchLimit:1,prefetchAudioLanguages:[],disableAudioPrefetch:!1,disableTextPrefetch:!1,disableVideoPrefetch:!1,liveSync:{enabled:!1,targetLatency:.5,targetLatencyTolerance:.5,maxPlaybackRate:1.1,minPlaybackRate:.95,panicMode:!1,panicThreshold:60,dynamicTargetLatency:{enabled:!1,stabilityThreshold:60,rebufferIncrement:.5,maxAttempts:10,maxLatency:4,minLatency:1}},allowMediaSourceRecoveries:!0,minTimeBetweenRecoveries:5,vodDynamicPlaybackRate:!1,vodDynamicPlaybackRateLowBufferRate:.95,vodDynamicPlaybackRateBufferRatio:.5,preloadNextUrlWindow:30,loadTimeout:30,clearDecodingCache:!1,dontChooseCodecs:!1,shouldFixTimestampOffset:!1,avoidEvictionOnQuotaExceededError:!1,crossBoundaryStrategy:"keep",returnToEndOfLiveWindowWhenOutside:!1},networking:{forceHTTP:!1,forceHTTPS:!1,minBytesForProgressEvents:16e3},mediaSource:{codecSwitchingStrategy:r,addExtraFeaturesToSourceBuffer:function(e){return zl([e],"")},forceTransmux:!1,insertFakeEncryptionInInit:!0,correctEc3Enca:!1,modifyCueCallback:function(e,t){return zl([e,t])},dispatchAllEmsgBoxes:!1,useSourceElements:!0,durationReductionEmitsUpdateEnd:!0},offline:o,abrFactory:function(){return new Ar},adaptationSetCriteriaFactory:function(){return new(Function.prototype.bind.apply(Ql,[null].concat(h(D.apply(0,arguments)))))},abr:{enabled:!0,useNetworkInformation:!0,defaultBandwidthEstimate:1e6,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:t,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0,minChannelsCount:0,maxChannelsCount:1/0},advanced:{minTotalBytes:128e3,minBytes:16e3,fastHalfLife:2,slowHalfLife:5},restrictToElementSize:!1,restrictToScreenSize:!1,ignoreDevicePixelRatio:!1,clearBufferSwitch:!1,safeMarginSwitch:0,cacheLoadThreshold:5,minTimeToSwitch:0,preferNetworkInformationBandwidth:!1,removeLatencyFromFirstPacketTime:!0},autoShowText:3,preferredAudioLanguage:"",preferredAudioLabel:"",preferredTextLanguage:"",preferredVariantRole:"",preferredTextRole:"",preferredAudioChannelCount:2,preferredVideoHdrLevel:"AUTO",preferredVideoLayout:"",preferredVideoLabel:"",preferredVideoCodecs:[],preferredAudioCodecs:[],preferredTextFormats:[],preferForcedSubs:!1,preferSpatialAudio:!1,preferredDecodingAttributes:[],restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0,minChannelsCount:0,maxChannelsCount:1/0},playRangeStart:0,playRangeEnd:1/0,textDisplayer:{captionsUpdatePeriod:.25,fontScaleFactor:1},textDisplayFactory:function(){return null},cmcd:{enabled:!1,sessionId:"",contentId:"",rtpSafetyFactor:5,useHeaders:!1,includeKeys:[],version:1},cmsd:{enabled:!0,applyMaximumSuggestedBitrate:!0,estimatedThroughputWeightRatio:.5},lcevc:{enabled:!1,dynamicPerformanceScaling:!0,logLevel:0,drawLogo:!1,poster:!0},ads:{customPlayheadTracker:!1,skipPlayDetection:!1,supportsMultipleMediaElements:!0,disableHLSInterstitial:!1,disableDASHInterstitial:!1,allowPreloadOnDomElements:!0,allowStartInMiddleOfInterstitial:!0},ignoreHardwareResolution:!1,queue:{preloadNextUrlWindow:30,repeatMode:0}};return o.trackSelectionCallback=function(e){return L(function(t){return t.return(function(e,t,n){var i=n;"AUTO"==i&&(n=e.some(function(e){return!(!e.hdr||"HLG"!=e.hdr)}),i=pv(n));var r=e.filter(function(e){return!("variant"!=e.type||e.hdr&&e.hdr!=i)});n=[];var a=gt(t,r.map(function(e){return e.language}));a&&(n=r.filter(function(e){return ht(e.language)==a})),0==n.length&&(n=r.filter(function(e){return e.primary})),0==n.length&&(r.map(function(e){return e.language}),n=r);var o=n.filter(function(e){return e.height&&480>=e.height});for(o.length&&(o.sort(function(e,t){return t.height-e.height}),n=o.filter(function(e){return e.height==o[0].height})),t=[],n.length&&(r=Math.floor(n.length/2),n.sort(function(e,t){return e.bandwidth-t.bandwidth}),t.push(n[r])),n=(e=l(e)).next();!n.done;n=e.next())(n=n.value).type!=nt&&"image"!=n.type||t.push(n);return t}(e,s.preferredAudioLanguage,s.preferredVideoHdrLevel))})},n.ab(s)}function ih(e,t,n){var i={".drm.keySystemsMapping":"",".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:[],audioRobustness:[],sessionType:"",serverCertificate:new Uint8Array(0),serverCertificateUri:"",individualizationServer:"",headers:{}}};return Vl(e,t,n||nh(),i,"")}function rh(e){return zl([e],e)}function ah(e){return zl([e],e)}function oh(){this.g=null,this.h=[]}function sh(e,t){var n=0;e.g&&e.g.state==t&&(n+=e.g.duration);for(var i=(e=l(e.h)).next();!i.done;i=e.next())n+=(i=i.value).state==t?i.duration:0;return n}function uh(){this.i=this.h=null,this.g=[]}function lh(e,t,n){e.i!=t&&(e.i=t,e.g.push({timestamp:Date.now()/1e3,id:t.id,type:"text",fromAdaptation:n,bandwidth:null}))}function hh(){this.C=this.U=NaN,this.l="",this.j=this.dj=this.u=this.B=this.J=this.D=this.s=this.m=this.I=this.F=this.i=this.P=this.R=this.L=this.N=this.O=NaN,this.K=0,this.G=this.H=NaN,this.g=new oh,this.h=new uh}function ch(e,t,n){e.U=t,e.C=n}function dh(e,t){e.j=isNaN(e.j)?t:e.j+t}function ph(e,t,n,i){$.call(this),this.N=e,this.U=t,this.La=i.networkingEngine,this.m=n,this.C=null,this.Ia=0,this.Ya=i.yd,this.G=i.Hl,this.eb=i.Il,this.g=i.config,this.l=this.H=this.h=null,this.qa=!1,this.I=i.Tl,this.sa=!1,this.i=null,this.ba=!1,this.j=this.F=null,this.Z=!1,this.L=new Map,this.ua=!1,this.Na=i.Sl,this.Y=new hh,this.na=new Br,this.B=new Br,this.O=null,this.u=!1,this.$=i.gk,this.R=this.s=null,this.Ta=i.fk,this.P=!1,this.K=[],this.J=[],this.D=!0}function fh(e,t,n){(e=t?e.J:e.K)?e.push(n):n()}function gh(e,t){if(e.O=t,e.P=!0,e.K)for(var n=(t=l(e.K)).next();!n.done;n=t.next())(n=n.value)();e.K=null}function mh(e){if(e.u)throw new Ce(2,7,7003)}function vh(e,t){e.dispatchEvent(new V("onstatechange",(new Map).set("state",t)))}function yh(e,t){var n,i,r;return L(function(a){switch(a.g){case 1:return!e.h||e.i?a.return():(vh(e,"drm-engine"),e.Ia=Date.now()/1e3,e.i=e.Ya(),e.G.h=e.i,e.i.configure(e.g.drm,function(){return e.D}),n=pr(e.h.variants),i=!0,e.h&&e.h.presentationTimeline&&(i=e.h.presentationTimeline.T()),_(a,Ea(e.i,n,e.h.offlineSessionIds,i),2));case 2:if(mh(e),!t){a.A(3);break}return _(a,e.i.ac(t),4);case 4:mh(e);case 3:return _(a,eo(e.G,e.h),5);case 5:if(!a.h){a.A(0);break}return r=new V("trackschanged",void 0),_(a,Promise.resolve(),7);case 7:e.dispatchEvent(r),w(a)}})}function bh(e){var t=pr(e.h.variants);return t=e.C.create(t),e.j.configure(e.g.abr),e.j.setVariants(Array.from(t.values())),e.j.chooseVariant()}function _h(e,t,n){var i,r,a,o,s;return L(function(u){return 1==u.g?(i=e.g.streaming.segmentPrefetchLimit||2,r=new tl(i,t,function(t,n,i){return Ll(t,n,i||null,e.g.streaming.retryParameters,e.La,e.D)},!1),e.L.set(t.id,r),t.segmentIndex?u.A(2):_(u,t.createSegmentIndex(),2)):(a="number"==typeof e.m?e.m:0,o=t.segmentIndex.cc(a),s=null,o&&((s=o.current())||(s=o.next().value)),s||(s=Hu(t.segmentIndex)),s?n?s.ea?_(u,rl(r,s.ea),0):u.A(0):_(u,il(r,s.startTime),0):u.A(0))})}function wh(e,t){$.call(this);var n=this;this.i=e,this.l=t,this.g=new Map,this.m=[{wd:null,vd:Ah,gd:function(e,t){return Sh(n,"enter",e,t)}},{wd:Th,vd:Ah,gd:function(e,t){return Sh(n,"enter",e,t)}},{wd:Eh,vd:Ah,gd:function(e,t){return Sh(n,"enter",e,t)}},{wd:Ah,vd:Th,gd:function(e,t){return Sh(n,"exit",e,t)}},{wd:Ah,vd:Eh,gd:function(e,t){return Sh(n,"exit",e,t)}},{wd:Th,vd:Eh,gd:function(e,t){t?Sh(n,"skip",e,t):(Sh(n,"enter",e,t),Sh(n,"exit",e,t))}},{wd:Eh,vd:Th,gd:function(e,t){return Sh(n,"skip",e,t)}}],this.h=new At,this.h.o(this.i,"regionremove",function(e){n.g.delete(e.region)})}function Sh(e,t,n,i){t=new V(t,new Map([["region",n],["seeking",i]])),e.dispatchEvent(t)}xu.prototype.release=function(){this.h&&(this.h.release(),this.h=null),null!=this.i&&(this.i.release(),this.i=null),this.m=function(){},this.g=null},Pu.prototype.release=function(){this.h&&(this.h.stop(),this.h=null),this.g=null},(i=Du.prototype).ready=function(){var e=this;Au(this.g,HTMLMediaElement.HAVE_FUTURE_DATA,this.j,function(){!function(){if(null==e.h||0==e.h&&1/0!=e.g.duration)e.i=!0;else{var t=e.g.currentTime,n=null;if("number"==typeof e.h)n=e.h;else if(e.h instanceof Date){var i=Ru(e);null!==i&&(n=e.h.getTime()/1e3-i,n=Nu(e,n))}null==n?e.i=!0:(0>n&&(n=Math.max(0,t+n)),t!=n?(e.j.ra(e.g,"seeking",function(){e.i=!0}),e.g.currentTime=n):e.i=!0)}}()})},i.release=function(){this.j&&(this.j.release(),this.j=null),this.g=null},i.yg=function(e){this.h=this.i?this.h:e},i.We=function(){var e=this.i?this.g.currentTime:this.h;return e instanceof Date&&(e=Nu(this,e=e.getTime()/1e3-(Ru(this)||0))),e||0},i.wi=function(){return 0},i.ti=function(){return 0},i.lj=function(){},i.$i=function(){var e=ts(this.g.buffered);return null!=e&&e>=this.g.duration-1},(i=Ou.prototype).ready=function(){this.m.ya(.25)},i.release=function(){this.i&&(this.i.release(),this.i=null),this.j&&(this.j.release(),this.j=null),this.m&&(this.m.stop(),this.m=null),this.h=this.i=this.g=this.l=null,this.u=function(){}},i.yg=function(e){ku(this.i,Uu(this,e))},i.We=function(){var e=Cu(this.i);return 0=e)return!0}return!1},(i=Gu.prototype).getNumReferences=function(){return this.g.length},i.getNumEvicted=function(){return this.i},i.release=function(){this.s||(this.g=[],this.m&&this.m.stop(),this.m=null)},i.Kl=function(){this.s=!0},i.Ib=function(e){for(var t=l(this.g),n=t.next();!n.done;n=t.next())e(n.value)},i.find=function(e){for(var t=this.g.length-1,n=t;0<=n;--n){var i=this.g[n],r=n=i.startTime&&e(e-=this.i)||e>=this.g.length?null:this.g[e]},i.offset=function(e){if(!this.s)for(var t=l(this.g),n=t.next();!n.done;n=t.next())n.value.offset(e)},i.If=function(e){if(!this.s&&e.length){var t=Math.round(1e3*e[0].startTime)/1e3;this.g=this.g.filter(function(e){return Math.round(1e3*e.startTime)/1e3t&&(0==n.g.length||e.endTime>n.g[0].startTime)}),this.If(e),this.hb(t)},i.hb=function(e){if(!this.s){var t=this.g.length;this.g=this.g.filter(function(t){return t.endTime>e}),this.i+=t-this.g.length}},i.Cd=function(e,t,n){if(n=void 0!==n&&n,!this.s){for(;this.g.length&&this.g[this.g.length-1].startTime>=t;)this.g.pop();for(;this.g.length&&this.g[0].endTime<=e;)this.g.shift(),n||this.i++;0!=this.g.length&&((t=new qo((e=this.g[this.g.length-1]).startTime,t,e.D,e.startByte,e.endByte,e.ea,e.timestampOffset,e.appendWindowStart,e.appendWindowEnd,e.g,e.tilesLayout,e.C,e.h,e.status,e.aesKey)).mimeType=e.mimeType,t.codecs=e.codecs,t.i=e.i,this.g[this.g.length-1]=t)}},i.ng=function(e,t){var n=this;this.s||(this.m&&this.m.stop(),this.m=new zi(function(){var e=t();e?n.g.push.apply(n.g,h(e)):(n.m.stop(),n.m=null)}),this.m.ya(e))},Gu.prototype[Symbol.iterator]=function(){return this.cc(0)},Gu.prototype.cc=function(e,t,n){t=void 0!==t&&t,n=void 0!==n&&n;var i=this.find(e);if(null==i)return null;var r=this.get(i);n?i++:i--;var a=-1;if(r&&0=s.startTime&&e=e.g.length&&(this.h++,this.g=0,e=this.i.get(this.h)),e&&0this.g&&(this.h--,this.g=(e=this.i.get(this.h))&&0=this.g);)this.g--,t=e.g[this.g]},H("shaka.media.SegmentIterator",Wu),Wu.prototype.resetToLastIndependent=Wu.prototype.Sh,Wu.prototype.next=Wu.prototype.next,Wu.prototype.current=Wu.prototype.current,Wu.prototype.currentPosition=Wu.prototype.pk,Wu.prototype.setReverse=Wu.prototype.Td,m(zu,Gu),(i=zu.prototype).clone=function(){var e=new zu;return e.h=this.h.slice(),e.i=this.i,e},i.release=function(){for(var e=l(this.h),t=e.next();!t.done;t=e.next())t.value.release();this.h=[]},i.Ib=function(e){for(var t=l(this.h),n=t.next();!n.done;n=t.next())n.value.Ib(e)},i.find=function(e){for(var t=this.i,n=l(this.h),i=n.next();!i.done;i=n.next()){var r=(i=i.value).find(e);if(null!=r)return r+t;t+=i.getNumEvicted()+i.getNumReferences()}return null},i.get=function(e){for(var t=this.i,n=l(this.h),i=n.next();!i.done;i=n.next()){var r=(i=i.value).get(e-t);if(r)return r;r=i.getNumReferences(),t+=i.getNumEvicted()+r}return null},i.offset=function(){},i.If=function(){},i.hb=function(e){for(var t=l(this.h),n=t.next();!n.done;n=t.next())n.value.hb(e);for(;1(i=i.value).endTime&&ll(this,i);t&&sl(this)},tl.prototype.Td=function(e){this.s=e,this.g&&this.g.Td(e)},hl.prototype.abort=function(){this.ve&&this.ve.abort()},(i=ml.prototype).destroy=function(){return this.l.destroy()},i.configure=function(e){if(this.i=e,this.P=new Nr({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor,timeout:0,stallTimeout:0,connectionTimeout:0},!0),e.disableAudioPrefetch){var t=this.h.get("audio");t&&t.ia&&(ol(t.ia),t.ia=null);for(var n=(t=l(this.m.keys())).next();!n.done;n=t.next())n=n.value,ol(this.m.get(n)),this.m.delete(n)}for(e.disableTextPrefetch&&(t=this.h.get(nt))&&t.ia&&(ol(t.ia),t.ia=null),e.disableVideoPrefetch&&(t=this.h.get("video"))&&t.ia&&(ol(t.ia),t.ia=null),n=(t=l(this.h.keys())).next();!n.done;n=t.next())(n=this.h.get(n.value)).ia?(ul(n.ia,e.segmentPrefetchLimit),0=t||!n.some(function(e){return function(t){return st(e.Rb.audio.language,t)}}(a))||!(r=Al(e,a.Rb.audio))||(a.Rb.audio.segmentIndex||a.Rb.audio.createSegmentIndex(),e.m.set(a.Rb.audio,r))}(this)},i.start=function(e){var t=this;return L(function(n){if(1==n.g)return _(n,function(e,t){var n,i,r,a,o,s,u;return L(function(h){if(1==h.g){if(!e.s)throw new Ce(2,5,5006);return n=Gl(e,!0),_(h,e.g.ha.init(n,e.j.sequenceMode,e.j.type,e.j.ignoreManifestTimestampsInSegmentsMode),2)}for(aa(e.l),e.updateDuration(),i=l(n.keys()),r=i.next();!r.done;r=i.next())a=r.value,o=n.get(a),e.h.has(a)||(s=Tl(e,o),t.has(o.id)&&(nl(u=t.get(o.id),function(t,n,i){return Ll(t,n,i||null,e.i.retryParameters,e.g.yc)}),s.ia=u),e.h.set(a,s),Rl(e,s,0));w(h)})}(t,e||new Map),2);aa(t.l),t.I=!0,w(n)})},i.od=function(){if(this.g){for(var e=this.g.ed(),t=l(this.h.keys()),n=t.next();!n.done;n=t.next()){var i=n.value;n=this.h.get(i);var r=this.g.ha;if(!(r=i==nt?null!=(r=r.h).g&&null!=r.h&&e>=r.g&&et?(e&&(this.u&&this.u.stop(),eu(this.g.ha)),this.g.ha.wb(t)):e?(this.u&&this.u.ya(.5),this.g.ha.wb(1/0)):this.g.ha.wb(Math.pow(2,32))},H("shaka.util.ConfigUtils",Hl),Hl.getDifferenceFromConfigObjects=Kl,Hl.convertToConfigObject=Wl,Hl.mergeConfigObjects=Vl,H("shaka.config.RepeatMode",{OFF:0,ALL:1,SINGLE:2}),H("shaka.drm.FairPlay",Xl),Xl.commonFairPlayResponse=function(e,t){if(2===e&&(e=t.originalRequest.drmInfo)&&Pr(e.keySystem)){try{var n=Ne(t.data)}catch(e){return}if(e=!1,""===(n=n.trim()).substr(0,5)&&""===n.substr(-6)&&(n=n.slice(5,-6),e=!0),!e)try{var i=JSON.parse(n);i.ckc&&(n=i.ckc,e=!0),i.CkcMessage&&(n=i.CkcMessage,e=!0),i.License&&(n=i.License,e=!0)}catch(e){}e&&(t.data=Se(Ke(n)))}},Xl.muxFairPlayRequest=function(e,t){Jl(e,t)},Xl.expressplayFairPlayRequest=function(e,t){if(2===e){var n=t.drmInfo;n&&Pr(n.keySystem)&&Jl(e,t)}},Xl.conaxFairPlayRequest=function(e,t){Jl(e,t)},Xl.ezdrmFairPlayRequest=function(e,t){Jl(e,t)},Xl.verimatrixFairPlayRequest=function(e,t){2===e&&(e=t.drmInfo)&&Pr(e.keySystem)&&(e=ze(e=Te(t.body)),t.headers["Content-Type"]="application/x-www-form-urlencoded",t.body=Be("spc="+e))},Xl.muxInitDataTransform=function(e,t,n){return Zl(e,t,n)},Xl.expressplayInitDataTransform=function(e,t,n){return Zl(e,t,n)},Xl.conaxInitDataTransform=function(t,n,i){if("skd"!==n)return t;n=i.serverCertificate,i=Ue(t).split("skd://").pop().split("?").shift(),i=e.atob(i);var r=new ArrayBuffer(2*i.length);r=Ae(r);for(var a=0,o=i.length;ai.endTime?Eh:Ah;this.g.set(i,a);for(var o=l(this.m),s=o.next();!s.done;s=o.next())(s=s.value).wd==r&&s.vd==a&&s.gd(i,t)}}};var Th=1,Ah=2,Eh=3;function xh(e,t,n){var i,r,a,o,s,u,l;return L(function(h){switch(h.g){case 1:var c=new re(e).vb.split("/").pop().split(".");return i=1==c.length?"":c.pop().toLowerCase(),(r=Ch.get(i))?h.return(r):(a=0,o=Zr([e],n),S(h,2),o.method="HEAD",_(h,t.request(a,o).promise,4));case 4:s=h.h,r=s.headers["content-type"],A(h,3);break;case 2:if(!(u=E(h))||1002!=u.code&&1001!=u.code){h.A(3);break}return o.method="GET",_(h,t.request(a,o).promise,6);case 6:l=h.h,r=l.headers["content-type"];case 3:return h.return(r?r.toLowerCase().split(";").shift():"")}})}for(var Ch=(new Map).set("mp4","video/mp4").set("m4v","video/mp4").set("m4a","audio/mp4").set("webm","video/webm").set("weba","audio/webm").set("mkv","video/webm").set("ts","video/mp2t").set("ogv","video/ogg").set("ogg","audio/ogg").set("mpg","video/mpeg").set("mpeg","video/mpeg").set("mov","video/quicktime").set("m3u8","application/x-mpegurl").set("mpd","application/dash+xml").set("ism","application/vnd.ms-sstr+xml").set("mp3","audio/mpeg").set("aac","audio/aac").set("flac","audio/flac").set("wav","audio/wav").set("sbv","text/x-subviewer").set("srt","text/srt").set("vtt","text/vtt").set("webvtt","text/vtt").set("ttml","application/ttml+xml").set("lrc","application/x-subtitle-lrc").set("ssa","text/x-ssa").set("ass","text/x-ssa").set("jpeg","image/jpeg").set("jpg","image/jpeg").set("png","image/png").set("svg","image/svg+xml").set("webp","image/webp").set("avif","image/avif").set("html","text/html").set("htm","text/html"),kh={ach:"Lwo",ady:"Адыгэбзэ",af:"Afrikaans","af-NA":"Afrikaans (Namibia)","af-ZA":"Afrikaans (South Africa)",ak:"Tɕɥi",ar:"العربية","ar-AR":"العربية","ar-MA":"العربية","ar-SA":"العربية (السعودية)","ay-BO":"Aymar aru",az:"Azərbaycan dili","az-AZ":"Azərbaycan dili","be-BY":"Беларуская",bg:"Български","bg-BG":"Български",bn:"বাংলা","bn-IN":"বাংলা (ভারত)","bn-BD":"বাংলা(বাংলাদেশ)","bs-BA":"Bosanski",ca:"Català","ca-ES":"Català",cak:"Maya Kaqchikel","ck-US":"ᏣᎳᎩ (tsalagi)",cs:"Čeština","cs-CZ":"Čeština",cy:"Cymraeg","cy-GB":"Cymraeg",da:"Dansk","da-DK":"Dansk",de:"Deutsch","de-AT":"Deutsch (Österreich)","de-DE":"Deutsch (Deutschland)","de-CH":"Deutsch (Schweiz)",dsb:"Dolnoserbšćina",el:"Ελληνικά","el-GR":"Ελληνικά",en:"English","en-GB":"English (UK)","en-AU":"English (Australia)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-IN":"English (India)","en-PI":"English (Pirate)","en-UD":"English (Upside Down)","en-US":"English (US)","en-ZA":"English (South Africa)","en@pirate":"English (Pirate)",eo:"Esperanto","eo-EO":"Esperanto",es:"Español","es-AR":"Español (Argentine)","es-419":"Español (Latinoamérica)","es-CL":"Español (Chile)","es-CO":"Español (Colombia)","es-EC":"Español (Ecuador)","es-ES":"Español (España)","es-LA":"Español (Latinoamérica)","es-NI":"Español (Nicaragua)","es-MX":"Español (México)","es-US":"Español (Estados Unidos)","es-VE":"Español (Venezuela)",et:"eesti keel","et-EE":"Eesti (Estonia)",eu:"Euskara","eu-ES":"Euskara",fa:"فارسی","fa-IR":"فارسی","fb-LT":"Leet Speak",ff:"Fulah",fi:"Suomi","fi-FI":"Suomi","fo-FO":"Føroyskt",fr:"Français","fr-CA":"Français (Canada)","fr-FR":"Français (France)","fr-BE":"Français (Belgique)","fr-CH":"Français (Suisse)","fy-NL":"Frysk",ga:"Gaeilge","ga-IE":"Gaeilge (Gaelic)",gl:"Galego","gl-ES":"Galego","gn-PY":"Avañe'ẽ","gu-IN":"ગુજરાતી","gx-GR":"Ἑλληνική ἀρχαία",he:"עברית‏","he-IL":"עברית‏",hi:"हिन्दी","hi-IN":"हिन्दी",hr:"Hrvatski","hr-HR":"Hrvatski",hsb:"Hornjoserbšćina",ht:"Kreyòl",hu:"Magyar","hu-HU":"Magyar","hy-AM":"Հայերեն",id:"Bahasa Indonesia","id-ID":"Bahasa Indonesia",is:"Íslenska","is-IS":"Íslenska (Iceland)",it:"Italiano","it-IT":"Italiano",ja:"日本語","ja-JP":"日本語","jv-ID":"Basa Jawa","ka-GE":"ქართული","kk-KZ":"Қазақша",km:"ភាសាខ្មែរ","km-KH":"ភាសាខ្មែរ",kab:"Taqbaylit",kn:"ಕನ್ನಡ","kn-IN":"ಕನ್ನಡ (India)",ko:"한국어","ko-KR":"한국어 (韩国)",ku:"Kurdî","ku-TR":"Kurdî",la:"Latin","la-VA":"Latin",lb:"Lëtzebuergesch","li-NL":"Lèmbörgs",lt:"Lietuvių","lt-LT":"Lietuvių",lv:"Latviešu","lv-LV":"Latviešu",mai:"मैथिली, মৈথিলী","mg-MG":"Malagasy",mk:"Македонски","mk-MK":"Македонски (Македонски)",ml:"മലയാളം","ml-IN":"മലയാളം","mn-MN":"Монгол",mr:"मराठी","mr-IN":"मराठी",ms:"Bahasa Melayu","ms-MY":"Bahasa Melayu",mt:"Malti","mt-MT":"Malti",my:"ဗမာစကာ",nb:"Norsk (bokmål)","nb-NO":"Norsk (bokmål)",ne:"नेपाली","ne-NP":"नेपाली",nl:"Nederlands","nl-BE":"Nederlands (België)","nl-NL":"Nederlands (Nederland)","nn-NO":"Norsk (nynorsk)",no:"Norsk",oc:"Occitan","or-IN":"ଓଡ଼ିଆ",pa:"ਪੰਜਾਬੀ","pa-IN":"ਪੰਜਾਬੀ (ਭਾਰਤ ਨੂੰ)",pl:"Polski","pl-PL":"Polski","ps-AF":"پښتو",pt:"Português","pt-BR":"Português (Brasil)","pt-PT":"Português (Portugal)","qu-PE":"Qhichwa","rm-CH":"Rumantsch",ro:"Română","ro-RO":"Română",ru:"Русский","ru-RU":"Русский","sa-IN":"संस्कृतम्","se-NO":"Davvisámegiella","si-LK":"පළාත",sk:"Slovenčina","sk-SK":"Slovenčina (Slovakia)",sl:"Slovenščina","sl-SI":"Slovenščina","so-SO":"Soomaaliga",sq:"Shqip","sq-AL":"Shqip",sr:"Српски","sr-RS":"Српски (Serbia)",su:"Basa Sunda",sv:"Svenska","sv-SE":"Svenska",sw:"Kiswahili","sw-KE":"Kiswahili",ta:"தமிழ்","ta-IN":"தமிழ்",te:"తెలుగు","te-IN":"తెలుగు",tg:"забо́ни тоҷикӣ́","tg-TJ":"тоҷикӣ",th:"ภาษาไทย","th-TH":"ภาษาไทย (ประเทศไทย)",tl:"Filipino","tl-PH":"Filipino",tlh:"tlhIngan-Hol",tr:"Türkçe","tr-TR":"Türkçe","tt-RU":"татарча",uk:"Українська","uk-UA":"Українська",ur:"اردو","ur-PK":"اردو",uz:"O'zbek","uz-UZ":"O'zbek",vi:"Tiếng Việt","vi-VN":"Tiếng Việt","xh-ZA":"isiXhosa",yi:"ייִדיש","yi-DE":"ייִדיש (German)",zh:"中文","zh-HANS":"中文简体","zh-HANT":"中文繁體","zh-CN":"中文(中国)","zh-HK":"中文(香港)","zh-SG":"中文(新加坡)","zh-TW":"中文(台灣)","zu-ZA":"isiZulu"},Ih=l(Object.keys(kh)),Mh=Ih.next();!Mh.done;Mh=Ih.next()){var Ph=Mh.value;kh[Ph.toLowerCase()]=kh[Ph]}function Lh(e,t){if(e.lineBreak)return"\n";if(e.nestedCues.length)return e.nestedCues.map(function(t){return Lh(t,e)}).join("");if(!e.payload)return e.payload;var n=[],i=e.fontWeight>=ci,r=e.fontStyle==pi,a=e.textDecoration.includes(gi);return i&&n.push(["b"]),r&&n.push(["i"]),a&&n.push(["u"]),""==(r=e.color)&&t&&(r=t.color),i="",(r=Dh(r))&&(i+="."+r),""==(r=e.backgroundColor)&&t&&(r=t.backgroundColor),(t=Dh(r))&&(i+=".bg_"+t),i&&n.push(["c",i]),n.reduceRight(function(e,t){var n=l(t);return"<"+(t=n.next().value)+(void 0===(n=n.next().value)?"":n)+">"+e+""},e.payload)}function Dh(e){var t=(e=e.toLowerCase()).replace(/\s/g,"").match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i);switch(t?e="#"+(256|parseInt(t[1],10)).toString(16).slice(1)+(256|parseInt(t[2],10)).toString(16).slice(1)+(256|parseInt(t[3],10)).toString(16).slice(1):e.startsWith("#")&&7>>0).toString()}if(e.startTime>=e.endTime)return null;var n=new VTTCue(e.startTime,e.endTime,e.payload);n.id=t(e.startTime.toString())+t(e.endTime.toString())+t(e.payload),n.lineAlign=e.lineAlign,n.positionAlign=e.positionAlign,e.size&&(n.size=e.size);try{n.align=e.textAlign}catch(e){}return"center"==e.textAlign&&"center"!=n.align&&(n.align="middle"),"vertical-lr"==e.writingMode?n.vertical="lr":"vertical-rl"==e.writingMode&&(n.vertical="rl"),1==e.lineInterpretation&&(n.snapToLines=!1),null!=e.line&&(n.line=e.line),null!=e.position&&(n.position=e.position),n}function Uh(e,t){var n=Rh(t),i=[];t=e.cues?Array.from(e.cues):[];for(var r=(n=l(n)).next(),a={};!r.done;a={Ed:void 0},r=n.next())a.Ed=r.value,!t.some(function(e){return function(t){return t.startTime==e.Ed.startTime&&t.endTime==e.Ed.endTime&&t.text==e.Ed.payload}}(a))&&a.Ed.payload&&(r=Oh(a.Ed))&&i.push(r);for(n=(t=l(t=i.slice().sort(function(e,t){return e.startTime!=t.startTime?e.startTime-t.startTime:e.endTime!=t.endTime?e.endTime-t.startTime:"line"in VTTCue.prototype?i.indexOf(t)-i.indexOf(e):i.indexOf(e)-i.indexOf(t)}))).next();!n.done;n=t.next())e.addCue(n.value)}function Bh(e,t){var n=!1;"disabled"===e.mode&&(n=!0,e.mode="hidden");for(var i=0;in&&"hidden"===a.track.mode&&(n=r)}for(r=(i=l(t.h)).next();!r.done;r=i.next())r=(a=l(r.value)).next().value,a=a.next().value,r!==n&&"disabled"!==a.track.mode&&(a.track.mode="disabled");t.g!==n&&(t.g=n,-1i,d=h?h.bk:null;h&&(o.push(h.Qg),h.nd&&o.push(h.nd),c||(a=!0,e.l.delete(u),h=null)),c&&(s.push(u),h?Kh(e,d)||(a=!0):(qh(e,u,r),d=(h=e.l.get(u)).bk,a=!0)),0e.u&&(s=32),i=0>i?100+i/s*100:i/s*100),1==o&&(a.position="absolute",n.writingMode==ri?(a.width="100%",n.lineAlign==oi?a.top=i+"%":"end"==n.lineAlign&&(a.bottom=100-i+"%")):"vertical-lr"==n.writingMode?(a.height="100%",n.lineAlign==oi?a.left=i+"%":"end"==n.lineAlign&&(a.right=100-i+"%")):(a.height="100%",n.lineAlign==oi?a.right=i+"%":"end"==n.lineAlign&&(a.left=100-i+"%")))),a.lineHeight=n.lineHeight,e=function(e){var t=e.direction,n=e.positionAlign;return e=e.textAlign,n!==Qn?n:"left"===e||"start"===e&&t===ii||"end"===e&&"rtl"===t?"line-left":"right"===e||"start"===e&&"rtl"===t||"end"===e&&t===ii?"line-right":"center"}(n),"line-left"==e?(a.cssFloat="left",null!==n.position&&(a.position="absolute",n.writingMode==ri?(a.left=n.position+"%",a.width="auto"):a.top=n.position+"%")):"line-right"==e?(a.cssFloat="right",null!==n.position&&(a.position="absolute",n.writingMode==ri?(a.right=100-n.position+"%",a.width="auto"):a.bottom=n.position+"%")):null!==n.position&&50!=n.position&&(a.position="absolute",n.writingMode==ri?(a.left=n.position+"%",a.width="auto"):a.top=n.position+"%"),a.textAlign=n.textAlign,a.textDecoration=n.textDecoration.join(" "),a.writingMode=n.writingMode,"writingMode"in document.documentElement.style&&a.writingMode==n.writingMode||(a.webkitWritingMode=n.writingMode),n.size&&(n.writingMode==ri?a.width=n.size+"%":a.height=n.size+"%")}(e,a,t,n,i),n=null,t.region&&t.region.id){var o=t.region,s=e.u===4/3?2.5:1.9;if(n=o.id+"_"+o.width+"x"+o.height+(o.heightUnits==qt?"%":"px")+"-"+o.viewportAnchorX+"x"+o.viewportAnchorY+(o.viewportAnchorUnits==qt?"%":"px"),e.F.has(n))n=e.F.get(n);else{r=os("span");var u=o.heightUnits==qt?"%":"px",l=o.widthUnits==qt?"%":"px",h=o.viewportAnchorUnits==qt?"%":"px";r.id="shaka-text-region---"+n,r.classList.add("shaka-text-region"),r.style.position="absolute";var c=o.height,d=o.width;2===o.heightUnits&&(c=5.33*o.height,u="%"),2===o.widthUnits&&(d=o.width*s,l="%"),r.style.height=c+u,r.style.width=d+l,2===o.viewportAnchorUnits?(s=o.viewportAnchorY/75*100,u=o.viewportAnchorX/(e.u===4/3?160:210)*100,s-=o.regionAnchorY*c/100,u-=o.regionAnchorX*d/100,r.style.top=s+"%",r.style.left=u+"%"):(r.style.top=o.viewportAnchorY-o.regionAnchorY*c/100+h,r.style.left=o.viewportAnchorX-o.regionAnchorX*d/100+h),0!==o.heightUnits&&0!==o.widthUnits&&0!==o.viewportAnchorUnits&&(o=Math.max(0,Math.min(100-(parseInt(r.style.width.slice(0,-1),10)||0),parseInt(r.style.left.slice(0,-1),10)||0)),r.style.top=Math.max(0,Math.min(100-(parseInt(r.style.height.slice(0,-1),10)||0),parseInt(r.style.top.slice(0,-1),10)||0))+"%",r.style.left=o+"%"),r.style.display="flex",r.style.flexDirection="column",r.style.alignItems="center",r.style.justifyContent="before"==t.displayAlign?"flex-start":"center"==t.displayAlign?"center":"flex-end",e.F.set(n,r),n=r}}r=a,i&&((r=os("span")).classList.add("shaka-text-wrapper"),r.style.backgroundColor=t.backgroundColor,r.style.lineHeight="normal",a.appendChild(r)),e.l.set(t,{Qg:a,bk:r,nd:n})}function Zh(e,t,n,i){i=void 0===i?1:i;var r=(r=new RegExp(/(\d*\.?\d+)([a-z]+|%+)/).exec(e))?{value:Number(r[1]),unit:r[2]}:null;if(!r)return e;switch(e=r.unit,i*=r.value,e){case"%":return i/100*n.clientHeight/t.cellResolution.rows+"px";case"c":return n.clientHeight*i/t.cellResolution.rows+"px";default:return i+e}}function Jh(e,t){this.h=e,this.g=t,this.i=void 0,this.u=!1,this.F=!0,this.l=this.C=!1,this.s=this.m=void 0,this.B=0,this.G=!1,this.D=new At,this.j=null}function Qh(t){return t.g.sessionId||(t.g.sessionId=e.crypto.randomUUID()),{v:t.g.version,sf:t.i,sid:t.g.sessionId,cid:t.g.contentId,mtp:t.h.getBandwidthEstimate()/1e3}}function $h(e,t,n){n=void 0===n?{}:n;var i=void 0===i?e.g.useHeaders:i;if(e.g.enabled)if(e=function(e,t){t=void 0===t?{}:t,Object.assign(t,Qh(e)),t.pr=e.h.Xa();var n=t.ot===rc||t.ot===ac;return e.C&&n&&(t.bs=!0,t.su=!0,e.C=!1),null==t.su&&(t.su=e.F),t.v===sc&&(e.h.T()&&(t.ltc=e.h.rf()),null!=(n=!e.G&&e.s&&e.m?e.s-(e.B||e.m):void 0)&&(t.msd=n,e.G=!0)),function(e,t){var n=e.g.includeKeys;return n.length?Object.keys(t).reduce(function(e,i){return n.includes(i)&&(e[i]=t[i]),e},{}):t}(e,t)}(e,n),i)i=function(e){for(var t=Object.keys(e),n={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,ltc:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,msd:2,bs:3,rtp:3},o=(t=l(t)).next();!o.done;o=t.next())r[null!=a[o=o.value]?a[o]:1][o]=e[o];for(e=0;e=n}))?1e3*(e.end-n):0}function tc(e){function t(e){return 100*n(e/100)}function n(e){return Math.round(e)}function i(e){return!Number.isNaN(e)&&null!=e&&""!==e&&!1!==e}for(var r=[],a={br:n,d:n,bl:t,dl:t,mtp:t,nor:function(e){return encodeURIComponent(e)},rtp:t,tb:n},o=Object.keys(e||{}).sort(),s=(o=l(o)).next();!s.done;s=o.next()){var u=e[s=s.value];if(i(u)&&("v"!==s||1!==u)&&("pr"!=s||1!==u)){var h,c=a[s];c&&(u=c(u)),h="string"==(c=typeof u)&&"ot"!==s&&"sf"!==s&&"st"!==s?s+"="+JSON.stringify(u):"boolean"===c?s:"symbol"===c?s+"="+u.description:s+"="+u,r.push(h)}}return r.join(",")}function nc(e,t){return!t||e.includes("offline:")?e:((e=new re(e)).g.set("CMCD",t),e.toString())}(i=Fh.prototype).configure=function(){},i.remove=function(e,t){return!!this.i&&(this.h.has(this.g)&&Bh(this.h.get(this.g).track,function(n){return n.startTimee}),!0)},i.append=function(e){this.h.has(this.g)&&Uh(this.h.get(this.g).track,e)},i.destroy=function(){return this.i&&(this.j&&this.C(),this.i=null),this.l&&(this.l.release(),this.l=null),Promise.resolve()},i.isTextVisible=function(){return this.u},i.setTextVisibility=function(e){if(this.u=e,this.h.has(this.g)){var t=this.h.get(this.g).track;"disabled"!==t.mode&&(e=e?"showing":"hidden",t.mode!==e&&(t.mode=e))}else if(this.i&&3===this.i.m)if(t=Array.from(this.i.h.textTracks).filter(function(e){return["captions","subtitles","forced"].includes(e.kind)}),e){e=null;for(var n=(t=l(t)).next();!n.done;n=t.next()){if("showing"===(n=n.value).mode){e=null;break}e||"hidden"!==n.mode||(e=n)}e&&(e.mode="showing")}else for(t=(e=l(t)).next();!t.done;t=e.next())"showing"===(t=t.value).mode&&(t.mode="hidden")},i.setTextLanguage=function(){},i.enableTextDisplayer=function(){!this.j&&this.i&&2===this.i.m&&(this.j=this.i.h,this.l.ra(this.i,"unloading",this.C),this.l.o(this.i,"textchanged",this.m),this.l.o(this.j.textTracks,"change",this.B),this.m())},H("shaka.text.NativeTextDisplayer",Fh),Fh.prototype.enableTextDisplayer=Fh.prototype.enableTextDisplayer,Fh.prototype.setTextLanguage=Fh.prototype.setTextLanguage,Fh.prototype.setTextVisibility=Fh.prototype.setTextVisibility,Fh.prototype.isTextVisible=Fh.prototype.isTextVisible,Fh.prototype.destroy=Fh.prototype.destroy,Fh.prototype.append=Fh.prototype.append,Fh.prototype.remove=Fh.prototype.remove,Fh.prototype.configure=Fh.prototype.configure,(i=Gh.prototype).configure=function(){},i.remove=function(e,t){return!!this.g&&(Bh(this.g,function(n){return n.startTimee}),!0)},i.append=function(e){this.g&&Uh(this.g,e)},i.destroy=function(){return this.g&&(Bh(this.g,function(){return!0}),this.g.mode="disabled"),this.g=this.h=null,Promise.resolve()},i.isTextVisible=function(){return!!this.g&&"showing"==this.g.mode},i.setTextVisibility=function(e){e&&!this.g&&Hh(this),this.g&&(this.g.mode=e?"showing":"hidden")},i.setTextLanguage=function(){},i.enableTextDisplayer=function(){Hh(this)},H("shaka.text.SimpleTextDisplayer",Gh),Gh.prototype.enableTextDisplayer=Gh.prototype.enableTextDisplayer,Gh.prototype.setTextLanguage=Gh.prototype.setTextLanguage,Gh.prototype.setTextVisibility=Gh.prototype.setTextVisibility,Gh.prototype.isTextVisible=Gh.prototype.isTextVisible,Gh.prototype.destroy=Gh.prototype.destroy,Gh.prototype.append=Gh.prototype.append,Gh.prototype.remove=Gh.prototype.remove,Gh.prototype.configure=Gh.prototype.configure,(i=Vh.prototype).configure=function(){},i.remove=function(){},i.append=function(){},i.destroy=function(){},i.isTextVisible=function(){return!1},i.setTextVisibility=function(){},i.setTextLanguage=function(){},i.enableTextDisplayer=function(){},H("shaka.text.StubTextDisplayer",Vh),Vh.prototype.enableTextDisplayer=Vh.prototype.enableTextDisplayer,Vh.prototype.setTextLanguage=Vh.prototype.setTextLanguage,Vh.prototype.setTextVisibility=Vh.prototype.setTextVisibility,Vh.prototype.isTextVisible=Vh.prototype.isTextVisible,Vh.prototype.destroy=Vh.prototype.destroy,Vh.prototype.append=Vh.prototype.append,Vh.prototype.remove=Vh.prototype.remove,Vh.prototype.configure=Vh.prototype.configure,(i=Wh.prototype).configure=function(e){this.C=e,zh(this),Yh(this,!0)},i.append=function(e){for(var t=[].concat(h(this.h)),n=(e=l(Nh(e))).next(),i={};!n.done;i={Pg:void 0},n=e.next())i.Pg=n.value,t.some(function(e){return function(t){return Xn(t,e.Pg)}}(i))||this.h.push(i.Pg);this.h.length&&zh(this),Yh(this)},i.destroy=function(){return this.g?(this.g.parentElement&&this.s.removeChild(this.g),this.g=null,this.m=!1,this.h=[],this.B&&(this.B.stop(),this.B=null),this.l.clear(),this.i&&(this.i.release(),this.i=null),this.D&&(this.D.disconnect(),this.D=null),Promise.resolve()):Promise.resolve()},i.remove=function(e,t){if(!this.g)return!1;var n=this.h.length;return this.h=this.h.filter(function(n){return n.startTime=t}),Yh(this,n>this.h.length),this.h.length||zh(this),!0},i.isTextVisible=function(){return this.m},i.setTextVisibility=function(e){(this.m=e)?(this.g.parentElement||this.s.appendChild(this.g),Yh(this,!0)):this.g.parentElement&&this.s.removeChild(this.g)},i.setTextLanguage=function(e){e&&"und"!=e?this.g.setAttribute("lang",e):this.g.setAttribute("lang","")},i.enableTextDisplayer=function(){},H("shaka.text.UITextDisplayer",Wh),Wh.prototype.enableTextDisplayer=Wh.prototype.enableTextDisplayer,Wh.prototype.setTextLanguage=Wh.prototype.setTextLanguage,Wh.prototype.setTextVisibility=Wh.prototype.setTextVisibility,Wh.prototype.isTextVisible=Wh.prototype.isTextVisible,Wh.prototype.remove=Wh.prototype.remove,Wh.prototype.destroy=Wh.prototype.destroy,Wh.prototype.append=Wh.prototype.append,Wh.prototype.configure=Wh.prototype.configure,H("shaka.text.WebVttGenerator",function(){}),Jh.prototype.setMediaElement=function(e){this.j=e,function(e){e.D.ra(e.j,"play",function(){e.m||(e.m=Date.now())}),e.D.ra(e.j,"playing",function(){e.s||(e.s=Date.now())})}(this)},Jh.prototype.configure=function(e){this.g=e};var ic="a",rc="v",ac="av",oc="tt",sc=2,uc="d",lc="ld",hc="h",cc="lh";function dc(e){this.h=e,this.g=null}function pc(e){return!e||"false"!==e.toLowerCase()&&(/^[-0-9]/.test(e)?parseInt(e,10):e.replace(/["]+/g,""))}H("shaka.util.CmcdManager.StreamingFormat",{DASH:uc,Wm:lc,HLS:hc,Xm:cc,on:"s",OTHER:"o"}),(i=dc.prototype).configure=function(e){this.h=e},i.Ti=function(){return this.h.enabled&&this.h.applyMaximumSuggestedBitrate&&this.g&&this.g.has(gc)?1e3*this.g.get(gc):null},i.Si=function(){return this.h.enabled&&this.g&&this.g.has(fc)?1e3*this.g.get(fc):null},i.Yk=function(){return this.h.enabled&&this.g&&this.g.has(mc)?this.g.get(mc):null},i.Zk=function(){return this.h.enabled&&this.g&&this.g.has(vc)?this.g.get(vc):null},i.getBandwidthEstimate=function(e){var t=this.Si();if(!t)return e;var n=this.h.estimatedThroughputWeightRatio;return 0=n?e*(1-n)+t*n:e},H("shaka.util.CmsdManager",dc),dc.prototype.getBandwidthEstimate=dc.prototype.getBandwidthEstimate,dc.prototype.getRoundTripTime=dc.prototype.Zk,dc.prototype.getResponseDelay=dc.prototype.Yk,dc.prototype.getEstimatedThroughput=dc.prototype.Si,dc.prototype.getMaxBitrate=dc.prototype.Ti;var fc="etp",gc="mb",mc="rd",vc="rtt";function yc(){this.g=null,this.h=[]}function bc(e,t){return L(function(n){if(1==n.g)return e.g?_(n,new Promise(function(t){return e.h.push(t)}),2):n.A(2);e.g=t,w(n)})}function _c(t,n,i){n=void 0===n?null:n,$.call(this);var r=this;this.m=Ad,this.h=null,this.Pe=n,this.Y=!1,this.Ue=new At,this.Je=new At,this.j=new At,this.ic=new At,this.Nd=new At,this.F=this.G=this.D=this.I=null,this.Ve=0,this.ba=new yc,this.N=this.Z=this.U=this.i=this.zc=this.H=this.l=this.Ge=this.P=this.zi=this.qa=this.K=this.Ya=this.Ia=this.He=this.O=this.La=this.J=this.Mb=null,this.$=!1,this.Ta=this.u=null,this.Oe=1e9,this.Te=[],this.eb=[],this.zg=-1,this.g=qc(this),this.Bg={streaming:{inaccurateManifestTolerance:0,segmentPrefetchLimit:2,updateIntervalSeconds:.1,maxDisabledTime:1,retryParameters:{baseDelay:100}},manifest:{dash:{autoCorrectDrift:!1},retryParameters:{baseDelay:100}},drm:{retryParameters:{baseDelay:100}}},this.R=null,this.Xe=-1,this.fc=null,this.sa={width:1/0,height:1/0},this.Ne=new $a(this.g,this.sa,null),this.Re=[],this.B=null,this.L=this.g.adaptationSetCriteriaFactory(),this.L.configure({language:this.g.preferredAudioLanguage,role:this.g.preferredVariantRole,channelCount:0,Nc:this.g.preferredVideoHdrLevel,spatialAudio:this.g.preferSpatialAudio,videoLayout:this.g.preferredVideoLayout,Wc:this.g.preferredAudioLabel,Vd:this.g.preferredVideoLabel,codecSwitchingStrategy:this.g.mediaSource.codecSwitchingStrategy,audioCodec:"",Xd:"",Ye:0,preferredAudioCodecs:this.g.preferredAudioCodecs,preferredAudioChannelCount:this.g.preferredAudioChannelCount}),this.Od=this.g.preferredTextLanguage,this.Me=this.g.preferredTextRole,this.Le=this.g.preferForcedSubs,this.Ke=[],i&&i(this),this.K=function(e){return new Jh({getBandwidthEstimate:function(){return e.u?e.u.getBandwidthEstimate():NaN},bc:function(){return e.bc()},getCurrentTime:function(){return e.h?e.h.currentTime:0},Xa:function(){return e.Xa()},Jb:function(){return e.Jb()},qb:function(){return e.qb()},T:function(){return e.T()},rf:function(){return e.rf()}},e.g.cmcd)}(this),this.qa=new dc(this.g.cmsd),this.I=Oc(this),this.Qd=this.na=this.ua=this.C=null,this.Dg=!1,this.Ag=[],this.Cg=new zi(function(){return L(function(e){return 1==e.g?r.na?_(e,r.ac(r.Qd,!0),3):e.A(0):4!=e.g?_(e,r.load(r.na),4):(r.Dg?r.Qd.pause():r.Qd.play(),r.na=null,r.Dg=!1,void w(e))})}),Id&&(this.C=Id(),this.C.configure(this.g.ads),this.Nd.o(this.C,"ad-content-pause-requested",function(e){var t;return L(function(n){if(1==n.g)return r.Cg.stop(),r.na?n.A(0):(r.Qd=r.h,r.Dg=r.isEnded(),t=e.saveLivePosition||!1,_(n,r.Ni(!0,t),3));r.na=n.h,w(n)})}),this.Nd.o(this.C,"ad-content-resume-requested",function(e){if(e=e.offset||0,r.na){var t=r.na;t.m&&e&&("number"==typeof t.m?t.m+=e:t.m.setTime(t.m.getTime()+1e3*e))}r.Cg.X(.1)}),this.Nd.o(this.C,"ad-content-attach-requested",function(){return L(function(e){return r.h||!r.Qd?e.A(0):_(e,r.ac(r.Qd,!0),0)})})),Md&&(this.ua=Md(this),this.ua.configure(this.g.queue)),this.Ue.o(e,"online",function(){fd(r),r.Th()}),this.Qe=new zi(function(){for(var e=Date.now()/1e3,t=!1,n=!0,i=l(r.i.variants),a=i.next();!a.done;a=i.next())0<(a=a.value).disabledUntilTime&&a.disabledUntilTime<=e&&(a.disabledUntilTime=0,t=!0),0o&&(o=a);for(var s=l(r.frames),u=s.next();!u.done;u=s.next())Nc(e,a,o,"org.id3",u.value);e.C&&e.C.onHlsTimedMetadata(r,a)}},Nl:function(t){e.Ya&&el(e.Ya,{schemeIdUri:t.schemeIdUri,startTime:t.startTime,endTime:t.endTime,id:String(t.id),emsg:t})},onEvent:function(t){return e.dispatchEvent(t)},Pl:function(){e.H&&e.H.update&&e.H.update()}},e.P,e.g.mediaSource),n=e.g.manifest,i=n.segmentRelativeVttTiming,t.Ia=i,_(r,t.J,2);e.G=t,w(r)})}function Dc(e,t,n){function i(){return Qc(e)}if(e.j.o(t,"playing",i),e.j.o(t,"pause",i),e.j.o(t,"ended",i),e.j.o(t,"ratechange",function(){var t=e.h.playbackRate;0!=t&&(e.J&&(e.J.set(t),e.m==Ed&&e.u.playbackRateChanged(t),Jc(e,t)),t=Sc("ratechange"),e.dispatchEvent(t))}),t.remote&&(e.j.o(t.remote,"connect",function(){e.l&&"connected"==t.remote.state&&hd(e),od(e)}),e.j.o(t.remote,"connecting",function(){return od(e)}),e.j.o(t.remote,"disconnect",function(){return L(function(n){if(1==n.g)return e.l&&"disconnected"==t.remote.state?_(n,Bl(e.l),3):n.A(2);2!=n.g&&hd(e),od(e),w(n)})})),t.audioTracks&&(e.j.o(t.audioTracks,"addtrack",function(){return od(e)}),e.j.o(t.audioTracks,"removetrack",function(){return od(e)}),e.j.o(t.audioTracks,"change",function(){return od(e)})),t.videoTracks&&(e.j.o(t.videoTracks,"addtrack",function(){return od(e)}),e.j.o(t.videoTracks,"removetrack",function(){return od(e)}),e.j.o(t.videoTracks,"change",function(){return od(e)})),t.textTracks){var r=function(){e.m===xd&&e.s instanceof Fh&&hd(e),od(e)};e.j.o(t.textTracks,"addtrack",function(t){if(t.track)switch(t=t.track,t.kind){case"metadata":!function(e,t){if("metadata"==t.kind){t.mode="hidden",e.j.o(t,"cuechange",function(){if(t.activeCues)for(var n=l(t.activeCues),i=n.next();!i.done;i=n.next())i=i.value,Nc(e,i.startTime,i.endTime,i.type,i.value),e.C&&e.C.onCueMetadataChange(i.value);if(t.cues){n=[];for(var r=(i=l(t.cues)).next(),a={};!r.done;a={Gc:void 0},r=i.next())a.Gc=r.value,"com.apple.quicktime.HLS"==a.Gc.type&&null!=a.Gc.startTime&&(r=n.find(function(e){return function(t){return t.startTime==e.Gc.startTime&&t.endTime==e.Gc.endTime}}(a)),r||(r={startTime:a.Gc.startTime,endTime:a.Gc.endTime,values:[]},n.push(r)),r.values.push(a.Gc.value));for(i=(n=l(n)).next();!i.done;i=n.next())(i=i.value).values.some(function(e){return"X-ASSET-URI"==e.key||"X-ASSET-LIST"==e.key})&&e.C&&(i.values.push({key:"CUE",description:"",data:0!=i.startTime||e.T()?"ONCE":"ONCE,PRE",mimeType:null,pictureType:null}),e.C.onHLSInterstitialMetadata(e,e.h,i))}});var n=new zi(function(){for(var t=function(e){return Array.from(e.h.textTracks).filter(function(e){return"metadata"==e.kind})}(e),n=(t=l(t)).next();!n.done;n=t.next())n.value.mode="hidden"}).Ka().X(.5);e.Ke.push(function(){n.stop()})}}(e,t);break;case"chapters":!function(e,t){if(t&&"chapters"==t.kind){t.mode="hidden";var n=new zi(function(){t.mode="hidden"}).Ka().X(.5);e.Ke.push(function(){n.stop()})}}(e,t);break;default:r()}}),e.j.o(t.textTracks,"removetrack",r),e.j.o(t.textTracks,"change",r),"keep"!==e.g.streaming.crossBoundaryStrategy&&(e.j.o(t,"waiting",function(){e.l&&jl(e.l)}),e.j.o(t,"timeupdate",function(){e.l&&jl(e.l)}))}"none"!=t.preload&&e.j.ra(t,"loadedmetadata",function(){e.B.F=Date.now()/1e3-n})}function Rc(e,t,n){t=(new Map).set("startTime",t.startTime).set("endTime",t.endTime).set("metadataType",t.schemeIdUri).set("payload",t.payload),e.dispatchEvent(Sc(n,t))}function Nc(e,t,n,i,r){e.Ia&&((t={schemeIdUri:i,startTime:t,endTime:n||1/0,id:"",payload:r}).id=JSON.stringify(t),el(e.Ia,t))}function Oc(e,t){function n(n){t()?t().dispatchEvent(n):e.dispatchEvent(n)}function i(e){t()?fh(t(),!0,e):e()}t||(t=function(){return null});var r=new Xr(function(n,i,r,a,o){var s=t()?t().j:e.u;s&&s.segmentDownloaded(n,i,r,a,o)},function(t,r,a){n(Sc("downloadheadersreceived",r=(new Map).set("headers",t).set("request",r).set("requestType",a))),i(function(){if(e.qa){var n=e.qa;if(n.h.enabled){var i=t["cmsd-static"];if(i)try{var r=new Map,a=i.split(",");for(i=0;i=n}))?1e3*(e.end-n):NaN}(i,d.type),h.ot!==oc)){var f=ec(i,d.type);h.dl=p?f/Math.abs(p):f}if(d.bandwidth&&(h.br=d.bandwidth/1e3),d.segmentIndex&&u){var g=d.segmentIndex.cc(u.endTime,!0,0>p);if(g){var m=g.next().value;if(m&&m!=u){if(s&&!en(u.S(),m.S())){var v=m.S()[0],y=new URL(v),b=new URL(s);if(y.origin!==b.origin)var _=v;else{for(var w=y.pathname.split("/").slice(1),S=b.pathname.split("/").slice(1,-1);w[0]===S[0];)w.shift(),S.shift();for(;S.length;)S.shift(),w.unshift("..");_=w.join("/")}h.nor=_}if((m.startByte||m.endByte)&&(u.startByte!=m.startByte||u.endByte!=m.endByte)){var T=m.startByte+"-";m.endByte&&(T+=m.endByte),h.nrr=T}}}var A=i.h.Xa()||1,E=ec(i,d.type)||500,x=d.bandwidth,C=x?x*(u.endTime-u.startTime)/1e3/(E/A/1e3)*i.g.rtpSafetyFactor:NaN;isNaN(C)||(h.rtp=C)}}c&&h.ot!==oc&&(h.tb=function(e,t){var n=e.h.qb();if(!n.length)return NaN;e=n[0];for(var i=(n=l(n)).next();!i.done;i=n.next())"variant"===(i=i.value).type&&i.bandwidth>e.bandwidth&&(e=i);switch(t){case rc:return e.videoBandwidth||NaN;case ic:return e.audioBandwidth||NaN;default:return e.bandwidth}}(i,h.ot)/1e3),$h(i,n,h)}}catch(e){q("CMCD_SEGMENT_ERROR","Could not generate segment CMCD data.",e)}break;case 2:case 5:case 6:$h(i,n,{ot:"k"});break;case 4:$h(i,n,{ot:"o"})}})},function(n,i,r,a){(n=t()?t().l:e.H)&&n.banLocation&&n.banLocation(a)},function(n,i){if(i.data){i=i.data.byteLength;var r=t()?t().getStats():e.B;r&&(dh(r,i),0===n&&(r.dj=i))}});return r.configure(e.g.networking),r}function Uc(e,t,n){e.O=new Za,e.O.g=Ja,Bc(e),Zc(e),e.La=new zi(function(){Fc(e)}),e.g.streaming.rebufferingGoal&&e.La.ya(.25),e.j.o(t,"waiting",function(){return Fc(e)}),e.j.o(t,"canplaythrough",function(){return Fc(e)}),e.j.o(t,"playing",function(){return Fc(e)}),e.j.o(t,"seeked",function(){return Fc(e)}),n&&(e.j.o(t,"stalled",function(){return Fc(e)}),e.j.o(t,"progress",function(){return Fc(e)}),e.j.o(t,"timeupdate",function(){return Fc(e)}))}function Bc(e){var t=e.g.streaming.rebufferingGoal;e.O.i.set(Qa,Math.min(.5,t/2)).set(Ja,t)}function Fc(e){var t=!!e.G&&Ks(e.G),n=e.isEnded()||t||e.F.$i(),i=is(e.h.buffered,e.h.currentTime),r=(t=e.O).i.get(t.g),a=t.g;n=n||i>=r&&0(e=Math.floor(n/3600))?"0":"")+e+":"+(10>(i=Math.floor(n/60%60))?"0":"")+i+":"+(10>(r=Math.floor(n%60))?"0":"")+r+"."+(100>(n=Math.floor(1e3*n%1e3))?10>n?"00":"0":"")+n}var i=Rh(e);e="WEBVTT\n\n";for(var r=(i=l(i)).next();!r.done;r=i.next())e+=n((r=r.value).startTime)+" --\x3e "+n(r.endTime)+function(e){var t=[];switch(e.textAlign){case"left":t.push("align:left");break;case"right":t.push("align:right");break;case $n:t.push("align:middle");break;case"start":t.push("align:start");break;case"end":t.push("align:end")}switch(e.writingMode){case"vertical-lr":t.push("vertical:lr");break;case"vertical-rl":t.push("vertical:rl")}return t.length?" "+t.join(" "):""}(r)+"\n",e+=r.payload+"\n\n";return e}(t=n.parseMedia(t,e,null,[]),i);throw new Ce(2,2,2014,n)}function qc(e){var t=nh();return t.streaming.failureCallback=function(t){if(e.T()){var n=null;1001==t.code||1002==t.code?(n=1,e.g.streaming.lowLatencyMode&&(n=.1)):1003==t.code&&(n=.1),null!=n&&(t.severity=1,e.Th(n))}},t.textDisplayFactory=function(){var t=Me();return e.Pe&&(document.fullscreenEnabled||"WEBKIT"!==t.Fa())?new Wh(e.h,e.Pe):"track"in document.createElement("track")?new Fh(e):new Vh},t}function Zc(e){var t=e.zf();if(e.B&&e.O&&e.F){if(0==e.g.streaming.rebufferingGoal){var n=e.J;n.j=!1,Xu(n)}else(n=e.J).j=t,Xu(n);if(e.K&&(n=e.K,t||n.u||(n.u=!0),n.u&&t&&(n.C=!0),n.F=t),Qc(e),n=e.g.streaming.liveSync.dynamicTargetLatency.maxAttempts,e.g.streaming.liveSync.dynamicTargetLatency.enabled&&t&&e.Xe=Math.floor(i.end)&&e.xd():Math.floor(n)<=Math.floor(i.start+a)&&e.xd()})}function Qc(e){if(e.B&&e.O){var t=e.B.g,n="playing";e.O.g==Ja?n="buffering":e.isEnded()?n="ended":e.h.paused&&(n="paused");var i=n;if(null==t.g)t.g={timestamp:Date.now()/1e3,state:i,duration:0},t=!0;else{var r=Date.now()/1e3;t.g.duration=r-t.g.timestamp,t.g.state==i?t=!1:(t.h.push(t.g),t.g={timestamp:r,state:i,duration:0},t=!0)}t&&(n=(new Map).set("newstate",n),e.dispatchEvent(Sc("statechanged",n)))}}function $c(e){var t=e.h.playbackRate,n=e.T();if(e.g.streaming.vodDynamicPlaybackRate&&!n){var i=e.g.streaming.vodDynamicPlaybackRateLowBufferRate,r=e.Ri();r<=e.g.streaming.vodDynamicPlaybackRateBufferRatio?t!=i&&e.Uc(i,!1):1==r&&t!==e.J.dd()&&e.xd()}if(n&&(n=e.xa(),Number.isFinite(n.end)&&!(e.h.currentTime1e3*a&&(a=e.g.streaming.liveSync.dynamicTargetLatency.minLatency,e.R=Math.max(e.R-(o-a)/2,a+i),e.fc=Date.now()),r&&null!==e.R&&(s=e.R+i,u=e.R-i),o=n.end-e.h.currentTime,i=0,e.m==xd&&0<(r=e.h.buffered).length&&(i=r.end(r.length-1),i=Math.max(l,i-n.end)),n=e.g.streaming.liveSync.panicMode,r=1e3*e.g.streaming.liveSync.panicThreshold,a=Date.now()-e.O.h,n&&!h&&(h=e.g.streaming.liveSync.minPlaybackRate),n&&h&&a<=r?t!=h&&e.Uc(h,!1):null!=s&&l&&o-i>s?(t!=l&&e.Uc(l,!1),e.fc=null):null!=u&&h&&o-it)&&e.zgt&&(t+=Math.pow(2,32)),t=t.toString(16)),new Ce(2,3,3016,n,t,e.h.error.message)):null}function bd(e,t,n){0=i)})}else t.xe=[]}(e,i),e={Id:t,position:n},0<=(t=(i=i.xe).findIndex(function(e){return e.position>=n}))?i.splice(t,i[t].position==n?1:0,e):i.push(e)}(e.Ge,n,t)},Ei:function(t,n){var i=e.D;if(i.h.parseInbandPsshEnabled&&!i.G&&["audio","video"].includes(t)){t=new Sa(Te(n)),n=0;for(var r=l(t.data),a=r.next();!a.done;a=r.next())n+=a.value.length;if(0==n)i=Promise.resolve();else{for(n=new Uint8Array(n),r=0,a=(t=l(t.data)).next();!a.done;a=t.next())a=a.value,n.set(a,r),r+=a.length;Ia(i,"cenc",n),i=i.m}}else i=Promise.resolve();return i},disableStream:function(t,n){return e.disableStream(t,n)}})}(t),t.l.configure(t.g.streaming),t.m=Ed,t.dispatchEvent(Sc("streaming")),d=i;case 2:for((f=t.l.s)||d||(d=td(t)?t.u.chooseVariant():null),g=[],m=l([(p=f||d).video,p.audio]),v=m.next();!v.done;v=m.next())(y=v.value)&&!y.segmentIndex&&(g.push(y.createSegmentIndex()),y.dependencyStream&&g.push(y.dependencyStream.createSegmentIndex()));if(!(0k&&(A=k),_(O,function(e,t){var n,i,r,a,o;return L(function(s){return 1==s.g?(n=e.audio,i=e.video,r=function(e,t){var n,i,r;return L(function(a){return 1==a.g?e?e.segmentIndex?a.A(2):_(a,e.createSegmentIndex(),2):a.return(null):(i=(n=e.segmentIndex.cc(t))?n.next().value:null)?(r=i.startTime,a.return(r)):a.return(null)})},_(s,r(n,t),2)):3!=s.g?(a=s.h,_(s,r(i,t),3)):null!=(o=s.h)&&null!=a?s.return(Math.max(o,a)):null!=o?s.return(o):null!=a?s.return(a):s.return(t)})}(d,A),9);case 9:I=O.h,b(I);case 8:id(t,d,!0,!1,0);case 7:return t.F.ready(),t.sc().find(function(e){return e.active})||((M=fr(t.i.textStreams,t.Od,t.Me,t.Le)[0]||null)&&lh(t.B.h,M,!0),d&&(M?(yr(d.audio,M,t.g)&&(t.Y=!0),t.Y&&t.s.setTextVisibility(!0)):(t.Y=!1,t.s.setTextVisibility(!1)),cd(t)),M&&(t.g.streaming.alwaysStreamText||t.jd())&&(bl(t.l,M),pd(t))),_(O,t.l.start(r),10);case 10:t.g.abr.enabled&&(t.u.enable(),dd(t)),od(t),td(t),t.i.variants.some(function(e){return e.primary}),((P=t.T())&&(t.g.streaming.liveSync&&t.g.streaming.liveSync.enabled||t.i.serviceDescription||t.g.streaming.liveSync.panicMode)||t.g.streaming.vodDynamicPlaybackRate)&&(D=function(){return $c(t)},t.j.o(a,"timeupdate",D)),P||(R=function(){return ed(t)},t.j.o(a,"timeupdate",R),ed(t),t.i.nextUrl&&(0, the browser will not load anything until play() is called. We are unable to measure load latency in a meaningful way, and we cannot provide track info yet. Please do not use preload="none" with Shaka Player.'),h.resolve()),e.j.ra(i,"error",function(){h.reject(yd(e))}),_(m,qi(e.g.streaming.loadTimeout,h),4);case 4:((d=e.T())&&(e.g.streaming.liveSync&&e.g.streaming.liveSync.enabled||e.g.streaming.liveSync.panicMode)||e.g.streaming.vodDynamicPlaybackRate)&&(p=function(){return $c(e)},e.j.o(i,"timeupdate",p)),d||(f=function(){return ed(e)},e.j.o(i,"timeupdate",f),ed(e)),e.C&&(e.C.onManifestUpdated(d),d&&(g=e.xa().end,e.j.o(i,"progress",function(){var t=e.xa().end;g!=t&&(e.C.onManifestUpdated(e.T()),g=t)}))),e.$=!0,w(m)}})}(b,d,i),0)})},"srcEqualsInner_"),14);case 14:b.dispatchEvent(Sc("loaded"));case 6:if(x(A),!r){A.A(25);break}return _(A,r.destroy(),25);case 25:b.Na=null,C(A,0);break;case 5:if(!(y=E(A))||7e3==y.code){A.A(27);break}return _(A,b.nc(!1),27);case 27:throw y}})},i.qm=function(e,t){e=void 0===e||e,t=void 0!==t&&t;var n,i=this;return L(function(r){return 1==r.g?_(r,Cc(i),2):3!=r.g?(n=r.h,_(r,i.nc(e,t),3)):r.return(n)})},i.Ni=function(e,t){e=void 0!==e&&e,t=void 0!==t&&t;var n,i=this;return L(function(r){return 1==r.g?_(r,Cc(i,t),2):3!=r.g?(n=r.h,_(r,i.detach(e),3)):r.return(n)})},i.preload=function(e,t,n,i){t=void 0===t?null:t;var r,a,o=this;return L(function(s){return 1==s.g?(ih(r=qc(o),i||o.g,qc(o)),_(s,kc(o,e,t,n,!1,r),2)):((a=s.h)?a.start():gd(o,new Ce(2,7,7005)),s.return(a))})},i.Tg=function(){var e,t,n,i,r=this;return L(function(a){for(e=[],t=l(r.Re),n=t.next();!n.done;n=t.next())(i=n.value).u||e.push(i.destroy());return r.Re=[],_(a,Promise.all(e),0)})},i.Xl=function(){for(var e=this.ba;e.g;)e.release()},i.yd=function(e){return new Aa(e)},i.configure=function(e,t){if(2==arguments.length&&"string"==typeof e&&(e=Wl(e,t)),e.streaming&&"forceTransmuxTS"in e.streaming&&(kt("streaming.forceTransmuxTS configuration","Please Use mediaSource.forceTransmux instead."),e.mediaSource=e.mediaSource||{},e.mediaSource.mediaSource=e.streaming.forceTransmuxTS,delete e.streaming.forceTransmuxTS),e.streaming&&"forceTransmux"in e.streaming&&(kt("streaming.forceTransmux configuration","Please Use mediaSource.forceTransmux instead."),e.mediaSource=e.mediaSource||{},e.mediaSource.mediaSource=e.streaming.forceTransmux,delete e.streaming.forceTransmux),e.streaming&&"useNativeHlsOnSafari"in e.streaming){kt("streaming.useNativeHlsOnSafari configuration","Please Use streaming.useNativeHlsForFairPlay or streaming.preferNativeHls instead.");var n=Me();e.streaming.preferNativeHls=e.streaming.useNativeHlsOnSafari&&"WEBKIT"===n.Fa(),delete e.streaming.useNativeHlsOnSafari}if(e.streaming&&"boolean"==typeof e.streaming.liveSync&&(kt("streaming.liveSync","Please Use streaming.liveSync.enabled instead."),n=e.streaming.liveSync,e.streaming.liveSync={},e.streaming.liveSync.enabled=n),e.streaming&&(!e.streaming.liveSync||!("targetLatency"in e.streaming.liveSync))&&("liveSyncMinLatency"in e.streaming||"liveSyncMaxLatency"in e.streaming)){n=e.streaming.liveSyncMinLatency||0;var i=Math.abs((e.streaming.liveSyncMaxLatency||1)-n)/2;e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.targetLatency=n+i,e.streaming.liveSync.targetLatencyTolerance=i}if(e.streaming&&"liveSyncMaxLatency"in e.streaming&&(kt("streaming.liveSyncMaxLatency","Please Use streaming.liveSync.targetLatency and streaming.liveSync.targetLatencyTolerance instead. Or, set the values in your DASH manifest"),delete e.streaming.liveSyncMaxLatency),e.streaming&&"liveSyncMinLatency"in e.streaming&&(kt("streaming.liveSyncMinLatency","Please Use streaming.liveSync.targetLatency and streaming.liveSync.targetLatencyTolerance instead. Or, set the values in your DASH manifest"),delete e.streaming.liveSyncMinLatency),e.streaming&&"liveSyncTargetLatency"in e.streaming&&(kt("streaming.liveSyncTargetLatency","Please Use streaming.liveSync.targetLatency instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.targetLatency=e.streaming.liveSyncTargetLatency,delete e.streaming.liveSyncTargetLatency),e.streaming&&"liveSyncTargetLatencyTolerance"in e.streaming&&(kt("streaming.liveSyncTargetLatencyTolerance","Please Use streaming.liveSync.targetLatencyTolerance instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.targetLatencyTolerance=e.streaming.liveSyncTargetLatencyTolerance,delete e.streaming.liveSyncTargetLatencyTolerance),e.streaming&&"liveSyncPlaybackRate"in e.streaming&&(kt("streaming.liveSyncPlaybackRate","Please Use streaming.liveSync.maxPlaybackRate instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.maxPlaybackRate=e.streaming.liveSyncPlaybackRate,delete e.streaming.liveSyncPlaybackRate),e.streaming&&"liveSyncMinPlaybackRate"in e.streaming&&(kt("streaming.liveSyncMinPlaybackRate","Please Use streaming.liveSync.minPlaybackRate instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.minPlaybackRate=e.streaming.liveSyncMinPlaybackRate,delete e.streaming.liveSyncMinPlaybackRate),e.streaming&&"liveSyncPanicMode"in e.streaming&&(kt("streaming.liveSyncPanicMode","Please Use streaming.liveSync.panicMode instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.panicMode=e.streaming.liveSyncPanicMode,delete e.streaming.liveSyncPanicMode),e.streaming&&"liveSyncPanicThreshold"in e.streaming&&(kt("streaming.liveSyncPanicThreshold","Please Use streaming.liveSync.panicThreshold instead."),e.streaming.liveSync=e.streaming.liveSync||{},e.streaming.liveSync.panicThreshold=e.streaming.liveSyncPanicThreshold,delete e.streaming.liveSyncPanicThreshold),e.mediaSource&&"sourceBufferExtraFeatures"in e.mediaSource){kt("mediaSource.sourceBufferExtraFeatures configuration","Please Use mediaSource.addExtraFeaturesToSourceBuffer() instead.");var r=e.mediaSource.sourceBufferExtraFeatures;e.mediaSource.addExtraFeaturesToSourceBuffer=function(){return r},delete e.mediaSource.sourceBufferExtraFeatures}if(e.manifest&&e.manifest.hls&&"useSafariBehaviorForLive"in e.manifest.hls&&(kt("manifest.hls.useSafariBehaviorForLive configuration","Please Use liveSync config to keep on live Edge instead."),delete e.manifest.hls.useSafariBehaviorForLive),e.streaming&&"parsePrftBox"in e.streaming&&(kt("streaming.parsePrftBox configuration","Now fired without needing a configuration."),delete e.streaming.parsePrftBox),e.manifest&&e.manifest.dash&&"enableAudioGroups"in e.manifest.dash&&(kt("manifest.dash.enableAudioGroups configuration","It is now enabled by default and cannot be disabled."),delete e.manifest.dash.enableAudioGroups),e.streaming&&"dispatchAllEmsgBoxes"in e.streaming&&(kt("streaming.dispatchAllEmsgBoxes configuration","Please Use mediaSource.dispatchAllEmsgBoxes instead."),e.mediaSource=e.mediaSource||{},e.mediaSource.dispatchAllEmsgBoxes=e.streaming.dispatchAllEmsgBoxes,delete e.streaming.dispatchAllEmsgBoxes),e.streaming&&"autoLowLatencyMode"in e.streaming&&(kt("streaming.autoLowLatencyMode configuration","Please Use streaming.lowLatencyMode instead."),e.streaming.lowLatencyMode=e.streaming.autoLowLatencyMode,delete e.streaming.autoLowLatencyMode),e.manifest&&e.manifest.dash&&"ignoreSupplementalCodecs"in e.manifest.dash&&(kt("manifest.dash.ignoreSupplementalCodecs configuration","Please Use manifest.ignoreSupplementalCodecs instead."),e.manifest.ignoreSupplementalCodecs=e.manifest.dash.ignoreSupplementalCodecs,delete e.manifest.dash.ignoreSupplementalCodecs),e.manifest&&e.manifest.hls&&"ignoreSupplementalCodecs"in e.manifest.hls&&(kt("manifest.hls.ignoreSupplementalCodecs configuration","Please Use manifest.ignoreSupplementalCodecs instead."),e.manifest.ignoreSupplementalCodecs=e.manifest.hls.ignoreSupplementalCodecs,delete e.manifest.hls.ignoreSupplementalCodecs),e.manifest&&e.manifest.dash&&"updatePeriod"in e.manifest.dash&&(kt("manifest.dash.updatePeriod configuration","Please Use manifest.updatePeriod instead."),e.manifest.updatePeriod=e.manifest.dash.updatePeriod,delete e.manifest.dash.updatePeriod),e.manifest&&e.manifest.hls&&"updatePeriod"in e.manifest.hls&&(kt("manifest.hls.updatePeriod configuration","Please Use manifest.updatePeriod instead."),e.manifest.updatePeriod=e.manifest.hls.updatePeriod,delete e.manifest.hls.updatePeriod),e.manifest&&e.manifest.dash&&"ignoreDrmInfo"in e.manifest.dash&&(kt("manifest.dash.ignoreDrmInfo configuration","Please Use manifest.ignoreDrmInfo instead."),e.manifest.ignoreDrmInfo=e.manifest.dash.ignoreDrmInfo,delete e.manifest.dash.ignoreDrmInfo),e.drm&&e.drm.advanced){for(var a in n=!1,e.drm.advanced){var o=e.drm.advanced[a];i=o.videoRobustness,o=o.audioRobustness,"videoRobustness"in e.drm.advanced[a]&&!Array.isArray(e.drm.advanced[a].videoRobustness)&&(e.drm.advanced[a].videoRobustness=[i],n=!0),"audioRobustness"in e.drm.advanced[a]&&!Array.isArray(e.drm.advanced[a].audioRobustness)&&(e.drm.advanced[a].audioRobustness=[o],n=!0)}n&&kt("AdvancedDrmConfiguration's videoRobustness and audioRobustness","These properties are no longer strings but array of strings, please update your usage of these properties.")}return e.streaming&&"forceHTTP"in e.streaming&&(kt("streaming.forceHTTP configuration","Please Use networking.forceHTTP instead."),e.networking=e.networking||{},e.networking.forceHTTP=e.streaming.forceHTTP,delete e.streaming.forceHTTP),e.streaming&&"forceHTTPS"in e.streaming&&(kt("streaming.forceHTTPS configuration","Please Use networking.forceHTTP instead."),e.networking=e.networking||{},e.networking.forceHTTPS=e.streaming.forceHTTPS,delete e.streaming.forceHTTPS),e.streaming&&"minBytesForProgressEvents"in e.streaming&&(kt("streaming.minBytesForProgressEvents configuration","Please Use networking.minBytesForProgressEvents instead."),e.networking=e.networking||{},e.networking.minBytesForProgressEvents=e.streaming.minBytesForProgressEvents,delete e.streaming.minBytesForProgressEvents),a=ih(this.g,e,qc(this)),jc(this),a},i.nk=function(e){this.Bg=e},i.getConfiguration=function(){var e=qc(this);return ih(e,this.g,qc(this)),e},i.Ck=function(){return this.Bg},i.Ui=function(){return ih(qc(this),this.g,qc(this)),Kl(this.g,qc(this))},i.Ri=function(){if(this.h){var e=this.h.buffered.length;e=e?this.h.buffered.end(e-1):0;var t=this.getConfiguration().streaming.bufferingGoal;if(e>=(t=Math.min(this.h.currentTime+t,this.xa().end)))return 1;if(!(e<=this.h.currentTime)&&eu(p,h))&&(d=p);d!=h&&(d?(h=or(d),s.Ae(h,!0,i||0)):nd(s))}(),!this.Ca())||function(){if(s.h&&s.h.audioTracks){var n=fr(s.qb(),e,t||"",!1)[0];n&&s.Ae(n)}}()},i.Xh=function(e,t,n){var i,r=this;n=void 0!==n&&n,this.i&&this.F&&(function(){r.Od=e,r.Me=t||"",r.Le=n||!1;var i=fr(r.i.textStreams,r.Od,r.Me,r.Le)[0]||null;i&&i!=r.l.B&&(lh(r.B.h,i,!1),r.g.streaming.alwaysStreamText||r.jd())&&(bl(r.l,i),hd(r),pd(r))}(),!this.Ca())||(i=fr(r.sc(),e,t||"",n||!1)[0])&&r.dg(i)},i.fm=function(e,t,n){var i=this;t=void 0===t||t,n=void 0===n?0:n,this.i&&this.F&&(function(){for(var r=null,a=l(i.i.variants),o=a.next();!o.done;o=a.next())if((o=o.value).audio.label==e){r=o;break}null!=r&&(i.L=i.g.adaptationSetCriteriaFactory(),i.L.configure({language:r.language,role:"",channelCount:0,Nc:"",spatialAudio:!1,videoLayout:"",Vd:"",Wc:e,codecSwitchingStrategy:i.g.mediaSource.codecSwitchingStrategy,audioCodec:"",Xd:"",Ye:0,preferredAudioCodecs:i.g.preferredAudioCodecs,preferredAudioChannelCount:i.g.preferredAudioChannelCount}),nd(i,t,n))}(),!this.Ca())||function(){if(i.h&&i.h.audioTracks){for(var t=Array.from(i.h.audioTracks),n=null,r=(t=l(t)).next();!r.done;r=t.next())(r=r.value).label==e&&(n=r);n&&rd(i,n)}}()},i.jd=function(){var e=this.Y;return this.s?this.s.isTextVisible():e},i.zk=function(){return this.eb.map(function(e){return sr(e)})},i.yk=function(e){if(kt("getChapters","Please use an getChaptersAsync."),!this.eb.length)return[];var t=ht(e);if(!(e=this.eb.filter(function(e){return ht(e.language)==t})).length)return[];for(var n=[],i=new Set,r=(e=l(e)).next();!r.done;r=e.next())(r=r.value).segmentIndex&&r.segmentIndex.Ib(function(e){var t=e.S()[0],r=e.startTime+"-"+e.endTime+"-"+t;e={id:r,title:t,startTime:e.startTime,endTime:e.endTime},i.has(r)||(n.push(e),i.add(r))});return n},i.kh=function(e){var t,n,i,r,a,o,s,u=this;return L(function(h){switch(h.g){case 1:if(!u.eb.length)return h.return([]);if(t=ht(e),!(n=u.eb.filter(function(e){return ht(e.language)==t})).length)return h.return([]);i=[],r=new Set,a=l(n),o=a.next();case 2:if(o.done){h.A(4);break}if((s=o.value).segmentIndex){h.A(5);break}return _(h,s.createSegmentIndex(),5);case 5:s.segmentIndex.Ib(function(e){var t=e.S()[0],n=e.startTime+"-"+e.endTime+"-"+t;e={id:n,title:t,startTime:e.startTime,endTime:e.endTime},r.has(n)||(i.push(e),r.add(n))}),o=a.next(),h.A(2);break;case 4:return h.return(i)}})},i.Ce=function(e){e=!!e,this.Y!=e&&(this.Y=e,this.m==Ed?(this.s.setTextVisibility(e),this.g.streaming.alwaysStreamText||(e?this.l.B||0<(e=fr(this.i.textStreams,this.Od,this.Me,this.Le)).length&&(bl(this.l,e[0]),hd(this),pd(this)):function(e){var t=e.h.get(nt);t&&(Nl(t),Ol(t).catch(function(){}),e.F=e.h.get(nt),e.h.delete(nt),t.stream&&t.stream.closeSegmentIndex&&t.stream.closeSegmentIndex()),e.B=null}(this.l))):this.h&&this.h.src&&this.h.textTracks&&this.s.setTextVisibility(e),cd(this))},i.Uk=function(){if(this.F)var e=this.F.We();else{if(null==this.N)return new Date;if(this.N instanceof Date)return this.N;e=this.N}if(this.i&&!this.Ca()){var t=this.i.presentationTimeline;return new Date(1e3*((t.m||t.i)+e))}return this.h&&this.h.getStartDate?(t=this.h.getStartDate(),isNaN(t.getTime())?null:new Date(t.getTime()+1e3*e)):null},i.ph=function(){if(this.i&&!this.Ca()){var e=this.i.presentationTimeline;return new Date(1e3*(e.m||e.i))}return this.h&&this.h.getStartDate?(e=this.h.getStartDate(),isNaN(e.getTime())?null:e):null},i.uf=function(){return this.T()&&this.i?this.i.presentationTimeline.uf():null},i.bc=function(){if(this.m==Ed)return this.G.bc();var e={total:[],audio:[],video:[],text:[]};return this.m==xd&&(e.total=rs(this.h.buffered)),e},i.rf=function(){if(!this.h||!this.h.currentTime)return null;var e=this.ph().getTime()+1e3*this.h.currentTime;return Math.floor(Date.now()-e)},i.getStats=function(){if(this.m!=Ed&&this.m!=xd)return{width:NaN,height:NaN,currentCodecs:"",streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,stallsDetected:NaN,gapsJumped:NaN,estimatedBandwidth:NaN,completionPercent:NaN,loadLatency:NaN,manifestTimeSeconds:NaN,drmTimeSeconds:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,liveLatency:NaN,maxSegmentDuration:NaN,manifestSizeBytes:NaN,bytesDownloaded:NaN,nonFatalErrorCount:NaN,manifestPeriodCount:NaN,manifestGapCount:NaN,switchHistory:[],stateHistory:[]};Qc(this);var e=this.h,t=e.currentTime/e.duration;if(isNaN(t)||this.T()||function(e,t){e.i=isNaN(e.i)?t:Math.max(e.i,t)}(this.B,Math.round(100*t)),this.F&&(this.B.P=this.F.ti(),this.B.R=this.F.wi()),e.getVideoPlaybackQuality&&(t=e.getVideoPlaybackQuality(),function(e,t,n){e.O=t,e.N=n}(this.B,Number(t.droppedVideoFrames),Number(t.totalVideoFrames)),this.B.L=Number(t.corruptedVideoFrames)),this.B.s=this.D?function(e){return e.I?e.I:NaN}(this.D):NaN,ch(this.B,e.videoWidth||NaN,e.videoHeight||NaN),this.B.l="",this.T()&&null!=this.ph()&&(e=this.rf()||0,this.B.D=e/1e3),t=this.qb().find(function(e){return e.active}),e=this.sc().find(function(e){return e.active}),t){if(t.bandwidth){var n=this.J?this.J.i:1,i=n*t.bandwidth;e&&e.bandwidth&&(i+=n*e.bandwidth),this.B.B=i}t.width&&t.height&&ch(this.B,t.width||NaN,t.height||NaN),t=t.codecs,e&&(t+=","+(e.codecs||e.mimeType)),t&&(this.B.l=t)}return this.m!=Ed||this.Ca()||(this.i&&(this.B.H=this.i.periodCount,this.B.G=this.i.gapCount,this.i.presentationTimeline&&(this.B.J=this.i.presentationTimeline.h)),e=this.u.getBandwidthEstimate(),this.B.u=e),this.m==xd&&dh(this.B,NaN),function(e){for(var t=e.U,n=e.C,i=e.l,r=e.B,a=e.N,o=e.O,s=e.L,u=e.R,h=e.P,c=e.u,d=e.i,p=e.F,f=e.I,g=e.m,m=sh(e.g,"playing"),v=sh(e.g,"paused"),y=sh(e.g,"buffering"),b=e.s,_=e.D,w=e.J,S=e.dj,T=e.j,A=e.K,E=e.H,x=e.G,C=function(e){function t(e){return{timestamp:e.timestamp,state:e.state,duration:e.duration}}for(var n=[],i=l(e.h),r=i.next();!r.done;r=i.next())n.push(t(r.value));return e.g&&n.push(t(e.g)),n}(e.g),k=[],I=(e=l(e.h.g)).next();!I.done;I=e.next())I=I.value,k.push({timestamp:I.timestamp,id:I.id,type:I.type,fromAdaptation:I.fromAdaptation,bandwidth:I.bandwidth});return{width:t,height:n,currentCodecs:i,streamBandwidth:r,decodedFrames:a,droppedFrames:o,corruptedFrames:s,stallsDetected:u,gapsJumped:h,estimatedBandwidth:c,completionPercent:d,loadLatency:p,manifestTimeSeconds:f,drmTimeSeconds:g,playTime:m,pauseTime:v,bufferingTime:y,licenseTime:b,liveLatency:_,maxSegmentDuration:w,manifestSizeBytes:S,bytesDownloaded:T,nonFatalErrorCount:A,manifestPeriodCount:E,manifestGapCount:x,stateHistory:C,switchHistory:k}}(this.B)},i.Yd=function(e,t,n,i,r,a,o){o=void 0!==o&&o;var s,u,l,h,c,d,p,f,g,m,v=this;return L(function(y){switch(y.g){case 1:if(v.m!=Ed&&v.m!=xd)throw new Ce(1,7,7004);if("subtitles"!=n&&"captions"!=n&&Y("Using a kind value different of `subtitles` or `captions` can cause unwanted issues."),i){y.A(2);break}return _(y,Kc(v,e),3);case 3:i=y.h;case 2:if(s=[],v.C&&(s=v.C.getCuePoints()),v.m!=xd){y.A(4);break}return u=Me(),o&&"WEBKIT"===u.Fa()&&(n="forced"),_(y,function(e,t,n,i,r,a,o){var s,u,l,h;return L(function(c){if(1==c.g)return"text/vtt"!=r||o.length?_(c,Xc(e,t,e.I,e.g.streaming.retryParameters),3):c.A(2);2!=c.g&&(s=c.h,u=Yc(e,s,r,o),l=new Blob([u],{type:"text/vtt"}),t=pu(l),r="text/vtt"),h=document.createElement("track");var d=e.K,p=t;try{if(d.g.enabled){var f=Qh(d);f.ot="c",f.su=!0;var g=nc(p,tc(f))}else g=p}catch(e){q("CMCD_TEXT_TRACK_ERROR","Could not generate text track CMCD data.",e),g=p}return h.src=g,h.label=a,h.kind=i,h.srclang=n,e.h.getAttribute("crossorigin")||e.h.setAttribute("crossorigin","anonymous"),e.h.appendChild(h),e.Ag.push(h),c.return(h)})}(v,e,t,n,i,a||"",s),5);case 5:if((l=y.h).track)return od(v),y.return(hr(l.track));throw new Ce(1,2,2012);case 4:if(h=it,c=v.xa(),d=c.end-c.start,v.i&&(d=v.i.presentationTimeline.getDuration()),1/0==d)throw new Ce(1,4,4033);if(!s.length){y.A(6);break}return _(y,Xc(v,e,v.I,v.g.streaming.retryParameters),7);case 7:p=y.h,f=Yc(v,p,i,s),g=new Blob([f],{type:"text/vtt"}),e=pu(g),i="text/vtt";case 6:if(m={id:v.Oe++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:Vu(0,d,[e]),mimeType:i||"",codecs:r||"",kind:n,encrypted:!1,drmInfos:[],keyIds:new Set,language:t,originalLanguage:t,label:a||null,type:h.$a,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!!o,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(i||"",r||"")]),isAudioMuxedInVideo:!1,baseOriginalId:null},!ji(xi(m.mimeType,m.codecs)))throw new Ce(2,2,2014,i);return v.i.textStreams.push(m),od(v),y.return(sr(m))}})},i.$e=function(e,t){var n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S=this;return L(function(T){switch(T.g){case 1:if(S.m!=Ed&&S.m!=xd)throw new Ce(1,7,7004);if(t){T.A(2);break}return _(T,Kc(S,e),3);case 3:t=T.h;case 2:if("text/vtt"!=t)throw new Ce(1,2,2017,e);if(n=it,i=S.xa(),r=i.end-i.start,S.i&&(r=S.i.presentationTimeline.getDuration()),1/0==r)throw new Ce(1,4,4045);return _(T,Xc(S,e,S.I,S.g.streaming.retryParameters),4);case 4:if(a=T.h,!(o=Fi(t)))throw new Ce(2,2,2014,t);for(s=o(),u={periodStart:0,segmentStart:0,segmentEnd:r,vttOffset:0},h=Te(a),c=s.parseMedia(h,u,e,[]),d=[],p=l(c),f=p.next(),g={};!f.done;g={sg:void 0,zd:void 0},f=p.next())g.zd=f.value,g.sg=null,m=function(t){return function(){return null==t.sg&&(t.sg=Ze([e],[t.zd.payload])),t.sg||[]}}(g),v=new qo(g.zd.startTime,g.zd.endTime,m,0,null,null,0,0,1/0),g.zd.payload.includes("#xywh")&&4===(y=g.zd.payload.split("#xywh=")[1].split(",")).length&&v.hg({height:parseInt(y[3],10),positionX:parseInt(y[0],10),positionY:parseInt(y[1],10),width:parseInt(y[2],10)}),d.push(v);if(b=t,!d.length){T.A(5);break}return _(T,xh(d[0].S()[0],S.I,S.g.manifest.retryParameters),6);case 6:b=T.h;case 5:return w={id:S.Oe++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Gu(d),mimeType:b||"",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:n.wg,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,tilesLayout:"1x1",accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(b||"","")]),isAudioMuxedInVideo:!1,baseOriginalId:null},S.m==xd?S.Te.push(w):S.i.imageStreams.push(w),od(S),T.return(ur(w))}})},i.Ze=function(e,t,n){var i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b=this;return L(function(w){switch(w.g){case 1:if(b.m!=Ed&&b.m!=xd)throw new Ce(1,7,7004);if(n){w.A(2);break}return _(w,Kc(b,e),3);case 3:n=w.h;case 2:if(i=it,r=b.xa(),a=r.end-r.start,b.i&&(a=b.i.presentationTimeline.getDuration()),1/0==a)throw new Ce(1,4,4054);return _(w,Xc(b,e,b.I,b.g.streaming.retryParameters),4);case 4:if(o=w.h,!(s=Fi(n)))throw new Ce(2,2,2014,n);for(u=s(),h={periodStart:0,segmentStart:0,segmentEnd:a,vttOffset:0},c=Te(o),d=u.parseMedia(c,h,e,[]),p=[],f=l(d),g=f.next(),m={};!g.done;m={lf:void 0},g=f.next())m.lf=g.value,v=new qo(m.lf.startTime,m.lf.endTime,function(e){return function(){return[e.lf.payload]}}(m),0,null,null,0,0,1/0),p.push(v);return y={id:b.Oe++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Gu(p),mimeType:"text/plain",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:t,originalLanguage:t,label:null,type:i.$a,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi("text/plain","")]),isAudioMuxedInVideo:!1,baseOriginalId:null},b.eb.push(y),od(b),w.return(sr(y))}})},i.mm=function(e,t){this.sa.width=e,this.sa.height=t},i.Th=function(e){if(this.m==Ed){var t=this.l;if(e=void 0===e?.1:e,t.l.g)t=!1;else if(t.C)t=!1;else{for(var n=l(t.h.values()),i=n.next();!i.done;i=n.next())!(i=i.value).je||i.Za||i.Db||(i.je=!1,Rl(t,i,e));t=!0}}else t=!1;return t},i.nh=function(){return Y("Shaka Player's internal Manifest structure is NOT covered by semantic versioning compatibility guarantees. It may change at any time! Please consider filing a feature request for whatever you use getManifest() for."),this.i},i.Qk=function(){return this.zc},i.Ik=function(){var e={video:null,audio:null,text:null};if(this.m!=Ed)return e;for(var t=this.l.s,n=this.h.currentTime,i=(t=l([t.video,t.audio,this.l.B])).next();!i.done;i=t.next())if((i=i.value)&&i.segmentIndex){var r=i.segmentIndex.find(n);r={codecs:(r=i.segmentIndex.get(r)).codecs||i.codecs,mimeType:r.mimeType||i.mimeType,bandwidth:r.bandwidth||i.bandwidth},"video"==i.type?(r.width=i.width,r.height=i.height,e.video=r):"audio"==i.type?e.audio=r:i.type==nt&&(e.text=r)}return e},i.di=function(e){this.Pe=e},i.disableStream=function(e,t){if(!this.g.abr.enabled||this.m===Td||!navigator.onLine||0==t||!this.i)return!1;if(this.i.variants.some(function(t){var n=t[e.type];return!(!n||n.id===e.id||t.disabledUntilTime||"audio"==e.type&&e.language!==n.language)})){for(var n=!1,i=!1,r=l(this.i.variants),a=r.next();!a.done;a=r.next()){var o=(a=a.value)[e.type];o&&(o.id===e.id?(a.disabledUntilTime=Date.now()/1e3+t,n=!0):o.trickModeVideo&&o.trickModeVideo.id==e.id&&(i=!0))}return!(!n&&i||(this.Qe.ya(1),t=this.bc().video.reduce(function(e,t){return e+t.end-t.start},0),nd(this,!1,t,!0,!1),0))}return!1},i.addFont=function(t,n){return function(t,n){var i,r,a,o,s;return L(function(u){if(1==u.g)return"fonts"in document&&"FontFace"in e?_(u,document.fonts.ready,2):u.return();if(!("entries"in document.fonts))return u.return();for(i=function(e){for(var t=[],n=(e=e.entries()).next();!1===n.done;)t.push(n.value),n=e.next();return t},r=l(i(document.fonts)),a=r.next();!a.done;a=r.next())if((o=a.value).family===t&&"swap"===o.display)return u.return();s=new FontFace(t,"url("+n+")",{display:"swap"}),document.fonts.add(s),w(u)})}(t,n)},i.Ca=function(){return!(!this.h||!this.h.remote)&&"disconnected"!=this.h.remote.state},i.isEnded=function(){return!(this.h&&!this.h.ended)||this.$&&!this.T()&&this.h.currentTime>=this.xa().end},H("shaka.Player",_c),_c.prototype.isEnded=_c.prototype.isEnded,_c.prototype.isRemotePlayback=_c.prototype.Ca,_c.prototype.addFont=_c.prototype.addFont,_c.prototype.setVideoContainer=_c.prototype.di,_c.prototype.getFetchedPlaybackInfo=_c.prototype.Ik,_c.prototype.getManifestParserFactory=_c.prototype.Qk,_c.prototype.getManifest=_c.prototype.nh,_c.prototype.retryStreaming=_c.prototype.Th,_c.prototype.setMaxHardwareResolution=_c.prototype.mm,_c.prototype.addChaptersTrack=_c.prototype.Ze,_c.prototype.addThumbnailsTrack=_c.prototype.$e,_c.prototype.addTextTrackAsync=_c.prototype.Yd,_c.prototype.getStats=_c.prototype.getStats,_c.prototype.getBufferedInfo=_c.prototype.bc,_c.prototype.getSegmentAvailabilityDuration=_c.prototype.uf,_c.prototype.getPresentationStartTimeAsDate=_c.prototype.ph,_c.prototype.getPlayheadTimeAsDate=_c.prototype.Uk,_c.prototype.setTextTrackVisibility=_c.prototype.Ce,_c.prototype.getChaptersAsync=_c.prototype.kh,_c.prototype.getChapters=_c.prototype.yk,_c.prototype.getChaptersTracks=_c.prototype.zk,_c.prototype.isTextTrackVisible=_c.prototype.jd,_c.prototype.selectVariantsByLabel=_c.prototype.fm,_c.prototype.selectTextLanguage=_c.prototype.Xh,_c.prototype.selectAudioLanguage=_c.prototype.Aj,_c.prototype.getTextLanguages=_c.prototype.al,_c.prototype.getAudioLanguages=_c.prototype.tk,_c.prototype.getTextLanguagesAndRoles=_c.prototype.cl,_c.prototype.getAudioLanguagesAndRoles=_c.prototype.vk,_c.prototype.getVideoTracks=_c.prototype.getVideoTracks,_c.prototype.selectVideoTrack=_c.prototype.Cj,_c.prototype.getAudioTracks=_c.prototype.getAudioTracks,_c.prototype.selectAudioTrack=_c.prototype.Bj,_c.prototype.selectVariantTrack=_c.prototype.Ae,_c.prototype.selectTextTrack=_c.prototype.dg,_c.prototype.getThumbnails=_c.prototype.Vi,_c.prototype.getAllThumbnails=_c.prototype.rk,_c.prototype.getImageTracks=_c.prototype.mh,_c.prototype.getTextTracks=_c.prototype.sc,_c.prototype.getVariantTracks=_c.prototype.qb,_c.prototype.cancelTrickPlay=_c.prototype.xd,_c.prototype.trickPlay=_c.prototype.Uc,_c.prototype.useTrickPlayTrackIfAvailable=_c.prototype.si,_c.prototype.getPlaybackRate=_c.prototype.Xa,_c.prototype.isBuffering=_c.prototype.zf,_c.prototype.getKeyStatuses=_c.prototype.qf,_c.prototype.getActiveSessionsMetadata=_c.prototype.jh,_c.prototype.getExpiration=_c.prototype.fe,_c.prototype.drmInfo=_c.prototype.drmInfo,_c.prototype.keySystem=_c.prototype.keySystem,_c.prototype.isFullyLoaded=_c.prototype.xl,_c.prototype.goToLive=_c.prototype.rl,_c.prototype.seekRange=_c.prototype.xa,_c.prototype.isVideoOnly=_c.prototype.Dh,_c.prototype.isAudioOnly=_c.prototype.Fd,_c.prototype.isInProgress=_c.prototype.hd,_c.prototype.isLive=_c.prototype.T,_c.prototype.getQueueManager=_c.prototype.qh,_c.prototype.getAdManager=_c.prototype.pf,_c.prototype.getAssetUri=_c.prototype.cd,_c.prototype.getNetworkingEngine=_c.prototype.Jb,_c.prototype.getMediaElement=_c.prototype.Tk,_c.prototype.getManifestType=_c.prototype.oh,_c.prototype.getLoadMode=_c.prototype.Mk,_c.prototype.resetConfiguration=_c.prototype.vj,_c.prototype.getBufferFullness=_c.prototype.Ri,_c.prototype.getNonDefaultConfiguration=_c.prototype.Ui,_c.prototype.getConfigurationForLowLatency=_c.prototype.Ck,_c.prototype.getConfiguration=_c.prototype.getConfiguration,_c.prototype.configurationForLowLatency=_c.prototype.nk,_c.prototype.configure=_c.prototype.configure,_c.prototype.releaseAllMutexes=_c.prototype.Xl,_c.prototype.destroyAllPreloads=_c.prototype.Tg,_c.prototype.preload=_c.prototype.preload,_c.prototype.detachAndSavePreload=_c.prototype.Ni,_c.prototype.unloadAndSavePreload=_c.prototype.qm,_c.prototype.load=_c.prototype.load,_c.prototype.updateStartTime=_c.prototype.um,_c.prototype.unload=_c.prototype.nc,_c.prototype.detach=_c.prototype.detach,_c.prototype.attachCanvas=_c.prototype.Bi,_c.prototype.attach=_c.prototype.ac,_c.probeSupport=function(t){var n,i,r,a,o;return t=void 0===t||t,L(function(s){switch(s.g){case 1:if(n={},!t){s.A(2);break}return _(s,function(){var t,n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M,P,D,R,N,O,U,B,F,j,G;return L(function(H){if(1==H.g){if(t="org.w3.clearkey com.widevine.alpha com.widevine.alpha.experiment com.microsoft.playready com.microsoft.playready.hardware com.microsoft.playready.recommendation com.microsoft.playready.recommendation.3000 com.microsoft.playready.recommendation.3000.clearlead com.chromecast.playready com.apple.fps.1_0 com.apple.fps com.huawei.wiseplay".split(" "),!(e.MediaKeys&&e.navigator&&e.navigator.requestMediaKeySystemAccess&&e.MediaKeySystemAccess&&e.MediaKeySystemAccess.prototype.getConfiguration)){for(n={},i=l(t),r=i.next();!r.done;r=i.next())a=r.value,n[a]=null;return H.return(n)}for(o="1.0 1.1 1.2 1.3 1.4 2.0 2.1 2.2 2.3".split(" "),u={"com.widevine.alpha":s=["SW_SECURE_CRYPTO","SW_SECURE_DECODE","HW_SECURE_CRYPTO","HW_SECURE_DECODE","HW_SECURE_ALL"],"com.widevine.alpha.experiment":s,"com.microsoft.playready.recommendation":["150","2000","3000"]},d={videoCapabilities:h=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],audioCapabilities:c=[{contentType:'audio/mp4; codecs="mp4a.40.2"'},{contentType:'audio/webm; codecs="opus"'}],initDataTypes:["cenc","sinf","skd","keyids"]},p=[null,"cenc","cbcs"],f=new Map,g=Me(),m=function(e,t){var n,i,r,a,s,u,h,c,d,p,m,v,y;return L(function(b){switch(b.g){case 1:return S(b,2),_(b,t.createMediaKeys(),5);case 5:n=b.h;case 4:A(b,3);break;case 2:return E(b),b.return();case 3:if(r=!!(i=t.getConfiguration().sessionTypes)&&i.includes("persistent-license"),g.ij()&&(r=!1),a=t.getConfiguration().videoCapabilities,s=t.getConfiguration().audioCapabilities,u={persistentState:r,encryptionSchemes:[],videoRobustnessLevels:[],audioRobustnessLevels:[],minHdcpVersions:[]},f.has(e)&&f.get(e)?u=f.get(e):f.set(e,u),(h=a[0].encryptionScheme)&&!u.encryptionSchemes.includes(h)&&u.encryptionSchemes.push(h),(c=a[0].robustness)&&!u.videoRobustnessLevels.includes(c)&&u.videoRobustnessLevels.push(c),(d=s[0].robustness)&&!u.audioRobustnessLevels.includes(d)&&u.audioRobustnessLevels.push(d),"getStatusForPolicy"in n){for(p=[],m=l(o),v=m.next(),y={};!v.done;y={ke:void 0},v=m.next())y.ke=v.value,u.minHdcpVersions.includes(y.ke)||p.push(n.getStatusForPolicy({minHdcpVersion:y.ke}).then(function(e){return function(t){"usable"!=t||u.minHdcpVersions.includes(e.ke)||u.minHdcpVersions.push(e.ke)}}(y)));return _(b,Promise.all(p),0)}b.A(0)}})},v=function(e,t,n,i){var r,a,o,s,u,h,c,p,f,g;return L(function(v){switch(v.g){case 1:for(S(v,2),r=hn(d),a=l(r.videoCapabilities),o=a.next();!o.done;o=a.next())(s=o.value).encryptionScheme=t,s.robustness=n;for(u=l(r.audioCapabilities),h=u.next();!h.done;h=u.next())(c=h.value).encryptionScheme=t,c.robustness=i;return(p=hn(r)).persistentState="required",p.sessionTypes=["persistent-license"],f=[p,r],"MOBILE"==Me().Ja()?_(v,qi(5,navigator.requestMediaKeySystemAccess(e,f)),7):_(v,navigator.requestMediaKeySystemAccess(e,f),6);case 6:g=v.h,v.A(5);break;case 7:g=v.h;case 5:return _(v,m(e,g),8);case 8:A(v,0);break;case 2:E(v),w(v)}})},y=function(e,t,n,i){var r,a,o;return L(function(s){switch(s.g){case 1:return S(s,2),r={type:"media-source",video:{contentType:h[0].contentType,width:640,height:480,bitrate:1,framerate:1},audio:{contentType:c[0].contentType,channels:2,bitrate:1,samplerate:1},keySystemConfiguration:{keySystem:e,video:{encryptionScheme:t,robustness:n},audio:{encryptionScheme:t,robustness:i}}},"MOBILE"==Me().Ja()?_(s,qi(5,navigator.mediaCapabilities.decodingInfo(r)),7):_(s,navigator.mediaCapabilities.decodingInfo(r),6);case 6:a=s.h,s.A(5);break;case 7:a=s.h;case 5:return o=a.keySystemAccess,_(s,m(e,o),8);case 8:A(s,0);break;case 2:E(s),w(s)}})},b=l(t),T=b.next();!T.done;T=b.next())x=T.value,f.set(x,null);for(C=function(e){return"WEBKIT"!==Me().Fa()||"org.w3.clearkey"!==e},k=[],I=l(p),M=I.next();!M.done;M=I.next())for(P=M.value,D=l(t),R=D.next();!R.done;R=D.next())N=R.value,C(N)&&(k.push(v(N,P,"","")),k.push(y(N,P,"","")));for(O=l(t),U=O.next();!U.done;U=O.next())for(B=U.value,F=l(u[B]||[]),j=F.next();!j.done;j=F.next())G=j.value,C(B)&&(k.push(v(B,null,G,"")),k.push(v(B,null,"",G)),k.push(y(B,null,G,"")),k.push(y(B,null,"",G)));return _(H,Promise.all(k),2)}return H.return(sa(f))})}(),3);case 3:n=s.h;case 2:return i=function(){var e={};if(Me(),dv())for(var t=l(lo.keys()),n=t.next();!n.done;n=t.next())e[n.value]=!0;for(n=(t=l(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"])).next();!n.done;n=t.next())e[n=n.value]=dv()?lo.has(n):""!=cs().canPlayType(n);return e}(),r=function(){var e='video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",video/mp4; codecs="dvh1.05.01",video/mp4; codecs="dvh1.20.01",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="ac-4.02.01.01",audio/mp4; codecs="opus",audio/mp4; codecs="flac",audio/mp4; codecs="dtsc",audio/mp4; codecs="dtse",audio/mp4; codecs="dtsx",audio/mp4; codecs="apac.31.00",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").concat(h(Oi)),t={};Me();for(var n=(e=l(e)).next();!n.done;n=e.next()){ji(n=n.value)?t[n]=!0:t[n]=dv()?Ot(n)||!!bi(n):""!=cs().canPlayType(n);var i=n.split(";")[0];t[i]=t[i]||t[n]}return t}(),_(s,Me().qc(),4);case 4:return a=s.h,o={manifest:i,media:r,drm:n,hardwareResolution:a},kd.forEach(function(e,t){o[t]=e()}),s.return(o)}})},_c.isBrowserSupported=Ac,_c.setQueueManagerFactory=function(e){Md=e},_c.setAdManagerFactory=function(e){Id=e},_c.registerSupportPlugin=Tc,_c.prototype.destroy=_c.prototype.destroy;var Td=0,Ad=1,Ed=2,xd=3;_c.LoadMode={DESTROYED:Td,NOT_LOADED:Ad,MEDIA_SOURCE:Ed,SRC_EQUALS:xd},_c.version="v4.15.9";var Cd=["4","15"];Pt=new function(e){this.g=e,this.i=It,this.h=Mt}(new Ct(Number(Cd[0]),Number(Cd[1])));var kd=new Map,Id=null,Md=null;function Pd(){this.g=[],this.i=this.m=this.l=this.j=this.h=0}function Ld(e){return e.g.length?e.g.reduce(function(e,t){return e+t},0)/e.g.length:0}function Dd(e,t,n){var i=this;this.g=e,this.h=t,this.m=n,this.i=!1,this.j=this.h.getVolume(),this.l=new At,this.l.o(this.h,google.ima.AdEvent.Type.PAUSED,function(){i.i=!0}),this.l.o(this.h,google.ima.AdEvent.Type.RESUMED,function(){i.i=!1})}function Rd(){}function Nd(e,t){for(var n=[],i=(e=l(yn(e,"Ad"))).next();!i.done;i=e.next())if((i=Sn(i.value,"InLine"))&&(i=Sn(i,"Creatives")))for(var r=(i=l(yn(i,"Creative"))).next();!r.done;r=i.next()){var a=Sn(r=r.value,"Linear");if(a&&Od(n,t,a),r=Sn(r,"NonLinearAds"))for(var o=(r=l(r=yn(r,"NonLinear"))).next();!o.done;o=r.next())e:{a=n;var s=t,u=o.value,h=Sn(u,"StaticResource");if(h)o=h.attributes.creativeType;else{if(!(h=Sn(u,"HTMLResource")))break e;o="text/html"}if(h=_n(h)){"text/html"===o&&(h="data:text/html;charset=UTF-8,"+encodeURIComponent(h));var c=An(u,"width",Pn)||An(u,"expandedWidth",Pn),d=An(u,"height",Pn)||An(u,"expandedHeight",Pn);if(c||d){var p=null;(u=u.attributes.minSuggestedDuration)&&(p=sn(u)),u=0,null!=s&&(u=s),a.push({id:null,groupId:null,startTime:u,endTime:null,uri:h,mimeType:o,isSkippable:!1,skipOffset:null,skipFor:null,canJump:!1,resumeOffset:0,playoutLimit:p,once:!0,pre:null==s,post:1/0==s,timelineRange:!1,loop:!1,overlay:{viewport:{x:0,y:0},topLeft:{x:0,y:0},size:{x:c||0,y:d||0}},displayOnBackground:!1,currentVideo:null,background:null})}}}}return n}function Od(e,t,n){var i=0;null!=t&&(i=t);var r=null;if(n.attributes.skipoffset&&(r=sn(n.attributes.skipoffset),isNaN(r)&&(r=null)),n=Sn(n,"MediaFiles")){var a=yn(n,"MediaFile");for(n=a,(a=a.filter(function(e){return"streaming"==e.attributes.delivery})).length&&(n=a),n=n.sort(function(e,t){return(parseInt(t.attributes.height,10)||0)-(parseInt(e.attributes.height,10)||0)}),a=(n=l(n)).next();!a.done;a=n.next())if(!(a=a.value).attributes.apiFramework){var o=_n(a);if(o){e.push({id:null,groupId:null,startTime:i,endTime:null,uri:o,mimeType:a.attributes.type||null,isSkippable:null!=r,skipOffset:r,skipFor:null,canJump:!1,resumeOffset:0,playoutLimit:null,once:!0,pre:null==t,post:1/0==t,timelineRange:!1,loop:!1,overlay:null,displayOnBackground:!1,currentVideo:null,background:null});break}}}}function Ud(t,n,i,r,a){var o=this;this.u=t,this.i=n,this.F=!1,this.B=this.s=null,this.G=NaN,this.l=a,this.j=null,this.h=new At,google.ima.settings.setLocale(i),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0),this.D=new google.ima.AdDisplayContainer(this.u,this.i),this.D.initialize(),this.m=new google.ima.AdsLoader(this.D),this.m.getSettings().setPlayerType("shaka-player"),this.m.getSettings().setPlayerVersion("v4.15.9"),this.g=null,this.C=r||new google.ima.AdsRenderingSettings,this.h.o(this.m,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,function(t){!function(t,n){if(t.l(new V("ads-loaded",(new Map).set("loadTime",Date.now()/1e3-t.G))),t.s.customPlayheadTracker){var i={currentTime:t.i.currentTime};t.g=n.getAdsManager(i,t.C),t.i.muted?t.g.setVolume(0):t.g.setVolume(t.i.volume),t.h.o(t.i,"timeupdate",function(){t.i.duration&&(i.currentTime=t.i.currentTime)}),t.h.o(t.i,"volumechange",function(){t.j&&(t.j.setVolume(t.i.volume),t.i.muted&&t.j.setMuted(!0))})}else t.g=n.getAdsManager(t.i,t.C);t.l(new V("ima-ad-manager-loaded",(new Map).set("imaAdManager",t.g)));var r=t.g.getCuePoints();if(r.length){n=[];for(var a=(r=l(r)).next();!a.done;a=r.next())n.push({start:a.value,end:null});t.l(new V("ad-cue-points-changed",(new Map).set("cuepoints",n)))}!function(e){function t(t,n){t=(new Map).set("originalEvent",t),e.l(new V(n,t))}e.h.o(e.g,google.ima.AdErrorEvent.Type.AD_ERROR,function(t){Bd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,function(t){Fd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.STARTED,function(t){Fd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.FIRST_QUARTILE,function(e){t(e,"ad-first-quartile")}),e.h.o(e.g,google.ima.AdEvent.Type.MIDPOINT,function(e){t(e,"ad-midpoint")}),e.h.o(e.g,google.ima.AdEvent.Type.THIRD_QUARTILE,function(e){t(e,"ad-third-quartile")}),e.h.o(e.g,google.ima.AdEvent.Type.COMPLETE,function(e){t(e,"ad-complete")}),e.h.o(e.g,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,function(t){jd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(t){jd(e,t)}),e.h.o(e.g,google.ima.AdEvent.Type.SKIPPED,function(e){t(e,"ad-skipped")}),e.h.o(e.g,google.ima.AdEvent.Type.VOLUME_CHANGED,function(e){t(e,"ad-volume-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.VOLUME_MUTED,function(e){t(e,"ad-muted")}),e.h.o(e.g,google.ima.AdEvent.Type.PAUSED,function(n){e.j&&(e.j.i=!0,t(n,"ad-paused"))}),e.h.o(e.g,google.ima.AdEvent.Type.RESUMED,function(n){e.j&&(e.j.i=!1,t(n,"ad-resumed"))}),e.h.o(e.g,google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,function(n){e.j&&t(n,"ad-skip-state-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.CLICK,function(e){t(e,"ad-clicked")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_PROGRESS,function(e){t(e,"ad-progress")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_BUFFERING,function(e){t(e,"ad-buffering")}),e.h.o(e.g,google.ima.AdEvent.Type.IMPRESSION,function(e){t(e,"ad-impression")}),e.h.o(e.g,google.ima.AdEvent.Type.DURATION_CHANGE,function(e){t(e,"ad-duration-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.USER_CLOSE,function(e){t(e,"ad-closed")}),e.h.o(e.g,google.ima.AdEvent.Type.LOADED,function(e){t(e,"ad-loaded")}),e.h.o(e.g,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(e){t(e,"all-ads-completed")}),e.h.o(e.g,google.ima.AdEvent.Type.LINEAR_CHANGED,function(e){t(e,"ad-linear-changed")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_METADATA,function(e){t(e,"ad-metadata")}),e.h.o(e.g,google.ima.AdEvent.Type.LOG,function(e){t(e,"ad-recoverable-error")}),e.h.o(e.g,google.ima.AdEvent.Type.AD_BREAK_READY,function(e){t(e,"ad-break-ready")}),e.h.o(e.g,google.ima.AdEvent.Type.INTERACTION,function(e){t(e,"ad-interaction")})}(t);try{t.g.init(t.i.offsetWidth,t.i.offsetHeight),t.h.o(t.i,"loadeddata",function(){t.g.resize(t.i.offsetWidth,t.i.offsetHeight)}),"ResizeObserver"in e?(t.B=new ResizeObserver(function(){t.g.resize(t.i.offsetWidth,t.i.offsetHeight)}),t.B.observe(t.i)):t.h.o(document,"fullscreenchange",function(){t.g.resize(t.i.offsetWidth,t.i.offsetHeight)}),t.F||t.s.skipPlayDetection?t.g.start():t.h.ra(t.i,"play",function(){t.F=!0,t.g.start()})}catch(e){jd(t,null)}}(o,t)}),this.h.o(this.m,google.ima.AdErrorEvent.Type.AD_ERROR,function(e){Bd(o,e)}),this.h.o(this.i,"ended",function(){o.m.contentComplete()}),this.h.ra(this.i,"play",function(){o.F=!0})}function Bd(e,t){t.getError(),t=(new Map).set("originalEvent",t),e.l(new V("ad-error",t)),jd(e,null),e.l(new V("ad-cue-points-changed",(new Map).set("cuepoints",[])))}function Fd(e,t){var n=t.getAd();n?(e.j=new Dd(n,e.g,e.i),t.type!=google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED||e.s.supportsMultipleMediaElements||e.l(new V("ad-content-pause-requested")),t=(new Map).set("ad",e.j).set("sdkAdObject",n).set("originalEvent",t),e.l(new V("ad-started",t)),e.j.isLinear()&&(e.u.setAttribute("ad-active","true"),e.s.customPlayheadTracker||e.i.pause(),e.i.muted?((t=e.j).j=e.i.volume,t.h.setVolume(0)):e.j.setVolume(e.i.volume))):Y("The IMA SDK fired a "+t.type+" event with no associated ad. Unable to play ad!")}function jd(e,t){t&&t.type==google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED&&!e.s.supportsMultipleMediaElements&&e.l(new V("ad-content-resume-requested")),e.l(new V("ad-stopped",(new Map).set("originalEvent",t))),e.j&&e.j.isLinear()&&(e.u.removeAttribute("ad-active"),e.s.customPlayheadTracker||e.i.ended||e.i.play())}function Gd(e,t,n,i,r,a){this.g=e,this.i=t,this.j=(this.h=t.isSkippable)?t.skipOffset||0:t.skipOffset,this.l=t.skipFor,this.B=n,this.s=i,this.m=r,this.u=a,this.C=t.overlay}function Hd(e,t,n){this.g=e,this.j=t,this.h=n,this.i=null==e.overlay}function Vd(e,t,n,i){var r=this;this.L=null,this.C=e,this.D=t,this.g=n,this.G=null,this.B=!0,this.h=this.g,this.i=i,this.R=new Set,this.H=new Set,this.F=new Map,this.K=new Map,this.j=new _c,Qd(this),this.I=new At,this.l=new At,this.J=!1,this.Z=this.s=this.u=this.m=null,this.$=!1,this.O=-1,this.Y=function(){if(!r.J&&r.m&&!r.D.Ca()){r.m=r.g.currentTime;var e=Xd(r);e&&Yd(r,e,1,1,Date.now())}},this.U=function(){if(!(r.J||r.m||r.D.Ca())){r.m=r.g.currentTime;var e=Xd(r,!0);e||(e=Xd(r)),e&&Yd(r,e,1,1,Date.now())}},this.ba=function(){if(!r.J&&r.m&&!r.D.Ca()){var e=r.g.currentTime;r.u&&!r.u.pre&&!r.u.post&&e<(r.u.endTime||r.u.startTime)&&(r.u=null)}},this.P=new zi(this.Y),this.N=new zi(function(){var e,t,n,i,a,o,s,u,h,c,d;return L(function(p){switch(p.g){case 1:if(!r.H.size||null==r.m){p.A(0);break}if((e=r.D.m)==Td||e==Ad)return p.return();t=!1,n=Array.from(r.H),i=r.D.xa(),a=l(n),o=a.next();case 3:if(o.done){p.A(5);break}if((s=o.value)==r.u){p.A(4);break}if(u=s.endTime||s.startTime,!(1<=i.start-u)){0<(h=s.startTime-r.m)&&10>=h&&(!r.F.has(s)&&ep(s)&&r.F.set(s,r.j.preload(s.uri,null,s.mimeType||void 0)),np(r,s)),p.A(4);break}if(!r.F.has(s)){p.A(7);break}return _(p,r.F.get(s),8);case 8:(c=p.h)&&c.destroy(),r.F.delete(s);case 7:ip(r,s),d=JSON.stringify(s),r.R.has(d)&&r.R.delete(d),r.H.delete(s),Wd(r),s.overlay||(t=!0);case 4:o=a.next(),p.A(3);break;case 5:t&&Jd(r),w(p)}})}),this.configure(this.D.getConfiguration().ads)}function Wd(e){e.$&&!e.H.size&&(e.I.Da(e.g,"playing",e.U),e.I.Da(e.g,"timeupdate",e.U),e.I.Da(e.g,"seeked",e.ba),e.I.Da(e.g,"ended",e.Y),-1!=e.O&&(e.g.cancelVideoFrameCallback(e.O),e.O=-1),e.P&&e.P.stop(),e.N&&e.N.stop(),e.$=!1)}function zd(e){if(e.C&&e.L&&!e.J){var t=e.L.supportsMultipleMediaElements,n=e.g;n.webkitPresentationMode&&"inline"!==n.webkitPresentationMode&&(t=!1),e.B==t&&(e.B=!t,e.B?(e.h=e.g,e.G&&(e.G.parentElement&&e.C.removeChild(e.G),e.G=null)):(e.G||((t=document.createElement(e.g.tagName)).autoplay=!0,t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.display="none",t.setAttribute("playsinline",""),e.G=t),e.h=e.G))}else e.B=!0}function Kd(e,t){var n,i,r,a,o,s,u,h;L(function(c){switch(c.g){case 1:n=!1,i=l(t),r=i.next();case 2:if(r.done){c.A(4);break}if(!(a=r.value).uri){Y("Missing URL in interstitial",a),c.A(3);break}if(a.mimeType){c.A(5);break}return S(c,6),o=e.j.Jb(),_(c,xh(a.uri,o,e.D.getConfiguration().streaming.retryParameters),8);case 8:a.mimeType=c.h,A(c,5);break;case 6:E(c);case 5:if(s=a.id||JSON.stringify(a),e.R.has(s)){c.A(3);break}a.loop&&!a.overlay&&Y("Loop is only supported in overlay interstitials",a),a.overlay||(n=!0),e.R.add(s),e.H.add(a),u=!1,a.pre&&null==e.m?u=!0:0!=a.startTime||a.canJump?null!=e.m&&0<(h=a.startTime-e.m)&&10>=h&&(u=!0):u=!0,u&&(!e.F.has(a)&&ep(a)&&e.F.set(a,e.j.preload(a.uri,null,a.mimeType||void 0)),np(e,a));case 3:r=i.next(),c.A(2);break;case 4:n&&Jd(e),function(e){if(!e.$&&e.H.size){if(e.I.o(e.g,"playing",e.U),e.I.o(e.g,"timeupdate",e.U),e.I.o(e.g,"seeked",e.ba),e.I.o(e.g,"ended",e.Y),"requestVideoFrameCallback"in e.g&&!tp()){var t=e.g,n=function(){-1!=e.O&&(e.Y(),-1!=e.O&&(e.O=t.requestVideoFrameCallback(n)))};e.O=t.requestVideoFrameCallback(n)}else e.P.ya(.025);e.N&&e.N.ya(1),e.$=!0}}(e),w(c)}})}function Xd(e,t,n){t=void 0!==t&&t,n=void 0===n?null:n;var i=0,r=null;if(e.H.size&&null!=e.m){var a=e.g.ended,o=Array.from(e.H).sort(function(e,t){return t.startTime-e.startTime}),s=o;for(s=t?o.filter(function(e){return e.pre}):a?o.filter(function(e){return e.post}):o.filter(function(e){return!e.pre&&!e.post}),s=(o=l(s)).next();!s.done;s=o.next()){s=s.value;var u=!1;if(t)u=s.pre;else if(a)u=s.post;else if(!s.pre&&!s.post){var h=e.m-Math.round(1e3*s.startTime)/1e3,c=1;e.L.allowStartInMiddleOfInterstitial&&s.endTime&&1/0!=s.endTime&&(c=s.endTime-s.startTime),(0=s.startTime))}u&&(!e.u||s.startTime>=e.u.startTime)&&(i==(n||0)?r=s:r&&!s.canJump&&.001Math.abs(e.startTime-t.startTime)}).length),t.once&&(a++,e.H.delete(t),Wd(e),t.overlay||Jd(e)),t.mimeType&&(t.mimeType.startsWith("image/")||"text/html"===t.mimeType)?t.overlay?function(e,t,n,i,r){function a(){e.s&&(e.s.stop(),e.s=null),e.C.removeChild(u),Zd(e,t),e.i(new V("ad-stopped")),e.l.Sa();var a=Xd(e,t.pre,i-r);a?Yd(e,a,n,++i,Date.now(),r):e.J=!1}e.J=!0;var o=t.overlay,s="text/html"==t.mimeType?"iframe":"img",u=document.createElement(s);u.style.objectFit="contain",u.style.position="absolute",u.style.border="none",qd(e,t),e.i(new V("ad-started",(new Map).set("ad",new Hd(t,n,i)))),"iframe"==s?u.src=t.uri:(u.src=t.uri,u.onerror=function(t){e.i(new V("ad-error",(new Map).set("originalEvent",t))),a()});var l=o.viewport,h=o.topLeft;o=o.size,0==l.x&&0==l.y?(u.width=t.overlay.size.x,u.height=t.overlay.size.y,u.style.bottom="10%",u.style.left="0",u.style.right="0",u.style.width="100%",t.overlay.size.y||"iframe"!=s||(u.style.height="auto")):(u.style.height=o.y/l.y*100+"%",u.style.left=h.x/l.x*100+"%",u.style.top=h.y/l.y*100+"%",u.style.width=o.x/l.x*100+"%"),e.C.appendChild(u);var c=Date.now();e.s&&e.s.stop(),e.s=new zi(function(){t.playoutLimit&&(Date.now()-c)/1e3>t.playoutLimit||t.endTime&&e.g.currentTime>t.endTime?(e.i(new V("ad-complete")),a()):e.g.currentTimet.endTime)&&(e.s&&e.s.stop(),e.i(new V("ad-skipped")),a())})}(e,t,n,i,a):Y("Unsupported interstitial",t):e.B&&t.overlay?Y("Unsupported interstitial",t):function(e,t,n,i,r,a){var o,s,u,l,h,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M;L(function(P){switch(P.g){case 1:if(o=Date.now(),e.J=!0,s=!1,u=function(){if(!e.B&&!t.overlay&&null==t.resumeOffset)if(t.timelineRange&&t.endTime&&1/0!=t.endTime)e.g.currentTime!=t.endTime&&(e.g.currentTime=t.endTime);else{var n=Date.now();e.g.currentTime+=(n-r)/1e3,r=n}},l=function(o){var s,l;return L(function(h){if(1==h.g){if(u(),s=Xd(e,t.pre,i-a),o&&t.groupId)for(;s&&s.groupId==t.groupId;)i++,s=Xd(e,t.pre,i-a);return e.s&&(!t.groupId||s&&s.groupId!=t.groupId)&&(e.s.stop(),e.s=null),Zd(e,t),s&&!s.overlay?h.A(2):(t.post&&(e.m=null,e.u=null),e.B?_(h,e.j.detach(),4):_(h,e.j.nc(),4))}2!=h.g&&(e.B&&(null==(l=t.resumeOffset)&&(l=t.timelineRange&&t.endTime&&1/0!=t.endTime?t.endTime-(e.m||0):(Date.now()-r)/1e3),e.i(new V("ad-content-resume-requested",(new Map).set("offset",l)))),e.i(new V("ad-stopped")),e.l.Sa(),e.J=!1,e.B?Jd(e):(e.h.style.display="none",u(),e.g.ended||e.g.play())),zd(e),s&&(e.i(new V("ad-stopped")),e.l.Sa(),Yd(e,s,n,++i,r,a)),w(h)})},h=function(t){return L(function(n){return s?n.return():(s=!0,e.i(new V("ad-error",(new Map).set("originalEvent",t))),_(n,l(!1),0))})},c=function(){return L(function(t){if(1==t.g)return s?t.return():(s=!0,_(t,l(!1),2));e.i(new V("ad-complete")),w(t)})},e.Z=function(){return L(function(t){return s?t.return():(s=!0,e.i(new V("ad-skipped")),_(t,l(!0),0))})},d=new Gd(e.h,t,e.Z,n,i,!e.B),e.B||(d.setMuted(e.g.muted),d.setVolume(e.g.volume)),e.i(new V("ad-started",(new Map).set("ad",d))),(p=d.canSkipNow())&&e.i(new V("ad-skip-state-changed")),e.l.ra(e.j,"error",h),e.l.o(e.h,"timeupdate",function(){if(e.h.duration){var t=d.canSkipNow();p!=t&&0=t.playRangeEnd?c():e.i(new V("ad-paused"))}),e.l.o(e.h,"volumechange",function(){e.h.muted?e.i(new V("ad-muted")):e.i(new V("ad-volume-changed"))}),!e.B||1!=i){P.A(2);break}return e.i(new V("ad-content-pause-requested",(new Map).set("saveLivePosition",!0))),f=new Br,g=function(t){return L(function(n){if(1==n.g)return"detach"!=t.state?n.A(0):tp()?_(n,new Promise(function(e){return new zi(e).X(.1)}),3):n.A(3);f.resolve(),e.l.Da(e.D,"onstatechange",g),w(n)})},e.l.o(e.D,"onstatechange",g),_(P,f,2);case 2:return qd(e,t),e.B||(e.h.style.display="",t.overlay?(e.h.loop=t.loop,m=t.overlay.viewport,v=t.overlay.topLeft,y=t.overlay.size,e.h.style.height=y.y/m.y*100+"%",e.h.style.left=v.x/m.x*100+"%",e.h.style.top=v.y/m.y*100+"%",e.h.style.width=y.x/m.x*100+"%"):(e.g.pause(),null!=t.resumeOffset&&0!=t.resumeOffset&&(e.g.currentTime+=t.resumeOffset),e.h.loop=!1,e.h.style.height="100%",e.h.style.left="0",e.h.style.top="0",e.h.style.width="100%")),S(P,4),Qd(e),t.startTime&&t.endTime&&1/0!=t.endTime&&t.startTime!=t.endTime&&0<(b=t.endTime-t.startTime)&&e.j.configure("playRangeEnd",b),t.playoutLimit&&!e.s&&(e.s=new zi(function(){e.Z()}).X(t.playoutLimit),e.j.configure("playRangeEnd",t.playoutLimit)),_(P,e.j.ac(e.h),6);case 6:return T=null,e.L.allowStartInMiddleOfInterstitial&&null!=e.m&&(x=e.m-t.startTime,.25t.endTime)&&e.Z()})),A(P,0);break;case 4:if(M=E(P),!e.J)return P.return();h(M),w(P)}})}(e,t,n,i,r,a)}function qd(e,t){if(t.displayOnBackground&&(e.g.style.zIndex="1"),null!=t.currentVideo){var n=t.currentVideo;e.g.style.transformOrigin="top left";var i=!0,r=[],a=n.topLeft.x/n.viewport.x*100;0=a&&(r.push("translateX("+a+"%)"),i=!1),0<(a=n.topLeft.y/n.viewport.y*100)&&100>=a&&(r.push("translateY("+a+"%)"),i=!1),1>(a=n.size.x/n.viewport.x)&&r.push("scaleX("+a+")"),n=n.size.y/n.viewport.y,1>a&&r.push("scaleY("+n+")"),r.length&&(e.g.style.transform=r.join(" ")),i&&(e.g.style.transition="transform 250ms")}e.C&&(e.C.style.pointerEvents="none",t.background&&(e.C.style.background=t.background)),e.G&&(e.G.style.background=t.overlay?"":"rgb(0, 0, 0)")}function Zd(e,t){t&&!t.displayOnBackground||(e.g.style.zIndex=""),t&&null==t.currentVideo||(e.g.style.transformOrigin="",e.g.style.transition="",e.g.style.transform=""),e.C&&(e.C.style.pointerEvents="",!t||t.background)&&(e.C.style.background=""),e.G&&(e.G.style.background="")}function Jd(e){for(var t=[],n=l(e.H),i=n.next(),r={};!i.done;r={Dc:void 0},i=n.next())(i=i.value).overlay||(r.Dc={start:i.startTime,end:null},i.pre?(r.Dc.start=0,r.Dc.end=null):i.post?(r.Dc.start=-1,r.Dc.end=null):i.timelineRange&&(r.Dc.end=i.endTime),t.find(function(e){return function(t){return e.Dc.start==t.start&&e.Dc.end==t.end}}(r))||t.push(r.Dc));e.i(new V("ad-cue-points-changed",(new Map).set("cuepoints",t)))}function Qd(e){e.j.configure(e.D.Ui()),e.j.configure("ads.disableHLSInterstitial",!0),e.j.configure("ads.disableDASHInterstitial",!0),e.j.configure("playRangeEnd",1/0),qr(e.D.Jb(),e.j.Jb())}function $d(e,t,n){var i,r;return L(function(a){return 1==a.g?(i=Zr([t],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}),_(a,e.D.Jb().request(7,i,n).promise,2)):(r=a.h,a.return(r.data))})}function ep(e){return!(e=e.mimeType)||!e.startsWith("image/")&&"text/html"!==e}function tp(){var e=Me().Ja();return"TV"==e||"CONSOLE"==e||"CAST"==e}function np(e,t){if(!(e.K.has(t)||e.L&&!e.L.allowPreloadOnDomElements)){var n=function(e){var t=document.createElement("link");return t.rel="preload",t.href=e,t.as="image",document.head.appendChild(t),t},i=[];if(t.background){var r=t.background.match(/url\(('|")?([^'"()]+)('|")\)?/);r&&i.push(n(r[2]))}t.mimeType.startsWith("image/")&&i.push(n(t.uri)),e.K.set(t,i)}}function ip(e,t){if(e.K.has(t)){for(var n=e.K.get(t),i=(n=l(n)).next();!i.done;i=n.next())(i=i.value).parentNode.removeChild(i);e.K.delete(t)}}function rp(e,t,n,i,r){this.h=e,this.j=sn(this.h.skipOffset),this.g=r,this.i=t,this.l=n,this.s=i,this.m=!1}function ap(e,t,n,i){this.C=e,this.J=t,this.h=n,this.l=null,this.O=NaN,this.i=i,this.I=!1,this.B=null,this.j=[],this.L=[],this.K=this.D=this.g=null,this.F=new Map,this.m=[],this.u=[],this.G="",this.N=!0,this.H="",this.s=new At}function op(e,t){var n,i,r,a,o,s,u,l;L(function(h){return 1==h.g?t.staticResource?(n=sp(t),e.F.get(n)?h.return():(i={type:9},r=Zr([t.staticResource],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}),a=e.J.request(7,r,i),S(h,2),e.F.set(n,[]),_(h,a.promise,4))):h.return():2!=h.g?(o=h.h,s=Ne(o.data),u=JSON.parse(s),l=u.apps,e.F.set(n,l),A(h,0)):(E(h),e.F.delete(n),void w(h))})}function sp(e){return[e.adId,e.adParameters,e.adSystem,e.adTitle,e.creativeAdId,e.creativeId,e.creativeSequence,e.height,e.width,e.staticResource].join("")}function up(e){var t=e.h.currentTime;if(0!=t&&null==e.B){for(var n,i,r=l(e.j),a=r.next();!a.done;a=r.next())for(var o=l((a=a.value).ads),s=o.next();!s.done;s=o.next())if(s=s.value,i){if(s.startTimeInSecondsi.startTimeInSeconds+i.durationInSeconds){i=s,n=a;break}}else s.startTimeInSeconds=i.startTimeInSeconds+.25*i.durationInSeconds&&!e.u.includes("firstQuartile")?(e.u.push("firstQuartile"),dp(e,"firstQuartile")):t>=r&&!e.u.includes("midpoint")?(e.u.push("midpoint"),dp(e,"midpoint")):t>=a&&!e.u.includes("thirdQuartile")&&(e.u.push("thirdQuartile"),dp(e,"thirdQuartile")),i=e.g.getRemainingTime(),r=e.g.getDuration(),e.g.canSkipNow()&&0=i||i>r)&&hp(e)}if(!e.g||!e.g.isLinear()){e:for(i=l(e.j),r=i.next();!r.done&&(r=r.value,!e.g||!e.g.isLinear());r=i.next())for(a=0;at){if(e.L.includes(o.adId)){if(e.h.ended)continue;e.h.currentTime=s;break e}hp(e),e.K=r,e.g=new rp(o,a+1,r.ads.length,!0,e.h),e.D=o,0===a&&dp(e,"breakStart"),cp(e);break}}if(!e.g)for(r=(i=l(e.j)).next();!r.done&&(r=r.value,!e.g);r=i.next())for(a=0;at&&(e.h.currentTime=e.B),e.B=null)}}}function hp(e){if(e.g){for(;e.C.lastChild;)e.C.removeChild(e.C.firstChild);e.I||e.L.push(e.D.adId);var t=e.g.m;dp(e,void 0!==t&&t?"skip":"complete");for(var n=(t=l(e.m)).next();!n.done;n=t.next())n=n.value,e.s.Da(n.target,n.type,n.listener);e.m=[],e.u=[],(t=e.g.getPositionInSequence())===(n=e.g.getSequenceLength())&&dp(e,"breakEnd"),e.g=null,e.D=null,e.K=null}}function cp(e){var t=!1;e.h.paused?t=!0:(dp(e,"impression"),dp(e,"start")),e.m.push({target:e.h,type:"volumechange",listener:function(){e.h.muted&&dp(e,"mute")}}),e.m.push({target:e.h,type:"volumechange",listener:function(){e.h.muted||dp(e,"unmute")}}),e.m.push({target:e.h,type:"play",listener:function(){t?(dp(e,"impression"),dp(e,"start"),t=!1):dp(e,"resume")}}),e.m.push({target:e.h,type:"pause",listener:function(){dp(e,"pause")}});for(var n=l(e.m),i=n.next();!i.done;i=n.next())i=i.value,e.s.o(i.target,i.type,i.listener)}function dp(e,t){var n=e.D.trackingEvents.find(function(e){return e.eventType==t});if(n||(n=e.K.adBreakTrackingEvents.find(function(e){return e.eventType==t})),n)for(var i={type:10},r=(n=l(n.beaconUrls)).next();!r.done;r=n.next())(r=r.value)&&""!=r&&((r=Zr([r],Ur())).method="POST",e.J.request(7,r,i));switch(t){case"impression":e.i(new V("ad-impression"));break;case"start":e.i(new V("ad-started",(new Map).set("ad",e.g)));break;case"mute":e.i(new V("ad-muted"));break;case"unmute":e.i(new V("ad-volume-changed"));break;case"resume":e.i(new V("ad-resumed"));break;case"pause":e.i(new V("ad-paused"));break;case"firstQuartile":e.i(new V("ad-first-quartile"));break;case"midpoint":e.i(new V("ad-midpoint"));break;case"thirdQuartile":e.i(new V("ad-third-quartile"));break;case"complete":e.i(new V("ad-complete")),e.i(new V("ad-stopped"));break;case"skip":e.i(new V("ad-skipped")),e.i(new V("ad-stopped"));break;case"breakStart":e.C.setAttribute("ad-active","true");break;case"breakEnd":e.C.removeAttribute("ad-active");break;case"skipStateChanged":e.i(new V("ad-skip-state-changed"))}}function pp(e,t){this.g=e,this.i=null,this.h=t}function fp(e,t,n,i){var r=this;this.u=e,this.l=t,this.j=null,this.F=NaN,this.i=i,this.G=!1,this.B=this.m=this.s=null,this.C="",this.D=[],this.h=new At,(e=new google.ima.dai.api.UiSettings).setLocale(n),this.g=new google.ima.dai.api.StreamManager(this.l,this.u,e),this.i(new V("ima-stream-manager-loaded",(new Map).set("imaStreamManager",this.g))),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.LOADED,function(e){!function(e,t){e.i(new V("ads-loaded",(new Map).set("loadTime",Date.now()/1e3-e.F))),t=t.getStreamData().url,e.j.resolve(t),e.j=null,e.G||e.h.o(e.l,"seeked",function(){var t=e.l.currentTime;if(0!=t){e.g.streamTimeForContentTime(t);var n=e.g.previousCuePointForStreamTime(t);n&&!n.played&&(e.s=t,e.l.currentTime=n.start)}})}(r,e)}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.ERROR,function(){r.C.length?r.j.resolve(r.C):r.j.reject("IMA Stream request returned an error and there was no backup asset uri provided."),r.j=null}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,function(){}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.STARTED,function(e){e=e.getAd(),r.m=new pp(e,r.l),r.B&&(r.m.i=r.B),r.i(new V("ad-started",(new Map).set("ad",r.m))),r.u.setAttribute("ad-active","true")}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,function(){r.u.removeAttribute("ad-active");var e=r.l.currentTime;r.s&&r.s>e&&(r.l.currentTime=r.s,r.s=null)}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,function(e){r.B=e.getStreamData().adProgressData,r.m&&(r.m.i=r.B)}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.FIRST_QUARTILE,function(){r.i(new V("ad-first-quartile"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.MIDPOINT,function(){r.i(new V("ad-midpoint"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.THIRD_QUARTILE,function(){r.i(new V("ad-third-quartile"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.COMPLETE,function(){r.i(new V("ad-complete")),r.i(new V("ad-stopped")),r.u.removeAttribute("ad-active"),r.m=null}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.SKIPPED,function(){r.i(new V("ad-skipped")),r.i(new V("ad-stopped"))}),this.h.o(this.g,google.ima.dai.api.StreamEvent.Type.CUEPOINTS_CHANGED,function(e){var t=e.getStreamData();e=[];for(var n=(t=l(t.cuepoints)).next();!n.done;n=t.next())n=n.value,e.push({start:n.start,end:n.end});r.D=e,r.i(new V("ad-cue-points-changed",(new Map).set("cuepoints",e)))})}function gp(){$.call(this),this.h=this.i=this.j=this.g=null,this.m=new Pd,this.s=navigator.language,this.l=null}function mp(e,t){if(t&&t.type)switch(t.type){case"ads-loaded":e.m.g.push(t.loadTime);break;case"ad-started":e.m.h++;var n=t.ad;n&&!n.isLinear()&&e.m.j++;break;case"ad-complete":e.m.l++;break;case"ad-skipped":e.m.m++;break;case"ad-error":e.m.i++}e.dispatchEvent(t)}function vp(e){return JSON.stringify(e,function(e,t){if("function"!=typeof t){if(t instanceof Event||t instanceof V){var n={};for(i in t)(e=t[i])&&"object"==typeof e?"detail"==i&&(n[i]=e):i in Event||(n[i]=e);return n}if(t instanceof Error){var i=new Set(["name","message","stack"]);for(n in t)i.add(n);for(e=(n=l(Object.getOwnPropertyNames(t))).next();!e.done;e=n.next())i.add(e.value);for(n={},e=(i=l(i)).next();!e.done;e=i.next())n[e=e.value]=t[e];t={__type__:"Error",contents:n}}else if(t instanceof TimeRanges){for(i={__type__:"TimeRanges",length:t.length,start:[],end:[]},n=(t=l(rs(t))).next();!n.done;n=t.next())e=(n=n.value).end,i.start.push(n.start),i.end.push(e);t=i}else t=ArrayBuffer.isView(t)&&1===t.BYTES_PER_ELEMENT?{__type__:"Uint8Array",entries:Array.from(t)}:"number"==typeof t?isNaN(t)?"NaN":isFinite(t)?t:0>t?"-Infinity":"Infinity":t;return t}})}function yp(e){return JSON.parse(e,function(e,t){if("NaN"==t)var n=NaN;else if("-Infinity"==t)n=-1/0;else if("Infinity"==t)n=1/0;else if(t&&"object"==typeof t&&"TimeRanges"==t.__type__)n=function(e){return{length:e.length,start:function(t){return e.start[t]},end:function(t){return e.end[t]}}}(t);else if(t&&"object"==typeof t&&"Uint8Array"==t.__type__)n=new Uint8Array(t.entries);else if(t&&"object"==typeof t&&"Error"==t.__type__){for(n in e=t.contents,t=Error(e.message),e)t[n]=e[n];n=t}else n=t;return n})}(i=Dd.prototype).needsSkipUI=function(){return!1},i.isClientRendering=function(){return!0},i.hasCustomClick=function(){return!0},i.isUsingAnotherMediaElement=function(){return!0},i.getDuration=function(){return this.g.getDuration()},i.getMinSuggestedDuration=function(){return this.g.getMinSuggestedDuration()},i.getRemainingTime=function(){return this.h.getRemainingTime()},i.isPaused=function(){return this.i},i.isSkippable=function(){return 0<=this.g.getSkipTimeOffset()},i.getTimeUntilSkippable=function(){var e=this.g.getSkipTimeOffset();return e=this.getRemainingTime()-e,Math.max(e,0)},i.canSkipNow=function(){return this.h.getAdSkippableState()},i.skip=function(){return this.h.skip()},i.pause=function(){return this.h.pause()},i.play=function(){return this.h.resume()},i.getVolume=function(){return this.h.getVolume()},i.setVolume=function(e){return this.m.volume=e,this.h.setVolume(e)},i.isMuted=function(){return 0==this.h.getVolume()},i.isLinear=function(){return this.g.isLinear()},i.resize=function(e,t){this.h.resize(e,t)},i.setMuted=function(e){(this.m.muted=e)?(this.j=this.getVolume(),this.h.setVolume(0)):this.h.setVolume(this.j)},i.getSequenceLength=function(){var e=this.g.getAdPodInfo();return null==e?1:e.getTotalAds()},i.getPositionInSequence=function(){var e=this.g.getAdPodInfo();return null==e?1:e.getAdPosition()},i.getTitle=function(){return this.g.getTitle()},i.getDescription=function(){return this.g.getDescription()},i.getVastMediaBitrate=function(){return this.g.getVastMediaBitrate()},i.getVastMediaHeight=function(){return this.g.getVastMediaHeight()},i.getVastMediaWidth=function(){return this.g.getVastMediaWidth()},i.getVastAdId=function(){return""},i.getAdId=function(){return this.g.getAdId()},i.getCreativeAdId=function(){return this.g.getCreativeAdId()},i.getAdvertiserName=function(){return this.g.getAdvertiserName()},i.getMediaUrl=function(){return this.g.getMediaUrl()},i.getTimeOffset=function(){var e=this.g.getAdPodInfo();return null==e?0:e.getTimeOffset()},i.getPodIndex=function(){var e=this.g.getAdPodInfo();return null==e?0:e.getPodIndex()},i.release=function(){this.h=this.g=null},H("shaka.ads.ClientSideAd",Dd),Dd.prototype.release=Dd.prototype.release,Dd.prototype.getPodIndex=Dd.prototype.getPodIndex,Dd.prototype.getTimeOffset=Dd.prototype.getTimeOffset,Dd.prototype.getMediaUrl=Dd.prototype.getMediaUrl,Dd.prototype.getAdvertiserName=Dd.prototype.getAdvertiserName,Dd.prototype.getCreativeAdId=Dd.prototype.getCreativeAdId,Dd.prototype.getAdId=Dd.prototype.getAdId,Dd.prototype.getVastAdId=Dd.prototype.getVastAdId,Dd.prototype.getVastMediaWidth=Dd.prototype.getVastMediaWidth,Dd.prototype.getVastMediaHeight=Dd.prototype.getVastMediaHeight,Dd.prototype.getVastMediaBitrate=Dd.prototype.getVastMediaBitrate,Dd.prototype.getDescription=Dd.prototype.getDescription,Dd.prototype.getTitle=Dd.prototype.getTitle,Dd.prototype.getPositionInSequence=Dd.prototype.getPositionInSequence,Dd.prototype.getSequenceLength=Dd.prototype.getSequenceLength,Dd.prototype.setMuted=Dd.prototype.setMuted,Dd.prototype.resize=Dd.prototype.resize,Dd.prototype.isLinear=Dd.prototype.isLinear,Dd.prototype.isMuted=Dd.prototype.isMuted,Dd.prototype.setVolume=Dd.prototype.setVolume,Dd.prototype.getVolume=Dd.prototype.getVolume,Dd.prototype.play=Dd.prototype.play,Dd.prototype.pause=Dd.prototype.pause,Dd.prototype.skip=Dd.prototype.skip,Dd.prototype.canSkipNow=Dd.prototype.canSkipNow,Dd.prototype.getTimeUntilSkippable=Dd.prototype.getTimeUntilSkippable,Dd.prototype.isSkippable=Dd.prototype.isSkippable,Dd.prototype.isPaused=Dd.prototype.isPaused,Dd.prototype.getRemainingTime=Dd.prototype.getRemainingTime,Dd.prototype.getMinSuggestedDuration=Dd.prototype.getMinSuggestedDuration,Dd.prototype.getDuration=Dd.prototype.getDuration,Dd.prototype.isUsingAnotherMediaElement=Dd.prototype.isUsingAnotherMediaElement,Dd.prototype.hasCustomClick=Dd.prototype.hasCustomClick,Dd.prototype.isClientRendering=Dd.prototype.isClientRendering,Dd.prototype.needsSkipUI=Dd.prototype.needsSkipUI,H("shaka.ads.Utils",Rd),Rd.ADS_LOADED="ads-loaded",Rd.AD_STARTED="ad-started",Rd.AD_FIRST_QUARTILE="ad-first-quartile",Rd.AD_MIDPOINT="ad-midpoint",Rd.AD_THIRD_QUARTILE="ad-third-quartile",Rd.AD_COMPLETE="ad-complete",Rd.AD_STOPPED="ad-stopped",Rd.AD_SKIPPED="ad-skipped",Rd.AD_VOLUME_CHANGED="ad-volume-changed",Rd.AD_MUTED="ad-muted",Rd.AD_PAUSED="ad-paused",Rd.AD_RESUMED="ad-resumed",Rd.AD_SKIP_STATE_CHANGED="ad-skip-state-changed",Rd.CUEPOINTS_CHANGED="ad-cue-points-changed",Rd.IMA_AD_MANAGER_LOADED="ima-ad-manager-loaded",Rd.IMA_STREAM_MANAGER_LOADED="ima-stream-manager-loaded",Rd.AD_CLICKED="ad-clicked",Rd.AD_PROGRESS="ad-progress",Rd.AD_BUFFERING="ad-buffering",Rd.AD_IMPRESSION="ad-impression",Rd.AD_DURATION_CHANGED="ad-duration-changed",Rd.AD_CLOSED="ad-closed",Rd.AD_LOADED="ad-loaded",Rd.ALL_ADS_COMPLETED="all-ads-completed",Rd.AD_LINEAR_CHANGED="ad-linear-changed",Rd.AD_METADATA="ad-metadata",Rd.AD_RECOVERABLE_ERROR="ad-recoverable-error",Rd.AD_ERROR="ad-error",Rd.AD_BREAK_READY="ad-break-ready",Rd.AD_INTERACTION="ad-interaction",Rd.AD_CONTENT_PAUSE_REQUESTED="ad-content-pause-requested",Rd.AD_CONTENT_RESUME_REQUESTED="ad-content-resume-requested",Rd.AD_CONTENT_ATTACH_REQUESTED="ad-content-attach-requested",Ud.prototype.configure=function(e){this.s=e},Ud.prototype.stop=function(){this.g&&this.g.stop(),this.u&&hs(this.u)},Ud.prototype.release=function(){this.stop(),this.B&&this.B.disconnect(),this.h&&this.h.release(),this.g&&this.g.destroy(),this.m.destroy(),this.D.destroy()},(i=Gd.prototype).needsSkipUI=function(){return!0},i.isClientRendering=function(){return!0},i.hasCustomClick=function(){return!1},i.isUsingAnotherMediaElement=function(){return this.u},i.getDuration=function(){var e=this.g.duration;return isNaN(e)?-1:e},i.getMinSuggestedDuration=function(){return this.getDuration()},i.getRemainingTime=function(){var e=this.g.duration;return isNaN(e)?-1:e-this.g.currentTime},i.isPaused=function(){return this.g.paused},i.isSkippable=function(){return this.h&&null!=this.l?this.getDuration()-this.getRemainingTime()=r)return null;for(var a=-1,o=-1,s=0;sn||127n||0>t))if(t>=n)for(--i;0<=i;i--)e.i[t+i]=e.i[n+i].map(function(e){return e});else for(var r=0;rt;t++)e.i.push(Ff())}function Ff(){for(var e=[],t=0;42>t;t++)e.push(null);return e}function jf(e,t){Gf(e)&&(e.i[e.h][e.g]=new bf(t,e.D,e.B,e.u,e.C),e.g++)}function Gf(e){var t=e.g=t.g&&0>=t.h||(0>=t.g?(t.g=t.m-1,t.h--):t.g--,t.i[t.h][t.g]=null);break;case 13:t.isVisible()&&(r=Hf(t,i,e.i)),t.h+1>=t.s?function(e){for(var t=0,n=1;16>n;n++,t++)e.i[t]=e.i[n];for(n=0;1>n;n++,t++)e.i[t]=Ff()}(t):t.h++,t.g=0;break;case 14:t.isVisible()&&(r=Hf(t,i,e.i)),t.i[t.h]=Ff(),t.g=0;break;case 12:t.isVisible()&&(r=Hf(t,i,e.i)),Bf(t),t.h=0,t.g=0}return r?[r]:[]}function qf(e,t,n,i){if(128<=n&&135>=n)i=7&n,e.h[i]&&(e.g=e.h[i]);else{if(136===n){n=Kf(t).value,t=[];for(var r=(n=l(Zf(e,n))).next();!r.done;r=n.next()){if((r=e.h[r.value]).isVisible()){var a=Hf(r,i,e.i);a&&t.push(a)}Bf(r)}return t}if(137===n)for(n=(t=l(Zf(e,t=Kf(t).value))).next();!n.done;n=t.next())(n=e.h[n.value]).isVisible()||(n.j=i),n.display();else{if(138===n){for(n=Kf(t).value,t=null,r=(n=l(Zf(e,n))).next();!r.done;r=n.next())(r=e.h[r.value]).isVisible()&&(t=Hf(r,i,e.i)),r.l=!1;return t?[t]:[]}if(139===n){for(n=Kf(t).value,t=null,r=(n=l(Zf(e,n))).next();!r.done;r=n.next())(r=e.h[r.value]).isVisible()?t=Hf(r,i,e.i):r.j=i,r.l=!r.l;return t?[t]:[]}if(140===n)return Jf(e,t=Kf(t).value,i);if(143===n)return i=Jf(e,255,i),Qf(e),i;if(144===n)t.skip(1),i=Kf(t).value,e.g&&(e.g.B=0<(128&i),e.g.D=0<(64&i));else if(145===n)i=Kf(t).value,n=Kf(t).value,t.skip(1),e.g&&(t=$f((48&n)>>4,(12&n)>>2,3&n),e.g.C=$f((48&i)>>4,(12&i)>>2,3&i),e.g.u=t);else if(146===n)i=Kf(t).value,t=Kf(t).value,e.g&&((e=e.g).h=15&i,e.g=63&t);else if(151===n)t.skip(1),t.skip(1),i=Kf(t).value,t.skip(1),e.g&&(e.g.F=3&i);else if(152<=n&&159>=n){n=(15&n)-8,(r=null!==e.h[n])||((a=new Uf(n,e.i)).j=i,e.h[n]=a),i=Kf(t).value,a=Kf(t).value;var o=Kf(t).value,s=Kf(t).value,u=Kf(t).value;t=Kf(t).value,r&&!(7&t)||((t=e.h[n]).h=0,t.g=0,t.D=!1,t.B=!1,t.C="white",t.u="black"),(t=e.h[n]).l=0<(32&i),t.K=127&a,t.H=o,t.G=(240&s)>>4,t.J=0<(128&a),t.s=1+(15&s),t.m=1+(63&u),e.g=e.h[n]}}}return[]}function Zf(e,t){for(var n=[],i=0;8>i;i++)!(1&~t)&&e.h[i]&&n.push(i),t>>=1;return n}function Jf(e,t,n){for(var i=[],r=(t=l(Zf(e,t))).next();!r.done;r=t.next()){r=r.value;var a=e.h[r];a.isVisible()&&(a=Hf(a,n,e.i))&&i.push(a),e.h[r]=null}return i}function Qf(e){e.g=null,e.h=[null,null,null,null,null,null,null,null]}function $f(e,t,n){var i={0:0,1:0,2:1,3:1};return tg[(e=i[e])<<2|(t=i[t])<<1|(n=i[n])]}Uf.prototype.isVisible=function(){return this.l},Uf.prototype.display=function(){this.l=!0},zf.prototype.Oa=function(){return this.gthis.h.length)throw new Ce(2,2,3e3);this.g+=e},zf.prototype.xj=function(e){if(0>this.g-e)throw new Ce(2,2,3e3);this.g-=e};var eg=new Map([[32," "],[33," "],[37,"…"],[42,"Š"],[44,"Œ"],[48,"█"],[49,"‘"],[50,"’"],[51,"“"],[52,"”"],[53,"•"],[57,"™"],[58,"š"],[60,"œ"],[61,"℠"],[63,"Ÿ"],[118,"⅛"],[119,"⅜"],[120,"⅝"],[121,"⅞"],[122,"│"],[123,"┐"],[124,"└"],[125,"─"],[126,"┘"],[127,"┌"]]),tg="black blue green cyan red magenta yellow white".split(" ");function ng(){this.h=[],this.g=[],this.i=new Vf,this.l=0,this.m=new Map([["CC1",new Pf(0,0)],["CC2",new Pf(0,1)],["CC3",new Pf(1,0)],["CC4",new Pf(1,1)]]),this.u=this.s=0,this.j=new Map,this.C=!0,this.B=new Set,ig(this)}function ig(e){e.s=0,e.u=0;for(var t=l(e.m.values()),n=t.next();!n.done;n=t.next())(n=n.value).h=0,n.g=n.j,n.m=null,Sf(n.i),Sf(n.j),Sf(n.s);e.C=!0}function rg(e,t){var n=t.type;if(16==(112&t.Fb)){var i=t.Fb>>3&1;0===n?e.s=i:e.u=i}if(i="CC"+(1+(n<<1|(n?e.u:e.s))),n=e.m.get(i),255===t.Fb&&255===t.pc||!t.Fb&&!t.pc||!og(t.Fb)||!og(t.pc))return 45<=++e.l&&ig(e),null;e.l=0,t.Fb&=127,t.pc&=127;var r=t.Fb;if(1<=r&&15>=r||!t.Fb&&!t.pc)return null;if(r=null,16==(112&t.Fb))e:{if(e.B.add(i),i=t.Fb,e=t.pc,n.m===(i<<8|e))n.m=null;else if(n.m=i<<8|e,16==(240&i)&&64==(192&e)){t=[11,11,1,2,3,4,12,13,14,15,5,6,7,8,9,10][(7&i)<<1|e>>5&1],i="white",r=!1;var a=null,o=95=o?i=Of[Math.floor(o/2)]:15>=o?r=!0:a=Math.floor((o-16)/2),e=!(1&~e),4!==n.h&&(o=n.g,3===n.h&&t!==o.g&&(Af(o,n=1+t-o.h,1+o.g-o.h,o.h),Ef(o,0,n-1),Ef(o,t+1,15-t)),o.g=t,o.m=e,o.j=r,o.l=i,o.u=a,o.s="black")}else if(17==(247&i)&&32==(240&e))n.g.m=!1,n.g.j=!1,n.g.l="white",Tf(n.g,0,32),i=!1,"white_italics"===(t=Of[(14&e)>>1])&&(t="white",i=!0),n.g.m=!(1&~e),n.g.j=i,n.g.l=t;else if(16==(247&i)&&32==(240&e)||23==(247&i)&&45==(255&e))t="black",!(7&i)&&(t=Nf[(14&e)>>1]),n.g.s=t;else if(17==(247&i)&&48==(240&e))Tf(n.g,1,e);else if(18==(246&i)&&32==(224&e))Tf(n.g,1&i?3:2,e);else{if(20==(246&i)&&32==(240&e)){switch(e=t.pts,i=null,t.pc){case 32:Df(n);break;case 33:(n=n.g).i[n.g].pop();break;case 37:i=Lf(n,2,e);break;case 38:i=Lf(n,3,e);break;case 39:i=Lf(n,4,e);break;case 40:Tf(n.g,0,32);break;case 41:n.h=2,n.g=n.i,n.g.h=0,n.l=e;break;case 42:Sf(n.s),Rf(n);break;case 43:Rf(n);break;case 44:t=n.i,i=null,4!==n.h&&(i=wf(t,n.l,e)),Ef(t,0,15);break;case 45:t=n.g,3!==n.h?i=null:(i=wf(t,n.l,e),Af(t,(r=t.g-t.h+1)-1,r,t.h),Ef(t,0,r-1),Ef(t,t.g,15-t.g),n.l=e);break;case 46:Ef(n.j,0,15);break;case 47:t=null,4!==n.h&&(t=wf(n.i,n.l,e)),i=n.j,n.j=n.i,n.i=i,Df(n),n.l=e,i=t}r=i;break e}(23==i||31==i)&&33<=e&&35>=e&&(n.g.B=e-32)}r=null}else e=t.pc,Tf(n.g,0,t.Fb),Tf(n.g,0,e);return r}function ag(e,t){var n=[];try{for(;t.Oa();){var i=Kf(t).value,r=(224&i)>>5,a=31&i;if(7===r&&0!=a&&(r=63&Kf(t).value),0!=r){e.B.add("svc"+r),e.j.has(r)||e.j.set(r,new Xf(r));for(var o=e.j.get(r),s=t.Ua();t.Ua()-s=c)var p=Yf(r,u,c,d);else if(128<=c&&159>=c)p=qf(r,u,c,d);else{if(4096<=c&&4127>=c)r=u,8<=(u=255&c)&&15>=u?r.skip(1):16<=u&&23>=u?r.skip(2):24<=u&&31>=u&&r.skip(3);else if(4224<=c&&4255>=c)r=u,128<=(u=255&c)&&135>=u?r.skip(4):136<=u&&143>=u&&r.skip(5);else if(32<=c&&127>=c)u=c,r.g&&jf(r.g,127===u?"♪":String.fromCharCode(u));else if(160<=c&&255>=c)r.g&&jf(r.g,String.fromCharCode(c));else if(4128<=c&&4223>=c){if(u=255&c,r.g)if(eg.has(u)){var f=eg.get(u);jf(r.g,f)}else jf(r.g,"_")}else 4256<=c&&4351>=c&&r.g&&jf(r.g,160!=(255&c)?"_":"[CC]");p=[]}n.push.apply(n,h(p))}}}}catch(e){if(!(e instanceof Ce&&3e3===e.code))throw e;q("CEA708_INVALID_DATA","Buffer read out of bounds / invalid CEA-708 Data.")}return n}function og(e){for(var t=0;e;)t^=1&e,e>>=1;return 1===t}function sg(e){for(var t=[],n=e,i=e=0;i>1&63)||40==g;break;case pg:s=2,t.skip(1),g=23==(g=f>>1&63)||24==g;break;default:return}if(g)for(f=0,c(e=new ua(e,0)).getLength())&&181===e.aa()&&49===e.Ga()&&1195456820===e.W()&&3===e.aa()&&64&(n=e.aa()))for(n&=31,e.skip(1),i=0;i>2,o=e.aa(),s=e.aa();a&&(0==(r&=3)||1===r?this.h.push({pts:t,type:r,Fb:o,pc:s,order:this.h.length}):(this.g.push({pts:t,type:r,value:o,order:this.g.length}),this.g.push({pts:t,type:2,value:s,order:this.g.length})))}},ng.prototype.decode=function(){function e(e,t){return e.pts-t.pts||e.order-t.order}var t=[];this.h.sort(e),this.g.sort(e);for(var n=l(this.h),i=n.next();!i.done;i=n.next())(i=rg(this,i.value))&&t.push(i);for(i=(n=l(this.g)).next();!i.done;i=n.next())Wf(this.i,i.value);for(i=(n=l(this.i.i)).next();!i.done;i=n.next())i=ag(this,i.value),t.push.apply(t,h(i));return this.i.i=[],this.h=[],this.g=[],t},ng.prototype.getStreams=function(){return Array.from(this.B)},H("shaka.cea.CeaDecoder",ng),Xt=function(){return new ng},ug.prototype.init=function(e){function t(e){e=e.name,fg.has(e)&&(n.g=fg.get(e))}var n=this,i=[],r=[];if((new ca).box("moov",da).box("mvex",da).V("trex",function(e){var t=e.reader;t.skip(4),t.skip(4),e=t.W(),t=t.W(),n.h=e,n.i=t}).box("trak",da).V("tkhd",function(e){var t=e.reader;1==(e=e.version)?(t.skip(8),t.skip(8)):(t.skip(4),t.skip(4));var n=t.W();1==e?t.skip(8):t.skip(4),t.skip(4),t.skip(8),t.skip(2),t.skip(2),t.skip(2),t.skip(2),t.skip(36),t.Ga(),t.Ga(),t.Ga(),t.Ga(),i.push(n)}).box("mdia",da).V("mdhd",function(e){e=po(e.reader,e.version),r.push(e.timescale)}).box("minf",da).box("stbl",da).V("stsd",pa).box("avc1",t).box("avc3",t).box("dvav",t).box("dva1",t).box("hev1",t).box("hvc1",t).box("dvh1",t).box("dvhe",t).box("vvc1",t).box("vvi1",t).box("dvc1",t).box("dvi1",t).box("encv",fa).box("sinf",da).box("frma",function(e){e=mo(e.reader).codec,fg.has(e)&&(n.g=fg.get(e))}).parse(e,!0,!0),!i.length||!r.length||i.length!=r.length)throw new Ce(2,2,2010);this.g==hg&&Y("Unable to determine bitstream format for CEA parsing!"),i.forEach(function(e,t){n.j.set(e,r[t])})},ug.prototype.parse=function(e){var t=this;if(this.g==hg)return[];var n=[],i=0,r=[];return(new ca).box("moof",function(e){i=e.start,r=[],da(e)}).box("traf",function(e){r.push({baseMediaDecodeTime:null,be:t.h,ce:t.i,oj:[],timescale:9e4}),da(e)}).V("trun",function(e){var t=r[r.length-1];e=fo(e.reader,e.version,e.flags),t.oj.push(e)}).V("tfhd",function(e){var n=r[r.length-1];e=ho(e.reader,e.flags),n.be=e.be||t.h,n.ce=e.ce||t.i,e=e.trackId,t.j.has(e)&&(n.timescale=t.j.get(e))}).V("tfdt",function(e){var t=r[r.length-1];e=co(e.reader,e.version),t.baseMediaDecodeTime=e.baseMediaDecodeTime}).box("mdat",function(e){for(var a=i-e.start-8,o=e.reader.Ua(),s=l(r),u=s.next();!u.done;u=s.next())null===(u=u.value).baseMediaDecodeTime?Y("Unable to find base media decode time for CEA captions!"):(e.reader.seek(o),lg(t,e.reader,u.baseMediaDecodeTime,u.timescale,u.be,u.ce,a,u.oj,n))}).parse(e,!1,!0),n},H("shaka.cea.Mp4CeaParser",ug);var hg=0,cg=1,dg=2,pg=3,fg=(new Map).set("avc1",cg).set("avc3",cg).set("dvav",cg).set("dva1",cg).set("hev1",dg).set("hvc1",dg).set("dvh1",dg).set("dvhe",dg).set("vvc1",pg).set("vvi1",pg).set("dvc1",pg).set("dvi1",pg);function gg(){this.g=null}function mg(e){return(e=function(e){var t=0,n=Ee(e),i=n.getUint32(t,!0);if(i!=e.byteLength)return[];e:{for(e=t+6,t=[];en.byteLength){n=[];break e}var a=Te(n,e,r);t.push({type:i,value:a}),e+=r}n=t}return n}(e=Ke(bn(e))).filter(function(e){return e.type===yg})[0])&&(e=fn(e=Oe(e.value,!0),"WRMHEADER"))?e:null}function vg(e){try{var t=mg(e);if(t)e:{for(var n=l(wn(t,"DATA")),i=n.next();!i.done;i=n.next()){var r=i.value;if(r.children)for(var a=l(r.children),o=a.next();!o.done;o=a.next()){var s=o.value;if("LA_URL"==s.tagName){var u=bn(s);break e}}}u=""}else u="";return u}catch(e){return""}}Wt("video/mp4",function(){return new ug}),gg.prototype.init=function(){},gg.prototype.parse=function(e){this.g?this.g.clearData():this.g=new Rs;var t=[];if(!Bs(e=Te(e)))return t;var n=(e=this.g.parse(e)).ee(),i=e.vf();switch(e=[],n.video){case"avc":e.push(6);break;case"hvc":e.push(39),e.push(40)}if(!e.length)return t;for(i=(n=l(i)).next();!i.done;i=n.next())if(i=i.value,e.includes(i.type)&&null!=i.time)for(var r=l(sg(i.data)),a=r.next();!a.done;a=r.next())t.push({packet:a.value,pts:i.time});return t},H("shaka.cea.TsCeaParser",gg),Wt("video/mp2t",function(){return new gg});var yg=1;function bg(t,n,i){var r=function(e){for(var t=[],n=(e=l(e)).next();!n.done;n=e.next())(n=wg(n.value))&&t.push(n);return t}(t),a=null;t=[];var o=[],s=null,u=new Set(r.map(function(e){return e.keyId}));u.delete(null);var h="cenc";if(1"+(e=We(e=Te(t,e+4)))+""))}return""}function wg(e){var t=e.attributes.schemeIdUri,n=En(e,"urn:mpeg:cenc:2013","default_KID"),i=xn(e,"urn:mpeg:cenc:2013","pssh").map(_n),r=e.attributes.value;if(!t)return null;if(t=t.toLowerCase(),n&&(n=n.replace(/-/g,"").toLowerCase()).includes(" "))throw new Ce(2,4,4009);var a=[];try{a=i.map(function(e){return{initDataType:"cenc",initData:Ke(e),keyId:null}})}catch(e){throw new Ce(2,4,4007)}return{node:e,Rd:t,keyId:n,init:0(m=m||0))if(p){if(null==(p=An(p,"t",Dn)))break;if(f>=p)break;m=Math.ceil((p-f)/g)-1}else{if(1/0==e)break;if(f/a>=e)break;m=Math.ceil((e*a-f)/g)-1}for(0>>31;d&=2147483647;var f=o.reader.W();if(o.reader.skip(4),1==p)throw new Ce(2,3,3006);s.push(new qo(l/u+n,(l+f)/u+n,function(){return a},e,e+d-1,t,n,i,r)),l+=f,e+=d}return o.parser.stop(),s}(t,i,r,a,o,n,e)});if(e&&u.parse(e),s)return s;throw new Ce(2,3,3004)}(v,r,i,n,w,S,T);else{k=v;var I=new Ig(y);if(440786851!=Mg(I).id)throw new Ce(2,3,3008);var M=Mg(I);if(408125543!=M.id)throw new Ce(2,3,3009);I=M.g.byteOffset,M=new Ig(M.g);for(var P=null;M.Oa();){var L=Mg(M);if(357149030==L.id){P=L;break}}if(!P)throw new Ce(2,3,3010);for(P=new Ig(P.g),L=1e6,M=null;P.Oa();){var D=Mg(P);if(2807729==D.id)L=Rg(D);else if(17545==D.id)if(4==D.g.byteLength)M=D.g.getFloat32(0);else{if(8!=D.g.byteLength)throw new Ce(2,3,3003);M=D.g.getFloat64(0)}}if(null==M)throw new Ce(2,3,3011);if(M*=P=L/1e9,475249515!=(k=Mg(new Ig(k))).id)throw new Ce(2,3,3007);k=function(e,t,n,i,r,a,o,s,u){function l(){return r}var h=[];e=new Ig(e.g);for(var c=null,d=null;e.Oa();){var p=Mg(e);if(187==p.id){var f=Ng(p);f&&(p=n*f.tm,f=t+f.Wl,null!=c&&h.push(new qo(c+o,p+o,l,d,f-1,a,o,s,u)),c=p,d=f)}}return null!=c&&h.push(new qo(c+o,i+o,l,d,null,a,o,s,u)),h}(k,I,P,M,i,n,w,S,T)}for(A=l(b=k),E=A.next();!E.done;E=A.next())(x=E.value).codecs=e.M.codecs,x.mimeType=e.M.mimeType,x.bandwidth=e.bandwidth;return s.ue(b),f=new Gu(b),u&&f.Cd(S,T,!0),C.return(f)})}function Bg(e){return e.Sd}function Fg(e){var t=Cg(e,Bg,"RepresentationIndex");return e=Mn((e=xg(e,Bg,"indexRange"))||""),t&&(e=An(t,"range",Mn,e)),e}function jg(e,t){var n=e.M.mimeType.split("/")[1];if(e.M.contentType!=nt&&"mp4"!=n&&"webm"!=n)throw new Ce(2,4,4006);if("webm"==n&&!t)throw new Ce(2,4,4005)}function Gg(e){var t=e.M;return{bandwidth:e.bandwidth,audioSamplingRate:t.audioSamplingRate,codecs:t.codecs,contentType:t.contentType,frameRate:t.frameRate||null,height:t.height||null,mimeType:t.mimeType,channelsCount:t.Nf,pixelAspectRatio:t.pixelAspectRatio||null,width:t.width||null,label:e.va.label||null,roles:e.roles||null,language:e.va.language||null}}function Hg(e){return e.Cc}function Vg(t,n,i,r,a,o,s,u,h,c){h||t.M.xf||(t.M.xf=xg(t,Wg,"initialization"));var d=t.M.xf?function(e,t){var n=e.M.xf;if(n||(n=xg(e,Wg,"initialization")),!n)return null;n=Ge(n);var i=e.M.originalId,r=e.bandwidth||null,a=e.M.jb,o=e.Qb;return t=new Xo(function(){var e=Tg(n,i,null,null,r,null);return Ze(a(),[e],o())},0,null,Gg(e),null,null,t,e.va.encrypted),t.codecs=e.M.codecs,t.mimeType=e.M.mimeType,e.oa&&!e.oa.Af&&(t.g=e.oa.start+e.oa.duration),t}(t,s):null,p=function(e){var t=Ag(e,Wg),n=xg(e,Wg,"media"),i=xg(e,Wg,"index"),r=xg(e,Wg,"k"),a=0;return r&&(a=parseInt(r,10)),{mg:t.mg,mb:t.mb,timescale:t.timescale,De:t.De,Ob:t.Ob,td:t.td,timeline:t.timeline,hc:n&&Ge(n),me:i,mimeType:e.M.mimeType,codecs:e.M.codecs,bandwidth:e.bandwidth,Ml:a}}(t);!function(e){var t=e.me?1:0;if(t+=e.timeline?1:0,0==(t+=e.mb?1:0))throw new Ce(2,4,4002);if(1!=t&&(e.me&&(e.timeline=null),e.mg=null,e.mb=null),!e.me&&!e.hc)throw new Ce(2,4,4002)}(p);var f=cn(t);if(p.me)return jg(t,d),{endTime:-1,timeline:-1,bd:function(){var e=Tg(p.me,f.M.originalId,null,null,f.bandwidth||null,null);return e=Ze(f.M.jb(),[e]),Ug(f,n,d,e,0,null,p.Ob)},timescale:p.timescale};if(p.mb)return r||"image"===t.va.contentType||"text"===t.va.contentType||(r=t.oa.start,c=t.za.id,i=t.oa.duration,c=(c=null!=c&&o.get(c)||i)?r+c:1/0,t.presentationTimeline.Hh(p.mb),t.presentationTimeline.mj(r,c)),{endTime:-1,timeline:-1,bd:function(){return function(t,n,i,r,a,o,s,u){function h(i){var a=i-y,s=a*v,l=n.mg,h=a*l;"BigInt"in e&&h>Number.MAX_SAFE_INTEGER&&(h=BigInt(a)*BigInt(l)),a=(s+=f)+v,l=Math.min(a,d());var c=[],p=n.Ml;if(p)for(var g=(l-s)/p,m={},E=0;Ed()&&!n.length?null:n})}return Promise.resolve(k)}(f,p,a,d,o,s,u,t.M.cg)},timescale:p.timescale};var g=null;r=r=null,t.za.id&&t.M.id&&(r=t.za.id+","+t.M.id,r=i.get(r))&&(g=r.segmentIndex);var m=t.oa.start,v=t.oa.duration?m+t.oa.duration:1/0;if(g)Kg(c=g,p,m,v,d,t.Hb),c.hb(t.presentationTimeline.Lb());else{if(i=0,h=-1,null!=t.za.id&&null!=t.M.id){var y=c.get(t.za.id);if(y)h=y.timeline;else for(y=(c=l(c.values())).next();!y.done;y=c.next()){if(y=y.value,Math.abs(p.Ob-y.endTime)<=rt&&y.Qh.includes(t.M.id)){h=y.timeline;break}y.timeline>=i&&(i=y.timeline+1)}}-1==h&&(h=i),g=new zg(t.Hb,p,t.M.originalId,t.bandwidth,t.M.jb,t.Qb,m,v,d,s,t.M.cg,h)}return p.timeline&&"image"!==t.va.contentType&&"text"!==t.va.contentType&&t.presentationTimeline.nj(g.h?g.h.timeline:[],m),r&&t.Hb&&(r.segmentIndex=g),r=(r=(r=p.timeline)&&r[r.length-1])?r.end+p.Ob:-1,c=-1,g instanceof zg&&(c=g.kf()),{endTime:r,timeline:c,bd:function(){return g instanceof zg&&0==g.getNumReferences()&&Kg(g,p,m,v,d,t.Hb),Promise.resolve(g)},timescale:p.timescale}}function Wg(e){return e.Qc}function zg(e,t,n,i,r,a,o,s,u,l,h,c){Gu.call(this,[]),this.D=e,this.h=t,this.G=n,this.C=i,this.F=r,this.I=a,this.j=o,this.l=s,this.u=u,this.B=l,this.H=h,this.J=c,Xg(this)}function Kg(e,t,n,i,r,a){if(function(e,t){if(e.u!==t){e.u=t;for(var n=(e=l(e.g)).next();!n.done;n=e.next())(n=n.value)&&Zo(n,t)}}(e,r),e.D=a,e.h){if(e.h.td!==t.td&&(e.h.timeline=t.timeline,e.h.td=t.td,e.h.Ob=t.Ob),e.h.hc!==t.hc&&(e.h.hc=t.hc),(n=e.h.timeline).length){var o=n[n.length-1];t=t.timeline.filter(function(e){return e.end>o.end})}else t=t.timeline.slice();0=e.l||0>=i.end||t.push(i);e.h.timeline=t,e.hb(e.j)}}function Yg(e,t,n,i,r,a,o,s){return e=Tg(e,t,n,a,i||null,r),Ze(o(),[e],s()).map(function(e){return e.toString()})}function qg(e){this.s=null,this.B=e,this.G=new zr,this.i=[],this.h=null,this.m=[],this.C=null,this.F=[],this.D=300,this.l=new Map,this.j=new Map,this.g=null,this.u="UNKNOWN"}function Zg(e,t){var n,i,r,a,o,s,u;return L(function(l){return 1==l.g?(n=Ze(e.i,[Jg(e,t)]),i=Zr(n,e.s.retryParameters),r=e.B.networkingEngine.request(8,i),Kr(e.G,r),S(l,2),_(l,r.promise,4)):2!=l.g?(a=l.h,o=Ne(a.data),1==(s=JSON.parse(o)).VERSION&&function(e,t,n){null!=e.g&&(e.g.stop(),e.g=null);var i=t["RELOAD-URI"]||n;e.g=new zi(function(){Zg(e,i)}),(n=t.TTL)&&(e.D=n),e.g.X(e.D),e.m=t["PATHWAY-PRIORITY"]||[],e.F=t["PATHWAY-CLONES"]||[]}(e,s,a.uri),A(l,0)):(u=E(l))&&7001==u.code?l.return():(null!=e.g&&(e.g.stop(),e.g=null),e.g=new zi(function(){Zg(e,t)}),e.g.X(e.D),void w(l))})}function Jg(e,t){if(!e.m.length)return t;t=new re(t);var n=e.C||e.m[0],i=Math.round(e.B.getBandwidthEstimate()),r=t.g;return"DASH"==e.u?(r.add("_DASH_pathway",n),r.add("_DASH_throughput",String(i))):"HLS"==e.u&&(r.add("_HLS_pathway",n),r.add("_HLS_throughput",String(i))),be(r)&&ue(t,r),t.toString()}function Qg(e,t,n,i){var r=e.l.get(t);r||(r=new Map),r.set(n,i),e.l.set(t,r)}function $g(e,t,n){n=void 0!==n&&n,t=e.l.get(t)||new Map;for(var i=[],r=l(e.m),a=r.next(),o={};!a.done;o={Ld:void 0},a=r.next())if(o.Ld=a.value,a=t.get(o.Ld))i.push({Mh:o.Ld,location:a});else if(a=e.F.find(function(e){return function(t){return t.Rm==e.Ld}}(o))){var s=t.get(a["BASE-ID"]);s&&(a["URI-REPLACEMENT"].ck?(oe(s=new re(s),a["URI-REPLACEMENT"].ck),i.push({Mh:o.Ld,location:s.toString()})):i.push({Mh:o.Ld,location:s}))}for(r=Date.now(),a=(o=l(e.j.keys())).next();!a.done;a=o.next())a=a.value,r>(s=e.j.get(a))&&e.j.delete(a);if(i=i.filter(function(t){for(var n=l(e.j.keys()),i=n.next();!i.done;i=n.next())if(i.value.includes(new re(t.location).Gb))return!1;return!0}),i.length&&(e.C=i[0].Mh),i=i.map(function(e){return e.location}),!i.length&&e.h)for(o=(r=l(e.h.split(","))).next();!o.done;o=r.next())(o=t.get(o.value))&&(e.C=e.h,i.push(o));if(!i.length)for(r=(t=l(t.values())).next();!r.done;r=t.next())i.push(r.value);return n?i:Ze(e.i,i)}function em(){this.l=[],this.h=[],this.g=[],this.j=[],this.i=[],this.u=this.s=!1,this.m=new Set}function tm(e,t){for(var n=[],i=[],r=[],a=[],o=(e=l(e)).next();!o.done;o=e.next()){var s=o.value;o=new Map(s.audioStreams.map(function(e){return[km(e),e]}));var u=new Map(s.videoStreams.map(function(e){return[Cm(e),e]})),h=new Map(s.textStreams.map(function(e){return[Im(e),e]}));if(s=new Map(s.imageStreams.map(function(e){return[Mm(e),e]})),t){var c=Sm(nt);h.set(Im(c),c),c=Sm("image"),s.set(Mm(c),c)}n.push(o),i.push(u),r.push(h),a.push(s)}return{Ci:n,Zj:i,Uj:r,Zi:a}}function nm(e){var t,n,i,r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S,T,A,E,x,C,k,I,M,P;return L(function(L){switch(L.g){case 1:if(t=it,1==e.length)return L.return(e[0]);for(n=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.ma}).map(function(e){return[km(e),e]}))}),i=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.Ha}).map(function(e){return[Cm(e),e]}))}),r=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.$a}).map(function(e){return[Im(e),e]}))}),a=e.map(function(e){return new Map(e.filter(function(e){return e.type===t.wg}).map(function(e){return[Mm(e),e]}))}),o=l(r),s=o.next();!s.done;s=o.next())u=s.value,h=wm(t.$a),u.set(Im(h),h);for(c=l(a),d=c.next();!d.done;d=c.next())p=d.value,f=wm(t.wg),p.set(Mm(f),f);return _(L,im(g=new em,[],n,0,um,hm,0),2);case 2:return m=L.h,_(L,im(g,[],i,0,um,hm,0),3);case 3:return v=L.h,_(L,im(g,[],r,0,um,hm,0),4);case 4:return y=L.h,_(L,im(g,[],a,0,um,hm,0),5);case 5:if(b=L.h,w=0,v.length&&m.length)for(E=l(m),x=E.next();!x.done;x=E.next())for(C=x.value,k=l(v),I=k.next();!I.done;I=k.next())M=I.value,P=w++,M.variantIds.push(P),C.variantIds.push(P);else for(S=v.concat(m),T=l(S),A=T.next();!A.done;A=T.next())A.value.variantIds=[w++];return L.return(v.concat(m).concat(y).concat(b))}})}function im(e,t,n,i,r,a,o){var s,u,h,c,d,p,f,g,m,v,y,b,w,S,T,A,E,x;return L(function(C){switch(C.g){case 1:for(s=[],u=0;u=i?s.push(new Set(n[u].values())):s.push(new Set);h=l(t),c=h.next();case 2:if(c.done){C.A(4);break}return d=c.value,_(C,function(e,t,n,i,r,a,o){return L(function(s){return 1==s.g?(cm(e,n,t,0i)return!0;if(ri.length)return!0;if(r.lengthi)return!0;if(ri.length)return!0;if(r.lengthe){if(n<=e||n-et-e)return Rm}else{if(n>e)return Rm;if(e-ne-t)return Rm}return Dm}function Am(e,t,n){var i=e.mimeType===t.mimeType&&e.codecs===t.codecs,r=e.mimeType===n.mimeType&&e.codecs===n.codecs;return i&&!r?Rm:!i&&r?Lm:(t=pm(e,t),e=pm(e,n),t&&!e?Rm:!t&&e?Lm:Dm)}function Em(e,t,n){return t=Math.abs(e-t),(e=Math.abs(e-n))=t&&(this.g=this.g.slice(t)),this.i+=t,0===this.getNumReferences()&&this.release())}},i.find=function(e){if(this.h&&this.h.timeline&&this.h.timeline.length&&e=this.l)return null;for(var n=t.length-1,i=0;i=a&&e(e-=this.i)||e>=this.getNumReferences()||!this.h)return null;var n=this.g[e];if(!n){var i=(n=this.h.timeline[e]).em,r=n.ri+this.h.td,a=this.j-this.h.Ob,o=this.j+n.end,s=o;e===this.getNumReferences()-1&&1/0!==this.l&&(s=this.D&&.1n}).map(_n).filter(Yi);return i.length?Ze(e.B,i):[]}(e),r=e.B,i.length?(r=i,n="Patch",t=6):1v&&m>g&&e.L++,null==m&&(m=g),!(null!==e.N&&null!==f&&null!==p&&pe.N)&&(e.N=p),u=qm(e,t,n,{start:p,duration:m,node:c,Af:null==m||!d}),s.push(u),t.za.id&&m&&e.qa.set(t.za.id,m),null==m){u=null;break}u=p+m}}if(r)for(n=(t=l(s)).next();!n.done;n=t.next())n=n.value.id,e.F.includes(n)||e.F.push(n);else e.F=s.map(function(e){return e.id});return null!=a?{periods:s,duration:a+o,Oi:!1}:{periods:s,duration:u,Oi:!0}}function qm(e,t,n,i){t.za=tv(e,i.node,null,n),t.oa=i,t.za.xb=t.xb,t.za.id||(t.za.id="__shaka_period_"+i.start);var r=yn(i.node,"EventStream");n=t.presentationTimeline.Lb();for(var a=(r=l(r)).next();!a.done;a=r.next())iv(e,i.start,i.duration,a.value,n);for(r=(n=l(n=yn(i.node,"SupplementalProperty"))).next();!r.done;r=n.next())"urn:mpeg:dash:urlparam:2014"==(r=r.value).attributes.schemeIdUri&&(r=Qm(e,r))&&(t.Qb=r);if(n=yn(i.node,"AdaptationSet").map(function(n,i){return Jm(e,t,i,n)}).filter(Yi),t.Hb){r=[];for(var o=(a=l(n)).next();!o.done;o=a.next())for(var s=(o=l(o.value.$l)).next();!s.done;s=o.next())r.push(s.value);if(r.length!=new Set(r).size)throw new Ce(2,4,4018)}for(r=new Map,o=(a=l(n)).next();!o.done;o=a.next())for(s=(o=l(o.value.qk)).next();!s.done;s=o.next()){var u=l(s.value);s=u.next().value,u=u.next().value,r.set(s,u)}if(r.size)for(a=null,s=(o=l(n)).next();!s.done;s=o.next()){u=[];for(var c=l((s=s.value).streams),d=c.next(),p={};!d.done;p={ii:void 0},d=c.next())if(p.ii=d.value,r.has(p.ii.originalId)){a||(a=yn(i.node,"AdaptationSet").map(function(n,i){return Jm(e,t,i,n)}).filter(Yi));for(var f=(d=l(a)).next();!f.done;f=d.next())(f=f.value.streams.find(function(e){return function(t){return t.originalId==e.ii.originalId}}(p)))&&(f.dependencyStream=r.get(f.originalId),f.originalId+=f.dependencyStream.originalId,u.push(f))}u.length&&s.streams.push.apply(s.streams,h(u))}if(i=n.filter(function(e){return!e.pi}),n=n.filter(function(e){return e.pi}),!e.g.disableIFrames)for(r=(n=l(n)).next();!r.done;r=n.next())for(a=(r=r.value).pi.split(" "),s=(o=l(i)).next();!s.done;s=o.next())if(s=s.value,a.includes(s.id))for(u=(s=l(s.streams)).next();!u.done;u=s.next())mr(u.value,r.streams);if(n=Zm(e.g.disableAudio,i,"audio"),r=Zm(e.g.disableVideo,i,"video"),a=Zm(e.g.disableText,i,nt),i=Zm(e.g.disableThumbnails,i,"image"),0===r.length&&0===n.length)throw new Ce(2,4,4004);return{id:t.za.id,audioStreams:n,videoStreams:r,textStreams:a,imageStreams:i}}function Zm(e,t,n){return e||!t.length?[]:t.reduce(function(e,t){return t.contentType!=n||e.push.apply(e,h(t.streams)),e},[])}function Jm(t,n,i,r){function a(e){var i=e.attributes["dvb:fontFamily"];e=e.attributes["dvb:url"],i&&e&&(e=Ze(n.va.jb(),[e],n.Qb()),t.j.addFont(i,e[0]))}function o(e){switch(e){case 1:case 5:case 6:case 7:return"srgb";case 9:return"rec2020";case 11:case 12:return"p3"}}function s(e){switch(e){case 1:case 6:case 13:case 14:case 15:return"SDR";case 16:return"PQ";case 18:return"HLG"}}n.va=tv(t,r,n.za,null),n.va.position=i;var u=!1,c=(i=yn(r,"Role")).map(function(e){return e.attributes.value}).filter(Yi),d=void 0,p=n.va.contentType==nt;p&&(d="subtitle");for(var f=(i=l(i)).next();!f.done;f=i.next()){var g=(f=f.value).attributes.schemeIdUri;if(null==g||"urn:mpeg:dash:role:2011"==g)switch(f=f.attributes.value,f){case"main":u=!0;break;case"caption":case"subtitle":d=f}}var m=yn(r,"EssentialProperty");i=null;var v=!1;f=null,g=!1;for(var y=(m=l(m)).next();!y.done;y=m.next()){var b=(y=y.value).attributes.schemeIdUri;if("http://dashif.org/guidelines/trickmode"==b)i=y.attributes.value;else if("urn:mpeg:mpegB:cicp:TransferCharacteristics"==b)var S=s(parseInt(y.attributes.value,10));else if("urn:mpeg:mpegB:cicp:ColourPrimaries"==b)var T=o(parseInt(y.attributes.value,10));else"urn:mpeg:mpegB:cicp:MatrixCoefficients"!=b&&("urn:mpeg:dash:ssr:2023"==b&&t.g.dash.enableFastSwitching?v=!0:"urn:dvb:dash:fontdownload:2014"==b?a(y):"urn:mpeg:dash:urlparam:2014"==b&&(f=Qm(t,y))||(g=!0))}if(g)return null;var A=null;for(m=(g=l(g=yn(r,"SupplementalProperty"))).next();!m.done;m=g.next())"http://dashif.org/guidelines/last-segment-number"==(y=(m=m.value).attributes.schemeIdUri)?A=parseInt(m.attributes.value,10)-1:"urn:mpeg:mpegB:cicp:TransferCharacteristics"==y?S=s(parseInt(m.attributes.value,10)):"urn:mpeg:mpegB:cicp:ColourPrimaries"==y?T=o(parseInt(m.attributes.value,10)):"urn:dvb:dash:fontdownload:2014"==y?a(m):"urn:mpeg:dash:urlparam:2014"==y&&(f=Qm(t,m));f&&(n.Qb=f),f=yn(r,"Accessibility");var E,x=new Map;for(g=(f=l(f)).next();!g.done;g=f.next())if(g=(m=g.value).attributes.schemeIdUri,m=m.attributes.value,"urn:scte:dash:cc:cea-608:2015"!=g||t.g.disableText)if("urn:scte:dash:cc:cea-708:2015"!=g||t.g.disableText)"urn:mpeg:dash:role:2011"==g?null!=m&&(c.push(m),"captions"==m&&(d="caption")):"urn:tva:metadata:cs:AudioPurposeCS:2007"==g&&("1"==m?E="visually impaired":"2"==m?E="hard of hearing":"9"==m&&(E="spoken subtitles"));else if(g=1,null!=m)for(y=(m=l(m.split(";"))).next();!y.done;y=m.next()){b=y.value;var C=y=void 0;b.includes("=")?(y="svc"+(b=b.split("="))[0],C=b[1].split(",")[0].split(":").pop()):(y="svc"+g,g++,C=b),x.set(y,ht(C))}else x.set("svc1","und");else if(g=1,null!=m)for(b=(y=l(m=m.split(";"))).next();!b.done;b=y.next()){C=b.value;var k=b=void 0;C.includes("=")?(b=(C=C.split("="))[0].startsWith("CC")?C[0]:"CC"+C[0],k=C[1]||"und"):(b="CC"+g,2==m.length?g+=2:g++,k=C),x.set(b,ht(k))}else x.set("CC1","und");var I=bg(f=yn(r,"ContentProtection"),t.g.ignoreDrmInfo,t.g.dash.keySystemsByURI);n.va.encrypted=0e.J)){var n=e.J;0<=e.g.updatePeriod&&(n=e.g.updatePeriod),e.K.X(Math.max(n-t,St(e.sa)))}}function tv(e,t,n,i){n=n||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,pixelAspectRatio:void 0,Nf:null,audioSamplingRate:null,xb:0,cg:1,encrypted:!1},i=i||n.jb;var r,a=t.attributes.id,o=t.attributes.supplementalId,s=yn(t,"BaseURL"),u=!1;if(e.i)for(var h=l(s),c=h.next();!c.done;c=h.next()){var d=c.value;c=d.attributes.serviceLocation,d=_n(d),c&&d&&(Qg(e.i,a,c,d),u=!0)}u&&e.i||(r=s.map(_n));var p=e.i;e=t.attributes.contentType||n.contentType,h=t.attributes.mimeType||n.mimeType,c=pl([t.attributes.codecs||n.codecs]).join(","),d=An(t,"frameRate",On)||n.frameRate;var f=t.attributes.sar||n.pixelAspectRatio,g=function(e,t){t=t.slice();for(var n=(e=l(e)).next();!n.done;n=e.next())n=n.value.attributes.schemeIdUri,t.includes(n)||t.push(n);return t}(yn(t,"InbandEventStream"),n.emsgSchemeIdUris),m=yn(t,"AudioChannelConfiguration");m=function(e){for(var t=(e=l(e)).next();!t.done;t=e.next()){var n=(t=t.value).attributes.schemeIdUri;if(n&&(t=t.attributes.value))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return t.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(t=parseInt(t,10)))continue;return t;case"tag:dolby.com,2015:dash:audio_channel_configuration:2015":if(n=[2,1,2,2,2,2,1,2,2,1,1,1,1,2,1,1,2,2],!(t=parseInt(t,16)))continue;for(var i=0,r=0;rthis.g&&e.push("opus"),e},i.hj=function(){return!0},i.ij=function(){return 3===this.Ea()},navigator.userAgent.includes("Tizen")&&(Pe=function(){return new Tv}),m(Av,cv),Av.prototype.Ea=function(){return null},Av.prototype.Sb=function(){return"Vizio"},Av.prototype.Ja=function(){return"TV"},Av.prototype.kc=function(){return!1},navigator.userAgent.includes("VIZIO SmartCast")&&(Pe=function(){return new Av}),m(Ev,cv),(i=Ev.prototype).Ea=function(){return this.g.value()},i.Sb=function(){return"WebKit STB"},i.Ja=function(){return"TV"},i.Fa=function(){return"WEBKIT"},i.kc=function(){return!1},i.rd=function(){var e=this.g.value();return null===e||15<=e},i.qc=function(){return Promise.resolve({width:e.screen.width*e.devicePixelRatio,height:e.screen.height*e.devicePixelRatio})},i.jg=function(){return!this.h.value()},(navigator.userAgent.includes("DT_STB_BCM")||navigator.userAgent.includes("DT_STB_BCM")||!(!(navigator.vendor||"").includes("Apple")||/(?:iPhone|iPad|iPod)/.test(navigator.userAgent)||1n.length||"data"!=n[0])throw new Ce(2,1,1004,t);if(2>(n=n.slice(1).join(":").split(",")).length)throw new Ce(2,1,1004,t);var i=n[0];t=e.decodeURIComponent(n.slice(1).join(",")),n=i.split(";"),i=n[0];var r=!1;return 1",ze(e),""].join("\n")))&&(n.licenseServerUri=vg(e)),n=Promise.resolve(n)}else n=Promise.resolve(null);return n}).set("urn:uuid:3d5e6d35-9b9a-41e8-b843-dd3c6e72c42c",function(e){var t=Rv(e,"METHOD");if(["SAMPLE-AES","SAMPLE-AES-CTR"].includes(t)){var n="cenc";"SAMPLE-AES"==t&&(n="cbcs"),n=Je("com.huawei.wiseplay",n,[{initDataType:"cenc",initData:t=Te((t=Jv((t=Rv(e,"URI")).split("?")[0])).data)}]),(e=Dv(e,"KEYID"))&&n.keyIds.add(e.toLowerCase().substr(2)),e=Promise.resolve(n)}else e=Promise.resolve(null);return e}),this.Ya=new Set,this.i=new Map,this.l=null,this.F="",this.gb=new Wv,this.K=-1,this.Z=1/0,this.Y=this.zc=this.Ta=!1,this.D=new zi(function(){t.R&&!t.g.continueLoadingWhenPaused&&(t.P.Da(t.R,"timeupdate"),t.R.paused)?t.P.ra(t.R,"timeupdate",function(){return Ny(t)}):Ny(t)}),this.ua=qy,this.m=null,this.Na=0,this.s=1/0,this.La=this.Ia=this.O=0,this.U=new zr,this.H=new Map,this.I=new Map,this.sa=new Map,this.ba=new Map,this.L=new Map,this.na=new Map,this.qa=new Map,this.ic=this.$=!1,this.eb=new wt(5),this.j=null,this.N=!0,this.P=new At,this.u=this.R=null,this.Mb=function(){return!1}}function $v(e,t){return Oy(e)?e.C.get(t.type):t.Hf}function ey(e,t){var n,i,r,a,o,s,u,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M,P,D,R,N,O,U,B,F,j,G,H,V,W;return L(function(L){switch(L.g){case 1:if(t.stream.isAudioMuxedInVideo)return L.return();for(n=[],i=l(t.S()),r=i.next();!r.done;r=i.next())a=r.value,o=new re(a),s=o.g,t.gf&&(0<=t.Wb&&s.add("_HLS_msn",String(t.Wb)),0<=t.Xb&&s.add("_HLS_part",String(t.Xb))),t.hf&&s.add("_HLS_skip","YES"),be(s)&&ue(o,le(s.toString())),n.push(o.toString());return S(L,2),_(L,Ry(e,n,!0).promise,4);case 4:u=L.h,A(L,3);break;case 2:throw c=E(L),e.h&&e.h.disableStream(t.stream),c;case 3:if(!t.stream.segmentIndex)return L.return();if(1!=(d=zv(e.gb,u.data)).type)throw new Ce(2,4,4017);return(p=u.uri)==u.originalUri||t.S().includes(p)||t.Xf.push(p),f=Uv(d.ka,"EXT-X-DEFINE"),g=ay(e,f,p),m=t.stream,v=$v(e,t),_(L,_y(e,d,m.mimeType,t.S,g),5);case 5:for(y=L.h,b=y.keyIds,T=y.drmInfos,x=y.encrypted,C=y.Ai,m.encrypted||!x||C||(m.encrypted=!0),function(e,t){return e.size===t.size&&[].concat(h(e)).every(function(e){return t.has(e)})}(m.keyIds,b)||(m.keyIds=b,m.drmInfos=T,e.h.newDrmInfo(m)),k=Iy(e,d,v,g,t.S,t.type),I=k.segments,(M=k.bandwidth)&&(m.bandwidth=M),P=Qu(m),D=l(I),R=D.next();!R.done;R=D.next())(N=R.value).ea&&(N.ea.Id=P);m.segmentIndex.re(I,e.l.Lb()),I.length&&(O=jv(d.ka,"EXT-X-MEDIA-SEQUENCE",0),B=(U=Fv(d.ka,"EXT-X-SKIP"))?Number(Dv(U,"SKIPPED-SEGMENTS")):0,F=yy(O,I),j=F.Wb,G=F.Xb,t.Wb=j+B,t.Xb=G,H=v.get(O),m.segmentIndex.hb(H)),(V=Hu(m.segmentIndex))&&(t.kd=V.startTime,W=I[I.length-1],t.wc=W.endTime),Fv(d.ka,"EXT-X-ENDLIST")&&(t.ie=!0),Ty(e,d),ky(e,d.ka,m.type,g,t.S),w(L)}})}function ty(e,t,n){n=void 0!==n&&n;for(var i=-1==e.K,r=l(t),a=r.next();!a.done;a=r.next()){var o=(a=a.value).stream.segmentIndex,s=$v(e,a);if(o=Hu(o))for(var u=(s=l(s)).next();!u.done;u=s.next()){var h=(u=l(u.value)).next().value;if(u.next().value==o.startTime){i&&(e.K=Math.max(e.K,h)),a.Ug=h;break}}}if(!(0>e.K))for(i=(t=l(t)).next();!i.done;i=t.next())(my(e,(i=i.value).type)||n)&&(r=i.stream.segmentIndex)&&0<(a=e.K-i.Ug)&&(r.g.splice(0,a),r=Hu(r))&&(r=-r.startTime,i.stream.segmentIndex.offset(r),ny(e,i,r))}function ny(e,t,n){if(!(.001>Math.abs(n))){t.kd+=n,t.wc+=n;for(var i=l(e=$v(e,t)),r=i.next();!r.done;r=i.next()){var a=l(r.value);r=a.next().value,a=a.next().value,e.set(r,a+n)}t.S()}}function iy(e,t,n){var i,r,a,o,s;return L(function(u){switch(u.g){case 1:return t?(i=ta,r=gl(t.S(),t.Kc(),t.Ic(),e.g.retryParameters),_(u,By(e,r,i,{type:t instanceof qo?1:0}).promise,2)):u.return({mimeType:null,data:null});case 2:if(a=u.h,o=a.data,!t.aesKey){u.A(3);break}return _(u,fl(o,t.aesKey,n),4);case 4:o=u.h;case 3:return t instanceof qo?t.Be(o,!0):t.Be(o),(s=a.headers["content-type"])&&(s=s.split(";")[0].toLowerCase()),u.return({mimeType:s,data:o})}})}function ry(e){if(Oy(e)){if(e.ua==Jy){for(var t=1/0,n=1/0,i=l(e.i.values()),r=i.next();!r.done;r=i.next())(r=r.value).stream.segmentIndex&&"text"!=r.stream.type&&!r.stream.isAudioMuxedInVideo&&(t=Math.min(t,r.wc),n=Math.min(n,r.kd));t=t-n||0,isNaN(e.g.availabilityWindowOverride)||(t=e.g.availabilityWindowOverride),e.l.fg(t)}}else e.l.wb(py(e));if(!e.l.s)for(n=(t=l(e.i.values())).next();!n.done;n=t.next())!(n=n.value).stream.segmentIndex||"audio"!=n.type&&"video"!=n.type||(n=Hu(n.stream.segmentIndex))&&n.h&&e.l.ai(n.h);e.l.Gf()}function ay(e,t,n){n=new re(n).g;for(var i=new Map,r=(t=l(t)).next();!r.done;r=t.next()){var a=r.value,o=Dv(a,"NAME"),s=Dv(a,"VALUE");r=Dv(a,"QUERYPARAM"),a=Dv(a,"IMPORT"),o&&s&&(i.has(o)||i.set(o,s)),r&&(o=n.get(r)[0])&&!i.has(o)&&i.set(r,o),a&&(r=e.B.get(a))&&i.set(a,r)}return i}function oy(e){var t=new Set([xi(e.mimeType,e.codecs)]);e.segmentIndex&&e.segmentIndex.Ib(function(n){n.mimeType&&t.add(xi(n.mimeType,e.codecs))}),e.fullMimeTypes=t}function sy(e,t,n){for(var i={audio:[],video:[]},r=new Map,a=[],o=!1,s=!1,u=l(t),c=u.next();!c.done;c=u.next()){var d=c.value;c=Dv(d,"AUDIO");var p=Dv(d,"VIDEO"),f=c||p;f&&(a.includes(f)||a.push(f),(d=Dv(d,"PATHWAY-ID"))&&r.set(f,d),c?o=!0:p&&(s=!0))}a.length&&n.length&&function(e,t,n){t=t.filter(function(e){var t=Dv(e,"URI")||"";return"SUBTITLES"!=(e=Dv(e,"TYPE"))&&(""!=t||"AUDIO"==e)});for(var i={},r=(t=l(t)).next();!r.done;r=t.next()){var a=Pv(r=r.value,!e.j);i[a]?i[a].push(r):i[a]=[r]}for(var o in i)hy(e,i[o],n,!1)}(e,n=n.filter(function(e){return a.includes(Rv(e,"GROUP-ID"))}),r),n=(r=a.sort().join(","))&&e.J.has(r)?e.J.get(r):[],o?i.audio.push.apply(i.audio,h(n)):s&&i.video.push.apply(i.video,h(n)),o=!1;var g=t.map(function(e){return Rv(e,"URI")});return c=i.audio.find(function(e){return e&&e.S().find(function(e){return g.includes(e)})}),n=et("video",s=uy(e,t[0])),(u=et("audio",s))&&!n?(c="audio",o=0>3)&&e.Oa()&&(n=32+((7&t)<<3)+((224&e.aa())>>5)),i+="."+n)),s.push(i),h=!0}).box("ac-3",r).box("ec-3",r).box("ac-4",r).box("Opus",r).box("fLaC",r).box("apac",r).box("avc1",i).box("avc3",i).box("hev1",i).box("hvc1",i).box("dva1",i).box("dvav",i).box("dvh1",i).box("dvhe",i).box("vp09",i).box("av01",i).box("avcC",function(e){var t=o||"";switch(o){case"dvav":t="avc3";break;case"dva1":t="avc1"}(e=e.reader).skip(1),e=t+"."+vo(e.aa())+vo(e.aa())+vo(e.aa()),u.push(e),c=!0}).box("hvcC",function(e){var t=o||"";switch(o){case"dvh1":t="hvc1";break;case"dvhe":t="hev1"}var n=e.reader;n.skip(1);var i=["","A","B","C"][(e=n.aa())>>6],r=31&e,a=n.W(),s=(32&e)>>5?"H":"L";e=[n.aa(),n.aa(),n.aa(),n.aa(),n.aa(),n.aa()],n=n.aa();for(var l=0,h=0;32>h&&(l|=1&a,31!=h);h++)l<<=1,a>>=1;for(t=t+"."+i+r+"."+vo(l,!0),t+="."+s+n,i="",r=e.length;r--;)((s=e[r])||i)&&(i="."+s.toString(16).toUpperCase()+i);t+=i,u.push(t),c=!0}).box("dvcC",function(e){var t=o||"";switch(o){case"hvc1":t="dvh1";break;case"hev1":t="dvhe";break;case"avc1":t="dva1";break;case"avc3":t="dvav";break;case"av01":t="dav1"}var n=e.reader;n.skip(2),e=n.aa(),n=n.aa(),u.push(t+"."+yo(e>>1&127)+"."+yo(e<<5&32|n>>3&31)),c=!0}).box("dvvC",function(e){var t=o||"";switch(o){case"hvc1":t="dvh1";break;case"hev1":t="dvhe";break;case"avc1":t="dva1";break;case"avc3":t="dvav";break;case"av01":t="dav1"}var n=e.reader;n.skip(2),e=n.aa(),n=n.aa(),u.push(t+"."+yo(e>>1&127)+"."+yo(e<<5&32|n>>3&31)),c=!0}).V("vpcC",function(e){var t=o||"",n=e.reader;e=n.aa();var i=n.aa();n=n.aa()>>4&15,u.push(t+"."+yo(e)+"."+yo(i)+"."+yo(n)),c=!0}).box("av1C",function(e){var t=o||"";"dav1"===o&&(t="av01");var n=e.reader;n.skip(1);var i=(e=n.aa())>>>5,r=(64&(n=n.aa()))>>6;u.push(t+"."+i+"."+yo(31&e)+(n>>>7?"H":"M")+"."+yo(2===i&&r?(32&n)>>5?12:10:r?10:8)+"."+((16&n)>>4)+"."+((8&n)>>3)+((4&n)>>2)+(3&n)+"."+yo(1)+"."+yo(1)+"."+yo(1)+".0"),c=!0}).box("enca",ga).box("encv",fa).box("sinf",da).box("frma",function(e){a(e=mo(e.reader).codec)}).box("colr",function(e){u=u.map(function(t){if(t.startsWith("av01.")){var n=e.reader,i=n.Ua(),r=n.Yb(4),a=String.fromCharCode(r[0]);if(a+=String.fromCharCode(r[1]),a+=String.fromCharCode(r[2]),"nclx"===(a+=String.fromCharCode(r[3]))){r=n.Ga(),a=n.Ga();var o=n.Ga(),s=n.aa()>>7,u=t.split(".");10==u.length&&(u[6]=yo(r),u[7]=yo(a),u[8]=yo(o),u[9]=String(s),t=u.join("."))}n.seek(i)}return t});var t=function(e){var t=null,n=null,i=e.Yb(4),r=String.fromCharCode(i[0]);if(r+=String.fromCharCode(i[1]),r+=String.fromCharCode(i[2]),"nclx"===(r+=String.fromCharCode(i[3]))){switch(e.Ga()){case 1:case 5:case 6:case 7:t="srgb";break;case 9:t="rec2020";break;case 11:case 12:t="p3"}switch(i=e.Ga(),e.Ga(),i){case 1:case 6:case 13:case 14:case 15:n="SDR";break;case 16:n="PQ";break;case 18:n="HLG"}}return{colorGamut:t,Ie:n}}(e.reader),n=t.colorGamut;v=t.Ie,y=n}).parse(e||t,!0,!0),!s.length&&!u.length)return null;var b=h&&!c,_=new Map;if(c&&!n){n=new Vt("video/mp4"),e&&n.init(e);try{n.Rf(t);for(var w=l(n.xg()),S=w.next();!S.done;S=w.next()){var T=S.value;_.set(T,T)}}catch(e){}n.Wd()}return{type:b?"audio":"video",mimeType:b?"audio/mp4":"video/mp4",codecs:pl(s.concat(u)).join(", "),language:d,height:p,width:f,channelCount:g,sampleRate:m,closedCaptions:_,Ie:v,colorGamut:y,frameRate:null}}(f,g,e.g.disableText)))return S.return(w);return p?S.return(dl(p)):S.return(n)})}(e,k),3);case 3:O=t.h,o!=O.type&&Oy(e)&&(e.C.set(O.type,e.C.get(o)),e.C.set(o,new Map)),o=O.type,s=O.language,c=O.channelCount,g=O.sampleRate,e.g.disableText||(d=O.closedCaptions),P=O.height,M=O.width,D=O.Ie,R=O.colorGamut,N=O.frameRate,b&&(v=O.mimeType,a=O.codecs);case 2:if(v){t.A(4);break}return _(t,function(e,t,n,i){var r,a,o,s,u,l,h,c,d,p,f,g,m;return L(function(v){switch(v.g){case 1:return r=ta,a=Ly(e,i),2==(o=a.segment).status?v.return(Py(t)):(s=o.S(),u=new re(s[0]),l=u.vb.split(".").pop(),h=Xy.get(t),(c=h.get(l))||(c=Hy.get(l))||(c=My(t,n))?v.return(c):(p=1,f=Zr(s,e.g.retryParameters),S(v,2),f.method="HEAD",_(v,By(e,f,r,{type:p}).promise,4)));case 4:g=v.h,d=g.headers["content-type"],A(v,3);break;case 2:if(!(m=E(v))||1002!=m.code&&1001!=m.code){v.A(3);break}return f.method="GET",e.g.hls.allowRangeRequestsToGuessMimeType&&(f.headers.Range="bytes=0-0"),_(v,By(e,f,r,{type:p}).promise,6);case 6:g=v.h,d=g.headers["content-type"];case 3:if(!d){v.A(7);break}if("application/octet-stream"!=(c=d.toLowerCase().split(";")[0])){v.A(8);break}if(g.data.byteLength){v.A(9);break}return f.method="GET",_(v,By(e,f,r,{type:p}).promise,10);case 10:g=v.h;case 9:Bs(Te(g.data))&&(c="video/mp2t");case 8:if("application/octet-stream"!=c)return v.return(c);case 7:return v.return(Py(t))}})}(e,o,a,k),5);case 5:v=t.h,o!=nt||a||"application/mp4"!=v||!k[0]||k[0].ea||(v="text/vtt");case 4:return _(t,_y(e,i,v,r,n),6);case 6:if(U=t.h,B=U.drmInfos,F=U.keyIds,j=U.encrypted,G=U.Ai,j&&!B.length&&!G)throw new Ce(2,4,4026);return(H=by(e,a,o,s,u,h,c,d,p,f,g,m)).encrypted=j&&!G,H.drmInfos=B,H.keyIds=F,H.mimeType=v,I&&(H.bandwidth=I),oy(H),"video"==o&&(M||P||D||R)&&Dy(H,M,P,N,D,null,R),Oy(e)&&Ty(e,i),V=k[0].startTime,W=k[k.length-1],z=W.endTime,K=new Gu(k),H.segmentIndex=K,Y=!!(X=Fv(i.ka,"EXT-X-SERVER-CONTROL"))&&null!=Lv(X,"CAN-SKIP-UNTIL"),q=!!X&&null!=Lv(X,"CAN-BLOCK-RELOAD"),Z=jv(i.ka,"EXT-X-MEDIA-SEQUENCE",0),J=yy(Z,k),Q=J.Wb,$=J.Xb,t.return({stream:H,type:o,Xf:[],S:r,kd:V,wc:z,hf:Y,gf:q,ie:!1,Ug:-1,Wb:Q,Xb:$,Hf:x})}})}function yy(e,t){e=e+t.length-1;var n=-1;if(!t.length)return{Wb:++e,Xb:n};var i=(t=t[t.length-1]).g;return t.g.length?(n=i.length-1,i[i.length-1].isPreload()||(e++,n=0),{Wb:e,Xb:n}):(e++,t.m&&(n=0),{Wb:e,Xb:n})}function by(e,t,n,i,r,a,o,s,u,h,c,d){var p=My(n,t)||Py(n),f=[];if(u)for(var g=(u=l(u.split(","))).next();!g.done;g=u.next())f.push(g.value);return u=void 0,g=null,n==nt?u=f.includes("public.accessibility.transcribes-spoken-dialog")&&f.includes("public.accessibility.describes-music-and-sound")?"caption":"subtitle":f.includes("public.accessibility.describes-video")&&(g="visually impaired"),f.length||"subtitle"!==u||f.push("subtitle"),oy(e={id:e.G++,originalId:a,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:null,mimeType:p,codecs:t,kind:n==nt?"subtitle":void 0,encrypted:!1,drmInfos:[],keyIds:new Set,language:ht(i||"und"),originalLanguage:i,label:a,type:n,primary:r,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,frameRate:void 0,pixelAspectRatio:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:f,forced:h,channelsCount:o,audioSamplingRate:c,spatialAudio:d,closedCaptions:s,hdr:void 0,colorGamut:void 0,videoLayout:void 0,tilesLayout:void 0,accessibilityPurpose:g,external:!1,fastSwitching:!1,fullMimeTypes:new Set,isAudioMuxedInVideo:!1,baseOriginalId:null}),e}function _y(e,t,n,i,r){var a,o,s,u,h,c,d,p,f,g,m,v,y,b,w,S,T,A,E,x,C,k,I,M,P,D,R,N,O;return L(function(L){switch(L.g){case 1:if(a=new Map,!e.g.ignoreDrmInfo&&t.segments)for(o=l(t.segments),s=o.next();!s.done;s=o.next())if(u=s.value,h=Uv(u.ka,"EXT-X-KEY"),c=null,h.length)for(c=Ey(e,t,u.ka,i,r),d=l(h),p=d.next();!p.done;p=d.next())f=p.value,a.set(f,c);m=g=!1,v=[],y=new Set,b=l(a),w=b.next();case 2:if(w.done){L.A(4);break}if(S=w.value,T=l(S),A=T.next().value,E=T.next().value,C=E,"NONE"==(k=Rv(x=A,"METHOD"))){L.A(3);break}if(g=!0,I=Dv(x,"KEYFORMAT")||"identity",M=null,Fy(k)){m=!0,L.A(3);break}if("identity"==I)return _(L,jy(e,x,n,i,C,r),11);if(!(P=e.fc.get(I))){D=null,L.A(9);break}return _(L,P(x,n,C),10);case 10:D=L.h;case 9:M=D,L.A(6);break;case 11:M=L.h;case 6:if(M){if(M.keyIds)for(R=l(M.keyIds),N=R.next();!N.done;N=R.next())O=N.value,y.add(O);v.push(M)}case 3:w=b.next(),L.A(2);break;case 4:return L.return({drmInfos:v,keyIds:y,encrypted:g,Ai:m})}})}function wy(t,n,i,r,a){if(!e.crypto||!e.crypto.subtle)throw Y("Web Crypto API is not available to decrypt AES. (Web Crypto only exists in secure origins like https)"),new Ce(2,4,4042);var o=0,s=Dv(n,"IV","");if(s){var u=Xe(s.substr(2));if(16!=u.byteLength)throw new Ce(2,4,4048)}else o=jv(i.ka,"EXT-X-MEDIA-SEQUENCE",0);var l=Gv(r(),Rv(n,"URI"),a),h=l.sort().join("");if(i=n.toString()+"-"+o+"-"+h,!t.ba.has(i)){var c={bitsKey:128,blockCipherMode:"CBC",iv:u,firstMediaSequenceNumber:o};switch(Rv(n,"METHOD")){case"AES-256":c.bitsKey=256;break;case"AES-256-CTR":c.bitsKey=256,c.blockCipherMode="CTR"}c.fetchKey=function(){var n,i,r,a;return L(function(o){if(1==o.g)return t.L.has(h)||(n=Zr(l,t.g.retryParameters),i=By(t,n,6).promise,t.L.set(h,i)),_(o,t.L.get(h),2);if(3!=o.g){if(!(r=o.h).data||r.data.byteLength!=c.bitsKey/8)throw new Ce(2,4,4049);return a={name:"CTR"==c.blockCipherMode?"AES-CTR":"AES-CBC",length:c.bitsKey},_(o,e.crypto.subtle.importKey("raw",r.data,a,!0,["decrypt"]),3)}c.cryptoKey=o.h,c.fetchKey=void 0,w(o)})},t.ba.set(i,c)}return t.ba.get(i)}function Sy(e,t){null==e.u&&(t=Fv(t.ka,"EXT-X-START"))&&(e.u=Number(Rv(t,"TIME-OFFSET")))}function Ty(e,t){var n=1/0,i=t.segments;if(i.length)for(var r=i.length-1;0<=r;){var a=Fv(i[r].ka,"EXTINF");if(a){n=Number(a.value.split(",")[0]);break}r--}if(!(i=Fv(t.ka,"EXT-X-TARGETDURATION")))throw new Ce(2,4,4024,"EXT-X-TARGETDURATION");i=Number(i.value),(r=Fv(t.ka,"EXT-X-PART-INF"))&&(e.O=Number(Rv(r,"PART-TARGET"))),t=Fv(t.ka,"EXT-X-SERVER-CONTROL"),e.$&&e.O?(e.s=e.ic?5*e.O<=n?Math.min(e.O,e.s):Math.min(n,e.s):Math.min(e.O,e.s),e.La=t?Number(Rv(t,"PART-HOLD-BACK")):0):(e.s=Math.min(n,e.s),n=t?Lv(t,"HOLD-BACK"):null,e.Ia=n?Number(n.value):0),e.Na=Math.max(i,e.Na)}function Ay(e,t){var n=0;if(e.g.defaultPresentationDelay)n=e.g.defaultPresentationDelay;else if(e.La)n=e.La;else if(e.Ia)n=e.Ia;else for(var i=t.segments.length,r=i-Math.min(i,e.g.hls.liveSegmentsDelay);re.u&&(n=Math.min(-e.u,n),e.u+=n),e.l.Ij(0),e.l.Zh(n),e.l.pd(!1)}function Ey(e,t,n,i,r){var a=Fv(n,"EXT-X-MAP");if(!a)return null;var o=Rv(a,"URI"),s=Gv(i(),o,r);if(o=[s.toString(),Dv(a,"BYTERANGE","")].join("-"),!e.sa.has(o)){for(var u=void 0,h=null,c=!1,d=(n=l(n)).next();!d.done;d=n.next())"EXT-X-KEY"==(d=d.value).name?Fy(c=Rv(d,"METHOD"))&&d.idt?1:0}),n=0;n(h=d-a))continue}if(null==h){var p=Dv(o,"DURATION")||Dv(o,"PLANNED-DURATION");if(p){var f=parseFloat(p);if(isNaN(f)||(h=u+f),0>s-a+f)continue}}var g=Dv(o,"CLASS")||"com.apple.quicktime.HLS",m="YES"==Dv(o,"END-ON-NEXT");if(null==h&&m){for(var v=n+1;vs){h=Math.max(0,y-a);break}}if(null==h)continue}v=["CLASS","START-DATE","END-DATE","DURATION","END-ON-NEXT"];for(var b=[],_=l(o.attributes),w=_.next();!w.done;w=_.next()){var S=w.value;if(!v.includes(S.name)){var T=Vv(S.value,i);"X-ASSET-URI"!=S.name&&"X-ASSET-LIST"!=S.name||(T=Gv(r(),S.value,i)[0]),b.push({key:S.name,description:"",data:T,mimeType:null,pictureType:null})}}1C)if(k){if(null==(k=An(k,"t",Dn)))break;if(I>=k)break;C=Math.ceil((k-I)/M)-1}else{if(1/0==S)break;if(I/y>=S)break;C=Math.ceil((S*y-I)/M)-1}for(k=0;k<=C;++k)E=I+M,A.push({start:I/y,end:E/y,ri:I}),I=E}for(y=A,S=(b=l(b)).next();!S.done;S=b.next())(S=ib(e,v,S.value,y,g,c))&&("audio"!=S.type||e.g.disableAudio?"video"!=S.type||e.g.disableVideo?S.type!=nt||e.g.disableText||d.push(S):p.push(S):m.push(S))}for(f=[],g=(m=l(0>1,n[1]=i<<7|t<<3|e>>1,n[2]=e<<7|8,n[3]=0,(t=new Uint16Array(2))[0]=(n[0]<<8)+n[1],t[1]=(n[2]<<8)+n[3],t[0].toString(16)+t[1].toString(16)):((n=new Uint8Array(2))[0]=16|i>>1,n[1]=i<<7|t<<3,(t=new Uint16Array(1))[0]=(n[0]<<8)+n[1],t[0].toString(16))}(n,o,r,v),v.mssPrivateData.codecPrivateData=n,o){case"audio":if(!n)return Y("Quality unsupported without CodecPrivateData",o),null;v.type="audio",v.mimeType="mss/audio/mp4",v.codecs=function(e,t){var n=0;return"AACH"===e&&(n=5),t?0===n&&(n=(248&parseInt(t.substr(0,2),16))>>3):(n=2,"AACH"===e&&(n=5)),"mp4a.40."+n}(r,n);break;case"video":if(!n)return Y("Quality unsupported without CodecPrivateData",o),null;v.type="video",v.mimeType="mss/video/mp4",v.codecs=function(e){var t=/00000001[0-9]7/.exec(e);return t.length&&e?"avc1."+e.substr(e.indexOf(t[0])+10,6):""}(n);break;case"text":v.type=nt,v.mimeType="application/mp4",("TTML"===r||"DFXP"===r)&&(v.codecs="stpp")}return v.fullMimeTypes.add(xi(v.mimeType,v.codecs)),v.createSegmentIndex=function(){if(v.segmentIndex)return Promise.resolve();if(e.m.has(v.id))var n=e.m.get(v.id);else n=[],"video"==v.type&&(n=v.mssPrivateData.codecPrivateData.split("00000001").slice(1)),n=_o(new bo([n={id:v.id,type:v.type,codecs:v.codecs,encrypted:v.encrypted,timescale:v.mssPrivateData.timescale,duration:v.mssPrivateData.duration,Eb:n,Ma:new Uint8Array([]),Wa:new Uint8Array([]),cb:0,fb:0,data:null,stream:v}])),e.m.set(v.id,n);return n=function(e,t,n,i,r){var a=i.attributes.Url.replace("{bitrate}",String(n.bandwidth));i=[];for(var o=(r=l(r)).next(),s={};!o.done;s={kg:void 0},o=r.next())s.kg=o.value,i.push(new qo(s.kg.start,s.kg.end,function(t){return function(){return Ze(e.l,[a.replace("{start time}",String(t.kg.ri))])}}(s),0,null,t,0,0,n.mssPrivateData.duration));return i}(e,new Xo(function(){return[]},0,null,Qu(v),v.mssPrivateData.timescale,n,null,v.encrypted),v,t,i),v.segmentIndex=new Gu(n),Promise.resolve()},v.closeSegmentIndex=function(){v.segmentIndex&&(v.segmentIndex.release(),v.segmentIndex=null)},v}(i=tb.prototype).configure=function(e,t){this.g=e,t&&(this.B=t)},i.start=function(e,t){var n=this;return L(function(i){if(1==i.g)return n.l=[e],n.h=t,_(i,nb(n),2);if(!n.h)throw new Ce(2,7,7001);return i.return(n.j)})},i.stop=function(){return this.g=this.h=null,this.l=[],this.j=null,null!=this.s&&(this.s.stop(),this.s=null),this.m.clear(),this.C.destroy()},i.update=function(){var e,t=this;return L(function(n){return 1==n.g?(S(n,2),_(n,nb(t),4)):2!=n.g?A(n,0):(e=E(n),t.h&&e?(t.h.onError(e),void w(n)):n.return())})},i.onExpirationUpdated=function(){},i.onInitialVariantChosen=function(){},i.banLocation=function(){},i.setMediaElement=function(){},H("shaka.mss.MssParser",tb);var rb="AAC AACL AACH AACP AVC1 H264 TTML DFXP".split(" "),ab=(new Map).set("CAPT","main").set("SUBT","alternate").set("DESC","main");function ob(e,t,n,i,r,a,o){if(200<=n&&299>=n&&202!=n||304==n)return{uri:r||i,originalUri:i,data:t,status:n,headers:e,fromCache:!!e["x-shaka-from-cache"],originalRequest:a};a=null;try{a=Ue(t)}catch(e){}throw new Ce(401==n||403==n?2:1,1,1001,i,n,a,e,o,r||i)}function sb(){}function ub(e,t,n,i,r,a){var o=new pb;oa(t.headers).forEach(function(e,t){o.append(t,e)});var s=new cb,u={Fi:!1,Wj:!1};if(e=function(e,t,n,i,r,a,o,s,u){var l,h,c,d,p,f,g,m,v,y,b,T,x,C;return L(function(k){switch(k.g){case 1:return l=hb,h=db,d=new ArrayBuffer(0),f=p=0,g={},m=Date.now(),S(k,2),_(k,l(e,i),4);case 4:if(c=k.h,g=function(e){var t={};return e.forEach(function(e,n){t[n.trim()]=e}),t}(c.headers),o(g),"HEAD"==i.method){k.A(5);break}return y=(v=c.headers.get("Content-Length"))?parseInt(v,10):0,c.body?(b=c.clone().body.getReader(),new h({start:function(e){!function t(){var n,i,r,o;return L(function(l){switch(l.g){case 1:return S(l,2),_(l,b.read(),4);case 4:n=l.h,A(l,3);break;case 2:return E(l),l.return();case 3:if(n.done){l.A(5);break}if(p+=n.value.byteLength,!s){l.A(5);break}return _(l,s(n.value),5);case 5:i=Date.now(),r=p-f,(100=u||n.done)&&(o=n.done?0:y-p,a(i-m,r,o),f=p,m=i),n.done?e.close():(e.enqueue(n.value),t()),w(l)}})}()}}),_(k,c.arrayBuffer(),8)):_(k,c.arrayBuffer(),9);case 8:d=k.h,k.A(5);break;case 9:d=k.h,T=Date.now(),a(T-m,d.byteLength,0);case 5:t.headers.Range&&2==(x=t.headers.Range.replace("bytes=","").split("-").filter(function(e){return e}).map(function(e){return parseInt(e,10)})).length&&d.byteLength!=x[1]-x[0]+1&&Y("Payload length does not match range requested bytes",t,c),A(k,3);break;case 2:if(C=E(k),r.Fi)throw new Ce(1,1,7001,e,n);if(r.Wj)throw new Ce(1,1,1003,e,n);throw new Ce(1,1,1002,e,C,n);case 3:return k.return(ob(g,d,c.status,e,c.url,t,n))}})}(e,t,n,{body:t.body||void 0,headers:o,method:t.method,signal:s.signal,credentials:t.allowCrossSiteCredentials?"include":void 0},u,i,r,t.streamDataCallback,a.minBytesForProgressEvents||0),e=new Fr(e,function(){return u.Fi=!0,s.abort(),Promise.resolve()}),t=t.retryParameters.timeout){var l=new zi(function(){u.Wj=!0,s.abort()});l.X(t/1e3),e.finally(function(){l.stop()})}return e}function lb(){if(!e.ReadableStream)return!1;try{new ReadableStream({})}catch(e){return!1}return!!e.Response&&!!new Response("").body&&!(!e.fetch||"polyfill"in e.fetch||!e.AbortController)}so("application/vnd.ms-sstr+xml",function(){return new tb}),H("shaka.net.HttpFetchPlugin",sb),sb.isSupported=lb,sb.parse=ub;var hb=e.fetch,cb=e.AbortController,db=e.ReadableStream,pb=e.Headers;function fb(){}function gb(e,t,n,i,r,a){var o=new mb,s=Date.now(),u=0;return new Fr(new Promise(function(h,c){o.open(t.method,e,!0),o.responseType="arraybuffer",o.timeout=t.retryParameters.timeout,o.withCredentials=t.allowCrossSiteCredentials;var d={};for(var p in o.onabort=function(){c(new Ce(1,1,7001,e,n))},o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.HEADERS_RECEIVED){for(var e=o.getAllResponseHeaders().trim().split("\r\n"),t={},n=(e=l(e)).next();!n.done;n=e.next())t[(n=n.value.split(": "))[0].toLowerCase()]=n.slice(1).join(": ");r(d=t)}},o.onload=function(r){var a=o.response;try{i(Date.now()-s,r.loaded-u,0);var l=ob(d,a,o.status,e,o.responseURL,t,n);h(l)}catch(e){c(e)}},o.onerror=function(t){c(new Ce(1,1,1002,e,t,n))},o.ontimeout=function(){c(new Ce(1,1,1003,e,n))},o.onprogress=function(e){var t=Date.now(),n=a.minBytesForProgressEvents||0,r=e.loaded-u;(100=n||e.lengthComputable&&e.loaded==e.total)&&(i(t-s,r,4==o.readyState?0:e.total-e.loaded),u=e.loaded,s=t)},t.headers)o.setRequestHeader(p.toLowerCase(),t.headers[p]);o.send(t.body)}),function(){return o.abort(),Promise.resolve()})}lb()&&(Yr("http",ub,2,!0),Yr("https",ub,2,!0),Yr("blob",ub,2,!0)),H("shaka.net.HttpXHRPlugin",fb),fb.parse=gb;var mb=e.XMLHttpRequest;function vb(e,t,n,i,r){this.g=e,this.i=t,this.groupId=n,this.h=i,this.j=r}function yb(e){var t=e.ec(!1);return t?ze(t):e.S().map(function(e){return"{"+encodeURI(e.split("#xywh=")[0])+"}"}).join("")+":"+e.startByte+":"+e.endByte}function bb(e,t){return gl(e.g.S(),e.g.startByte,e.g.endByte,t.streaming.retryParameters)}function _b(){this.g=this.j=this.i=0,this.h=new Map,this.l=0}function wb(e,t){e.i+=t;var n=e.l;return e.l++,e.h.set(n,t),n}function Sb(e){return 0==e.i?0:e.j/e.i}function Tb(e){var t=this;this.u=e,this.i=new Map,this.h=new ra(function(){return Ab(t).catch(function(){})}),this.j=[],this.s=function(){},this.m=function(){},this.g=new _b,this.l=!1}function Ab(e){e.l=!0;var t=e.j.map(function(e){return e()});return e.j=[],Promise.all(t)}function Eb(e,t,n,i,r,a){aa(e.h);var o=(e.i.get(t)||Promise.resolve()).then(function(){if(e.h.g)throw new Ce(2,9,7001);if(r){var t=Te(n);for(var o in(t=new Sa(t)).data){var s=Number(o);e.m(t.data[s],t.g[s])}}return e.g.close(i,n.byteLength),e.s(Sb(e.g),e.g.g),a(n)});e.i.set(t,o)}function xb(e,t){var n=this;this.i=e,this.h=e.objectStore(t),this.g=new Br,e.onabort=function(e){e.preventDefault(),n.g.reject()},e.onerror=function(e){e.preventDefault(),n.g.reject()},e.oncomplete=function(){n.g.resolve()}}function Cb(e,t){return new Promise(function(n,i){var r=e.h.openCursor();r.onerror=i,r.onsuccess=function(){var e;return L(function(i){if(1==i.g)return null==r.result?(n(),i.return()):(e=r.result,_(i,t(e.key,e.value,e),2));e.continue(),w(i)})}})}function kb(e){this.h=e,this.g=[]}function Ib(e,t){return Mb(e,t,"readwrite")}function Mb(e,t,n){var i=new xb(n=e.h.transaction([t],n),t);return e.g.push(i),i.promise().then(function(){Qt(e.g,i)},function(){Qt(e.g,i)}),i}function Pb(e,t,n){this.h=new kb(e),this.i=t,this.g=n}function Lb(e){return Promise.reject(new Ce(2,9,9011,"Cannot add new value to "+e))}function Db(e,t,n,i){t=(e=Ib(e.h,t)).store();for(var r=(n=l(n)).next(),a={};!r.done;a={Eh:void 0},r=n.next())a.Eh=r.value,t.delete(a.Eh).onsuccess=function(e){return function(){return i(e.Eh)}}(a);return e.promise()}function Rb(e,t,n){var i,r,a,o,s,u,h;return L(function(c){if(1==c.g){for(i=Mb(e.h,t,"readonly"),r=i.store(),a={},o=[],s=l(n),u=s.next(),h={};!u.done;h={Zf:void 0,Cf:void 0},u=s.next())h.Cf=u.value,h.Zf=r.get(h.Cf),h.Zf.onsuccess=function(e){return function(){null==e.Zf.result&&o.push(e.Cf),a[e.Cf]=e.Zf.result}}(h);return _(c,i.promise(),2)}if(o.length)throw new Ce(2,9,9012,"Could not find values for "+o);return c.return(n.map(function(e){return a[e]}))})}function Nb(e){this.g=new kb(e)}function Ob(){this.g=new Map}function Ub(e){var t=null;if(e.g.forEach(function(e,n){e.getCells().forEach(function(e,i){e.hasFixedKeySpace()||t||(t={path:{Vb:n,ib:i},ib:e})})}),t)return t;throw new Ce(2,9,9013,"Could not find a cell that supports add-operations")}function Bb(e,t,n){if(!(e=e.g.get(t)))throw new Ce(2,9,9013,"Could not find mechanism with name "+t);if(!(t=e.getCells().get(n)))throw new Ce(2,9,9013,"Could not find cell with name "+n);return t}function Fb(e,t){jb.set(e,t)}Yr("http",gb,1,!0),Yr("https",gb,1,!0),Yr("blob",gb,1,!0),_b.prototype.close=function(e,t){if(this.h.has(e)){var n=this.h.get(e);this.h.delete(e),this.j+=n,this.g+=t}},Tb.prototype.destroy=function(){return this.h.destroy()},Tb.prototype.queue=function(e,t,n,i,r){var a=this;aa(this.h);var o=(this.i.get(e)||Promise.resolve()).then(function(){var e,o,s,u,l,h,c;return L(function(d){if(1==d.g)return _(d,function(e,t){var n,i,r,a;return L(function(o){return 1==o.g?(n=ta,i=e.u.request(n,t),r=function(){return i.abort()},e.j.push(r),_(o,i.promise,2)):(a=o.h,Qt(e.j,r),o.return(a.data))})}(a,t),2);if(e=d.h,a.h.g)throw new Ce(2,9,7001);if(i)for(u in o=Te(e),(s=new Sa(o)).data)l=Number(u),h=s.data[l],c=s.g[l],a.m(h,c);return a.g.close(n,e.byteLength),a.s(Sb(a.g),a.g.g),d.return(r(e))})});return this.i.set(e,o),o},xb.prototype.abort=function(){var e=this;return L(function(t){if(1==t.g){try{e.i.abort()}catch(e){}return S(t,2),_(t,e.g,4)}if(2!=t.g)return A(t,0);E(t),w(t)})},xb.prototype.store=function(){return this.h},xb.prototype.promise=function(){return this.g},kb.prototype.destroy=function(){return Promise.all(this.g.map(function(e){return e.abort()}))},(i=Pb.prototype).destroy=function(){return this.h.destroy()},i.hasFixedKeySpace=function(){return!0},i.addSegments=function(){return Lb(this.i)},i.removeSegments=function(e,t){return Db(this,this.i,e,t)},i.getSegments=function(e){var t,n=this;return L(function(i){return 1==i.g?_(i,Rb(n,n.i,e),2):(t=i.h,i.return(t.map(function(e){return n.Ki(e)})))})},i.addManifests=function(){return Lb(this.g)},i.updateManifest=function(){return Promise.reject(new Ce(2,9,9016,"Cannot modify values in "+this.g))},i.updateManifestExpiration=function(e,t){var n=Ib(this.h,this.g),i=n.store();return i.get(e).onsuccess=function(n){(n=n.target.result)&&(n.expiration=t,i.put(n,e))},n.promise()},i.removeManifests=function(e,t){return Db(this,this.g,e,t)},i.getManifests=function(e){var t,n=this;return L(function(i){return 1==i.g?_(i,Rb(n,n.g,e),2):(t=i.h,i.return(Promise.all(t.map(function(e){return n.$d(e)}))))})},i.getAllManifests=function(){var e,t,n=this;return L(function(i){return 1==i.g?(e=Mb(n.h,n.g,"readonly"),t=new Map,_(i,Cb(e,function(e,i){var r;return L(function(a){if(1==a.g)return _(a,n.$d(i),2);r=a.h,t.set(e,r),w(a)})}),2)):3!=i.g?_(i,e.promise(),3):i.return(t)})},i.Ki=function(e){return e},i.$d=function(e){return Promise.resolve(e)},i.add=function(e,t){var n,i,r,a,o,s,u,h=this;return L(function(c){if(1==c.g){for(n=Ib(h.h,e),i=n.store(),r=[],a=l(t),o=a.next(),s={};!o.done;s={Rh:void 0},o=a.next())u=o.value,s.Rh=i.add(u),s.Rh.onsuccess=function(e){return function(){r.push(e.Rh.result)}}(s);return _(c,n.promise(),2)}return c.return(r)})},Nb.prototype.destroy=function(){return this.g.destroy()},Nb.prototype.getAll=function(){var e,t,n=this;return L(function(i){return 1==i.g?(e=Mb(n.g,"session-ids","readonly"),t=[],_(i,Cb(e,function(e,n){t.push(n)}),2)):3!=i.g?_(i,e.promise(),3):i.return(t)})},Nb.prototype.add=function(e){for(var t=Ib(this.g,"session-ids"),n=t.store(),i=(e=l(e)).next();!i.done;i=e.next())n.add(i.value);return t.promise()},Nb.prototype.remove=function(e){var t,n=this;return L(function(i){return 1==i.g?_(i,Cb(t=Ib(n.g,"session-ids"),function(t,n,i){e.includes(n.sessionId)&&i.delete()}),2):_(i,t.promise(),0)})},Ob.prototype.destroy=function(){for(var e=[],t=l(this.g.values()),n=t.next();!n.done;n=t.next())e.push(n.value.destroy());return this.g.clear(),Promise.all(e)},Ob.prototype.init=function(){var e=this;jb.forEach(function(t,n){(t=t())&&e.g.set(n,t)});for(var t=[],n=l(this.g.values()),i=n.next();!i.done;i=n.next())t.push(i.value.init());return Promise.all(t)},H("shaka.offline.StorageMuxer",Ob),Ob.unregister=function(e){jb.delete(e)},Ob.register=Fb,Ob.prototype.destroy=Ob.prototype.destroy;var jb=new Map;function Gb(){Pb.apply(this,arguments)}function Hb(e,t){!function(e){var t=e.streams.filter(function(e){return"audio"==e.contentType});if(e=e.streams.filter(function(e){return"video"==e.contentType}),!t.every(function(e){return e.variantIds})||!e.every(function(e){return e.variantIds})){for(var n=l(t),i=n.next();!i.done;i=n.next())i.value.variantIds=[];for(i=(n=l(e)).next();!i.done;i=n.next())i.value.variantIds=[];if(n=0,e.length&&!t.length){i=n++;for(var r=l(e),a=r.next();!a.done;a=r.next())a.value.variantIds.push(i)}if(!e.length&&t.length)for(i=n++,a=(r=l(t)).next();!a.done;a=r.next())a.value.variantIds.push(i);if(e.length&&t.length)for(i=(t=l(t)).next();!i.done;i=t.next())for(i=i.value,a=(r=l(e)).next();!a.done;a=r.next()){a=a.value;var o=n++;i.variantIds.push(o),a.variantIds.push(o)}}}(e);for(var n=l(e.streams),i=n.next();!i.done;i=n.next());return e.streams.map(function(n){return function(e,t,n){var i=e.initSegmentUri?Vb(e.initSegmentUri):null,r=t+e.presentationTimeOffset,a=t+n;return{id:e.id,originalId:null,groupId:null,primary:e.primary,type:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:void 0,hdr:void 0,colorGamut:void 0,videoLayout:void 0,kind:e.kind,language:e.language,originalLanguage:e.language||null,label:e.label,width:e.width,height:e.height,initSegmentKey:i,encrypted:e.encrypted,keyIds:new Set([e.keyId]),segments:e.segments.map(function(e){var n=Vb(e.uri);return{startTime:t+e.startTime,endTime:t+e.endTime,dataKey:n,initSegmentKey:i,appendWindowStart:t,appendWindowEnd:a,timestampOffset:r,tilesLayout:"",mimeType:null,codecs:null,thumbnailSprite:null}}),variantIds:e.variantIds,roles:[],forced:!1,audioSamplingRate:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,tilesLayout:void 0,external:!1,fastSwitching:!1,isAudioMuxedInVideo:!1}}(n,e.startTime,t)})}function Vb(e){var t;if((t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(e))||(t=/^offline:segment\/([0-9]+)$/.exec(e)))return Number(t[1]);throw new Ce(2,9,9004,"Could not parse uri "+e)}function Wb(){Pb.apply(this,arguments)}function zb(e,t,n){return{id:e.id,originalId:e.originalId,groupId:null,primary:e.primary,type:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:e.pixelAspectRatio,hdr:void 0,colorGamut:void 0,videoLayout:void 0,kind:e.kind,language:e.language,originalLanguage:e.language||null,label:e.label,width:e.width,height:e.height,encrypted:e.encrypted,keyIds:new Set([e.keyId]),segments:e.segments.map(function(i){return{startTime:t+i.startTime,endTime:t+i.endTime,initSegmentKey:e.initSegmentKey,appendWindowStart:t,appendWindowEnd:n,timestampOffset:t-e.presentationTimeOffset,dataKey:i.dataKey,tilesLayout:"",mimeType:null,codecs:null,thumbnailSprite:null}}),variantIds:e.variantIds,roles:[],forced:!1,audioSamplingRate:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,tilesLayout:void 0,external:!1,fastSwitching:!1,isAudioMuxedInVideo:!1}}function Kb(){Pb.apply(this,arguments)}function Xb(){this.m=this.j=this.i=this.h=this.g=this.l=null}m(Gb,Pb),Gb.prototype.updateManifestExpiration=function(e,t){var n,i,r,a=this;return L(function(o){return n=Ib(a.h,a.g),i=n.store(),r=new Br,i.get(e).onsuccess=function(n){(n=n.target.result)?(n.expiration=t,i.put(n),r.resolve()):r.reject(new Ce(2,9,9012,"Could not find values for "+e))},_(o,Promise.all([n.promise(),r]),0)})},Gb.prototype.$d=function(e){var t,n,i,r,a,o;return L(function(s){if(1==s.g){for(t=[],n=0;n=a&&(a=t.bandwidth),e.g.set(n.id,r),e.g.set(i.id,a)}}function l_(e,t){e.g.set(t.id,t.bandwidth||2048)}function h_(e,t){return null==(e=e.g.get(t))&&(e=0),e}function c_(e){var t=this;if(e&&e.constructor!=_c)throw new Ce(2,9,9008);this.g=this.h=null,e?(this.h=e.g,this.g=e.Jb()):(this.h=nh(),this.g=new Xr,this.g.configure(this.h.networking)),this.i=[],this.l=[];var n=!e;this.j=new ra(function(){var e,i,r,a,o;return L(function(s){switch(s.g){case 1:return _(s,Promise.all(t.l.map(function(e){return Ab(e)})),2);case 2:for(e=function(){},i=[],r=l(t.i),a=r.next();!a.done;a=r.next())o=a.value,i.push(o.then(e,e));return _(s,Promise.all(i),3);case 3:if(!n){s.A(4);break}return _(s,t.g.destroy(),4);case 4:t.h=null,t.g=null,w(s)}})}),this.m=1e9}function d_(){if(dv(Me()))e:{for(var e=l(jb.values()),t=e.next();!t.done;t=e.next())if(t=(t=t.value)()){t.destroy(),e=!0;break e}e=!1}else e=!1;return e}function p_(e){var t,n,i;return L(function(r){switch(r.g){case 1:return _(r,(t=new Ob).init(),2);case 2:return _(r,Ub(t),3);case 3:return n=r.h,i=new qb("manifest",n.path.Vb,n.path.ib,e),_(r,t.destroy(),4);case 4:return _(r,(new c_).remove(i.toString()),0)}})}function f_(e,t,n,i,r,a){var o,s,u,h,c,d,p,f,g,m,v;return L(function(y){switch(y.g){case 1:for(o=!1,S(y,2),s=!0,u=l(n.streams),h=u.next();!h.done;h=u.next())for(c=h.value,d=l(c.segments),p=d.next();!p.done;p=d.next())f=p.value,null!=(g=f.pendingSegmentRefId?i[f.pendingSegmentRefId]:null)&&(f.dataKey=g,f.pendingSegmentRefId=void 0),null!=(g=f.pendingInitSegmentRefId?i[f.pendingInitSegmentRefId]:null)&&(f.initSegmentKey=g,f.pendingInitSegmentRefId=void 0),f.pendingSegmentRefId&&(s=!1),f.pendingInitSegmentRefId&&(s=!1);return n.size+=r,s&&(n.isIncomplete=!1),_(y,e.updateManifest(t,n),4);case 4:o=!0,a(),A(y,0);break;case 2:return m=E(y),_(y,p_(t),5);case 5:if(o){y.A(6);break}return v=Object.values(i),_(y,e.removeSegments(v,function(){}),6);case 6:throw m}})}function g_(e){return e.variants.some(function(e){var t=e.audio&&e.audio.encrypted;return e.video&&e.video.encrypted||t})}function m_(e){return e.variants.some(function(e){return(e.video?e.video.drmInfos:[]).concat(e.audio?e.audio.drmInfos:[]).some(function(e){return e.initData&&e.initData.length})})}function v_(e,t,n,i){if(t.expiration=n.fe(),n=Ma(n),t.sessionIds=i?n:[],g_(e)&&i&&!n.length)throw new Ce(2,9,9007)}function y_(e,t){for(var n=[],i=l(e.streams),r=i.next();!r.done;r=i.next())r=r.value,t&&"video"==r.type?n.push({contentType:xi(r.mimeType,r.codecs),robustness:e.drmInfo.videoRobustness}):t||"audio"!=r.type||n.push({contentType:xi(r.mimeType,r.codecs),robustness:e.drmInfo.audioRobustness});return n}function b_(e,t,n){return L(function(i){return _(i,function(e,t,n,i){var r,a,o;return L(function(s){return 1==s.g?i.drmInfo?(r=function(e){var t=Array.from(e.g.keys());if(!t.length)throw new Ce(2,9,9e3,"No supported storage mechanisms found");return e.g.get(t[0]).getEmeSessionCell()}(n),a=i.sessionIds.map(function(e){return{sessionId:e,keySystem:i.drmInfo.keySystem,licenseUri:i.drmInfo.licenseServerUri,serverCertificate:i.drmInfo.serverCertificate,audioCapabilities:y_(i,!1),videoCapabilities:y_(i,!0)}}),_(s,i_(t,e,a),2)):s.return():3!=s.g?(o=s.h,_(s,r.remove(o),3)):_(s,r.add(a.filter(function(e){return!o.includes(e.sessionId)})),0)})}(e.g,e.h.drm,n,t),0)})}function __(e,t,n){function i(){}var r=function(e){for(var t=new Set,n=(e=l(e.streams)).next();!n.done;n=e.next())for(var i=(n=l(n.value.segments)).next();!i.done;i=n.next())null!=(i=i.value).initSegmentKey&&t.add(i.initSegmentKey),t.add(i.dataKey);return Array.from(t)}(n);return a_(t,n),Promise.all([e.removeSegments(r,i),e.removeManifests([t.key()],i)])}function w_(e,t){var n;return L(function(i){switch(i.g){case 1:return S(i,2),_(i,xh(t,e.g,e.h.streaming.retryParameters),4);case 4:n=i.h,A(i,3);break;case 2:E(i);case 3:if(n)return i.return(n);throw new Ce(1,2,2011,t)}})}function S_(e,t,n,i,r,a){var o={id:i.id,originalId:i.originalId,groupId:i.groupId,primary:i.primary,type:i.type,mimeType:i.mimeType,codecs:i.codecs,frameRate:i.frameRate,pixelAspectRatio:i.pixelAspectRatio,hdr:i.hdr,colorGamut:i.colorGamut,videoLayout:i.videoLayout,kind:i.kind,language:i.language,originalLanguage:i.originalLanguage,label:i.label,width:i.width||null,height:i.height||null,encrypted:i.encrypted,keyIds:i.keyIds,segments:[],variantIds:[],roles:i.roles,forced:i.forced,channelsCount:i.channelsCount,audioSamplingRate:i.audioSamplingRate,spatialAudio:i.spatialAudio,closedCaptions:i.closedCaptions,tilesLayout:i.tilesLayout,mssPrivateData:i.mssPrivateData,external:i.external,fastSwitching:i.fastSwitching,isAudioMuxedInVideo:i.isAudioMuxedInVideo},s=r.offline.numberOfParallelDownloads,u=0===s?i.id:0;return function(e,t,n){if(null!=(t=e.segmentIndex.find(t)))for(var i=e.segmentIndex.get(t);i;)n(i,t),i=e.segmentIndex.get(++t)}(i,n.presentationTimeline.Lb(),function(n,r){var l=yb(n),h=void 0;if(!a.has(l)){var c=n.endTime-n.startTime;c=h_(t,i.id)*c,c=wb(e.g,c),a.set(l,new vb(n,c,u,!1,r))}n.ea&&(h=yb(n.ea),a.has(h)||(c=.5*h_(t,i.id),c=wb(e.g,c),a.set(h,new vb(n.ea,c,u,!0,r)))),o.segments.push({pendingInitSegmentRefId:h,initSegmentKey:h?0:null,startTime:n.startTime,endTime:n.endTime,appendWindowStart:n.appendWindowStart,appendWindowEnd:n.appendWindowEnd,timestampOffset:n.timestampOffset,tilesLayout:n.tilesLayout,pendingSegmentRefId:l,dataKey:0,mimeType:n.mimeType,codecs:n.codecs,thumbnailSprite:n.thumbnailSprite}),0!==s&&(u=(u+1)%s)}),o}function T_(e){if(e.j.g)throw new Ce(2,9,7001)}function A_(){if(!d_())throw new Ce(2,9,9e3)}function E_(e,t){return L(function(n){return 1==n.g?(e.i.push(t),T(n,2),_(n,t,4)):2!=n.g?n.return(n.h):(x(n),Qt(e.i,t),C(n,0))})}function x_(e){for(var t=new Set,n=l(e.variants),i=n.next();!i.done;i=n.next())(i=i.value).audio&&t.add(i.audio),i.video&&t.add(i.video);for(i=(n=l(e.textStreams)).next();!i.done;i=n.next())t.add(i.value);for(n=(e=l(e.imageStreams)).next();!n.done;n=e.next())t.add(n.value);return t}H("shaka.offline.indexeddb.StorageMechanismOpenTimeout",Yb),Fb("idb",function(){return Me().ki()?new Xb:null}),qb.prototype.Vb=function(){return this.i},qb.prototype.ib=function(){return this.h},qb.prototype.key=function(){return this.l},qb.prototype.toString=function(){return this.j},(i=e_.prototype).configure=function(){},i.start=function(e,t){var n,i,r,a,o,s,u=this;return L(function(l){switch(l.g){case 1:if(n=Zb(e),u.g=n,null==n||"manifest"!=n.g)throw new Ce(2,1,9004,e);return i=new Ob,T(l,2),_(l,i.init(),4);case 4:return _(l,Bb(i,n.Vb(),n.ib()),5);case 5:return _(l,l.h.getManifests([n.key()]),6);case 6:return r=l.h,a=r[0],o=new Jb(n.Vb(),n.ib()),s=Qb(o,a),t.makeTextStreamsForClosedCaptions(s),l.return(s);case 2:return x(l),_(l,i.destroy(),7);case 7:C(l,0)}})},i.stop=function(){return Promise.resolve()},i.update=function(){},i.onExpirationUpdated=function(e,t){var n,i,r,a,o,s,u,l=this;return L(function(h){switch(h.g){case 1:return n=l.g,i=new Ob,S(h,2,3),_(h,i.init(),5);case 5:return _(h,Bb(i,n.Vb(),n.ib()),6);case 6:return _(h,(r=h.h).getManifests([n.key()]),7);case 7:if(a=h.h,o=a[0],s=o.sessionIds.includes(e),u=null==o.expiration||o.expiration>t,!s||!u){h.A(3);break}return _(h,r.updateManifestExpiration(n.key(),t),3);case 3:return x(h),_(h,i.destroy(),10);case 10:C(h,0);break;case 2:E(h),h.A(3)}})},i.onInitialVariantChosen=function(){},i.banLocation=function(){},i.setMediaElement=function(){},so("application/x-offline-manifest",function(){return new e_}),H("shaka.offline.OfflineScheme",t_),t_.plugin=n_,Yr("offline",n_),(i=c_.prototype).destroy=function(){return this.j.destroy()},i.configure=function(e,t){return 2==arguments.length&&"string"==typeof e&&(e=Wl(e,t)),ih(this.h,e)},i.getConfiguration=function(){var e=nh();return ih(e,this.h,nh()),e},i.Jb=function(){return this.g},i.store=function(e,t,n,i,r){var a=this,o=this.getConfiguration(),s=new Tb(this.g);return this.l.push(s),t=function(e,t,n,i,r,a,o,s){var u,h,c,d,p,f,g,m,v,y,b,T,k,I,M,P,D,R,N,O,U,B,F;return L(function(j){switch(j.g){case 1:return A_(),h=u=null,c=new Ob,f=p=d=null,S(j,2,3),_(j,a(),5);case 5:return u=j.h,_(j,function(e,t,n,i){var r,a,o,s,u;return L(function(l){if(1==l.g)return r=null,a=e.g,o={networkingEngine:a,filter:function(){return Promise.resolve()},makeTextStreamsForClosedCaptions:function(){},onTimelineRegionAdded:function(){},onEvent:function(){},onError:function(e){r=e},isLowLatencyMode:function(){return!1},updateDuration:function(){},newDrmInfo:function(){},onManifestUpdated:function(){},getBandwidthEstimate:function(){return i.abr.defaultBandwidthEstimate},onMetadata:function(){},disableStream:function(){},addFont:function(){}},n.configure(i.manifest),T_(e),_(l,n.start(t,o),2);if(3!=l.g)return s=l.h,T_(e),u=x_(s),_(l,Promise.all(ee(u,function(e){return e.createSegmentIndex()})),3);if(T_(e),r)throw r;return l.return(s)})}(e,t,u,o),6);case 6:if(g=j.h,T_(e),g.presentationTimeline.T()||g.presentationTimeline.hd())throw new Ce(2,9,9005,t);m=l(i),v=m.next();case 7:if(v.done){j.A(9);break}return y=v.value,_(j,function(e,t,n){var i,r,a,o,s,u,h,c,d,p,f,g,m,v,y;return L(function(b){switch(b.g){case 1:return _(b,w_(e,t),2);case 2:if("text/vtt"!=(i=b.h))throw new Ce(1,2,2017,t);return _(b,function(e,t,n){var i,r,a;return L(function(o){return 1==o.g?(i=ta,(r=Zr([e],n)).method="GET",_(o,t.request(i,r).promise,2)):(a=o.h,o.return(a.data))})}(t,e.g,e.h.streaming.retryParameters),3);case 3:if(r=b.h,!(a=Fi(i)))throw new Ce(2,2,2014,i);for(o=a(),s={periodStart:0,segmentStart:0,segmentEnd:n.presentationTimeline.getDuration(),vttOffset:0},u=Te(r),h=o.parseMedia(u,s,t,[]),c=[],d=l(h),p=d.next(),f={};!p.done;f={rg:void 0,Bd:void 0},p=d.next())f.Bd=p.value,f.rg=null,g=function(e){return function(){return null==e.rg&&(e.rg=Ze([t],[e.Bd.payload])),e.rg||[]}}(f),m=new qo(f.Bd.startTime,f.Bd.endTime,g,0,null,null,0,0,1/0),f.Bd.payload.includes("#xywh")&&4===(v=f.Bd.payload.split("#xywh=")[1].split(",")).length&&m.hg({height:parseInt(v[3],10),positionX:parseInt(v[0],10),positionY:parseInt(v[1],10),width:parseInt(v[2],10)}),c.push(m);if(y=i,!c.length){b.A(4);break}return _(b,xh(c[0].S()[0],e.g,e.h.manifest.retryParameters),5);case 5:y=b.h;case 4:return b.return({id:e.m++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Gu(c),mimeType:y||"",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:"image",primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,tilesLayout:"1x1",accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(y||"","")]),isAudioMuxedInVideo:!1,baseOriginalId:null})}})}(e,y,g),10);case 10:b=j.h,g.imageStreams.push(b),T_(e),v=m.next(),j.A(7);break;case 9:T=l(r),k=T.next();case 11:return k.done?(Ha(o.drm.clearKeys,g.variants),P=g.variants.some(function(e){if(e.audio)for(var t=l(e.audio.drmInfos),n=t.next();!n.done;n=t.next())if(n.value.licenseServerUri.startsWith("data:"))return!0;if(e.video)for(t=(e=l(e.video.drmInfos)).next();!t.done;t=e.next())if(t.value.licenseServerUri.startsWith("data:"))return!0;return!1}),D=o.offline.usePersistentLicense,P&&(D=!1),_(j,e.yd(g,function(e){f=f||e},o,D),15)):(I=k.value,_(j,function(e,t,n,i,r,a,o){var s;return L(function(u){if(1==u.g)return a?u.A(2):_(u,w_(e,n),3);if(2!=u.g&&(a=u.h),s={id:e.m++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:Vu(0,t.presentationTimeline.getDuration(),[n]),mimeType:a||"",codecs:o||"",kind:r,encrypted:!1,drmInfos:[],keyIds:new Set,language:i,originalLanguage:i,label:null,type:nt,primary:!1,trickModeVideo:null,dependencyStream:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([xi(a||"",o||"")]),isAudioMuxedInVideo:!1,baseOriginalId:null},!ji(xi(s.mimeType,s.codecs)))throw new Ce(2,2,2014,a);return u.return(s)})}(e,g,I.uri,I.language,I.kind,I.mime,I.codecs),14));case 14:M=j.h,g.textStreams.push(M),T_(e),k=T.next(),j.A(11);break;case 15:if(h=j.h,T_(e),f)throw f;return _(j,function(e,t,n,i){var r,a,o,s,u,h,c,d,p,f,g,m,v,y,b,T,x,C,k,I,M,P,D,R,N,O,U,B,F;return L(function(L){switch(L.g){case 1:return r={width:1/0,height:1/0},function(e,t,n){e.variants=e.variants.filter(function(e){return Qi(e,t,n)})}(e,n.restrictions,r),_(L,$i(t,e,i,n.drm.preferredKeySystems,n.drm.keySystemsMapping),2);case 2:for(a=[],o=n.preferredDecodingAttributes,s=n.preferredVideoCodecs,u=n.preferredAudioCodecs,h=n.preferredTextFormats,Ji(e,s,u,o,h),c=l(e.variants),d=c.next();!d.done;d=c.next())p=d.value,a.push(or(p));for(f=l(e.textStreams),g=f.next();!g.done;g=f.next())m=g.value,a.push(sr(m));for(v=l(e.imageStreams),y=v.next();!y.done;y=v.next())b=y.value,a.push(ur(b));return _(L,n.offline.trackSelectionCallback(a),3);case 3:for(T=L.h,x=e.presentationTimeline.getDuration(),C=0,k=l(T),I=k.next();!I.done;I=k.next())M=I.value,P=M.bandwidth*x/8,C+=P;return S(L,4),_(L,n.offline.downloadSizeCallback(C),6);case 6:if(!L.h)throw new Ce(2,9,9014);A(L,5);break;case 4:if((D=E(L))instanceof Ce)throw D;throw new Ce(2,9,9015);case 5:for(R=new Set,N=new Set,O=new Set,U=l(T),B=U.next();!B.done;B=U.next())"variant"==(F=B.value).type&&R.add(F.id),"text"==F.type&&N.add(F.id),"image"==F.type&&O.add(F.id);e.variants=e.variants.filter(function(e){return R.has(e.id)}),e.textStreams=e.textStreams.filter(function(e){return N.has(e.id)}),e.imageStreams=e.imageStreams.filter(function(e){return O.has(e.id)}),function(e){e.variants.map(function(e){return e.video});var t=new Set(e.variants.map(function(e){return e.audio}));e=e.textStreams;for(var n=l(t),i=n.next();!i.done;i=n.next())for(var r=(i=l(t)).next();!r.done;r=i.next());for(n=(t=l(e)).next();!n.done;n=t.next())for(i=(n=l(e)).next();!i.done;i=n.next());}(e),w(L)}})}(g,h,o,D),16);case 16:return _(j,c.init(),17);case 17:return T_(e),_(j,Ub(c),18);case 18:return d=j.h,T_(e),R=function(e,t,n,i,r,a,o){var s=function(e,t,n){return{offlineUri:null,originalManifestUri:e,duration:t.presentationTimeline.getDuration(),size:0,expiration:1/0,tracks:t=o_(t),appMetadata:n,isIncomplete:!1}}(n,t,i),u=r.offline.progressCallback;!function(e,t,n){e.s=function(e,t){s.size=t,u(s,e)},e.m=n}(a,0,function(t,n){h&&o&&c==n&&Ia(e,"cenc",t)});var h=g_(t)&&!m_(t),c=null;h&&(c=C_.get(e.g.keySystem));for(var d=new s_,p=l(t.textStreams),f=p.next();!f.done;f=p.next())d.g.set(f.value.id,52);for(f=(p=l(t.imageStreams)).next();!f.done;f=p.next())l_(d,f.value);for(f=(p=l(t.variants)).next();!f.done;f=p.next())u_(d,f.value);return a=function(e,t,n,i){for(var r=new Map,a=x_(n),o=new Map,s=(a=l(a)).next();!s.done;s=a.next()){var u=S_(e,t,n,s=s.value,i,r);o.set(s.id,u)}for(t=(e=l(n.variants)).next();!t.done;t=e.next())(t=t.value).audio&&o.get(t.audio.id).variantIds.push(t.id),t.video&&o.get(t.video.id).variantIds.push(t.id);return{streams:Array.from(o.values()),oi:Array.from(r.values())}}(a,d,t,r),r=a.streams,a=a.oi,(d=e.g)&&o&&(d.initData=[]),{Gl:{creationTime:Date.now(),originalManifestUri:n,duration:t.presentationTimeline.getDuration(),size:0,expiration:e.fe(),streams:r,sessionIds:o?Ma(e):[],drmInfo:d,appMetadata:i,isIncomplete:!0,sequenceMode:t.sequenceMode,type:t.type},oi:a}}(h,g,t,n,o,s,D),N=R.Gl,O=R.oi,_(j,d.ib.addManifests([N]),19);case 19:if(U=j.h,T_(e),p=U[0],T_(e),f)throw f;return _(j,function(e,t,n,i,r,a,o,s,u,h){var c,d,p,f,g,m,v,y,b,T,x;return L(function(C){switch(C.g){case 1:if(c={},d=0,p=function(){if(e.j.g||r.l)throw new Ce(2,9,7001)},f=function(e,t){var f,g,m,v,y,b,S,T,A;return L(function(E){if(1==E.g){for(f=l(e),g=f.next(),m={};!g.done;m={rc:void 0},g=f.next())m.rc=g.value,p(),v=bb(m.rc,a),y=m.rc.i,b=m.rc.h,S=function(e){return function(t){var n,i,r,a;return L(function(s){switch(s.g){case 1:if(n=e.rc.g,i=n.ec(!1),!n.aesKey||i){s.A(2);break}return _(s,fl(t,n.aesKey,e.rc.j),3);case 3:t=s.h;case 2:return r=yb(n),_(s,o.addSegments([{data:t}]),4);case 4:a=s.h,p(),c[r]=a[0],d+=t.byteLength,w(s)}})}}(m),T=m.rc.g,(A=T.ec(!1))?Eb(r,m.rc.groupId,A,y,b,S):r.queue(m.rc.groupId,v,y,b,S);return _(E,function(e){return L(function(t){return 1==t.g?_(t,Promise.all(e.i.values()),2):t.return(e.g.g)})}(r),2)}return p(),!t||r.l?E.A(0):(v_(s,i,u,h),_(E,o.updateManifest(n,i),0))})},g=!1,S(C,2),!g_(s)||!g||m_(s)){C.A(4);break}return _(C,f(t.filter(function(e){return e.h}),!0),5);case 5:return p(),t=t.filter(function(e){return!e.h}),m=c,v=d,c={},d=0,_(C,f_(o,n,i,m,v,function(){return T_(e)}),6);case 6:p();case 4:if(g){C.A(7);break}return _(C,f(t,!1),8);case 8:return p(),y=c,b=d,c={},d=0,_(C,f_(o,n,i,y,b,function(){return p()}),9);case 9:p();case 7:A(C,0);break;case 2:return T=E(C),x=Object.values(c),_(C,o.removeSegments(x,function(){}),10);case 10:throw T}})}(e,O,p,N,s,o,d.ib,g,h,D),20);case 20:return T_(e),v_(g,N,h,D),_(j,d.ib.updateManifest(p,N),21);case 21:return T_(e),B=new qb("manifest",d.path.Vb,d.path.ib,p),j.return(a_(B,N));case 3:return x(j),_(j,c.destroy(),22);case 22:if(!u){j.A(23);break}return _(j,u.stop(),23);case 23:if(!h){j.A(25);break}return _(j,h.destroy(),25);case 25:C(j,0);break;case 2:if(F=E(j),null==p){j.A(27);break}return _(j,p_(p),27);case 27:throw f||F}})}(this,e,t||{},i||[],r||[],function(){var t;return L(function(i){return 1==i.g?n?i.A(2):_(i,xh(e,a.g,o.manifest.retryParameters),3):(2!=i.g&&(n=i.h),t=uo(e,n||null),i.return(t()))})},o,s),(t=new Fr(t,function(){return Ab(s)})).finally(function(){Qt(a.l,s)}),function(e,t){var n=t.promise;return e.i.push(n),t.finally(function(){Qt(e.i,n)})}(this,t)},i.remove=function(e){return E_(this,function(e,t){var n,i,r,a,o,s;return L(function(u){switch(u.g){case 1:if(A_(),null==(n=Zb(t))||"manifest"!=n.g)throw new Ce(2,9,9004,t);return i=n,r=new Ob,T(u,2),_(u,r.init(),4);case 4:return _(u,Bb(r,i.Vb(),i.ib()),5);case 5:return _(u,(a=u.h).getManifests([i.key()]),6);case 6:return o=u.h,s=o[0],_(u,Promise.all([b_(e,s,r),__(a,i,s)]),2);case 2:return x(u),_(u,r.destroy(),8);case 8:C(u,0)}})}(this,e))},i.Zl=function(){return E_(this,function(e){var t,n,i,r,a,o,s,u,h,c;return L(function(d){switch(d.g){case 1:return A_(),t=e.g,n=e.h.drm,i=new Ob,r=!1,T(d,2),_(d,i.init(),4);case 4:a=[],function(e){e.g.forEach(function(e){var t;t=e.getEmeSessionCell(),a.push(t)})}(i),o=l(a),s=o.next();case 5:if(s.done){d.A(2);break}return _(d,(u=s.value).getAll(),8);case 8:return h=d.h,_(d,i_(n,t,h),9);case 9:return c=d.h,_(d,u.remove(c),10);case 10:c.length!=h.length&&(r=!0),s=o.next(),d.A(5);break;case 2:return x(d),_(d,i.destroy(),11);case 11:C(d,3);break;case 3:return d.return(!r)}})}(this))},i.list=function(){return E_(this,L(function(i){switch(i.g){case 1:return A_(),e=[],t=new Ob,T(i,2),_(i,t.init(),4);case 4:return n=Promise.resolve(),function(e,t){e.g.forEach(function(e,n){e.getCells().forEach(function(e,i){t({Vb:n,ib:i},e)})})}(t,function(t,i){n=n.then(function(){return L(function(n){if(1==n.g)return _(n,i.getAllManifests(),2);n.h.forEach(function(n,i){n=a_(new qb("manifest",t.Vb,t.ib,i),n),e.push(n)}),w(n)})})}),_(i,n,2);case 2:return x(i),_(i,t.destroy(),6);case 6:C(i,3);break;case 3:return i.return(e)}}));var e,t,n},i.yd=function(e,t,n,i){var r,a=this;return L(function(o){return 1==o.g?((r=new Aa({yc:a.g,onError:t,Of:function(){},onExpirationUpdated:function(){},onEvent:function(){}})).configure(n.drm),_(o,function(e,t,n){return e.ba=!0,e.C=new Map,e.O=n,xa(e,t,!1)}(r,e.variants,i),2)):3!=o.g?_(o,ka(r),3):o.return(r)})},H("shaka.offline.Storage",c_),c_.deleteAll=function(){var e;return L(function(t){return 1==t.g?(e=new Ob,T(t,2),_(t,function(e){var t,n;return L(function(i){return 1==i.g?(t=Array.from(e.g.values()),(n=0=n?(dw(),function(){var e=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(t,n){return e.call(this,t,n-.001)}}()):15>=n&&dw()),n=(t=l(t.rj())).next();!n.done;n=t.next())pw(n.value);(e.MediaSource||e.ManagedMediaSource)&&function(){if(e.MediaSource){var t=MediaSource.isTypeSupported.bind(MediaSource);MediaSource.isTypeSupported=function(e){return"mp2t"!=Ii(e)&&t(e)}}if(e.ManagedMediaSource){var n=ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);e.ManagedMediaSource.isTypeSupported=function(e){return"mp2t"!=Ii(e)&&n(e)}}}(),e.MediaSource&&MediaSource.isTypeSupported('video/webm; codecs="vp9"')&&!MediaSource.isTypeSupported('video/webm; codecs="vp09.00.10.08"')&&function(){var e=MediaSource.isTypeSupported;Me().Tj()&&(MediaSource.isTypeSupported=function(t){var n=t.split(/ *; */),i=n.findIndex(function(e){return e.startsWith("codecs=")});if(0>i)return e(t);var r=n[i].replace("codecs=","").replace(/"/g,"").split(/\s*,\s*/),a=r.findIndex(function(e){return e.startsWith("vp09")});return 0<=a&&(r[a]="vp9",n[i]='codecs="'+r.join(",")+'"',t=n.join("; ")),e(t)})}()}function dw(){var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=e.apply(this,D.apply(0,arguments));return t.abort=function(){},t}}function pw(t){var n=MediaSource.isTypeSupported.bind(MediaSource);if(MediaSource.isTypeSupported=function(e){return Pi(e)!=t&&n(e)},e.ManagedMediaSource){var i=ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);e.ManagedMediaSource.isTypeSupported=function(e){return Pi(e)!=t&&i(e)}}}function fw(){}function gw(){screen.orientation&&screen.orientation.unlock||(null!=screen.orientation?(void 0===screen.orientation.lock&&(screen.orientation.lock=function(){return Promise.resolve()}),void 0===screen.orientation.unlock&&(screen.orientation.unlock=function(){})):null!=e.orientation&&function(){function t(){switch(e.orientation){case-90:n.type="landscape-secondary",n.angle=270;break;case 0:n.type="portrait-primary",n.angle=0;break;case 90:n.type="landscape-primary",n.angle=90;break;case 180:n.type="portrait-secondary",n.angle=180}}var n=new mw;screen.orientation=n,t(),e.addEventListener("orientationchange",function(){t();var e=new V("change");n.dispatchEvent(e)})}())}function mw(){$.call(this),this.type="",this.angle=0}function vw(){}function yw(t){e.HTMLVideoElement&&e.WebKitMediaKeys&&e.shakaMediaKeysPolyfill!=kw&&(void 0!==t&&t&&(iw=!0,rw=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"mediaKeys"),aw=HTMLMediaElement.prototype.setMediaKeys,ow=e.MediaKeys,sw=e.MediaKeySystemAccess,uw=navigator.requestMediaKeySystemAccess),delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=_w,e.MediaKeys=Tw,e.MediaKeySystemAccess=Sw,navigator.requestMediaKeySystemAccess=bw,e.shakaMediaKeysPolyfill=kw,_r.clear(),Rr.clear())}function bw(e,t){try{var n=new Sw(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function _w(e){var t=this.mediaKeys;return t&&t!=e&&Aw(t,null),delete this.mediaKeys,(this.mediaKeys=e)?Aw(e,this):Promise.resolve()}function ww(e){if(Ee(e=Te(e.initData)).getUint32(0,!0)+4!=e.byteLength)throw new RangeError("Malformed FairPlay init data");e=Be(e=Oe(e.subarray(4),!0));var t=new Event("encrypted");t.initDataType="skd",t.initData=Se(e),this.dispatchEvent(t)}function Sw(e,t){if(this.keySystem=e,e.startsWith("com.apple.fps"))for(t=(e=l(t)).next();!t.done;t=e.next()){var n=t.value;if("required"==n.persistentState)t=null;else{t={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:n.initDataTypes,sessionTypes:["temporary"],label:n.label};var i=!1,r=!1;if(n.audioCapabilities)for(var a=l(n.audioCapabilities),o=a.next();!o.done;o=a.next())(o=o.value).contentType&&(i=!0,WebKitMediaKeys.isTypeSupported(this.keySystem,o.contentType.split(";")[0])&&(t.audioCapabilities.push(o),r=!0));if(n.videoCapabilities)for(a=(n=l(n.videoCapabilities)).next();!a.done;a=n.next())(a=a.value).contentType&&(i=!0,WebKitMediaKeys.isTypeSupported(this.keySystem,a.contentType.split(";")[0])&&(t.videoCapabilities.push(a),r=!0));i||(r=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),t=r?t:null}if(t)return void(this.g=t)}throw(e=Error("Unsupported keySystem")).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,e}function Tw(e){this.h=new WebKitMediaKeys(e),this.g=new At}function Aw(e,t){if(e.g.Sa(),!t)return Promise.resolve();e.g.o(t,"webkitneedkey",ww);try{return Au(t,HTMLMediaElement.HAVE_METADATA,e.g,function(){t.webkitSetMediaKeys(e.h)}),Promise.resolve()}catch(e){return Promise.reject(e)}}function Ew(e){$.call(this),this.i=null,this.l=e,this.g=this.h=null,this.j=new At,this.sessionId="",this.expiration=NaN,this.closed=new Br,this.keyStatuses=new Cw}function xw(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,t=new V("keystatuseschange"),e.dispatchEvent(t)}function Cw(){this.size=0,this.g=void 0}M_(tw,-1),k_.MediaSource=hw,hw.install=cw,M_(cw),k_.Orientation=fw,fw.install=gw,m(mw,$),mw.prototype.lock=function(e){function t(e){return screen.lockOrientation?screen.lockOrientation(e):screen.mozLockOrientation?screen.mozLockOrientation(e):!!screen.msLockOrientation&&screen.msLockOrientation(e)}var n=!1;switch(e){case"natural":n=t("default");break;case"any":n=!0,this.unlock();break;default:n=t(e)}return n?Promise.resolve():((e=Error("screen.orientation.lock() is not available on this device")).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,Promise.reject(e))},mw.prototype.unlock=function(){screen.unlockOrientation?screen.unlockOrientation():screen.mozUnlockOrientation?screen.mozUnlockOrientation():screen.msUnlockOrientation&&screen.msUnlockOrientation()},M_(gw),k_.PatchedMediaKeysApple=vw,vw.uninstall=function(){e.shakaMediaKeysPolyfill==kw&&iw&&(iw=!1,Object.defineProperty(HTMLMediaElement.prototype,"mediaKeys",rw),HTMLMediaElement.prototype.setMediaKeys=aw,e.MediaKeys=ow,e.MediaKeySystemAccess=sw,navigator.requestMediaKeySystemAccess=uw,rw=uw=aw=sw=ow=null,e.shakaMediaKeysPolyfill="",_r.clear(),Rr.clear())},vw.install=yw,Sw.prototype.createMediaKeys=function(){var e=new Tw(this.keySystem);return Promise.resolve(e)},Sw.prototype.getConfiguration=function(){return this.g},Tw.prototype.createSession=function(e){if("temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new Ew(this.h,e)},Tw.prototype.setServerCertificate=function(){return Promise.resolve(!1)},Tw.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},m(Ew,$),(i=Ew.prototype).generateRequest=function(e,t){var n=this;this.h=new Br;try{var i=this.l.createSession("video/mp4",Te(t));this.i=i,this.sessionId=i.sessionId||"",this.j.o(this.i,"webkitkeymessage",function(e){n.h&&(n.h.resolve(),n.h=null),e=new V("message",e=(new Map).set("messageType",null==n.keyStatuses.Lc()?"license-request":"license-renewal").set("message",Se(e.message))),n.dispatchEvent(e)}),this.j.o(i,"webkitkeyadded",function(){n.g&&(xw(n,"usable"),n.g.resolve(),n.g=null)}),this.j.o(i,"webkitkeyerror",function(){var e=Error("EME PatchedMediaKeysApple key error");if(e.errorCode=n.i.error,null!=n.h)n.h.reject(e),n.h=null;else if(null!=n.g)n.g.reject(e),n.g=null;else switch(n.i.error.code){case WebKitMediaKeyError.MEDIA_KEYERR_OUTPUT:case WebKitMediaKeyError.MEDIA_KEYERR_HARDWARECHANGE:xw(n,"output-not-allowed");break;default:xw(n,"internal-error")}}),xw(this,"status-pending")}catch(e){this.h.reject(e)}return this.h},i.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},i.update=function(e){this.g=new Br;try{this.i.update(Te(e))}catch(e){this.g.reject(e)}return this.g},i.close=function(){try{this.i.close(),this.closed.resolve(),this.j.Sa()}catch(e){this.closed.reject(e)}return this.closed},i.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},(i=Cw.prototype).Lc=function(){return this.g},i.forEach=function(e){this.g&&e(this.g,Dr.value())},i.get=function(e){if(this.has(e))return this.g},i.has=function(e){var t=Dr.value();return!(!this.g||!we(e,t))},i.entries=function(){},i.keys=function(){},i.values=function(){};var kw="apple";function Iw(){}function Mw(){if(e.MediaKeys){var t=Me();MediaKeys.prototype.setServerCertificate&&t.Ee()||(MediaKeys.prototype.setServerCertificate=Pw)}}function Pw(){return Promise.resolve(!1)}function Lw(){}function Dw(){if(!(!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration)){if(HTMLMediaElement.prototype.webkitGenerateKeyRequest)Kw="webkit";else if(!HTMLMediaElement.prototype.generateKeyRequest)return;navigator.requestMediaKeySystemAccess=Nw,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Ow,e.MediaKeys=Bw,e.MediaKeySystemAccess=Uw,e.shakaMediaKeysPolyfill=Xw}}function Rw(e){return Kw?Kw+e.charAt(0).toUpperCase()+e.slice(1):e}function Nw(e,t){try{var n=new Uw(e,t);return Promise.resolve(n)}catch(e){return Promise.reject(e)}}function Ow(e){var t=this.mediaKeys;return t&&t!=e&&Fw(t,null),delete this.mediaKeys,(this.mediaKeys=e)&&Fw(e,this),Promise.resolve()}function Uw(e,t){this.g=this.keySystem=e;var n=!1;"org.w3.clearkey"==e&&(this.g="webkit-org.w3.clearkey",n=!1);var i=!1,r=document.getElementsByTagName("video");r=r.length?r[0]:document.createElement("video");for(var a=(t=l(t)).next();!a.done;a=t.next()){var o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:(a=a.value).initDataTypes,sessionTypes:["temporary"],label:a.label},s=!1;if(a.audioCapabilities)for(var u=l(a.audioCapabilities),h=u.next();!h.done;h=u.next())(h=h.value).contentType&&(s=!0,r.canPlayType(h.contentType.split(";")[0],this.g)&&(o.audioCapabilities.push(h),i=!0));if(a.videoCapabilities)for(h=(u=l(a.videoCapabilities)).next();!h.done;h=u.next())(h=h.value).contentType&&(s=!0,r.canPlayType(h.contentType,this.g)&&(o.videoCapabilities.push(h),i=!0));if(s||(i=r.canPlayType("video/mp4",this.g)||r.canPlayType("video/webm",this.g)),"required"==a.persistentState&&(n?(o.persistentState="required",o.sessionTypes=["persistent-license"]):i=!1),i)return void(this.h=o)}throw n="Unsupported keySystem","org.w3.clearkey"!=e&&"com.widevine.alpha"!=e||(n="None of the requested configurations were supported."),(e=Error(n)).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,e}function Bw(e){this.l=e,this.h=null,this.g=new At,this.i=[],this.j=new Map}function Fw(e,t){e.h=t,e.g.Sa();var n=Kw;t&&(e.g.o(t,n+"needkey",function(t){var n=new CustomEvent("encrypted");n.initDataType="cenc",n.initData=Se(t.initData),e.h.dispatchEvent(n)}),e.g.o(t,n+"keymessage",function(t){var n=jw(e,t.sessionId);n&&(t=new V("message",t=(new Map).set("messageType",null==n.keyStatuses.Lc()?"licenserequest":"licenserenewal").set("message",t.message)),n.h&&(n.h.resolve(),n.h=null),n.dispatchEvent(t))}),e.g.o(t,n+"keyadded",function(t){(t=jw(e,t.sessionId))&&t.ready()}),e.g.o(t,n+"keyerror",function(t){var n=jw(e,t.sessionId);if(n){var i=Error("EME v0.1b key error"),r=t.errorCode;r.systemCode=t.systemCode,i.errorCode=r,!t.sessionId&&n.h?(45==t.systemCode&&(i.message="Unsupported session type."),n.h.reject(i),n.h=null):t.sessionId&&n.g?(n.g.reject(i),n.g=null):(i=t.systemCode,t.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?Ww(n,"output-restricted"):Ww(n,1==i?"expired":"internal-error"))}}))}function jw(e,t){var n=e.j.get(t);return n||((n=e.i.shift())?(n.sessionId=t,e.j.set(t,n),n):null)}function Gw(e,t,n){$.call(this),this.j=e,this.m=!1,this.g=this.h=null,this.i=t,this.l=n,this.sessionId="",this.expiration=NaN,this.closed=new Br,this.keyStatuses=new zw}function Hw(e,t,n){if(e.m)return Promise.reject(Error("The session is already initialized."));e.m=!0;try{if("persistent-license"==e.l)if(n)var i=Te(Be("LOAD_SESSION|"+n));else{var r=Be("PERSISTENT|");i=qe(r,t)}else i=Te(t)}catch(e){return Promise.reject(e)}e.h=new Br;var a=Rw("generateKeyRequest");try{e.j[a](e.i,i)}catch(t){if("InvalidStateError"!=t.name)return e.h=null,Promise.reject(t);new zi(function(){try{e.j[a](e.i,i)}catch(t){e.h.reject(t),e.h=null}}).X(.01)}return e.h}function Vw(e,t,n){if(e.g)e.g.then(function(){return Vw(e,t,n)}).catch(function(){return Vw(e,t,n)});else{if(e.g=t,"webkit-org.w3.clearkey"==e.i){var i=Ne(n),r=JSON.parse(i);"oct"!=r.keys[0].kty&&(e.g.reject(Error("Response is not a valid JSON Web Key Set.")),e.g=null),i=Ke(r.keys[0].k),r=Ke(r.keys[0].kid)}else i=Te(n),r=null;var a=Rw("addKey");try{e.j[a](e.i,i,r,e.sessionId)}catch(t){e.g.reject(t),e.g=null}}}function Ww(e,t){var n=e.keyStatuses;n.size=null==t?0:1,n.g=t,t=new V("keystatuseschange"),e.dispatchEvent(t)}function zw(){this.size=0,this.g=void 0}M_(function(){e.HTMLVideoElement&&e.WebKitMediaKeys&&(navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||yw())}),k_.PatchedMediaKeysCert=Iw,Iw.install=Mw,M_(Mw),k_.PatchedMediaKeysWebkit=Lw,Lw.install=Dw,Uw.prototype.createMediaKeys=function(){var e=new Bw(this.g);return Promise.resolve(e)},Uw.prototype.getConfiguration=function(){return this.h},Bw.prototype.createSession=function(e){if("temporary"!=(e=e||"temporary")&&"persistent-license"!=e)throw new TypeError("Session type "+e+" is unsupported on this platform.");var t=this.h||document.createElement("video");return t.src||(t.src="about:blank"),e=new Gw(t,this.l,e),this.i.push(e),e},Bw.prototype.setServerCertificate=function(){return Promise.resolve(!1)},Bw.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},m(Gw,$),(i=Gw.prototype).ready=function(){Ww(this,"usable"),this.g&&this.g.resolve(),this.g=null},i.generateRequest=function(e,t){return Hw(this,t,null)},i.load=function(e){return"persistent-license"==this.l?Hw(this,null,e):Promise.reject(Error("Not a persistent session."))},i.update=function(e){var t=new Br;return Vw(this,t,e),t},i.close=function(){if("persistent-license"!=this.l){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var e=Rw("cancelKeyRequest");try{this.j[e](this.i,this.sessionId)}catch(e){}}return this.closed.resolve(),this.closed},i.remove=function(){return"persistent-license"!=this.l?Promise.reject(Error("Not a persistent session.")):this.close()},(i=zw.prototype).Lc=function(){return this.g},i.forEach=function(e){this.g&&e(this.g,Dr.value())},i.get=function(e){if(this.has(e))return this.g},i.has=function(e){var t=Dr.value();return!(!this.g||!we(e,t))},i.entries=function(){},i.keys=function(){},i.values=function(){};var Kw="",Xw="webkit";function Yw(){}function qw(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;t.requestPictureInPicture&&document.exitPictureInPicture||!t.webkitSupportsPresentationMode||(document.pictureInPictureEnabled=!0,document.pictureInPictureElement=null,t.requestPictureInPicture=Jw,Object.defineProperty(t,"disablePictureInPicture",{get:$w,set:eS,enumerable:!0,configurable:!0}),document.exitPictureInPicture=Qw,document.addEventListener("webkitpresentationmodechanged",Zw,!0))}}function Zw(e){if("picture-in-picture"==(e=e.target).webkitPresentationMode){document.pictureInPictureElement=e;var t=new Event("enterpictureinpicture");e.dispatchEvent(t)}else document.pictureInPictureElement==e&&(document.pictureInPictureElement=null),t=new Event("leavepictureinpicture"),e.dispatchEvent(t)}function Jw(){return this.webkitSupportsPresentationMode("picture-in-picture")?(this.webkitSetPresentationMode("picture-in-picture"),document.pictureInPictureElement=this,Promise.resolve()):Promise.reject(Error("PiP not allowed by video element"))}function Qw(){var e=document.pictureInPictureElement;return e?(e.webkitSetPresentationMode("inline"),document.pictureInPictureElement=null,Promise.resolve()):Promise.reject(Error("No picture in picture element found"))}function $w(){return!!this.hasAttribute("disablePictureInPicture")||!this.webkitSupportsPresentationMode("picture-in-picture")}function eS(e){e?this.setAttribute("disablePictureInPicture",""):this.removeAttribute("disablePictureInPicture")}function tS(){}function nS(){e.crypto&&("randomUUID"in e.crypto||(e.crypto.randomUUID=iS))}function iS(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)}function rS(){}function aS(){var e=Symbol.prototype;"description"in e||Object.defineProperty(e,"description",{get:oS})}function oS(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}function sS(){}function uS(){for(var e=l([Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array]),t=e.next();!t.done;t=e.next())(t=t.value).prototype.indexOf||(t.prototype.indexOf=lS),t.prototype.lastIndexOf||(t.prototype.lastIndexOf=hS),t.prototype.includes||(t.prototype.includes=cS)}function lS(e,t){return Array.prototype.indexOf.call(this,e,t)}function hS(e,t){return Array.prototype.lastIndexOf.call(this,e,t)}function cS(e,t){return-1!==this.indexOf(e,t)}function dS(){}function pS(){if(e.HTMLMediaElement){var t=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var e=t.apply(this);return e&&e.catch(function(){}),e}}}function fS(){}function gS(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;!t.getVideoPlaybackQuality&&("webkitDroppedFrameCount"in t||"number"==typeof cs().webkitDroppedFrameCount)&&(t.getVideoPlaybackQuality=mS)}}function mS(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function vS(){}function yS(){if(!e.VTTCue&&e.TextTrackCue){var t=null,n=TextTrackCue.length;if(3==n)t=bS;else if(6==n)t=_S;else{try{var i=!!bS(1,2,"")}catch(e){i=!1}i&&(t=bS)}t&&(e.VTTCue=function(e,n,i){return t(e,n,i)})}}function bS(t,n,i){return new e.TextTrackCue(t,n,i)}function _S(t,n,i){return new e.TextTrackCue(t+"-"+n+"-"+i,t,n,i)}function wS(e){$.call(this),this.h=e,this.l=null,this.g=[],this.i=-1,this.j=null,this.m=new At}function SS(){}M_(Dw),k_.PiPWebkit=Yw,Yw.install=qw,M_(qw),k_.RandomUUID=tS,tS.install=nS,M_(nS),k_.Symbol=rS,rS.install=aS,M_(aS),k_.TypedArray=sS,sS.install=uS,M_(uS),k_.VideoPlayPromise=dS,dS.install=pS,M_(pS),k_.VideoPlaybackQuality=fS,fS.install=gS,M_(gS),k_.VTTCue=vS,vS.install=yS,M_(yS),m(wS,$),(i=wS.prototype).destroy=function(){var e=this;return L(function(t){if(1==t.g)return _(t,e.removeAllItems(),2);e.h=null,e.m&&(e.m.release(),e.m=null),$.prototype.release.call(e),w(t)})},i.configure=function(e){this.l=e},i.getConfiguration=function(){return this.l},i.getCurrentItem=function(){return this.g.length&&0<=this.i&&this.i=m.g.length)throw new Ce(2,7,7007);return t=m.g[e],m.i!=e&&(m.i=e,m.dispatchEvent(new V("currentitemchanged"))),n=m.h.h,0<(i=m.l?m.l.preloadNextUrlWindow:0)&&(r=!1,m.m.o(n,"timeupdate",function(){var e,t,a,o;return L(function(s){switch(s.g){case 1:if(m.j||1>=m.g.length||r||m.h.T()||!n.duration)return s.return();if(e=m.h.xa().end-n.currentTime,isNaN(e)){s.A(0);break}if(!(e<=i)){s.A(0);break}if(t=m.l&&m.l.repeatMode,a=null,m.i+1=p.length)return null;v=p[v]}else d&&y&&!y.startsWith("#")&&(b=new re(d),y=new re(y),(y=b.resolve(y).toString())&&(v=y));if(("p"==e.tagName||m||v)&&(c=!0),e=c,y="default"==(g.attributes["xml:space"]||(s?"default":"preserve")),s=[],!(b=g.children.every(mn)))for(var _=l(g.children),w=_.next();!w.done;w=_.next())(w=xS(w.value,t,n,i,r,a,o,y,u,g,c,d,p))&&s.push(w);if(i=null!=h,d=bn(g),d=g.children.length&&d&&/\S/.test(d),!((_=g.attributes.begin||g.attributes.end||g.attributes.dur)||d||"br"==g.tagName||0!=s.length||i&&!y))return null;for(d=(p=OS(g,n)).start,p=p.end;f&&f.tagName&&"tt"!=f.tagName;)d=(p=NS(f,n,d,p)).start,p=p.end,f=f.parent;if(null==d&&(d=0),d+=t.periodStart,p=null==p?1/0:p+t.periodStart,d=Math.max(d,t.segmentStart),p=Math.min(p,t.segmentEnd),!_&&0n.length)return a;var o=e;for(e=null;!e&&!(e=r?En(o,r,t):o.attributes[t])&&(o=o.parent););if(t=e)for(r=(t=l(t.split(" "))).next();!r.done;r=t.next())for(r=r.value,o=(e=l(n)).next();!o.done;o=e.next())if(i+(o=o.value).attributes["xml:id"]==r){a.push(o);break}return a}function NS(e,t,n,i){return e=OS(e,t),null==n?n=e.start:null!=e.start&&(n+=e.start),null==i?i=e.end:null!=e.start&&(i+=e.start),{start:n,end:i}}function OS(e,t){var n=US(e.attributes.begin,t),i=US(e.attributes.end,t);return e=US(e.attributes.dur,t),null==i&&null!=e&&(i=n+e),{start:n,end:i}}function US(e,t){var n=null;if(WS.test(e)){e=WS.exec(e),n=Number(e[1]);var i=Number(e[2]),r=Number(e[3]),a=Number(e[4]);n=(r+=(a+=(Number(e[5])||0)/t.h)/t.frameRate)+60*i+3600*n}else if(zS.test(e))n=BS(zS,e);else if(KS.test(e))n=BS(KS,e);else if(XS.test(e))e=XS.exec(e),n=Number(e[1])/t.frameRate;else if(YS.test(e))e=YS.exec(e),n=Number(e[1])/t.g;else if(qS.test(e))n=BS(qS,e);else if(e)throw new Ce(2,2,2001,"Could not parse cue time range in TTML");return n}function BS(e,t){return null==(e=e.exec(t))||""==e[0]?null:(Number(e[4])||0)/1e3+(Number(e[3])||0)+60*(Number(e[2])||0)+3600*(Number(e[1])||0)}function FS(e,t,n,i){this.frameRate=Number(e)||30,this.h=Number(t)||1,this.g=Number(i),0==this.g&&(this.g=e?this.frameRate*this.h:1),n&&(e=/^(\d+) (\d+)$/g.exec(n))&&(this.frameRate*=Number(e[1])/Number(e[2]))}Bi("application/x-subtitle-lrc",function(){return new SS}),ES.prototype.parseInit=function(){},ES.prototype.setSequenceMode=function(){},ES.prototype.setManifestType=function(){},ES.prototype.parseMedia=function(e,t,n,i){var r=Ne(e);if(e=[],""==r)return e;var a=fn(r,"tt",!0);if(!a)throw new Ce(2,2,2005,"Failed to parse TTML.");if(!(r=wn(a,"body")[0]))return[];var o=Cn(a,QS,"frameRate"),s=Cn(a,QS,"subFrameRate"),u=Cn(a,QS,"frameRateMultiplier"),h=Cn(a,QS,"tickRate"),c=Cn(a,QS,"cellResolution"),d=a.attributes["xml:space"]||"default",p=Cn(a,$S,"extent");if("default"!=d&&"preserve"!=d)throw new Ce(2,2,2005,"Invalid xml:space value: "+d);d="default"==d,o=new FS(o,s,u,h),c=function(e){return e&&(e=/^(\d+) (\d+)$/.exec(e))?{Yc:parseInt(e[1],10),rows:parseInt(e[2],10)}:null}(c),s=((s=wn(a,"metadata")[0])?s.children:[]).filter(function(e){return"\n"!=e}),u=wn(a,"style"),h=[];for(var f=l(a=wn(a,"region")),g=f.next();!g.done;g=f.next())(g=CS(g.value,u,p))&&h.push(g);if(yn(r,"p").length)throw new Ce(2,2,2001,"

can only be inside

in TTML");for(f=(p=l(yn(r,"div"))).next();!f.done;f=p.next())if(yn(f.value,"span").length)throw new Ce(2,2,2001," can only be inside

in TTML");return(t=xS(r,t,o,s,u,a,h,d,c,null,!1,n,i))&&(t.backgroundColor||(t.backgroundColor="transparent"),e.push(t)),e},H("shaka.text.TtmlTextParser",ES),ES.prototype.parseMedia=ES.prototype.parseMedia,ES.prototype.setManifestType=ES.prototype.setManifestType,ES.prototype.setSequenceMode=ES.prototype.setSequenceMode,ES.prototype.parseInit=ES.prototype.parseInit;var jS=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,GS=/^(\d{1,4}(?:\.\d+)?|100)%$/,HS=/^(\d+px|\d+em|\d*\.?\d+c)$/,VS=/^(\d+)px (\d+)px$/,WS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,zS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,KS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,XS=/^(\d*(?:\.\d*)?)f$/,YS=/^(\d*(?:\.\d*)?)t$/,qS=RegExp("^(?:(\\d*(?:\\.\\d*)?)h)?(?:(\\d*(?:\\.\\d*)?)m)?(?:(\\d*(?:\\.\\d*)?)s)?(?:(\\d*(?:\\.\\d*)?)ms)?$"),ZS=(new Map).set("left",oi).set("center","center").set("right","end").set("start",oi).set("end","end"),JS=(new Map).set("left","line-left").set("center","center").set("right","line-right"),QS=["http://www.w3.org/ns/ttml#parameter","http://www.w3.org/2006/10/ttaf1#parameter"],$S=["http://www.w3.org/ns/ttml#styling","http://www.w3.org/2006/10/ttaf1#styling"],eT=["http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt","http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"];function tT(){this.g=new ES}function nT(){this.g="UNKNOWN"}function iT(e,t,n){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(t))?(t=i[1],e.textAlign="middle"==t?$n:ei[t.toUpperCase()]):(i=/^vertical:(lr|rl)$/.exec(t))?e.writingMode="lr"==i[1]?"vertical-lr":"vertical-rl":(i=/^size:([\d.]+)%$/.exec(t))?e.size=Number(i[1]):(i=/^position:([\d.]+)%(?:,(line-left|line-right|middle|center|start|end|auto))?$/.exec(t))?(e.position=Number(i[1]),i[2]&&(t=i[2],e.positionAlign="line-left"==t||"start"==t?"line-left":"line-right"==t||"end"==t?"line-right":"center"==t||"middle"==t?"center":Qn)):(i=/^region:(.*)$/.exec(t))?(t=function(e,t){return e=e.filter(function(e){return e.id==t}),e.length?e[0]:null}(n,i[1]))&&(e.region=t):(n=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(t))?(e.lineInterpretation=1,e.line=Number(n[1]),n[2]&&(e.lineAlign=si[n[2].toUpperCase()])):(n=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(t))&&(e.lineInterpretation=ai,e.line=Number(n[1]),n[2]&&(e.lineAlign=si[n[2].toUpperCase()]))}function rT(){this.g=null}function aT(e,t,n){var i,r,a;return(new ca).box("payl",ma(function(e){i=Ne(e)})).box("iden",ma(function(e){r=Ne(e)})).box("sttg",ma(function(e){a=Ne(e)})).parse(e),i?function(e,t,n,i,r){if(Yn(e=new zn(i,r,e)),t&&(e.id=t),n)for(n=an(t=new tn(n));n;)iT(e,n,[]),nn(t),n=an(t);return e}(i,r,a,t,n):null}function oT(){}function sT(){this.g=new nT}function uT(e){var t="WEBVTT\n\n";if(""==e)return t;for(var n=(e=l((e=(e=e.replace(/\r+/g,"")).trim()).split("\n\n"))).next();!n.done;n=e.next())(n=n.value.split(/\n/))[0].match(/\d+/)&&n.shift(),n[0]=n[0].replace(/,/g,"."),t+=n.join("\n").replace(/{b}/g,"").replace(/{\/b}/g,"").replace(/{i}/g,"").replace(/{\/i}/g,"").replace(/{u}/g,"").replace(/{\/u}/g,"")+"\n\n";return t}function lT(){}function hT(e,t){var n=t.Fontname;if(n&&(e.fontFamily=n),(n=t.Fontsize)&&(e.fontSize=n+"px"),(n=t.PrimaryColour)&&(n=cT(n))&&(e.color=n),(n=t.BackColour)&&(n=cT(n))&&(e.backgroundColor=n),t.Bold&&(e.fontWeight=ci),t.Italic&&(e.fontStyle=pi),t.Underline&&e.textDecoration.push(gi),(n=t.Spacing)&&(e.letterSpacing=n+"px"),n=t.Alignment)switch(parseInt(n,10)){case 1:e.displayAlign=ti,e.textAlign="start";break;case 2:e.displayAlign=ti,e.textAlign=$n;break;case 3:e.displayAlign=ti,e.textAlign="end";break;case 5:e.displayAlign="before",e.textAlign="start";break;case 6:e.displayAlign="before",e.textAlign=$n;break;case 7:e.displayAlign="before",e.textAlign="end";break;case 9:e.displayAlign="center",e.textAlign="start";break;case 10:e.displayAlign="center",e.textAlign=$n;break;case 11:e.displayAlign="center",e.textAlign="end"}(t=t.AlphaLevel)&&(e.opacity=parseFloat(t))}function cT(e){return 0<=(e=parseInt(e.replace("&H",""),16))?"rgba("+(255&e)+","+(e>>8&255)+","+(e>>16&255)+","+(e>>24&255^255)/255+")":null}function dT(e){return 3600*((e=mT.exec(e))[1]?parseInt(e[1].replace(":",""),10):0)+60*parseInt(e[2],10)+parseFloat(e[3])}Bi("application/ttml+xml",function(){return new ES}),tT.prototype.parseInit=function(e){var t=!1;if((new ca).box("moov",da).box("trak",da).box("mdia",da).box("minf",da).box("stbl",da).V("stsd",pa).box("stpp",function(e){t=!0,e.parser.stop()}).parse(e),!t)throw new Ce(2,2,2007)},tT.prototype.setSequenceMode=function(){},tT.prototype.setManifestType=function(){},tT.prototype.parseMedia=function(e,t,n){var i=[],r=null,a=[],o=new Map,s=[];if((new ca).box("moof",da).box("traf",da).V("tfhd",function(e){r=ho(e.reader,e.flags).ce}).V("trun",function(e){for(var t=(e=l((e=fo(e.reader,e.version,e.flags)).Vh)).next();!t.done;t=e.next())s.push(t.value.sampleSize||r||0)}).V("subs",function(e){for(var t=e.reader,n=t.W(),i=-1,r=0;r>>5)-n)?{le:n,wa:e}:null}function yT(e,t){var n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=(60&e[t+2])>>>2;if(i>n.length-1)return null;var r=((192&e[t+2])>>>6)+1,a=(1&e[t+2])<<2;return a|=(192&e[t+3])>>>6,{sampleRate:n[i],channelCount:a,codec:"mp4a.40."+r}}function bT(e,t){if(t+1=e.length)return!1;var i=(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5;return!(i<=n)&&((t+=i)===e.length||t+1e.length||11!==e[t]||119!==e[t+1])return null;var n=e[t+4]>>6;if(3<=n)return null;var i=63&e[t+4],r=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*i+n];if(t+r>e.length)return null;var a=e[t+6]>>5,o=0;2===a?o+=2:(1&a&&1!==a&&(o+=2),4&a&&(o+=2)),o=(e[t+6]<<8|e[t+7])>>12-o&1;var s=7&e[t+5];return e=new Uint8Array([n<<6|e[t+5]>>3<<1|s>>2,(3&s)<<6|a<<3|o<<2|i>>4,i<<4&224]),{sampleRate:[48e3,44100,32e3][n],channelCount:[2,1,2,3,3,4,4,5][a]+o,Ma:e,wa:r}}function ST(e,t){if(11===e[t]&&119===e[t+1]){var n,i,r=0,a=5;for(t+=a;0>>24+s<>s,r=r?r<r)return!0}return!1}function TT(e){this.j=e,this.h=0,this.g=new Map,this.i=null}function AT(e,t){if(t+8>e.length||2935!=(e[t]<<8|e[t+1]))return null;var n=new Ss(e.subarray(t+2));As(n,2),As(n,3);var i=Es(n,11)+1<<1,r=Es(n,2);if(3==r){r=[24e3,22060,16e3][r=Es(n,2)];var a=3}else r=[48e3,44100,32e3][r],a=Es(n,2);var o=Es(n,3),s=Es(n,1);return n=Es(n,5),t+i>e.byteLength?null:(e=Math.floor(i*r/(16*[1,2,3,6][a])),e=new Uint8Array([(8160&e)>>5,(31&e)<<3,r<<6|n<<1,o<<1|s,0]),{sampleRate:r,channelCount:[2,1,2,3,3,4,4,5][o]+s,Ma:e,wa:i})}function ET(e){this.j=e,this.h=0,this.g=new Map,this.i=null}Bi("text/x-ssa",function(){return new lT}),(i=_T.prototype).destroy=function(){this.g.clear()},i.isSupported=function(e){return"audio/aac"==e.toLowerCase().split(";")[0]&&Ot(this.convertCodecs("audio",e))},i.convertCodecs=function(e,t){return"audio/aac"==t.toLowerCase().split(";")[0]?'audio/mp4; codecs="'+(Di(t)||"mp4a.40.2")+'"':t},i.getOriginalMimeType=function(){return this.j},i.transmux=function(e,t,n,i){for(var r=Te(e),a=_s(r),o=a.length;o>3&3,i=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==n&&0!==r&&15!==r&&3!==a){var o=e[t+3]>>6;r=1e3*MT[14*(3===n?3-i:3===i?3:4)+r-1],a=PT[3*(3===n?0:2===n?1:2)+a],n=LT[n][i];var s=DT[i],u=Math.floor(n*r/a+(e[t+2]>>1&1))*s,l=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);return(l=l?parseInt(l[1],10):0)&&87>=l&&2===i&&224e3<=r&&0===o&&(e[t+3]|=128),{sampleRate:a,channelCount:3===o?1:2,wa:u,bm:8*n*s}}return null}function kT(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function IT(e,t){if(t+1n;n++)this.usertype[n]!==BT[n]&&(e=!1);e&&(this._parsing&&(this.type="sepiff"),t.call(this))})}(this)}function UT(e,t){for(var n=8,i=0;i>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,e.push(o),e.push(n.fullData)}r.data=qe.apply(Ve,h(e)),i.push(r)}}for(var i=[],r=null,a=!1,o=0;or?16:64)}if(Cs(n),0===(i=ks(n)))ks(n);else if(1===i)for(As(n,1),Cs(n),Cs(n),i=ks(n),r=0;r=p?(i=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][p-1],r=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][p-1]):255===p&&(i=Es(n,16),r=Es(n,16))}return n=(2-s)*(o+1)*16-2*c-2*d,a=16*(a+1)-2*u-2*l,u=[],t=t.fullData,u.push(t.byteLength>>>8&255),u.push(255&t.byteLength),u=u.concat.apply(u,h(t)),t=[],e=e.fullData,t.push(e.byteLength>>>8&255),t.push(255&e.byteLength),t=t.concat.apply(t,h(e)),{height:n,width:a,Wa:e=new Uint8Array([1,u[3],u[4],u[5],255,225].concat(u,[1],t)),cb:i,fb:r}}(w);if(!A||null==g)throw new Ce(2,3,3018,n?n.S()[0]:null);t.height=A.height,t.width=A.width,p={id:t.id,type:"video",codecs:"avc1",encrypted:t.encrypted&&0>24&255,j[1]=F>>16&255,j[2]=F>>8&255,j[3]=255&F,D.push(j),D.push(U.fullData)}}var G,H=D.length?{data:qe.apply(Ve,h(D)),isKeyframe:L}:null;if(H)null==x&&null!=M.dts&&(x=M.dts),G=I+1S;S++)Es(e,2);for(S=0;Sx;x++)for(var C=0;C<(3===x?2:6);C++)if(Ms(e)){var k=Math.min(64,1<<4+(x<<1));1=k?(E=I[k-1],x=M[k-1]):255===k&&(E=Es(e,16),x=Es(e,16))),Ms(e)&&Ms(e),Ms(e)&&(Es(e,3),Ms(e),Ms(e)&&(Ps(e),Ps(e),Ps(e))),Ms(e)&&(ks(e),ks(e)),Ms(e),Ms(e),Ms(e),(k=Ms(e))&&(ks(e),ks(e),ks(e),ks(e)),Ms(e)&&(Es(e,32),Es(e,32),Ms(e)&&ks(e),Ms(e)))for(M=!1,k=Ms(e),I=Ms(e),(k||I)&&((M=Ms(e))&&(Ps(e),Es(e,5),Ms(e),Es(e,5)),Es(e,4),Es(e,4),M&&Es(e,4),Es(e,5),Es(e,5),Es(e,5)),P=0;P<=a;P++){var D=!0;L=1,Ms(e)||(D=Ms(e));var R=!1;if(D?ks(e):R=Ms(e),R||(L=ks(e)+1),k){for(D=0;D>8,r[14]=255&i.Jf,r[15]=252|3&i.Kh,r[16]=252|3&i.Lg,r[17]=248|7&i.Hg,r[18]=248|7&i.Gg,r[19]=0,r[20]=0,r[21]=(3&i.Ng)<<6|(7&i.Ih)<<3|(i.mi?1:0)<<2|3,r[22]=3,r[23]=160,r[24]=0,r[25]=1,r[26]=(65280&e.byteLength)>>8,r[27]=255&e.byteLength,r.set(e,28),r[23+(5+e.byteLength)]=161,r[e.byteLength+29]=0,r[e.byteLength+30]=1,r[e.byteLength+31]=(65280&t.byteLength)>>8,r[e.byteLength+32]=255&t.byteLength,r.set(t,e.byteLength+33),r[23+(e.byteLength+10+t.byteLength)]=162,r[e.byteLength+10+t.byteLength+24]=0,r[e.byteLength+10+t.byteLength+25]=1,r[e.byteLength+10+t.byteLength+26]=(65280&n.byteLength)>>8,r[e.byteLength+10+t.byteLength+27]=255&n.byteLength,r.set(n,e.byteLength+10+t.byteLength+28),r}(t.fullData,n.fullData,i.fullData,{Ih:r.Ih,mi:r.mi,hh:e.hh,ih:e.ih,ah:e.ah,gh:e.gh,bh:e.bh,dh:e.dh,eh:e.eh,fh:e.fh,Vg:e.Vg,Wg:e.Wg,Xg:e.Xg,Yg:e.Yg,Zg:e.Zg,$g:e.$g,Ng:e.Ng,Jf:e.Jf,Lg:e.Lg,Hg:e.Hg,Gg:e.Gg,Kh:a.Kh}),{height:e.height,width:e.width,Wa:t,cb:e.dm,fb:e.cm}}(C);if(!V||null==x)throw new Ce(2,3,3018,n?n.S()[0]:null);t.height=V.height,t.width=V.width,p={id:t.id,type:"video",codecs:"hvc1",encrypted:t.encrypted&&0>>24&255,Xe.sampleRate>>>17&255,Xe.sampleRate>>>8&255,Xe.sampleRate>>>0&255,0,0].concat(h(Ye))),Je=Xe.sampleRate,Qe=l(u.zb()),$e=Qe.next();!$e.done;$e=Qe.next()){var tt=$e.value,nt=tt.data;null==Ke&&null!==tt.pts&&(Ke=tt.pts);for(var it=0;it(e=Math.floor(e%60))&&(e="0"+e),e=r+":"+e,t&&(10>r&&(e="0"+e),e=i+":"+e,0i&&(e="0"+e),e=n+":"+e)),e}function ZT(e,t){VT.call(this,e,t);var n=this;this.g=ss(),this.g.classList.add("shaka-ad-info"),this.g.disabled=!0,this.parent.appendChild(this.g),this.h=new zi(function(){if(n.ad.isLinear()){var e="",t=n.ad.getSequenceLength();1Date.now()){n.l.stop(),n.s=Date.now();var t=parseInt(n.h.textContent,10);t=n.m?t-e:t+e,n.h.textContent=t.toString()+"s",n.g.style.opacity="1",n.l.X(.5)}}else n.C=!0,n.s=Date.now(),n.l.X(.5)})}function rA(e,t){iA.call(this,e,t),this.g.classList.add("shaka-fast-forward-container"),this.i.textContent="fast_forward",this.m=!1}function aA(e,t){iA.call(this,e,t),this.g.classList.add("shaka-rewind-container"),this.i.textContent="fast_rewind",this.m=!0}function oA(e,t,n,i){VT.call(this,e,t);var r=this;this.container=os("div"),this.container.classList.add("shaka-range-container"),this.container.classList.add.apply(this.container.classList,h(n)),this.i=!1,this.bar=document.createElement("input"),this.F=new zi(function(){r.onChangeEnd(),r.i=!1}),this.bar.classList.add("shaka-range-element"),this.bar.classList.add.apply(this.bar.classList,h(i)),this.bar.type="range",this.bar.step="any",this.bar.min="0",this.bar.max="1",this.bar.value="0",this.bar.disabled=!this.controls.Ba(),this.container.appendChild(this.bar),this.parent.appendChild(this.container),this.K=new zi(function(){r.bar.disabled=!1}),this.eventManager.o(this.controls,"showingui",function(){r.K.X(0)}),this.eventManager.o(this.controls,"hidingui",function(){r.K.stop(),r.bar.disabled=!0}),this.eventManager.o(this.bar,"mousedown",function(e){r.bar.disabled||(r.i=!0,r.onChangeStart(),e.stopPropagation())}),this.eventManager.o(this.bar,"touchstart",function(e){r.bar.disabled||(r.i=!0,uA(r,e),r.onChangeStart(),e.stopPropagation())}),this.eventManager.o(this.bar,"input",function(){r.onChange()}),this.eventManager.o(this.bar,"touchmove",function(e){r.i&&(uA(r,e),r.onChange(),e.stopPropagation())}),this.eventManager.o(this.bar,"touchend",function(e){r.i&&(r.i=!1,uA(r,e),r.onChangeEnd(),e.stopPropagation())}),this.eventManager.o(this.bar,"touchcancel",function(e){r.i&&(r.i=!1,uA(r,e),r.onChangeEnd(),e.stopPropagation())}),this.eventManager.o(this.bar,"mouseup",function(e){r.i&&(r.i=!1,r.onChangeEnd(),e.stopPropagation())}),this.eventManager.o(this.bar,"blur",function(){r.i&&(r.i=!1,r.onChangeEnd())}),this.eventManager.o(this.bar,"contextmenu",function(e){e.preventDefault(),e.stopPropagation()})}function sA(e,t){var n=e.bar.getBoundingClientRect(),i=parseFloat(e.bar.min),r=parseFloat(e.bar.max);e=parseFloat(e.bar.step)||1;var a=n.left+6;return n=n.right-6,t=i+(Math.max(a,Math.min(n,t))-a)/(n-a)*(r-i),t=Math.round((t-i)/e)*e+i,Math.min(r,Math.max(i,t))}function uA(e,t){t.preventDefault(),e.bar.value=sA(e,t.changedTouches[0].clientX)}function lA(e,t){oA.call(this,e,t,["shaka-seek-bar-container"],["shaka-seek-bar","shaka-no-propagation","shaka-show-controls-on-mouse-over"]);var n=this;this.D=os("div"),this.D.classList.add("shaka-ad-markers"),this.container.insertBefore(this.D,this.container.childNodes[0]),this.H=this.controls.g,this.B=new zi(function(){var e=n.getValue();n.player.T()||e==n.video.duration&&(e-=.001),n.video.currentTime=e}),this.C=new zi(function(){hA(n)}),this.L=!1,this.h=os("div"),this.h.id="shaka-player-ui-thumbnail-container",this.g=os("img"),this.g.id="shaka-player-ui-thumbnail-image",this.g.draggable=!1,this.J=os("div"),this.J.id="shaka-player-ui-thumbnail-time-container",this.G=os("div"),this.G.id="shaka-player-ui-thumbnail-time",this.J.appendChild(this.G),this.h.appendChild(this.g),this.h.appendChild(this.J),this.container.appendChild(this.h),this.j=os("div"),this.j.id="shaka-player-ui-time-container",this.container.appendChild(this.j),this.l=this.s=null,this.I=!1,this.u=new zi(function(){mA(n)}),this.m=[],this.eventManager.o(this.bar,"input",function(){n.controls.Oc()}),this.eventManager.o(this.localization,"locale-updated",function(){return pA(n)}),this.eventManager.o(this.localization,"locale-changed",function(){return pA(n)}),this.eventManager.o(this.adManager,"ad-started",function(){dA(n)||YT(n.container,!1)}),this.eventManager.o(this.adManager,"ad-stopped",function(){dA(n)&&YT(n.container,!0)}),this.eventManager.o(this.adManager,"ad-cue-points-changed",function(e){n.m=e.cuepoints,cA(n)}),this.eventManager.o(this.player,"unloading",function(){n.m=[],cA(n),n.l&&(n.l.abort(),n.l=null),n.s=null,mA(n),vA(n)}),this.eventManager.o(this.bar,"mousemove",function(e){if(n.controls.Ec())vA(n),mA(n);else{var t=sA(n,e.clientX),i=n.bar.getBoundingClientRect();e=Math.max(0,e.clientX-i.left),n.player.mh().length?(vA(n),gA(n,e,t)):(mA(n),fA(n,e,t))}}),this.eventManager.o(this.container,"mouseleave",function(){vA(n),n.u.stop(),n.u.X(.25)}),this.setValue(this.video.currentTime),this.update(),pA(this),this.ad&&YT(this.container,!1)}function hA(e){if(e.m.length){for(var t=e.player.xa(),n=t.end-t.start,i=["to right"],r=[],a=e.H.seekBarColors.adBreaks,o=!1,s=l(e.m),u=s.next();!u.done;u=s.next())if(-1!=(u=u.value).start||u.end){if(!u.end&&u.start>=t.start||"number"==typeof u.end&&u.end>t.start){var h=(Math.max(u.start,t.start)-t.start)/n||0,c=h+.01;u.end&&(c=(u.end-t.start)/n||0),r.push({start:h,end:c})}}else o=!0;for(n=(t=l(r=r.sort(function(e,t){return e.start-t.start}))).next();!n.done;n=t.next())n=n.value,i.push("transparent "+100*n.start+"%"),i.push(a+" "+100*n.start+"%"),i.push(a+" "+100*n.end+"%"),i.push("transparent "+100*n.end+"%");o&&(i.push("transparent 99%"),i.push(a+" 99%")),e.D.style.background="linear-gradient("+i.join(",")+")"}else e.D.style.background="transparent",e.C.stop()}function cA(e){function t(){hA(e);var t=e.player.xa();t=t.end-t.start,e.player.T()&&5t||!isFinite(t))||null!=e.ad&&e.ad.isLinear())}function pA(e){e.bar.ariaLabel=e.localization.resolve("SEEK")}function fA(e,t,n){var i=e.j.clientWidth;e.j.style.width="auto",e.j.style.height="20px",e.j.style.top="-30px",e.j.style.left=Math.min(e.bar.offsetWidth-i,Math.max(0,t-i/2))+"px",e.j.style.right="",e.j.style.visibility="visible",t=e.player.xa(),e.player.T()?1>(n=t.end-n)?(e.j.textContent=e.localization.resolve("LIVE"),e.j.style.left="",e.j.style.right="0px"):e.j.textContent="-"+qT(n,3600<=n):(n-=t.start,e.j.textContent=qT(n,3600<=n))}function gA(e,t,n){var i,r,a,o,s,u,l,h,c,d,p,f,g,m,v,y,b;L(function(T){switch(T.g){case 1:return 0>n&&(n=0),i=!1,e.m.length&&(i=e.m.some(function(e){return!!e.end&&n>=e.start&&n<=e.end})),i?(mA(e),fA(e,t,n),T.return()):(r=e.player.xa(),a=Math.max(Math.ceil(r.start),Math.min(Math.floor(r.end),n)),e.player.T()?(o=r.end-n,e.G.textContent=1>o?e.localization.resolve("LIVE"):"-"+qT(o,3600<=o)):e.G.textContent=qT(n,3600<=n),_(T,e.player.Vi(null,a),2));case 2:if(!(s=T.h)||!s.uris||!s.uris.length)return mA(e),fA(e,t,n),T.return();if(s.widths&&o>t?(t=2*Math.sqrt(1+o-s-t),e[3]=(a-l)/t,e[0]=.25*t,e[1]=(n+r)/t,e[2]=(u+i)/t):s>t?(t=2*Math.sqrt(1+s-o-t),e[3]=(u-i)/t,e[0]=(n+r)/t,e[1]=.25*t,e[2]=(a+l)/t):(t=2*Math.sqrt(1+t-o-s),e[3]=(n-r)/t,e[0]=(u+i)/t,e[1]=(a+l)/t,e[2]=.25*t)}function CA(e,t){var n=t[0],i=t[1],r=t[2],a=n+n,o=i+i,s=r+r;n*=a;var u=i*a;i*=o;var l=r*a,h=r*o;r*=s,a*=t=t[3],o*=t,t*=s,e[0]=1-i-r,e[1]=u+t,e[2]=l-o,e[3]=0,e[4]=u-t,e[5]=1-n-r,e[6]=h+a,e[7]=0,e[8]=l+o,e[9]=h-a,e[10]=1-n-i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}function kA(){var e=new Float32Array(4);return e[3]=1,e}function IA(e){var t=[],n=[],i=[],r=Math.PI;e=void 0!==e&&e?r/2:r;for(var a=0;100>=a;a++){var o=a*r/100,s=Math.sin(o);o=Math.cos(o);for(var u=0;100>=u;u++){var l=2*u*e/100;t.push(Math.sin(l)*s,o,Math.cos(l)*s),n.push(u/100,a/100)}}for(r=0;100>r;r++)for(e=0;100>e;e++)s=(a=101*r+e)+101,i.push(a,s,a+1),i.push(s,s+1,a+1);return{Yj:t,Vj:n,indices:i}}function MA(e,t,n,i,r){this.i=e,this.qa=t,this.s=n,this.g=i,this.u=new At,this.L=kA(),this.h=kA(),this.ba=this.na=this.$=this.l=null,this.D=TA(),this.I=TA(),this.N=TA(),this.Y=TA(),this.C=null,this.O=!1,this.J=this.B=null,this.sa=this.ua=0,this.Z=this.P=this.R=this.K=null,this.H=this.G=0,this.j=75,this.U=0,this.m=r,this.F=-1,function(e){(function(e){var t=e.D,n=[0,0,0],i=[1,0,0],r=[0,1,0],a=n[0],o=n[1];n=n[2];var s=r[0],u=r[1],l=r[2],h=i[0];r=i[1];var c=i[2];if(1e-6>Math.abs(a-h)&&1e-6>Math.abs(o-r)&&1e-6>Math.abs(n-c))for(a=0;16>a;a++)t[a]=0==a%5?1:0;else{i=a-h,r=o-r,h=n-c;var d=1/Math.sqrt(i*i+r*r+h*h);c=u*(h*=d)-l*(r*=d),l=l*(i*=d)-s*h,s=s*r-u*i,(d=Math.sqrt(c*c+l*l+s*s))?(c*=d=1/d,l*=d,s*=d):s=l=c=0,u=r*s-h*l;var p=h*c-i*s,f=i*l-r*c;(d=Math.sqrt(u*u+p*p+f*f))?(u*=d=1/d,p*=d,f*=d):f=p=u=0,t[0]=c,t[1]=u,t[2]=i,t[3]=0,t[4]=l,t[5]=p,t[6]=r,t[7]=0,t[8]=s,t[9]=f,t[10]=h,t[11]=0,t[12]=-(c*a+l*o+s*n),t[13]=-(u*a+p*o+f*n),t[14]=-(i*a+r*o+h*n),t[15]=1}xA(e.L,e.D),e=t=e.Y,a=(n=[4,4,4])[0],o=n[1],n=n[2],t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]})(e),function(e){DA(e),e.g.viewport(0,0,e.g.drawingBufferWidth,e.g.drawingBufferHeight),e.g.clearColor(0,0,0,1),e.g.enable(e.g.CULL_FACE),e.g.cullFace(e.g.FRONT),e.g.clear(e.g.COLOR_BUFFER_BIT)}(e),function(e){var t=PA(e,e.g.VERTEX_SHADER),n=PA(e,e.g.FRAGMENT_SHADER);e.l=e.g.createProgram(),e.g.attachShader(e.l,t),e.g.attachShader(e.l,n),e.g.linkProgram(e.l),"cubemap"==e.m?(e.R=e.g.getAttribLocation(e.l,"aVertexPosition"),e.P=e.g.getAttribLocation(e.l,"aTextureCoord")):(e.R=e.g.getAttribLocation(e.l,"a_vPosition"),e.g.enableVertexAttribArray(e.R),e.P=e.g.getAttribLocation(e.l,"a_TexCoordinate"),e.g.enableVertexAttribArray(e.P))}(e),function(e){e.K="cubemap"==e.m?{Yj:[-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1],Vj:[2/3,.5,1/3,.5,1/3,0,2/3,0,2/3,.5,2/3,0,1,0,1,.5,1,1,2/3,1,2/3,.5,1,.5,0,.5,0,0,1/3,0,1/3,.5,0,.5,1/3,.5,1/3,1,0,1,1/3,1,1/3,.5,2/3,.5,2/3,1],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}:"halfequirectangular"==e.m?IA(!0):IA(),e.$=e.g.createBuffer(),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.$),e.g.bufferData(e.g.ARRAY_BUFFER,new Float32Array(e.K.Yj),e.g.STATIC_DRAW),e.na=e.g.createBuffer(),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.na),e.g.bufferData(e.g.ARRAY_BUFFER,new Float32Array(e.K.Vj),e.g.STATIC_DRAW),e.ba=e.g.createBuffer(),e.g.bindBuffer(e.g.ELEMENT_ARRAY_BUFFER,e.ba),e.g.bufferData(e.g.ELEMENT_ARRAY_BUFFER,new Uint16Array(e.K.indices),e.g.STATIC_DRAW)}(e),function(e){e.Z=e.g.createTexture(),e.g.bindTexture(e.g.TEXTURE_2D,e.Z),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_WRAP_S,e.g.CLAMP_TO_EDGE),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_WRAP_T,e.g.CLAMP_TO_EDGE),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_MIN_FILTER,e.g.NEAREST),e.g.texParameteri(e.g.TEXTURE_2D,e.g.TEXTURE_MAG_FILTER,e.g.NEAREST)}(e),Au(e.i,HTMLMediaElement.HAVE_CURRENT_DATA,e.u,function(){if(e.i.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA&&LA(e),"requestVideoFrameCallback"in e.i){var t=function(){-1!=e.F&&(LA(e),-1!=e.F&&(e.F=e.i.requestVideoFrameCallback(t)))};e.F=e.i.requestVideoFrameCallback(t)}else{var n;e.u.o(e.i,"canplaythrough",function(){LA(e)}),e.u.o(e.i,"playing",function(){if(e.B&&e.B.stop(),!n)for(var t=e.qa.qb(),i=(t=l(t)).next();!i.done;i=t.next())(i=i.value.frameRate)&&(!n||ne.i.readyState||!n&&0==e.i.playbackRate||(AA(e.I,e.j*Math.PI/180,1.5625),"cubemap"==e.m?AA(e.I,e.j*Math.PI/180,2.5):AA(e.I,e.j*Math.PI/180,1.5625),e.g.useProgram(e.l),e.g.clear(e.g.COLOR_BUFFER_BIT),DA(e),t&&(e.g.activeTexture(e.g.TEXTURE0),e.g.bindTexture(e.g.TEXTURE_2D,e.Z),e.g.pixelStorei(e.g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.g.texImage2D(e.g.TEXTURE_2D,0,e.g.RGBA,e.g.RGBA,e.g.UNSIGNED_BYTE,e.i)),"equirectangular"!=e.m&&"halfequirectangular"!=e.m||(EA(e.N,e.D,e.Y),EA(e.N,e.I,e.N)),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.$),e.g.vertexAttribPointer(e.R,3,e.g.FLOAT,!1,0,0),e.g.enableVertexAttribArray(e.R),e.g.bindBuffer(e.g.ARRAY_BUFFER,e.na),e.g.vertexAttribPointer(e.P,2,e.g.FLOAT,!1,0,0),e.g.enableVertexAttribArray(e.P),e.g.bindBuffer(e.g.ELEMENT_ARRAY_BUFFER,e.ba),"cubemap"==e.m?(e.g.uniformMatrix4fv(e.g.getUniformLocation(e.l,"uProjectionMatrix"),!1,e.I),e.g.uniformMatrix4fv(e.g.getUniformLocation(e.l,"uModelViewMatrix"),!1,e.N)):e.g.uniformMatrix4fv(e.g.getUniformLocation(e.l,"u_VPMatrix"),!1,e.N),e.g.uniform1i(e.g.getUniformLocation(e.l,"uSampler"),0),e.O&&e.g.viewport(0,0,e.s.width/2,e.s.height),e.g.drawElements(e.g.TRIANGLES,e.K.indices.length,e.g.UNSIGNED_SHORT,0),e.O&&(e.g.viewport(e.s.width/2,0,e.s.width/2,e.s.height),e.g.drawElements(e.g.TRIANGLES,e.K.indices.length,e.g.UNSIGNED_SHORT,0)))}function DA(e){var t=e.i.videoWidth;t||(t=e.s.scrollWidth);var n=e.i.videoHeight;if(n||(n=e.s.scrollHeight),e.ua!==t||e.sa!==n){e.s.width=t,e.s.height=n,e.ua=t,e.sa=n;var i=t/n,r=e.I,a=-i,o=1/(i-a);r[0]=0*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r[8]=(i+a)*o,r[9]=0,r[10]=-1,r[11]=-1,r[12]=0,r[13]=0,r[14]=-0,r[15]=0,e.I=r,e.g.viewport(0,0,t,n)}}function RA(e,t,n,i){var r=1/0,a=90*Math.PI/180;"halfequirectangular"==e.m&&(r=90*Math.PI/180,a/=2);var o="cubemap"==e.m?e.N:e.D;if(e.G+=t,e.H+=n,e.G-r){r=Math.sin(t),t=Math.cos(t);var s=o[0],u=o[1],l=o[2],h=o[3],c=o[8],d=o[9],p=o[10],f=o[11];o!=o&&(o[4]=o[4],o[5]=o[5],o[6]=o[6],o[7]=o[7],o[12]=o[12],o[13]=o[13],o[14]=o[14],o[15]=o[15]),o[0]=s*t-c*r,o[1]=u*t-d*r,o[2]=l*t-p*r,o[3]=h*t-f*r,o[8]=s*r+c*t,o[9]=u*r+d*t,o[10]=l*r+p*t,o[11]=h*r+f*t}else e.G-=t;e.H-a?(a=TA(),r=TA(),t=-1*n,n=Math.sin(t),t=Math.cos(t),s=r[4],u=r[5],l=r[6],h=r[7],c=r[8],d=r[9],p=r[10],f=r[11],r!==a&&(a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=r[3],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[4]=s*t+c*n,a[5]=u*t+d*n,a[6]=l*t+p*n,a[7]=h*t+f*n,a[8]=c*t-s*n,a[9]=d*t-u*n,a[10]=p*t-l*n,a[11]=f*t-h*n,EA(o,a,o)):e.H-=n,n=TA(),a=TA(),r=Math.sin(i),i=Math.cos(i),t=a[0],s=a[1],u=a[2],l=a[3],h=a[4],c=a[5],d=a[6],p=a[7],a!==n&&(n[8]=a[8],n[9]=a[9],n[10]=a[10],n[11]=a[11],n[12]=a[12],n[13]=a[13],n[14]=a[14],n[15]=a[15]),n[0]=t*i+h*r,n[1]=s*i+c*r,n[2]=u*i+d*r,n[3]=l*i+p*r,n[4]=h*i-t*r,n[5]=c*i-s*r,n[6]=d*i-u*r,n[7]=p*i-l*r,EA(o,n,o),LA(e,!1)}function NA(e,t){(void 0===t||t)&&(xA(e.h,e.D),e.U=0,e.C=kA(),e.C[0]=(e.h[0]-e.L[0])/20,e.C[1]=(e.h[1]-e.L[1])/20,e.C[2]=(e.h[2]-e.L[2])/20,e.C[3]=(e.h[3]-e.L[3])/20),e.h[0]-=e.C[0],e.h[1]-=e.C[1],e.h[2]-=e.C[2],e.h[3]-=e.C[3],t=TA(),function(e,t){var n=t[0],i=t[1],r=t[2],a=n*n+i*i+r*r+(t=t[3])*t;0e.U?e.J=new zi(function(){NA(e,!1),e.G=0,e.H=0,e.U++,LA(e,!1)}).X(.025):(CA(t,e.L),e.D=t)}function OA(e,t,n,i,r){$.call(this);var a=this;this.i=e,this.l=t,this.F=n,this.J=i,this.u=r,this.s=new At,this.h=new At,this.B=FA(this.l),this.g=null,this.m=!1,this.I=this.H=this.G=this.D=this.C=0,this.j=null,this.s.o(i,"loading",function(){a.g&&NA(a.g),UA(a)}),this.s.o(i,"spatialvideoinfo",function(e){switch((e=e.detail).projection){case"rect":default:a.j=null;break;case"equi":a.j="equirectangular";break;case"hequ":switch(e.hfov){case 360:a.j="equirectangular";break;case 180:a.j="halfequirectangular";break;default:null==e.hfov?a.j="halfequirectangular":a.j=null}break;case"fish":a.j="halfequirectangular"}UA(a)}),this.s.o(i,"nospatialvideoinfo",function(){a.j=null,UA(a)}),this.s.o(i,"unloading",function(){a.j=null,UA(a)}),UA(this)}function UA(e){if(e.u.displayInVrMode||e.j){e.l||(e.l=document.createElement("canvas"),e.l.classList.add("shaka-vr-canvas-container"),e.F.parentElement.insertBefore(e.l,e.F.nextElementSibling),e.B=FA(e.l));var t=e.j||e.u.defaultVrProjectionMode;e.g?e.g.m!=t&&(e.h.Sa(),e.g.release(),BA(e,t)):(e.l.style.display="",BA(e,t),e.dispatchEvent(new V("vrstatuschanged",(new Map).set("newStatus",e.Ub()))))}else!e.u.displayInVrMode&&!e.j&&e.l&&e.g&&(e.l.style.display="none",e.h.Sa(),e.g.release(),e.g=null,e.dispatchEvent(new V("vrstatuschanged",(new Map).set("newStatus",e.Ub()))))}function BA(t,n){t.B&&t.l&&(t.g=new MA(t.F,t.J,t.l,t.B,n),function(t){t.h.o(t.i,"mousedown",function(e){if(!t.m){var n=e.clientX;e=e.clientY,t.m=!0,t.C=n,t.D=e}}),0=n.j&&(n.j+=i),20>n.j?n.j=20:100n?n:eMath.abs(n-e)&&(n=1/0);try{navigator.mediaSession.setPositionState({duration:Math.max(0,n),playbackRate:t.B.playbackRate,position:Math.max(0,e)})}catch(e){}}},r=function(){try{navigator.mediaSession.setPositionState()}catch(e){}},a=function(e){var n=t.g.keyboardSeekDistance;switch(e.action){case"pause":case"play":ZA(t);break;case"seekbackward":if(e.seekOffset&&!isFinite(e.seekOffset))break;t.j&&t.j.isLinear()||rE(t,t.u.getValue()-(e.seekOffset||n));break;case"seekforward":if(e.seekOffset&&!isFinite(e.seekOffset))break;t.j&&t.j.isLinear()||rE(t,t.u.getValue()+(e.seekOffset||n));break;case"seekto":if(e.seekTime&&!isFinite(e.seekTime))break;t.j&&t.j.isLinear()||rE(t,t.s.xa().start+e.seekTime);break;case"stop":t.s.nc();break;case"enterpictureinpicture":t.j&&t.j.isLinear()||t.Sc()}};n("pause",a),n("play",a),n("seekbackward",a),n("seekforward",a),n("seekto",a),n("stop",a),("documentPictureInPicture"in e||document.pictureInPictureEnabled)&&n("enterpictureinpicture",a),n=function(){t.s.T()||0!=t.s.xa().start?(i(),t.h.o(t.B,"timeupdate",i)):r()},t.s.$&&n(),t.h.o(t.s,"loaded",n),t.h.o(t.s,"unloading",function(){t.h.Da(t.B,"timeupdate",i)}),t.h.o(t.s,"metadata",function(e){var n,i;(e=e.payload)&&("TIT2"==e.key&&e.data&&(n=e.data),"APIC"==e.key&&"--\x3e"==e.mimeType&&(i=e.data),n&&(e={title:n,artwork:[]},navigator.mediaSession.metadata&&((e=navigator.mediaSession.metadata).title=n),navigator.mediaSession.metadata=new MediaMetadata(e)),i&&(i!=(n=t.m).poster&&(n.poster=i),n={title:"",artwork:[{src:i}]},navigator.mediaSession.metadata&&((n=navigator.mediaSession.metadata).artwork=[{src:i}]),navigator.mediaSession.metadata=new MediaMetadata(n)))})}}(this),this.ba=new Set,tE(this),this.ua.ya(this.g.refreshTickInSeconds),this.h.o(this.sa,"locale-changed",function(e){e=e.locales[0],o.na.setLocale(e),o.l.setAttribute("lang",e)}),this.na.initInterstitial(this.G,this.Z,this.m),this.h.o(this.s,"texttrackvisibility",function(){QA(o)}),this.h.o(this.s,"unloading",function(){o.j||(o.tc()&&qA(o),o.Gd()&&o.Sc())})}function WA(e){for(var t=l(e.H),n=t.next();!n.done;n=t.next())n.value.release();e.H=[]}function zA(e,t){oE.set(e,t)}function KA(e){return!(!document.fullscreenEnabled||e.m.webkitSupportsFullscreen&&e.g.preferVideoFullScreenInVisionOS&&"APPLE_VR"==Me().Ja())}function XA(t){return"documentPictureInPicture"in e&&t.g.preferDocumentPictureInPicture}function YA(e){var t,n;return L(function(i){switch(i.g){case 1:if(S(i,2),!KA(e)){(t=e.m).webkitSupportsFullscreen&&t.webkitEnterFullscreen(),i.A(4);break}if(!e.Gd()){i.A(5);break}return _(i,e.Sc(),6);case 6:if(!XA(e)){i.A(5);break}return _(i,new Promise(function(e){new zi(e).X(.05)}),5);case 5:return _(i,e.g.fullScreenElement.requestFullscreen({navigationUI:"hide"}),9);case 9:if(!e.g.forceLandscapeOnFullscreen||!screen.orientation){i.A(4);break}return S(i,11),_(i,screen.orientation.lock("landscape"),13);case 13:A(i,4,2);break;case 11:E(i,2);case 4:A(i,0);break;case 2:n=E(i),e.dispatchEvent(new V("error",(new Map).set("detail",n))),w(i)}})}function qA(e){var t;return L(function(n){return KA(e)?(screen.orientation&&screen.orientation.unlock(),_(n,document.exitFullscreen(),0)):((t=e.m).webkitSupportsFullscreen&&t.webkitExitFullscreen(),n.A(0))})}function ZA(e){if(e.Y){if(e.j&&(e.j&&e.j.isPaused()?e.j.play():e.j&&e.j.pause(),e.j.isLinear()))return;e.B.duration&&(e.B.paused&&!e.R?(e.s.isEnded()&&(e.B.currentTime=e.s.xa().start),e.B.play()):e.B.pause())}}function JA(e,t){"mousemove"==t.type&&(e.i.classList.remove("shaka-keyboard-navigation"),$A(e)),"touchstart"==t.type||"touchmove"==t.type||"touchend"==t.type||"keyup"==t.type?e.O=Date.now():e.O+1e3\n \n \n \n \n \n \n \n ')}(this),this.g.seekOnTaps&&(function(e){var t=os("div");t.classList.add("shaka-hidden-fast-forward-container"),e.i.appendChild(t),e.Ya=new rA(t,e),e.H.push(e.Ya)}(this),function(e){var t=os("div");t.classList.add("shaka-hidden-rewind-container"),e.i.appendChild(t),e.eb=new aA(t,e),e.H.push(e.eb)}(this)),this.Ia=os("div"),this.Ia.classList.add("shaka-server-side-ad-container"),this.i.appendChild(this.Ia),function(e){e.L=os("div"),e.L.classList.add("shaka-bottom-controls"),e.L.classList.add("shaka-no-propagation"),e.i.appendChild(e.L),e.h.o(e.L,"click",function(t){t.target.closest(".shaka-overflow-button")||e.Oc()}),function(e){e.P=os("div"),e.P.classList.add("shaka-ad-controls");var t=null!=e.j&&e.j.isLinear();YT(e.P,t),e.L.appendChild(e.P),t=new bA(e.P,e),e.H.push(t)}(e),function(e){if(e.g.addSeekBar)e.u=sE.create(e.L,e),e.H.push(e.u);else{for(var t=l(e.I),n=t.next();!n.done;n=t.next())n.value.classList.add("shaka-low-position");(e=e.F).classList.contains("shaka-tooltips-on")&&e.classList.add("shaka-tooltips-low-position")}}(e),e.F=os("div"),e.F.classList.add("shaka-controls-button-panel"),e.F.classList.add("shaka-show-controls-on-mouse-over"),e.g.enableTooltips&&e.F.classList.add("shaka-tooltips-on"),e.L.appendChild(e.F);for(var t=l(e.g.controlPanelElements),n=t.next();!n.done;n=t.next())if(n=n.value,oE.get(n)){var i=oE.get(n).create(e.F,e);e.H.push(i),"time_and_duration"==n&&(n=new ZT(e.F,e),e.H.push(n))}else Y("Unrecognized control panel element requested:",n)}(this),this.I=Array.from(this.l.getElementsByClassName("shaka-settings-menu")),this.I.push.apply(this.I,h(Array.from(this.l.getElementsByClassName("shaka-overflow-menu")))),this.Ta=Array.from(this.l.getElementsByClassName("shaka-show-controls-on-mouse-over")),$A(this);for(var n=(e=l(this.l.getElementsByClassName("shaka-no-propagation"))).next();!n.done;n=e.next()){n=n.value;var i=function(e){return e.stopPropagation()};this.h.o(n,"click",i),this.h.o(n,"dblclick",i),0.499995*o?(o=Math.PI/2,e=2*Math.atan2(n,e)):s<-.499995*o?(o=-Math.PI/2,e=2*Math.atan2(n,e)):(o=Math.asin(2*(e*i-t*n)),e=Math.atan2(2*(e*t+n*i),1-2*(r+a))),e=180*Math.acos(Math.cos(e)*Math.cos(o))/Math.PI}else Y("Not playing VR content"),e=null;return e},i.jl=function(){var e=this.C;return e.g?e=e.g.j:(Y("Not playing VR content"),e=null),e},i.nm=function(e){var t=this.C;t.g?(0>e?(Y("Field of view should be greater than 0"),e=0):100=t.alpha&&(o="display");break;case"display":0>=--s&&(o="fadeOut");break;case"fadeOut":0>=(a=Math.max(0,a-u))&&(o="transition",r=n(),s=Math.round(60*t.displayDuration),o="fadeIn")}0t&&(t=(n=l([n,t])).next().value,n=n.next().value),t/n>16/9&&(n=Math.round(9*t/16)),e=e.controls.g.qualityMarks,8640<=n?n+"p":4320<=n?e[4320]:2160<=n?e[2160]:1440<=n?e[1440]:1080<=n?e[1080]:720<=n?e[720]:""):""}function Bx(e){var t=WT(e.menu);hs(e.menu),e.menu.appendChild(t),t=0,t=e.player.Fd()?function(e){var t=[];e.player.m==xd||e.player.Ca()||(t=e.player.qb()||[]);var n=t.find(function(e){return e.active});n&&(t=t.filter(function(t){if(t.language!=n.language||e.controls.g.showAudioChannelCountVariants&&t.channelsCount&&n.channelsCount&&t.channelsCount!=n.channelsCount)return!1;var i=e.controls.g.trackLabelFormat;return!((1==i||2==i)&&JSON.stringify(t.audioRoles)!=JSON.stringify(n.audioRoles)||3==i&&t.label!=n.label||!t.bandwidth)})),t=t.filter(function(e,n){return t.findIndex(function(t){return t.bandwidth==e.bandwidth})==n}),t.sort(function(e,t){return t.bandwidth-e.bandwidth});for(var i=e.player.getConfiguration().abr.enabled,r=l(t),a=r.next(),o={};!a.done;o={Fe:void 0},a=r.next()){o.Fe=a.value,(a=ss()).classList.add("explicit-resolution"),e.eventManager.o(a,"click",function(t){return function(){var n=t.Fe;e.player.configure({abr:{enabled:!1}}),e.player.Ae(n,e.controls.g.clearBufferOnQualityChange)}}(o));var s=os("span");s.textContent=o.Fe.bandwidth?jx(e,o.Fe,t):"Unknown",a.appendChild(s),i||o.Fe!=n||(a.ariaSelected="true",a.appendChild(XT()),s.classList.add("shaka-chosen-item"),e.currentSelection.textContent=s.textContent),e.menu.appendChild(a)}return t.length}(e):function(e){var t=e.player.getVideoTracks()||[],n=t.find(function(e){return e.active});(t=t.filter(function(n,i){return t.findIndex(function(t){var i=t.height==n.height&&t.bandwidth==n.bandwidth&&t.frameRate==n.frameRate&&t.hdr==n.hdr&&t.videoLayout==n.videoLayout;return i&&e.controls.g.showVideoCodec&&t.codecs&&n.codecs&&(i=Mi(t.codecs)==Mi(n.codecs)),i})==i})).sort(function(e,t){return t.height==e.height||null==e.height||null==t.height?t.bandwidth-e.bandwidth:t.height-e.height});for(var i=e.player.getConfiguration().abr.enabled,r=l(t),a=r.next(),o={};!a.done;o={lc:void 0},a=r.next()){o.lc=a.value,(a=ss()).classList.add("explicit-resolution"),e.eventManager.o(a,"click",function(t){return function(){var n=t.lc;e.player.configure({abr:{enabled:!1}}),e.player.Cj(n,e.controls.g.clearBufferOnQualityChange)}}(o));var s=os("span");s.textContent=o.lc.height&&o.lc.width?Fx(e,o.lc,t):o.lc.bandwidth?Math.round(o.lc.bandwidth/1e3)+" kbits/s":"Unknown",a.appendChild(s);var u=Ux(e,o.lc.width,o.lc.height);if(""!==u){var h=os("sup");h.classList.add("shaka-quality-mark"),h.textContent=u,a.appendChild(h)}i||o.lc!=n||(a.ariaSelected="true",a.appendChild(XT()),s.classList.add("shaka-chosen-item"),e.currentSelection.textContent=s.textContent),e.menu.appendChild(a)}return t.length}(e);var n=ss();n.classList.add("shaka-enable-abr-button"),e.eventManager.o(n,"click",function(){e.player.configure({abr:{enabled:!0}}),Bx(e)}),e.l=os("span"),e.l.textContent=e.localization.resolve("AUTO_QUALITY"),n.appendChild(e.l),e.player.getConfiguration().abr.enabled&&(n.ariaSelected="true",n.appendChild(XT()),e.l.classList.add("shaka-chosen-item"),e.currentSelection.textContent=e.localization.resolve("AUTO_QUALITY")),e.button.setAttribute("shaka-status",e.currentSelection.textContent),e.menu.appendChild(n),KT(e.menu),e.controls.dispatchEvent(new V("resolutionselectionupdated")),Gx(e),YT(e.button,0a&&(a=(r=l([r,a])).next().value,r=r.next().value);var o=r;a/r>16/9&&(o=Math.round(9*a/16)),a=o+"p",r=new Set;for(var s=(o=l(n)).next();!s.done;s=o.next())(s=s.value).frameRate&&r.add(Math.round(s.frameRate));if(1=r)&&(a+=Math.round(t.frameRate)),"PQ"!=t.hdr&&"HLG"!=t.hdr||(a+=" HDR"),(t.videoLayout||"").includes("CH-STEREO")&&(a+=" 3D"),n.some(function(e){return i(t,e)})&&(n.some(function(e){return i(t,e)&&e.bandwidth==t.bandwidth})||(a+=" ("+Math.round(t.bandwidth/1e3)+" kbits/s)"),e.controls.g.showVideoCodec)){var u=function(e){var t="";return e&&(t=(e=Mi(e)).startsWith("dovi-")?"Dolby Vision":e.toUpperCase()),t?" "+t:t};n.some(function(e){return i(t,e)&&u(e.codecs)!=u(t.codecs)})&&(a+=u(t.codecs))}return a}function jx(e,t,n){var i=Math.round(t.bandwidth/1e3)+" kbits/s";if(e.controls.g.showAudioCodec){var r=function(e){var t="";return e&&(t=Mi(e).toUpperCase()),t?" "+t:t};n.some(function(e){return r(e.codecs)!=r(t.codecs)})&&(i+=r(t.codecs))}return i}function Gx(e){var t=e.player.Fd()?"QUALITY":"RESOLUTION";e.button.ariaLabel=e.localization.resolve(t),e.backButton.ariaLabel=e.localization.resolve(t),e.backSpan.textContent=e.localization.resolve(t),e.nameSpan.textContent=e.localization.resolve(t),e.l.textContent=e.localization.resolve("AUTO_QUALITY"),e.player.getConfiguration().abr.enabled&&(e.currentSelection.textContent=e.localization.resolve("AUTO_QUALITY"))}function Hx(){}function Vx(e,t){VT.call(this,e,t);var n=this;this.g=ss(),this.g.classList.add("material-icons-round"),this.g.classList.add("shaka-rewind-button"),this.g.classList.add("shaka-tooltip-status"),this.g.setAttribute("shaka-status",this.localization.resolve("OFF")),this.g.textContent="fast_rewind",this.parent.appendChild(this.g),Wx(this),this.h=this.controls.g.rewindRates,this.eventManager.o(this.localization,"locale-updated",function(){Wx(n)}),this.eventManager.o(this.localization,"locale-changed",function(){Wx(n)}),this.eventManager.o(this.g,"click",function(){if(n.controls.Ba()&&n.video.duration){var e=n.h.indexOf(n.player.Xa())+1;e=e!=n.h.length?n.h[e]:n.h[0],n.video.paused&&n.video.play(),n.player.Uc(e),n.g.setAttribute("shaka-status",e+"x")}}),this.eventManager.o(this.player,"ratechange",function(){n.g.setAttribute("shaka-status",n.player.Xa()+"x")})}function Wx(e){e.g.ariaLabel=e.localization.resolve("REWIND")}function zx(){}function Kx(e,t){VT.call(this,e,t);var n=this;this.l=this.controls.D,this.g=ss(),this.g.classList.add("shaka-save.video-frame-button"),this.g.classList.add("shaka-tooltip"),this.h=os("i"),this.h.classList.add("material-icons-round"),this.h.textContent="download",this.g.appendChild(this.h),(e=os("label")).classList.add("shaka-overflow-button-label"),e.classList.add("shaka-overflow-menu-only"),this.i=os("span"),this.i.textContent=this.localization.resolve("DOWNLOAD_VIDEO_FRAME"),e.appendChild(this.i),this.j=os("span"),this.j.classList.add("shaka-current-selection-span"),e.appendChild(this.j),this.g.appendChild(e),Yx(this),this.parent.appendChild(this.g),this.eventManager.o(this.localization,"locale-updated",function(){Yx(n)}),this.eventManager.o(this.localization,"locale-changed",function(){Yx(n)}),this.eventManager.o(this.g,"click",function(){var e=document.createElement("canvas"),t=e.getContext("2d"),i=n.controls.m;e.width=i.videoWidth,e.height=i.videoHeight,t.drawImage(i,0,0,e.width,e.height),e=e.toDataURL("image/png"),(t=document.createElement("a")).href=e,t.download="videoframe_"+i.currentTime.toFixed(3)+".png",t.click()}),this.eventManager.o(this.controls.C,"vrstatuschanged",function(){Xx(n)}),this.eventManager.o(this.adManager,"ad-started",function(){Xx(n)}),this.eventManager.o(this.adManager,"ad-stopped",function(){Xx(n)}),this.eventManager.o(this.player,"unloading",function(){Xx(n)}),this.eventManager.o(this.player,"loaded",function(){Xx(n)}),this.eventManager.o(this.video,"play",function(){Xx(n)}),this.eventManager.o(this.video,"pause",function(){Xx(n)}),this.eventManager.o(this.video,"seeking",function(){Xx(n)}),this.eventManager.o(this.controls,"caststatuschanged",function(){Xx(n)}),Xx(this)}function Xx(e){var t=!0;e.controls.Ub()&&(t=!1),t&&e.l.Pa()&&(t=!1),t&&(e.player.drmInfo()||e.player.Fd())&&(t=!1),t&&e.ad&&(t=!1),t&&e.video.remote&&"disconnected"!=e.video.remote.state&&(t=!1),YT(e.g,t)}function Yx(e){e.g.ariaLabel=e.localization.resolve("DOWNLOAD_VIDEO_FRAME"),e.i.textContent=e.localization.resolve("DOWNLOAD_VIDEO_FRAME")}function qx(){}function Zx(e,t){VT.call(this,e,t);var n=this;(this.h=this.player.qh())&&(this.g=ss(),this.g.classList.add("shaka-skip-next-button"),this.g.classList.add("material-icons-round"),this.g.classList.add("shaka-tooltip"),this.g.textContent="skip_next",this.parent.appendChild(this.g),Jx(this),Qx(this),this.eventManager.o(this.localization,"locale-updated",function(){Jx(n)}),this.eventManager.o(this.localization,"locale-changed",function(){Jx(n)}),this.eventManager.o(this.g,"click",function(){n.controls.Ba()&&n.h.playItem(n.h.getCurrentItemIndex()+1)}),this.eventManager.o(this.h,"currentitemchanged",function(){Qx(n)}),this.eventManager.o(this.h,"itemsinserted",function(){Qx(n)}),this.eventManager.o(this.h,"itemsremoved",function(){Qx(n)}),this.eventManager.o(this.player,"loading",function(){Qx(n)}))}function Jx(e){e.g.ariaLabel=e.localization.resolve("SKIP_NEXT")}function Qx(e){var t=e.h.getItems().length;t=1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const i=n(8871);class r{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new r(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){const t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.m[0]*t+this.m[2]*n,r=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,o=this.m[1]*-n+this.m[3]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=a,this.m[3]=o,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){const n=this.m[0]+this.m[2]*t,i=this.m[1]+this.m[3]*t,r=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=i,this.m[2]=r,this.m[3]=a,this}multiply(e){const t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],r=this.m[1]*e.m[2]+this.m[3]*e.m[3],a=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],o=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=a,this.m[5]=o,this}invert(){const e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,i=-this.m[2]*e,r=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=a,this.m[5]=o,this}getMatrix(){return this.m}decompose(){const e=this.m[0],n=this.m[1],i=this.m[2],r=this.m[3],a=e*r-n*i,o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=n){const t=Math.sqrt(e*e+n*n);o.rotation=n>0?Math.acos(e/t):-Math.acos(e/t),o.scaleX=t,o.scaleY=a/t,o.skewX=(e*i+n*r)/a,o.skewY=0}else if(0!=i||0!=r){const t=Math.sqrt(i*i+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-i/t):-Math.acos(i/t)),o.scaleX=a/t,o.scaleY=t,o.skewX=0,o.skewY=(e*i+n*r)/a}return o.rotation=t.Util._getRotation(o.rotation),o}}t.Transform=r;const a=Math.PI/180,o=180/Math.PI,s="Konva error: ",u={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},l=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let h=[];const c="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)};t.Util={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;const t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){h.push(e),1===h.length&&c(function(){const e=h;h=[],e.forEach(function(e){e()})})},createCanvasElement(){const e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,n){const i=t.Util.createImageElement();i.onload=function(){n(i)},i.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){let e=(16777215*Math.random()|0).toString(16);for(;e.length<6;)e="0"+e;return"#"+e},getRGB(e){let t;return e in u?(t=u[e],{r:t[0],g:t[1],b:t[2]}):"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=l.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",t.Util._namedColorToRBA(e)||t.Util._hex3ColorToRGBA(e)||t.Util._hex4ColorToRGBA(e)||t.Util._hex6ColorToRGBA(e)||t.Util._hex8ColorToRGBA(e)||t.Util._rgbColorToRGBA(e)||t.Util._rgbaColorToRGBA(e)||t.Util._hslColorToRGBA(e)),_namedColorToRBA(e){const t=u[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){const t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){const t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if("#"===e[0]&&9===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if("#"===e[0]&&5===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),i=Number(n[0])/360,r=Number(n[1])/100,a=Number(n[2])/100;let o,s,u;if(0===r)return u=255*a,{r:Math.round(u),g:Math.round(u),b:Math.round(u),a:1};o=a<.5?a*(1+r):a+r-a*r;const l=2*a-o,h=[0,0,0];for(let e=0;e<3;e++)s=i+1/3*-(e-1),s<0&&s++,s>1&&s--,u=6*s<1?l+6*(o-l)*s:2*s<1?o:3*s<2?l+(o-l)*(2/3-s)*6:l,h[e]=255*u;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.heighte.slice(0),degToRad:e=>e*a,radToDeg:e=>e*o,_degToRad:e=>(t.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),t.Util.degToRad(e)),_radToDeg:e=>(t.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),t.Util.radToDeg(e)),_getRotation:e=>i.Konva.angleDeg?t.Util.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(s+e)},error(e){console.error(s+e)},warn(e){i.Konva.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e1?(o=n,s=i,u=(n-r)*(n-r)+(i-a)*(i-a)):(o=e+h*(n-e),s=t+h*(i-t),u=(o-r)*(o-r)+(s-a)*(s-a))}return[o,s,u]},_getProjectionToLine(e,n,i){const r=t.Util.cloneObject(e);let a=Number.MAX_VALUE;return n.forEach(function(o,s){if(!i&&s===n.length-1)return;const u=n[(s+1)%n.length],l=t.Util._getProjectionToSegment(o.x,o.y,u.x,u.y,e.x,e.y),h=l[0],c=l[1],d=l[2];dn.length){const t=n;n=e,e=t}for(let t=0;te.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){i.Konva.releaseCanvasOnDestroy&&e.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,n,i){let r=0,a=0,o=0,s=0;"number"==typeof i?r=a=o=s=Math.min(i,t/2,n/2):(r=Math.min(i[0]||0,t/2,n/2),a=Math.min(i[1]||0,t/2,n/2),s=Math.min(i[2]||0,t/2,n/2),o=Math.min(i[3]||0,t/2,n/2)),e.moveTo(r,0),e.lineTo(t-a,0),e.arc(t-a,a,a,3*Math.PI/2,0,!1),e.lineTo(t,n-s),e.arc(t-s,n-s,s,0,Math.PI/2,!1),e.lineTo(o,n),e.arc(o,n-o,o,Math.PI/2,Math.PI,!1),e.lineTo(0,r),e.arc(r,r,r,Math.PI,3*Math.PI/2,!1)}}},4357:(e,t,n)=>{const i=n(208);function r(e){this.mode=i.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,i;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),i=parseInt(n,10),e.put(i,10);const r=this.data.length-t;r>0&&(n=this.data.substr(t),i=parseInt(n,10),e.put(i,3*r+1))},e.exports=r},4473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Container=void 0;const i=n(4892),r=n(6536),a=n(5483);class o extends r.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){const t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(0===e.length)return this;if(e.length>1){for(let t=0;t0?t[0]:void 0}_generalFind(e,t){const n=[];return this._descendants(i=>{const r=i._isMatch(e);return r&&n.push(i),!(!r||!t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const i of n){if(t=e(i),t)return!0;if(i.hasChildren()&&(t=i._descendants(e),t))return!0}return!1}toObject(){const e=r.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){const t=r.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach(function(t){t._clearSelfAndDescendantCache(e)})}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t,n){const i=this.getLayer(),r=e||i&&i.getCanvas(),a=r&&r.getContext(),o=this._getCanvasCache(),s=o&&o.scene,u=r&&r.isCache;if(!this.isVisible()&&!u)return this;if(s){a.save();const e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",r,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),i=e||n&&n.hitCanvas,r=i&&i.getContext(),a=this._getCanvasCache();if(a&&a.hit){r.save();const e=this.getAbsoluteTransform(t).getMatrix();r.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(r),r.restore()}else this._drawChildren("drawHit",i,t);return this}_drawChildren(e,t,n,i){var r;const a=t&&t.getContext(),o=this.clipWidth(),s=this.clipHeight(),u=this.clipFunc(),l="number"==typeof o&&"number"==typeof s||u,h=n===this;if(l){a.save();const e=this.getAbsoluteTransform(n);let t,i=e.getMatrix();if(a.transform(i[0],i[1],i[2],i[3],i[4],i[5]),a.beginPath(),u)t=u.call(this,a,this);else{const e=this.clipX(),t=this.clipY();a.rect(e||0,t||0,o,s)}a.clip.apply(a,t),i=e.copy().invert().getMatrix(),a.transform(i[0],i[1],i[2],i[3],i[4],i[5])}const c=!h&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;c&&(a.save(),a._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach(function(r){r[e](t,n,i)}),c&&a.restore(),l&&a.restore()}getClientRect(e={}){var t;const n=e.skipTransform,i=e.relativeTo;let r,a,o,s,u={x:1/0,y:1/0,width:0,height:0};const l=this;null===(t=this.children)||void 0===t||t.forEach(function(t){if(!t.visible())return;const n=t.getClientRect({relativeTo:l,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===n.width&&0===n.height||(void 0===r?(r=n.x,a=n.y,o=n.x+n.width,s=n.y+n.height):(r=Math.min(r,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)))});const h=this.find("Shape");let c=!1;for(let e=0;e{const i=n(6886),r=i.getBCHDigit(1335);t.getEncodedBits=function(e,t){const n=e.bit<<3|t;let a=n<<10;for(;i.getBCHDigit(a)-r>=0;)a^=1335<{const i=n(2731);t.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let r=0;r=0;){const e=n[0];for(let r=0;r{var i,r;void 0===(r="function"==typeof(i=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){i=i.call(t)},n:function(){var e=i.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==i.return||i.return()}finally{if(u)throw o}}}}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},s.apply(null,arguments)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}!function(e){e.AbortSignal,e.AbortController}("undefined"!=typeof self?self:n.g);var d=function(){return a(function e(){i(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})},[{key:"addEventListener",value:function(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}},{key:"removeEventListener",value:function(e,t){if(e in this.listeners)for(var n=this.listeners[e],i=0,r=n.length;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const i=n(8871),r=n(4060),a=n(4892),o=n(6536),s=n(5483),u=n(8871),l=n(8722),h="hasShadow",c="shadowRGBA",d="patternImage",p="linearGradient",f="radialGradient";let g;function m(){return g||(g=r.Util.createCanvasElement().getContext("2d"),g)}t.shapes={};class v extends o.Node{constructor(e){let n;for(super(e);n=r.Util.getRandomColor(),!n||n in t.shapes;);this.colorKey=n,t.shapes[n]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=m().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new r.Transform;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(i.Konva.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),a="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(a)}return e}}_getLinearGradient(){return this._getCache(p,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=m(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=t.createLinearGradient(n.x,n.y,i.x,i.y);for(let t=0;tthis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return o.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(null!==(t=this.attrs.perfectDrawEnabled)&&void 0!==t&&!t)return!1;const n=e||this.hasFill(),i=this.hasStroke(),r=1!==this.getAbsoluteOpacity();if(n&&i&&r)return!0;const a=this.hasShadow(),o=this.shadowForStrokeEnabled();return!!(n&&i&&a&&o)}setStrokeHitEnabled(e){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const i=e.skipTransform,r=e.relativeTo||t&&this.getStage()||void 0,a=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=a.width+o,u=a.height+o,l=!e.skipShadow&&this.hasShadow(),h=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,d=s+Math.abs(h),p=u+Math.abs(c),f=l&&this.shadowBlur()||0,g={width:d+2*f,height:p+2*f,x:-(o/2+f)+Math.min(h,0)+a.x,y:-(o/2+f)+Math.min(c,0)+a.y};return i?g:this._transformedRect(g,r)}drawScene(e,t,n){const i=this.getLayer(),r=(e||i.getCanvas()).getContext(),a=this._getCanvasCache(),o=this.getSceneFunc(),s=this.hasShadow();let u;const l=t===this;if(!this.isVisible()&&!l)return this;if(a){r.save();const e=this.getAbsoluteTransform(t).getMatrix();return r.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(r),r.restore(),this}if(!o)return this;if(r.save(),this._useBufferCanvas()){u=this.getStage();const e=n||u.bufferCanvas,i=e.getContext();i.clear(),i.save(),i._applyLineJoin(this);const a=this.getAbsoluteTransform(t).getMatrix();i.transform(a[0],a[1],a[2],a[3],a[4],a[5]),o.call(this,i,this),i.restore();const l=e.pixelRatio;s&&r._applyShadow(this),r._applyOpacity(this),r._applyGlobalCompositeOperation(this),r.drawImage(e._canvas,e.x||0,e.y||0,e.width/l,e.height/l)}else{if(r._applyLineJoin(this),!l){const e=this.getAbsoluteTransform(t).getMatrix();r.transform(e[0],e[1],e[2],e[3],e[4],e[5]),r._applyOpacity(this),r._applyGlobalCompositeOperation(this)}s&&r._applyShadow(this),o.call(this,r,this)}return r.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const i=this.getLayer(),a=e||i.hitCanvas,o=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),u=this._getCanvasCache(),l=u&&u.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){o.save();const e=this.getAbsoluteTransform(t).getMatrix();return o.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),o._applyLineJoin(this),this!==t){const e=this.getAbsoluteTransform(t).getMatrix();o.transform(e[0],e[1],e[2],e[3],e[4],e[5])}return s.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),i=t.hit,a=i.getContext(),o=i.getWidth(),s=i.getHeight();a.clear(),a.drawImage(n._canvas,0,0,o,s);try{const t=a.getImageData(0,0,o,s),n=t.data,i=n.length,u=r.Util._hexToRgb(this.colorKey);for(let t=0;te?(n[t]=u.r,n[t+1]=u.g,n[t+2]=u.b,n[t+3]=255):n[t+3]=0;a.putImageData(t,0,0)}catch(e){r.Util.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return l.hasPointerCapture(e,this)}setPointerCapture(e){l.setPointerCapture(e,this)}releaseCapture(e){l.releaseCapture(e,this)}}t.Shape=v,v.prototype._fillFunc=function(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()},v.prototype._strokeFunc=function(e){e.stroke()},v.prototype._fillFuncHit=function(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()},v.prototype._strokeFuncHit=function(e){e.stroke()},v.prototype._centroid=!1,v.prototype.nodeType="Shape",(0,u._registerNode)(v),v.prototype.eventListeners={},v.prototype.on.call(v.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(h)}),v.prototype.on.call(v.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(c)}),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",function(){this._clearCache(d)}),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",function(){this._clearCache(p)}),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",function(){this._clearCache(f)}),a.Factory.addGetterSetter(v,"stroke",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(v,"strokeWidth",2,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(v,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(v,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(v,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(v,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(v,"lineJoin"),a.Factory.addGetterSetter(v,"lineCap"),a.Factory.addGetterSetter(v,"sceneFunc"),a.Factory.addGetterSetter(v,"hitFunc"),a.Factory.addGetterSetter(v,"dash"),a.Factory.addGetterSetter(v,"dashOffset",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"shadowColor",void 0,(0,s.getStringValidator)()),a.Factory.addGetterSetter(v,"shadowBlur",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"shadowOpacity",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(v,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(v,"shadowOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"shadowOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternImage"),a.Factory.addGetterSetter(v,"fill",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(v,"fillPatternX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(v,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(v,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(v,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(v,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(v,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(v,"fillEnabled",!0),a.Factory.addGetterSetter(v,"strokeEnabled",!0),a.Factory.addGetterSetter(v,"shadowEnabled",!0),a.Factory.addGetterSetter(v,"dashEnabled",!0),a.Factory.addGetterSetter(v,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(v,"fillPriority","color"),a.Factory.addComponentsGetterSetter(v,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(v,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(v,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(v,"fillPatternScaleX",1,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(v,"fillPatternScaleY",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(v,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(v,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(v,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(v,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(v,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(v,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(v,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(v,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(v,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(v,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(v,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(v,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(v,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(v,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(v,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(v,"fillPatternRotation",0),a.Factory.addGetterSetter(v,"fillRule",void 0,(0,s.getStringValidator)()),a.Factory.backCompat(v,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})},4764:(e,t,n)=>{const i=n(4713);function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=i.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=i.mod(t,this.genPoly),r=this.degree-n.length;if(r>0){const e=new Uint8Array(this.degree);return e.set(n,r),e}return n},e.exports=r},4861:(e,t,n)=>{const i=n(208),r=n(6886);function a(e){this.mode=i.KANJI,this.data=e}a.getBitsLength=function(e){return 13*e},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},e.exports=a},4892:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const i=n(4060),r=n(5483),a="get",o="set";t.Factory={addGetterSetter(e,n,i,r,a){t.Factory.addGetter(e,n,i),t.Factory.addSetter(e,n,r,a),t.Factory.addOverloadedGetterSetter(e,n)},addGetter(e,t,n){const r=a+i.Util._capitalize(t);e.prototype[r]=e.prototype[r]||function(){const e=this.attrs[t];return void 0===e?n:e}},addSetter(e,n,r,a){const s=o+i.Util._capitalize(n);e.prototype[s]||t.Factory.overWriteSetter(e,n,r,a)},overWriteSetter(e,t,n,r){const a=o+i.Util._capitalize(t);e.prototype[a]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,n,s,u,l){const h=s.length,c=i.Util._capitalize,d=a+c(n),p=o+c(n);e.prototype[d]=function(){const e={};for(let t=0;t{this._setAttr(n+c(e),void 0)}),this._fireChangeEvent(n,t,e),l&&l.call(this),this},t.Factory.addOverloadedGetterSetter(e,n)},addOverloadedGetterSetter(e,t){const n=i.Util._capitalize(t),r=o+n,s=a+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[s]()}},addDeprecatedGetterSetter(e,n,r,o){i.Util.error("Adding deprecated "+n);const s=a+i.Util._capitalize(n),u=n+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[s]=function(){i.Util.error(u);const e=this.attrs[n];return void 0===e?r:e},t.Factory.addSetter(e,n,o,function(){i.Util.error(u)}),t.Factory.addOverloadedGetterSetter(e,n)},backCompat(e,t){i.Util.each(t,function(t,n){const r=e.prototype[n],s=a+i.Util._capitalize(t),u=o+i.Util._capitalize(t);function l(){r.apply(this,arguments),i.Util.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=l,e.prototype[s]=l,e.prototype[u]=l})},afterSetFilter(){this._filterUpToDate=!1}}},5155:(e,t,n)=>{"use strict";t.r=void 0;const i=n(4892),r=n(4723),a=n(8871),o=n(4060),s=n(5483);class u extends r.Shape{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),i=this.height();e.beginPath(),t?o.Util.drawRoundedRectPath(e,n,i,t):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}}t.r=u,u.prototype.className="Rect",(0,a._registerNode)(u),i.Factory.addGetterSetter(u,"cornerRadius",0,(0,s.getNumberOrArrayOfNumbersValidator)(4))},5483:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RGBComponent=function(e){return e>255?255:e<0?0:Math.round(e)},t.alphaComponent=function(e){return e>1?1:e<1e-4?1e-4:e},t.getNumberValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isNumber(e)||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}},t.getNumberOrArrayOfNumbersValidator=function(e){if(i.Konva.isUnminified)return function(t,n){let i=r.Util._isNumber(t),o=r.Util._isArray(t)&&t.length==e;return i||o||r.Util.warn(a(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}},t.getNumberOrAutoValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isNumber(e)||"auto"===e||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}},t.getStringValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isString(e)||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}},t.getStringOrGradientValidator=function(){if(i.Konva.isUnminified)return function(e,t){const n=r.Util._isString(e),i="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||i||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}},t.getFunctionValidator=function(){if(i.Konva.isUnminified)return function(e,t){return r.Util._isFunction(e)||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}},t.getNumberArrayValidator=function(){if(i.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(r.Util._isArray(e)?e.forEach(function(e){r.Util._isNumber(e)||r.Util.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")}):r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}},t.getBooleanValidator=function(){if(i.Konva.isUnminified)return function(e,t){return!0===e||!1===e||r.Util.warn(a(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}},t.getComponentValidator=function(e){if(i.Konva.isUnminified)return function(t,n){return null==t||r.Util.isObject(t)||r.Util.warn(a(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}};const i=n(8871),r=n(4060);function a(e){return r.Util._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||r.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}},5822:(e,t,n)=>{const i=n(208);function r(e){this.mode=i.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return 8*e},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Layer=void 0;const i=n(4060),r=n(4473),a=n(6536),o=n(4892),s=n(8604),u=n(5483),l=n(4723),h=n(8871),c=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d=c.length;class p extends r.Container{constructor(e){super(e),this.canvas=new s.SceneCanvas,this.hitCanvas=new s.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let i=0;i0?{antialiased:!0}:{}}drawScene(e,t,n){const i=this.getLayer(),a=e||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),r.Container.prototype.drawScene.call(this,a,t,n),this._fire("draw",{node:this}),this}drawHit(e,t){const n=this.getLayer(),i=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),r.Container.prototype.drawHit.call(this,i,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){i.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return i.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return i.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}t.Layer=p,p.prototype.nodeType="Layer",(0,h._registerNode)(p),o.Factory.addGetterSetter(p,"imageSmoothingEnabled",!0),o.Factory.addGetterSetter(p,"clearBeforeDraw",!0),o.Factory.addGetterSetter(p,"hitGraphEnabled",!0,(0,u.getBooleanValidator)())},6320:e=>{"use strict";var t={single_source_shortest_paths:function(e,n,i){var r={},a={};a[n]=0;var o,s,u,l,h,c,d,p=t.PriorityQueue.make();for(p.push(n,0);!p.empty();)for(u in s=(o=p.pop()).value,l=o.cost,h=e[s]||{})h.hasOwnProperty(u)&&(c=l+h[u],d=a[u],(void 0===a[u]||d>c)&&(a[u]=c,p.push(u,c),r[u]=s));if(void 0!==i&&void 0===a[i]){var f=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(f)}return r},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],i=t;i;)n.push(i),e[i],i=e[i];return n.reverse(),n},find_path:function(e,n,i){var r=t.single_source_shortest_paths(e,n,i);return t.extract_shortest_path_from_predecessor_list(r,i)},PriorityQueue:{make:function(e){var n,i=t.PriorityQueue,r={};for(n in e=e||{},i)i.hasOwnProperty(n)&&(r[n]=i[n]);return r.queue=[],r.sorter=e.sorter||i.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},6421:(e,t,n)=>{const i=n(6886).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,n=i(e),r=145===n?26:2*Math.ceil((n-13)/(2*t-2)),a=[n-7];for(let e=1;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Node=void 0;const i=n(8604),r=n(1268),a=n(4892),o=n(8871),s=n(4060),u=n(5483),l="absoluteOpacity",h="allEventListeners",c="absoluteTransform",d="absoluteScale",p="canvas",f="listening",g="Shape",m=" ",v="stage",y="transform",b="visible",_=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(m);let w=1;class S{constructor(e){this._id=w++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==y&&e!==c||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){let n=this._cache.get(e);return(void 0===n||(e===y||e===c)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map(e=>e+"Change.konva").join(m);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(p)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===c&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(p)){const{scene:e,filter:t,hit:n,buffer:i}=this._cache.get(p);s.Util.releaseCanvas(e,t,n,i),this._cache.delete(p)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const t=e||{};let n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(t.width||n.width),a=Math.ceil(t.height||n.height),o=t.pixelRatio,u=void 0===t.x?Math.floor(n.x):t.x,h=void 0===t.y?Math.floor(n.y):t.y,c=t.offset||0,f=t.drawBorder||!1,g=t.hitCanvasPixelRatio||1;if(!r||!a)return void s.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");r+=2*c+(Math.abs(Math.round(n.x)-u)>.5?1:0),a+=2*c+(Math.abs(Math.round(n.y)-h)>.5?1:0),u-=c,h-=c;const m=new i.SceneCanvas({pixelRatio:o,width:r,height:a}),v=new i.SceneCanvas({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),y=new i.HitCanvas({pixelRatio:g,width:r,height:a}),b=m.getContext(),_=y.getContext(),w=new i.SceneCanvas({width:m.width/m.pixelRatio+Math.abs(u),height:m.height/m.pixelRatio+Math.abs(h),pixelRatio:m.pixelRatio}),S=w.getContext();return y.isCache=!0,m.isCache=!0,this._cache.delete(p),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),b.save(),_.save(),S.save(),b.translate(-u,-h),_.translate(-u,-h),S.translate(-u,-h),w.x=u,w.y=h,this._isUnderCache=!0,this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(d),this.drawScene(m,this,w),this.drawHit(y,this),this._isUnderCache=!1,b.restore(),_.restore(),f&&(b.save(),b.beginPath(),b.rect(0,0,r,a),b.closePath(),b.setAttr("strokeStyle","red"),b.setAttr("lineWidth",5),b.stroke(),b.restore()),this._cache.set(p,{scene:m,filter:v,hit:y,buffer:w,x:u,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(p)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){const n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,r=1/0,a=-1/0,o=-1/0;const s=this.getAbsoluteTransform(t);return n.forEach(function(e){const t=s.point(e);void 0===i&&(i=a=t.x,r=o=t.y),i=Math.min(i,t.x),r=Math.min(r,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)}),{x:i,y:r,width:a-i,height:o-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);const n=this._getCachedSceneCanvas(),i=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/i,n.height/i),e.restore()}_drawCachedHitCanvas(e){const t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e,t,n,i,r=this.filters(),a=this._getCanvasCache(),o=a.scene,u=a.filter,l=u.getContext();if(r){if(!this._filterUpToDate){const a=o.pixelRatio;u.setSize(o.width/o.pixelRatio,o.height/o.pixelRatio);try{for(e=r.length,l.clear(),l.drawImage(o._canvas,0,0,o.getWidth()/a,o.getHeight()/a),t=l.getImageData(0,0,u.getWidth(),u.getHeight()),n=0;n{let t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+s.Util._capitalize(t),s.Util._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(f,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(b,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);const n=this.getLayer();let i=!1;r.DD._dragElements.forEach(e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(i=!0)});const a=!t&&!o.Konva.hitOnDragEnabled&&(i||o.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e,t,n,i,r=this.getDepth(),a=this,o=0;const s=this.getStage();return"Stage"!==a.nodeType&&s&&function s(u){for(e=[],t=u.length,n=0;n0&&e[0].getDepth()<=r&&s(e)}(s.getChildren()),o}getDepth(){let e=0,t=this.parent;for(;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(y),this._clearSelfAndDescendantCache(c)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const t=e.getPointerPosition();if(!t)return null;const n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),r=new s.Transform,a=this.offset();return r.m=i.slice(),r.translate(a.x,a.y),r.getTranslation()}setAbsolutePosition(e){const{x:t,y:n,...i}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache(y);const r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(y),this._clearSelfAndDescendantCache(c),this}_setTransform(e){let t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let t=e.x,n=e.y,i=this.x(),r=this.y();return void 0!==t&&(i+=t),void 0!==n&&(r+=n),this.setPosition({x:i,y:r}),this}_eachAncestorReverse(e,t){let n,i,r=[],a=this.getParent();if(!t||t._id!==this._id){for(r.unshift(this);a&&(!t||a._id!==t._id);)r.unshift(a),a=a.parent;for(n=r.length,i=0;i0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return s.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return s.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&s.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(l,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e,t,n,i,r,a=this.getAttrs();const o={attrs:{},className:this.getClassName()};for(e in a)t=a[e],r=s.Util.isObject(t)&&!s.Util._isPlainObject(t)&&!s.Util._isArray(t),r||(n="function"==typeof this[e]&&this[e],delete a[e],i=n?n.call(this):null,a[e]=t,i!==t&&(o.attrs[e]=t));return s.Util._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){const i=[];t&&this._isMatch(e)&&i.push(this);let r=this.parent;for(;r;){if(r===n)return i;r._isMatch(e)&&i.push(r),r=r.parent}return i}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);let t,n,i=e.replace(/ /g,"").split(","),r=i.length;for(t=0;t{try{const n=null==e?void 0:e.callback;n&&delete e.callback,s.Util._urlToImage(this.toDataURL(e),function(e){t(e),null==n||n(e)})}catch(e){n(e)}})}toBlob(e){return new Promise((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob(e=>{t(e),null==n||n(e)},null==e?void 0:e.mimeType,null==e?void 0:e.quality)}catch(e){n(e)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():o.Konva.dragDistance}_off(e,t,n){let i,r,a,o=this.eventListeners[e];for(i=0;i=0))return;if(this.isDragging())return;let t=!1;r.DD._dragElements.forEach(e=>{this.isAncestorOf(e.node)&&(t=!0)}),t||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=r.DD._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&r.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return s.Util.haveIntersection(n,this.getClientRect())}static create(e,t){return s.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){let n,i,r,a=S.prototype.getClassName.call(e),u=e.children;if(t&&(e.attrs.container=t),o.Konva[a]||(s.Util.warn('Can not find a node with class name "'+a+'". Fallback to "Shape".'),a="Shape"),n=new(0,o.Konva[a])(e.attrs),u)for(i=u.length,r=0;r{const i=n(2726);function r(e,t){const n=e.a/255,i=t+'="'+e.hex+'"';return n<1?i+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':i}function a(e,t,n){let i=e+t;return void 0!==n&&(i+=" "+n),i}t.render=function(e,t,n){const o=i.getOptions(t),s=e.modules.size,u=e.modules.data,l=s+2*o.margin,h=o.color.light.a?"':"",c="0&&l>0&&e[u-1]||(i+=o?a("M",l+n,.5+h+n):a("m",r,0),r=0,o=!1),l+1',d='viewBox="0 0 '+l+" "+l+'"',p=''+h+c+"\n";return"function"==typeof n&&n(null,p),p}},6886:(e,t)=>{let n;const i=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return i[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},7007:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise(function(n,i){function r(n){e.removeListener(t,a),i(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)})},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,n,i){var r,a,o,l;if(s(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]),void 0===o)o=a[t]=n,++e._eventsCount;else if("function"==typeof o?o=a[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=u(e))>0&&o.length>r&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,l=h,console&&console.warn&&console.warn(l)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)i(u,this,t);else{var l=u.length,h=f(u,l);for(n=0;n=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,r=a;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},7044:(e,t)=>{const n="[0-9]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+")(?:.|[\r\n]))+";t.KANJI=new RegExp(i,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(r,"g"),t.NUMERIC=new RegExp(n,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const a=new RegExp("^"+i+"$"),o=new RegExp("^"+n+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return a.test(e)},t.testNumeric=function(e){return o.test(e)},t.testAlphanumeric=function(e){return s.test(e)}},7324:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const i=n(4060),r=n(4892),a=n(4473),o=n(8871),s=n(8604),u=n(1268),l=n(8871),h=n(8722),c="mouseleave",d="mouseover",p="mouseenter",f="mousemove",g="mousedown",m="mouseup",v="pointermove",y="pointerdown",b="pointerup",_="pointercancel",w="pointerout",S="pointerleave",T="pointerover",A="pointerenter",E="contextmenu",x="touchstart",C="touchend",k="touchmove",I="touchcancel",M="wheel",P=[[p,"_pointerenter"],[g,"_pointerdown"],[f,"_pointermove"],[m,"_pointerup"],[c,"_pointerleave"],[x,"_pointerdown"],[k,"_pointermove"],[C,"_pointerup"],[I,"_pointercancel"],[d,"_pointerover"],[M,"_wheel"],[E,"_contextmenu"],[y,"_pointerdown"],[v,"_pointermove"],[b,"_pointerup"],[_,"_pointercancel"],[S,"_pointerleave"],["lostpointercapture","_lostpointercapture"]],L={mouse:{[w]:"mouseout",[S]:c,[T]:d,[A]:p,[v]:f,[y]:g,[b]:m,[_]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[w]:"touchout",[S]:"touchleave",[T]:"touchover",[A]:"touchenter",[v]:k,[y]:x,[b]:C,[_]:I,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[w]:w,[S]:S,[T]:T,[A]:A,[v]:v,[y]:y,[b]:b,[_]:_,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},D=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",R=e=>{const t=D(e);return"pointer"===t?o.Konva.pointerEventsEnabled&&L.pointer:"touch"===t?L.touch:"mouse"===t?L.mouse:void 0};function N(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&i.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}t.stages=[];class O extends a.Container{constructor(e){super(N(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{N(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||i.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){let t;if("."===e.charAt(0)){const t=e.slice(1);e=document.getElementsByClassName(t)[0]}else t="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(t);if(!e)throw"Can not find container in document with id "+t}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,t=e.length;for(let n=0;n-1&&t.stages.splice(n,1),i.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(i.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const t=new s.SceneCanvas({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,i=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),i.forEach(function(t){if(!t.isVisible())return;const i=t._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}),t}getIntersection(e){if(!e)return null;const t=this.children;for(let n=t.length-1;n>=0;n--){const i=t[n].getIntersection(e);if(i)return i}return null}_resizeDOM(){const e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let e=0;e5&&i.Util.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),o.Konva.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return h.hasPointerCapture(e,this)}setPointerCapture(e){h.setPointerCapture(e,this)}releaseCapture(e){h.releaseCapture(e,this)}getLayers(){return this.children}_bindContentEvents(){o.Konva.isBrowser&&P.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=R(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=R(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=R(e.type),n=D(e.type);if(!t)return;this.setPointersPositions(e);const i=this._getTargetShape(n),r=!(o.Konva.isDragging()||o.Konva.isTransforming())||o.Konva.hitOnDragEnabled;i&&r?(i._fireAndBubble(t.pointerout,{evt:e}),i._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):r&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const t=R(e.type),n=D(e.type);if(!t)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(r=>{const a=this.getIntersection(r);if(u.DD.justDragged=!1,o.Konva["_"+n+"ListenClick"]=!0,!a||!a.isListening())return void(this[n+"ClickStartShape"]=void 0);o.Konva.capturePointerEventsEnabled&&a.setPointerCapture(r.id),this[n+"ClickStartShape"]=a,a._fireAndBubble(t.pointerdown,{evt:e,pointerId:r.id}),i=!0;const s=e.type.indexOf("touch")>=0;a.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),i||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const t=R(e.type),n=D(e.type);if(!t)return;if(o.Konva.isDragging()&&u.DD.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),(o.Konva.isDragging()||o.Konva.isTransforming())&&!o.Konva.hitOnDragEnabled)return;const i={};let r=!1;const a=this._getTargetShape(n);this._changedPointerPositions.forEach(o=>{const s=h.getCapturedShape(o.id)||this.getIntersection(o),u=o.id,l={evt:e,pointerId:u},c=a!==s;if(c&&a&&(a._fireAndBubble(t.pointerout,{...l},s),a._fireAndBubble(t.pointerleave,{...l},s)),s){if(i[s._id])return;i[s._id]=!0}s&&s.isListening()?(r=!0,c&&(s._fireAndBubble(t.pointerover,{...l},a),s._fireAndBubble(t.pointerenter,{...l},a),this[n+"targetShape"]=s),s._fireAndBubble(t.pointermove,{...l})):a&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),r||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=R(e.type),n=D(e.type);if(!t)return;this.setPointersPositions(e);const i=this[n+"ClickStartShape"],r=this[n+"ClickEndShape"],a={};let s=!1;this._changedPointerPositions.forEach(l=>{const c=h.getCapturedShape(l.id)||this.getIntersection(l);if(c){if(c.releaseCapture(l.id),a[c._id])return;a[c._id]=!0}const d=l.id,p={evt:e,pointerId:d};let f=!1;o.Konva["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):u.DD.justDragged||(o.Konva["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){o.Konva["_"+n+"InDblClickWindow"]=!1},o.Konva.dblClickWindow),c&&c.isListening()?(s=!0,this[n+"ClickEndShape"]=c,c._fireAndBubble(t.pointerup,{...p}),o.Konva["_"+n+"ListenClick"]&&i&&i===c&&(c._fireAndBubble(t.pointerclick,{...p}),f&&r&&r===c&&c._fireAndBubble(t.pointerdblclick,{...p}))):(this[n+"ClickEndShape"]=null,o.Konva["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:d}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:d}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),o.Konva["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&"pointer"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(E,{evt:e}):this._fire(E,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(M,{evt:e}):this._fire(M,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=h.getCapturedShape(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(b,h.createEvent(e)),h.releaseCapture(e.pointerId)}_lostpointercapture(e){h.releaseCapture(e.pointerId)}setPointersPositions(e){const t=this._getContentPosition();let n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:i.Util._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:i.Util._getFirstPointerId(e)}])}_setPointerPosition(e){i.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!o.Konva.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return i.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}}t.Stage=O,O.prototype.nodeType="Stage",(0,l._registerNode)(O),r.Factory.addGetterSetter(O,"container"),o.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(e=>{e.batchDraw()})})},7457:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FastLayer=void 0;const i=n(4060),r=n(6267),a=n(8871);class o extends r.Layer{constructor(e){super(e),this.listening(!1),i.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}t.FastLayer=o,o.prototype.nodeType="FastLayer",(0,a._registerNode)(o)},7518:(e,t,n)=>{const i=n(9953),r=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case i.L:return r[4*(e-1)+0];case i.M:return r[4*(e-1)+1];case i.Q:return r[4*(e-1)+2];case i.H:return r[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case i.L:return a[4*(e-1)+0];case i.M:return a[4*(e-1)+1];case i.Q:return a[4*(e-1)+2];case i.H:return a[4*(e-1)+3];default:return}}},7583:(e,t,n)=>{const i=n(1333),r=n(157),a=n(7899),o=n(6756);function s(e,t,n,a,o){const s=[].slice.call(arguments,1),u=s.length,l="function"==typeof s[u-1];if(!l&&!i())throw new Error("Callback required as last argument");if(!l){if(u<1)throw new Error("Too few arguments provided");return 1===u?(n=t,t=a=void 0):2!==u||t.getContext||(a=n,n=t,t=void 0),new Promise(function(i,o){try{const o=r.create(n,a);i(e(o,t,a))}catch(e){o(e)}})}if(u<2)throw new Error("Too few arguments provided");2===u?(o=n,n=t,t=a=void 0):3===u&&(t.getContext&&void 0===o?(o=a,a=void 0):(o=a,a=n,n=t,t=void 0));try{const i=r.create(n,a);o(null,e(i,t,a))}catch(e){o(e)}}t.create=r.create,t.toCanvas=s.bind(null,a.render),t.toDataURL=s.bind(null,a.renderToDataURL),t.toString=s.bind(null,function(e,t,n){return o.render(e,n)})},7756:(e,t,n)=>{const i=n(6886).getSymbolSize;t.getPositions=function(e){const t=i(e);return[[0,0],[t-7,0],[0,t-7]]}},7899:(e,t,n)=>{const i=n(2726);t.render=function(e,t,n){let r=n,a=t;void 0!==r||t&&t.getContext||(r=t,t=void 0),t||(a=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),r=i.getOptions(r);const o=i.getImageWidth(e.modules.size,r),s=a.getContext("2d"),u=s.createImageData(o,o);return i.qrToImageData(u.data,e,r),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(s,a,o),s.putImageData(u,0,0),a},t.renderToDataURL=function(e,n,i){let r=i;void 0!==r||n&&n.getContext||(r=n,n=void 0),r||(r={});const a=t.render(e,n,r),o=r.type||"image/png",s=r.rendererOpts||{};return a.toDataURL(o,s.quality)}},7949:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Group=void 0;const i=n(4060),r=n(4473),a=n(8871);class o extends r.Container{_validateAdd(e){const t=e.getType();"Group"!==t&&"Shape"!==t&&i.Util.throw("You may only add groups and shapes to groups.")}}t.Group=o,o.prototype.nodeType="Group",(0,a._registerNode)(o)},8228:(e,t,n)=>{"use strict";n.d(t,{A:()=>De});var i=n(663),r=n.n(i),a=n(3443),o=n(5155),s=n(1958),u=n(9696),l=n(317);function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,i,a,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,a||e,o),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,a=i.length,o=new Array(a);r0&&n.push(o),n.push(a%60),n.push(r%60);for(var s=0;s0&&(n+="."+g(i,t)),n}function v(e,t,n){return en?n:e}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function b(e,t){for(var n in t)y(t,n)&&(e[n]=t[n]);return e}function _(e){return"number"==typeof e}function w(e){return"number"==typeof e&&Number.isFinite(e)}function S(e){return null!==e&&"object"===p(e)&&!Array.isArray(e)}function T(e){return"string"==typeof e}function A(e){return null==e}function E(e){return!0===e||!1===e}function x(e){return e instanceof HTMLElement}function C(e){return S(e)&&y(e,"linearGradientStart")&&y(e,"linearGradientEnd")&&y(e,"linearGradientColorStops")&&_(e.linearGradientStart)&&_(e.linearGradientEnd)&&function(e){return Array.isArray(e)}(e.linearGradientColorStops)&&2===e.linearGradientColorStops.length}function k(e){for(;null!==e.parent;){if(e.parent instanceof r().Layer)return e;e=e.parent}return null}f.POINT=0,f.SEGMENT_START=1,f.SEGMENT_END=2,f.sorter=function(e,t){return e.time-t.time};var I=/HeadlessChrome/.test(navigator.userAgent),M=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,P=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame,L={forward:{},reverse:{}};L.forward[f.POINT]=0,L.forward[f.SEGMENT_START]=1,L.forward[f.SEGMENT_END]=2,L.reverse[f.POINT]=0,L.reverse[f.SEGMENT_START]=2,L.reverse[f.SEGMENT_END]=1;var D={0:"points.enter",1:"segments.enter",2:"segments.exit"},R={};function N(e,t){switch(t.type){case f.POINT:return e.points.getPoint(t.id);case f.SEGMENT_START:case f.SEGMENT_END:return e.segments.getSegment(t.id);default:throw new Error("getPointOrSegment: id not found?")}}function O(e){this._cues=[],this._peaks=e,this._previousTime=-1,this._updateCues=this._updateCues.bind(this),this._onPlaying=this._onPlaying.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onTimeUpdate=this._onTimeUpdate.bind(this),this._onAnimationFrame=this._onAnimationFrame.bind(this),this._rAFHandle=null,this._activeSegments={},this._attachEventHandlers()}function U(e){return function(t){return t.id===e}}R[0]="point",R[1]="segment",R[2]="segment",O.prototype._updateCues=function(){var e=this,t=e._peaks.points.getPoints(),n=e._peaks.segments.getSegments();e._cues.length=0,t.forEach(function(t){e._cues.push(new f(t.time,f.POINT,t.id))}),n.forEach(function(t){e._cues.push(new f(t.startTime,f.SEGMENT_START,t.id)),e._cues.push(new f(t.endTime,f.SEGMENT_END,t.id))}),e._cues.sort(f.sorter);var i=e._peaks.player.getCurrentTime();e._updateActiveSegments(i)},O.prototype._onUpdate=function(e,t){var n,i,r,a=e>t;a?(n=0,i=this._cues.length,r=1):(n=this._cues.length-1,i=-1,r=-1);for(var o=n;a?oi;o+=r){var s=this._cues[o];if(a?s.time>t:s.timee:s.time=e&&this.time=t.startTime&&e0?function(n){return n.startTime===e&&n.endTime===t}:function(t){return t.startTime===e},this._removeSegments(n)},Y.prototype.removeAll=function(){this._segments=[],this._segmentsById={},this._segmentsByPid={},this._peaks.emit("segments.remove_all")},Y.prototype.setInserting=function(e){this._isInserting=e},Y.prototype.isInserting=function(){return this._isInserting};var q=["OBJECT","TEXTAREA","INPUT","SELECT","OPTION"],Z=[32,9,37,39];function J(e){this.eventEmitter=e,this._handleKeyEvent=this._handleKeyEvent.bind(this),document.addEventListener("keydown",this._handleKeyEvent),document.addEventListener("keypress",this._handleKeyEvent),document.addEventListener("keyup",this._handleKeyEvent)}function Q(e){this._mediaElement=e}function $(e,t){this._eventEmitter=e,this._mediaElement=t,this._playerCanPlayHandler=this._playerCanPlayHandler.bind(this),this._playerErrorHandler=this._playerErrorHandler.bind(this)}function ee(e,t){this._peaks=e,this._playingSegment=!1,this._segment=null,this._loop=!1,this._playSegmentTimerCallback=this._playSegmentTimerCallback.bind(this),function(e){var t=function(e){for(var t=[],n=e;n;)Object.getOwnPropertyNames(n).forEach(function(e){t.push(e)}),n=Object.getPrototypeOf(n);return t}(e);["init","destroy","play","pause","isPlaying","isSeeking","getCurrentTime","getDuration","seek"].forEach(function(n){if(!t.includes(n))throw new TypeError("Peaks.init(): Player method "+n+" is undefined");if("function"!=typeof e[n])throw new TypeError("Peaks.init(): Player method "+n+" is not a function")})}(t),this._adapter=t}function te(e){this._options=e,this._draggable=e.editable}function ne(e){this._options=e,this._editable=e.editable}function ie(e){return"zoomview"===e.view?new ne(e):null}function re(e){return new s.EY({x:12,y:12,text:e.segment.labelText,textAlign:"center",fontFamily:e.fontFamily||"sans-serif",fontSize:e.fontSize||12,fontStyle:e.fontStyle||"normal",fill:"#000"})}function ae(e){return new te(e)}function oe(e,t){this._view=e,this._offset=t.highlightOffset,this._color=t.highlightColor,this._layer=new(r().Layer)({listening:!1}),this._highlightRect=null,this._startTime=null,this._endTime=null,this._strokeColor=t.highlightStrokeColor,this._opacity=t.highlightOpacity,this._cornerRadius=t.highlightCornerRadius}function se(e){this._point=e.point,this._marker=e.marker,this._draggable=e.draggable,this._onDragStart=e.onDragStart,this._onDragMove=e.onDragMove,this._onDragEnd=e.onDragEnd,this._dragBoundFunc=e.dragBoundFunc,this._onMouseEnter=e.onMouseEnter,this._onMouseLeave=e.onMouseLeave,this._group=new(r().Group)({name:"point-marker",point:this._point,draggable:this._draggable,dragBoundFunc:e.dragBoundFunc}),this._bindDefaultEventHandlers(),this._marker.init(this._group)}function ue(e,t,n){this._peaks=e,this._view=t,this._allowEditing=n,this._pointMarkers={},this._layer=new(r().Layer),this._onPointsDrag=this._onPointsDrag.bind(this),this._onPointMarkerDragStart=this._onPointMarkerDragStart.bind(this),this._onPointMarkerDragMove=this._onPointMarkerDragMove.bind(this),this._onPointMarkerDragEnd=this._onPointMarkerDragEnd.bind(this),this._pointMarkerDragBoundFunc=this._pointMarkerDragBoundFunc.bind(this),this._onPointMarkerMouseEnter=this._onPointMarkerMouseEnter.bind(this),this._onPointMarkerMouseLeave=this._onPointMarkerMouseLeave.bind(this),this._onPointsUpdate=this._onPointsUpdate.bind(this),this._onPointsAdd=this._onPointsAdd.bind(this),this._onPointsRemove=this._onPointsRemove.bind(this),this._onPointsRemoveAll=this._onPointsRemoveAll.bind(this),this._peaks.on("points.update",this._onPointsUpdate),this._peaks.on("points.add",this._onPointsAdd),this._peaks.on("points.remove",this._onPointsRemove),this._peaks.on("points.remove_all",this._onPointsRemoveAll),this._peaks.on("points.dragstart",this._onPointsDrag),this._peaks.on("points.dragmove",this._onPointsDrag),this._peaks.on("points.dragend",this._onPointsDrag)}function le(e,t,n){this._player=e,this._view=t,this._playheadPixel=0,this._playheadLineAnimation=null,this._playheadVisible=!1,this._playheadColor=n.playheadColor,this._playheadTextColor=n.playheadTextColor,this._playheadBackgroundColor=n.playheadBackgroundColor,this._playheadPadding=n.playheadPadding,this._playheadWidth=n.playheadWidth,this._playheadFontFamily=n.playheadFontFamily,this._playheadFontSize=n.playheadFontSize,this._playheadFontStyle=n.playheadFontStyle,this._playheadLayer=new(r().Layer),this._createPlayhead(),n.showPlayheadTime&&this._createPlayheadText(),this.fitToView(),this.zoomLevelChanged()}function he(e){this._options=e}function ce(e){var t=this;t._segment=e.segment,t._marker=e.marker,t._segmentShape=e.segmentShape,t._editable=e.editable,t._startMarker=e.startMarker,t._onDragStart=e.onDragStart,t._onDragMove=e.onDragMove,t._onDragEnd=e.onDragEnd,t._group=new(r().Group)({name:"segment-marker",segment:t._segment,draggable:t._editable,visible:t._editable,dragBoundFunc:function(n){return e.dragBoundFunc(t,n)}}),t._bindDefaultEventHandlers(),t._marker.init(t._group)}function de(e){this._color=e.color;var t={};if(T(e.color))t.fill=e.color;else{if(!C(e.color))throw new TypeError("Unknown type for color property");var n=e.view._height*(e.color.linearGradientStart/100),i=e.view._height*(e.color.linearGradientEnd/100);t.fillLinearGradientStartPointY=n,t.fillLinearGradientEndPointY=i,t.fillLinearGradientColorStops=[0,e.color.linearGradientColorStops[0],1,e.color.linearGradientColorStops[1]]}this._shape=new(r().Shape)(t),this._view=e.view,this._segment=e.segment,this._shape.sceneFunc(this._sceneFunc.bind(this))}J.prototype._handleKeyEvent=function(e){if(-1===q.indexOf(e.target.nodeName))if(Z.indexOf(e.type)>-1&&e.preventDefault(),"keydown"===e.type||"keypress"===e.type)switch(e.keyCode){case 32:this.eventEmitter.emit("keyboard.space");break;case 9:this.eventEmitter.emit("keyboard.tab")}else if("keyup"===e.type)switch(e.keyCode){case 37:e.shiftKey?this.eventEmitter.emit("keyboard.shift_left"):this.eventEmitter.emit("keyboard.left");break;case 39:e.shiftKey?this.eventEmitter.emit("keyboard.shift_right"):this.eventEmitter.emit("keyboard.right")}},J.prototype.destroy=function(){document.removeEventListener("keydown",this._handleKeyEvent),document.removeEventListener("keypress",this._handleKeyEvent),document.removeEventListener("keyup",this._handleKeyEvent)},Q.prototype._addMediaListener=function(e,t){this._listeners.push({type:e,callback:t}),this._mediaElement.addEventListener(e,t)},Q.prototype.init=function(e){var t,n=this;return n._eventEmitter=e,n._listeners=[],n._duration=n.getDuration(),n._addMediaListener("timeupdate",function(){n._eventEmitter.emit("player.timeupdate",n.getCurrentTime())}),n._addMediaListener("playing",function(){n._eventEmitter.emit("player.playing",n.getCurrentTime())}),n._addMediaListener("pause",function(){n._eventEmitter.emit("player.pause",n.getCurrentTime())}),n._addMediaListener("ended",function(){n._eventEmitter.emit("player.ended")}),n._addMediaListener("seeked",function(){n._eventEmitter.emit("player.seeked",n.getCurrentTime())}),n._addMediaListener("canplay",function(){n._eventEmitter.emit("player.canplay")}),n._addMediaListener("error",function(e){n._eventEmitter.emit("player.error",e.target.error)}),n._interval=null,(t=n._mediaElement).src||t.querySelector("source")?n._mediaElement.error&&n._mediaElement.error.code===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED?Promise.reject(n._mediaElement.error):new Promise(function(e,t){function i(r){n._mediaElement.removeEventListener("loadedmetadata",i),n._mediaElement.removeEventListener("error",i),"loadedmetadata"===r.type?e():t(r.target.error)}n._mediaElement.readyState===HTMLMediaElement.HAVE_NOTHING?(n._mediaElement.addEventListener("loadedmetadata",i),n._mediaElement.addEventListener("error",i),n._mediaElement.load()):e()}):Promise.resolve()},Q.prototype.destroy=function(){for(var e=0;e=this._segment.endTime){if(!this._loop)return this.pause(),this._peaks.emit("player.ended"),void(this._playingSegment=!1);this.seek(this._segment.startTime)}window.requestAnimationFrame(this._playSegmentTimerCallback)}else this._playingSegment=!1},ee.prototype._setSource=function(e){return this._adapter.setSource(e)},te.prototype.init=function(e){"zoomview"===this._options.view&&(this._label=new s.EY({x:2,y:0,text:this._options.point.labelText,textAlign:"left",fontFamily:this._options.fontFamily||"sans-serif",fontSize:this._options.fontSize||10,fontStyle:this._options.fontStyle||"normal",fill:"#000"})),this._handle=new o.r({x:-4.5,y:0,width:10,height:20,fill:this._options.color,visible:this._draggable}),this._line=new a.N({x:0,y:0,stroke:this._options.color,strokeWidth:1}),this._time=new s.EY({x:-24,y:0,text:this._options.layer.formatTime(this._options.point.time),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center"}),this._time.hide(),e.add(this._handle),e.add(this._line),this._label&&e.add(this._label),e.add(this._time),this.fitToView(),this.bindEventHandlers(e)},te.prototype.bindEventHandlers=function(e){var t=this;t._handle.on("mouseover touchstart",function(){t._draggable&&(t._time.setX(-24-t._time.getWidth()),t._time.show())}),t._handle.on("mouseout touchend",function(){t._draggable&&t._time.hide()}),e.on("dragstart",function(){t._time.setX(-24-t._time.getWidth()),t._time.show()}),e.on("dragend",function(){t._time.hide()})},te.prototype.fitToView=function(){var e=this._options.layer.getHeight();this._line.points([.5,0,.5,e]),this._label&&this._label.y(12),this._handle&&this._handle.y(e/2-10.5),this._time&&this._time.y(e/2-5)},te.prototype.update=function(e){void 0!==e.time&&this._time&&this._time.setText(this._options.layer.formatTime(e.time)),void 0!==e.labelText&&this._label&&this._label.text(e.labelText),void 0!==e.color&&(this._handle&&this._handle.fill(e.color),this._line.stroke(e.color)),void 0!==e.editable&&(this._draggable=e.editable,this._handle.visible(this._draggable))},ne.prototype.init=function(e){var t=this._options.startMarker?-24:24,n=this._options.startMarker?this._options.segment.startTime:this._options.segment.endTime;this._label=new s.EY({x:t,y:0,text:this._options.layer.formatTime(n),fontFamily:this._options.fontFamily,fontSize:this._options.fontSize,fontStyle:this._options.fontStyle,fill:"#000",textAlign:"center",visible:this._editable}),this._label.hide(),this._handle=new o.r({x:-4.5,y:0,width:10,height:20,fill:this._options.color,stroke:this._options.color,strokeWidth:1,visible:this._editable}),this._line=new a.N({x:0,y:0,stroke:this._options.color,strokeWidth:1,visible:this._editable}),e.add(this._label),e.add(this._line),e.add(this._handle),this.fitToView(),this.bindEventHandlers(e)},ne.prototype.bindEventHandlers=function(e){var t=this,n=t._options.startMarker?-24:24;e.on("dragstart",function(){t._options.startMarker&&t._label.setX(n-t._label.getWidth()),t._label.show()}),e.on("dragend",function(){t._label.hide()}),t._handle.on("mouseover touchstart",function(){t._options.startMarker&&t._label.setX(n-t._label.getWidth()),t._label.show()}),t._handle.on("mouseout touchend",function(){t._label.hide()})},ne.prototype.fitToView=function(){var e=this._options.layer.getHeight();this._label.y(e/2-5),this._handle.y(e/2-10.5),this._line.points([.5,0,.5,e])},ne.prototype.update=function(e){void 0!==e.startTime&&this._options.startMarker&&this._label.text(this._options.layer.formatTime(e.startTime)),void 0===e.endTime||this._options.startMarker||this._label.text(this._options.layer.formatTime(e.endTime)),void 0!==e.editable&&(this._editable=e.editable,this._label.visible(this._editable),this._handle.visible(this._editable),this._line.visible(this._editable))},oe.prototype.addToStage=function(e){e.add(this._layer)},oe.prototype.showHighlight=function(e,t){this._highlightRect||this._createHighlightRect(e,t),this._update(e,t)},oe.prototype._update=function(e,t){this._startTime=e,this._endTime=t;var n=this._view.timeToPixels(e),i=this._view.timeToPixels(t);this._highlightRect.setAttrs({x:n,width:i-n})},oe.prototype._createHighlightRect=function(e,t){this._startTime=e,this._endTime=t;var n=this._view.timeToPixels(e),i=this._view.timeToPixels(t);this._highlightRect=new o.r({x:n,y:0,width:i-n,height:0,stroke:this._strokeColor,strokeWidth:1,fill:this._color,opacity:this._opacity,cornerRadius:this._cornerRadius}),this.fitToView(),this._layer.add(this._highlightRect)},oe.prototype.removeHighlight=function(){this._highlightRect&&(this._highlightRect.destroy(),this._highlightRect=null)},oe.prototype.updateHighlight=function(){this._highlightRect&&this._update(this._startTime,this._endTime)},oe.prototype.fitToView=function(){if(this._highlightRect){var e=this._view.getHeight(),t=v(this._offset,0,Math.floor(e/2));this._highlightRect.setAttrs({y:t,height:e-2*t})}},se.prototype._bindDefaultEventHandlers=function(){var e=this;e._group.on("dragstart",function(t){e._onDragStart(t,e._point)}),e._group.on("dragmove",function(t){e._onDragMove(t,e._point)}),e._group.on("dragend",function(t){e._onDragEnd(t,e._point)}),e._group.on("mouseenter",function(t){e._onMouseEnter(t,e._point)}),e._group.on("mouseleave",function(t){e._onMouseLeave(t,e._point)})},se.prototype.addToLayer=function(e){e.add(this._group)},se.prototype.fitToView=function(){this._marker.fitToView()},se.prototype.getPoint=function(){return this._point},se.prototype.getX=function(){return this._group.getX()},se.prototype.setX=function(e){this._group.setX(e)},se.prototype.getWidth=function(){return this._group.getWidth()},se.prototype.getAbsolutePosition=function(){return this._group.getAbsolutePosition()},se.prototype.update=function(e){void 0!==e.editable&&this._group.draggable(e.editable),this._marker.update&&this._marker.update(e)},se.prototype.destroy=function(){this._marker.destroy&&this._marker.destroy(),this._group.destroyChildren(),this._group.destroy()},ue.prototype.addToStage=function(e){e.add(this._layer)},ue.prototype.enableEditing=function(e){this._allowEditing=e},ue.prototype.getPointMarker=function(e){return this._pointMarkers[e.pid]},ue.prototype.formatTime=function(e){return this._view.formatTime(e)},ue.prototype._onPointsUpdate=function(e,t){var n=this._view.getStartTime(),i=this._view.getEndTime(),r=this.getPointMarker(e),a=e.isVisible(n,i);if(r&&!a)this._removePoint(e);else if(!r&&a)this._updatePoint(e);else if(r&&a){if(y(t,"time")){var o=this._view.timeToPixels(e.time)-this._view.getFrameOffset();r.setX(o)}r.update(t)}},ue.prototype._onPointsAdd=function(e){var t=this,n=t._view.getStartTime(),i=t._view.getEndTime();e.points.forEach(function(e){e.isVisible(n,i)&&t._updatePoint(e)})},ue.prototype._onPointsRemove=function(e){var t=this;e.points.forEach(function(e){t._removePoint(e)})},ue.prototype._onPointsRemoveAll=function(){this._layer.removeChildren(),this._pointMarkers={}},ue.prototype._createPointMarker=function(e){var t=this._allowEditing&&e.editable;return new se({point:e,draggable:t,marker:this._peaks.options.createPointMarker({point:e,editable:t,color:e.color,fontFamily:this._peaks.options.fontFamily||"sans-serif",fontSize:this._peaks.options.fontSize||10,fontStyle:this._peaks.options.fontStyle||"normal",layer:this,view:this._view.getName()}),onDragStart:this._onPointMarkerDragStart,onDragMove:this._onPointMarkerDragMove,onDragEnd:this._onPointMarkerDragEnd,dragBoundFunc:this._pointMarkerDragBoundFunc,onMouseEnter:this._onPointMarkerMouseEnter,onMouseLeave:this._onPointMarkerMouseLeave})},ue.prototype.getHeight=function(){return this._view.getHeight()},ue.prototype._addPointMarker=function(e){var t=this._createPointMarker(e);return this._pointMarkers[e.pid]=t,t.addToLayer(this._layer),t},ue.prototype._onPointsDrag=function(e){this._updatePoint(e.point).update({time:e.point.time})},ue.prototype._onPointMarkerMouseEnter=function(e,t){this._peaks.emit("points.mouseenter",{point:t,evt:e.evt})},ue.prototype._onPointMarkerMouseLeave=function(e,t){this._peaks.emit("points.mouseleave",{point:t,evt:e.evt})},ue.prototype._onPointMarkerDragStart=function(e,t){this._dragPointMarker=this.getPointMarker(t),this._peaks.emit("points.dragstart",{point:t,evt:e.evt})},ue.prototype._onPointMarkerDragMove=function(e,t){var n=this._pointMarkers[t.pid],i=n.getX()+n.getWidth();t._setTime(this._view.pixelOffsetToTime(i)),this._peaks.emit("points.dragmove",{point:t,evt:e.evt})},ue.prototype._onPointMarkerDragEnd=function(e,t){this._dragPointMarker=null,this._peaks.emit("points.dragend",{point:t,evt:e.evt})},ue.prototype._pointMarkerDragBoundFunc=function(e){return{x:v(e.x,0,this._view.getWidth()),y:this._dragPointMarker.getAbsolutePosition().y}},ue.prototype.updatePoints=function(e,t){this._peaks.points.find(e,t).forEach(this._updatePoint.bind(this)),this._removeInvisiblePoints(e,t)},ue.prototype._updatePoint=function(e){var t=this.getPointMarker(e);t||(t=this._addPointMarker(e));var n=this._view.timeToPixels(e.time)-this._view.getFrameOffset();return t.setX(n),t},ue.prototype._removeInvisiblePoints=function(e,t){for(var n in this._pointMarkers)if(y(this._pointMarkers,n)){var i=this._pointMarkers[n].getPoint();i.isVisible(e,t)||this._removePoint(i)}},ue.prototype._removePoint=function(e){var t=this.getPointMarker(e);t&&(t.destroy(),delete this._pointMarkers[e.pid])},ue.prototype.setVisible=function(e){this._layer.setVisible(e)},ue.prototype.destroy=function(){this._peaks.off("points.update",this._onPointsUpdate),this._peaks.off("points.add",this._onPointsAdd),this._peaks.off("points.remove",this._onPointsRemove),this._peaks.off("points.remove_all",this._onPointsRemoveAll),this._peaks.off("points.dragstart",this._onPointsDrag),this._peaks.off("points.dragmove",this._onPointsDrag),this._peaks.off("points.dragend",this._onPointsDrag)},ue.prototype.fitToView=function(){for(var e in this._pointMarkers)y(this._pointMarkers,e)&&this._pointMarkers[e].fitToView()},ue.prototype.draw=function(){this._layer.draw()},le.prototype.addToStage=function(e){e.add(this._playheadLayer)},le.prototype.zoomLevelChanged=function(){var e=this._view.timeToPixels(1);if(this._useAnimation=e>=5,this._useAnimation)this._player.isPlaying()&&!this._playheadLineAnimation&&this._start();else if(this._playheadLineAnimation){var t=this._player.getCurrentTime();this.stop(t)}},le.prototype.fitToView=function(){var e=this._view.getHeight();this._playheadLine.points([.5,0,.5,e]),this._playheadText&&this._playheadText.y(12)},le.prototype._createPlayhead=function(){this._playheadLine=new a.N({stroke:this._playheadColor,strokeWidth:this._playheadWidth}),this._playheadGroup=new(r().Group)({x:0,y:0}),this._playheadGroup.add(this._playheadLine),this._playheadLayer.add(this._playheadGroup)},le.prototype._createPlayheadText=function(){var e=this,t=e._player.getCurrentTime(),n=e._view.formatTime(t);e._playheadText=new s.EY({x:0,y:0,padding:e._playheadPadding,text:n,fontSize:e._playheadFontSize,fontFamily:e._playheadFontFamily,fontStyle:e._playheadFontStyle,fill:e._playheadTextColor,align:"right",sceneFunc:function(t,n){var i=n.width(),r=n.height()+2*e._playheadPadding;t.fillStyle=e._playheadBackgroundColor,t.fillRect(0,-e._playheadPadding,i,r),n._sceneFunc(t)}}),e._playheadGroup.add(e._playheadText)},le.prototype.updatePlayheadTime=function(e){this._syncPlayhead(e),this._player.isPlaying()&&this._start()},le.prototype._syncPlayhead=function(e){var t=this._view.timeToPixels(e),n=this._view.getFrameOffset(),i=this._view.getWidth(),r=t>=n&&t<=n+i;if(this._playheadPixel=t,r){var a=this._playheadPixel-n;if(this._playheadVisible||(this._playheadVisible=!0,this._playheadGroup.show()),this._playheadGroup.setX(a),this._playheadText){var o=this._view.formatTime(e),s=this._playheadText.width();this._playheadText.setText(o),s+a>i-2?this._playheadText.setX(-s):s+as&&(r=s),r>t.length-1&&(r=t.length-1);for(var u=t.channels,l=0,h=Math.floor(o/u),c=0;c=i;s--)u=t.max_sample(s),l=s-n+.5,h=a+de.scaleY(u,o,c)+1,e.lineTo(l,h);e.closePath(),e.fillShape(this._shape)},de.prototype.addToLayer=function(e){e.add(this._shape)},de.prototype.destroy=function(){this._shape.destroy(),this._shape=null},de.prototype.on=function(e,t){this._shape.on(e,t)},de.prototype.off=function(e,t){this._shape.off(e,t)},de.scaleY=function(e,t,n){var i=-(t-1)*(e*n+128)/255+(t-1);return v(Math.floor(i),0,t-1)};var pe="sans-serif",fe="normal";function ge(e,t,n,i){this._segment=e,this._peaks=t,this._layer=n,this._view=i,this._label=null,this._startMarker=null,this._endMarker=null,this._color=e.color,this._borderColor=e.borderColor,this._draggable=this._segment.editable&&this._view.isSegmentDraggingEnabled(),this._dragging=!1;var a=i.getViewOptions().segmentOptions;this._overlayOffset=a.overlayOffset,a.overlay||(this._waveformShape=new de({color:e.color,view:i,segment:e})),this._onMouseEnter=this._onMouseEnter.bind(this),this._onMouseLeave=this._onMouseLeave.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._dragBoundFunc=this._dragBoundFunc.bind(this),this._onSegmentDragStart=this._onSegmentDragStart.bind(this),this._onSegmentDragMove=this._onSegmentDragMove.bind(this),this._onSegmentDragEnd=this._onSegmentDragEnd.bind(this),this._onSegmentMarkerDragStart=this._onSegmentMarkerDragStart.bind(this),this._onSegmentMarkerDragMove=this._onSegmentMarkerDragMove.bind(this),this._onSegmentMarkerDragEnd=this._onSegmentMarkerDragEnd.bind(this),this._segmentMarkerDragBoundFunc=this._segmentMarkerDragBoundFunc.bind(this),this._label=this._peaks.options.createSegmentLabel({segment:e,view:this._view.getName(),layer:this._layer,fontFamily:this._peaks.options.fontFamily,fontSize:this._peaks.options.fontSize,fontStyle:this._peaks.options.fontStyle}),this._label&&this._label.hide();var o,s,u,l,h,c=this._view.timeToPixelOffset(this._segment.startTime),d=this._view.timeToPixelOffset(this._segment.endTime),p=v(0,this._view.getHeight()-2*this._overlayOffset);this._overlay=new(r().Group)({name:"segment-overlay",segment:this._segment,x:c,y:0,width:d-c,height:this._view.getHeight(),clipX:0,clipY:this._overlayOffset,clipWidth:d-c,clipHeight:p,draggable:this._draggable,dragBoundFunc:this._dragBoundFunc}),a.overlay&&(o=this._borderColor||a.overlayBorderColor,s=a.overlayBorderWidth,u=this._color||a.overlayColor,l=a.overlayOpacity,h=a.overlayCornerRadius),this._overlayRect=new(r().Rect)({x:0,y:this._overlayOffset,width:d-c,stroke:o,strokeWidth:s,height:p,fill:u,opacity:l,cornerRadius:h}),this._overlay.add(this._overlayRect),a.overlay&&(this._overlayText=new(r().Text)({x:0,y:this._overlayOffset,text:this._segment.labelText,fontFamily:a.overlayFontFamily,fontSize:a.overlayFontSize,fontStyle:a.overlayFontStyle,fill:a.overlayLabelColor,listening:!1,align:a.overlayLabelAlign,width:d-c,verticalAlign:a.overlayLabelVerticalAlign,height:p,padding:a.overlayLabelPadding}),this._overlay.add(this._overlayText)),this._overlay.on("mouseenter",this._onMouseEnter),this._overlay.on("mouseleave",this._onMouseLeave),this._overlay.on("mousedown",this._onMouseDown),this._overlay.on("mouseup",this._onMouseUp),this._draggable&&(this._overlay.on("dragstart",this._onSegmentDragStart),this._overlay.on("dragmove",this._onSegmentDragMove),this._overlay.on("dragend",this._onSegmentDragEnd)),this._createMarkers()}function me(e){return new he(e)}function ve(e){return e.endTime-e.startTime}function ye(e,t,n){this._peaks=e,this._view=t,this._allowEditing=n,this._segmentShapes={},this._layer=new(r().Layer),this._onSegmentsUpdate=this._onSegmentsUpdate.bind(this),this._onSegmentsAdd=this._onSegmentsAdd.bind(this),this._onSegmentsRemove=this._onSegmentsRemove.bind(this),this._onSegmentsRemoveAll=this._onSegmentsRemoveAll.bind(this),this._onSegmentsDragged=this._onSegmentsDragged.bind(this),this._peaks.on("segments.update",this._onSegmentsUpdate),this._peaks.on("segments.add",this._onSegmentsAdd),this._peaks.on("segments.remove",this._onSegmentsRemove),this._peaks.on("segments.remove_all",this._onSegmentsRemoveAll),this._peaks.on("segments.dragged",this._onSegmentsDragged)}function be(e,t){var n=this;n._axisGridlineColor=t.axisGridlineColor,n._axisLabelColor=t.axisLabelColor,n._showAxisLabels=t.showAxisLabels,n._axisTopMarkerHeight=t.axisTopMarkerHeight,n._axisBottomMarkerHeight=t.axisBottomMarkerHeight,t.formatAxisTime?n._formatAxisTime=t.formatAxisTime:n._formatAxisTime=function(e){return m(e,0)},n._axisLabelFont=be._buildFontString(t.fontFamily,t.fontSize,t.fontStyle),n._axisShape=new(r().Shape)({sceneFunc:function(t){n._drawAxis(t,e)}})}function _e(e,t,n,i){var a=this;a._container=t,a._peaks=n,a._options=n.options,a._viewOptions=i,a._originalWaveformData=e,a._data=e,a._frameOffset=0,a._width=t.clientWidth,a._height=t.clientHeight,a._amplitudeScale=1,a._waveformColor=a._viewOptions.waveformColor,a._playedWaveformColor=a._viewOptions.playedWaveformColor,a._timeLabelPrecision=a._viewOptions.timeLabelPrecision,a._viewOptions.formatPlayheadTime?a._formatPlayheadTime=a._viewOptions.formatPlayheadTime:a._formatPlayheadTime=function(e){return m(e,a._timeLabelPrecision)},a._enableSeek=!0,a.initWaveform(),r().showWarnings=!1,a._stage=new(r().Stage)({container:t,width:a._width,height:a._height}),a._createWaveform(),a._viewOptions.enableSegments&&(a._segmentsLayer=new ye(n,a,a._viewOptions.enableEditing),a._segmentsLayer.addToStage(a._stage)),a._viewOptions.enablePoints&&(a._pointsLayer=new ue(n,a,a._viewOptions.enableEditing),a._pointsLayer.addToStage(a._stage)),a.initHighlightLayer(),a._createAxisLabels(),a._playheadLayer=new le(a._peaks.player,a,a._viewOptions),a._playheadLayer.addToStage(a._stage),a._onClick=a._onClick.bind(a),a._onDblClick=a._onDblClick.bind(a),a._onContextMenu=a._onContextMenu.bind(a),a._stage.on("click",a._onClick),a._stage.on("dblclick",a._onDblClick),a._stage.on("contextmenu",a._onContextMenu)}function we(e,t){this._stage=e,this._handlers=t,this._dragging=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseUp=this._mouseUp.bind(this),this._mouseMove=this._mouseMove.bind(this),this._stage.on("mousedown",this._mouseDown),this._stage.on("touchstart",this._mouseDown),this._lastMouseClientX=null}function Se(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._mouseDragHandler=new we(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove})}function Te(e,t,n){var i=this;_e.call(i,e,t,n,n.options.overview),i._onTimeUpdate=i._onTimeUpdate.bind(i),i._onPlaying=i._onPlaying.bind(i),i._onPause=i._onPause.bind(i),i._onZoomviewDisplaying=i._onZoomviewDisplaying.bind(i),n.on("player.timeupdate",i._onTimeUpdate),n.on("player.playing",i._onPlaying),n.on("player.pause",i._onPause),n.on("zoomview.displaying",i._onZoomviewDisplaying);var r=i._peaks.player.getCurrentTime();i._playheadLayer.updatePlayheadTime(r),i._mouseDragHandler=new Se(n,i)}function Ae(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new we(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function Ee(e,t){this._peaks=e,this._view=t,this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._mouseDragHandler=new we(t._stage,{onMouseDown:this._onMouseDown,onMouseMove:this._onMouseMove,onMouseUp:this._onMouseUp})}function xe(e,t,n){var i=this;_e.call(i,e,t,n,n.options.zoomview),i._onTimeUpdate=i._onTimeUpdate.bind(i),i._onPlaying=i._onPlaying.bind(i),i._onPause=i._onPause.bind(i),i._onKeyboardLeft=i._onKeyboardLeft.bind(i),i._onKeyboardRight=i._onKeyboardRight.bind(i),i._onKeyboardShiftLeft=i._onKeyboardShiftLeft.bind(i),i._onKeyboardShiftRight=i._onKeyboardShiftRight.bind(i),i._peaks.on("player.timeupdate",i._onTimeUpdate),i._peaks.on("player.playing",i._onPlaying),i._peaks.on("player.pause",i._onPause),i._peaks.on("keyboard.left",i._onKeyboardLeft),i._peaks.on("keyboard.right",i._onKeyboardRight),i._peaks.on("keyboard.shift_left",i._onKeyboardShiftLeft),i._peaks.on("keyboard.shift_right",i._onKeyboardShiftRight),i._autoScroll=i._viewOptions.autoScroll,i._autoScrollOffset=i._viewOptions.autoScrollOffset,i._enableSegmentDragging=!1,i._segmentDragMode="overlap",i._minSegmentDragWidth=0,i._insertSegmentShape=null,i._playheadClickTolerance=i._viewOptions.playheadClickTolerance,i._zoomLevelAuto=!1,i._zoomLevelSeconds=null;var r=i._peaks.player.getCurrentTime();i._syncPlayhead(r),i._mouseDragHandler=new Ee(n,i),i._onWheel=i._onWheel.bind(i),i._onWheelCaptureVerticalScroll=i._onWheelCaptureVerticalScroll.bind(i),i.setWheelMode(i._viewOptions.wheelMode),i._peaks.emit("zoomview.displaying",0,i.getEndTime())}function Ce(e,t,n){this._waveformData=e,this._container=t,this._peaks=n,this._options=n.options.scrollbar,this._zoomview=n.views.getView("zoomview"),this._dragBoundFunc=this._dragBoundFunc.bind(this),this._onScrollboxDragStart=this._onScrollboxDragStart.bind(this),this._onScrollboxDragMove=this._onScrollboxDragMove.bind(this),this._onScrollboxDragEnd=this._onScrollboxDragEnd.bind(this),this._onZoomviewDisplaying=this._onZoomviewDisplaying.bind(this),this._onScrollbarClick=this._onScrollbarClick.bind(this),n.on("zoomview.displaying",this._onZoomviewDisplaying),this._width=t.clientWidth,this._height=t.clientHeight,this._stage=new(r().Stage)({container:t,width:this._width,height:this._height}),this._layer=new(r().Layer),this._stage.on("click",this._onScrollbarClick),this._stage.add(this._layer),this._color=this._options.color,this._scrollboxX=0,this._minScrollboxWidth=this._options.minWidth,this._offsetY=0,this._scrollbox=new(r().Group)({draggable:!0,dragBoundFunc:this._dragBoundFunc}),this._scrollboxRect=new o.r({x:this._scrollboxX,y:this._offsetY,width:0,height:this._height,fill:this._color}),this._scrollbox.add(this._scrollboxRect),this._setScrollboxWidth(),this._scrollbox.on("dragstart",this._onScrollboxDragStart),this._scrollbox.on("dragmove",this._onScrollboxDragMove),this._scrollbox.on("dragend",this._onScrollboxDragEnd),this._layer.add(this._scrollbox),this._layer.draw()}function ke(e){this._peaks=e,this._overview=null,this._zoomview=null,this._scrollbar=null}function Ie(e,t){this._peaks=e,this._zoomLevels=t,this._zoomLevelIndex=0}ge.prototype._createMarkers=function(){var e=this._layer.isEditingEnabled()&&this._segment.editable,t=this._view.getViewOptions().segmentOptions,n=t.markers?this._peaks.options.createSegmentMarker:me,i=n({segment:this._segment,editable:e,startMarker:!0,color:t.startMarkerColor,fontFamily:this._peaks.options.fontFamily||pe,fontSize:this._peaks.options.fontSize||10,fontStyle:this._peaks.options.fontStyle||fe,layer:this._layer,view:this._view.getName(),segmentOptions:this._view.getViewOptions().segmentOptions});i&&(this._startMarker=new ce({segment:this._segment,segmentShape:this,editable:e,startMarker:!0,marker:i,onDragStart:this._onSegmentMarkerDragStart,onDragMove:this._onSegmentMarkerDragMove,onDragEnd:this._onSegmentMarkerDragEnd,dragBoundFunc:this._segmentMarkerDragBoundFunc}));var r=n({segment:this._segment,editable:e,startMarker:!1,color:t.endMarkerColor,fontFamily:this._peaks.options.fontFamily||pe,fontSize:this._peaks.options.fontSize||10,fontStyle:this._peaks.options.fontStyle||fe,layer:this._layer,view:this._view.getName(),segmentOptions:this._view.getViewOptions().segmentOptions});r&&(this._endMarker=new ce({segment:this._segment,segmentShape:this,editable:e,startMarker:!1,marker:r,onDragStart:this._onSegmentMarkerDragStart,onDragMove:this._onSegmentMarkerDragMove,onDragEnd:this._onSegmentMarkerDragEnd,dragBoundFunc:this._segmentMarkerDragBoundFunc}))},ge.prototype._dragBoundFunc=function(e){return{x:e.x,y:0}},ge.prototype.update=function(e){var t,n=this._view.timeToPixelOffset(this._segment.startTime),i=this._view.timeToPixelOffset(this._segment.endTime),r=i-n;(t=this.getStartMarker())&&(t.setX(n-t.getWidth()),e&&t.update(e)),(t=this.getEndMarker())&&(t.setX(i),e&&t.update(e)),this._color=this._segment.color,this._borderColor=this._segment.bordercolor,this._overlayText&&this._overlayText.text(this._segment.labelText),this._view.getViewOptions().segmentOptions.overlay?(this._color&&this._overlayRect.fill(this._color),this._borderColor&&this._overlayRect.stroke(this._borderColor)):this._waveformShape.setWaveformColor(this._segment.color),this._dragging||this._overlay&&(this._overlay.setAttrs({x:n,width:r,clipWidth:r<1?1:r}),this._overlayRect.setAttrs({x:0,width:r}),this._overlayText&&this._overlayText.setAttrs({width:r}))},ge.prototype.getSegment=function(){return this._segment},ge.prototype.getStartMarker=function(){return this._startMarker},ge.prototype.getEndMarker=function(){return this._endMarker},ge.prototype.addToLayer=function(e){this._waveformShape&&this._waveformShape.addToLayer(e),this._label&&e.add(this._label),this._overlay&&e.add(this._overlay),this._startMarker&&this._startMarker.addToLayer(e),this._endMarker&&this._endMarker.addToLayer(e)},ge.prototype.isDragging=function(){return this._dragging},ge.prototype._onMouseEnter=function(e){this._label&&(this._label.moveToTop(),this._label.show()),this._peaks.emit("segments.mouseenter",{segment:this._segment,evt:e.evt})},ge.prototype._onMouseLeave=function(e){this._label&&this._label.hide(),this._peaks.emit("segments.mouseleave",{segment:this._segment,evt:e.evt})},ge.prototype._onMouseDown=function(e){this._peaks.emit("segments.mousedown",{segment:this._segment,evt:e.evt})},ge.prototype._onMouseUp=function(e){this._peaks.emit("segments.mouseup",{segment:this._segment,evt:e.evt})},ge.prototype.segmentClicked=function(e,t){this._moveToTop(),this._peaks.emit("segments."+e,t)},ge.prototype._moveToTop=function(){this._overlay.moveToTop(),this._layer.moveSegmentMarkersToTop()},ge.prototype.enableSegmentDragging=function(e){this._segment.editable&&(!this._draggable&&e?(this._overlay.on("dragstart",this._onSegmentDragStart),this._overlay.on("dragmove",this._onSegmentDragMove),this._overlay.on("dragend",this._onSegmentDragEnd)):this._draggable&&!e&&(this._overlay.off("dragstart",this._onSegmentDragStart),this._overlay.off("dragmove",this._onSegmentDragMove),this._overlay.off("dragend",this._onSegmentDragEnd)),this._overlay.draggable(e),this._draggable=e)},ge.prototype._setPreviousAndNextSegments=function(){"overlap"!==this._view.getSegmentDragMode()?(this._nextSegment=this._peaks.segments.findNextSegment(this._segment),this._previousSegment=this._peaks.segments.findPreviousSegment(this._segment)):(this._nextSegment=null,this._previousSegment=null)},ge.prototype._onSegmentDragStart=function(e){this._setPreviousAndNextSegments(),this._dragging=!0,this._dragStartX=this._overlay.getX(),this._dragStartTime=this._segment.startTime,this._dragEndTime=this._segment.endTime,this._peaks.emit("segments.dragstart",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt})},ge.prototype._onSegmentDragMove=function(e){var t,n=this._overlay.getX()-this._dragStartX,i=this._view.pixelsToTime(n),r=this._dragStartTime+i,a=this._dragEndTime+i,o=this._segment.endTime-this._segment.startTime,s=this._view.getMinSegmentDragWidth(),u=this._view.pixelsToTime(s),l=!1,h=!1;if(r<0&&(r=0,a=o,this._overlay.setX(this._view.timeToPixelOffset(r))),this._previousSegment){var c=this._view.timeToPixelOffset(this._previousSegment.endTime);if(rthis._nextSegment.startTime)if("no-overlap"===(t=this._view.getSegmentDragMode())||"compress"===t&&!this._nextSegment.editable)r=(a=this._nextSegment.startTime)-o,this._overlay.setX(f-this._overlay.getWidth());else if("compress"===t){var g=a,m=this._nextSegment.endTime-u;g>m&&(g=m,f=this._view.timeToPixelOffset(g),this._overlay.setX(f-this._overlay.getWidth()),r=(a=g)-o),this._nextSegment.update({startTime:g}),h=!0}}this._segment._setStartTime(r),this._segment._setEndTime(a),this._peaks.emit("segments.dragged",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt}),l?this._peaks.emit("segments.dragged",{segment:this._previousSegment,marker:!1,startMarker:!1,evt:e.evt}):h&&this._peaks.emit("segments.dragged",{segment:this._nextSegment,marker:!1,startMarker:!1,evt:e.evt})},ge.prototype._onSegmentDragEnd=function(e){this._dragging=!1,this._peaks.emit("segments.dragend",{segment:this._segment,marker:!1,startMarker:!1,evt:e.evt})},ge.prototype.moveMarkersToTop=function(){this._startMarker&&this._startMarker.moveToTop(),this._endMarker&&this._endMarker.moveToTop()},ge.prototype.startDrag=function(){this._endMarker&&this._endMarker.startDrag()},ge.prototype.stopDrag=function(){this._endMarker&&this._endMarker.stopDrag()},ge.prototype._onSegmentMarkerDragStart=function(e,t){this._setPreviousAndNextSegments(),this._moveToTop(),this._startMarkerX=this._startMarker.getX(),this._endMarkerX=this._endMarker.getX(),this._peaks.emit("segments.dragstart",{segment:this._segment,marker:!0,startMarker:e.isStartMarker(),evt:t.evt})},ge.prototype._onSegmentMarkerDragMove=function(e,t){e.isStartMarker()?(this._segmentStartMarkerDragMove(e,t),e.update({startTime:this._segment.startTime})):(this._segmentEndMarkerDragMove(e,t),e.update({endTime:this._segment.endTime}))},ge.prototype._segmentStartMarkerDragMove=function(e,t){var n=this._view.getWidth(),i=this._startMarker.getX(),r=this._endMarker.getX(),a=this._view.pixelsToTime(50),o=this._view.getMinSegmentDragWidth(),s=this._endMarker.getX()-o;s>n&&(s=n);var u,l=!1,h=!1;if(this._previousSegment&&(l=(u=this._view.timeToPixelOffset(this._previousSegment.endTime))>=0),i>s)e.setX(s),this._overlay.clipWidth(s-r),0===o&&s0?this._segment._setEndTime(this._segment.startTime):this._segment._setEndTime(this._view.pixelOffsetToTime(s));else if(this._nextSegment&&l){var c=this._view.getSegmentDragMode(),d="no-overlap"===c||"compress"===c&&!this._nextSegment.editable,p="compress"===c&&this._nextSegment.editable;if(r>=u){if(d)e.setX(u),this._overlay.clipWidth(u-i),this._segment._setEndTime(this._nextSegment.startTime);else if(p){var f=ve(this._nextSegment);fg&&(r=g),e.setX(r),this._overlay.clipWidth(r-i),this._segment._setEndTime(this._view.pixelOffsetToTime(r)),this._nextSegment.update({startTime:this._view.pixelOffsetToTime(r)}),h=!0}}else r>n&&(r=n),e.setX(r),this._overlay.clipWidth(r-i),this._segment._setEndTime(this._view.pixelOffsetToTime(r))}else r>n&&(r=n),e.setX(r),this._overlay.clipWidth(r-i),this._segment._setEndTime(this._view.pixelOffsetToTime(r));this._peaks.emit("segments.dragged",{segment:this._segment,marker:!0,startMarker:!1,evt:t.evt}),h&&this._peaks.emit("segments.dragged",{segment:this._nextSegment,marker:!0,startMarker:!0,evt:t.evt})},ge.prototype._onSegmentMarkerDragEnd=function(e,t){this._nextSegment=null,this._previousSegment=null;var n=e.isStartMarker();this._peaks.emit("segments.dragend",{segment:this._segment,marker:!0,startMarker:n,evt:t.evt})},ge.prototype._segmentMarkerDragBoundFunc=function(e,t){return{x:t.x,y:e.getAbsolutePosition().y}},ge.prototype.fitToView=function(){if(this._startMarker&&this._startMarker.fitToView(),this._endMarker&&this._endMarker.fitToView(),this._overlay){var e=this._view.getHeight(),t=v(0,e-2*this._overlayOffset);this._overlay.setAttrs({y:0,height:e,clipY:this._overlayOffset,clipHeight:t}),this._overlayRect.setAttrs({y:this._overlayOffset,height:t}),this._overlayText&&this._overlayText.setAttrs({y:this._overlayOffset,height:t})}},ge.prototype.destroy=function(){this._waveformShape&&this._waveformShape.destroy(),this._label&&this._label.destroy(),this._startMarker&&this._startMarker.destroy(),this._endMarker&&this._endMarker.destroy(),this._overlay&&this._overlay.destroy()},ye.prototype.addToStage=function(e){e.add(this._layer)},ye.prototype.enableEditing=function(e){this._allowEditing=e},ye.prototype.isEditingEnabled=function(){return this._allowEditing},ye.prototype.enableSegmentDragging=function(e){for(var t in this._segmentShapes)y(this._segmentShapes,t)&&this._segmentShapes[t].enableSegmentDragging(e)},ye.prototype.getSegmentShape=function(e){return this._segmentShapes[e.pid]},ye.prototype.formatTime=function(e){return this._view.formatTime(e)},ye.prototype._onSegmentsUpdate=function(e,t){var n=this._view.getStartTime(),i=this._view.getEndTime(),r=this.getSegmentShape(e),a=e.isVisible(n,i);r&&!a?r.isDragging()||this._removeSegment(e):!r&&a?r=this._updateSegment(e):r&&a&&r.update(t)},ye.prototype._onSegmentsAdd=function(e){var t=this,n=t._view.getStartTime(),i=t._view.getEndTime();e.segments.forEach(function(e){e.isVisible(n,i)&&t._addSegmentShape(e).update()}),this.moveSegmentMarkersToTop()},ye.prototype._onSegmentsRemove=function(e){var t=this;e.segments.forEach(function(e){t._removeSegment(e)})},ye.prototype._onSegmentsRemoveAll=function(){this._layer.removeChildren(),this._segmentShapes={}},ye.prototype._onSegmentsDragged=function(e){this._updateSegment(e.segment)},ye.prototype._createSegmentShape=function(e){return new ge(e,this._peaks,this,this._view)},ye.prototype._addSegmentShape=function(e){var t=this._createSegmentShape(e);return t.addToLayer(this._layer),this._segmentShapes[e.pid]=t,t},ye.prototype.updateSegments=function(e,t){this._peaks.segments.find(e,t).forEach(this._updateSegment.bind(this)),this._removeInvisibleSegments(e,t)},ye.prototype._updateSegment=function(e){var t=this.getSegmentShape(e);t||(t=this._addSegmentShape(e)),t.update()},ye.prototype._removeInvisibleSegments=function(e,t){for(var n in this._segmentShapes)if(y(this._segmentShapes,n)){var i=this._segmentShapes[n].getSegment();i.isVisible(e,t)||this._removeSegment(i)}},ye.prototype._removeSegment=function(e){var t=this._segmentShapes[e.pid];t&&(t.destroy(),delete this._segmentShapes[e.pid])},ye.prototype.moveSegmentMarkersToTop=function(){for(var e in this._segmentShapes)y(this._segmentShapes,e)&&this._segmentShapes[e].moveMarkersToTop()},ye.prototype.setVisible=function(e){this._layer.setVisible(e)},ye.prototype.segmentClicked=function(e,t){var n=this._segmentShapes[t.segment.pid];n&&n.segmentClicked(e,t)},ye.prototype.destroy=function(){this._peaks.off("segments.update",this._onSegmentsUpdate),this._peaks.off("segments.add",this._onSegmentsAdd),this._peaks.off("segments.remove",this._onSegmentsRemove),this._peaks.off("segments.remove_all",this._onSegmentsRemoveAll),this._peaks.off("segments.dragged",this._onSegmentsDragged)},ye.prototype.fitToView=function(){for(var e in this._segmentShapes)y(this._segmentShapes,e)&&this._segmentShapes[e].fitToView()},ye.prototype.draw=function(){this._layer.draw()},ye.prototype.getHeight=function(){return this._layer.getHeight()},be._buildFontString=function(e,t,n){return t||(t=11),e||(e="sans-serif"),n||(n="normal"),n+" "+t+"px "+e},be.prototype.addToLayer=function(e){e.add(this._axisShape)},be.prototype.showAxisLabels=function(e,t){this._showAxisLabels=e,t&&(y(t,"topMarkerHeight")&&(this._axisTopMarkerHeight=t.topMarkerHeight),y(t,"bottomMarkerHeight")&&(this._axisBottomMarkerHeight=t.bottomMarkerHeight))},be.prototype._getAxisLabelScale=function(e){for(var t,n=1,i=[1,2,5,10,20,30],r=0;t=n*i[r],e.timeToPixels(t)<60;)++r===i.length&&(n*=60,r=0);return t},be.prototype._drawAxis=function(e,t){var n=t.getStartTime(),i=this._getAxisLabelScale(t),r=function(e,t){if(0===t)return 0;var n=1;return e<0&&(n=-1,e=-e),n*((Math.ceil(e)+t-1)/t|0)*t}(n,i),a=r-n,o=t.timeToPixels(a);e.setAttr("strokeStyle",this._axisGridlineColor),e.setAttr("lineWidth",1),e.setAttr("font",this._axisLabelFont),e.setAttr("fillStyle",this._axisLabelColor),e.setAttr("textAlign","left"),e.setAttr("textBaseline","bottom");for(var s=t.getWidth(),u=t.getHeight(),l=r;;){var h=o+t.timeToPixels(l-r);if(h>=s)break;if(this._axisTopMarkerHeight>0&&(e.beginPath(),e.moveTo(h+.5,0),e.lineTo(h+.5,0+this._axisTopMarkerHeight),e.stroke()),this._axisBottomMarkerHeight&&(e.beginPath(),e.moveTo(h+.5,u),e.lineTo(h+.5,u-this._axisBottomMarkerHeight),e.stroke()),this._showAxisLabels){var c=this._formatAxisTime(l),d=h-e.measureText(c).width/2,p=u-1-this._axisBottomMarkerHeight;d>=0&&e.fillText(c,d,p)}l+=i}},_e.prototype.getViewOptions=function(){return this._viewOptions},_e.prototype.getWaveformData=function(){return this._data},_e.prototype.setWaveformData=function(e){this._data=e},_e.prototype.timeToPixels=function(e){return Math.floor(e*this._data.sample_rate/this._data.scale)},_e.prototype.pixelsToTime=function(e){return e*this._data.scale/this._data.sample_rate},_e.prototype.pixelOffsetToTime=function(e){return(this._frameOffset+e)*this._data.scale/this._data.sample_rate},_e.prototype.timeToPixelOffset=function(e){return Math.floor(e*this._data.sample_rate/this._data.scale)-this._frameOffset},_e.prototype.getFrameOffset=function(){return this._frameOffset},_e.prototype.getWidth=function(){return this._width},_e.prototype.getHeight=function(){return this._height},_e.prototype.getStartTime=function(){return this.pixelOffsetToTime(0)},_e.prototype.getEndTime=function(){return this.pixelOffsetToTime(this._width)},_e.prototype._getDuration=function(){return this._peaks.player.getDuration()},_e.prototype._createWaveform=function(){this._waveformLayer=new(r().Layer)({listening:!1}),this._createWaveformShapes(),this._stage.add(this._waveformLayer)},_e.prototype._createWaveformShapes=function(){if(this._waveformShape||(this._waveformShape=new de({color:this._waveformColor,view:this}),this._waveformShape.addToLayer(this._waveformLayer)),this._playedWaveformColor&&!this._playedWaveformShape){var e=this._peaks.player.getCurrentTime();this._playedSegment={startTime:0,endTime:e},this._unplayedSegment={startTime:e,endTime:this._getDuration()},this._waveformShape.setSegment(this._unplayedSegment),this._playedWaveformShape=new de({color:this._playedWaveformColor,view:this,segment:this._playedSegment}),this._playedWaveformShape.addToLayer(this._waveformLayer)}},_e.prototype.setWaveformColor=function(e){this._waveformColor=e,this._waveformShape.setWaveformColor(e)},_e.prototype.setPlayedWaveformColor=function(e){this._playedWaveformColor=e,e?(this._playedWaveformShape||this._createWaveformShapes(),this._playedWaveformShape.setWaveformColor(e)):this._playedWaveformShape&&this._destroyPlayedWaveformShape()},_e.prototype._destroyPlayedWaveformShape=function(){this._waveformShape.setSegment(null),this._playedWaveformShape.destroy(),this._playedWaveformShape=null,this._playedSegment=null,this._unplayedSegment=null},_e.prototype._createAxisLabels=function(){this._axisLayer=new(r().Layer)({listening:!1}),this._axis=new be(this,this._viewOptions),this._axis.addToLayer(this._axisLayer),this._stage.add(this._axisLayer)},_e.prototype.showAxisLabels=function(e,t){this._axis.showAxisLabels(e,t),this._axisLayer.draw()},_e.prototype.showPlayheadTime=function(e){this._playheadLayer.showPlayheadTime(e)},_e.prototype.setTimeLabelPrecision=function(e){this._timeLabelPrecision=e,this._playheadLayer.updatePlayheadText()},_e.prototype.formatTime=function(e){return this._formatPlayheadTime(e)},_e.prototype.setAmplitudeScale=function(e){if(!_(e)||"number"!=typeof(t=e)||t!=t||t===1/0||t===-1/0)throw new Error("view.setAmplitudeScale(): Scale must be a valid number");var t;this._amplitudeScale=e,this.drawWaveformLayer(),this._segmentsLayer&&this._segmentsLayer.draw()},_e.prototype.getAmplitudeScale=function(){return this._amplitudeScale},_e.prototype.enableSeek=function(e){this._enableSeek=e},_e.prototype.isSeekEnabled=function(){return this._enableSeek},_e.prototype._onClick=function(e){this._clickHandler(e,"click")},_e.prototype._onDblClick=function(e){this._clickHandler(e,"dblclick")},_e.prototype._onContextMenu=function(e){this._clickHandler(e,"contextmenu")},_e.prototype._clickHandler=function(e,t){var n=!0;if(e.target!==this._stage){var i=k(e.target);if(i)if("point-marker"===i.attrs.name){var r=i.getAttr("point");r&&this._peaks.emit("points."+t,{point:r,evt:e.evt,preventViewEvent:function(){n=!1}})}else if("segment-overlay"===i.attrs.name){var a=i.getAttr("segment");if(a){var o={segment:a,evt:e.evt,preventViewEvent:function(){n=!1}};this._segmentsLayer&&this._segmentsLayer.segmentClicked(t,o)}}}if(n){var s=e.evt.layerX,u=this.pixelOffsetToTime(s),l=this.getName();this._peaks.emit(l+"."+t,{time:u,evt:e.evt})}},_e.prototype.updatePlayheadTime=function(e){this._playheadLayer.updatePlayheadTime(e)},_e.prototype.playheadPosChanged=function(e){this._playedWaveformShape&&(this._playedSegment.endTime=e,this._unplayedSegment.startTime=e,this.drawWaveformLayer())},_e.prototype.drawWaveformLayer=function(){this._waveformLayer.draw()},_e.prototype.enableMarkerEditing=function(e){this._segmentsLayer&&this._segmentsLayer.enableEditing(e),this._pointsLayer&&this._pointsLayer.enableEditing(e)},_e.prototype.fitToContainer=function(){if(0!==this._container.clientWidth||0!==this._container.clientHeight){var e=!1;this._container.clientWidth!==this._width&&(this._width=this._container.clientWidth,this._stage.setWidth(this._width),e=this.containerWidthChange()),this._container.clientHeight!==this._height&&(this._height=this._container.clientHeight,this._stage.height(this._height),this._waveformShape.fitToView(),this._playheadLayer.fitToView(),this._segmentsLayer&&this._segmentsLayer.fitToView(),this._pointsLayer&&this._pointsLayer.fitToView(),this.containerHeightChange()),e&&this.updateWaveform(this._frameOffset)}},_e.prototype.destroy=function(){this._playheadLayer.destroy(),this._segmentsLayer&&this._segmentsLayer.destroy(),this._pointsLayer&&this._pointsLayer.destroy(),this._stage&&(this._stage.destroy(),this._stage=null)},we.prototype._mouseDown=function(e){var t=null;if("mousedown"!==e.type||0===e.evt.button){var n=k(e.target);if(n){if("point-marker"===n.attrs.name||"segment-marker"===n.attrs.name)return;"segment-overlay"===n.attrs.name&&(t=n)}if(this._lastMouseClientX=Math.floor("touchstart"===e.type?e.evt.touches[0].clientX:e.evt.clientX),this._handlers.onMouseDown){var i=this._getMousePosX(this._lastMouseClientX);this._handlers.onMouseDown(i,t)}window.addEventListener("mousemove",this._mouseMove,{capture:!1,passive:!0}),window.addEventListener("touchmove",this._mouseMove,{capture:!1,passive:!0}),window.addEventListener("mouseup",this._mouseUp,{capture:!1,passive:!0}),window.addEventListener("touchend",this._mouseUp,{capture:!1,passive:!0}),window.addEventListener("blur",this._mouseUp,{capture:!1,passive:!0})}},we.prototype._mouseMove=function(e){var t=Math.floor("touchmove"===e.type?e.changedTouches[0].clientX:e.clientX);if(t!==this._lastMouseClientX&&(this._lastMouseClientX=t,this._dragging=!0,this._handlers.onMouseMove)){var n=this._getMousePosX(t);this._handlers.onMouseMove(n)}},we.prototype._mouseUp=function(e){var t;if("touchend"===e.type?(t=Math.floor(e.changedTouches[0].clientX),e.cancelable&&e.preventDefault()):t=Math.floor(e.clientX),this._handlers.onMouseUp){var n=this._getMousePosX(t);this._handlers.onMouseUp(n)}window.removeEventListener("mousemove",this._mouseMove,{capture:!1}),window.removeEventListener("touchmove",this._mouseMove,{capture:!1}),window.removeEventListener("mouseup",this._mouseUp,{capture:!1}),window.removeEventListener("touchend",this._mouseUp,{capture:!1}),window.removeEventListener("blur",this._mouseUp,{capture:!1}),this._dragging=!1},we.prototype._getMousePosX=function(e){return e-this._stage.getContainer().getBoundingClientRect().left},we.prototype.isDragging=function(){return this._dragging},we.prototype.destroy=function(){this._stage.off("mousedown",this._mouseDown),this._stage.off("touchstart",this._mouseDown)},Se.prototype._onMouseDown=function(e){this._seek(e)},Se.prototype._onMouseMove=function(e){this._seek(e)},Se.prototype._seek=function(e){if(this._view.isSeekEnabled()){e=v(e,0,this._width);var t=this._view.pixelsToTime(e),n=this._peaks.player.getDuration();t>n&&(t=n),this._view.updatePlayheadTime(t),this._peaks.player.seek(t)}},Se.prototype.destroy=function(){this._mouseDragHandler.destroy()},Te.prototype=Object.create(_e.prototype),Te.prototype.initWaveform=function(){0!==this._width&&this._resampleAndSetWaveformData(this._originalWaveformData,this._width)},Te.prototype.initHighlightLayer=function(){this._highlightLayer=new oe(this,this._viewOptions),this._highlightLayer.addToStage(this._stage)},Te.prototype.isSegmentDraggingEnabled=function(){return!1},Te.prototype.getName=function(){return"overview"},Te.prototype._onTimeUpdate=function(e){this._playheadLayer.updatePlayheadTime(e)},Te.prototype._onPlaying=function(e){this._playheadLayer.updatePlayheadTime(e)},Te.prototype._onPause=function(e){this._playheadLayer.stop(e)},Te.prototype._onZoomviewDisplaying=function(e,t){this.showHighlight(e,t)},Te.prototype.showHighlight=function(e,t){this._highlightLayer.showHighlight(e,t)},Te.prototype.setWaveformData=function(e){this._originalWaveformData=e,0!==this._width?this._resampleAndSetWaveformData(e,this._width):this._data=e,this.updateWaveform()},Te.prototype._resampleAndSetWaveformData=function(e,t){try{return this._data=e.resample({width:t}),!0}catch(t){return this._data=e,!1}},Te.prototype.removeHighlightRect=function(){this._highlightLayer.removeHighlight()},Te.prototype.updateWaveform=function(){this._waveformLayer.draw(),this._axisLayer.draw();var e=this._peaks.player.getCurrentTime();this._playheadLayer.updatePlayheadTime(e),this._highlightLayer.updateHighlight();var t=this.pixelsToTime(this._width);this._pointsLayer&&this._pointsLayer.updatePoints(0,t),this._segmentsLayer&&this._segmentsLayer.updateSegments(0,t)},Te.prototype.containerWidthChange=function(){return this._resampleAndSetWaveformData(this._originalWaveformData,this._width)},Te.prototype.containerHeightChange=function(){this._highlightLayer.fitToView()},Te.prototype.destroy=function(){this._peaks.off("player.playing",this._onPlaying),this._peaks.off("player.pause",this._onPause),this._peaks.off("player.timeupdate",this._onTimeUpdate),this._peaks.off("zoomview.displaying",this._onZoomviewDisplaying),this._mouseDragHandler.destroy(),_e.prototype.destroy.call(this)},Ae.prototype.isDragging=function(){return this._mouseDragHandler.isDragging()},Ae.prototype._reset=function(){this._insertSegment=null,this._insertSegmentShape=null,this._segmentIsDraggable=!1,this._peaks.segments.setInserting(!1)},Ae.prototype._onMouseDown=function(e,t){if(this._reset(),this._segment=t,this._segment){if("overlap"!==this._view.getSegmentDragMode())return;this._segmentIsDraggable=this._segment.draggable(),this._segment.draggable(!1)}var n=this._view.pixelsToTime(e+this._view.getFrameOffset());this._peaks.segments.setInserting(!0),this._insertSegment=this._peaks.segments.add({startTime:n,endTime:n,editable:!0}),this._insertSegmentShape=this._view._segmentsLayer.getSegmentShape(this._insertSegment),this._insertSegmentShape&&(this._insertSegmentShape.moveMarkersToTop(),this._insertSegmentShape.startDrag())},Ae.prototype._onMouseMove=function(){},Ae.prototype._onMouseUp=function(){this._insertSegment&&(this._insertSegmentShape&&(this._insertSegmentShape.stopDrag(),this._insertSegmentShape=null),this._segment&&this._segmentIsDraggable&&this._segment.draggable(!0),this._peaks.emit("segments.insert",{segment:this._insertSegment}),this._peaks.segments.setInserting(!1))},Ae.prototype.destroy=function(){this._mouseDragHandler.destroy()},Ee.prototype.isDragging=function(){return this._mouseDragHandler.isDragging()},Ee.prototype._onMouseDown=function(e,t){this._seeking=!1,t&&!t.attrs.draggable?this._segment=null:this._segment=t;var n=this._view.getPlayheadOffset();if(this._view.isSeekEnabled()&&Math.abs(e-n)<=this._view.getPlayheadClickTolerance()&&(this._seeking=!0,this._segment&&(this._segmentIsDraggable=this._segment.draggable(),this._segment.draggable(!1))),this._seeking){e=v(e,0,this._view.getWidth());var i=this._view.pixelsToTime(e+this._view.getFrameOffset());this._seek(i)}else this._initialFrameOffset=this._view.getFrameOffset(),this._mouseDownX=e},Ee.prototype._onMouseMove=function(e){if(!this._segment||this._seeking)if(this._seeking){e=v(e,0,this._view.getWidth());var t=this._view.pixelsToTime(e+this._view.getFrameOffset());this._seek(t)}else if(!this._view.isAutoZoom()){var n=this._mouseDownX-e,i=this._initialFrameOffset+n;i!==this._initialFrameOffset&&this._view.updateWaveform(i)}},Ee.prototype._onMouseUp=function(){if(!this._seeking&&this._view._enableSeek&&!this._mouseDragHandler.isDragging()){var e=this._view.pixelOffsetToTime(this._mouseDownX);this._seek(e)}this._segment&&this._seeking&&this._segmentIsDraggable&&this._segment.draggable(!0)},Ee.prototype._seek=function(e){var t=this._peaks.player.getDuration();e>t&&(e=t),this._view.updatePlayheadTime(e),this._peaks.player.seek(e)},Ee.prototype.destroy=function(){this._mouseDragHandler.destroy()},xe.prototype=Object.create(_e.prototype),xe.prototype.initWaveform=function(){this._enableWaveformCache=this._options.waveformCache,this._initWaveformCache();var e=this._peaks.zoom.getZoomLevel();this._resampleData({scale:e})},xe.prototype._initWaveformCache=function(){this._enableWaveformCache&&(this._waveformData=new Map,this._waveformData.set(this._originalWaveformData.scale,this._originalWaveformData),this._waveformScales=[this._originalWaveformData.scale])},xe.prototype.initHighlightLayer=function(){},xe.prototype.setWheelMode=function(e,t){t||(t={}),e===this._wheelMode&&t.captureVerticalScroll===this._captureVerticalScroll||(this._stage.off("wheel"),this._wheelMode=e,this._captureVerticalScroll=t.captureVerticalScroll,"scroll"!==e)||(t.captureVerticalScroll?this._stage.on("wheel",this._onWheelCaptureVerticalScroll):this._stage.on("wheel",this._onWheel))},xe.prototype._onWheel=function(e){var t,n=e.evt;if(n.shiftKey)if(0!==n.deltaY)t=n.deltaY;else{if(0===n.deltaX)return;t=n.deltaX}else{if(Math.abs(n.deltaX)=this._frameOffset+this._width-this._autoScrollOffset||t=0&&a=this._zoomLevels.length&&(e=this._zoomLevels.length-1),e<0&&(e=0),t||e!==this._zoomLevelIndex){this._zoomLevelIndex=e;var n=this._peaks.views.getView("zoomview");n&&n.setZoom({scale:this._zoomLevels[e]})}},Ie.prototype.getZoom=function(){return this._zoomLevelIndex},Ie.prototype.getZoomLevel=function(){return this._zoomLevels[this._zoomLevelIndex]};var Me="withCredentials"in new XMLHttpRequest;function Pe(e){this._peaks=e}function Le(e){var t=e.getResponseHeader("content-range");if(!t)return!1;var n=t.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(n&&4===n.length){var i=parseInt(n[1],10),r=parseInt(n[2],10),a=parseInt(n[3],10);return 0===i&&r+1===a}return!1}function De(){return d.call(this),this.options={zoomLevels:[512,1024,2048,4096],waveformCache:!0,mediaElement:null,mediaUrl:null,dataUri:null,withCredentials:!1,waveformData:null,webAudio:null,nudgeIncrement:1,pointMarkerColor:"#39cccc",createSegmentMarker:ie,createSegmentLabel:re,createPointMarker:ae,logger:console.error.bind(console)},this}Pe.prototype.init=function(e,t){if(!(e.dataUri&&(e.webAudio||e.audioContext)||e.waveformData&&(e.webAudio||e.audioContext)||e.dataUri&&e.waveformData))return e.audioContext&&(this._peaks._logger("Peaks.init(): The audioContext option is deprecated, please pass a webAudio object instead"),e.webAudio={audioContext:e.audioContext}),e.dataUri?this._getRemoteWaveformData(e,t):e.waveformData?this._buildWaveformFromLocalData(e,t):e.webAudio?e.webAudio.audioBuffer?this._buildWaveformDataFromAudioBuffer(e,t):this._buildWaveformDataUsingWebAudio(e,t):void t(new Error("Peaks.init(): You must pass an audioContext, or dataUri, or waveformData to render waveform data"));t(new TypeError("Peaks.init(): You may only pass one source (webAudio, dataUri, or waveformData) to render waveform data."))},Pe.prototype._getRemoteWaveformData=function(e,t){var n,i=this,r=null,a=null;S(e.dataUri)?(r=e.dataUri,["ArrayBuffer","JSON"].some(function(e){if(window[e])return a=e.toLowerCase(),n=r[a],Boolean(n)}),n?(i._xhr=i._createXHR(n,a,e.withCredentials,function(e){if(4===this.readyState)if(200===this.status||206===this.status&&Le(this)){i._xhr=null;var n=l.A.create(e.target.response);1===n.channels||2===n.channels?8===n.bits?t(null,n):t(new Error("Peaks.init(): 16-bit waveform data is not supported")):t(new Error("Peaks.init(): Only mono or stereo waveforms are currently supported"))}else t(new Error("Unable to fetch remote data. HTTP status "+this.status))},function(){t(new Error("XHR failed"))},function(){t(new Error("XHR aborted"))}),i._xhr.send()):t(new Error("Peaks.init(): Unable to determine a compatible dataUri format for this browser"))):t(new TypeError("Peaks.init(): The dataUri option must be an object"))},Pe.prototype._buildWaveformFromLocalData=function(e,t){var n,i=null,r=null;if(S(e.waveformData))if(S((i=e.waveformData).json)?r=i.json:(n=i.arraybuffer,Object.prototype.toString.call(n).includes("ArrayBuffer")&&(r=i.arraybuffer)),r)try{var a=l.A.create(r);if(1!==a.channels&&2!==a.channels)return void t(new Error("Peaks.init(): Only mono or stereo waveforms are currently supported"));if(8!==a.bits)return void t(new Error("Peaks.init(): 16-bit waveform data is not supported"));t(null,a)}catch(e){t(e)}else t(new Error("Peaks.init(): Unable to determine a compatible waveformData format"));else t(new Error("Peaks.init(): The waveformData option must be an object"))},Pe.prototype._buildWaveformDataUsingWebAudio=function(e,t){var n=this,i=window.AudioContext||window.webkitAudioContext;if(e.webAudio.audioContext instanceof i){var r=e.webAudio;r.scale!==e.zoomLevels[0]&&(r.scale=e.zoomLevels[0]);var a=n._peaks.options.mediaElement.currentSrc;a?n._requestAudioAndBuildWaveformData(a,r,e.withCredentials,t):n._peaks.once("player.canplay",function(){n._requestAudioAndBuildWaveformData(n._peaks.options.mediaElement.currentSrc,r,e.withCredentials,t)})}else t(new TypeError("Peaks.init(): The webAudio.audioContext option must be a valid AudioContext"))},Pe.prototype._buildWaveformDataFromAudioBuffer=function(e,t){var n=e.webAudio;n.scale!==e.zoomLevels[0]&&(n.scale=e.zoomLevels[0]);var i={audio_buffer:n.audioBuffer,split_channels:n.multiChannel,scale:n.scale,disable_worker:!0};l.A.createFromAudio(i,t)},Pe.prototype._requestAudioAndBuildWaveformData=function(e,t,n,i){var r=this;e?(r._xhr=r._createXHR(e,"arraybuffer",n,function(e){if(4===this.readyState)if(200===this.status||206===this.status&&Le(this)){r._xhr=null;var n={audio_context:t.audioContext,array_buffer:e.target.response,split_channels:t.multiChannel,scale:t.scale};l.A.createFromAudio(n,i)}else i(new Error("Unable to fetch remote data. HTTP status "+this.status))},function(){i(new Error("XHR failed"))},function(){i(new Error("XHR aborted"))}),r._xhr.send()):r._peaks._logger("Peaks.init(): The mediaElement src is invalid")},Pe.prototype.abort=function(){this._xhr&&this._xhr.abort()},Pe.prototype._createXHR=function(e,t,n,i,r,a){var o=new XMLHttpRequest;if(o.open("GET",e,!0),Me)try{o.responseType=t}catch(e){}return o.onload=i,o.onerror=r,Me&&n&&(o.withCredentials=!0),o.addEventListener("abort",a),o},De.prototype=Object.create(d.prototype);var Re={playheadColor:"#111111",playheadTextColor:"#aaaaaa",playheadBackgroundColor:"transparent",playheadPadding:2,playheadWidth:1,axisGridlineColor:"#cccccc",showAxisLabels:!0,axisTopMarkerHeight:10,axisBottomMarkerHeight:10,axisLabelColor:"#aaaaaa",fontFamily:"sans-serif",fontSize:11,fontStyle:"normal",timeLabelPrecision:2,enablePoints:!0,enableSegments:!0},Ne={playheadClickTolerance:3,waveformColor:"rgba(0, 225, 128, 1)",wheelMode:"none",autoScroll:!0,autoScrollOffset:100,enableEditing:!0},Oe={waveformColor:"rgba(0, 0, 0, 0.2)",highlightColor:"#aaaaaa",highlightStrokeColor:"transparent",highlightOpacity:.3,highlightOffset:11,highlightCornerRadius:2,enableEditing:!1},Ue={overlay:!1,markers:!0,startMarkerColor:"#aaaaaa",endMarkerColor:"#aaaaaa",waveformColor:"#0074d9",overlayColor:"#ff0000",overlayOpacity:.3,overlayBorderColor:"#ff0000",overlayBorderWidth:2,overlayCornerRadius:5,overlayOffset:25,overlayLabelAlign:"left",overlayLabelVerticalAlign:"top",overlayLabelPadding:8,overlayLabelColor:"#000000",overlayFontFamily:"sans-serif",overlayFontSize:12,overlayFontStyle:"normal"},Be={color:"#888888",minWidth:50};function Fe(e,t){for(var n in t)y(t,n)&&y(e,n)&&(e[n]=t[n]);return e}function je(e){var t=e.zoomview.container,n=e.overview.container;return x(t)||x(n)?t&&(t.clientWidth<=0||t.clientHeight<=0)?new Error("Peaks.init(): The zoomview container must be visible and have non-zero width and height"):n&&(n.clientWidth<=0||n.clientHeight<=0)?new Error("Peaks.init(): The overview container must be visible and have non-zero width and height"):void 0:new TypeError("Peaks.init(): The zoomview and/or overview container options must be valid HTML elements")}De.init=function(e,t){var n=new De,i=n._setOptions(e);if(i||(i=je(n.options)),!i){var r=null;if(n.options.scrollbar){if(!x(r=n.options.scrollbar.container))return void t(new TypeError("Peaks.init(): The scrollbar container option must be a valid HTML element"));if(r.clientWidth<=0)return void t(new TypeError("Peaks.init(): The scrollbar container must be visible and have non-zero width"))}e.keyboard&&(n._keyboardHandler=new J(n));var a=e.player?e.player:new Q(n.options.mediaElement);return n.player=new ee(n,a),n.segments=new Y(n),n.points=new V(n),n.zoom=new Ie(n,n.options.zoomLevels),n.views=new ke(n),n._waveformBuilder=new Pe(n),n.player.init(n).then(function(){n._waveformBuilder.init(n.options,function(i,a){if(i)t&&t(i);else if(i=je(n.options))t&&t(i);else{n._waveformBuilder=null,n._waveformData=a;var o=n.options.zoomview.container,s=n.options.overview.container;s&&n.views.createOverview(s),o&&n.views.createZoomview(o),r&&n.views.createScrollbar(r),e.segments&&n.segments.add(e.segments),e.points&&n.points.add(e.points),e.emitCueEvents&&(n._cueEmitter=new O(n)),setTimeout(function(){n.emit("peaks.ready")},0),t(null,n)}})}).catch(function(e){t&&t(e)}),n}t(i)},De.prototype._setOptions=function(e){if(!S(e))return new TypeError("Peaks.init(): The options parameter should be an object");if(!e.player){if(!e.mediaElement)return new Error("Peaks.init(): Missing mediaElement option");if(!(e.mediaElement instanceof HTMLMediaElement))return new TypeError("Peaks.init(): The mediaElement option should be an HTMLMediaElement")}return e.logger&&"function"!=typeof e.logger?new TypeError("Peaks.init(): The logger option should be a function"):e.segments&&!Array.isArray(e.segments)?new TypeError("Peaks.init(): options.segments must be an array of segment objects"):e.points&&!Array.isArray(e.points)?new TypeError("Peaks.init(): options.points must be an array of point objects"):(Fe(this.options,e),this.options.overview=function(e){var t={};return e.overview&&e.overview.showPlayheadTime&&(t.showPlayheadTime=e.overview.showPlayheadTime),["container","waveformColor","playedWaveformColor","playheadColor","playheadTextColor","playheadBackgroundColor","playheadPadding","playheadWidth","formatPlayheadTime","timeLabelPrecision","axisGridlineColor","showAxisLabels","axisTopMarkerHeight","axisBottomMarkerHeight","axisLabelColor","formatAxisTime","fontFamily","fontSize","fontStyle","highlightColor","highlightStrokeColor","highlightOpacity","highlightCornerRadius","highlightOffset","enablePoints","enableSegments","enableEditing"].forEach(function(n){e.overview&&y(e.overview,n)?t[n]=e.overview[n]:y(e,n)?t[n]=e[n]:y(t,n)||(y(Oe,n)?t[n]=Oe[n]:y(Re,n)&&(t[n]=Re[n]))}),t}(e),this.options.zoomview=function(e){var t={};return e.showPlayheadTime?t.showPlayheadTime=e.showPlayheadTime:e.zoomview&&e.zoomview.showPlayheadTime&&(t.showPlayheadTime=e.zoomview.showPlayheadTime),["container","waveformColor","playedWaveformColor","playheadColor","playheadTextColor","playheadBackgroundColor","playheadPadding","playheadWidth","formatPlayheadTime","playheadClickTolerance","timeLabelPrecision","axisGridlineColor","showAxisLabels","axisTopMarkerHeight","axisBottomMarkerHeight","axisLabelColor","formatAxisTime","fontFamily","fontSize","fontStyle","wheelMode","autoScroll","autoScrollOffset","enablePoints","enableSegments","enableEditing"].forEach(function(n){e.zoomview&&y(e.zoomview,n)?t[n]=e.zoomview[n]:y(e,n)?t[n]=e[n]:y(t,n)||(y(Ne,n)?t[n]=Ne[n]:y(Re,n)&&(t[n]=Re[n]))}),t}(e),this.options.scrollbar=function(e){if(!y(e,"scrollbar"))return null;var t={};return["container","color","minWidth"].forEach(function(n){y(e.scrollbar,n)?t[n]=e.scrollbar[n]:t[n]=Be[n]}),t}(e),function(e,t){e.segmentOptions={},b(e.segmentOptions,Ue),t.segmentOptions&&Fe(e.segmentOptions,t.segmentOptions),e.zoomview.segmentOptions={},b(e.zoomview.segmentOptions,e.segmentOptions),t.zoomview&&t.zoomview.segmentOptions&&Fe(e.zoomview.segmentOptions,t.zoomview.segmentOptions),e.overview.segmentOptions={},b(e.overview.segmentOptions,e.segmentOptions),t.overview&&t.overview.segmentOptions&&Fe(e.overview.segmentOptions,t.overview.segmentOptions)}(this.options,e),Array.isArray(this.options.zoomLevels)?0===this.options.zoomLevels.length?new Error("Peaks.init(): The zoomLevels array must not be empty"):function(e){if(0===e.length)return!0;for(var t=e[0],n=1;n=e[n])return!1;t=e[n]}return!0}(this.options.zoomLevels)?void(this._logger=this.options.logger):new Error("Peaks.init(): The zoomLevels array must be sorted in ascending order"):new TypeError("Peaks.init(): The zoomLevels option should be an array"))},De.prototype.setSource=function(e,t){var n=this;n.player._setSource(e).then(function(){e.zoomLevels||(e.zoomLevels=n.options.zoomLevels),n._waveformBuilder=new Pe(n),n._waveformBuilder.init(e,function(i,r){i?t(i):(n._waveformBuilder=null,n._waveformData=r,["overview","zoomview"].forEach(function(e){var t=n.views.getView(e);t&&t.setWaveformData(r)}),n.zoom.setZoomLevels(e.zoomLevels),t())})}).catch(function(e){t(e)})},De.prototype.getWaveformData=function(){return this._waveformData},De.prototype.destroy=function(){this._waveformBuilder&&this._waveformBuilder.abort(),this._keyboardHandler&&this._keyboardHandler.destroy(),this.views&&this.views.destroy(),this.player&&this.player.destroy(),this._cueEmitter&&this._cueEmitter.destroy()}},8604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HitCanvas=t.SceneCanvas=t.Canvas=void 0;const i=n(4060),r=n(9869),a=n(8871);let o;class s{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||a.Konva.pixelRatio||function(){if(o)return o;const e=i.Util.createCanvasElement(),t=e.getContext("2d");return o=(a.Konva._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),i.Util.releaseCanvas(e),o}();this.pixelRatio=t,this._canvas=i.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return i.Util.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}t.Canvas=s,t.SceneCanvas=class extends s{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new r.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},t.HitCanvas=class extends s{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new r.HitContext(this),this.setSize(e.width,e.height)}}},8665:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const i=n(4060),r=n(9696),a=n(6536),o=n(8871),s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},u=["fill","stroke","shadowColor"];let l=0;class h{constructor(e,t,n,i,r,a,o){this.prop=e,this.propFunc=t,this.begin=i,this._pos=i,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=o,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=r-this.begin,this.pause()}fire(e){const t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class c{constructor(e){const n=this,a=e.node,u=a._id,d=e.easing||t.Easings.Linear,p=!!e.yoyo;let f,g;f=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=a,this._id=l++;const m=a.getLayer()||(a instanceof o.Konva.Stage?a.getLayers():null);for(g in m||i.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new r.Animation(function(){n.tween.onEnterFrame()},m),this.tween=new h(g,function(e){n._tweenFunc(e)},d,0,1,1e3*f,p),this._addListeners(),c.attrs[u]||(c.attrs[u]={}),c.attrs[u][this._id]||(c.attrs[u][this._id]={}),c.tweens[u]||(c.tweens[u]={}),e)void 0===s[g]&&this._addAttr(g,e[g]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){const n=this.node,r=n._id;let a,o,s,l,h;const d=c.tweens[r][e];d&&delete c.attrs[r][d][e];let p=n.getAttr(e);if(i.Util._isArray(t))if(a=[],o=Math.max(t.length,p.length),"points"===e&&t.length!==p.length&&(t.length>p.length?(l=p,p=i.Util._prepareArrayForTween(p,t,n.closed())):(s=t,t=i.Util._prepareArrayForTween(t,p,n.closed()))),0===e.indexOf("fill"))for(let e=0;e{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const e=this.node,t=c.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const e=this.node,t=c.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const e=this.node._id,t=this._id,n=c.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const t in n)delete c.tweens[e][t];delete c.attrs[e][t],c.tweens[e]&&(0===Object.keys(c.tweens[e]).length&&delete c.tweens[e],0===Object.keys(c.attrs[e]).length&&delete c.attrs[e])}}t.Tween=c,c.attrs={},c.tweens={},a.Node.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new c(e).play()},t.Easings={BackEaseIn(e,t,n,i){const r=1.70158;return n*(e/=i)*e*((r+1)*e-r)+t},BackEaseOut(e,t,n,i){const r=1.70158;return n*((e=e/i-1)*e*((r+1)*e+r)+1)+t},BackEaseInOut(e,t,n,i){let r=1.70158;return(e/=i/2)<1?n/2*(e*e*((1+(r*=1.525))*e-r))+t:n/2*((e-=2)*e*((1+(r*=1.525))*e+r)+2)+t},ElasticEaseIn(e,t,n,i,r,a){let o=0;return 0===e?t:1===(e/=i)?t+n:(a||(a=.3*i),!r||r(e/=i)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,n,i,r)=>i-t.Easings.BounceEaseOut(r-e,0,i,r)+n,BounceEaseInOut:(e,n,i,r)=>en*(e/=i)*e+t,EaseOut:(e,t,n,i)=>-n*(e/=i)*(e-2)+t,EaseInOut:(e,t,n,i)=>(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,i)=>n*(e/=i)*e*e*e*e+t,StrongEaseOut:(e,t,n,i)=>n*((e=e/i-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,i)=>(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,i)=>n*e/i+t}},8722:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCapturedShape=function(e){return r.get(e)},t.createEvent=o,t.hasPointerCapture=function(e,t){return r.get(e)===t},t.setPointerCapture=function(e,t){s(e),t.getStage()&&(r.set(e,t),a&&t._fire("gotpointercapture",o(new PointerEvent("gotpointercapture"))))},t.releaseCapture=s;const i=n(8871),r=new Map,a=void 0!==i.Konva._global.PointerEvent;function o(e){return{evt:e,pointerId:e.pointerId}}function s(e,t){const n=r.get(e);if(!n)return;const i=n.getStage();i&&i.content,r.delete(e),a&&n._fire("lostpointercapture",o(new PointerEvent("lostpointercapture")))}},8820:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,n,i){const r=e*this.size+t;this.data[r]=n,i&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},8871:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const i=Math.PI/180;t.glob=void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>t.Konva.angleDeg?e*i:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>t.Konva.DD.isDragging,isTransforming(){var e;return null===(e=t.Konva.Transformer)||void 0===e?void 0:e.isTransforming()},isDragReady:()=>!!t.Konva.DD.node,releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(e){t.glob.Konva=e}},t._registerNode=e=>{t.Konva[e.prototype.getClassName()]=e},t.Konva._injectGlobal(t.Konva)},9696:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Animation=void 0;const i=n(8871),r=n(4060),a=i.glob.performance&&i.glob.performance.now?function(){return i.glob.performance.now()}:function(){return(new Date).getTime()};class o{constructor(e,t){this.id=o.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:a(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){const t=this.layers,n=t.length;for(let i=0;i{const i=n(208),r=n(4357),a=n(1433),o=n(5822),s=n(4861),u=n(7044),l=n(6886),h=n(6320);function c(e){return unescape(encodeURIComponent(e)).length}function d(e,t,n){const i=[];let r;for(;null!==(r=e.exec(n));)i.push({data:r[0],index:r.index,mode:t,length:r[0].length});return i}function p(e){const t=d(u.NUMERIC,i.NUMERIC,e),n=d(u.ALPHANUMERIC,i.ALPHANUMERIC,e);let r,a;return l.isKanjiModeEnabled()?(r=d(u.BYTE,i.BYTE,e),a=d(u.KANJI,i.KANJI,e)):(r=d(u.BYTE_KANJI,i.BYTE,e),a=[]),t.concat(n,r,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,t){switch(t){case i.NUMERIC:return r.getBitsLength(e);case i.ALPHANUMERIC:return a.getBitsLength(e);case i.KANJI:return s.getBitsLength(e);case i.BYTE:return o.getBitsLength(e)}}function g(e,t){let n;const u=i.getBestModeForData(e);if(n=i.from(t,u),n!==i.BYTE&&n.bit=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[]))},t.rawSplit=function(e){return t.fromArray(p(e,l.isKanjiModeEnabled()))}},9869:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HitContext=t.SceneContext=t.Context=void 0;const i=n(4060),r=n(8871),a=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class o{constructor(e){this.canvas=e,r.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n,r,a,o,s=this.traceArr,u=s.length,l="";for(n=0;n"number"==typeof e?Math.floor(e):e)),l+="("+o.join(",")+")")):(l+=r.property,e||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){let t,n=this.traceArr;n.push(e),t=n.length,t>=100&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,i,r,a){this._context.arc(e,t,n,i,r,a)}arcTo(e,t,n,i,r){this._context.arcTo(e,t,n,i,r)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,i,r,a){this._context.bezierCurveTo(e,t,n,i,r,a)}clearRect(e,t,n,i){this._context.clearRect(e,t,n,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,i){return this._context.createLinearGradient(e,t,n,i)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,i,r,a){return this._context.createRadialGradient(e,t,n,i,r,a)}drawImage(e,t,n,i,r,a,o,s,u){const l=arguments,h=this._context;3===l.length?h.drawImage(e,t,n):5===l.length?h.drawImage(e,t,n,i,r):9===l.length&&h.drawImage(e,t,n,i,r,a,o,s,u)}ellipse(e,t,n,i,r,a,o,s){this._context.ellipse(e,t,n,i,r,a,o,s)}isPointInPath(e,t,n,i){return n?this._context.isPointInPath(n,e,t,i):this._context.isPointInPath(e,t,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,i){this._context.fillRect(e,t,n,i)}strokeRect(e,t,n,i){this._context.strokeRect(e,t,n,i)}fillText(e,t,n,i){i?this._context.fillText(e,t,n,i):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,i){return this._context.getImageData(e,t,n,i)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,i){this._context.rect(e,t,n,i)}roundRect(e,t,n,i,r){this._context.roundRect(e,t,n,i,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,i){this._context.quadraticCurveTo(e,t,n,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,i,r,a){this._context.setTransform(e,t,n,i,r,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,i){this._context.strokeText(e,t,n,i)}transform(e,t,n,i,r,a){this._context.transform(e,t,n,i,r,a)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e,t,n=this,r=a.length,o=this.setAttr;const s=function(e){let r,a=n[e];n[e]=function(){return t=function(e){const t=[],n=e.length,r=i.Util;for(let i=0;i{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},9953:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return n}}}}]); //# sourceMappingURL=DlfMediaVendor.js.map \ No newline at end of file From 2fb450751ba7c6a52dea0be7506ca89ff71a13b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=B6lzel?= Date: Thu, 31 Jul 2025 20:04:08 +0200 Subject: [PATCH 3/3] Add a Workflow for Webpack Build Production on Push and Check on Pull Request --- .../webpack-main-build-and-commit.yaml | 46 +++++++++++++++++++ .github/workflows/webpack-pr-build-check.yaml | 27 +++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/webpack-main-build-and-commit.yaml create mode 100644 .github/workflows/webpack-pr-build-check.yaml diff --git a/.github/workflows/webpack-main-build-and-commit.yaml b/.github/workflows/webpack-main-build-and-commit.yaml new file mode 100644 index 0000000000..dbe5de4f22 --- /dev/null +++ b/.github/workflows/webpack-main-build-and-commit.yaml @@ -0,0 +1,46 @@ +name: Webpack Build Production & Commit (Node.js) +description: 'This workflow triggers a Node.js build on push or manually: it reads the Node version from Build/.nvmrc, checks out the code, installs dependencies via npm ci, runs the production Webpack build, and commits the built assets back to the repository.' + +on: + push: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build-and-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: 'Build/.nvmrc' + + - name: Install Dependencies from package-lock.json + working-directory: Build + run: npm ci + + - name: Run Webpack Build for Production + working-directory: Build + run: npm run build + + # needs to be adjusted after changes in the webpack.config output paths + # filename: 'JavaScript/DlfMediaPlayer/[name].js' + # filename: "Css/[name].css", + - name: Commit and Push Built Assets + run: | + git config --global user.name "webpack-builder[bot]" + git config --global user.email "webpack-builder[bot]@users.noreply.github.com" + + git add Resources/Public/JavaScript/DlfMediaPlayer + git add Resources/Public/Css + + if git diff --cached --quiet; then + echo "No changes to commit." + else + git commit -m "build: update webpack built assets [ci skip]" + git push + fi diff --git a/.github/workflows/webpack-pr-build-check.yaml b/.github/workflows/webpack-pr-build-check.yaml new file mode 100644 index 0000000000..99a44763fb --- /dev/null +++ b/.github/workflows/webpack-pr-build-check.yaml @@ -0,0 +1,27 @@ +name: Webpack Build Check (Node.js) +description: 'This workflow triggers a Node.js build on a Pull Request to main to check the workflow: it reads the Node version from Build/.nvmrc, checks out the code, installs dependencies via npm ci, and runs the production Webpack build.' + +on: + pull_request: + branches: [ "main" ] + +jobs: + build-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: 'Build/.nvmrc' + + - name: Install Dependencies from package-lock.json + working-directory: Build + run: npm ci + + - name: Run Webpack Build for Production (Check Only) + working-directory: Build + run: npm run build