Files
ArtPlayer/docs/compiled/artplayer-proxy-mediabunny.legacy.js
T
Harvey Zhao 99ad0d7b93 Update package.json
Remove options section from README for clarity

Add 'waiting' event emission during seeking in mediabunnyEngine

This change emits a 'waiting' event when the seeking process begins,
improving the event handling and allowing for better synchronization
during media playback.

fix(audioEngine): adjust audio context suspension timing for improved playback responsiveness

refactor(mediabunnyVideoShim): remove redundant width and height getters; enhance poster setter and add setAttribute method

feat: initialize artplayer-proxy-mediabunny with essential files and structure

feat: implement audio and video engines for mediabunny integration

- Added audioEngine.js to handle audio playback using MediaBunny.
- Created mediabunnyEngine.js to manage both audio and video playback.
- Implemented videoEngine.js for rendering video on a canvas.
- Introduced canvasProxy.js to create a canvas element and manage its methods.
- Developed mediabunnyVideoShim.js to bridge ArtPlayer and MediaBunny functionalities.
- Added videoEvents.js for custom event handling related to video playback.
- Included a utility function clamp.js for value clamping.

feat: add playback rate control to audio and video engines

- Introduced playback rate management in the audio engine, allowing dynamic adjustment of playback speed.
- Updated the mediabunny engine to expose the new setPlaybackRate method.
- Enhanced the mediabunny video shim to support playback rate adjustments, including getter and setter for playbackRate.
- Added event emission for rate changes to ensure proper handling in the application.

Enhance audio engine and video shim functionality

- Added a check to ensure the audio context is initialized before playing audio in the audio engine.
- Introduced a new 'playing' getter in the video shim to accurately reflect the playback state, indicating when the video is neither paused nor ended.

Refactor audio context initialization to handle errors and remove async/await

- Changed `ensureAudioContext` from async to synchronous to simplify error handling.
- Added a try-catch block to handle potential errors when creating the AudioContext with a specified sample rate.
- Updated calls to `ensureAudioContext` to remove unnecessary await statements.

Enhance Mediabunny Engine and Video Shim with State Management and Error Handling

- Added readyState, networkState, and error properties to the Mediabunny Engine for better state management.
- Implemented error handling during media loading, emitting appropriate events on error.
- Updated the Video Engine to emit a 'timeupdate' event for better synchronization.
- Extended the Mediabunny Video Shim to expose new properties (readyState, networkState, error) and methods for improved functionality.
- Added seekable property to the Video Shim to provide seekable range based on media duration.
- Implemented additional properties and methods in the Video Shim for autoplay, loop, controls, currentSrc, poster, preload, defaultMuted, and defaultPlaybackRate.
- Enhanced requestVideoFrameCallback and cancelVideoFrameCallback methods for better frame handling.

refactor: streamline audio and video engine implementations

- Updated audioEngine.js to improve readability and maintainability by using consistent formatting and simplifying function structures.
- Refactored mediabunnyEngine.js to enhance clarity and ensure consistent coding style.
- Enhanced videoEngine.js with improved async handling and clearer function definitions.
- Modified canvasProxy.js to maintain consistent formatting and improve readability.
- Updated mediabunnyVideoShim.js to streamline event handling and improve clarity.
- Refactored videoEvents.js for better readability and consistency in event listener management.
- Simplified clamp.js for improved readability.

feat: enhance audio and video loading with metadata callbacks

- Updated audioEngine to accept an optional onMetadata callback in the load function, which is triggered upon loading completion.
- Modified mediabunnyEngine to handle video and audio loading concurrently, emitting loadedmetadata and durationchange events only when both are ready.
- Enhanced videoEngine to include an onMetadata callback in the load function, ensuring metadata events are emitted appropriately.
- Implemented a throttling mechanism for the timeupdate event in videoEngine to reduce event emissions and improve performance.

feat: add seeking state and played property to mediabunny engine and video shim

- Introduced a `_seeking` state in the mediabunny engine to track seek operations.
- Emitted 'seeking' and 'seeked' events during seek operations.
- Added a `seeking` getter to expose the seeking state.
- Implemented a `played` property in the video shim to provide playback range information.
- Added `width` and `height` getters to the video shim for better video dimension access.
- Enhanced cross-origin handling in the video shim.

feat(audioEngine): enhance audio playback management with starvation detection

- Added an event emitter to notify when the audio context is waiting.
- Implemented a starvation check that suspends the audio context if playback is delayed.
- Introduced a mechanism to track the latest scheduled end time of audio buffers.
- Updated the handling of audio buffer playback to ensure proper state transitions.

refactor: remove unnecessary comments and streamline code in audio, video, and mediabunny engines

feat: add resize functionality to canvas proxy and update type definitions

- Implemented a resize function in canvasProxy.js to adjust canvas size based on player dimensions and video metadata.
- Updated TypeScript definitions for artplayer-proxy-mediabunny to include option and result types.
- Modified build-ts script to include all plugin type definitions.
- Added TypeScript definitions for artplayer-proxy-canvas and artplayer-proxy-mediabunny.

refactor: remove unused properties from Artplayer instance and make option parameter optional in artplayerProxyCanvas type definition

Enhance Mediabunny and Video Engine functionality

- Added event listener for 'ended' event in mediabunnyEngine to handle playback state.
- Modified seek function to check if playback should resume after seeking.
- Reset canvas dimensions to zero in videoEngine when video track is not available or cannot be decoded.
- Ensured canvas is cleared when video track is invalid to prevent rendering issues.

Emit 'waiting' event during loadstart in mediabunnyEngine

Refactor event emission in mediabunnyEngine and add sleep utility function

- Changed the event emission for 'loadstart' to be asynchronous using setTimeout.
- Introduced a new utility function 'sleep' to facilitate delayed execution in promises.

feat: enhance mediabunny proxy with new options and source handling

- Added options for event delay, load timeout, timeupdate interval, AV sync tolerance, poster, and source in README.
- Implemented source normalization in audio and video engines to support URL, Blob, and ReadableStream.
- Updated mediabunny engine to handle new options and improve load handling with timeout and error management.
- Enhanced video engine to draw a poster when no video source is available and manage playback rate.
- Modified shim to accept source option and integrate with the new engine options.
- Updated TypeScript definitions to reflect new options and source types.

feat: add dropLateFrames option to video and mediabunny engines

- Introduced dropLateFrames option in mediabunnyEngine and videoEngine to control frame dropping behavior.
- Updated videoEngine logic to handle frame rendering based on the dropLateFrames setting.
- Added type definition for dropLateFrames in TypeScript declaration file.

fix: delay loadstart event emission to ensure proper event handling

The 'loadstart' event emission is now wrapped in a setTimeout to ensure it is triggered after the current call stack is cleared. This change aims to improve the timing of event emissions and prevent potential issues with event handling in the mediabunny engine.

feat: add preflight range check and drop late frames option

- Updated README.md to include new options: dropLateFrames and preflightRange.
- Enhanced mediabunnyEngine to support new options with default values.
- Implemented preflight function in videoEngine to check server support for Range requests.
- Adjusted videoEngine to utilize preflight check before loading media.
- Updated TypeScript definitions to include preflightRange option.

Remove aspectRatio option from Artplayer configuration

Update README and mediabunny example URL for consistency

Refactor code structure for improved readability and maintainability

Update dependencies and fix play/seek state management in mediabunnyEngine

Refactor code structure for improved readability and maintainability

fix(types): update export syntax and formatting in TypeScript declaration files
2025-12-13 14:06:30 +08:00

8 lines
430 KiB
JavaScript

/*!
* artplayer-proxy-mediabunny.js v1.0.0
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,r,n,a,i,s,o,c){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof u[a]&&u[a],d=l.i||{},f=l.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,n){if(!f[r]){if(!e[r]){if(i[r])return i[r];var s="function"==typeof u[a]&&u[a];if(!n&&s)return s(r,!0);if(l)return l(r,!0);if(h&&"string"==typeof r)return h(r);var o=Error("Cannot find module '"+r+"'");throw o.code="MODULE_NOT_FOUND",o}d.resolve=function(n){var a=e[r][1][n];return null!=a?a:n},d.cache={};var c=f[r]=new p.Module(r);e[r][0].call(c.exports,d,c,c.exports,u)}return f[r].exports;function d(e){var r=d.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=h,this.exports={}},p.modules=e,p.cache=f,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return u[a]}}),u[a]=p;for(var m=0;m<r.length;m++)p(r[m]);if(n){var g=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({OIaIB:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return c});var s=e("./proxy/canvasProxy.js"),o=i.interopDefault(s);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){return(0,o.default)(r,e)}}"undefined"!=typeof window&&(window.artplayerProxyMediabunny=c)},{"./proxy/canvasProxy.js":"hTxiw","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],hTxiw:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return u});var s=e("@swc/helpers/cjs/_to_consumable_array.cjs"),o=e("../shim/mediabunnyVideoShim.js"),c=i.interopDefault(o);function u(e,r){var n,a=function(e){e in o||Object.defineProperty(o,e,{get:function(){var r=l[e];return"function"==typeof r?r.bind(l):r},set:function(r){l[e]=r},configurable:!0,enumerable:!0})},i=function(e){o[e]=function(){for(var r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];return(n=d)[e].apply(n,(0,s._)(a))}},o=(0,e.constructor.utils.createElement)("canvas"),u=o.getContext("2d"),l=(0,c.default)({art:e,canvas:o,ctx:u,option:r}),d={};for(var f in o)"function"==typeof o[f]&&(d[f]=o[f].bind(o));for(var h in l)a(h);for(var p in d)i(p);function m(){var r;(null==(r=e.template)?void 0:r.$player)&&!e.option.autoSize&&Object.assign(o.style,{width:"100%",height:"100%",objectFit:"contain"})}return e.on("destroy",function(){l.destroy()}),e.on("resize",m),e.on("video:loadedmetadata",m),o}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","../shim/mediabunnyVideoShim.js":"4Z3fn","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],i81N6:[function(e,r,n,a){"use strict";var i=e("d402183024004bc7"),s=e("3209e2b12672cd18"),o=e("fc58adb8f1bff142"),c=e("5e213dc122a10171");n._=function(e){return i._(e)||s._(e)||c._(e)||o._()}},{d402183024004bc7:"hfQG0","3209e2b12672cd18":"fQrlQ",fc58adb8f1bff142:"fWabh","5e213dc122a10171":"fh7mx"}],hfQG0:[function(e,r,n,a){"use strict";var i=e("5bd5b10bf87fc8e");n._=function(e){if(Array.isArray(e))return i._(e)}},{"5bd5b10bf87fc8e":"1WOAB"}],"1WOAB":[function(e,r,n,a){"use strict";n._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,a=Array(r);n<r;n++)a[n]=e[n];return a}},{}],fQrlQ:[function(e,r,n,a){"use strict";n._=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}},{}],fWabh:[function(e,r,n,a){"use strict";n._=function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,r,n,a){"use strict";var i=e("3ee51b7dc02d0c44");n._=function(e,r){if(e){if("string"==typeof e)return i._(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i._(e,r)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"4Z3fn":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return d});var s=e("../engine/mediabunnyEngine.js"),o=i.interopDefault(s),c=e("../utils/clamp.js"),u=i.interopDefault(c),l=e("./videoEvents.js");function d(e){var r,n,a=e.art,i=e.canvas,s=e.ctx,c=e.option,d=(0,l.createVideoEventTarget)(),f=(0,o.default)({canvas:i,ctx:s,events:d,option:c}),h=null,p=null!=(n=c.volume)?n:.7,m=!!c.muted,g=1;f.setVolume(p,m),a.constructor.config.events.forEach(function(e){d.addEventListener(e,function(e){a.emit("video:".concat(e.type),e)})});var b={addEventListener:d.addEventListener,removeEventListener:d.removeEventListener,get src(){return h},set src(v){h=v,v&&f.load(v)},get currentTime(){return f.currentTime},set currentTime(t){f.seek(Number(t)||0)},get duration(){return f.duration},get buffered(){var k=f.duration;if(!k||Number.isNaN(k))return{length:0,start:function(){return 0},end:function(){return 0}};return{length:1,start:function(){return 0},end:function(){return k}}},get played(){var _=f.duration,y=f.currentTime;if(!_||Number.isNaN(_)||y<=0)return{length:0,start:function(){return 0},end:function(){return 0}};return{length:1,start:function(){return 0},end:function(){return y}}},get paused(){return f.paused},get playing(){return!f.paused&&!f.ended},get ended(){return f.ended},get readyState(){return f.readyState},get networkState(){return f.networkState},get error(){return f.error},get seeking(){return f.seeking},get seekable(){var S=f.duration;if(!S||Number.isNaN(S))return{length:0,start:function(){return 0},end:function(){return 0}};return{length:1,start:function(){return 0},end:function(){return S}}},get playbackRate(){return g},set playbackRate(v){var w=Number(v);if(Number.isNaN(w)||w<=0)return;g=w,f.setPlaybackRate(w),d.emit("ratechange")},get volume(){return p},set volume(v){p=(0,u.default)(v,0,1),m=!1,f.setVolume(p,m),d.emit("volumechange")},get muted(){return m},set muted(v){m=!!v,f.setVolume(p,m),d.emit("volumechange")},play:function(){return f.play()},pause:function(){f.pause()},load:function(){h&&f.load(h)},destroy:function(){f.destroy()},get videoWidth(){return f.videoWidth},get videoHeight(){return f.videoHeight},get playsInline(){return!0},set playsInline(v){},get autoplay(){return c.autoplay||!1},set autoplay(v){},get loop(){return c.loop||!1},set loop(v){},get controls(){return!1},set controls(v){},get crossOrigin(){return c.crossOrigin||""},set crossOrigin(v){},get currentSrc(){return h},get poster(){return c.poster||""},set poster(v){c.poster=v},get preload(){return"auto"},set preload(v){},get defaultMuted(){return!1},set defaultMuted(v){},get defaultPlaybackRate(){return 1},set defaultPlaybackRate(v){},canPlayType:function(e){return"maybe"},getBoundingClientRect:function(){return i.getBoundingClientRect()},requestVideoFrameCallback:function(e){return requestAnimationFrame(function(r){e(r,{presentationTime:f.currentTime,expectedDisplayTime:r+16.6,width:f.videoWidth,height:f.videoHeight,mediaTime:f.currentTime,presentedFrames:0,processingDuration:0,captureTime:r,receiveTime:r,rtpTimestamp:0})})},cancelVideoFrameCallback:function(e){cancelAnimationFrame(e)},setAttribute:function(e,r){"src"===e?this.src=r:"autoplay"===e?this.autoplay=r:"loop"===e?this.loop=r:"muted"===e?this.muted=!0:i.setAttribute(e,r)}};return c.source?b.src=c.source:(null==(r=a.option)?void 0:r.url)&&(b.src=a.option.url),b}},{"../engine/mediabunnyEngine.js":"g9ru2","../utils/clamp.js":"39E3e","./videoEvents.js":"2Lzla","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],g9ru2:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return f});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("./audioEngine.js"),u=i.interopDefault(c),l=e("./videoEngine.js"),d=i.interopDefault(l);function f(e){var r,n,a,i,c,l,f=e.canvas,h=e.ctx,p=e.events,m=e.option,g=void 0===m?{}:m,b=(0,u.default)(p),k=(0,d.default)({canvas:f,ctx:h,events:p,timeupdateInterval:null!=(n=g.timeupdateInterval)?n:250,avSyncTolerance:null!=(a=g.avSyncTolerance)?a:.12,dropLateFrames:null!=(i=g.dropLateFrames)&&i,poster:null!=(c=g.poster)?c:"",preflightRange:null!=(l=g.preflightRange)&&l}),_=!0,y=!1,S=0,w=0,T=null,x=!1,I=0;function E(){return(0,s._)(function(){return(0,o._)(this,function(e){switch(e.label){case 0:if(!_)return[2];return _=!1,[4,b.play()];case 1:return e.sent(),k.start(b),p.emit("play"),p.emit("playing"),[2]}})})()}function j(){_||(_=!0,b.pause(),k.stop(),p.emit("pause"))}return null==(r=p.addEventListener)||r.call(p,"ended",function(){y=!0,_=!0}),{load:function(e){return(0,s._)(function(){var r,n,a,i,c,u;return(0,o._)(this,function(l){switch(l.label){case 0:if(r=++I,j(),y=!1,T=null,w=2,S=0,setTimeout(function(){return p.emit("waiting")},0),setTimeout(function(){return p.emit("loadstart")},0),n=Number.isFinite(g.loadTimeout)?g.loadTimeout:12e3,a=null,i=n>0?new Promise(function(e,r){a=setTimeout(function(){return r(Error("Load timeout"))},n)}):null,c=(0,s._)(function(){var n,i,s,c;return(0,o._)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,4]),n=!1,i=!1,s=function(){n&&i&&(S=1,p.emit("loadedmetadata"),p.emit("durationchange"))},[4,Promise.all([k.load(e,function(){r===I&&(n=!0,s())}),b.load(e,function(){r===I&&(i=!0,s())})])];case 1:if(o.sent(),r!==I)return[2];return S=4,w=1,p.emit("loadeddata"),p.emit("canplay"),p.emit("canplaythrough"),[3,4];case 2:if(c=o.sent(),r!==I)return[2];return T={code:4,message:c.message},w=3,p.emit("error"),console.error(c),[3,4];case 3:return a&&clearTimeout(a),[7];case 4:return[2]}})})(),!i)return[3,5];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Promise.race([c,i])];case 2:return l.sent(),[3,4];case 3:if(u=l.sent(),r!==I)return[2];return I++,T={code:4,message:u.message},w=3,p.emit("error"),[3,4];case 4:return[3,7];case 5:return[4,c];case 6:l.sent(),l.label=7;case 7:return[2]}})})()},play:E,pause:j,seek:function(e){return(0,s._)(function(){var r;return(0,o._)(this,function(n){switch(n.label){case 0:return r=!_,x=!0,p.emit("seeking"),p.emit("waiting"),j(),[4,b.seek(e)];case 1:return n.sent(),[4,k.seek(e)];case 2:if(n.sent(),x=!1,p.emit("seeked"),!(r&&!y))return[3,4];return[4,E()];case 3:n.sent(),n.label=4;case 4:return[2]}})})()},destroy:function(){j(),b.destroy(),k.destroy()},setVolume:b.setVolume,setPlaybackRate:function(e){b.setPlaybackRate(e),k.setPlaybackRate(e)},get currentTime(){return b.currentTime},get duration(){return b.duration||k.duration},get paused(){return _},get seeking(){return x},get ended(){return y},get readyState(){return S},get networkState(){return w},get error(){return T},get videoWidth(){return k.width},get videoHeight(){return k.height}}}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./audioEngine.js":"avNjw","./videoEngine.js":"iWP57","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,r,n,a){"use strict";function i(e,r,n,a,i,s,o){try{var c=e[s](o),u=c.value}catch(e){n(e);return}c.done?r(u):Promise.resolve(u).then(a,i)}n._=function(e){return function(){var r=this,n=arguments;return new Promise(function(a,s){var o=e.apply(r,n);function c(e){i(o,a,s,c,u,"next",e)}function u(e){i(o,a,s,c,u,"throw",e)}c(void 0)})}}},{}],eltGh:[function(e,r,n,a){"use strict";n._=e("eb260df52bffddd").__generator},{eb260df52bffddd:"6yrAu"}],"6yrAu":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"__extends",function(){return c}),i.export(n,"__assign",function(){return u}),i.export(n,"__rest",function(){return l}),i.export(n,"__decorate",function(){return d}),i.export(n,"__param",function(){return f}),i.export(n,"__esDecorate",function(){return h}),i.export(n,"__runInitializers",function(){return p}),i.export(n,"__propKey",function(){return m}),i.export(n,"__setFunctionName",function(){return g}),i.export(n,"__metadata",function(){return b}),i.export(n,"__awaiter",function(){return k}),i.export(n,"__generator",function(){return _}),i.export(n,"__createBinding",function(){return y}),i.export(n,"__exportStar",function(){return S}),i.export(n,"__values",function(){return w}),i.export(n,"__read",function(){return T}),i.export(n,"__spread",function(){return x}),i.export(n,"__spreadArrays",function(){return I}),i.export(n,"__spreadArray",function(){return E}),i.export(n,"__await",function(){return j}),i.export(n,"__asyncGenerator",function(){return P}),i.export(n,"__asyncDelegator",function(){return C}),i.export(n,"__asyncValues",function(){return A}),i.export(n,"__makeTemplateObject",function(){return B}),i.export(n,"__importStar",function(){return F}),i.export(n,"__importDefault",function(){return R}),i.export(n,"__classPrivateFieldGet",function(){return U}),i.export(n,"__classPrivateFieldSet",function(){return O}),i.export(n,"__classPrivateFieldIn",function(){return L}),i.export(n,"__addDisposableResource",function(){return N}),i.export(n,"__disposeResources",function(){return z}),i.export(n,"__rewriteRelativeImportExtension",function(){return H});var s=e("@swc/helpers/cjs/_type_of.cjs"),o=function(e,r){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(e,r)};function c(e,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}o(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var u=function(){return(u=Object.assign||function(e){for(var r,n=1,a=arguments.length;n<a;n++)for(var i in r=arguments[n])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e}).apply(this,arguments)};function l(e,r){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>r.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)0>r.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]]);return n}function d(e,r,n,a){var i,o=arguments.length,c=o<3?r:null===a?a=Object.getOwnPropertyDescriptor(r,n):a;if(("undefined"==typeof Reflect?"undefined":(0,s._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,r,n,a);else for(var u=e.length-1;u>=0;u--)(i=e[u])&&(c=(o<3?i(c):o>3?i(r,n,c):i(r,n))||c);return o>3&&c&&Object.defineProperty(r,n,c),c}function f(e,r){return function(n,a){r(n,a,e)}}function h(e,r,n,a,i,o){function c(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,l=a.kind,d="getter"===l?"get":"setter"===l?"set":"value",f=!r&&e?a.static?e:e.prototype:null,h=r||(f?Object.getOwnPropertyDescriptor(f,a.name):{}),p=!1,m=n.length-1;m>=0;m--){var g={};for(var b in a)g[b]="access"===b?{}:a[b];for(var b in a.access)g.access[b]=a.access[b];g.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");o.push(c(e||null))};var k=(0,n[m])("accessor"===l?{get:h.get,set:h.set}:h[d],g);if("accessor"===l){if(void 0===k)continue;if(null===k||(void 0===k?"undefined":(0,s._)(k))!=="object")throw TypeError("Object expected");(u=c(k.get))&&(h.get=u),(u=c(k.set))&&(h.set=u),(u=c(k.init))&&i.unshift(u)}else(u=c(k))&&("field"===l?i.unshift(u):h[d]=u)}f&&Object.defineProperty(f,a.name,h),p=!0}function p(e,r,n){for(var a=arguments.length>2,i=0;i<r.length;i++)n=a?r[i].call(e,n):r[i].call(e);return a?n:void 0}function m(e){return(void 0===e?"undefined":(0,s._)(e))==="symbol"?e:"".concat(e)}function g(e,r,n){return(void 0===r?"undefined":(0,s._)(r))==="symbol"&&(r=r.description?"[".concat(r.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",r):r})}function b(e,r){if(("undefined"==typeof Reflect?"undefined":(0,s._)(Reflect))==="object"&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,r)}function k(e,r,n,a){return new(n||(n=Promise))(function(i,s){function o(e){try{u(a.next(e))}catch(e){s(e)}}function c(e){try{u(a.throw(e))}catch(e){s(e)}}function u(e){var r;e.done?i(e.value):((r=e.value)instanceof n?r:new n(function(e){e(r)})).then(o,c)}u((a=a.apply(e,r||[])).next())})}function _(e,r){var n,a,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=c(0),o.throw=c(1),o.return=c(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(s=0)),s;)try{if(n=1,a&&(i=2&l[0]?a.return:l[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,l[1])).done)return i;switch(a=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return s.label++,{value:l[1],done:!1};case 5:s.label++,a=l[1],l=[0];continue;case 7:l=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){s=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){s.label=l[1];break}if(6===l[0]&&s.label<i[1]){s.label=i[1],i=l;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(l);break}i[2]&&s.ops.pop(),s.trys.pop();continue}l=r.call(e,s)}catch(e){l=[6,e],a=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var y=Object.create?function(e,r,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(r,n);(!i||("get"in i?!r.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return r[n]}}),Object.defineProperty(e,a,i)}:function(e,r,n,a){void 0===a&&(a=n),e[a]=r[n]};function S(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||y(r,e,n)}function w(e){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&e[r],a=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function T(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,s=n.call(e),o=[];try{for(;(void 0===r||r-- >0)&&!(a=s.next()).done;)o.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}function x(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(T(arguments[r]));return e}function I(){for(var e=0,r=0,n=arguments.length;r<n;r++)e+=arguments[r].length;for(var a=Array(e),i=0,r=0;r<n;r++)for(var s=arguments[r],o=0,c=s.length;o<c;o++,i++)a[i]=s[o];return a}function E(e,r,n){if(n||2==arguments.length)for(var a,i=0,s=r.length;i<s;i++)!a&&i in r||(a||(a=Array.prototype.slice.call(r,0,i)),a[i]=r[i]);return e.concat(a||Array.prototype.slice.call(r))}function j(e){return this instanceof j?(this.v=e,this):new j(e)}function P(e,r,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var a,i=n.apply(e,r||[]),s=[];return a=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(r){return Promise.resolve(r).then(e,l)}}),a[Symbol.asyncIterator]=function(){return this},a;function o(e,r){i[e]&&(a[e]=function(r){return new Promise(function(n,a){s.push([e,r,n,a])>1||c(e,r)})},r&&(a[e]=r(a[e])))}function c(e,r){try{var n;(n=i[e](r)).value instanceof j?Promise.resolve(n.value.v).then(u,l):d(s[0][2],n)}catch(e){d(s[0][3],e)}}function u(e){c("next",e)}function l(e){c("throw",e)}function d(e,r){e(r),s.shift(),s.length&&c(s[0][0],s[0][1])}}function C(e){var r,n;return r={},a("next"),a("throw",function(e){throw e}),a("return"),r[Symbol.iterator]=function(){return this},r;function a(a,i){r[a]=e[a]?function(r){return(n=!n)?{value:j(e[a](r)),done:!1}:i?i(r):r}:i}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,n=e[Symbol.asyncIterator];return n?n.call(e):(e=w(e),r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r);function a(n){r[n]=e[n]&&function(r){return new Promise(function(a,i){var s,o,c;s=a,o=i,c=(r=e[n](r)).done,Promise.resolve(r.value).then(function(e){s({value:e,done:c})},o)})}}}function B(e,r){return Object.defineProperty?Object.defineProperty(e,"raw",{value:r}):e.raw=r,e}var M=Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r},D=function(e){return(D=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r})(e)};function F(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n=D(e),a=0;a<n.length;a++)"default"!==n[a]&&y(r,e,n[a]);return M(r,e),r}function R(e){return e&&e.__esModule?e:{default:e}}function U(e,r,n,a){if("a"===n&&!a)throw TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!a:!r.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:r.get(e)}function O(e,r,n,a,i){if("m"===a)throw TypeError("Private method is not writable");if("a"===a&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof r?e!==r||!i:!r.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:r.set(e,n),n}function L(e,r){if(null===r||(void 0===r?"undefined":(0,s._)(r))!=="object"&&"function"!=typeof r)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?r===e:e.has(r)}function N(e,r,n){if(null!=r){var a,i;if((void 0===r?"undefined":(0,s._)(r))!=="object"&&"function"!=typeof r)throw TypeError("Object expected.");if(n){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");a=r[Symbol.asyncDispose]}if(void 0===a){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");a=r[Symbol.dispose],n&&(i=a)}if("function"!=typeof a)throw TypeError("Object not disposable.");i&&(a=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:r,dispose:a,async:n})}else n&&e.stack.push({async:!0});return r}var V="function"==typeof SuppressedError?SuppressedError:function(e,r,n){var a=Error(n);return a.name="SuppressedError",a.error=e,a.suppressed=r,a};function z(e){function r(r){e.error=e.hasError?new V(r,e.error,"An error was suppressed during disposal."):r,e.hasError=!0}var n,a=0;return function i(){for(;n=e.stack.pop();)try{if(!n.async&&1===a)return a=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return a|=2,Promise.resolve(s).then(i,function(e){return r(e),i()})}else a|=1}catch(e){r(e)}if(1===a)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function H(e,r){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,a,i,s){return n?r?".jsx":".js":!a||i&&s?a+i+"."+s.toLowerCase()+"js":e}):e}n.default={__extends:c,__assign:u,__rest:l,__decorate:d,__param:f,__esDecorate:h,__runInitializers:p,__propKey:m,__setFunctionName:g,__metadata:b,__awaiter:k,__generator:_,__createBinding:y,__exportStar:S,__values:w,__read:T,__spread:x,__spreadArrays:I,__spreadArray:E,__await:j,__asyncGenerator:P,__asyncDelegator:C,__asyncValues:A,__makeTemplateObject:B,__importStar:F,__importDefault:R,__classPrivateFieldGet:U,__classPrivateFieldSet:O,__classPrivateFieldIn:L,__addDisposableResource:N,__disposeResources:z,__rewriteRelativeImportExtension:H}},{"@swc/helpers/cjs/_type_of.cjs":"iXhRw","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],iXhRw:[function(e,r,n,a){"use strict";n._=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}},{}],qpMMf:[function(e,r,n,a){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,r){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})}),r},n.export=function(e,r,n){Object.defineProperty(e,r,{enumerable:!0,get:n})}},{}],avNjw:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return d});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_type_of.cjs"),c=e("@swc/helpers/cjs/_ts_generator.cjs"),u=e("@swc/helpers/cjs/_ts_values.cjs"),l=e("mediabunny");function d(e){var r=null,n=null,a=null,i=null,d=null,f=0,h=0,p=0,m=NaN,g=!0,b=.7,k=!1,_=1,y=0,S=new Set;function w(){return g?h:(a.currentTime-f)*_+h}function T(){if(i){var e=k?0:b;i.gain.value=e*e}}function x(e){if(!a){var r=window.AudioContext||window.webkitAudioContext;try{a=new r({sampleRate:e})}catch(e){a=new r}(i=a.createGain()).connect(a.destination),T()}}function I(){var e=!0,r=!1,n=void 0;try{for(var a,i=S[Symbol.iterator]();!(e=(a=i.next()).done);e=!0)a.value.stop()}catch(e){r=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(r)throw n}}S.clear()}function E(){return(0,s._)(function(){return(0,c._)(this,function(e){switch(e.label){case 0:return[4,null==d?void 0:d.return()];case 1:return e.sent(),d=null,[2]}})})()}function j(r){return(0,s._)(function(){var s,l;return(0,c._)(this,function(m){switch(m.label){case 0:if(s=function(){var n,s,o,u,l,m,b,k,w;return(0,c._)(this,function(c){switch(c.label){case 0:if(r!==y||g)return[2,{v:void 0}];n=d.next(),s=setInterval(function(){if(r!==y||g)return void clearInterval(s);"running"===a.state&&a.currentTime>=p-.2&&(a.suspend(),e.emit("waiting"))},50),o=void 0,c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,n];case 2:return o=c.sent(),[3,5];case 3:return console.error(c.sent()),[2,"break"];case 4:return clearInterval(s),[7];case 5:if(r!==y||g)return[2,{v:void 0}];if("suspended"!==a.state)return[3,7];return[4,a.resume()];case 6:c.sent(),e.emit("canplay"),e.emit("playing"),c.label=7;case 7:if(o.done)return[2,"break"];return l=(u=o.value).buffer,m=u.timestamp,(b=a.createBufferSource()).buffer=l,b.connect(i),b.playbackRate.value=_,(w=(k=f+(m-h)/_)+l.duration/_)>p&&(p=w),k>=a.currentTime?b.start(k):b.start(a.currentTime,(a.currentTime-k)*_),S.add(b),b.onended=function(){return S.delete(b)},[2]}})},!n)return[2];return[4,E()];case 1:m.sent(),d=n.buffers(w()),m.label=2;case 2:return[5,(0,u._)(s())];case 3:if(l=m.sent(),"object"===(0,o._)(l))return[2,l.v];if("break"===l)return[3,4];return[3,2];case 4:return[2]}})})()}function P(){g||(h=w(),g=!0,E(),I())}return{load:function(e,a){return(0,s._)(function(){var i,s,o,u;return(0,c._)(this,function(c){switch(c.label){case 0:return i=++y,[4,E()];case 1:if(c.sent(),I(),g=!0,h=0,f=0,!(s="string"==typeof e?new(0,l.UrlSource)(e):e instanceof Blob?new(0,l.BlobSource)(e):"undefined"!=typeof ReadableStream&&e instanceof ReadableStream?new(0,l.ReadableStreamSource)(e):e))return[2];return[4,(r=new(0,l.Input)({source:s,formats:l.ALL_FORMATS})).computeDuration()];case 2:if(m=c.sent(),i!==y)return[2];return[4,r.getPrimaryAudioTrack()];case 3:if(!(o=c.sent()))return n=null,x(),a&&a(),[2];if(u=null===o.codec)return[3,5];return[4,o.canDecode()];case 4:u=!c.sent(),c.label=5;case 5:if(u)return n=null,x(),a&&a(),[2];return x(o.sampleRate),n=new(0,l.AudioBufferSink)(o),a&&a(),[2]}})})()},play:function(){return(0,s._)(function(){return(0,c._)(this,function(e){switch(e.label){case 0:if(!g)return[2];if(a||x(),"suspended"!==a.state)return[3,2];return[4,a.resume()];case 1:e.sent(),e.label=2;case 2:return p=f=a.currentTime,g=!1,j(++y),[2]}})})()},pause:P,seek:function(e){return(0,s._)(function(){return(0,c._)(this,function(r){return h=Math.max(0,e),p=f=a.currentTime,y++,g||j(y),[2]})})()},destroy:function(){y++,P(),null==a||a.close(),a=null,r=null,n=null},setVolume:function(e,r){b=e,k=r,T()},setPlaybackRate:function(e){e!==_&&(g||(h=w(),f=a.currentTime),_=e,g||j(++y))},get currentTime(){return w()},get duration(){return m},get paused(){return g}}}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@swc/helpers/cjs/_ts_values.cjs":"94P5Q",mediabunny:"b8Ej9","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"94P5Q":[function(e,r,n,a){"use strict";n._=e("2ed00358a4809745").__values},{"2ed00358a4809745":"6yrAu"}],b8Ej9:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"Output",function(){return s.Output}),i.export(n,"OutputFormat",function(){return o.OutputFormat}),i.export(n,"AdtsOutputFormat",function(){return o.AdtsOutputFormat}),i.export(n,"FlacOutputFormat",function(){return o.FlacOutputFormat}),i.export(n,"IsobmffOutputFormat",function(){return o.IsobmffOutputFormat}),i.export(n,"MkvOutputFormat",function(){return o.MkvOutputFormat}),i.export(n,"MovOutputFormat",function(){return o.MovOutputFormat}),i.export(n,"Mp3OutputFormat",function(){return o.Mp3OutputFormat}),i.export(n,"Mp4OutputFormat",function(){return o.Mp4OutputFormat}),i.export(n,"OggOutputFormat",function(){return o.OggOutputFormat}),i.export(n,"WavOutputFormat",function(){return o.WavOutputFormat}),i.export(n,"WebMOutputFormat",function(){return o.WebMOutputFormat}),i.export(n,"MediaSource",function(){return c.MediaSource}),i.export(n,"VideoSource",function(){return c.VideoSource}),i.export(n,"AudioSource",function(){return c.AudioSource}),i.export(n,"SubtitleSource",function(){return c.SubtitleSource}),i.export(n,"AudioBufferSource",function(){return c.AudioBufferSource}),i.export(n,"AudioSampleSource",function(){return c.AudioSampleSource}),i.export(n,"CanvasSource",function(){return c.CanvasSource}),i.export(n,"EncodedAudioPacketSource",function(){return c.EncodedAudioPacketSource}),i.export(n,"EncodedVideoPacketSource",function(){return c.EncodedVideoPacketSource}),i.export(n,"MediaStreamAudioTrackSource",function(){return c.MediaStreamAudioTrackSource}),i.export(n,"MediaStreamVideoTrackSource",function(){return c.MediaStreamVideoTrackSource}),i.export(n,"TextSubtitleSource",function(){return c.TextSubtitleSource}),i.export(n,"VideoSampleSource",function(){return c.VideoSampleSource}),i.export(n,"VIDEO_CODECS",function(){return u.VIDEO_CODECS}),i.export(n,"AUDIO_CODECS",function(){return u.AUDIO_CODECS}),i.export(n,"PCM_AUDIO_CODECS",function(){return u.PCM_AUDIO_CODECS}),i.export(n,"NON_PCM_AUDIO_CODECS",function(){return u.NON_PCM_AUDIO_CODECS}),i.export(n,"SUBTITLE_CODECS",function(){return u.SUBTITLE_CODECS}),i.export(n,"canEncode",function(){return l.canEncode}),i.export(n,"canEncodeVideo",function(){return l.canEncodeVideo}),i.export(n,"canEncodeAudio",function(){return l.canEncodeAudio}),i.export(n,"canEncodeSubtitles",function(){return l.canEncodeSubtitles}),i.export(n,"getEncodableCodecs",function(){return l.getEncodableCodecs}),i.export(n,"getEncodableVideoCodecs",function(){return l.getEncodableVideoCodecs}),i.export(n,"getEncodableAudioCodecs",function(){return l.getEncodableAudioCodecs}),i.export(n,"getEncodableSubtitleCodecs",function(){return l.getEncodableSubtitleCodecs}),i.export(n,"getFirstEncodableVideoCodec",function(){return l.getFirstEncodableVideoCodec}),i.export(n,"getFirstEncodableAudioCodec",function(){return l.getFirstEncodableAudioCodec}),i.export(n,"getFirstEncodableSubtitleCodec",function(){return l.getFirstEncodableSubtitleCodec}),i.export(n,"Quality",function(){return l.Quality}),i.export(n,"QUALITY_VERY_LOW",function(){return l.QUALITY_VERY_LOW}),i.export(n,"QUALITY_LOW",function(){return l.QUALITY_LOW}),i.export(n,"QUALITY_MEDIUM",function(){return l.QUALITY_MEDIUM}),i.export(n,"QUALITY_HIGH",function(){return l.QUALITY_HIGH}),i.export(n,"QUALITY_VERY_HIGH",function(){return l.QUALITY_VERY_HIGH}),i.export(n,"Target",function(){return d.Target}),i.export(n,"BufferTarget",function(){return d.BufferTarget}),i.export(n,"FilePathTarget",function(){return d.FilePathTarget}),i.export(n,"NullTarget",function(){return d.NullTarget}),i.export(n,"StreamTarget",function(){return d.StreamTarget}),i.export(n,"ALL_TRACK_TYPES",function(){return s.ALL_TRACK_TYPES}),i.export(n,"Source",function(){return f.Source}),i.export(n,"BlobSource",function(){return f.BlobSource}),i.export(n,"BufferSource",function(){return f.BufferSource}),i.export(n,"FilePathSource",function(){return f.FilePathSource}),i.export(n,"StreamSource",function(){return f.StreamSource}),i.export(n,"ReadableStreamSource",function(){return f.ReadableStreamSource}),i.export(n,"UrlSource",function(){return f.UrlSource}),i.export(n,"InputFormat",function(){return h.InputFormat}),i.export(n,"AdtsInputFormat",function(){return h.AdtsInputFormat}),i.export(n,"IsobmffInputFormat",function(){return h.IsobmffInputFormat}),i.export(n,"MatroskaInputFormat",function(){return h.MatroskaInputFormat}),i.export(n,"Mp3InputFormat",function(){return h.Mp3InputFormat}),i.export(n,"Mp4InputFormat",function(){return h.Mp4InputFormat}),i.export(n,"OggInputFormat",function(){return h.OggInputFormat}),i.export(n,"QuickTimeInputFormat",function(){return h.QuickTimeInputFormat}),i.export(n,"WaveInputFormat",function(){return h.WaveInputFormat}),i.export(n,"WebMInputFormat",function(){return h.WebMInputFormat}),i.export(n,"FlacInputFormat",function(){return h.FlacInputFormat}),i.export(n,"ALL_FORMATS",function(){return h.ALL_FORMATS}),i.export(n,"ADTS",function(){return h.ADTS}),i.export(n,"MATROSKA",function(){return h.MATROSKA}),i.export(n,"MP3",function(){return h.MP3}),i.export(n,"MP4",function(){return h.MP4}),i.export(n,"OGG",function(){return h.OGG}),i.export(n,"QTFF",function(){return h.QTFF}),i.export(n,"WAVE",function(){return h.WAVE}),i.export(n,"WEBM",function(){return h.WEBM}),i.export(n,"FLAC",function(){return h.FLAC}),i.export(n,"Input",function(){return p.Input}),i.export(n,"InputDisposedError",function(){return p.InputDisposedError}),i.export(n,"InputTrack",function(){return m.InputTrack}),i.export(n,"InputVideoTrack",function(){return m.InputVideoTrack}),i.export(n,"InputAudioTrack",function(){return m.InputAudioTrack}),i.export(n,"EncodedPacket",function(){return g.EncodedPacket}),i.export(n,"AudioSample",function(){return b.AudioSample}),i.export(n,"VideoSample",function(){return b.VideoSample}),i.export(n,"AudioBufferSink",function(){return k.AudioBufferSink}),i.export(n,"AudioSampleSink",function(){return k.AudioSampleSink}),i.export(n,"BaseMediaSampleSink",function(){return k.BaseMediaSampleSink}),i.export(n,"CanvasSink",function(){return k.CanvasSink}),i.export(n,"EncodedPacketSink",function(){return k.EncodedPacketSink}),i.export(n,"VideoSampleSink",function(){return k.VideoSampleSink}),i.export(n,"Conversion",function(){return _.Conversion}),i.export(n,"CustomVideoDecoder",function(){return y.CustomVideoDecoder}),i.export(n,"CustomVideoEncoder",function(){return y.CustomVideoEncoder}),i.export(n,"CustomAudioDecoder",function(){return y.CustomAudioDecoder}),i.export(n,"CustomAudioEncoder",function(){return y.CustomAudioEncoder}),i.export(n,"registerDecoder",function(){return y.registerDecoder}),i.export(n,"registerEncoder",function(){return y.registerEncoder}),i.export(n,"RichImageData",function(){return S.RichImageData}),i.export(n,"AttachedFile",function(){return S.AttachedFile});var s=e("./output.js"),o=e("./output-format.js"),c=e("./media-source.js"),u=e("./codec.js"),l=e("./encode.js"),d=e("./target.js"),f=e("./source.js"),h=e("./input-format.js"),p=e("./input.js"),m=e("./input-track.js"),g=e("./packet.js"),b=e("./sample.js"),k=e("./media-sink.js"),_=e("./conversion.js"),y=e("./custom-coder.js"),S=e("./metadata.js")},{"./output.js":!1,"./output-format.js":!1,"./media-source.js":!1,"./codec.js":!1,"./encode.js":!1,"./target.js":!1,"./source.js":"7vKle","./input-format.js":"1jhAI","./input.js":"3sapy","./input-track.js":!1,"./packet.js":!1,"./sample.js":!1,"./media-sink.js":"k0V9R","./conversion.js":!1,"./custom-coder.js":!1,"./metadata.js":!1,"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],fXWqW:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"VIDEO_CODECS",function(){return u}),i.export(n,"PCM_AUDIO_CODECS",function(){return l}),i.export(n,"NON_PCM_AUDIO_CODECS",function(){return d}),i.export(n,"AUDIO_CODECS",function(){return f}),i.export(n,"SUBTITLE_CODECS",function(){return h}),i.export(n,"VP9_LEVEL_TABLE",function(){return g}),i.export(n,"buildVideoCodecString",function(){return y}),i.export(n,"generateVp9CodecConfigurationFromCodecString",function(){return S}),i.export(n,"generateAv1CodecConfigurationFromCodecString",function(){return w}),i.export(n,"extractVideoCodecString",function(){return T}),i.export(n,"buildAudioCodecString",function(){return x}),i.export(n,"extractAudioCodecString",function(){return I}),i.export(n,"aacFrequencyTable",function(){return E}),i.export(n,"aacChannelMap",function(){return j}),i.export(n,"parseAacAudioSpecificConfig",function(){return P}),i.export(n,"buildAacAudioSpecificConfig",function(){return C}),i.export(n,"OPUS_SAMPLE_RATE",function(){return A}),i.export(n,"parsePcmCodec",function(){return M}),i.export(n,"inferCodecFromCodecString",function(){return D}),i.export(n,"getVideoEncoderConfigExtension",function(){return F}),i.export(n,"getAudioEncoderConfigExtension",function(){return R}),i.export(n,"validateVideoChunkMetadata",function(){return z}),i.export(n,"validateAudioChunkMetadata",function(){return G}),i.export(n,"validateSubtitleMetadata",function(){return q});var s=e("@swc/helpers/cjs/_to_consumable_array.cjs"),o=e("@swc/helpers/cjs/_type_of.cjs"),c=e("./misc.js"),u=["avc","hevc","vp9","av1","vp8"],l=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],d=["aac","opus","mp3","vorbis","flac"],f=(0,s._)(d).concat((0,s._)(l)),h=["webvtt"],p=[{maxMacroblocks:99,maxBitrate:64e3,level:10},{maxMacroblocks:396,maxBitrate:192e3,level:11},{maxMacroblocks:396,maxBitrate:384e3,level:12},{maxMacroblocks:396,maxBitrate:768e3,level:13},{maxMacroblocks:396,maxBitrate:2e6,level:20},{maxMacroblocks:792,maxBitrate:4e6,level:21},{maxMacroblocks:1620,maxBitrate:4e6,level:22},{maxMacroblocks:1620,maxBitrate:1e7,level:30},{maxMacroblocks:3600,maxBitrate:14e6,level:31},{maxMacroblocks:5120,maxBitrate:2e7,level:32},{maxMacroblocks:8192,maxBitrate:2e7,level:40},{maxMacroblocks:8192,maxBitrate:5e7,level:41},{maxMacroblocks:8704,maxBitrate:5e7,level:42},{maxMacroblocks:22080,maxBitrate:135e6,level:50},{maxMacroblocks:36864,maxBitrate:24e7,level:51},{maxMacroblocks:36864,maxBitrate:24e7,level:52},{maxMacroblocks:139264,maxBitrate:24e7,level:60},{maxMacroblocks:139264,maxBitrate:48e7,level:61},{maxMacroblocks:139264,maxBitrate:8e8,level:62}],m=[{maxPictureSize:36864,maxBitrate:128e3,tier:"L",level:30},{maxPictureSize:122880,maxBitrate:15e5,tier:"L",level:60},{maxPictureSize:245760,maxBitrate:3e6,tier:"L",level:63},{maxPictureSize:552960,maxBitrate:6e6,tier:"L",level:90},{maxPictureSize:983040,maxBitrate:1e7,tier:"L",level:93},{maxPictureSize:2228224,maxBitrate:12e6,tier:"L",level:120},{maxPictureSize:2228224,maxBitrate:3e7,tier:"H",level:120},{maxPictureSize:2228224,maxBitrate:2e7,tier:"L",level:123},{maxPictureSize:2228224,maxBitrate:5e7,tier:"H",level:123},{maxPictureSize:8912896,maxBitrate:25e6,tier:"L",level:150},{maxPictureSize:8912896,maxBitrate:1e8,tier:"H",level:150},{maxPictureSize:8912896,maxBitrate:4e7,tier:"L",level:153},{maxPictureSize:8912896,maxBitrate:16e7,tier:"H",level:153},{maxPictureSize:8912896,maxBitrate:6e7,tier:"L",level:156},{maxPictureSize:8912896,maxBitrate:24e7,tier:"H",level:156},{maxPictureSize:0x2200000,maxBitrate:6e7,tier:"L",level:180},{maxPictureSize:0x2200000,maxBitrate:24e7,tier:"H",level:180},{maxPictureSize:0x2200000,maxBitrate:12e7,tier:"L",level:183},{maxPictureSize:0x2200000,maxBitrate:48e7,tier:"H",level:183},{maxPictureSize:0x2200000,maxBitrate:24e7,tier:"L",level:186},{maxPictureSize:0x2200000,maxBitrate:8e8,tier:"H",level:186}],g=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:0x2200000,maxBitrate:18e7,level:60},{maxPictureSize:0x2200000,maxBitrate:24e7,level:61},{maxPictureSize:0x2200000,maxBitrate:48e7,level:62}],b=[{maxPictureSize:147456,maxBitrate:15e5,tier:"M",level:0},{maxPictureSize:278784,maxBitrate:3e6,tier:"M",level:1},{maxPictureSize:665856,maxBitrate:6e6,tier:"M",level:4},{maxPictureSize:1065024,maxBitrate:1e7,tier:"M",level:5},{maxPictureSize:2359296,maxBitrate:12e6,tier:"M",level:8},{maxPictureSize:2359296,maxBitrate:3e7,tier:"H",level:8},{maxPictureSize:2359296,maxBitrate:2e7,tier:"M",level:9},{maxPictureSize:2359296,maxBitrate:5e7,tier:"H",level:9},{maxPictureSize:8912896,maxBitrate:3e7,tier:"M",level:12},{maxPictureSize:8912896,maxBitrate:1e8,tier:"H",level:12},{maxPictureSize:8912896,maxBitrate:4e7,tier:"M",level:13},{maxPictureSize:8912896,maxBitrate:16e7,tier:"H",level:13},{maxPictureSize:8912896,maxBitrate:6e7,tier:"M",level:14},{maxPictureSize:8912896,maxBitrate:24e7,tier:"H",level:14},{maxPictureSize:0x2200000,maxBitrate:6e7,tier:"M",level:15},{maxPictureSize:0x2200000,maxBitrate:24e7,tier:"H",level:15},{maxPictureSize:0x2200000,maxBitrate:6e7,tier:"M",level:16},{maxPictureSize:0x2200000,maxBitrate:24e7,tier:"H",level:16},{maxPictureSize:0x2200000,maxBitrate:1e8,tier:"M",level:17},{maxPictureSize:0x2200000,maxBitrate:48e7,tier:"H",level:17},{maxPictureSize:0x2200000,maxBitrate:16e7,tier:"M",level:18},{maxPictureSize:0x2200000,maxBitrate:8e8,tier:"H",level:18},{maxPictureSize:0x2200000,maxBitrate:16e7,tier:"M",level:19},{maxPictureSize:0x2200000,maxBitrate:8e8,tier:"H",level:19}],k=".01.01.01.01.00",_=".0.110.01.01.01.0",y=function(e,r,n,a){if("avc"===e){var i,s=Math.ceil(r/16)*Math.ceil(n/16),o=null!=(i=p.find(function(e){return s<=e.maxMacroblocks&&a<=e.maxBitrate}))?i:(0,c.last)(p),u=o?o.level:0,l="64".padStart(2,"0"),d=u.toString(16).padStart(2,"0");return"avc1.".concat(l).concat("00").concat(d)}if("hevc"===e){var f,h=r*n,k=null!=(f=m.find(function(e){return h<=e.maxPictureSize&&a<=e.maxBitrate}))?f:(0,c.last)(m);return"hev1."+"".concat("").concat(1,".")+"".concat("6",".")+"".concat(k.tier).concat(k.level,".")+"".concat("B0")}if("vp8"===e)return"vp8";if("vp9"===e){var _,y=r*n,S=null!=(_=g.find(function(e){return y<=e.maxPictureSize&&a<=e.maxBitrate}))?_:(0,c.last)(g);return"vp09.".concat("00",".").concat(S.level.toString().padStart(2,"0"),".").concat("08")}if("av1"===e){var w,T=r*n,x=null!=(w=b.find(function(e){return T<=e.maxPictureSize&&a<=e.maxBitrate}))?w:(0,c.last)(b),I=x.level.toString().padStart(2,"0");return"av01.".concat(0,".").concat(I).concat(x.tier,".").concat("08")}throw TypeError("Unhandled codec '".concat(e,"'."))},S=function(e){var r=e.split(".");return[1,1,Number(r[1]),2,1,Number(r[2]),3,1,Number(r[3]),4,1,r[4]?Number(r[4]):1]},w=function(e){var r=e.split("."),n=Number(r[1]),a=r[2];return[129,(n<<5)+Number(a.slice(0,-1)),(("H"===a.slice(-1))<<7)+((8!==Number(r[3]))<<6)+0+((r[4]?Number(r[4]):0)<<4)+((r[5]?Number(r[5][0]):1)<<3)+((r[5]?Number(r[5][1]):1)<<2)+(r[5]?Number(r[5][2]):0),0]},T=function(e){var r=e.codec,n=e.codecDescription,a=e.colorSpace,i=e.avcCodecInfo,o=e.hevcCodecInfo,u=e.vp9CodecInfo,l=e.av1CodecInfo;if("avc"===r){if((0,c.assert)(null!==e.avcType),i){var d=new Uint8Array([i.avcProfileIndication,i.profileCompatibility,i.avcLevelIndication]);return"avc".concat(e.avcType,".").concat((0,c.bytesToHexString)(d))}if(!n||n.byteLength<4)throw TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return"avc".concat(e.avcType,".").concat((0,c.bytesToHexString)(n.subarray(1,4)))}if("hevc"===r){if(o)f=o.generalProfileSpace,h=o.generalProfileIdc,p=(0,c.reverseBitsU32)(o.generalProfileCompatibilityFlags),m=o.generalTierFlag,b=o.generalLevelIdc,y=(0,s._)(o.generalConstraintIndicatorFlags);else{if(!n||n.byteLength<23)throw TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");var f,h,p,m,b,y,S=(0,c.toDataView)(n),w=S.getUint8(1);f=w>>6&3,h=31&w,p=(0,c.reverseBitsU32)(S.getUint32(2)),m=w>>5&1,b=S.getUint8(12),y=[];for(var T=0;T<6;T++)y.push(S.getUint8(6+T))}var x="hev1.";for(x+=["","A","B","C"][f]+h,x+=".",x+=p.toString(16).toUpperCase(),x+=".",x+=0===m?"L":"H",x+=b;y.length>0&&0===y[y.length-1];)y.pop();return y.length>0&&(x+=".",x+=y.map(function(e){return e.toString(16).toUpperCase()}).join(".")),x}if("vp8"===r)return"vp8";if("vp9"===r){if(!u){var I=e.width*e.height,E=(0,c.last)(g).level,j=!0,P=!1,C=void 0;try{for(var A,B=g[Symbol.iterator]();!(j=(A=B.next()).done);j=!0){var M=A.value;if(I<=M.maxPictureSize){E=M.level;break}}}catch(e){P=!0,C=e}finally{try{j||null==B.return||B.return()}finally{if(P)throw C}}return"vp09.00.".concat(E.toString().padStart(2,"0"),".08")}var D=u.profile.toString().padStart(2,"0"),F=u.level.toString().padStart(2,"0"),R=u.bitDepth.toString().padStart(2,"0"),U=u.chromaSubsampling.toString().padStart(2,"0"),O=u.colourPrimaries.toString().padStart(2,"0"),L=u.transferCharacteristics.toString().padStart(2,"0"),N=u.matrixCoefficients.toString().padStart(2,"0"),V=u.videoFullRangeFlag.toString().padStart(2,"0"),z="vp09.".concat(D,".").concat(F,".").concat(R,".").concat(U);return(z+=".".concat(O,".").concat(L,".").concat(N,".").concat(V)).endsWith(k)&&(z=z.slice(0,-k.length)),z}if("av1"===r){if(!l){var H=e.width*e.height,G=(0,c.last)(g).level,q=!0,W=!1,K=void 0;try{for(var X,Q=g[Symbol.iterator]();!(q=(X=Q.next()).done);q=!0){var Z=X.value;if(H<=Z.maxPictureSize){G=Z.level;break}}}catch(e){W=!0,K=e}finally{try{q||null==Q.return||Q.return()}finally{if(W)throw K}}return"av01.0.".concat(G.toString().padStart(2,"0"),"M.08")}var Y=l.profile,J=l.level.toString().padStart(2,"0"),$=l.tier?"H":"M",ee=l.bitDepth.toString().padStart(2,"0"),et=l.monochrome?"1":"0",er=100*l.chromaSubsamplingX+10*l.chromaSubsamplingY+ +(l.chromaSubsamplingX&&l.chromaSubsamplingY?l.chromaSamplePosition:0),en=(null==a?void 0:a.primaries)?c.COLOR_PRIMARIES_MAP[a.primaries]:1,ea=(null==a?void 0:a.transfer)?c.TRANSFER_CHARACTERISTICS_MAP[a.transfer]:1,ei=(null==a?void 0:a.matrix)?c.MATRIX_COEFFICIENTS_MAP[a.matrix]:1,es=+(null!=a&&!!a.fullRange),eo="av01.".concat(Y,".").concat(J).concat($,".").concat(ee);return eo+=".".concat(et,".").concat(er.toString().padStart(3,"0")),eo+=".".concat(en.toString().padStart(2,"0")),eo+=".".concat(ea.toString().padStart(2,"0")),eo+=".".concat(ei.toString().padStart(2,"0")),(eo+=".".concat(es)).endsWith(_)&&(eo=eo.slice(0,-_.length)),eo}throw TypeError("Unhandled codec '".concat(r,"'."))},x=function(e,r,n){if("aac"===e)return r>=2&&n<=24e3?"mp4a.40.29":n<=24e3?"mp4a.40.5":"mp4a.40.2";if("mp3"===e)return"mp3";if("opus"===e)return"opus";if("vorbis"===e)return"vorbis";if("flac"===e)return"flac";else if(l.includes(e))return e;throw TypeError("Unhandled codec '".concat(e,"'."))},I=function(e){var r=e.codec,n=e.codecDescription,a=e.aacCodecInfo;if("aac"===r){if(!a)throw TypeError("AAC codec info must be provided.");if(a.isMpeg2)return"mp4a.67";var i=P(n);return"mp4a.40.".concat(i.objectType)}if("mp3"===r)return"mp3";if("opus"===r)return"opus";if("vorbis"===r)return"vorbis";if("flac"===r)return"flac";else if(r&&l.includes(r))return r;throw TypeError("Unhandled codec '".concat(r,"'."))},E=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],j=[-1,1,2,3,4,5,6,8],P=function(e){if(!e||e.byteLength<2)throw TypeError("AAC description must be at least 2 bytes long.");var r=new(0,c.Bitstream)(e),n=r.readBits(5);31===n&&(n=32+r.readBits(6));var a=r.readBits(4),i=null;15===a?i=r.readBits(24):a<E.length&&(i=E[a]);var s=r.readBits(4),o=null;return s>=1&&s<=7&&(o=j[s]),{objectType:n,frequencyIndex:a,sampleRate:i,channelConfiguration:s,numberOfChannels:o}},C=function(e){var r=E.indexOf(e.sampleRate),n=null;-1===r&&(r=15,n=e.sampleRate);var a=j.indexOf(e.numberOfChannels);if(-1===a)throw TypeError("Unsupported number of channels: ".concat(e.numberOfChannels));var i=13;e.objectType>=32&&(i+=6),15===r&&(i+=24);var s=new Uint8Array(Math.ceil(i/8)),o=new(0,c.Bitstream)(s);return e.objectType<32?o.writeBits(5,e.objectType):(o.writeBits(5,31),o.writeBits(6,e.objectType-32)),o.writeBits(4,r),15===r&&o.writeBits(24,n),o.writeBits(4,a),s},A=48e3,B=/^pcm-([usf])(\d+)+(be)?$/,M=function(e){if((0,c.assert)(l.includes(e)),"ulaw"===e)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===e)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};var r=B.exec(e);return(0,c.assert)(r),{dataType:"u"===r[1]?"unsigned":"s"===r[1]?"signed":"float",sampleSize:Number(r[2])/8,littleEndian:"be"!==r[3],silentValue:128*("pcm-u8"===e)}},D=function(e){if(e.startsWith("avc1")||e.startsWith("avc3"))return"avc";if(e.startsWith("hev1")||e.startsWith("hvc1"))return"hevc";if("vp8"===e)return"vp8";if(e.startsWith("vp09"))return"vp9";if(e.startsWith("av01"))return"av1";if(e.startsWith("mp4a.40")||"mp4a.67"===e)return"aac";if("mp3"===e||"mp4a.69"===e||"mp4a.6B"===e||"mp4a.6b"===e)return"mp3";if("opus"===e)return"opus";if("vorbis"===e)return"vorbis";if("flac"===e)return"flac";else if("ulaw"===e)return"ulaw";else if("alaw"===e)return"alaw";else if(B.test(e))return e;return"webvtt"===e?"webvtt":null},F=function(e){return"avc"===e?{avc:{format:"avc"}}:"hevc"===e?{hevc:{format:"hevc"}}:{}},R=function(e){return"aac"===e?{aac:{format:"aac"}}:"opus"===e?{opus:{format:"opus"}}:{}},U=["avc1","avc3","hev1","hvc1","vp8","vp09","av01"],O=/^(avc1|avc3)\.[0-9a-fA-F]{6}$/,L=/^(hev1|hvc1)\.(?:[ABC]?\d+)\.[0-9a-fA-F]{1,8}\.[LH]\d+(?:\.[0-9a-fA-F]{1,2}){0,6}$/,N=/^vp09(?:\.\d{2}){3}(?:(?:\.\d{2}){5})?$/,V=/^av01\.\d\.\d{2}[MH]\.\d{2}(?:\.\d\.\d{3}\.\d{2}\.\d{2}\.\d{2}\.\d)?$/,z=function(e){if(!e)throw TypeError("Video chunk metadata must be provided.");if((void 0===e?"undefined":(0,o._)(e))!=="object")throw TypeError("Video chunk metadata must be an object.");if(!e.decoderConfig)throw TypeError("Video chunk metadata must include a decoder configuration.");if("object"!==(0,o._)(e.decoderConfig))throw TypeError("Video chunk metadata decoder configuration must be an object.");if("string"!=typeof e.decoderConfig.codec)throw TypeError("Video chunk metadata decoder configuration must specify a codec string.");if(!U.some(function(r){return e.decoderConfig.codec.startsWith(r)}))throw TypeError("Video chunk metadata decoder configuration codec string must be a valid video codec string as specified in the WebCodecs Codec Registry.");if(!Number.isInteger(e.decoderConfig.codedWidth)||e.decoderConfig.codedWidth<=0)throw TypeError("Video chunk metadata decoder configuration must specify a valid codedWidth (positive integer).");if(!Number.isInteger(e.decoderConfig.codedHeight)||e.decoderConfig.codedHeight<=0)throw TypeError("Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).");if(void 0!==e.decoderConfig.description&&!(0,c.isAllowSharedBufferSource)(e.decoderConfig.description))throw TypeError("Video chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.");if(void 0!==e.decoderConfig.colorSpace){var r=e.decoderConfig.colorSpace;if((void 0===r?"undefined":(0,o._)(r))!=="object")throw TypeError("Video chunk metadata decoder configuration colorSpace, when provided, must be an object.");var n=Object.keys(c.COLOR_PRIMARIES_MAP);if(null!=r.primaries&&!n.includes(r.primaries))throw TypeError("Video chunk metadata decoder configuration colorSpace primaries, when defined, must be one of"+" ".concat(n.join(", "),"."));var a=Object.keys(c.TRANSFER_CHARACTERISTICS_MAP);if(null!=r.transfer&&!a.includes(r.transfer))throw TypeError("Video chunk metadata decoder configuration colorSpace transfer, when defined, must be one of"+" ".concat(a.join(", "),"."));var i=Object.keys(c.MATRIX_COEFFICIENTS_MAP);if(null!=r.matrix&&!i.includes(r.matrix))throw TypeError("Video chunk metadata decoder configuration colorSpace matrix, when defined, must be one of"+" ".concat(i.join(", "),"."));if(null!=r.fullRange&&"boolean"!=typeof r.fullRange)throw TypeError("Video chunk metadata decoder configuration colorSpace fullRange, when defined, must be a boolean.")}if(e.decoderConfig.codec.startsWith("avc1")||e.decoderConfig.codec.startsWith("avc3")){if(!O.test(e.decoderConfig.codec))throw TypeError("Video chunk metadata decoder configuration codec string for AVC must be a valid AVC codec string as specified in Section 3.4 of RFC 6381.")}else if(e.decoderConfig.codec.startsWith("hev1")||e.decoderConfig.codec.startsWith("hvc1")){if(!L.test(e.decoderConfig.codec))throw TypeError("Video chunk metadata decoder configuration codec string for HEVC must be a valid HEVC codec string as specified in Section E.3 of ISO 14496-15.")}else if(e.decoderConfig.codec.startsWith("vp8")){if("vp8"!==e.decoderConfig.codec)throw TypeError('Video chunk metadata decoder configuration codec string for VP8 must be "vp8".')}else if(e.decoderConfig.codec.startsWith("vp09")){if(!N.test(e.decoderConfig.codec))throw TypeError('Video chunk metadata decoder configuration codec string for VP9 must be a valid VP9 codec string as specified in Section "Codecs Parameter String" of https://www.webmproject.org/vp9/mp4/.')}else if(e.decoderConfig.codec.startsWith("av01")&&!V.test(e.decoderConfig.codec))throw TypeError('Video chunk metadata decoder configuration codec string for AV1 must be a valid AV1 codec string as specified in Section "Codecs Parameter String" of https://aomediacodec.github.io/av1-isobmff/.')},H=["mp4a","mp3","opus","vorbis","flac","ulaw","alaw","pcm"],G=function(e){if(!e)throw TypeError("Audio chunk metadata must be provided.");if((void 0===e?"undefined":(0,o._)(e))!=="object")throw TypeError("Audio chunk metadata must be an object.");if(!e.decoderConfig)throw TypeError("Audio chunk metadata must include a decoder configuration.");if("object"!==(0,o._)(e.decoderConfig))throw TypeError("Audio chunk metadata decoder configuration must be an object.");if("string"!=typeof e.decoderConfig.codec)throw TypeError("Audio chunk metadata decoder configuration must specify a codec string.");if(!H.some(function(r){return e.decoderConfig.codec.startsWith(r)}))throw TypeError("Audio chunk metadata decoder configuration codec string must be a valid audio codec string as specified in the WebCodecs Codec Registry.");if(!Number.isInteger(e.decoderConfig.sampleRate)||e.decoderConfig.sampleRate<=0)throw TypeError("Audio chunk metadata decoder configuration must specify a valid sampleRate (positive integer).");if(!Number.isInteger(e.decoderConfig.numberOfChannels)||e.decoderConfig.numberOfChannels<=0)throw TypeError("Audio chunk metadata decoder configuration must specify a valid numberOfChannels (positive integer).");if(void 0!==e.decoderConfig.description&&!(0,c.isAllowSharedBufferSource)(e.decoderConfig.description))throw TypeError("Audio chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.");if(e.decoderConfig.codec.startsWith("mp4a")&&"mp4a.69"!==e.decoderConfig.codec&&"mp4a.6B"!==e.decoderConfig.codec&&"mp4a.6b"!==e.decoderConfig.codec){if(!["mp4a.40.2","mp4a.40.02","mp4a.40.5","mp4a.40.05","mp4a.40.29","mp4a.67"].includes(e.decoderConfig.codec))throw TypeError("Audio chunk metadata decoder configuration codec string for AAC must be a valid AAC codec string as specified in https://www.w3.org/TR/webcodecs-aac-codec-registration/.");if(!e.decoderConfig.description)throw TypeError("Audio chunk metadata decoder configuration for AAC must include a description, which is expected to be an AudioSpecificConfig as specified in ISO 14496-3.")}else if(e.decoderConfig.codec.startsWith("mp3")||e.decoderConfig.codec.startsWith("mp4a")){if("mp3"!==e.decoderConfig.codec&&"mp4a.69"!==e.decoderConfig.codec&&"mp4a.6B"!==e.decoderConfig.codec&&"mp4a.6b"!==e.decoderConfig.codec)throw TypeError('Audio chunk metadata decoder configuration codec string for MP3 must be "mp3", "mp4a.69" or "mp4a.6B".')}else if(e.decoderConfig.codec.startsWith("opus")){if("opus"!==e.decoderConfig.codec)throw TypeError('Audio chunk metadata decoder configuration codec string for Opus must be "opus".');if(e.decoderConfig.description&&e.decoderConfig.description.byteLength<18)throw TypeError("Audio chunk metadata decoder configuration description, when specified, is expected to be an Identification Header as specified in Section 5.1 of RFC 7845.")}else if(e.decoderConfig.codec.startsWith("vorbis")){if("vorbis"!==e.decoderConfig.codec)throw TypeError('Audio chunk metadata decoder configuration codec string for Vorbis must be "vorbis".');if(!e.decoderConfig.description)throw TypeError("Audio chunk metadata decoder configuration for Vorbis must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-vorbis-codec-registration/.")}else if(e.decoderConfig.codec.startsWith("flac")){if("flac"!==e.decoderConfig.codec)throw TypeError('Audio chunk metadata decoder configuration codec string for FLAC must be "flac".');if(!e.decoderConfig.description||e.decoderConfig.description.byteLength<42)throw TypeError("Audio chunk metadata decoder configuration for FLAC must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-flac-codec-registration/.")}else if((e.decoderConfig.codec.startsWith("pcm")||e.decoderConfig.codec.startsWith("ulaw")||e.decoderConfig.codec.startsWith("alaw"))&&!l.includes(e.decoderConfig.codec))throw TypeError("Audio chunk metadata decoder configuration codec string for PCM must be one of the supported PCM"+" codecs (".concat(l.join(", "),")."))},q=function(e){if(!e)throw TypeError("Subtitle metadata must be provided.");if((void 0===e?"undefined":(0,o._)(e))!=="object")throw TypeError("Subtitle metadata must be an object.");if(!e.config)throw TypeError("Subtitle metadata must include a config object.");if("object"!==(0,o._)(e.config))throw TypeError("Subtitle metadata config must be an object.");if("string"!=typeof e.config.description)throw TypeError("Subtitle metadata config description must be a string.")}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_type_of.cjs":"iXhRw","./misc.js":"j7iGm","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],j7iGm:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"assert",function(){return _}),i.export(n,"normalizeRotation",function(){return y}),i.export(n,"last",function(){return S}),i.export(n,"isU32",function(){return w}),i.export(n,"Bitstream",function(){return T}),i.export(n,"readExpGolomb",function(){return x}),i.export(n,"readSignedExpGolomb",function(){return I}),i.export(n,"writeBits",function(){return E}),i.export(n,"toUint8Array",function(){return j}),i.export(n,"toDataView",function(){return P}),i.export(n,"textDecoder",function(){return C}),i.export(n,"textEncoder",function(){return A}),i.export(n,"isIso88591Compatible",function(){return B}),i.export(n,"COLOR_PRIMARIES_MAP",function(){return D}),i.export(n,"COLOR_PRIMARIES_MAP_INVERSE",function(){return F}),i.export(n,"TRANSFER_CHARACTERISTICS_MAP",function(){return R}),i.export(n,"TRANSFER_CHARACTERISTICS_MAP_INVERSE",function(){return U}),i.export(n,"MATRIX_COEFFICIENTS_MAP",function(){return O}),i.export(n,"MATRIX_COEFFICIENTS_MAP_INVERSE",function(){return L}),i.export(n,"colorSpaceIsComplete",function(){return N}),i.export(n,"isAllowSharedBufferSource",function(){return V}),i.export(n,"AsyncMutex",function(){return z}),i.export(n,"bytesToHexString",function(){return H}),i.export(n,"reverseBitsU32",function(){return G}),i.export(n,"binarySearchExact",function(){return q}),i.export(n,"binarySearchLessOrEqual",function(){return W}),i.export(n,"insertSorted",function(){return K}),i.export(n,"promiseWithResolvers",function(){return X}),i.export(n,"removeItem",function(){return Q}),i.export(n,"findLast",function(){return Z}),i.export(n,"findLastIndex",function(){return Y}),i.export(n,"toAsyncIterator",function(){return J}),i.export(n,"validateAnyIterable",function(){return $}),i.export(n,"assertNever",function(){return ee}),i.export(n,"getUint24",function(){return et}),i.export(n,"getInt24",function(){return er}),i.export(n,"setUint24",function(){return en}),i.export(n,"setInt24",function(){return ea}),i.export(n,"setInt64",function(){return ei}),i.export(n,"mapAsyncGenerator",function(){return es}),i.export(n,"clamp",function(){return eo}),i.export(n,"UNDETERMINED_LANGUAGE",function(){return ec}),i.export(n,"roundIfAlmostInteger",function(){return eu}),i.export(n,"roundToMultiple",function(){return el}),i.export(n,"ilog",function(){return ed}),i.export(n,"isIso639Dash2LanguageCode",function(){return eh}),i.export(n,"SECOND_TO_MICROSECOND_FACTOR",function(){return ep}),i.export(n,"mergeRequestInit",function(){return em}),i.export(n,"retriedFetch",function(){return ev}),i.export(n,"computeRationalApproximation",function(){return eb}),i.export(n,"CallSerializer",function(){return ek}),i.export(n,"isWebKit",function(){return ey}),i.export(n,"isFirefox",function(){return ew}),i.export(n,"isChromium",function(){return ex}),i.export(n,"getChromiumVersion",function(){return eE}),i.export(n,"coalesceIndex",function(){return ej}),i.export(n,"closedIntervalsOverlap",function(){return eP}),i.export(n,"keyValueIterator",function(){return eC}),i.export(n,"imageMimeTypeToExtension",function(){return eA}),i.export(n,"base64ToBytes",function(){return eB}),i.export(n,"bytesToBase64",function(){return eM}),i.export(n,"uint8ArraysAreEqual",function(){return eD}),i.export(n,"polyfillSymbolDispose",function(){return eF}),i.export(n,"isNumber",function(){return eR});var s=e("@swc/helpers/cjs/_async_generator_delegate.cjs"),o=e("@swc/helpers/cjs/_async_iterator.cjs"),c=e("@swc/helpers/cjs/_async_to_generator.cjs"),u=e("@swc/helpers/cjs/_class_call_check.cjs"),l=e("@swc/helpers/cjs/_create_class.cjs"),d=e("@swc/helpers/cjs/_define_property.cjs"),f=e("@swc/helpers/cjs/_object_spread.cjs"),h=e("@swc/helpers/cjs/_sliced_to_array.cjs"),p=e("@swc/helpers/cjs/_to_consumable_array.cjs"),m=e("@swc/helpers/cjs/_type_of.cjs"),g=e("@swc/helpers/cjs/_wrap_async_generator.cjs"),b=e("@swc/helpers/cjs/_ts_generator.cjs"),k=e("@swc/helpers/cjs/_ts_values.cjs");function _(e){if(!e)throw Error("Assertion failed.")}var y=function(e){var r=(e%360+360)%360;if(0===r||90===r||180===r||270===r)return r;throw Error("Invalid rotation ".concat(e,"."))},S=function(e){return e&&e[e.length-1]},w=function(e){return e>=0&&e<0x100000000},T=function(){"use strict";function e(r){(0,u._)(this,e),this.bytes=r,this.pos=0}return(0,l._)(e,[{key:"seekToByte",value:function(e){this.pos=8*e}},{key:"readBit",value:function(){var e,r=Math.floor(this.pos/8),n=null!=(e=this.bytes[r])?e:0,a=7-(7&this.pos);return this.pos++,(n&1<<a)>>a}},{key:"readBits",value:function(e){if(1===e)return this.readBit();for(var r=0,n=0;n<e;n++)r<<=1,r|=this.readBit();return r}},{key:"writeBits",value:function(e,r){for(var n=this.pos+e,a=this.pos;a<n;a++){var i=Math.floor(a/8),s=this.bytes[i],o=7-(7&a);s&=~(1<<o),s|=(r&1<<n-a-1)>>n-a-1<<o,this.bytes[i]=s}this.pos=n}},{key:"readAlignedByte",value:function(){if(this.pos%8!=0)throw Error("Bitstream is not byte-aligned.");var e,r=this.pos/8,n=null!=(e=this.bytes[r])?e:0;return this.pos+=8,n}},{key:"skipBits",value:function(e){this.pos+=e}},{key:"getBitsLeft",value:function(){return 8*this.bytes.length-this.pos}},{key:"clone",value:function(){var r=new e(this.bytes);return r.pos=this.pos,r}}]),e}(),x=function(e){for(var r=0;0===e.readBits(1)&&r<32;)r++;if(r>=32)throw Error("Invalid exponential-Golomb code.");return(1<<r)-1+e.readBits(r)},I=function(e){var r=x(e);return(1&r)==0?-(r>>1):r+1>>1},E=function(e,r,n,a){for(var i=r;i<n;i++){var s=Math.floor(i/8),o=e[s],c=7-(7&i);o&=~(1<<c),o|=(a&1<<n-i-1)>>n-i-1<<c,e[s]=o}},j=function(e){return e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)},P=function(e){return e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)},C=new TextDecoder,A=new TextEncoder,B=function(e){for(var r=0;r<e.length;r++)if(e.charCodeAt(r)>255)return!1;return!0},M=function(e){return Object.fromEntries(Object.entries(e).map(function(e){var r=(0,h._)(e,2),n=r[0];return[r[1],n]}))},D={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},F=M(D),R={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},U=M(R),O={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},L=M(O),N=function(e){return!!e&&!!e.primaries&&!!e.transfer&&!!e.matrix&&void 0!==e.fullRange},V=function(e){return e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e)},z=function(){"use strict";function e(){(0,u._)(this,e),this.currentPromise=Promise.resolve()}return(0,l._)(e,[{key:"acquire",value:function(){return(0,c._)(function(){var e,r,n;return(0,b._)(this,function(a){switch(a.label){case 0:return r=new Promise(function(r){e=r}),n=this.currentPromise,this.currentPromise=r,[4,n];case 1:return a.sent(),[2,e]}})}).call(this)}}]),e}(),H=function(e){return(0,p._)(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("")},G=function(e){return(e=(e=(e=(e=(e=e>>1&0x55555555|(0x55555555&e)<<1)>>2&0x33333333|(0x33333333&e)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&e)<<4)>>8&0xff00ff|(0xff00ff&e)<<8)>>16&65535|(65535&e)<<16)>>>0},q=function(e,r,n){for(var a=0,i=e.length-1,s=-1;a<=i;){var o=a+i>>1,c=n(e[o]);c===r?(s=o,i=o-1):c<r?a=o+1:i=o-1}return s},W=function(e,r,n){for(var a=0,i=e.length-1,s=-1;a<=i;){var o=a+(i-a+1)/2|0;n(e[o])<=r?(s=o,a=o+1):i=o-1}return s},K=function(e,r,n){var a=W(e,n(r),n);e.splice(a+1,0,r)},X=function(){var e,r;return{promise:new Promise(function(n,a){e=n,r=a}),resolve:e,reject:r}},Q=function(e,r){var n=e.indexOf(r);-1!==n&&e.splice(n,1)},Z=function(e,r){for(var n=e.length-1;n>=0;n--)if(r(e[n]))return e[n]},Y=function(e,r){for(var n=e.length-1;n>=0;n--)if(r(e[n]))return n;return -1},J=function(e){return(0,g._)(function(){return(0,b._)(this,function(r){switch(r.label){case 0:if(!(Symbol.iterator in e))return[3,2];return[5,(0,k._)((0,s._)((0,o._)(e[Symbol.iterator]())))];case 1:return r.sent(),[3,4];case 2:return[5,(0,k._)((0,s._)((0,o._)(e[Symbol.asyncIterator]())))];case 3:r.sent(),r.label=4;case 4:return[2]}})})()},$=function(e){if(!(Symbol.iterator in e)&&!(Symbol.asyncIterator in e))throw TypeError("Argument must be an iterable or async iterable.")},ee=function(e){throw Error("Unexpected value: ".concat(e))},et=function(e,r,n){var a=e.getUint8(r),i=e.getUint8(r+1),s=e.getUint8(r+2);return n?a|i<<8|s<<16:a<<16|i<<8|s},er=function(e,r,n){return et(e,r,n)<<8>>8},en=function(e,r,n,a){n>>>=0,n&=0xffffff,a?(e.setUint8(r,255&n),e.setUint8(r+1,n>>>8&255),e.setUint8(r+2,n>>>16&255)):(e.setUint8(r,n>>>16&255),e.setUint8(r+1,n>>>8&255),e.setUint8(r+2,255&n))},ea=function(e,r,n,a){(n=eo(n,-8388608,8388607))<0&&(n=n+0x1000000&0xffffff),en(e,r,n,a)},ei=function(e,r,n,a){a?(e.setUint32(r+0,n,!0),e.setInt32(r+4,Math.floor(n/0x100000000),!0)):(e.setInt32(r+0,Math.floor(n/0x100000000),!0),e.setUint32(r+4,n,!0))},es=function(e,r){return(0,d._)({next:function(){return(0,c._)(function(){var n;return(0,b._)(this,function(a){switch(a.label){case 0:return[4,e.next()];case 1:if((n=a.sent()).done)return[2,{value:void 0,done:!0}];return[2,{value:r(n.value),done:!1}]}})})()},return:function(){return e.return()},throw:function(r){return e.throw(r)}},Symbol.asyncIterator,function(){return this})},eo=function(e,r,n){return Math.max(r,Math.min(n,e))},ec="und",eu=function(e){var r=Math.round(e);return Math.abs(e/r-1)<10*Number.EPSILON?r:e},el=function(e,r){return Math.round(e/r)*r},ed=function(e){for(var r=0;e;)r++,e>>=1;return r},ef=/^[a-z]{3}$/,eh=function(e){return ef.test(e)},ep=1e6*(1+Number.EPSILON),em=function(e,r){var n=(0,f._)({},e,r);if(e.headers||r.headers){var a=e.headers?eg(e.headers):{},i=r.headers?eg(r.headers):{},s=(0,f._)({},a);Object.entries(i).forEach(function(e){var r=(0,h._)(e,2),n=r[0],a=r[1],i=Object.keys(s).find(function(e){return e.toLowerCase()===n.toLowerCase()});i&&delete s[i],s[n]=a}),n.headers=s}return n},eg=function(e){if(e instanceof Headers){var r={};return e.forEach(function(e,n){r[n]=e}),r}if(Array.isArray(e)){var n={};return e.forEach(function(e){var r=(0,h._)(e,2),a=r[0],i=r[1];n[a]=i}),n}return e},ev=function(e,r,n,a,i){return(0,c._)(function(){var s,o,c;return(0,b._)(this,function(u){switch(u.label){case 0:s=function(){var s,c,u;return(0,b._)(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,5]),s={},[4,e(r,n)];case 1:return[2,(s.v=l.sent(),s)];case 2:if(c=l.sent(),i()||null===(u=a(++o,c,r)))throw c;if(console.error("Retrying failed fetch. Error:",c),!Number.isFinite(u)||u<0)throw TypeError("Retry delay must be a non-negative finite number.");if(!(u>0))return[3,4];return[4,new Promise(function(e){return setTimeout(e,1e3*u)})];case 3:l.sent(),l.label=4;case 4:if(i())throw c;return[3,5];case 5:return[2]}})},o=0,u.label=1;case 1:return[5,(0,k._)(s())];case 2:if(c=u.sent(),"object"===(0,m._)(c))return[2,c.v];return[3,1];case 3:return[2]}})})()},eb=function(e,r){for(var n=e<0?-1:1,a=0,i=1,s=1,o=0,c=e=Math.abs(e);;){var u=Math.floor(c),l=u*s+a,d=u*o+i;if(d>r||(a=s,i=o,s=l,o=d,!isFinite(c=1/(c-u))))break}return{numerator:n*s,denominator:o}},ek=function(){"use strict";function e(){(0,u._)(this,e),this.currentPromise=Promise.resolve()}return(0,l._)(e,[{key:"call",value:function(e){return this.currentPromise=this.currentPromise.then(e)}}]),e}(),e_=null,ey=function(){var e;return null!==e_?e_:e_=!!("undefined"!=typeof navigator&&((null==(e=navigator.vendor)?void 0:e.match(/apple/i))||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)))},eS=null,ew=function(){var e;return null!==eS?eS:eS="undefined"!=typeof navigator&&(null==(e=navigator.userAgent)?void 0:e.includes("Firefox"))},eT=null,ex=function(){var e;return null!==eT?eT:eT=!!("undefined"!=typeof navigator&&((null==(e=navigator.vendor)?void 0:e.includes("Google Inc"))||/Chrome/.test(navigator.userAgent)))},eI=null,eE=function(){if(null!==eI)return eI;if("undefined"==typeof navigator)return null;var e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?eI=Number(e[1]):null},ej=function(e,r){return -1!==e?e:r},eP=function(e,r,n,a){return e<=a&&n<=r},eC=function(e){var r,n,a,i,s;return(0,b._)(this,function(o){switch(o.label){case 0:for(n in r=[],e)r.push(n);a=0,o.label=1;case 1:if(!(a<r.length))return[3,4];if(void 0===(s=e[i=r[a]]))return[3,3];return[4,{key:i,value:s}];case 2:o.sent(),o.label=3;case 3:return a++,[3,1];case 4:return[2]}})},eA=function(e){switch(e.toLowerCase()){case"image/jpeg":case"image/jpg":return".jpg";case"image/png":return".png";case"image/gif":return".gif";case"image/webp":return".webp";case"image/bmp":return".bmp";case"image/svg+xml":return".svg";case"image/tiff":return".tiff";case"image/avif":return".avif";case"image/x-icon":case"image/vnd.microsoft.icon":return".ico";default:return null}},eB=function(e){for(var r=atob(e),n=new Uint8Array(r.length),a=0;a<r.length;a++)n[a]=r.charCodeAt(a);return n},eM=function(e){for(var r="",n=0;n<e.length;n++)r+=String.fromCharCode(e[n]);return btoa(r)},eD=function(e,r){if(e.length!==r.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==r[n])return!1;return!0},eF=function(){var e;null!=(e=Symbol).dispose||(e.dispose=Symbol("Symbol.dispose"))},eR=function(e){return"number"==typeof e&&!Number.isNaN(e)}},{"@swc/helpers/cjs/_async_generator_delegate.cjs":"cj5hX","@swc/helpers/cjs/_async_iterator.cjs":"f3IhJ","@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_define_property.cjs":"ltU3W","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_wrap_async_generator.cjs":"jAJTq","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@swc/helpers/cjs/_ts_values.cjs":"94P5Q","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cj5hX:[function(e,r,n,a){"use strict";var i=e("76fcdd7f180a7e89");n._=function(e){var r={},n=!1;function a(r,a){return n=!0,a=new Promise(function(n){n(e[r](a))}),{done:!1,value:new i._(a,1)}}return r["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},r.next=function(e){return n?(n=!1,e):a("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return a("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return n?(n=!1,e):a("return",e)}),r}},{"76fcdd7f180a7e89":"6nOfv"}],"6nOfv":[function(e,r,n,a){"use strict";n._=function(e,r){this.v=e,this.k=r}},{}],f3IhJ:[function(e,r,n,a){"use strict";function i(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(i=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):r(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):r(n.apply(this.s,arguments))}},new i(e)}n._=function(e){var r,n,a,s=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,a=Symbol.iterator);s--;){if(n&&null!=(r=e[n]))return r.call(e);if(a&&null!=(r=e[a]))return new i(r.call(e));n="@@asyncIterator",a="@@iterator"}throw TypeError("Object is not async iterable")}},{}],"4Uf9M":[function(e,r,n,a){"use strict";n._=function(e,r){if(!(e instanceof r))throw TypeError("Cannot call a class as a function")}},{}],igUuK:[function(e,r,n,a){"use strict";function i(e,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}n._=function(e,r,n){return r&&i(e.prototype,r),n&&i(e,n),e}},{}],ltU3W:[function(e,r,n,a){"use strict";n._=function(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}},{}],kyoEj:[function(e,r,n,a){"use strict";var i=e("9f9b8a24218ee51e");n._=function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(r){i._(e,r,n[r])})}return e}},{"9f9b8a24218ee51e":"ltU3W"}],gIQTH:[function(e,r,n,a){"use strict";var i=e("d7c30a5ae0c1ab2"),s=e("3aacfce52f67defd"),o=e("f0dae09a1a08b16a"),c=e("83f3648e614d0830");n._=function(e,r){return i._(e)||s._(e,r)||c._(e,r)||o._()}},{d7c30a5ae0c1ab2:"3QSPl","3aacfce52f67defd":"5SSeo",f0dae09a1a08b16a:"heYSj","83f3648e614d0830":"fh7mx"}],"3QSPl":[function(e,r,n,a){"use strict";n._=function(e){if(Array.isArray(e))return e}},{}],"5SSeo":[function(e,r,n,a){"use strict";n._=function(e,r){var n,a,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var s=[],o=!0,c=!1;try{for(i=i.call(e);!(o=(n=i.next()).done)&&(s.push(n.value),!r||s.length!==r);o=!0);}catch(e){c=!0,a=e}finally{try{o||null==i.return||i.return()}finally{if(c)throw a}}return s}}},{}],heYSj:[function(e,r,n,a){"use strict";n._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],jAJTq:[function(e,r,n,a){"use strict";var i=e("daf10f6c5064dcd0");n._=function(e){return function(){return new i._(e.apply(this,arguments))}}},{daf10f6c5064dcd0:"jrb7J"}],jrb7J:[function(e,r,n,a){"use strict";var i=e("b1fa00dbb84c97b3");function s(e){var r,n;function a(r,n){try{var o=e[r](n),c=o.value,u=c instanceof i._;Promise.resolve(u?c.v:c).then(function(n){if(u){var i="return"===r?"return":"next";if(!c.k||n.done)return a(i,n);n=e[i](n).value}s(o.done?"return":"normal",n)},function(e){a("throw",e)})}catch(e){s("throw",e)}}function s(e,i){switch(e){case"return":r.resolve({value:i,done:!0});break;case"throw":r.reject(i);break;default:r.resolve({value:i,done:!1})}(r=r.next)?a(r.key,r.arg):n=null}this._invoke=function(e,i){return new Promise(function(s,o){var c={key:e,arg:i,resolve:s,reject:o,next:null};n?n=n.next=c:(r=n=c,a(e,i))})},"function"!=typeof e.return&&(this.return=void 0)}s.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},s.prototype.next=function(e){return this._invoke("next",e)},s.prototype.throw=function(e){return this._invoke("throw",e)},s.prototype.return=function(e){return this._invoke("return",e)},n._=s},{b1fa00dbb84c97b3:"6nOfv"}],"7vKle":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"Source",function(){return k}),i.export(n,"BufferSource",function(){return _}),i.export(n,"BlobSource",function(){return y}),i.export(n,"UrlSource",function(){return w}),i.export(n,"FilePathSource",function(){return T}),i.export(n,"StreamSource",function(){return x}),i.export(n,"ReadableStreamSource",function(){return I});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_type_of.cjs"),f=e("@swc/helpers/cjs/_ts_generator.cjs"),h=e("@swc/helpers/cjs/_ts_values.cjs"),p=e("./misc.js"),m=e("./node.js"),g=e("./input.js"),b=void 0!==m?m:void 0,k=function(){"use strict";function e(){(0,c._)(this,e),this._disposed=!1,this._sizePromise=null,this.onread=null}return(0,u._)(e,[{key:"getSizeOrNull",value:function(){return(0,s._)(function(){var e;return(0,f._)(this,function(r){if(this._disposed)throw new(0,g.InputDisposedError);return[2,null!=(e=this._sizePromise)?e:this._sizePromise=Promise.resolve(this._retrieveSize())]})}).call(this)}},{key:"getSize",value:function(){return(0,s._)(function(){var e;return(0,f._)(this,function(r){switch(r.label){case 0:if(this._disposed)throw new(0,g.InputDisposedError);return[4,this.getSizeOrNull()];case 1:if(null===(e=r.sent()))throw Error("Cannot determine the size of an unsized source.");return[2,e]}})}).call(this)}}]),e}(),_=function(e){"use strict";function r(e){var n;if((0,c._)(this,r),!(e instanceof ArrayBuffer)&&!("undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)&&!ArrayBuffer.isView(e))throw TypeError("buffer must be an ArrayBuffer, SharedArrayBuffer, or ArrayBufferView.");return(n=(0,o._)(this,r))._onreadCalled=!1,n._bytes=(0,p.toUint8Array)(e),n._view=(0,p.toDataView)(e),n}return(0,l._)(r,e),(0,u._)(r,[{key:"_retrieveSize",value:function(){return this._bytes.byteLength}},{key:"_read",value:function(){if(!this._onreadCalled){var e;null==(e=this.onread)||e.call(this,0,this._bytes.byteLength),this._onreadCalled=!0}return{bytes:this._bytes,view:this._view,offset:0}}},{key:"_dispose",value:function(){}}]),r}(k),y=function(e){"use strict";function r(e){var n,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,c._)(this,r),!(e instanceof Blob))throw TypeError("blob must be a Blob.");if(!i||(void 0===i?"undefined":(0,d._)(i))!=="object")throw TypeError("options must be an object.");if(void 0!==i.maxCacheSize&&(!(0,p.isNumber)(i.maxCacheSize)||i.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");return(n=(0,o._)(this,r))._readers=new WeakMap,n._blob=e,n._orchestrator=new j({maxCacheSize:null!=(a=i.maxCacheSize)?a:8388608,maxWorkerCount:4,runWorker:n._runWorker.bind(n),prefetchProfile:E.fileSystem}),n}return(0,l._)(r,e),(0,u._)(r,[{key:"_retrieveSize",value:function(){var e=this._blob.size;return this._orchestrator.fileSize=e,e}},{key:"_read",value:function(e,r){return this._orchestrator.read(e,r)}},{key:"_runWorker",value:function(e){return(0,s._)(function(){var r,n,a,i,s,o,c,u,l;return(0,f._)(this,function(d){switch(d.label){case 0:void 0===(r=this._readers.get(e))&&(r="stream"in this._blob&&!(0,p.isWebKit)()?this._blob.slice(e.currentPos).stream().getReader():null,this._readers.set(e,r)),d.label=1;case 1:if(!(e.currentPos<e.targetPos&&!e.aborted))return[3,6];if(!r)return[3,3];return[4,r.read()];case 2:if(s=(i=d.sent()).done,o=i.value,s)throw this._orchestrator.forgetWorker(e),Error("Blob reader stopped unexpectedly before all requested data was read.");if(e.aborted)return[3,6];return null==(n=(a=this).onread)||n.call(a,e.currentPos,e.currentPos+o.length),this._orchestrator.supplyWorkerData(e,o),[3,5];case 3:return[4,this._blob.slice(e.currentPos,e.targetPos).arrayBuffer()];case 4:if(l=d.sent(),e.aborted)return[3,6];null==(c=(u=this).onread)||c.call(u,e.currentPos,e.currentPos+l.byteLength),this._orchestrator.supplyWorkerData(e,new Uint8Array(l)),d.label=5;case 5:return[3,1];case 6:return e.running=!1,[2]}})}).call(this)}},{key:"_dispose",value:function(){this._orchestrator.dispose()}}]),r}(k),S=function(e,r,n){if(r instanceof Error&&(r.message.includes("Failed to fetch")||r.message.includes("Load failed")||r.message.includes("NetworkError when attempting to fetch resource"))){var a=null;try{"undefined"!=typeof window&&void 0!==window.location&&(a=new URL(n instanceof Request?n.url:n,window.location.href).origin)}catch(e){}if(("undefined"==typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine)&&null!==a&&a!==window.location.origin)return console.warn("Request will not be retried because a CORS error was suspected due to different origins. You can modify this behavior by providing your own function for the 'getRetryDelay' option."),null}return Math.min(Math.pow(2,e-2),16)},w=function(e){"use strict";function r(e){var n,a,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,c._)(this,r),"string"!=typeof e&&!(e instanceof URL)&&!("undefined"!=typeof Request&&e instanceof Request))throw TypeError("url must be a string, URL or Request.");if(!s||(void 0===s?"undefined":(0,d._)(s))!=="object")throw TypeError("options must be an object.");if(void 0!==s.requestInit&&(!s.requestInit||"object"!==(0,d._)(s.requestInit)))throw TypeError("options.requestInit, when provided, must be an object.");if(void 0!==s.getRetryDelay&&"function"!=typeof s.getRetryDelay)throw TypeError("options.getRetryDelay, when provided, must be a function.");if(void 0!==s.maxCacheSize&&(!(0,p.isNumber)(s.maxCacheSize)||s.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(void 0!==s.fetchFn&&"function"!=typeof s.fetchFn)throw TypeError("options.fetchFn, when provided, must be a function.");return(n=(0,o._)(this,r))._existingResponses=new WeakMap,n._url=e,n._options=s,n._getRetryDelay=null!=(a=s.getRetryDelay)?a:S,n._orchestrator=new j({maxCacheSize:null!=(i=s.maxCacheSize)?i:0x4000000,maxWorkerCount:2,runWorker:n._runWorker.bind(n),prefetchProfile:E.network}),n}return(0,l._)(r,e),(0,u._)(r,[{key:"_retrieveSize",value:function(){return(0,s._)(function(){var e,r,n,a,i,s,o,c;return(0,f._)(this,function(u){switch(u.label){case 0:return e=this,r=new AbortController,[4,(0,p.retriedFetch)(null!=(n=this._options.fetchFn)?n:fetch,this._url,(0,p.mergeRequestInit)(null!=(a=this._options.requestInit)?a:{},{headers:{Range:"bytes=0-"},signal:r.signal}),this._getRetryDelay,function(){return e._disposed})];case 1:if(!(i=u.sent()).ok)throw Error("Error fetching ".concat(String(this._url),": ").concat(i.status," ").concat(i.statusText));if(206===i.status)o=this._getTotalLengthFromRangeResponse(i),s=this._orchestrator.createWorker(0,Math.min(o,524288));else if(c=i.headers.get("Content-Length"))o=Number(c),s=this._orchestrator.createWorker(0,o),this._orchestrator.options.maxCacheSize=1/0,console.warn("HTTP server did not respond with 206 Partial Content, meaning the entire remote resource now has to be downloaded. For efficient media file streaming across a network, please make sure your server supports range requests.");else throw Error("HTTP response (status ".concat(i.status,") must surface Content-Length header."));return this._orchestrator.fileSize=o,this._existingResponses.set(s,{response:i,abortController:r}),this._orchestrator.runWorker(s),[2,o]}})}).call(this)}},{key:"_read",value:function(e,r){return this._orchestrator.read(e,r)}},{key:"_runWorker",value:function(e){return(0,s._)(function(){var r,n,a,i,s,o,c,u,l,m;return(0,f._)(this,function(g){switch(g.label){case 0:r=this,g.label=1;case 1:if(a=function(){var r,a,i,o,c,u,d;return(0,f._)(this,function(f){switch(f.label){case 0:if(e.currentPos>=e.targetPos||e.aborted)return s.abort(),e.running=!1,[2,{v:void 0}];i=void 0,f.label=1;case 1:return f.trys.push([1,3,,7]),[4,l.read()];case 2:return i=f.sent(),[3,7];case 3:if(o=f.sent(),n._disposed)throw o;if(null===(c=n._getRetryDelay(1,o,n._url)))return[3,5];return console.error("Error while reading response stream. Attempting to resume.",o),[4,new Promise(function(e){return setTimeout(e,1e3*c)})];case 4:return f.sent(),[2,"break"];case 5:throw o;case 6:return[3,7];case 7:if(e.aborted)return[2,"break"];if(u=i.done,d=i.value,u){if(e.currentPos>=e.targetPos)return n._orchestrator.forgetWorker(e),e.running=!1,[2,{v:void 0}];return[2,"break"]}return null==(r=(a=n).onread)||r.call(a,e.currentPos,e.currentPos+d.length),n._orchestrator.supplyWorkerData(e,d),[2]}})},i=this._existingResponses.get(e),this._existingResponses.delete(e),s=null==i?void 0:i.abortController,o=null==i?void 0:i.response,s)return[3,3];return s=new AbortController,[4,(0,p.retriedFetch)(null!=(c=this._options.fetchFn)?c:fetch,this._url,(0,p.mergeRequestInit)(null!=(u=this._options.requestInit)?u:{},{headers:{Range:"bytes=".concat(e.currentPos,"-")},signal:s.signal}),this._getRetryDelay,function(){return r._disposed})];case 2:o=g.sent(),g.label=3;case 3:if((0,p.assert)(o),!o.ok)throw Error("Error fetching ".concat(String(this._url),": ").concat(o.status," ").concat(o.statusText));if(e.currentPos>0&&206!==o.status)throw Error("HTTP server did not respond with 206 Partial Content to a range request. To enable efficient media file streaming across a network, please make sure your server supports range requests.");if(!o.body)throw Error("Missing HTTP response body stream. The used fetch function must provide the response body as a ReadableStream.");l=o.body.getReader(),g.label=4;case 4:return n=this,[5,(0,h._)(a())];case 5:if(m=g.sent(),"object"===(0,d._)(m))return[2,m.v];if("break"===m)return[3,6];return[3,4];case 6:if(e.aborted)return[3,7];return[3,1];case 7:return e.running=!1,[2]}})}).call(this)}},{key:"_getTotalLengthFromRangeResponse",value:function(e){var r=e.headers.get("Content-Range");if(r){var n=/\/(\d+)/.exec(r);if(n)return Number(n[1])}var a=e.headers.get("Content-Length");if(a)return Number(a);throw Error("Partial HTTP response (status 206) must surface either Content-Range or Content-Length header.")}},{key:"_dispose",value:function(){this._orchestrator.dispose()}}]),r}(k),T=function(e){"use strict";function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,c._)(this,r),"string"!=typeof e)throw TypeError("filePath must be a string.");if(!a||(void 0===a?"undefined":(0,d._)(a))!=="object")throw TypeError("options must be an object.");if(void 0!==a.maxCacheSize&&(!(0,p.isNumber)(a.maxCacheSize)||a.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");return(n=(0,o._)(this,r))._fileHandle=null,n._streamSource=new x({getSize:function(){return(0,s._)(function(){return(0,f._)(this,function(r){switch(r.label){case 0:return[4,b.fs.open(e,"r")];case 1:return n._fileHandle=r.sent(),[4,n._fileHandle.stat()];case 2:return[2,r.sent().size]}})})()},read:function(e,r){return(0,s._)(function(){var a;return(0,f._)(this,function(i){switch(i.label){case 0:return(0,p.assert)(n._fileHandle),a=new Uint8Array(r-e),[4,n._fileHandle.read(a,0,r-e,e)];case 1:return i.sent(),[2,a]}})})()},maxCacheSize:a.maxCacheSize,prefetchProfile:"fileSystem"}),n}return(0,l._)(r,e),(0,u._)(r,[{key:"_read",value:function(e,r){return this._streamSource._read(e,r)}},{key:"_retrieveSize",value:function(){return this._streamSource._retrieveSize()}},{key:"_dispose",value:function(){var e;this._streamSource._dispose(),null==(e=this._fileHandle)||e.close(),this._fileHandle=null}}]),r}(k),x=function(e){"use strict";function r(e){var n,a,i;if((0,c._)(this,r),!e||(void 0===e?"undefined":(0,d._)(e))!=="object")throw TypeError("options must be an object.");if("function"!=typeof e.getSize)throw TypeError("options.getSize must be a function.");if("function"!=typeof e.read)throw TypeError("options.read must be a function.");if(void 0!==e.dispose&&"function"!=typeof e.dispose)throw TypeError("options.dispose, when provided, must be a function.");if(void 0!==e.maxCacheSize&&(!(0,p.isNumber)(e.maxCacheSize)||e.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(e.prefetchProfile&&!["none","fileSystem","network"].includes(e.prefetchProfile))throw TypeError("options.prefetchProfile, when provided, must be one of 'none', 'fileSystem' or 'network'.");return(n=(0,o._)(this,r))._options=e,n._orchestrator=new j({maxCacheSize:null!=(a=e.maxCacheSize)?a:8388608,maxWorkerCount:2,prefetchProfile:E[null!=(i=e.prefetchProfile)?i:"none"],runWorker:n._runWorker.bind(n)}),n}return(0,l._)(r,e),(0,u._)(r,[{key:"_retrieveSize",value:function(){var e=this,r=this._options.getSize();if(r instanceof Promise)return r.then(function(r){if(!Number.isInteger(r)||r<0)throw TypeError("options.getSize must return or resolve to a non-negative integer.");return e._orchestrator.fileSize=r,r});if(!Number.isInteger(r)||r<0)throw TypeError("options.getSize must return or resolve to a non-negative integer.");return this._orchestrator.fileSize=r,r}},{key:"_read",value:function(e,r){return this._orchestrator.read(e,r)}},{key:"_runWorker",value:function(e){return(0,s._)(function(){var r,n,a,i,s,o,c,u,l,d,h,m;return(0,f._)(this,function(f){switch(f.label){case 0:if(!(e.currentPos<e.targetPos&&!e.aborted))return[3,9];if(r=e.currentPos,n=e.targetPos,!((a=this._options.read(e.currentPos,n))instanceof Promise))return[3,2];return[4,a];case 1:a=f.sent(),f.label=2;case 2:if(e.aborted)return[3,9];if(!(a instanceof Uint8Array))return[3,3];if((a=(0,p.toUint8Array)(a)).length!==n-e.currentPos)throw Error("options.read returned a Uint8Array with unexpected length: Requested ".concat(n-e.currentPos," bytes, but got ").concat(a.length,"."));return null==(i=(s=this).onread)||i.call(s,e.currentPos,e.currentPos+a.length),this._orchestrator.supplyWorkerData(e,a),[3,8];case 3:if(!(a instanceof ReadableStream))return[3,7];o=a.getReader(),f.label=4;case 4:if(!(e.currentPos<n&&!e.aborted))return[3,6];return[4,o.read()];case 5:if(d=(l=f.sent()).done,h=l.value,d){if(e.currentPos<n)throw Error("ReadableStream returned by options.read ended before supplying enough data."+" Requested ".concat(n-r," bytes, but got ").concat(e.currentPos-r));return[3,6]}if(!(h instanceof Uint8Array))throw TypeError("ReadableStream returned by options.read must yield Uint8Array chunks.");if(e.aborted)return[3,6];return m=(0,p.toUint8Array)(h),null==(c=(u=this).onread)||c.call(u,e.currentPos,e.currentPos+m.length),this._orchestrator.supplyWorkerData(e,m),[3,4];case 6:return[3,8];case 7:throw TypeError("options.read must return or resolve to a Uint8Array or a ReadableStream.");case 8:return[3,0];case 9:return e.running=!1,[2]}})}).call(this)}},{key:"_dispose",value:function(){var e,r;this._orchestrator.dispose(),null==(e=(r=this._options).dispose)||e.call(r)}}]),r}(k),I=function(e){"use strict";function r(e){var n,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,c._)(this,r),!(e instanceof ReadableStream))throw TypeError("stream must be a ReadableStream.");if(!i||(void 0===i?"undefined":(0,d._)(i))!=="object")throw TypeError("options must be an object.");if(void 0!==i.maxCacheSize&&(!(0,p.isNumber)(i.maxCacheSize)||i.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");return(n=(0,o._)(this,r))._reader=null,n._cache=[],n._pendingSlices=[],n._currentIndex=0,n._targetIndex=0,n._maxRequestedIndex=0,n._endIndex=null,n._pulling=!1,n._stream=e,n._maxCacheSize=null!=(a=i.maxCacheSize)?a:0x1000000,n}return(0,l._)(r,e),(0,u._)(r,[{key:"_retrieveSize",value:function(){return this._endIndex}},{key:"_read",value:function(e,r){var n=this;if(null!==this._endIndex&&r>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,r);var a=(0,p.binarySearchLessOrEqual)(this._cache,e,function(e){return e.start}),i=-1!==a?this._cache[a]:null;if(i&&i.start<=e&&r<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};var s=e,o=new Uint8Array(r-e);if(-1!==a)for(var c=a;c<this._cache.length;c++){var u=this._cache[c];if(u.start>=r)break;var l=Math.max(e,u.start);l>s&&this._throwDueToCacheMiss();var d=Math.min(r,u.end);l<d&&(o.set(u.bytes.subarray(l-u.start,d-u.start),l-e),s=d)}if(s===r)return{bytes:o,view:(0,p.toDataView)(o),offset:e};this._currentIndex>s&&this._throwDueToCacheMiss();var f=(0,p.promiseWithResolvers)(),h=f.promise,m=f.resolve,g=f.reject;return this._pendingSlices.push({start:e,end:r,bytes:o,resolve:m,reject:g}),this._targetIndex=Math.max(this._targetIndex,r),this._pulling||(this._pulling=!0,this._pull().catch(function(e){if(n._pulling=!1,n._pendingSlices.length>0)n._pendingSlices.forEach(function(r){return r.reject(e)}),n._pendingSlices.length=0;else throw e})),h}},{key:"_throwDueToCacheMiss",value:function(){throw Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}},{key:"_pull",value:function(){return(0,s._)(function(){var e,r,n,a,i,s,o,c,u,l,d,h,m,g,b;return(0,f._)(this,function(f){switch(f.label){case 0:null!=this._reader||(this._reader=this._stream.getReader()),f.label=1;case 1:if(!(this._currentIndex<this._targetIndex&&!this._disposed))return[3,3];return[4,this._reader.read()];case 2:if(r=(e=f.sent()).done,n=e.value,r){a=!0,i=!1,s=void 0;try{for(o=this._pendingSlices[Symbol.iterator]();!(a=(c=o.next()).done);a=!0)c.value.resolve(null)}catch(e){i=!0,s=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw s}}return this._pendingSlices.length=0,this._endIndex=this._currentIndex,[3,3]}for(d=0,u=this._currentIndex,l=this._currentIndex+n.byteLength;d<this._pendingSlices.length;d++)(m=Math.max(u,(h=this._pendingSlices[d]).start))<(g=Math.min(l,h.end))&&(h.bytes.set(n.subarray(m-u,g-u),m-h.start),g===h.end&&(h.resolve({bytes:h.bytes,view:(0,p.toDataView)(h.bytes),offset:h.start}),this._pendingSlices.splice(d,1),d--));for(this._cache.push({start:u,end:l,bytes:n,view:(0,p.toDataView)(n),age:0});this._cache.length>0&&(b=this._cache[0],!(this._maxRequestedIndex-b.end<=this._maxCacheSize));)this._cache.shift();return this._currentIndex+=n.byteLength,[3,1];case 3:return this._pulling=!1,[2]}})}).call(this)}},{key:"_dispose",value:function(){this._pendingSlices.length=0,this._cache.length=0}}]),r}(k),E={none:function(e,r){return{start:e,end:r}},fileSystem:function(e,r){return{start:e=65536*Math.floor((e-65536)/65536),end:r=65536*Math.ceil((r+65536)/65536)}},network:function(e,r,n){e=Math.max(0,65536*Math.floor((e-65536)/65536));var a=!0,i=!1,s=void 0;try{for(var o,c=n[Symbol.iterator]();!(a=(o=c.next()).done);a=!0){var u=o.value,l=Math.max((u.startPos+u.targetPos)/2,u.targetPos-8388608);if((0,p.closedIntervalsOverlap)(e,r,l,u.targetPos)){var d=u.targetPos-u.startPos,f=8388608*Math.ceil((d+1)/8388608),h=Math.pow(2,Math.ceil(Math.log2(d+1))),m=Math.min(h,f);r=Math.max(r,u.startPos+m)}}}catch(e){i=!0,s=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw s}}return r=Math.max(r,e+524288),{start:e,end:r}}},j=function(){"use strict";function e(r){(0,c._)(this,e),this.options=r,this.fileSize=null,this.nextAge=0,this.workers=[],this.cache=[],this.currentCacheSize=0,this.disposed=!1}return(0,u._)(e,[{key:"read",value:function(e,r){(0,p.assert)(null!==this.fileSize);var n=this.options.prefetchProfile(e,r,this.workers),a=Math.max(n.start,0),i=Math.min(n.end,this.fileSize);(0,p.assert)(a<=e&&r<=i);var s=null,o=(0,p.binarySearchLessOrEqual)(this.cache,e,function(e){return e.start}),c=-1!==o?this.cache[o]:null;c&&c.start<=e&&r<=c.end&&(c.age=this.nextAge++,s={bytes:c.bytes,view:c.view,offset:c.start});var u=(0,p.binarySearchLessOrEqual)(this.cache,a,function(e){return e.start}),l=s?null:new Uint8Array(r-e),d=0,f=a,h=[];if(-1!==u){for(var m=u;m<this.cache.length;m++){var g=this.cache[m];if(g.start>=i)break;if(!(g.end<=a)){var b=Math.max(a,g.start),k=Math.min(i,g.end);if((0,p.assert)(b<=k),f<b&&h.push({start:f,end:b}),f=k,l){var _=Math.max(e,g.start),y=Math.min(r,g.end);if(_<y){var S=_-e;l.set(g.bytes.subarray(_-g.start,y-g.start),S),S===d&&(d=y-e)}}g.age=this.nextAge++}}f<i&&h.push({start:f,end:i})}else h.push({start:a,end:i});if(l&&d>=l.length&&(s={bytes:l,view:(0,p.toDataView)(l),offset:e}),0===h.length)return(0,p.assert)(s),s;var w=(0,p.promiseWithResolvers)(),T=w.promise,x=w.resolve,I=w.reject,E=[],j=!0,P=!1,C=void 0;try{for(var A,B=h[Symbol.iterator]();!(j=(A=B.next()).done);j=!0){var M=A.value,D=Math.max(e,M.start),F=Math.min(r,M.end);D===M.start&&F===M.end?E.push(M):D<F&&E.push({start:D,end:F})}}catch(e){P=!0,C=e}finally{try{j||null==B.return||B.return()}finally{if(P)throw C}}var R=!0,U=!1,O=void 0;try{for(var L,N=h[Symbol.iterator]();!(R=(L=N.next()).done);R=!0){var V=L.value,z=l&&{start:e,bytes:l,holes:E,resolve:x,reject:I},H=!1,G=!0,q=!1,W=void 0;try{for(var K,X=this.workers[Symbol.iterator]();!(G=(K=X.next()).done);G=!0){var Q=K.value;if((0,p.closedIntervalsOverlap)(V.start-131072,V.start,Q.currentPos,Q.targetPos)){Q.targetPos=Math.max(Q.targetPos,V.end),H=!0,z&&!Q.pendingSlices.includes(z)&&Q.pendingSlices.push(z),Q.running||this.runWorker(Q);break}}}catch(e){q=!0,W=e}finally{try{G||null==X.return||X.return()}finally{if(q)throw W}}if(!H){var Z=this.createWorker(V.start,V.end);z&&(Z.pendingSlices=[z]),this.runWorker(Z)}}}catch(e){U=!0,O=e}finally{try{R||null==N.return||N.return()}finally{if(U)throw O}}return s||((0,p.assert)(l),s=T.then(function(r){return{bytes:r,view:(0,p.toDataView)(r),offset:e}})),s}},{key:"createWorker",value:function(e,r){var n={startPos:e,currentPos:e,targetPos:r,running:!1,aborted:this.disposed,pendingSlices:[],age:this.nextAge++};for(this.workers.push(n);this.workers.length>this.options.maxWorkerCount;){for(var a=0,i=this.workers[0],s=1;s<this.workers.length;s++){var o=this.workers[s];o.age<i.age&&(a=s,i=o)}if(i.running&&i.pendingSlices.length>0)break;i.aborted=!0,this.workers.splice(a,1)}return n}},{key:"runWorker",value:function(e){(0,p.assert)(!e.running),(0,p.assert)(e.currentPos<e.targetPos),e.running=!0,e.age=this.nextAge++,this.options.runWorker(e).catch(function(r){if(e.running=!1,e.pendingSlices.length>0)e.pendingSlices.forEach(function(e){return e.reject(r)}),e.pendingSlices.length=0;else throw r})}},{key:"supplyWorkerData",value:function(e,r){(0,p.assert)(!e.aborted);var n=e.currentPos,a=n+r.length;this.insertIntoCache({start:n,end:a,bytes:r,view:(0,p.toDataView)(r),age:this.nextAge++}),e.currentPos+=r.length,e.targetPos=Math.max(e.targetPos,e.currentPos);for(var i=0;i<e.pendingSlices.length;i++){var s=e.pendingSlices[i],o=Math.max(n,s.start),c=Math.min(a,s.start+s.bytes.length);o<c&&s.bytes.set(r.subarray(o-n,c-n),o-s.start);for(var u=0;u<s.holes.length;u++){var l=s.holes[u];n<=l.start&&a>l.start&&(l.start=a),l.end<=l.start&&(s.holes.splice(u,1),u--)}0===s.holes.length&&(s.resolve(s.bytes),e.pendingSlices.splice(i,1),i--)}for(var d=0;d<this.workers.length;d++){var f=this.workers[d];e!==f&&!f.running&&(0,p.closedIntervalsOverlap)(n,a,f.currentPos,f.targetPos)&&(this.workers.splice(d,1),d--)}}},{key:"forgetWorker",value:function(e){var r=this.workers.indexOf(e);(0,p.assert)(-1!==r),this.workers.splice(r,1)}},{key:"insertIntoCache",value:function(e){if(0!==this.options.maxCacheSize){var r=(0,p.binarySearchLessOrEqual)(this.cache,e.start,function(e){return e.start})+1;if(r>0){var n=this.cache[r-1];if(n.end>=e.end)return;if(n.end>e.start){var a=new Uint8Array(e.end-n.start);a.set(n.bytes,0),a.set(e.bytes,e.start-n.start),this.currentCacheSize+=e.end-n.end,n.bytes=a,n.view=(0,p.toDataView)(a),n.end=e.end,r--,e=n}else this.cache.splice(r,0,e),this.currentCacheSize+=e.bytes.length}else this.cache.splice(r,0,e),this.currentCacheSize+=e.bytes.length;for(var i=r+1;i<this.cache.length;i++){var s=this.cache[i];if(e.end<=s.start)break;if(e.end>=s.end){this.cache.splice(i,1),this.currentCacheSize-=s.bytes.length,i--;continue}var o=new Uint8Array(s.end-e.start);o.set(e.bytes,0),o.set(s.bytes,s.start-e.start),this.currentCacheSize-=e.end-s.start,e.bytes=o,e.view=(0,p.toDataView)(o),e.end=s.end,this.cache.splice(i,1);break}for(;this.currentCacheSize>this.options.maxCacheSize;){for(var c=0,u=this.cache[0],l=1;l<this.cache.length;l++){var d=this.cache[l];d.age<u.age&&(c=l,u=d)}if(this.currentCacheSize-u.bytes.length<=this.options.maxCacheSize)break;this.cache.splice(c,1),this.currentCacheSize-=u.bytes.length}}}},{key:"dispose",value:function(){var e=!0,r=!1,n=void 0;try{for(var a,i=this.workers[Symbol.iterator]();!(e=(a=i.next()).done);e=!0)a.value.aborted=!0}catch(e){r=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(r)throw n}}this.workers.length=0,this.cache.length=0,this.disposed=!0}}]),e}()},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@swc/helpers/cjs/_ts_values.cjs":"94P5Q","./misc.js":"j7iGm","./node.js":"5s8q3","./input.js":"3sapy","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],clpdF:[function(e,r,n,a){"use strict";var i=e("feddc910f69a01a6"),s=e("b644f6b72647b399"),o=e("ba991daace2b8ed9");n._=function(e,r,n){return r=i._(r),o._(e,s._()?Reflect.construct(r,n||[],i._(e).constructor):r.apply(e,n))}},{feddc910f69a01a6:"NOGHw",b644f6b72647b399:"83nDe",ba991daace2b8ed9:"hd12h"}],NOGHw:[function(e,r,n,a){"use strict";function i(e){return n._=i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}n._=i},{}],"83nDe":[function(e,r,n,a){"use strict";function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(n._=i=function(){return!!e})()}n._=i},{}],hd12h:[function(e,r,n,a){"use strict";var i=e("f7151fe13994d2aa"),s=e("f18e81760bb14899");n._=function(e,r){return r&&("object"===s._(r)||"function"==typeof r)?r:i._(e)}},{f7151fe13994d2aa:"1tlYe",f18e81760bb14899:"iXhRw"}],"1tlYe":[function(e,r,n,a){"use strict";n._=function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},{}],jtSwf:[function(e,r,n,a){"use strict";var i=e("b9db138b859a042c");n._=function(e,r){if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&i._(e,r)}},{b9db138b859a042c:"7ubVA"}],"7ubVA":[function(e,r,n,a){"use strict";function i(e,r){return n._=i=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},i(e,r)}n._=i},{}],"5s8q3":[function(e,r,n,a){},{}],"3sapy":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"Input",function(){return k}),i.export(n,"InputDisposedError",function(){return _});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_type_of.cjs"),f=e("@swc/helpers/cjs/_wrap_native_super.cjs"),h=e("@swc/helpers/cjs/_ts_generator.cjs"),p=e("./input-format.js"),m=e("./misc.js"),g=e("./reader.js"),b=e("./source.js");(0,m.polyfillSymbolDispose)();var k=function(){"use strict";function e(r){if((0,c._)(this,e),this._demuxerPromise=null,this._format=null,this._disposed=!1,!r||(void 0===r?"undefined":(0,d._)(r))!=="object")throw TypeError("options must be an object.");if(!Array.isArray(r.formats)||r.formats.some(function(e){return!(e instanceof p.InputFormat)}))throw TypeError("options.formats must be an array of InputFormat.");if(!(r.source instanceof b.Source))throw TypeError("options.source must be a Source.");if(r.source._disposed)throw Error("options.source must not be disposed.");this._formats=r.formats,this._source=r.source,this._reader=new(0,g.Reader)(r.source)}return(0,u._)(e,[{key:"disposed",get:function(){return this._disposed}},{key:"_getDemuxer",value:function(){var e;return null!=(e=this._demuxerPromise)?e:this._demuxerPromise=(0,s._)(function(){var e,r,n,a,i,s,o,c;return(0,h._)(this,function(u){switch(u.label){case 0:return e=this._reader,[4,this._source.getSizeOrNull()];case 1:e.fileSize=u.sent(),r=!0,n=!1,a=void 0,u.label=2;case 2:u.trys.push([2,7,8,9]),i=this._formats[Symbol.iterator](),u.label=3;case 3:if(r=(s=i.next()).done)return[3,6];return[4,(o=s.value)._canReadInput(this)];case 4:if(u.sent())return this._format=o,[2,o._createDemuxer(this)];u.label=5;case 5:return r=!0,[3,3];case 6:return[3,9];case 7:return c=u.sent(),n=!0,a=c,[3,9];case 8:try{r||null==i.return||i.return()}finally{if(n)throw a}return[7];case 9:throw Error("Input has an unsupported or unrecognizable format.")}})}).call(this)}},{key:"source",get:function(){return this._source}},{key:"getFormat",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this._getDemuxer()];case 1:return e.sent(),(0,m.assert)(this._format),[2,this._format]}})}).call(this)}},{key:"computeDuration",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this._getDemuxer()];case 1:return[2,e.sent().computeDuration()]}})}).call(this)}},{key:"getTracks",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this._getDemuxer()];case 1:return[2,e.sent().getTracks()]}})}).call(this)}},{key:"getVideoTracks",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this.getTracks()];case 1:return[2,e.sent().filter(function(e){return e.isVideoTrack()})]}})}).call(this)}},{key:"getAudioTracks",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this.getTracks()];case 1:return[2,e.sent().filter(function(e){return e.isAudioTrack()})]}})}).call(this)}},{key:"getPrimaryVideoTrack",value:function(){return(0,s._)(function(){var e;return(0,h._)(this,function(r){switch(r.label){case 0:return[4,this.getTracks()];case 1:return[2,null!=(e=r.sent().find(function(e){return e.isVideoTrack()}))?e:null]}})}).call(this)}},{key:"getPrimaryAudioTrack",value:function(){return(0,s._)(function(){var e;return(0,h._)(this,function(r){switch(r.label){case 0:return[4,this.getTracks()];case 1:return[2,null!=(e=r.sent().find(function(e){return e.isAudioTrack()}))?e:null]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this._getDemuxer()];case 1:return[2,e.sent().getMimeType()]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this._getDemuxer()];case 1:return[2,e.sent().getMetadataTags()]}})}).call(this)}},{key:"dispose",value:function(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}},{key:Symbol.dispose,value:function(){this.dispose()}}]),e}(),_=function(e){"use strict";function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Input has been disposed.";return(0,c._)(this,r),(e=(0,o._)(this,r,[n])).name="InputDisposedError",e}return(0,l._)(r,e),r}((0,f._)(Error))},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_wrap_native_super.cjs":"j8pRR","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./input-format.js":"1jhAI","./misc.js":"j7iGm","./reader.js":"8KRfO","./source.js":"7vKle","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],j8pRR:[function(e,r,n,a){"use strict";var i=e("c8857d56f4968279"),s=e("2ed7bdf1701f2d07"),o=e("5c5ad8846076b9cd"),c=e("2db6fa09e8a5be4c");function u(e){var r="function"==typeof Map?new Map:void 0;return n._=u=function(e){if(null===e||!o._(e))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return i._(e,arguments,s._(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c._(n,e)},u(e)}n._=u},{c8857d56f4968279:"bC52X","2ed7bdf1701f2d07":"NOGHw","5c5ad8846076b9cd":"1mpbk","2db6fa09e8a5be4c":"7ubVA"}],bC52X:[function(e,r,n,a){"use strict";var i=e("62fc231ae2e75266"),s=e("3f98bf9d4f706151");function o(e,r,a){return i._()?n._=o=Reflect.construct:n._=o=function(e,r,n){var a=[null];a.push.apply(a,r);var i=new(Function.bind.apply(e,a));return n&&s._(i,n.prototype),i},o.apply(null,arguments)}n._=o},{"62fc231ae2e75266":"83nDe","3f98bf9d4f706151":"7ubVA"}],"1mpbk":[function(e,r,n,a){"use strict";n._=function(e){return -1!==Function.toString.call(e).indexOf("[native code]")}},{}],"1jhAI":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"InputFormat",function(){return I}),i.export(n,"IsobmffInputFormat",function(){return E}),i.export(n,"Mp4InputFormat",function(){return j}),i.export(n,"QuickTimeInputFormat",function(){return P}),i.export(n,"MatroskaInputFormat",function(){return C}),i.export(n,"WebMInputFormat",function(){return A}),i.export(n,"Mp3InputFormat",function(){return B}),i.export(n,"WaveInputFormat",function(){return M}),i.export(n,"OggInputFormat",function(){return D}),i.export(n,"FlacInputFormat",function(){return F}),i.export(n,"AdtsInputFormat",function(){return R}),i.export(n,"MP4",function(){return U}),i.export(n,"QTFF",function(){return O}),i.export(n,"MATROSKA",function(){return L}),i.export(n,"WEBM",function(){return N}),i.export(n,"MP3",function(){return V}),i.export(n,"WAVE",function(){return z}),i.export(n,"OGG",function(){return H}),i.export(n,"ADTS",function(){return G}),i.export(n,"FLAC",function(){return q}),i.export(n,"ALL_FORMATS",function(){return W});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_ts_generator.cjs"),f=e("./isobmff/isobmff-demuxer.js"),h=e("./matroska/ebml.js"),p=e("./matroska/matroska-demuxer.js"),m=e("./mp3/mp3-demuxer.js"),g=e("../shared/mp3-misc.js"),b=e("./id3.js"),k=e("./mp3/mp3-reader.js"),_=e("./ogg/ogg-demuxer.js"),y=e("./wave/wave-demuxer.js"),S=e("./adts/adts-reader.js"),w=e("./adts/adts-demuxer.js"),T=e("./reader.js"),x=e("./flac/flac-demuxer.js"),I=function e(){"use strict";(0,c._)(this,e)},E=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_getMajorBrand",value:function(e){return(0,s._)(function(){var r;return(0,d._)(this,function(n){switch(n.label){case 0:if(!((r=e._reader.requestSlice(0,12))instanceof Promise))return[3,2];return[4,r];case 1:r=n.sent(),n.label=2;case 2:if(!r||(r.skip(4),"ftyp"!==(0,T.readAscii)(r,4)))return[2,null];return[2,(0,T.readAscii)(r,4)]}})})()}},{key:"_createDemuxer",value:function(e){return new(0,f.IsobmffDemuxer)(e)}}]),r}(I),j=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){var r;return(0,d._)(this,function(n){switch(n.label){case 0:return[4,this._getMajorBrand(e)];case 1:return[2,!!(r=n.sent())&&"qt "!==r]}})}).call(this)}},{key:"name",get:function(){return"MP4"}},{key:"mimeType",get:function(){return"video/mp4"}}]),r}(E),P=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){return(0,d._)(this,function(r){switch(r.label){case 0:return[4,this._getMajorBrand(e)];case 1:return[2,"qt "===r.sent()]}})}).call(this)}},{key:"name",get:function(){return"QuickTime File Format"}},{key:"mimeType",get:function(){return"video/quicktime"}}]),r}(E),C=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"isSupportedEBMLOfDocType",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o,c,u,l,f;return(0,d._)(this,function(d){switch(d.label){case 0:if(!((n=e._reader.requestSlice(0,h.MAX_HEADER_SIZE))instanceof Promise))return[3,2];return[4,n];case 1:n=d.sent(),d.label=2;case 2:if(!n||null===(a=(0,h.readVarIntSize)(n))||a<1||a>8||(0,h.readUnsignedInt)(n,a)!==h.EBMLId.EBML||null===(i=(0,h.readElementSize)(n)))return[2,!1];if(!((s=e._reader.requestSlice(n.filePos,i))instanceof Promise))return[3,4];return[4,s];case 3:s=d.sent(),d.label=4;case 4:if(!s)return[2,!1];for(o=n.filePos;s.filePos<=o+i-h.MIN_HEADER_SIZE&&(c=(0,h.readElementHeader)(s));){if(u=c.id,l=c.size,f=s.filePos,null===l)return[2,!1];switch(u){case h.EBMLId.EBMLVersion:case h.EBMLId.EBMLReadVersion:if(1!==(0,h.readUnsignedInt)(s,l))return[2,!1];break;case h.EBMLId.DocType:if((0,h.readAsciiString)(s,l)!==r)return[2,!1];break;case h.EBMLId.DocTypeVersion:if((0,h.readUnsignedInt)(s,l)>4)return[2,!1]}s.filePos=f+l}return[2,!0]}})})()}},{key:"_canReadInput",value:function(e){return this.isSupportedEBMLOfDocType(e,"matroska")}},{key:"_createDemuxer",value:function(e){return new(0,p.MatroskaDemuxer)(e)}},{key:"name",get:function(){return"Matroska"}},{key:"mimeType",get:function(){return"video/x-matroska"}}]),r}(I),A=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return this.isSupportedEBMLOfDocType(e,"webm")}},{key:"name",get:function(){return"WebM"}},{key:"mimeType",get:function(){return"video/webm"}}]),r}(C),B=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){var r,n,a,i,s,o,c,u,l;return(0,d._)(this,function(d){switch(d.label){case 0:if(!((r=e._reader.requestSlice(0,10))instanceof Promise))return[3,2];return[4,r];case 1:r=d.sent(),d.label=2;case 2:if(!r)return[2,!1];n=0,a=!1,d.label=3;case 3:if(!((i=e._reader.requestSlice(n,b.ID3_V2_HEADER_SIZE))instanceof Promise))return[3,5];return[4,i];case 4:i=d.sent(),d.label=5;case 5:if(!i||!(s=(0,b.readId3V2Header)(i)))return[3,6];return a=!0,n=i.filePos+s.size,[3,3];case 6:return[4,(0,k.readNextFrameHeader)(e._reader,n,n+4096)];case 7:if(!(o=d.sent()))return[2,!1];if(a)return[2,!0];return n=o.startPos+o.header.totalSize,[4,(0,k.readNextFrameHeader)(e._reader,n,n+g.FRAME_HEADER_SIZE)];case 8:if(!(c=d.sent())||(u=o.header,l=c.header,u.channel!==l.channel||u.sampleRate!==l.sampleRate))return[2,!1];return[2,!0]}})})()}},{key:"_createDemuxer",value:function(e){return new(0,m.Mp3Demuxer)(e)}},{key:"name",get:function(){return"MP3"}},{key:"mimeType",get:function(){return"audio/mpeg"}}]),r}(I),M=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){var r,n;return(0,d._)(this,function(a){switch(a.label){case 0:if(!((r=e._reader.requestSlice(0,12))instanceof Promise))return[3,2];return[4,r];case 1:r=a.sent(),a.label=2;case 2:if(!r||"RIFF"!==(n=(0,T.readAscii)(r,4))&&"RIFX"!==n&&"RF64"!==n)return[2,!1];return r.skip(4),[2,"WAVE"===(0,T.readAscii)(r,4)]}})})()}},{key:"_createDemuxer",value:function(e){return new(0,y.WaveDemuxer)(e)}},{key:"name",get:function(){return"WAVE"}},{key:"mimeType",get:function(){return"audio/wav"}}]),r}(I),D=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){var r;return(0,d._)(this,function(n){switch(n.label){case 0:if(!((r=e._reader.requestSlice(0,4))instanceof Promise))return[3,2];return[4,r];case 1:r=n.sent(),n.label=2;case 2:if(!r)return[2,!1];return[2,"OggS"===(0,T.readAscii)(r,4)]}})})()}},{key:"_createDemuxer",value:function(e){return new(0,_.OggDemuxer)(e)}},{key:"name",get:function(){return"Ogg"}},{key:"mimeType",get:function(){return"application/ogg"}}]),r}(I),F=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){var r;return(0,d._)(this,function(n){switch(n.label){case 0:if(!((r=e._reader.requestSlice(0,4))instanceof Promise))return[3,2];return[4,r];case 1:r=n.sent(),n.label=2;case 2:if(!r)return[2,!1];return[2,"fLaC"===(0,T.readAscii)(r,4)]}})})()}},{key:"name",get:function(){return"FLAC"}},{key:"mimeType",get:function(){return"audio/flac"}},{key:"_createDemuxer",value:function(e){return new(0,x.FlacDemuxer)(e)}}]),r}(I),R=function(e){"use strict";function r(){return(0,c._)(this,r),(0,o._)(this,r,arguments)}return(0,l._)(r,e),(0,u._)(r,[{key:"_canReadInput",value:function(e){return(0,s._)(function(){var r,n,a;return(0,d._)(this,function(i){switch(i.label){case 0:if(!((r=e._reader.requestSliceRange(0,S.MIN_FRAME_HEADER_SIZE,S.MAX_FRAME_HEADER_SIZE))instanceof Promise))return[3,2];return[4,r];case 1:r=i.sent(),i.label=2;case 2:if(!r||!(n=(0,S.readFrameHeader)(r)))return[2,!1];if(!((r=e._reader.requestSliceRange(n.frameLength,S.MIN_FRAME_HEADER_SIZE,S.MAX_FRAME_HEADER_SIZE))instanceof Promise))return[3,4];return[4,r];case 3:r=i.sent(),i.label=4;case 4:if(!r||!(a=(0,S.readFrameHeader)(r)))return[2,!1];return[2,n.objectType===a.objectType&&n.samplingFrequencyIndex===a.samplingFrequencyIndex&&n.channelConfiguration===a.channelConfiguration]}})})()}},{key:"_createDemuxer",value:function(e){return new(0,w.AdtsDemuxer)(e)}},{key:"name",get:function(){return"ADTS"}},{key:"mimeType",get:function(){return"audio/aac"}}]),r}(I),U=new j,O=new P,L=new C,N=new A,V=new B,z=new M,H=new D,G=new R,q=new F,W=[U,O,L,N,z,H,q,V,G]},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./isobmff/isobmff-demuxer.js":"1Dw1A","./matroska/ebml.js":"fq2QE","./matroska/matroska-demuxer.js":"kY1ME","./mp3/mp3-demuxer.js":"ifShX","../shared/mp3-misc.js":"gcure","./id3.js":"42Y2c","./mp3/mp3-reader.js":"gFWvE","./ogg/ogg-demuxer.js":"hRJRs","./wave/wave-demuxer.js":"cokSU","./adts/adts-reader.js":"5AUBv","./adts/adts-demuxer.js":"3t0bF","./reader.js":"8KRfO","./flac/flac-demuxer.js":"e0w8C","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"1Dw1A":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"IsobmffDemuxer",function(){return I});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_sliced_to_array.cjs"),h=e("@swc/helpers/cjs/_to_consumable_array.cjs"),p=e("@swc/helpers/cjs/_ts_generator.cjs"),m=e("../codec.js"),g=e("../codec-data.js"),b=e("../demuxer.js"),k=e("../input-track.js"),_=e("../misc.js"),y=e("../packet.js"),S=e("./isobmff-misc.js"),w=e("./isobmff-reader.js"),T=e("../reader.js"),x=e("../metadata.js"),I=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).moovSlice=null,n.currentTrack=null,n.tracks=[],n.metadataPromise=null,n.movieTimescale=-1,n.movieDurationInTimescale=-1,n.isQuickTime=!1,n.metadataTags={},n.currentMetadataKeys=null,n.isFragmented=!1,n.fragmentTrackDefaults=[],n.currentFragment=null,n.lastReadFragment=null,n.reader=e._reader,n}return(0,l._)(r,e),(0,u._)(r,[{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r;return(0,p._)(this,function(n){switch(n.label){case 0:return[4,this.getTracks()];case 1:return[4,Promise.all(n.sent().map(function(e){return e.computeDuration()}))];case 2:return r=n.sent(),[2,(e=Math).max.apply(e,[0].concat((0,h._)(r)))]}})}).call(this)}},{key:"getTracks",value:function(){return(0,s._)(function(){return(0,p._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.tracks.map(function(e){return e.inputTrack})]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,s._)(function(){var e;return(0,p._)(this,function(r){switch(r.label){case 0:return[4,this.readMetadata()];case 1:return r.sent(),[4,Promise.all(this.tracks.map(function(e){return e.inputTrack.getCodecParameterString()}))];case 2:return e=r.sent(),[2,(0,S.buildIsobmffMimeType)({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some(function(e){var r;return(null==(r=e.info)?void 0:r.type)==="video"}),hasAudio:this.tracks.some(function(e){var r;return(null==(r=e.info)?void 0:r.type)==="audio"}),codecStrings:e.filter(Boolean)})]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,s._)(function(){return(0,p._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.metadataTags]}})}).call(this)}},{key:"readMetadata",value:function(){var e;return null!=(e=this.metadataPromise)?e:this.metadataPromise=(0,s._)(function(){var e,r,n,a,i,s,o,c,u,l,d,f,h,m,g,b,k,y,S;return(0,p._)(this,function(p){switch(p.label){case 0:e=0,p.label=1;case 1:if(!((r=this.reader.requestSliceRange(e,w.MIN_BOX_HEADER_SIZE,w.MAX_BOX_HEADER_SIZE))instanceof Promise))return[3,3];return[4,r];case 2:r=p.sent(),p.label=3;case 3:if(!r||(n=e,!(a=(0,w.readBoxHeader)(r))))return[3,8];if("ftyp"!==a.name)return[3,4];return i=(0,T.readAscii)(r,4),this.isQuickTime="qt "===i,[3,7];case 4:if("moov"!==a.name)return[3,7];if(!((s=this.reader.requestSlice(r.filePos,a.contentSize))instanceof Promise))return[3,6];return[4,s];case 5:s=p.sent(),p.label=6;case 6:if(!s)return[3,8];this.moovSlice=s,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(function(e,r){return Number(r.disposition.default)-Number(e.disposition.default)}),o=!0,c=!1,u=void 0;try{for(l=this.tracks[Symbol.iterator]();!(o=(d=l.next()).done);o=!0)h=(f=d.value).editListPreviousSegmentDurations/this.movieTimescale,f.editListOffset-=Math.round(h*f.timescale)}catch(e){c=!0,u=e}finally{try{o||null==l.return||l.return()}finally{if(c)throw u}}return[3,8];case 7:return e=n+a.totalSize,[3,1];case 8:if(!(this.isFragmented&&null!==this.reader.fileSize))return[3,15];if(!((m=this.reader.requestSlice(this.reader.fileSize-4,4))instanceof Promise))return[3,10];return[4,m];case 9:m=p.sent(),p.label=10;case 10:if((0,_.assert)(m),g=(0,T.readU32Be)(m),!((b=this.reader.fileSize-g)>=0&&b<=this.reader.fileSize-w.MAX_BOX_HEADER_SIZE))return[3,15];if(!((k=this.reader.requestSliceRange(b,w.MIN_BOX_HEADER_SIZE,w.MAX_BOX_HEADER_SIZE))instanceof Promise))return[3,12];return[4,k];case 11:k=p.sent(),p.label=12;case 12:if(!k||!((y=(0,w.readBoxHeader)(k))&&"mfra"===y.name))return[3,15];if(!((S=this.reader.requestSlice(k.filePos,y.contentSize))instanceof Promise))return[3,14];return[4,S];case 13:S=p.sent(),p.label=14;case 14:S&&this.readContiguousBoxes(S),p.label=15;case 15:return[2]}})}).call(this)}},{key:"getSampleTableForTrack",value:function(e){if(e.sampleTable)return e.sampleTable;var r={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=r,(0,_.assert)(this.moovSlice);var n=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(n),this.currentTrack=null,(null==(a=e.info)?void 0:a.type)==="audio"&&e.info.codec&&m.PCM_AUDIO_CODECS.includes(e.info.codec)&&0===r.sampleCompositionTimeOffsets.length){(0,_.assert)((null==(i=e.info)?void 0:i.type)==="audio");for(var a,i,s=(0,m.parsePcmCodec)(e.info.codec),o=[],c=[],u=0;u<r.sampleToChunk.length;u++){for(var l=r.sampleToChunk[u],d=r.sampleToChunk[u+1],f=(d?d.startChunkIndex:r.chunkOffsets.length)-l.startChunkIndex,h=0;h<f;h++){var p=l.startSampleIndex+h*l.samplesPerChunk,g=p+l.samplesPerChunk,b=(0,_.binarySearchLessOrEqual)(r.sampleTimingEntries,p,function(e){return e.startIndex}),k=r.sampleTimingEntries[b],y=(0,_.binarySearchLessOrEqual)(r.sampleTimingEntries,g,function(e){return e.startIndex}),S=r.sampleTimingEntries[y],w=k.startDecodeTimestamp+(p-k.startIndex)*k.delta,T=S.startDecodeTimestamp+(g-S.startIndex)*S.delta-w,x=(0,_.last)(o);x&&x.delta===T?x.count++:o.push({startIndex:l.startChunkIndex+h,startDecodeTimestamp:w,count:1,delta:T});var I=l.samplesPerChunk*s.sampleSize*e.info.numberOfChannels;c.push(I)}l.startSampleIndex=l.startChunkIndex,l.samplesPerChunk=1}r.sampleTimingEntries=o,r.sampleSizes=c}if(r.sampleCompositionTimeOffsets.length>0){r.presentationTimestamps=[];var E=!0,j=!1,P=void 0;try{for(var C,A=r.sampleTimingEntries[Symbol.iterator]();!(E=(C=A.next()).done);E=!0)for(var B=C.value,M=0;M<B.count;M++)r.presentationTimestamps.push({presentationTimestamp:B.startDecodeTimestamp+M*B.delta,sampleIndex:B.startIndex+M})}catch(e){j=!0,P=e}finally{try{E||null==A.return||A.return()}finally{if(j)throw P}}var D=!0,F=!1,R=void 0;try{for(var U,O=r.sampleCompositionTimeOffsets[Symbol.iterator]();!(D=(U=O.next()).done);D=!0)for(var L=U.value,N=0;N<L.count;N++){var V=L.startIndex+N,z=r.presentationTimestamps[V];z&&(z.presentationTimestamp+=L.offset)}}catch(e){F=!0,R=e}finally{try{D||null==O.return||O.return()}finally{if(F)throw R}}r.presentationTimestamps.sort(function(e,r){return e.presentationTimestamp-r.presentationTimestamp}),r.presentationTimestampIndexMap=Array(r.presentationTimestamps.length).fill(-1);for(var H=0;H<r.presentationTimestamps.length;H++)r.presentationTimestampIndexMap[r.presentationTimestamps[H].sampleIndex]=H}return r}},{key:"readFragment",value:function(e){return(0,s._)(function(){var r,n,a,i,s,o,c,u,l,d,h,m,g,b,k,y,S;return(0,p._)(this,function(p){switch(p.label){case 0:if((null==(r=this.lastReadFragment)?void 0:r.moofOffset)===e)return[2,this.lastReadFragment];if(!((n=this.reader.requestSliceRange(e,w.MIN_BOX_HEADER_SIZE,w.MAX_BOX_HEADER_SIZE))instanceof Promise))return[3,2];return[4,n];case 1:n=p.sent(),p.label=2;case 2:if((0,_.assert)(n),a=(0,w.readBoxHeader)(n),(0,_.assert)((null==a?void 0:a.name)==="moof"),!((i=this.reader.requestSlice(e,a.totalSize))instanceof Promise))return[3,4];return[4,i];case 3:i=p.sent(),p.label=4;case 4:(0,_.assert)(i),this.traverseBox(i),s=this.lastReadFragment,(0,_.assert)(s&&s.moofOffset===e),o=!0,c=!1,u=void 0;try{for(l=s.trackData[Symbol.iterator]();!(o=(d=l.next()).done);o=!0)g=(m=(h=(0,f._)(d.value,2)[1]).track).fragmentPositionCache,h.startTimestampIsFinal||((b=m.fragmentLookupTable.find(function(e){return e.moofOffset===s.moofOffset}))?D(h,b.timestamp):(k=(0,_.binarySearchLessOrEqual)(g,s.moofOffset-1,function(e){return e.moofOffset}),-1!==k&&(y=g[k],D(h,y.endTimestamp))),h.startTimestampIsFinal=!0),S=(0,_.binarySearchLessOrEqual)(g,h.startTimestamp,function(e){return e.startTimestamp}),(-1===S||g[S].moofOffset!==s.moofOffset)&&g.splice(S+1,0,{moofOffset:s.moofOffset,startTimestamp:h.startTimestamp,endTimestamp:h.endTimestamp})}catch(e){c=!0,u=e}finally{try{o||null==l.return||l.return()}finally{if(c)throw u}}return[2,s]}})}).call(this)}},{key:"readContiguousBoxes",value:function(e){for(var r=e.filePos;e.filePos-r<=e.length-w.MIN_BOX_HEADER_SIZE&&this.traverseBox(e););}},{key:"iterateContiguousBoxes",value:function(e){var r,n,a;return(0,p._)(this,function(i){switch(i.label){case 0:r=e.filePos,i.label=1;case 1:if(!(e.filePos-r<=e.length-w.MIN_BOX_HEADER_SIZE)||(n=e.filePos,!(a=(0,w.readBoxHeader)(e))))return[3,3];return[4,{boxInfo:a,slice:e}];case 2:return i.sent(),e.filePos=n+a.totalSize,[3,1];case 3:return[2]}})}},{key:"traverseBox",value:function(e){var r=e.filePos,n=(0,w.readBoxHeader)(e);if(!n)return!1;var a=e.filePos,i=r+n.totalSize;switch(n.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(e.slice(a,n.contentSize));break;case"mvhd":var s=(0,T.readU8)(e);e.skip(3),1===s?(e.skip(16),this.movieTimescale=(0,T.readU32Be)(e),this.movieDurationInTimescale=(0,T.readU64Be)(e)):(e.skip(8),this.movieTimescale=(0,T.readU32Be)(e),this.movieDurationInTimescale=(0,T.readU32Be)(e));break;case"trak":var o={id:-1,demuxer:this,inputTrack:null,disposition:(0,d._)({},x.DEFAULT_TRACK_DISPOSITION),info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:_.UNDETERMINED_LANGUAGE,sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};this.currentTrack=o,this.readContiguousBoxes(e.slice(a,n.contentSize)),-1!==o.id&&-1!==o.timescale&&null!==o.info&&("video"===o.info.type&&-1!==o.info.width?(o.inputTrack=new(0,k.InputVideoTrack)(this.input,new j(o)),this.tracks.push(o)):"audio"===o.info.type&&-1!==o.info.numberOfChannels&&(o.inputTrack=new(0,k.InputAudioTrack)(this.input,new P(o)),this.tracks.push(o))),this.currentTrack=null;break;case"tkhd":var c=this.currentTrack;if(!c)break;var u=(0,T.readU8)(e),l=(0,T.readU24Be)(e);if(c.disposition.default=!!(1&l),0===u)e.skip(8),c.id=(0,T.readU32Be)(e),e.skip(4),c.durationInMovieTimescale=(0,T.readU32Be)(e);else if(1===u)e.skip(16),c.id=(0,T.readU32Be)(e),e.skip(4),c.durationInMovieTimescale=(0,T.readU64Be)(e);else throw Error("Incorrect track header version ".concat(u,"."));e.skip(16);var f=[(0,w.readFixed_16_16)(e),(0,w.readFixed_16_16)(e),(0,w.readFixed_2_30)(e),(0,w.readFixed_16_16)(e),(0,w.readFixed_16_16)(e),(0,w.readFixed_2_30)(e),(0,w.readFixed_16_16)(e),(0,w.readFixed_16_16)(e),(0,w.readFixed_2_30)(e)],h=(0,_.normalizeRotation)((0,_.roundToMultiple)(F(f),90));(0,_.assert)(0===h||90===h||180===h||270===h),c.rotation=h;break;case"elst":var p=this.currentTrack;if(!p)break;var b=(0,T.readU8)(e);e.skip(3);for(var y=!1,S=0,I=(0,T.readU32Be)(e),E=0;E<I;E++){var C=1===b?(0,T.readU64Be)(e):(0,T.readU32Be)(e),A=1===b?(0,T.readI64Be)(e):(0,T.readI32Be)(e),B=(0,w.readFixed_16_16)(e);if(0!==C){if(y){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(-1===A){S+=C;continue}if(1!==B){console.warn("Unsupported edit list entry: media rate must be 1.");break}p.editListPreviousSegmentDurations=S,p.editListOffset=A,y=!0}}break;case"mdhd":var M=this.currentTrack;if(!M)break;var R=(0,T.readU8)(e);e.skip(3),0===R?(e.skip(8),M.timescale=(0,T.readU32Be)(e),M.durationInMediaTimescale=(0,T.readU32Be)(e)):1===R&&(e.skip(16),M.timescale=(0,T.readU32Be)(e),M.durationInMediaTimescale=(0,T.readU64Be)(e));var U=(0,T.readU16Be)(e);if(U>0){M.languageCode="";for(var O=0;O<3;O++)M.languageCode=String.fromCharCode(96+(31&U))+M.languageCode,U>>=5;(0,_.isIso639Dash2LanguageCode)(M.languageCode)||(M.languageCode=_.UNDETERMINED_LANGUAGE)}break;case"hdlr":var L=this.currentTrack;if(!L)break;e.skip(8);var N=(0,T.readAscii)(e,4);"vide"===N?L.info={type:"video",width:-1,height:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===N&&(L.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null});break;case"stbl":var V=this.currentTrack;if(!V)break;V.sampleTableByteOffset=r,this.readContiguousBoxes(e.slice(a,n.contentSize));break;case"stsd":var z=this.currentTrack;if(!z||null===z.info||z.sampleTable)break;var H=(0,T.readU8)(e);e.skip(3);for(var G=(0,T.readU32Be)(e),q=0;q<G;q++){var W=e.filePos,K=(0,w.readBoxHeader)(e);if(!K)break;z.internalCodecId=K.name;var X=K.name.toLowerCase();if("video"===z.info.type)"avc1"===X||"avc3"===X?(z.info.codec="avc",z.info.avcType="avc1"===X?1:3):"hvc1"===X||"hev1"===X?z.info.codec="hevc":"vp08"===X?z.info.codec="vp8":"vp09"===X?z.info.codec="vp9":"av01"===X?z.info.codec="av1":console.warn("Unsupported video codec (sample entry type '".concat(K.name,"').")),e.skip(24),z.info.width=(0,T.readU16Be)(e),z.info.height=(0,T.readU16Be)(e),e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,W+K.totalSize-e.filePos));else{"mp4a"===X||("opus"===X?z.info.codec="opus":"flac"===X?z.info.codec="flac":"twos"===X||"sowt"===X||"raw "===X||"in24"===X||"in32"===X||"fl32"===X||"fl64"===X||"lpcm"===X||"ipcm"===X||"fpcm"===X||("ulaw"===X?z.info.codec="ulaw":"alaw"===X?z.info.codec="alaw":console.warn("Unsupported audio codec (sample entry type '".concat(K.name,"').")))),e.skip(8);var Q=(0,T.readU16Be)(e);e.skip(6);var Z=(0,T.readU16Be)(e),Y=(0,T.readU16Be)(e);e.skip(4);var J=(0,T.readU32Be)(e)/65536;if(0===H&&Q>0){if(1===Q)e.skip(4),Y=8*(0,T.readU32Be)(e),e.skip(8);else if(2===Q){e.skip(4),J=(0,T.readF64Be)(e),Z=(0,T.readU32Be)(e),e.skip(4),Y=(0,T.readU32Be)(e);var $=(0,T.readU32Be)(e);if(e.skip(8),"lpcm"===X){var ee=Y+7>>3,et=!!(1&$),er=!!(2&$),en=4&$?-1:0;Y>0&&Y<=64&&(et?32===Y&&(z.info.codec=er?"pcm-f32be":"pcm-f32"):en&1<<ee-1?1===ee?z.info.codec="pcm-s8":2===ee?z.info.codec=er?"pcm-s16be":"pcm-s16":3===ee?z.info.codec=er?"pcm-s24be":"pcm-s24":4===ee&&(z.info.codec=er?"pcm-s32be":"pcm-s32"):1===ee&&(z.info.codec="pcm-u8")),null===z.info.codec&&console.warn("Unsupported PCM format.")}}}"opus"===z.info.codec&&(J=m.OPUS_SAMPLE_RATE),z.info.numberOfChannels=Z,z.info.sampleRate=J,"twos"===X?8===Y?z.info.codec="pcm-s8":16===Y?z.info.codec="pcm-s16be":(console.warn("Unsupported sample size ".concat(Y," for codec 'twos'.")),z.info.codec=null):"sowt"===X?8===Y?z.info.codec="pcm-s8":16===Y?z.info.codec="pcm-s16":(console.warn("Unsupported sample size ".concat(Y," for codec 'sowt'.")),z.info.codec=null):"raw "===X?z.info.codec="pcm-u8":"in24"===X?z.info.codec="pcm-s24be":"in32"===X?z.info.codec="pcm-s32be":"fl32"===X?z.info.codec="pcm-f32be":"fl64"===X?z.info.codec="pcm-f64be":"ipcm"===X?z.info.codec="pcm-s16be":"fpcm"===X&&(z.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,W+K.totalSize-e.filePos))}}break;case"avcC":var ea=this.currentTrack;if(!ea)break;(0,_.assert)(ea.info),ea.info.codecDescription=(0,T.readBytes)(e,n.contentSize);break;case"hvcC":var ei=this.currentTrack;if(!ei)break;(0,_.assert)(ei.info),ei.info.codecDescription=(0,T.readBytes)(e,n.contentSize);break;case"vpcC":var es,eo=this.currentTrack;if(!eo)break;(0,_.assert)((null==(es=eo.info)?void 0:es.type)==="video"),e.skip(4);var ec=(0,T.readU8)(e),eu=(0,T.readU8)(e),el=(0,T.readU8)(e),ed=(0,T.readU8)(e),ef=(0,T.readU8)(e),eh=(0,T.readU8)(e);eo.info.vp9CodecInfo={profile:ec,level:eu,bitDepth:el>>4,chromaSubsampling:el>>1&7,videoFullRangeFlag:1&el,colourPrimaries:ed,transferCharacteristics:ef,matrixCoefficients:eh};break;case"av1C":var ep,em=this.currentTrack;if(!em)break;(0,_.assert)((null==(ep=em.info)?void 0:ep.type)==="video"),e.skip(1);var eg=(0,T.readU8)(e),ev=eg>>5,eb=(0,T.readU8)(e),ek=eb>>6&1;em.info.av1CodecInfo={profile:ev,level:31&eg,tier:eb>>7,bitDepth:2===ev&&ek?eb>>5&1?12:10:ek?10:8,monochrome:eb>>4&1,chromaSubsamplingX:eb>>3&1,chromaSubsamplingY:eb>>2&1,chromaSamplePosition:3&eb};break;case"colr":var e_,ey=this.currentTrack;if(!ey||((0,_.assert)((null==(e_=ey.info)?void 0:e_.type)==="video"),"nclx"!==(0,T.readAscii)(e,4)))break;var eS=(0,T.readU16Be)(e),ew=(0,T.readU16Be)(e),eT=(0,T.readU16Be)(e),ex=!!(128&(0,T.readU8)(e));ey.info.colorSpace={primaries:_.COLOR_PRIMARIES_MAP_INVERSE[eS],transfer:_.TRANSFER_CHARACTERISTICS_MAP_INVERSE[ew],matrix:_.MATRIX_COEFFICIENTS_MAP_INVERSE[eT],fullRange:ex};break;case"esds":var eI,eE=this.currentTrack;if(!eE)break;(0,_.assert)((null==(eI=eE.info)?void 0:eI.type)==="audio"),e.skip(4);var ej=(0,T.readU8)(e);(0,_.assert)(3===ej),(0,w.readIsomVariableInteger)(e),e.skip(2);var eP=(0,T.readU8)(e);if((128&eP)!=0&&e.skip(2),(64&eP)!=0){var eC=(0,T.readU8)(e);e.skip(eC)}(32&eP)!=0&&e.skip(2);var eA=(0,T.readU8)(e);(0,_.assert)(4===eA);var eB=(0,w.readIsomVariableInteger)(e),eM=e.filePos,eD=(0,T.readU8)(e);if(64===eD||103===eD?(eE.info.codec="aac",eE.info.aacCodecInfo={isMpeg2:103===eD}):105===eD||107===eD?eE.info.codec="mp3":221===eD?eE.info.codec="vorbis":console.warn("Unsupported audio codec (objectTypeIndication ".concat(eD,") - discarding track.")),e.skip(12),eB>e.filePos-eM){var eF=(0,T.readU8)(e);(0,_.assert)(5===eF);var eR=(0,w.readIsomVariableInteger)(e);if(eE.info.codecDescription=(0,T.readBytes)(e,eR),"aac"===eE.info.codec){var eU=(0,m.parseAacAudioSpecificConfig)(eE.info.codecDescription);null!==eU.numberOfChannels&&(eE.info.numberOfChannels=eU.numberOfChannels),null!==eU.sampleRate&&(eE.info.sampleRate=eU.sampleRate)}}break;case"enda":var eO,eL=this.currentTrack;if(!eL)break;(0,_.assert)((null==(eO=eL.info)?void 0:eO.type)==="audio"),255&(0,T.readU16Be)(e)&&("pcm-s16be"===eL.info.codec?eL.info.codec="pcm-s16":"pcm-s24be"===eL.info.codec?eL.info.codec="pcm-s24":"pcm-s32be"===eL.info.codec?eL.info.codec="pcm-s32":"pcm-f32be"===eL.info.codec?eL.info.codec="pcm-f32":"pcm-f64be"===eL.info.codec&&(eL.info.codec="pcm-f64"));break;case"pcmC":var eN,eV=this.currentTrack;if(!eV)break;(0,_.assert)((null==(eN=eV.info)?void 0:eN.type)==="audio"),e.skip(4);var ez=!!(1&(0,T.readU8)(e)),eH=(0,T.readU8)(e);"pcm-s16be"===eV.info.codec?ez?16===eH?eV.info.codec="pcm-s16":24===eH?eV.info.codec="pcm-s24":32===eH?eV.info.codec="pcm-s32":(console.warn("Invalid ipcm sample size ".concat(eH,".")),eV.info.codec=null):16===eH?eV.info.codec="pcm-s16be":24===eH?eV.info.codec="pcm-s24be":32===eH?eV.info.codec="pcm-s32be":(console.warn("Invalid ipcm sample size ".concat(eH,".")),eV.info.codec=null):"pcm-f32be"===eV.info.codec&&(ez?32===eH?eV.info.codec="pcm-f32":64===eH?eV.info.codec="pcm-f64":(console.warn("Invalid fpcm sample size ".concat(eH,".")),eV.info.codec=null):32===eH?eV.info.codec="pcm-f32be":64===eH?eV.info.codec="pcm-f64be":(console.warn("Invalid fpcm sample size ".concat(eH,".")),eV.info.codec=null));break;case"dOps":var eG,eq,eW=this.currentTrack;if(!eW)break;(0,_.assert)((null==(eG=eW.info)?void 0:eG.type)==="audio"),e.skip(1);var eK=(0,T.readU8)(e),eX=(0,T.readU16Be)(e),eQ=(0,T.readU32Be)(e),eZ=(0,T.readI16Be)(e),eY=(0,T.readU8)(e);eq=0!==eY?(0,T.readBytes)(e,2+eK):new Uint8Array(0);var eJ=new Uint8Array(19+eq.byteLength),e$=new DataView(eJ.buffer);e$.setUint32(0,0x4f707573,!1),e$.setUint32(4,0x48656164,!1),e$.setUint8(8,1),e$.setUint8(9,eK),e$.setUint16(10,eX,!0),e$.setUint32(12,eQ,!0),e$.setInt16(16,eZ,!0),e$.setUint8(18,eY),eJ.set(eq,19),eW.info.codecDescription=eJ,eW.info.numberOfChannels=eK;break;case"dfLa":var e0,e1=this.currentTrack;if(!e1)break;(0,_.assert)((null==(e0=e1.info)?void 0:e0.type)==="audio"),e.skip(4);for(var e2=e.filePos;e.filePos<i;){var e3=(0,T.readU8)(e),e4=(0,T.readU24Be)(e);if((127&e3)===g.FlacBlockType.STREAMINFO){e.skip(10);var e8=(0,T.readU32Be)(e),e6=e8>>>12,e5=(e8>>9&7)+1;e1.info.sampleRate=e6,e1.info.numberOfChannels=e5,e.skip(20)}else e.skip(e4);if(128&e3)break}var e7=e.filePos;e.filePos=e2;var e9=(0,T.readBytes)(e,e7-e2),te=new Uint8Array(4+e9.byteLength);new DataView(te.buffer).setUint32(0,0x664c6143,!1),te.set(e9,4),e1.info.codecDescription=te;break;case"stts":var tt=this.currentTrack;if(!tt||!tt.sampleTable)break;e.skip(4);for(var tr=(0,T.readU32Be)(e),tn=0,ta=0,ti=0;ti<tr;ti++){var ts=(0,T.readU32Be)(e),to=(0,T.readU32Be)(e);tt.sampleTable.sampleTimingEntries.push({startIndex:tn,startDecodeTimestamp:ta,count:ts,delta:to}),tn+=ts,ta+=ts*to}break;case"ctts":var tc=this.currentTrack;if(!tc||!tc.sampleTable)break;e.skip(4);for(var tu=(0,T.readU32Be)(e),tl=0,td=0;td<tu;td++){var tf=(0,T.readU32Be)(e),th=(0,T.readI32Be)(e);tc.sampleTable.sampleCompositionTimeOffsets.push({startIndex:tl,count:tf,offset:th}),tl+=tf}break;case"stsz":var tp=this.currentTrack;if(!tp||!tp.sampleTable)break;e.skip(4);var tm=(0,T.readU32Be)(e),tg=(0,T.readU32Be)(e);if(0===tm)for(var tv=0;tv<tg;tv++){var tb=(0,T.readU32Be)(e);tp.sampleTable.sampleSizes.push(tb)}else tp.sampleTable.sampleSizes.push(tm);break;case"stz2":var tk=this.currentTrack;if(!tk||!tk.sampleTable)break;e.skip(4),e.skip(3);for(var t_=(0,T.readU8)(e),ty=(0,T.readU32Be)(e),tS=(0,T.readBytes)(e,Math.ceil(ty*t_/8)),tw=new(0,_.Bitstream)(tS),tT=0;tT<ty;tT++){var tx=tw.readBits(t_);tk.sampleTable.sampleSizes.push(tx)}break;case"stss":var tI=this.currentTrack;if(!tI||!tI.sampleTable)break;e.skip(4),tI.sampleTable.keySampleIndices=[];for(var tE=(0,T.readU32Be)(e),tj=0;tj<tE;tj++){var tP=(0,T.readU32Be)(e)-1;tI.sampleTable.keySampleIndices.push(tP)}0!==tI.sampleTable.keySampleIndices[0]&&tI.sampleTable.keySampleIndices.unshift(0);break;case"stsc":var tC=this.currentTrack;if(!tC||!tC.sampleTable)break;e.skip(4);for(var tA=(0,T.readU32Be)(e),tB=0;tB<tA;tB++){var tM=(0,T.readU32Be)(e)-1,tD=(0,T.readU32Be)(e),tF=(0,T.readU32Be)(e);tC.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:tM,samplesPerChunk:tD,sampleDescriptionIndex:tF})}for(var tR=0,tU=0;tU<tC.sampleTable.sampleToChunk.length;tU++)tC.sampleTable.sampleToChunk[tU].startSampleIndex=tR,tU<tC.sampleTable.sampleToChunk.length-1&&(tR+=(tC.sampleTable.sampleToChunk[tU+1].startChunkIndex-tC.sampleTable.sampleToChunk[tU].startChunkIndex)*tC.sampleTable.sampleToChunk[tU].samplesPerChunk);break;case"stco":var tO=this.currentTrack;if(!tO||!tO.sampleTable)break;e.skip(4);for(var tL=(0,T.readU32Be)(e),tN=0;tN<tL;tN++){var tV=(0,T.readU32Be)(e);tO.sampleTable.chunkOffsets.push(tV)}break;case"co64":var tz=this.currentTrack;if(!tz||!tz.sampleTable)break;e.skip(4);for(var tH=(0,T.readU32Be)(e),tG=0;tG<tH;tG++){var tq=(0,T.readU64Be)(e);tz.sampleTable.chunkOffsets.push(tq)}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(a,n.contentSize));break;case"mehd":var tW=(0,T.readU8)(e);e.skip(3);var tK=1===tW?(0,T.readU64Be)(e):(0,T.readU32Be)(e);this.movieDurationInTimescale=tK;break;case"trex":e.skip(4);var tX=(0,T.readU32Be)(e),tQ=(0,T.readU32Be)(e),tZ=(0,T.readU32Be)(e),tY=(0,T.readU32Be)(e),tJ=(0,T.readU32Be)(e);this.fragmentTrackDefaults.push({trackId:tX,defaultSampleDescriptionIndex:tQ,defaultSampleDuration:tZ,defaultSampleSize:tY,defaultSampleFlags:tJ});break;case"tfra":var t$=(0,T.readU8)(e);e.skip(3);var t0=(0,T.readU32Be)(e),t1=this.tracks.find(function(e){return e.id===t0});if(!t1)break;for(var t2=(0,T.readU32Be)(e),t3=[T.readU8,T.readU16Be,T.readU24Be,T.readU32Be],t4=t3[(48&t2)>>4],t8=t3[(12&t2)>>2],t6=t3[3&t2],t5=(0,T.readU32Be)(e),t7=0;t7<t5;t7++){var t9=1===t$?(0,T.readU64Be)(e):(0,T.readU32Be)(e),re=1===t$?(0,T.readU64Be)(e):(0,T.readU32Be)(e);t4(e),t8(e),t6(e),t1.fragmentLookupTable.push({timestamp:t9,moofOffset:re})}t1.fragmentLookupTable.sort(function(e,r){return e.timestamp-r.timestamp});for(var rt=0;rt<t1.fragmentLookupTable.length-1;rt++){var rr=t1.fragmentLookupTable[rt],rn=t1.fragmentLookupTable[rt+1];rr.timestamp===rn.timestamp&&(t1.fragmentLookupTable.splice(rt+1,1),rt--)}break;case"moof":this.currentFragment={moofOffset:r,moofSize:n.totalSize,implicitBaseDataOffset:r,trackData:new Map},this.readContiguousBoxes(e.slice(a,n.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if((0,_.assert)(this.currentFragment),this.readContiguousBoxes(e.slice(a,n.contentSize)),this.currentTrack){var ra=this.currentFragment.trackData.get(this.currentTrack.id);if(ra){var ri=this.currentTrack.currentFragmentState;(0,_.assert)(ri),null!==ri.startTimestamp&&(D(ra,ri.startTimestamp),ra.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":(0,_.assert)(this.currentFragment),e.skip(1);var rs,ro,rc,ru,rl=(0,T.readU24Be)(e),rd=(0,T.readU32Be)(e),rf=this.tracks.find(function(e){return e.id===rd});if(!rf)break;var rh=this.fragmentTrackDefaults.find(function(e){return e.trackId===rd});this.currentTrack=rf,rf.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:null!=(rs=null==rh?void 0:rh.defaultSampleDescriptionIndex)?rs:null,defaultSampleDuration:null!=(ro=null==rh?void 0:rh.defaultSampleDuration)?ro:null,defaultSampleSize:null!=(rc=null==rh?void 0:rh.defaultSampleSize)?rc:null,defaultSampleFlags:null!=(ru=null==rh?void 0:rh.defaultSampleFlags)?ru:null,startTimestamp:null},1&rl?rf.currentFragmentState.baseDataOffset=(0,T.readU64Be)(e):131072&rl&&(rf.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),2&rl&&(rf.currentFragmentState.sampleDescriptionIndex=(0,T.readU32Be)(e)),8&rl&&(rf.currentFragmentState.defaultSampleDuration=(0,T.readU32Be)(e)),16&rl&&(rf.currentFragmentState.defaultSampleSize=(0,T.readU32Be)(e)),32&rl&&(rf.currentFragmentState.defaultSampleFlags=(0,T.readU32Be)(e)),65536&rl&&(rf.currentFragmentState.defaultSampleDuration=0);break;case"tfdt":var rp=this.currentTrack;if(!rp)break;(0,_.assert)(rp.currentFragmentState);var rm=(0,T.readU8)(e);e.skip(3);var rg=0===rm?(0,T.readU32Be)(e):(0,T.readU64Be)(e);rp.currentFragmentState.startTimestamp=rg;break;case"trun":var rv=this.currentTrack;if(!rv)break;if((0,_.assert)(this.currentFragment),(0,_.assert)(rv.currentFragmentState),this.currentFragment.trackData.has(rv.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}var rb=(0,T.readU8)(e),rk=(0,T.readU24Be)(e),r_=!!(256&rk),ry=!!(512&rk),rS=!!(1024&rk),rw=!!(2048&rk),rT=(0,T.readU32Be)(e),rx=rv.currentFragmentState.baseDataOffset;1&rk&&(rx+=(0,T.readI32Be)(e));var rI=null;4&rk&&(rI=(0,T.readU32Be)(e));var rE=rx;if(0===rT){this.currentFragment.implicitBaseDataOffset=rE;break}var rj=0,rP={track:rv,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(rv.id,rP);for(var rC=0;rC<rT;rC++){var rA=void 0;r_?rA=(0,T.readU32Be)(e):((0,_.assert)(null!==rv.currentFragmentState.defaultSampleDuration),rA=rv.currentFragmentState.defaultSampleDuration);var rB=void 0;ry?rB=(0,T.readU32Be)(e):((0,_.assert)(null!==rv.currentFragmentState.defaultSampleSize),rB=rv.currentFragmentState.defaultSampleSize);var rM=void 0;rS?rM=(0,T.readU32Be)(e):((0,_.assert)(null!==rv.currentFragmentState.defaultSampleFlags),rM=rv.currentFragmentState.defaultSampleFlags),0===rC&&null!==rI&&(rM=rI);var rD=0;rw&&(rD=0===rb?(0,T.readU32Be)(e):(0,T.readI32Be)(e));var rF=!(65536&rM);rP.samples.push({presentationTimestamp:rj+rD,duration:rA,byteOffset:rE,byteSize:rB,isKeyFrame:rF}),rE+=rB,rj+=rA}rP.presentationTimestamps=rP.samples.map(function(e,r){return{presentationTimestamp:e.presentationTimestamp,sampleIndex:r}}).sort(function(e,r){return e.presentationTimestamp-r.presentationTimestamp});for(var rR=0;rR<rP.presentationTimestamps.length;rR++){var rU=rP.presentationTimestamps[rR],rO=rP.samples[rU.sampleIndex];null===rP.firstKeyFrameTimestamp&&rO.isKeyFrame&&(rP.firstKeyFrameTimestamp=rO.presentationTimestamp),rR<rP.presentationTimestamps.length-1&&(rO.duration=rP.presentationTimestamps[rR+1].presentationTimestamp-rU.presentationTimestamp)}var rL=rP.samples[rP.presentationTimestamps[0].sampleIndex],rN=rP.samples[(0,_.last)(rP.presentationTimestamps).sampleIndex];rP.startTimestamp=rL.presentationTimestamp,rP.endTimestamp=rN.presentationTimestamp+rN.duration,this.currentFragment.implicitBaseDataOffset=rE;break;case"udta":var rV=this.iterateContiguousBoxes(e.slice(a,n.contentSize)),rz=!0,rH=!1,rG=void 0;try{for(var rq,rW=rV[Symbol.iterator]();!(rz=(rq=rW.next()).done);rz=!0){var rK,rX,rQ=rq.value,rZ=rQ.boxInfo,rY=rQ.slice;if("meta"!==rZ.name&&!this.currentTrack){var rJ,r$,r0,r1,r2,r3=rY.filePos;null!=(rJ=this.metadataTags).raw||(rJ.raw={}),"©"===rZ.name[0]?null!=(r$=this.metadataTags.raw)[r0=rZ.name]||(r$[r0]=(0,w.readMetadataStringShort)(rY)):null!=(r1=this.metadataTags.raw)[r2=rZ.name]||(r1[r2]=(0,T.readBytes)(rY,rZ.contentSize)),rY.filePos=r3}switch(rZ.name){case"meta":rY.skip(-rZ.headerSize),this.traverseBox(rY);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=_.textDecoder.decode((0,T.readBytes)(rY,rZ.contentSize)):null!=(r4=this.metadataTags).title||(r4.title=(0,w.readMetadataStringShort)(rY));break;case"©des":this.currentTrack||null!=(r8=this.metadataTags).description||(r8.description=(0,w.readMetadataStringShort)(rY));break;case"©ART":this.currentTrack||null!=(r6=this.metadataTags).artist||(r6.artist=(0,w.readMetadataStringShort)(rY));break;case"©alb":this.currentTrack||null!=(r5=this.metadataTags).album||(r5.album=(0,w.readMetadataStringShort)(rY));break;case"albr":this.currentTrack||null!=(r7=this.metadataTags).albumArtist||(r7.albumArtist=(0,w.readMetadataStringShort)(rY));break;case"©gen":this.currentTrack||null!=(r9=this.metadataTags).genre||(r9.genre=(0,w.readMetadataStringShort)(rY));break;case"©day":if(!this.currentTrack){var r4,r8,r6,r5,r7,r9,ne,nt=new Date((0,w.readMetadataStringShort)(rY));Number.isNaN(nt.getTime())||null!=(ne=this.metadataTags).date||(ne.date=nt)}break;case"©cmt":this.currentTrack||null!=(rK=this.metadataTags).comment||(rK.comment=(0,w.readMetadataStringShort)(rY));break;case"©lyr":this.currentTrack||null!=(rX=this.metadataTags).lyrics||(rX.lyrics=(0,w.readMetadataStringShort)(rY))}}}catch(e){rH=!0,rG=e}finally{try{rz||null==rW.return||rW.return()}finally{if(rH)throw rG}}break;case"meta":if(this.currentTrack)break;var nr=(0,T.readU32Be)(e);this.currentMetadataKeys=new Map,0!==nr?this.readContiguousBoxes(e.slice(a,n.contentSize)):this.readContiguousBoxes(e.slice(a+4,n.contentSize-4)),this.currentMetadataKeys=null;break;case"keys":if(!this.currentMetadataKeys)break;e.skip(4);for(var nn=(0,T.readU32Be)(e),na=0;na<nn;na++){var ni=(0,T.readU32Be)(e);e.skip(4);var ns=_.textDecoder.decode((0,T.readBytes)(e,ni-8));this.currentMetadataKeys.set(na+1,ns)}break;case"ilst":if(!this.currentMetadataKeys)break;var no=this.iterateContiguousBoxes(e.slice(a,n.contentSize)),nc=!0,nu=!1,nl=void 0;try{for(var nd,nf=no[Symbol.iterator]();!(nc=(nd=nf.next()).done);nc=!0){var nh=nd.value,np=nh.boxInfo,nm=nh.slice,ng=np.name,nv=(ng.charCodeAt(0)<<24)+(ng.charCodeAt(1)<<16)+(ng.charCodeAt(2)<<8)+ng.charCodeAt(3);this.currentMetadataKeys.has(nv)&&(ng=this.currentMetadataKeys.get(nv));var nb=(0,w.readDataBox)(nm);switch(null!=(nk=this.metadataTags).raw||(nk.raw={}),null!=(n_=this.metadataTags.raw)[ny=ng]||(n_[ny]=nb),ng){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof nb&&(null!=(nS=this.metadataTags).title||(nS.title=nb));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof nb&&(null!=(nw=this.metadataTags).description||(nw.description=nb));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof nb&&(null!=(nT=this.metadataTags).artist||(nT.artist=nb));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof nb&&(null!=(nx=this.metadataTags).album||(nx.album=nb));break;case"aART":case"album_artist":"string"==typeof nb&&(null!=(nI=this.metadataTags).albumArtist||(nI.albumArtist=nb));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof nb&&(null!=(nE=this.metadataTags).comment||(nE.comment=nb));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof nb&&(null!=(nj=this.metadataTags).genre||(nj.genre=nb));break;case"©lyr":case"lyrics":"string"==typeof nb&&(null!=(nP=this.metadataTags).lyrics||(nP.lyrics=nb));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof nb){var nk,n_,ny,nS,nw,nT,nx,nI,nE,nj,nP,nC,nA=new Date(nb);Number.isNaN(nA.getTime())||null!=(nC=this.metadataTags).date||(nC.date=nA)}break;case"covr":case"com.apple.quicktime.artwork":nb instanceof x.RichImageData?(null!=(nB=this.metadataTags).images||(nB.images=[]),this.metadataTags.images.push({data:nb.data,kind:"coverFront",mimeType:nb.mimeType})):nb instanceof Uint8Array&&(null!=(nM=this.metadataTags).images||(nM.images=[]),this.metadataTags.images.push({data:nb,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof nb){var nB,nM,nD,nF,nR=nb.split("/"),nU=Number.parseInt(nR[0],10),nO=nR[1]&&Number.parseInt(nR[1],10);Number.isInteger(nU)&&nU>0&&(null!=(nD=this.metadataTags).trackNumber||(nD.trackNumber=nU)),nO&&Number.isInteger(nO)&&nO>0&&(null!=(nF=this.metadataTags).tracksTotal||(nF.tracksTotal=nO))}break;case"trkn":if(nb instanceof Uint8Array&&nb.length>=6){var nL,nN,nV=(0,_.toDataView)(nb),nz=nV.getUint16(2,!1),nH=nV.getUint16(4,!1);nz>0&&(null!=(nL=this.metadataTags).trackNumber||(nL.trackNumber=nz)),nH>0&&(null!=(nN=this.metadataTags).tracksTotal||(nN.tracksTotal=nH))}break;case"disc":case"disk":if(nb instanceof Uint8Array&&nb.length>=6){var nG,nq,nW=(0,_.toDataView)(nb),nK=nW.getUint16(2,!1),nX=nW.getUint16(4,!1);nK>0&&(null!=(nG=this.metadataTags).discNumber||(nG.discNumber=nK)),nX>0&&(null!=(nq=this.metadataTags).discsTotal||(nq.discsTotal=nX))}}}}catch(e){nu=!0,nl=e}finally{try{nc||null==nf.return||nf.return()}finally{if(nu)throw nl}}}return e.filePos=i,!0}}]),r}(b.Demuxer),E=function(){"use strict";function e(r){(0,c._)(this,e),this.internalTrack=r,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}return(0,u._)(e,[{key:"getId",value:function(){return this.internalTrack.id}},{key:"getCodec",value:function(){throw Error("Not implemented on base class.")}},{key:"getInternalCodecId",value:function(){return this.internalTrack.internalCodecId}},{key:"getName",value:function(){return this.internalTrack.name}},{key:"getLanguageCode",value:function(){return this.internalTrack.languageCode}},{key:"getTimeResolution",value:function(){return this.internalTrack.timescale}},{key:"getDisposition",value:function(){return this.internalTrack.disposition}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r,n;return(0,p._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"getFirstTimestamp",value:function(){return(0,s._)(function(){var e,r;return(0,p._)(this,function(n){switch(n.label){case 0:return[4,this.getFirstPacket({metadataOnly:!0})];case 1:return[2,null!=(r=null==(e=n.sent())?void 0:e.timestamp)?r:0]}})}).call(this)}},{key:"getFirstPacket",value:function(e){return(0,s._)(function(){var r,n;return(0,p._)(this,function(a){switch(a.label){case 0:return r=this,[4,this.fetchPacketForSampleIndex(0,e)];case 1:if((n=a.sent())||!this.internalTrack.demuxer.isFragmented)return[2,n];return[2,this.performFragmentedLookup(null,function(e){return e.trackData.get(r.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,e)]}})}).call(this)}},{key:"mapTimestampIntoTimescale",value:function(e){return(0,_.roundIfAlmostInteger)(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}},{key:"getPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o;return(0,p._)(this,function(c){switch(c.label){case 0:return n=this,a=this.mapTimestampIntoTimescale(e),s=C(i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a),[4,this.fetchPacketForSampleIndex(s,r)];case 1:if(o=c.sent(),!R(i)||!this.internalTrack.demuxer.isFragmented)return[2,o];return[2,this.performFragmentedLookup(null,function(e){var r=e.trackData.get(n.internalTrack.id);if(!r)return{sampleIndex:-1,correctSampleFound:!1};var i=(0,_.binarySearchLessOrEqual)(r.presentationTimestamps,a,function(e){return e.presentationTimestamp});return{sampleIndex:-1!==i?r.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&a<r.endTimestamp}},a,a,r)]}})}).call(this)}},{key:"getNextPacket",value:function(e,r){return(0,s._)(function(){var n,a,i;return(0,p._)(this,function(s){if(n=this,void 0!==(a=this.packetToSampleIndex.get(e)))return[2,this.fetchPacketForSampleIndex(a+1,r)];if(void 0===(i=this.packetToFragmentLocation.get(e)))throw Error("Packet was not created from this track.");return[2,this.performFragmentedLookup(i.fragment,function(e){if(e===i.fragment){var r=e.trackData.get(n.internalTrack.id);if(i.sampleIndex+1<r.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(e.trackData.get(n.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,r)]})}).call(this)}},{key:"getKeyPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o;return(0,p._)(this,function(c){switch(c.label){case 0:return n=this,a=this.mapTimestampIntoTimescale(e),s=A(i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a),[4,this.fetchPacketForSampleIndex(s,r)];case 1:if(o=c.sent(),!R(i)||!this.internalTrack.demuxer.isFragmented)return[2,o];return[2,this.performFragmentedLookup(null,function(e){var r=e.trackData.get(n.internalTrack.id);if(!r)return{sampleIndex:-1,correctSampleFound:!1};var i=(0,_.findLastIndex)(r.presentationTimestamps,function(e){return r.samples[e.sampleIndex].isKeyFrame&&e.presentationTimestamp<=a});return{sampleIndex:-1!==i?r.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&a<r.endTimestamp}},a,a,r)]}})}).call(this)}},{key:"getNextKeyPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s;return(0,p._)(this,function(o){if(n=this,void 0!==(a=this.packetToSampleIndex.get(e)))return i=M(this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a),[2,this.fetchPacketForSampleIndex(i,r)];if(void 0===(s=this.packetToFragmentLocation.get(e)))throw Error("Packet was not created from this track.");return[2,this.performFragmentedLookup(s.fragment,function(e){if(e===s.fragment){var r=e.trackData.get(n.internalTrack.id).samples.findIndex(function(e,r){return e.isKeyFrame&&r>s.sampleIndex});if(-1!==r)return{sampleIndex:r,correctSampleFound:!0}}else{var a=e.trackData.get(n.internalTrack.id);if(a&&null!==a.firstKeyFrameTimestamp){var i=a.samples.findIndex(function(e){return e.isKeyFrame});return(0,_.assert)(-1!==i),{sampleIndex:i,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,r)]})}).call(this)}},{key:"fetchPacketForSampleIndex",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o,c;return(0,p._)(this,function(u){switch(u.label){case 0:if(-1===e||!(n=B(this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),e)))return[2,null];if(!r.metadataOnly)return[3,1];return a=y.PLACEHOLDER_DATA,[3,4];case 1:if(!((i=this.internalTrack.demuxer.reader.requestSlice(n.sampleOffset,n.sampleSize))instanceof Promise))return[3,3];return[4,i];case 2:i=u.sent(),u.label=3;case 3:(0,_.assert)(i),a=(0,T.readBytes)(i,n.sampleSize),u.label=4;case 4:return s=(n.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,o=n.duration/this.internalTrack.timescale,c=new(0,y.EncodedPacket)(a,n.isKeyFrame?"key":"delta",s,o,e,n.sampleSize),this.packetToSampleIndex.set(c,e),[2,c]}})}).call(this)}},{key:"fetchPacketInFragment",value:function(e,r,n){return(0,s._)(function(){var a,i,s,o,c,u;return(0,p._)(this,function(l){switch(l.label){case 0:if(-1===r)return[2,null];if(a=e.trackData.get(this.internalTrack.id).samples[r],(0,_.assert)(a),!n.metadataOnly)return[3,1];return i=y.PLACEHOLDER_DATA,[3,4];case 1:if(!((s=this.internalTrack.demuxer.reader.requestSlice(a.byteOffset,a.byteSize))instanceof Promise))return[3,3];return[4,s];case 2:s=l.sent(),l.label=3;case 3:(0,_.assert)(s),i=(0,T.readBytes)(s,a.byteSize),l.label=4;case 4:return o=(a.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,c=a.duration/this.internalTrack.timescale,u=new(0,y.EncodedPacket)(i,a.isKeyFrame?"key":"delta",o,c,e.moofOffset+r,a.byteSize),this.packetToFragmentLocation.set(u,{fragment:e,sampleIndex:r}),[2,u]}})}).call(this)}},{key:"performFragmentedLookup",value:function(e,r,n,a,i){return(0,s._)(function(){var s,o,c,u,l,d,f,h,m,g,b,k,y,S,T,x,I,E,j,P,C,A,B;return(0,p._)(this,function(p){switch(p.label){case 0:if(s=this.internalTrack.demuxer,o=null,c=null,u=-1,e){if(d=(l=r(e)).sampleIndex,l.correctSampleFound)return[2,this.fetchPacketInFragment(e,d,i)];-1!==d&&(c=e,u=d)}h=-1!==(f=(0,_.binarySearchLessOrEqual)(this.internalTrack.fragmentLookupTable,n,function(e){return e.timestamp}))?this.internalTrack.fragmentLookupTable[f]:null,g=-1!==(m=(0,_.binarySearchLessOrEqual)(this.internalTrack.fragmentPositionCache,n,function(e){return e.startTimestamp}))?this.internalTrack.fragmentPositionCache[m]:null,y=Math.max(null!=(b=null==h?void 0:h.moofOffset)?b:0,null!=(k=null==g?void 0:g.moofOffset)?k:0)||null,e?null===y||e.moofOffset>=y?(S=e.moofOffset+e.moofSize,o=e):S=y:S=null!=y?y:0,p.label=1;case 1:if(o&&(T=o.trackData.get(this.internalTrack.id))&&T.startTimestamp>a)return[3,6];if(!((x=s.reader.requestSliceRange(S,w.MIN_BOX_HEADER_SIZE,w.MAX_BOX_HEADER_SIZE))instanceof Promise))return[3,3];return[4,x];case 2:x=p.sent(),p.label=3;case 3:if(!x||(I=S,!(E=(0,w.readBoxHeader)(x))))return[3,6];if("moof"!==E.name)return[3,5];return[4,s.readFragment(I)];case 4:if(P=(j=r(o=p.sent())).sampleIndex,j.correctSampleFound)return[2,this.fetchPacketInFragment(o,P,i)];-1!==P&&(c=o,u=P),p.label=5;case 5:return S=I+E.totalSize,[3,1];case 6:if(h&&(!c||c.moofOffset<h.moofOffset))return C=this.internalTrack.fragmentLookupTable[f-1],(0,_.assert)(!C||C.timestamp<h.timestamp),B=null!=(A=null==C?void 0:C.timestamp)?A:-1/0,[2,this.performFragmentedLookup(null,r,B,a,i)];if(c)return[2,this.fetchPacketInFragment(c,u,i)];return[2,null]}})}).call(this)}}]),e}(),j=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).decoderConfigPromise=null,n.internalTrack=e,n}return(0,l._)(r,e),(0,u._)(r,[{key:"getCodec",value:function(){return this.internalTrack.info.codec}},{key:"getCodedWidth",value:function(){return this.internalTrack.info.width}},{key:"getCodedHeight",value:function(){return this.internalTrack.info.height}},{key:"getRotation",value:function(){return this.internalTrack.rotation}},{key:"getColorSpace",value:function(){return(0,s._)(function(){var e,r,n,a;return(0,p._)(this,function(i){return[2,{primaries:null==(e=this.internalTrack.info.colorSpace)?void 0:e.primaries,transfer:null==(r=this.internalTrack.info.colorSpace)?void 0:r.transfer,matrix:null==(n=this.internalTrack.info.colorSpace)?void 0:n.matrix,fullRange:null==(a=this.internalTrack.info.colorSpace)?void 0:a.fullRange}]})}).call(this)}},{key:"canBeTransparent",value:function(){return(0,s._)(function(){return(0,p._)(this,function(e){return[2,!1]})})()}},{key:"getDecoderConfig",value:function(){return(0,s._)(function(){var e,r;return(0,p._)(this,function(n){return(e=this,this.internalTrack.info.codec)?[2,null!=(r=this.decoderConfigPromise)?r:this.decoderConfigPromise=(0,s._)(function(){var e,r,n,a;return(0,p._)(this,function(i){switch(i.label){case 0:if(!("vp9"===this.internalTrack.info.codec&&!this.internalTrack.info.vp9CodecInfo))return[3,2];return[4,this.getFirstPacket({})];case 1:return e=i.sent(),this.internalTrack.info.vp9CodecInfo=e&&(0,g.extractVp9CodecInfoFromPacket)(e.data),[3,4];case 2:if(!("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo))return[3,4];return[4,this.getFirstPacket({})];case 3:r=i.sent(),this.internalTrack.info.av1CodecInfo=r&&(0,g.extractAv1CodecInfoFromPacket)(r.data),i.label=4;case 4:return[2,{codec:(0,m.extractVideoCodecString)(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:null!=(n=this.internalTrack.info.codecDescription)?n:void 0,colorSpace:null!=(a=this.internalTrack.info.colorSpace)?a:void 0}]}})}).call(e)]:[2,null]})}).call(this)}}]),r}(E),P=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).decoderConfig=null,n.internalTrack=e,n}return(0,l._)(r,e),(0,u._)(r,[{key:"getCodec",value:function(){return this.internalTrack.info.codec}},{key:"getNumberOfChannels",value:function(){return this.internalTrack.info.numberOfChannels}},{key:"getSampleRate",value:function(){return this.internalTrack.info.sampleRate}},{key:"getDecoderConfig",value:function(){return(0,s._)(function(){var e,r;return(0,p._)(this,function(n){return this.internalTrack.info.codec?[2,null!=(r=this.decoderConfig)?r:this.decoderConfig={codec:(0,m.extractAudioCodecString)(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!=(e=this.internalTrack.info.codecDescription)?e:void 0}]:[2,null]})}).call(this)}}]),r}(E),C=function(e,r){if(e.presentationTimestamps){var n=(0,_.binarySearchLessOrEqual)(e.presentationTimestamps,r,function(e){return e.presentationTimestamp});return -1===n?-1:e.presentationTimestamps[n].sampleIndex}var a=(0,_.binarySearchLessOrEqual)(e.sampleTimingEntries,r,function(e){return e.startDecodeTimestamp});if(-1===a)return -1;var i=e.sampleTimingEntries[a];return i.startIndex+Math.min(Math.floor((r-i.startDecodeTimestamp)/i.delta),i.count-1)},A=function(e,r){if(!e.keySampleIndices)return C(e,r);if(e.presentationTimestamps){var n=(0,_.binarySearchLessOrEqual)(e.presentationTimestamps,r,function(e){return e.presentationTimestamp});if(-1===n)return -1;for(var a=n;a>=0;a--){var i=e.presentationTimestamps[a].sampleIndex;if(-1!==(0,_.binarySearchExact)(e.keySampleIndices,i,function(e){return e}))return i}return -1}var s,o=C(e,r),c=(0,_.binarySearchLessOrEqual)(e.keySampleIndices,o,function(e){return e});return null!=(s=e.keySampleIndices[c])?s:-1},B=function(e,r){var n=(0,_.binarySearchLessOrEqual)(e.sampleTimingEntries,r,function(e){return e.startIndex}),a=e.sampleTimingEntries[n];if(!a||a.startIndex+a.count<=r)return null;var i=a.startDecodeTimestamp+(r-a.startIndex)*a.delta,s=(0,_.binarySearchLessOrEqual)(e.sampleCompositionTimeOffsets,r,function(e){return e.startIndex}),o=e.sampleCompositionTimeOffsets[s];o&&r-o.startIndex<o.count&&(i+=o.offset);var c=e.sampleSizes[Math.min(r,e.sampleSizes.length-1)],u=(0,_.binarySearchLessOrEqual)(e.sampleToChunk,r,function(e){return e.startSampleIndex}),l=e.sampleToChunk[u];(0,_.assert)(l);var d=l.startChunkIndex+Math.floor((r-l.startSampleIndex)/l.samplesPerChunk),f=e.chunkOffsets[d],h=l.startSampleIndex+(d-l.startChunkIndex)*l.samplesPerChunk,p=0,m=f;if(1===e.sampleSizes.length)m+=c*(r-h),p+=c*l.samplesPerChunk;else for(var g=h;g<h+l.samplesPerChunk;g++){var b=e.sampleSizes[g];g<r&&(m+=b),p+=b}var k=a.delta;if(e.presentationTimestamps){var y=e.presentationTimestampIndexMap[r];(0,_.assert)(void 0!==y),y<e.presentationTimestamps.length-1&&(k=e.presentationTimestamps[y+1].presentationTimestamp-i)}return{presentationTimestamp:i,duration:k,sampleOffset:m,sampleSize:c,chunkOffset:f,chunkSize:p,isKeyFrame:!e.keySampleIndices||-1!==(0,_.binarySearchExact)(e.keySampleIndices,r,function(e){return e})}},M=function(e,r){if(!e.keySampleIndices)return r+1;var n,a=(0,_.binarySearchLessOrEqual)(e.keySampleIndices,r,function(e){return e});return null!=(n=e.keySampleIndices[a+1])?n:-1},D=function(e,r){e.startTimestamp+=r,e.endTimestamp+=r;var n=!0,a=!1,i=void 0;try{for(var s,o=e.samples[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var c=s.value;c.presentationTimestamp+=r}}catch(e){a=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}var u=!0,l=!1,d=void 0;try{for(var f,h=e.presentationTimestamps[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var p=f.value;p.presentationTimestamp+=r}}catch(e){l=!0,d=e}finally{try{u||null==h.return||h.return()}finally{if(l)throw d}}},F=function(e){var r=(0,f._)(e,4),n=r[0],a=r[3],i=Math.hypot(n,a),s=-(180/Math.PI*Math.atan2(a/i,n/i));return Number.isFinite(s)?s:0},R=function(e){return 0===e.sampleSizes.length}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../codec.js":"fXWqW","../codec-data.js":"kWTYV","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../misc.js":"j7iGm","../packet.js":"QfqGG","./isobmff-misc.js":"gw3Ca","./isobmff-reader.js":"fSW0K","../reader.js":"8KRfO","../metadata.js":"eSjom","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kWTYV:[function(e,r,n,a){var i,s,o,c,u,l,d=e("@parcel/transformer-js/src/esmodule-helpers.js");d.defineInteropFlag(n),d.export(n,"AvcNalUnitType",function(){return c}),d.export(n,"HevcNalUnitType",function(){return u}),d.export(n,"findNalUnitsInAnnexB",function(){return g}),d.export(n,"transformAnnexBToLengthPrefixed",function(){return _}),d.export(n,"extractAvcNalUnits",function(){return y}),d.export(n,"extractAvcDecoderConfigurationRecord",function(){return w}),d.export(n,"serializeAvcDecoderConfigurationRecord",function(){return T}),d.export(n,"deserializeAvcDecoderConfigurationRecord",function(){return x}),d.export(n,"parseAvcSps",function(){return I}),d.export(n,"extractHevcNalUnits",function(){return E}),d.export(n,"extractNalUnitTypeForHevc",function(){return j}),d.export(n,"extractHevcDecoderConfigurationRecord",function(){return P}),d.export(n,"serializeHevcDecoderConfigurationRecord",function(){return U}),d.export(n,"extractVp9CodecInfoFromPacket",function(){return O}),d.export(n,"iterateAv1PacketObus",function(){return L}),d.export(n,"extractAv1CodecInfoFromPacket",function(){return N}),d.export(n,"parseOpusIdentificationHeader",function(){return V}),d.export(n,"parseOpusTocByte",function(){return H}),d.export(n,"parseModesFromVorbisSetupPacket",function(){return G}),d.export(n,"determineVideoPacketType",function(){return q}),d.export(n,"FlacBlockType",function(){return l}),d.export(n,"readVorbisComments",function(){return W}),d.export(n,"createVorbisComments",function(){return K});var f=e("@swc/helpers/cjs/_to_consumable_array.cjs"),h=e("@swc/helpers/cjs/_ts_generator.cjs"),p=e("./codec.js"),m=e("./misc.js");(i=c||(c={}))[i.IDR=5]="IDR",i[i.SEI=6]="SEI",i[i.SPS=7]="SPS",i[i.PPS=8]="PPS",i[i.SPS_EXT=13]="SPS_EXT",(s=u||(u={}))[s.RASL_N=8]="RASL_N",s[s.RASL_R=9]="RASL_R",s[s.BLA_W_LP=16]="BLA_W_LP",s[s.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",s[s.VPS_NUT=32]="VPS_NUT",s[s.SPS_NUT=33]="SPS_NUT",s[s.PPS_NUT=34]="PPS_NUT",s[s.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",s[s.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT";var g=function(e){for(var r=[],n=0;n<e.length;){for(var a=-1,i=0,s=n;s<e.length-3;s++){if(0===e[s]&&0===e[s+1]&&1===e[s+2]){a=s,i=3;break}if(s<e.length-4&&0===e[s]&&0===e[s+1]&&0===e[s+2]&&1===e[s+3]){a=s,i=4;break}}if(-1===a)break;if(n>0&&a>n){var o=e.subarray(n,a);o.length>0&&r.push(o)}n=a+i}if(n<e.length){var c=e.subarray(n);c.length>0&&r.push(c)}return r},b=function(e,r){for(var n=[],a=0,i=new DataView(e.buffer,e.byteOffset,e.byteLength);a+r<=e.length;){var s=void 0;1===r?s=i.getUint8(a):2===r?s=i.getUint16(a,!1):3===r?s=(0,m.getUint24)(i,a,!1):4===r?s=i.getUint32(a,!1):((0,m.assertNever)(r),(0,m.assert)(!1)),a+=r;var o=e.subarray(a,a+s);n.push(o),a+=s}return n},k=function(e){for(var r=[],n=e.length,a=0;a<n;a++)a+2<n&&0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(0,0),a+=2):r.push(e[a]);return new Uint8Array(r)},_=function(e){var r=g(e);if(0===r.length)return null;var n=0,a=!0,i=!1,s=void 0;try{for(var o,c=r[Symbol.iterator]();!(a=(o=c.next()).done);a=!0){var u=o.value;n+=4+u.byteLength}}catch(e){i=!0,s=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw s}}var l=new Uint8Array(n),d=new DataView(l.buffer),f=0,h=!0,p=!1,m=void 0;try{for(var b,k=r[Symbol.iterator]();!(h=(b=k.next()).done);h=!0){var _=b.value,y=_.byteLength;d.setUint32(f,y,!1),f+=4,l.set(_,f),f+=_.byteLength}}catch(e){p=!0,m=e}finally{try{h||null==k.return||k.return()}finally{if(p)throw m}}return l},y=function(e,r){return r.description?b(e,(3&(0,m.toUint8Array)(r.description)[4])+1):g(e)},S=function(e){return 31&e[0]},w=function(e){try{var r=g(e),n=r.filter(function(e){return S(e)===c.SPS}),a=r.filter(function(e){return S(e)===c.PPS}),i=r.filter(function(e){return S(e)===c.SPS_EXT});if(0===n.length||0===a.length)return null;var s=n[0],o=I(s);(0,m.assert)(null!==o);var u=100===o.profileIdc||110===o.profileIdc||122===o.profileIdc||144===o.profileIdc;return{configurationVersion:1,avcProfileIndication:o.profileIdc,profileCompatibility:o.constraintFlags,avcLevelIndication:o.levelIdc,lengthSizeMinusOne:3,sequenceParameterSets:n,pictureParameterSets:a,chromaFormat:u?o.chromaFormatIdc:null,bitDepthLumaMinus8:u?o.bitDepthLumaMinus8:null,bitDepthChromaMinus8:u?o.bitDepthChromaMinus8:null,sequenceParameterSetExt:u?i:null}}catch(e){return console.error("Error building AVC Decoder Configuration Record:",e),null}},T=function(e){var r=[];r.push(e.configurationVersion),r.push(e.avcProfileIndication),r.push(e.profileCompatibility),r.push(e.avcLevelIndication),r.push(252|3&e.lengthSizeMinusOne),r.push(224|31&e.sequenceParameterSets.length);var n=!0,a=!1,i=void 0;try{for(var s,o=e.sequenceParameterSets[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var c=s.value,u=c.byteLength;r.push(u>>8),r.push(255&u);for(var l=0;l<u;l++)r.push(c[l])}}catch(e){a=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}r.push(e.pictureParameterSets.length);var d=!0,f=!1,h=void 0;try{for(var p,g=e.pictureParameterSets[Symbol.iterator]();!(d=(p=g.next()).done);d=!0){var b=p.value,k=b.byteLength;r.push(k>>8),r.push(255&k);for(var _=0;_<k;_++)r.push(b[_])}}catch(e){f=!0,h=e}finally{try{d||null==g.return||g.return()}finally{if(f)throw h}}if(100===e.avcProfileIndication||110===e.avcProfileIndication||122===e.avcProfileIndication||144===e.avcProfileIndication){(0,m.assert)(null!==e.chromaFormat),(0,m.assert)(null!==e.bitDepthLumaMinus8),(0,m.assert)(null!==e.bitDepthChromaMinus8),(0,m.assert)(null!==e.sequenceParameterSetExt),r.push(252|3&e.chromaFormat),r.push(248|7&e.bitDepthLumaMinus8),r.push(248|7&e.bitDepthChromaMinus8),r.push(e.sequenceParameterSetExt.length);var y=!0,S=!1,w=void 0;try{for(var T,x=e.sequenceParameterSetExt[Symbol.iterator]();!(y=(T=x.next()).done);y=!0){var I=T.value,E=I.byteLength;r.push(E>>8),r.push(255&E);for(var j=0;j<E;j++)r.push(I[j])}}catch(e){S=!0,w=e}finally{try{y||null==x.return||x.return()}finally{if(S)throw w}}}return new Uint8Array(r)},x=function(e){try{for(var r=(0,m.toDataView)(e),n=0,a=r.getUint8(n++),i=r.getUint8(n++),s=r.getUint8(n++),o=r.getUint8(n++),c=3&r.getUint8(n++),u=31&r.getUint8(n++),l=[],d=0;d<u;d++){var f=r.getUint16(n,!1);n+=2,l.push(e.subarray(n,n+f)),n+=f}for(var h=r.getUint8(n++),p=[],g=0;g<h;g++){var b=r.getUint16(n,!1);n+=2,p.push(e.subarray(n,n+b)),n+=b}var k={configurationVersion:a,avcProfileIndication:i,profileCompatibility:s,avcLevelIndication:o,lengthSizeMinusOne:c,sequenceParameterSets:l,pictureParameterSets:p,chromaFormat:null,bitDepthLumaMinus8:null,bitDepthChromaMinus8:null,sequenceParameterSetExt:null};if((100===i||110===i||122===i||144===i)&&n+4<=e.length){var _=3&r.getUint8(n++),y=7&r.getUint8(n++),S=7&r.getUint8(n++),w=r.getUint8(n++);k.chromaFormat=_,k.bitDepthLumaMinus8=y,k.bitDepthChromaMinus8=S;for(var T=[],x=0;x<w;x++){var I=r.getUint16(n,!1);n+=2,T.push(e.subarray(n,n+I)),n+=I}k.sequenceParameterSetExt=T}return k}catch(e){return console.error("Error deserializing AVC Decoder Configuration Record:",e),null}},I=function(e){try{var r=new(0,m.Bitstream)(k(e));r.skipBits(1),r.skipBits(2);var n=r.readBits(5);if(7!==n)return null;var a=r.readAlignedByte(),i=r.readAlignedByte(),s=r.readAlignedByte();(0,m.readExpGolomb)(r);var o=null,c=null,u=null;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a)&&(o=(0,m.readExpGolomb)(r),3===o&&r.skipBits(1),c=(0,m.readExpGolomb)(r),u=(0,m.readExpGolomb)(r),r.skipBits(1),r.readBits(1))){for(var l=0;l<(3!==o?8:12);l++)if(r.readBits(1))for(var d=l<6?16:64,f=8,h=8,p=0;p<d;p++){if(0!==h){var g=(0,m.readSignedExpGolomb)(r);h=(f+g+256)%256}f=0===h?f:h}}(0,m.readExpGolomb)(r);var b=(0,m.readExpGolomb)(r);if(0===b)(0,m.readExpGolomb)(r);else if(1===b){r.skipBits(1),(0,m.readSignedExpGolomb)(r),(0,m.readSignedExpGolomb)(r);for(var _=(0,m.readExpGolomb)(r),y=0;y<_;y++)(0,m.readSignedExpGolomb)(r)}(0,m.readExpGolomb)(r),r.skipBits(1),(0,m.readExpGolomb)(r),(0,m.readExpGolomb)(r);var S=r.readBits(1);return{profileIdc:a,constraintFlags:i,levelIdc:s,frameMbsOnlyFlag:S,chromaFormatIdc:o,bitDepthLumaMinus8:c,bitDepthChromaMinus8:u}}catch(e){return console.error("Error parsing AVC SPS:",e),null}},E=function(e,r){return r.description?b(e,(3&(0,m.toUint8Array)(r.description)[21])+1):g(e)},j=function(e){return e[0]>>1&63},P=function(e){try{var r=g(e),n=r.filter(function(e){return j(e)===u.VPS_NUT}),a=r.filter(function(e){return j(e)===u.SPS_NUT}),i=r.filter(function(e){return j(e)===u.PPS_NUT}),s=r.filter(function(e){return j(e)===u.PREFIX_SEI_NUT||j(e)===u.SUFFIX_SEI_NUT});if(0===a.length||0===i.length)return null;var o=a[0],c=new(0,m.Bitstream)(k(o));c.skipBits(16),c.readBits(4);var l=c.readBits(3),d=c.readBits(1),h=C(c,l),p=h.general_profile_space,b=h.general_tier_flag,_=h.general_profile_idc,y=h.general_profile_compatibility_flags,S=h.general_constraint_indicator_flags,w=h.general_level_idc;(0,m.readExpGolomb)(c);var T=(0,m.readExpGolomb)(c);3===T&&c.skipBits(1),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),c.readBits(1)&&((0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c));var x=(0,m.readExpGolomb)(c),I=(0,m.readExpGolomb)(c);(0,m.readExpGolomb)(c);for(var E=c.readBits(1)?0:l,P=E;P<=l;P++)(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c);(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),c.readBits(1)&&c.readBits(1)&&A(c),c.skipBits(1),c.skipBits(1),c.readBits(1)&&(c.skipBits(4),c.skipBits(4),(0,m.readExpGolomb)(c),(0,m.readExpGolomb)(c),c.skipBits(1));var M=(0,m.readExpGolomb)(c);if(B(c,M),c.readBits(1))for(var F=(0,m.readExpGolomb)(c),R=0;R<F;R++)(0,m.readExpGolomb)(c),c.skipBits(1);c.skipBits(1),c.skipBits(1);var U=0;c.readBits(1)&&(U=D(c,l));var O=0;if(i.length>0){var L=i[0],N=new(0,m.Bitstream)(k(L));N.skipBits(16),(0,m.readExpGolomb)(N),(0,m.readExpGolomb)(N),N.skipBits(1),N.skipBits(1),N.skipBits(3),N.skipBits(1),N.skipBits(1),(0,m.readExpGolomb)(N),(0,m.readExpGolomb)(N),(0,m.readSignedExpGolomb)(N),N.skipBits(1),N.skipBits(1),N.readBits(1)&&(0,m.readExpGolomb)(N),(0,m.readSignedExpGolomb)(N),(0,m.readSignedExpGolomb)(N),N.skipBits(1),N.skipBits(1),N.skipBits(1),N.skipBits(1);var V=N.readBits(1),z=N.readBits(1);O=V||z?V&&!z?2:!V&&z?3:0:0}var H=(0,f._)(n.length?[{arrayCompleteness:1,nalUnitType:u.VPS_NUT,nalUnits:n}]:[]).concat((0,f._)(a.length?[{arrayCompleteness:1,nalUnitType:u.SPS_NUT,nalUnits:a}]:[]),(0,f._)(i.length?[{arrayCompleteness:1,nalUnitType:u.PPS_NUT,nalUnits:i}]:[]),(0,f._)(s.length?[{arrayCompleteness:1,nalUnitType:j(s[0]),nalUnits:s}]:[]));return{configurationVersion:1,generalProfileSpace:p,generalTierFlag:b,generalProfileIdc:_,generalProfileCompatibilityFlags:y,generalConstraintIndicatorFlags:S,generalLevelIdc:w,minSpatialSegmentationIdc:U,parallelismType:O,chromaFormatIdc:T,bitDepthLumaMinus8:x,bitDepthChromaMinus8:I,avgFrameRate:0,constantFrameRate:0,numTemporalLayers:l+1,temporalIdNested:d,lengthSizeMinusOne:3,arrays:H}}catch(e){return console.error("Error building HEVC Decoder Configuration Record:",e),null}},C=function(e,r){for(var n=e.readBits(2),a=e.readBits(1),i=e.readBits(5),s=0,o=0;o<32;o++)s=s<<1|e.readBits(1);for(var c=new Uint8Array(6),u=0;u<6;u++)c[u]=e.readBits(8);for(var l=e.readBits(8),d=[],f=[],h=0;h<r;h++)d.push(e.readBits(1)),f.push(e.readBits(1));if(r>0)for(var p=r;p<8;p++)e.skipBits(2);for(var m=0;m<r;m++)d[m]&&e.skipBits(88),f[m]&&e.skipBits(8);return{general_profile_space:n,general_tier_flag:a,general_profile_idc:i,general_profile_compatibility_flags:s,general_constraint_indicator_flags:c,general_level_idc:l}},A=function(e){for(var r=0;r<4;r++)for(var n=0;n<(3===r?2:6);n++)if(e.readBits(1)){var a=Math.min(64,1<<4+(r<<1));r>1&&(0,m.readSignedExpGolomb)(e);for(var i=0;i<a;i++)(0,m.readSignedExpGolomb)(e)}else(0,m.readExpGolomb)(e)},B=function(e,r){for(var n=[],a=0;a<r;a++)n[a]=M(e,a,r,n)},M=function(e,r,n,a){var i,s=0,o=0,c=0;if(0!==r&&(o=e.readBits(1)),o){c=r===n?r-((0,m.readExpGolomb)(e)+1):r-1,e.readBits(1),(0,m.readExpGolomb)(e);for(var u=null!=(i=a[c])?i:0,l=0;l<=u;l++)e.readBits(1)||e.readBits(1);s=a[c]}else{for(var d=(0,m.readExpGolomb)(e),f=(0,m.readExpGolomb)(e),h=0;h<d;h++)(0,m.readExpGolomb)(e),e.readBits(1);for(var p=0;p<f;p++)(0,m.readExpGolomb)(e),e.readBits(1);s=d+f}return s},D=function(e,r){if(e.readBits(1)&&255===e.readBits(8)&&(e.readBits(16),e.readBits(16)),e.readBits(1)&&e.readBits(1),e.readBits(1)&&(e.readBits(3),e.readBits(1),e.readBits(1)&&(e.readBits(8),e.readBits(8),e.readBits(8))),e.readBits(1)&&((0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e)),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(1)&&((0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e)),e.readBits(1)&&(e.readBits(32),e.readBits(32),e.readBits(1)&&(0,m.readExpGolomb)(e),e.readBits(1)&&F(e,!0,r)),e.readBits(1)){e.readBits(1),e.readBits(1),e.readBits(1);var n=(0,m.readExpGolomb)(e);return(0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e),n}return 0},F=function(e,r,n){var a=!1,i=!1,s=!1;r&&(a=1===e.readBits(1),i=1===e.readBits(1),(a||i)&&((s=1===e.readBits(1))&&(e.readBits(8),e.readBits(5),e.readBits(1),e.readBits(5)),e.readBits(4),e.readBits(4),s&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)));for(var o=0;o<=n;o++){var c=1===e.readBits(1),u=!0;c||(u=1===e.readBits(1));var l=!1;u?(0,m.readExpGolomb)(e):l=1===e.readBits(1);var d=1;l||(d=(0,m.readExpGolomb)(e)+1),a&&R(e,d,s),i&&R(e,d,s)}},R=function(e,r,n){for(var a=0;a<r;a++)(0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e),n&&((0,m.readExpGolomb)(e),(0,m.readExpGolomb)(e)),e.readBits(1)},U=function(e){var r=[];r.push(e.configurationVersion),r.push((3&e.generalProfileSpace)<<6|(1&e.generalTierFlag)<<5|31&e.generalProfileIdc),r.push(e.generalProfileCompatibilityFlags>>>24&255),r.push(e.generalProfileCompatibilityFlags>>>16&255),r.push(e.generalProfileCompatibilityFlags>>>8&255),r.push(255&e.generalProfileCompatibilityFlags),r.push.apply(r,(0,f._)(e.generalConstraintIndicatorFlags)),r.push(255&e.generalLevelIdc),r.push(240|e.minSpatialSegmentationIdc>>8&15),r.push(255&e.minSpatialSegmentationIdc),r.push(252|3&e.parallelismType),r.push(252|3&e.chromaFormatIdc),r.push(248|7&e.bitDepthLumaMinus8),r.push(248|7&e.bitDepthChromaMinus8),r.push(e.avgFrameRate>>8&255),r.push(255&e.avgFrameRate),r.push((3&e.constantFrameRate)<<6|(7&e.numTemporalLayers)<<3|(1&e.temporalIdNested)<<2|3&e.lengthSizeMinusOne),r.push(255&e.arrays.length);var n=!0,a=!1,i=void 0;try{for(var s,o=e.arrays[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var c=s.value;r.push((1&c.arrayCompleteness)<<7|63&c.nalUnitType),r.push(c.nalUnits.length>>8&255),r.push(255&c.nalUnits.length);var u=!0,l=!1,d=void 0;try{for(var h,p=c.nalUnits[Symbol.iterator]();!(u=(h=p.next()).done);u=!0){var m=h.value;r.push(m.length>>8&255),r.push(255&m.length);for(var g=0;g<m.length;g++)r.push(m[g])}}catch(e){l=!0,d=e}finally{try{u||null==p.return||p.return()}finally{if(l)throw d}}}}catch(e){a=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}return new Uint8Array(r)},O=function(e){var r=new(0,m.Bitstream)(e);if(2!==r.readBits(2))return null;var n=r.readBits(1),a=(r.readBits(1)<<1)+n;if(3===a&&r.skipBits(1),1===r.readBits(1)||0!==r.readBits(1)||(r.skipBits(2),4817730!==r.readBits(24)))return null;var i=8;a>=2&&(i=r.readBits(1)?12:10);var s=r.readBits(3),o=0,c=0;if(7!==s)if(c=r.readBits(1),1===a||3===a){var u=r.readBits(1),l=r.readBits(1);o=u||l?u&&!l?2:1:3,r.skipBits(1)}else o=1;else o=3,c=1;var d=(r.readBits(16)+1)*(r.readBits(16)+1),f=(0,m.last)(p.VP9_LEVEL_TABLE).level,h=!0,g=!1,b=void 0;try{for(var k,_=p.VP9_LEVEL_TABLE[Symbol.iterator]();!(h=(k=_.next()).done);h=!0){var y=k.value;if(d<=y.maxPictureSize){f=y.level;break}}}catch(e){g=!0,b=e}finally{try{h||null==_.return||_.return()}finally{if(g)throw b}}return{profile:a,level:f,bitDepth:i,chromaSubsampling:o,videoFullRangeFlag:c,colourPrimaries:2===s?1:1===s?6:2,transferCharacteristics:2===s?1:1===s?6:2,matrixCoefficients:7===s?0:2===s?1:1===s?6:2}},L=function(e){var r,n,a,i,s,o,c;return(0,h._)(this,function(u){switch(u.label){case 0:r=new(0,m.Bitstream)(e),n=function(){for(var e=0,n=0;n<8;n++){var a=r.readAlignedByte();if(e|=(127&a)<<7*n,!(128&a))break;if(7===n&&128&a)return null}return e>=0xffffffff?null:e},u.label=1;case 1:if(!(r.getBitsLeft()>=8))return[3,3];if(r.skipBits(1),a=r.readBits(4),i=r.readBits(1),s=r.readBits(1),r.skipBits(1),i&&r.skipBits(8),o=void 0,s){if(null===(c=n()))return[2];o=c}else o=Math.floor(r.getBitsLeft()/8);return(0,m.assert)(r.pos%8==0),[4,{type:a,data:e.subarray(r.pos/8,r.pos/8+o)}];case 2:return u.sent(),r.skipBits(8*o),[3,1];case 3:return[2]}})},N=function(e){var r=!0,n=!1,a=void 0;try{for(var i,s=L(e)[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var o=i.value,c=o.type,u=o.data;if(1===c){var l=new(0,m.Bitstream)(u),d=l.readBits(3);l.readBits(1);var f=l.readBits(1),h=0,p=0,g=0;if(f)h=l.readBits(5);else{if(l.readBits(1)&&(l.skipBits(32),l.skipBits(32),l.readBits(1)))return null;var b=l.readBits(1);b&&(g=l.readBits(5),l.skipBits(32),l.skipBits(5),l.skipBits(5));for(var k=l.readBits(5),_=0;_<=k;_++){l.skipBits(12);var y=l.readBits(5);if(0===_&&(h=y),y>7){var S=l.readBits(1);0===_&&(p=S)}if(b&&l.readBits(1)){var w=g+1;l.skipBits(w),l.skipBits(w),l.skipBits(1)}l.readBits(1)&&l.skipBits(4)}}var T=l.readBits(4),x=l.readBits(4),I=T+1;l.skipBits(I);var E=x+1;l.skipBits(E);if((f?0:l.readBits(1))&&(l.skipBits(4),l.skipBits(3)),l.skipBits(1),l.skipBits(1),l.skipBits(1),!f){l.skipBits(1),l.skipBits(1),l.skipBits(1),l.skipBits(1);var j=l.readBits(1);j&&(l.skipBits(1),l.skipBits(1));var P=l.readBits(1);(P?2:l.readBits(1))>0&&(l.readBits(1)||l.skipBits(1)),j&&l.skipBits(3)}l.skipBits(1),l.skipBits(1),l.skipBits(1);var C=l.readBits(1),A=8;2===d&&C?A=l.readBits(1)?12:10:d<=2&&(A=C?10:8);var B=0;1!==d&&(B=l.readBits(1));var M=1,D=1,F=0;return!B&&(0===d?(M=1,D=1):1===d?(M=0,D=0):12===A&&(M=l.readBits(1))&&(D=l.readBits(1)),M&&D&&(F=l.readBits(2))),{profile:d,level:h,tier:p,bitDepth:A,monochrome:B,chromaSubsamplingX:M,chromaSubsamplingY:D,chromaSamplePosition:F}}}}catch(e){n=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(n)throw a}}return null},V=function(e){var r=(0,m.toDataView)(e),n=r.getUint8(9),a=r.getUint16(10,!0),i=r.getUint32(12,!0),s=r.getInt16(16,!0),o=r.getUint8(18),c=null;return o&&(c=e.subarray(19,21+n)),{outputChannelCount:n,preSkip:a,inputSampleRate:i,outputGain:s,channelMappingFamily:o,channelMappingTable:c}},z=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960],H=function(e){return{durationInSamples:z[e[0]>>3]}},G=function(e){if(e.length<7)throw Error("Setup header is too short.");if(5!==e[0])throw Error("Wrong packet type in Setup header.");if("vorbis"!==(r=String).fromCharCode.apply(r,(0,f._)(e.slice(1,7))))throw Error("Invalid packet signature in Setup header.");for(var r,n=e.length,a=new Uint8Array(n),i=0;i<n;i++)a[i]=e[n-1-i];for(var s=new(0,m.Bitstream)(a),o=0;s.getBitsLeft()>97;)if(1===s.readBits(1)){o=s.pos;break}if(0===o)throw Error("Invalid Setup header: framing bit not found.");for(var c=0,u=!1,l=0;s.getBitsLeft()>=97;){var d=s.pos,h=s.readBits(8),p=s.readBits(16),g=s.readBits(16);if(h>63||0!==p||0!==g){s.pos=d;break}if(s.skipBits(1),++c>64)break;s.clone().readBits(6)+1===c&&(u=!0,l=c)}if(!u)throw Error("Invalid Setup header: mode header not found.");if(l>63)throw Error("Unsupported mode count: ".concat(l,"."));var b=l;s.pos=0,s.skipBits(o);for(var k=Array(b).fill(0),_=b-1;_>=0;_--)s.skipBits(40),k[_]=s.readBits(1);return{modeBlockflags:k}},q=function(e,r,n){switch(e){case"avc":var a=y(n,r),i=a.some(function(e){return S(e)===c.IDR}),s=!0,o=!1,l=void 0;if(!i&&(!(0,m.isChromium)()||(0,m.getChromiumVersion)()>=144))try{for(var d,f=a[Symbol.iterator]();!(s=(d=f.next()).done);s=!0){var h=d.value;if(S(h)===c.SEI){var p=k(h),g=1;do{for(var b=0;;){var _=p[g++];if(void 0===_||(b+=_,_<255))break}for(var w=0;;){var T=p[g++];if(void 0===T||(w+=T,T<255))break}if(6===b){var x=new(0,m.Bitstream)(p);x.pos=8*g;var I=(0,m.readExpGolomb)(x),P=x.readBits(1);if(0===I&&1===P){i=!0;break}}g+=w}while(g<p.length-1)}}}catch(e){o=!0,l=e}finally{try{s||null==f.return||f.return()}finally{if(o)throw l}}return i?"key":"delta";case"hevc":return E(n,r).some(function(e){var r=j(e);return u.BLA_W_LP<=r&&r<=u.RSV_IRAP_VCL23})?"key":"delta";case"vp8":return 0==(1&n[0])?"key":"delta";case"vp9":var C=new(0,m.Bitstream)(n);if(2!==C.readBits(2))return null;var A=C.readBits(1);if(3===(C.readBits(1)<<1)+A&&C.skipBits(1),C.readBits(1))return null;return 0===C.readBits(1)?"key":"delta";case"av1":var B=!1,M=!0,D=!1,F=void 0;try{for(var R,U=L(n)[Symbol.iterator]();!(M=(R=U.next()).done);M=!0){var O=R.value,N=O.type,V=O.data;if(1===N){var z=new(0,m.Bitstream)(V);z.skipBits(4),B=!!z.readBits(1)}else if(3===N||6===N||7===N){if(B)return"key";var H=new(0,m.Bitstream)(V);if(H.readBits(1))return null;var G=H.readBits(2);return 0===G?"key":"delta"}}}catch(e){D=!0,F=e}finally{try{M||null==U.return||U.return()}finally{if(D)throw F}}return null;default:(0,m.assertNever)(e),(0,m.assert)(!1)}};(o=l||(l={}))[o.STREAMINFO=0]="STREAMINFO",o[o.VORBIS_COMMENT=4]="VORBIS_COMMENT",o[o.PICTURE=6]="PICTURE";var W=function(e,r){var n=(0,m.toDataView)(e),a=0,i=n.getUint32(a,!0);a+=4;var s=m.textDecoder.decode(e.subarray(a,a+i));a+=i,i>0&&(null!=r.raw||(r.raw={}),null!=(g=r.raw)[b="vendor"]||(g[b]=s));var o=n.getUint32(a,!0);a+=4;for(var c=0;c<o;c++){var u=n.getUint32(a,!0);a+=4;var l=m.textDecoder.decode(e.subarray(a,a+u));a+=u;var d=l.indexOf("=");if(-1!==d){var h=l.slice(0,d).toUpperCase(),p=l.slice(d+1);switch(null!=r.raw||(r.raw={}),null!=(k=r.raw)[h]||(k[h]=p),h){case"TITLE":null!=r.title||(r.title=p);break;case"DESCRIPTION":null!=r.description||(r.description=p);break;case"ARTIST":null!=r.artist||(r.artist=p);break;case"ALBUM":null!=r.album||(r.album=p);break;case"ALBUMARTIST":null!=r.albumArtist||(r.albumArtist=p);break;case"COMMENT":null!=r.comment||(r.comment=p);break;case"LYRICS":null!=r.lyrics||(r.lyrics=p);break;case"TRACKNUMBER":var g,b,k,_=p.split("/"),y=Number.parseInt(_[0],10),S=_[1]&&Number.parseInt(_[1],10);Number.isInteger(y)&&y>0&&(null!=r.trackNumber||(r.trackNumber=y)),S&&Number.isInteger(S)&&S>0&&(null!=r.tracksTotal||(r.tracksTotal=S));break;case"TRACKTOTAL":var w=Number.parseInt(p,10);Number.isInteger(w)&&w>0&&(null!=r.tracksTotal||(r.tracksTotal=w));break;case"DISCNUMBER":var T=p.split("/"),x=Number.parseInt(T[0],10),I=T[1]&&Number.parseInt(T[1],10);Number.isInteger(x)&&x>0&&(null!=r.discNumber||(r.discNumber=x)),I&&Number.isInteger(I)&&I>0&&(null!=r.discsTotal||(r.discsTotal=I));break;case"DISCTOTAL":var E=Number.parseInt(p,10);Number.isInteger(E)&&E>0&&(null!=r.discsTotal||(r.discsTotal=E));break;case"DATE":var j=new Date(p);Number.isNaN(j.getTime())||null!=r.date||(r.date=j);break;case"GENRE":null!=r.genre||(r.genre=p);break;case"METADATA_BLOCK_PICTURE":var P,C=(0,m.base64ToBytes)(p),A=(0,m.toDataView)(C),B=A.getUint32(0,!1),M=A.getUint32(4,!1),D=(P=String).fromCharCode.apply(P,(0,f._)(C.subarray(8,8+M))),F=A.getUint32(8+M,!1),R=m.textDecoder.decode(C.subarray(12+M,12+M+F)),U=A.getUint32(M+F+28),O=C.subarray(M+F+32,M+F+32+U);null!=r.images||(r.images=[]),r.images.push({data:O,mimeType:D,kind:3===B?"coverFront":4===B?"coverBack":"unknown",name:void 0,description:R||void 0})}}}},K=function(e,r,n){var a=[e],i=m.textEncoder.encode("Mediabunny"),s=new Uint8Array(4+i.length),o=new DataView(s.buffer);o.setUint32(0,i.length,!0),s.set(i,4),a.push(s);var c=new Set,u=function(e,r){var n="".concat(e,"=").concat(r),i=m.textEncoder.encode(n);(o=new DataView((s=new Uint8Array(4+i.length)).buffer)).setUint32(0,i.length,!0),s.set(i,4),a.push(s),c.add(e)},l=!0,d=!1,f=void 0;try{for(var h,p=(0,m.keyValueIterator)(r)[Symbol.iterator]();!(l=(h=p.next()).done);l=!0){var g=h.value,b=g.key,k=g.value;switch(b){case"title":u("TITLE",k);break;case"description":u("DESCRIPTION",k);break;case"artist":u("ARTIST",k);break;case"album":u("ALBUM",k);break;case"albumArtist":u("ALBUMARTIST",k);break;case"genre":u("GENRE",k);break;case"date":var _,y,S,w=null!=(S=null==(_=r.raw)?void 0:_.DATE)?S:null==(y=r.raw)?void 0:y.date;u("DATE",w&&"string"==typeof w?w:k.toISOString().slice(0,10));break;case"comment":u("COMMENT",k);break;case"lyrics":u("LYRICS",k);break;case"trackNumber":u("TRACKNUMBER",k.toString());break;case"tracksTotal":u("TRACKTOTAL",k.toString());break;case"discNumber":u("DISCNUMBER",k.toString());break;case"discsTotal":u("DISCTOTAL",k.toString());break;case"images":if(!n)break;var T=!0,x=!1,I=void 0;try{for(var E,j=k[Symbol.iterator]();!(T=(E=j.next()).done);T=!0){for(var P,C=E.value,A="coverFront"===C.kind?3:4*("coverBack"===C.kind),B=new Uint8Array(C.mimeType.length),M=0;M<C.mimeType.length;M++)B[M]=C.mimeType.charCodeAt(M);var D=m.textEncoder.encode(null!=(P=C.description)?P:""),F=new Uint8Array(8+B.length+4+D.length+16+4+C.data.length),R=(0,m.toDataView)(F);R.setUint32(0,A,!1),R.setUint32(4,B.length,!1),F.set(B,8),R.setUint32(8+B.length,D.length,!1),F.set(D,12+B.length),R.setUint32(28+B.length+D.length,C.data.length,!1),F.set(C.data,32+B.length+D.length);var U=(0,m.bytesToBase64)(F);u("METADATA_BLOCK_PICTURE",U)}}catch(e){x=!0,I=e}finally{try{T||null==j.return||j.return()}finally{if(x)throw I}}break;case"raw":break;default:(0,m.assertNever)(b)}}}catch(e){d=!0,f=e}finally{try{l||null==p.return||p.return()}finally{if(d)throw f}}if(r.raw)for(var O in r.raw){var L,N=null!=(L=r.raw[O])?L:r.raw[O.toLowerCase()];"vendor"===O||null==N||c.has(O)||"string"==typeof N&&u(O,N)}var V=new Uint8Array(4);(0,m.toDataView)(V).setUint32(0,c.size,!0),a.splice(2,0,V);var z=new Uint8Array(a.reduce(function(e,r){return e+r.length},0)),H=0,G=!0,q=!1,W=void 0;try{for(var K,X=a[Symbol.iterator]();!(G=(K=X.next()).done);G=!0){var Q=K.value;z.set(Q,H),H+=Q.length}}catch(e){q=!0,W=e}finally{try{G||null==X.return||X.return()}finally{if(q)throw W}}return z}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./codec.js":"fXWqW","./misc.js":"j7iGm","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],d4thC:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"Demuxer",function(){return o});var s=e("@swc/helpers/cjs/_class_call_check.cjs"),o=function e(r){"use strict";(0,s._)(this,e),this.input=r}},{"@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],b22CJ:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"InputTrack",function(){return k}),i.export(n,"InputVideoTrack",function(){return _}),i.export(n,"InputAudioTrack",function(){return y});var s=e("@swc/helpers/cjs/_async_iterator.cjs"),o=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_call_super.cjs"),u=e("@swc/helpers/cjs/_class_call_check.cjs"),l=e("@swc/helpers/cjs/_create_class.cjs"),d=e("@swc/helpers/cjs/_inherits.cjs"),f=e("@swc/helpers/cjs/_ts_generator.cjs"),h=e("./codec-data.js"),p=e("./custom-coder.js"),m=e("./media-sink.js"),g=e("./misc.js"),b=e("./packet.js"),k=function(){"use strict";function e(r,n){(0,u._)(this,e),this.input=r,this._backing=n}return(0,l._)(e,[{key:"isVideoTrack",value:function(){return this instanceof _}},{key:"isAudioTrack",value:function(){return this instanceof y}},{key:"id",get:function(){return this._backing.getId()}},{key:"internalCodecId",get:function(){return this._backing.getInternalCodecId()}},{key:"languageCode",get:function(){return this._backing.getLanguageCode()}},{key:"name",get:function(){return this._backing.getName()}},{key:"timeResolution",get:function(){return this._backing.getTimeResolution()}},{key:"disposition",get:function(){return this._backing.getDisposition()}},{key:"getFirstTimestamp",value:function(){return this._backing.getFirstTimestamp()}},{key:"computeDuration",value:function(){return this._backing.computeDuration()}},{key:"computePacketStats",value:function(){return(0,o._)(function(){var e,r,n,a,i,o,c,u,l,d,h,p,g,b=arguments;return(0,f._)(this,function(f){switch(f.label){case 0:e=b.length>0&&void 0!==b[0]?b[0]:1/0,r=new(0,m.EncodedPacketSink)(this),n=1/0,a=-1/0,i=0,o=0,c=!1,u=!1,f.label=1;case 1:f.trys.push([1,6,7,12]),d=(0,s._)(r.packets(void 0,void 0,{metadataOnly:!0})),f.label=2;case 2:return[4,d.next()];case 3:if(!(c=!(h=f.sent()).done)||(p=h.value,i>=e&&p.timestamp>=a))return[3,5];n=Math.min(n,p.timestamp),a=Math.max(a,p.timestamp+p.duration),i++,o+=p.byteLength,f.label=4;case 4:return c=!1,[3,2];case 5:return[3,12];case 6:return g=f.sent(),u=!0,l=g,[3,12];case 7:if(f.trys.push([7,,10,11]),!(c&&null!=d.return))return[3,9];return[4,d.return()];case 8:f.sent(),f.label=9;case 9:return[3,11];case 10:if(u)throw l;return[7];case 11:return[7];case 12:return[2,{packetCount:i,averagePacketRate:i?Number((i/(a-n)).toPrecision(16)):0,averageBitrate:i?Number((8*o/(a-n)).toPrecision(16)):0}]}})}).apply(this,arguments)}}]),e}(),_=function(e){"use strict";function r(e,n){var a;return(0,u._)(this,r),(a=(0,c._)(this,r,[e,n]))._backing=n,a}return(0,d._)(r,e),(0,l._)(r,[{key:"type",get:function(){return"video"}},{key:"codec",get:function(){return this._backing.getCodec()}},{key:"codedWidth",get:function(){return this._backing.getCodedWidth()}},{key:"codedHeight",get:function(){return this._backing.getCodedHeight()}},{key:"rotation",get:function(){return this._backing.getRotation()}},{key:"displayWidth",get:function(){return this._backing.getRotation()%180==0?this._backing.getCodedWidth():this._backing.getCodedHeight()}},{key:"displayHeight",get:function(){return this._backing.getRotation()%180==0?this._backing.getCodedHeight():this._backing.getCodedWidth()}},{key:"getColorSpace",value:function(){return this._backing.getColorSpace()}},{key:"hasHighDynamicRange",value:function(){return(0,o._)(function(){var e;return(0,f._)(this,function(r){switch(r.label){case 0:return[4,this._backing.getColorSpace()];case 1:return[2,"bt2020"===(e=r.sent()).primaries||"smpte432"===e.primaries||"pg"===e.transfer||"hlg"===e.transfer||"bt2020-ncl"===e.matrix]}})}).call(this)}},{key:"canBeTransparent",value:function(){return this._backing.canBeTransparent()}},{key:"getDecoderConfig",value:function(){return this._backing.getDecoderConfig()}},{key:"getCodecParameterString",value:function(){return(0,o._)(function(){var e,r;return(0,f._)(this,function(n){switch(n.label){case 0:return[4,this._backing.getDecoderConfig()];case 1:return[2,null!=(r=null==(e=n.sent())?void 0:e.codec)?r:null]}})}).call(this)}},{key:"canDecode",value:function(){return(0,o._)(function(){var e,r;return(0,f._)(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this._backing.getDecoderConfig()];case 1:if(!(e=n.sent()))return[2,!1];if(r=this._backing.getCodec(),(0,g.assert)(null!==r),p.customVideoDecoders.some(function(n){return n.supports(r,e)}))return[2,!0];if("undefined"==typeof VideoDecoder)return[2,!1];return[4,VideoDecoder.isConfigSupported(e)];case 2:return[2,!0===n.sent().supported];case 3:return console.error("Error during decodability check:",n.sent()),[2,!1];case 4:return[2]}})}).call(this)}},{key:"determinePacketType",value:function(e){return(0,o._)(function(){var r;return(0,f._)(this,function(n){switch(n.label){case 0:if(!(e instanceof b.EncodedPacket))throw TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return[2,null];return[4,this.getDecoderConfig()];case 1:return r=n.sent(),(0,g.assert)(r),[2,(0,h.determineVideoPacketType)(this.codec,r,e.data)]}})}).call(this)}}]),r}(k),y=function(e){"use strict";function r(e,n){var a;return(0,u._)(this,r),(a=(0,c._)(this,r,[e,n]))._backing=n,a}return(0,d._)(r,e),(0,l._)(r,[{key:"type",get:function(){return"audio"}},{key:"codec",get:function(){return this._backing.getCodec()}},{key:"numberOfChannels",get:function(){return this._backing.getNumberOfChannels()}},{key:"sampleRate",get:function(){return this._backing.getSampleRate()}},{key:"getDecoderConfig",value:function(){return this._backing.getDecoderConfig()}},{key:"getCodecParameterString",value:function(){return(0,o._)(function(){var e,r;return(0,f._)(this,function(n){switch(n.label){case 0:return[4,this._backing.getDecoderConfig()];case 1:return[2,null!=(r=null==(e=n.sent())?void 0:e.codec)?r:null]}})}).call(this)}},{key:"canDecode",value:function(){return(0,o._)(function(){var e,r;return(0,f._)(this,function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),[4,this._backing.getDecoderConfig()];case 1:if(!(e=n.sent()))return[2,!1];if(r=this._backing.getCodec(),(0,g.assert)(null!==r),p.customAudioDecoders.some(function(n){return n.supports(r,e)}))return[2,!0];if(!e.codec.startsWith("pcm-"))return[3,2];return[2,!0];case 2:if("undefined"==typeof AudioDecoder)return[2,!1];return[4,AudioDecoder.isConfigSupported(e)];case 3:return[2,!0===n.sent().supported];case 4:return[3,6];case 5:return console.error("Error during decodability check:",n.sent()),[2,!1];case 6:return[2]}})}).call(this)}},{key:"determinePacketType",value:function(e){return(0,o._)(function(){return(0,f._)(this,function(r){if(!(e instanceof b.EncodedPacket))throw TypeError("packet must be an EncodedPacket.");return null===this.codec?[2,null]:[2,"key"]})}).call(this)}}]),r}(k)},{"@swc/helpers/cjs/_async_iterator.cjs":"f3IhJ","@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./codec-data.js":"kWTYV","./custom-coder.js":"hAl48","./media-sink.js":"k0V9R","./misc.js":"j7iGm","./packet.js":"QfqGG","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],hAl48:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"CustomVideoDecoder",function(){return c}),i.export(n,"CustomAudioDecoder",function(){return u}),i.export(n,"CustomVideoEncoder",function(){return l}),i.export(n,"CustomAudioEncoder",function(){return d}),i.export(n,"customVideoDecoders",function(){return f}),i.export(n,"customAudioDecoders",function(){return h}),i.export(n,"customVideoEncoders",function(){return p}),i.export(n,"customAudioEncoders",function(){return m}),i.export(n,"registerDecoder",function(){return g}),i.export(n,"registerEncoder",function(){return b});var s=e("@swc/helpers/cjs/_class_call_check.cjs"),o=e("@swc/helpers/cjs/_create_class.cjs"),c=function(){"use strict";function e(){(0,s._)(this,e)}return(0,o._)(e,null,[{key:"supports",value:function(e,r){return!1}}]),e}(),u=function(){"use strict";function e(){(0,s._)(this,e)}return(0,o._)(e,null,[{key:"supports",value:function(e,r){return!1}}]),e}(),l=function(){"use strict";function e(){(0,s._)(this,e)}return(0,o._)(e,null,[{key:"supports",value:function(e,r){return!1}}]),e}(),d=function(){"use strict";function e(){(0,s._)(this,e)}return(0,o._)(e,null,[{key:"supports",value:function(e,r){return!1}}]),e}(),f=[],h=[],p=[],m=[],g=function(e){if(e.prototype instanceof c){if(f.includes(e))return void console.warn("Video decoder already registered.");f.push(e)}else if(e.prototype instanceof u){if(h.includes(e))return void console.warn("Audio decoder already registered.");h.push(e)}else throw TypeError("Decoder must be a CustomVideoDecoder or CustomAudioDecoder.")},b=function(e){if(e.prototype instanceof l){if(p.includes(e))return void console.warn("Video encoder already registered.");p.push(e)}else if(e.prototype instanceof d){if(m.includes(e))return void console.warn("Audio encoder already registered.");m.push(e)}else throw TypeError("Encoder must be a CustomVideoEncoder or CustomAudioEncoder.")}},{"@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],k0V9R:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"EncodedPacketSink",function(){return A}),i.export(n,"BaseMediaSampleSink",function(){return M}),i.export(n,"VideoSampleSink",function(){return U}),i.export(n,"CanvasSink",function(){return O}),i.export(n,"AudioSampleSink",function(){return V}),i.export(n,"AudioBufferSink",function(){return z});var s=e("@swc/helpers/cjs/_async_iterator.cjs"),o=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_call_super.cjs"),u=e("@swc/helpers/cjs/_class_call_check.cjs"),l=e("@swc/helpers/cjs/_create_class.cjs"),d=e("@swc/helpers/cjs/_define_property.cjs"),f=e("@swc/helpers/cjs/_inherits.cjs"),h=e("@swc/helpers/cjs/_object_spread.cjs"),p=e("@swc/helpers/cjs/_object_spread_props.cjs"),m=e("@swc/helpers/cjs/_sliced_to_array.cjs"),g=e("@swc/helpers/cjs/_type_of.cjs"),b=e("@swc/helpers/cjs/_ts_generator.cjs"),k=e("./codec.js"),_=e("./codec-data.js"),y=e("./custom-coder.js"),S=e("./input.js"),w=e("./input-track.js"),T=e("./misc.js"),x=e("./packet.js"),I=e("./pcm.js"),E=e("./sample.js"),j=function(e){if(!e||(void 0===e?"undefined":(0,g._)(e))!=="object")throw TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},P=function(e){if(!(0,T.isNumber)(e))throw TypeError("timestamp must be a number.")},C=function(e,r,n){return n.verifyKeyPackets?r.then(function(r){return(0,o._)(function(){var n;return(0,b._)(this,function(a){switch(a.label){case 0:if(!r||"delta"===r.type)return[2,r];return[4,e.determinePacketType(r)];case 1:return(n=a.sent())&&(r.type=n),[2,r]}})})()}):r},A=function(){"use strict";function e(r){if((0,u._)(this,e),!(r instanceof w.InputTrack))throw TypeError("track must be an InputTrack.");this._track=r}return(0,l._)(e,[{key:"getFirstPacket",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(j(e),this._track.input._disposed)throw new(0,S.InputDisposedError);return C(this._track,this._track._backing.getFirstPacket(e),e)}},{key:"getPacket",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(P(e),j(r),this._track.input._disposed)throw new(0,S.InputDisposedError);return C(this._track,this._track._backing.getPacket(e,r),r)}},{key:"getNextPacket",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e instanceof x.EncodedPacket))throw TypeError("packet must be an EncodedPacket.");if(j(r),this._track.input._disposed)throw new(0,S.InputDisposedError);return C(this._track,this._track._backing.getNextPacket(e,r),r)}},{key:"getKeyPacket",value:function(e){return(0,o._)(function(e){var r,n,a=arguments;return(0,b._)(this,function(i){switch(i.label){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:{},P(e),j(r),this._track.input._disposed)throw new(0,S.InputDisposedError);if(!r.verifyKeyPackets)return[2,this._track._backing.getKeyPacket(e,r)];return[4,this._track._backing.getKeyPacket(e,r)];case 1:if(!(n=i.sent()))return[2,n];return(0,T.assert)("key"===n.type),[4,this._track.determinePacketType(n)];case 2:if("delta"===i.sent())return[2,this.getKeyPacket(n.timestamp-1/this._track.timeResolution,r)];return[2,n]}})}).apply(this,arguments)}},{key:"getNextKeyPacket",value:function(e){return(0,o._)(function(e){var r,n,a=arguments;return(0,b._)(this,function(i){switch(i.label){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:{},!(e instanceof x.EncodedPacket))throw TypeError("packet must be an EncodedPacket.");if(j(r),this._track.input._disposed)throw new(0,S.InputDisposedError);if(!r.verifyKeyPackets)return[2,this._track._backing.getNextKeyPacket(e,r)];return[4,this._track._backing.getNextKeyPacket(e,r)];case 1:if(!(n=i.sent()))return[2,n];return(0,T.assert)("key"===n.type),[4,this._track.determinePacketType(n)];case 2:if("delta"===i.sent())return[2,this.getNextKeyPacket(n,r)];return[2,n]}})}).apply(this,arguments)}},{key:"packets",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(void 0!==e&&!(e instanceof x.EncodedPacket))throw TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&!(null==n?void 0:n.metadataOnly))throw TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==r&&!(r instanceof x.EncodedPacket))throw TypeError("endPacket must be an EncodedPacket.");if(j(n),this._track.input._disposed)throw new(0,S.InputDisposedError);var a=[],i=(0,T.promiseWithResolvers)(),s=i.promise,c=i.resolve,u=(0,T.promiseWithResolvers)(),l=u.promise,f=u.resolve,h=!1,p=!1,m=null,g=[];(0,o._)(function(){var i,o,u,d;return(0,b._)(this,function(m){switch(m.label){case 0:if(null==e)return[3,1];return o=e,[3,3];case 1:return[4,this.getFirstPacket(n)];case 2:o=m.sent(),m.label=3;case 3:i=o,m.label=4;case 4:if(!(i&&!p&&!this._track.input._disposed)||r&&i.sequenceNumber>=(null==r?void 0:r.sequenceNumber))return[3,8];if(!(a.length>Math.max(2,g.length)))return[3,6];return l=(u=(0,T.promiseWithResolvers)()).promise,f=u.resolve,[4,l];case 5:return m.sent(),[3,4];case 6:return a.push(i),c(),s=(d=(0,T.promiseWithResolvers)()).promise,c=d.resolve,[4,this.getNextPacket(i,n)];case 7:return i=m.sent(),[3,4];case 8:return h=!0,c(),[2]}})}).call(this).catch(function(e){m||(m=e,c())});var k=this._track;return(0,d._)({next:function(){return(0,o._)(function(){var e,r;return(0,b._)(this,function(n){switch(n.label){case 0:if(!k.input._disposed)return[3,1];throw new(0,S.InputDisposedError);case 1:if(!p)return[3,2];return[2,{value:void 0,done:!0}];case 2:if(!m)return[3,3];throw m;case 3:if(!(a.length>0))return[3,4];for(e=a.shift(),r=performance.now(),g.push(r);g.length>0&&r-g[0]>=1e3;)g.shift();return f(),[2,{value:e,done:!1}];case 4:if(!h)return[3,5];return[2,{value:void 0,done:!0}];case 5:return[4,s];case 6:n.sent(),n.label=7;case 7:return[3,0];case 8:return[2]}})})()},return:function(){return(0,o._)(function(){return(0,b._)(this,function(e){return p=!0,f(),c(),[2,{value:void 0,done:!0}]})})()},throw:function(e){return(0,o._)(function(){return(0,b._)(this,function(r){throw e})})()}},Symbol.asyncIterator,function(){return this})}}]),e}(),B=function e(r,n){"use strict";(0,u._)(this,e),this.onSample=r,this.onError=n},M=function(){"use strict";function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"mediaSamplesInRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;P(e),P(r);var n=[],a=!1,i=null,s=(0,T.promiseWithResolvers)(),c=s.promise,u=s.resolve,l=(0,T.promiseWithResolvers)(),f=l.promise,h=l.resolve,p=!1,m=!1,g=!1,k=null;(0,o._)(function(){var s,o,l,d,_,y,S,w,x,I,E,j,P,C,A,B;return(0,b._)(this,function(b){switch(b.label){case 0:return s=Error(),[4,this._createDecoder(function(s){if(h(),s.timestamp>=r&&(m=!0),m)return void s.close();if(i&&(s.timestamp>e?(n.push(i),a=!0):i.close()),s.timestamp>=e&&(n.push(s),a=!0),i=a?null:s,n.length>0){var o;u(),c=(o=(0,T.promiseWithResolvers)()).promise,u=o.resolve}},function(e){k||(e.stack=s.stack,k=e,u())})];case 1:return o=b.sent(),[4,(l=this._createPacketSink()).getKeyPacket(e,{verifyKeyPackets:!0})];case 2:if(null==(d=b.sent()))return[3,3];return y=d,[3,5];case 3:return[4,l.getFirstPacket()];case 4:y=b.sent(),b.label=5;case 5:if(S=_=y,w=void 0,!(r<1/0))return[3,12];return[4,l.getPacket(r)];case 6:if(x=b.sent())return[3,7];return E=null,[3,11];case 7:if("key"!==x.type||x.timestamp!==r)return[3,8];return j=x,[3,10];case 8:return[4,l.getNextKeyPacket(x,{verifyKeyPackets:!0})];case 9:j=b.sent(),b.label=10;case 10:E=j,b.label=11;case 11:(I=E)&&(w=I),b.label=12;case 12:return[4,(P=l.packets(null!=_?_:void 0,w)).next()];case 13:b.sent(),b.label=14;case 14:if(!(S&&!m&&!this._track.input._disposed))return[3,18];if(C=D(n.length),!(n.length+o.getDecodeQueueSize()>C))return[3,16];return f=(A=(0,T.promiseWithResolvers)()).promise,h=A.resolve,[4,f];case 15:return b.sent(),[3,14];case 16:return o.decode(S),[4,P.next()];case 17:if((B=b.sent()).done)return[3,18];return S=B.value,[3,14];case 18:return[4,P.return()];case 19:if(b.sent(),!(!g&&!this._track.input._disposed))return[3,21];return[4,o.flush()];case 20:b.sent(),b.label=21;case 21:return o.close(),!a&&i&&n.push(i),p=!0,u(),[2]}})}).call(this).catch(function(e){k||(k=e,u())});var _=this._track,y=function(){null==i||i.close();var e=!0,r=!1,a=void 0;try{for(var s,o=n[Symbol.iterator]();!(e=(s=o.next()).done);e=!0)s.value.close()}catch(e){r=!0,a=e}finally{try{e||null==o.return||o.return()}finally{if(r)throw a}}};return(0,d._)({next:function(){return(0,o._)(function(){var e;return(0,b._)(this,function(r){switch(r.label){case 0:if(!_.input._disposed)return[3,1];throw y(),new(0,S.InputDisposedError);case 1:if(!g)return[3,2];return[2,{value:void 0,done:!0}];case 2:if(!k)return[3,3];throw y(),k;case 3:if(!(n.length>0))return[3,4];return e=n.shift(),h(),[2,{value:e,done:!1}];case 4:if(p)return[3,6];return[4,c];case 5:return r.sent(),[3,7];case 6:return[2,{value:void 0,done:!0}];case 7:return[3,0];case 8:return[2]}})})()},return:function(){return(0,o._)(function(){return(0,b._)(this,function(e){return g=!0,m=!0,h(),u(),y(),[2,{value:void 0,done:!0}]})})()},throw:function(e){return(0,o._)(function(){return(0,b._)(this,function(r){throw e})})()}},Symbol.asyncIterator,function(){return this})}},{key:"mediaSamplesAtTimestamps",value:function(e){(0,T.validateAnyIterable)(e);var r=(0,T.toAsyncIterator)(e),n=[],a=[],i=(0,T.promiseWithResolvers)(),c=i.promise,u=i.resolve,l=(0,T.promiseWithResolvers)(),f=l.promise,h=l.resolve,p=!1,m=!1,g=null,k=function(e){var r;a.push(e),u(),c=(r=(0,T.promiseWithResolvers)()).promise,u=r.resolve};(0,o._)(function(){var e,i,c,l,d,_,y,S,w,x,I,E,j,C,A,B,M,F;return(0,b._)(this,function(R){switch(R.label){case 0:return e=Error(),[4,this._createDecoder(function(e){if(h(),m)return void e.close();for(var r=0;n.length>0&&e.timestamp-n[0]>-1e-10;)r++,n.shift();if(r>0)for(var a=0;a<r;a++)k(a<r-1?e.clone():e);else e.close()},function(r){g||(r.stack=e.stack,g=r,u())})];case 1:i=R.sent(),c=this._createPacketSink(),l=null,d=null,_=-1,y=function(){return(0,o._)(function(){var e,r,n,s;return(0,b._)(this,function(o){switch(o.label){case 0:(0,T.assert)(d),e=d,i.decode(e),o.label=1;case 1:if(!(e.sequenceNumber<_))return[3,6];r=D(a.length),o.label=2;case 2:if(!(a.length+i.getDecodeQueueSize()>r&&!m))return[3,4];return f=(n=(0,T.promiseWithResolvers)()).promise,h=n.resolve,[4,f];case 3:return o.sent(),[3,2];case 4:if(m)return[3,6];return[4,c.getNextPacket(e)];case 5:return s=o.sent(),(0,T.assert)(s),i.decode(s),e=s,[3,1];case 6:return _=-1,[2]}})})()},S=function(){return(0,o._)(function(){var e;return(0,b._)(this,function(r){switch(r.label){case 0:return[4,i.flush()];case 1:for(r.sent(),e=0;e<n.length;e++)k(null);return n.length=0,[2]}})})()},w=!1,x=!1,R.label=2;case 2:R.trys.push([2,17,18,23]),E=(0,s._)(r),R.label=3;case 3:return[4,E.next()];case 4:if(!(w=!(j=R.sent()).done)||(P(C=j.value),m||this._track.input._disposed))return[3,16];return[4,c.getPacket(C)];case 5:if(!(M=A=R.sent()))return[3,7];return[4,c.getKeyPacket(C,{verifyKeyPackets:!0})];case 6:M=R.sent(),R.label=7;case 7:if(B=M)return[3,11];if(-1===_)return[3,10];return[4,y()];case 8:return R.sent(),[4,S()];case 9:R.sent(),R.label=10;case 10:return k(null),l=null,[3,15];case 11:if(!(l&&(B.sequenceNumber!==d.sequenceNumber||A.timestamp<l.timestamp)))return[3,14];return[4,y()];case 12:return R.sent(),[4,S()];case 13:R.sent(),R.label=14;case 14:n.push(A.timestamp),_=Math.max(A.sequenceNumber,_),l=A,d=B,R.label=15;case 15:return w=!1,[3,3];case 16:return[3,23];case 17:return F=R.sent(),x=!0,I=F,[3,23];case 18:if(R.trys.push([18,,21,22]),!(w&&null!=E.return))return[3,20];return[4,E.return()];case 19:R.sent(),R.label=20;case 20:return[3,22];case 21:if(x)throw I;return[7];case 22:return[7];case 23:if(!(!m&&!this._track.input._disposed))return[3,27];if(-1===_)return[3,25];return[4,y()];case 24:R.sent(),R.label=25;case 25:return[4,S()];case 26:R.sent(),R.label=27;case 27:return i.close(),p=!0,u(),[2]}})}).call(this).catch(function(e){g||(g=e,u())});var _=this._track,y=function(){var e=!0,r=!1,n=void 0;try{for(var i,s=a[Symbol.iterator]();!(e=(i=s.next()).done);e=!0){var o=i.value;null==o||o.close()}}catch(e){r=!0,n=e}finally{try{e||null==s.return||s.return()}finally{if(r)throw n}}};return(0,d._)({next:function(){return(0,o._)(function(){var e;return(0,b._)(this,function(r){switch(r.label){case 0:if(!_.input._disposed)return[3,1];throw y(),new(0,S.InputDisposedError);case 1:if(!m)return[3,2];return[2,{value:void 0,done:!0}];case 2:if(!g)return[3,3];throw y(),g;case 3:if(!(a.length>0))return[3,4];return e=a.shift(),(0,T.assert)(void 0!==e),h(),[2,{value:e,done:!1}];case 4:if(p)return[3,6];return[4,c];case 5:return r.sent(),[3,7];case 6:return[2,{value:void 0,done:!0}];case 7:return[3,0];case 8:return[2]}})})()},return:function(){return(0,o._)(function(){return(0,b._)(this,function(e){return m=!0,h(),u(),y(),[2,{value:void 0,done:!0}]})})()},throw:function(e){return(0,o._)(function(){return(0,b._)(this,function(r){throw e})})()}},Symbol.asyncIterator,function(){return this})}}]),e}(),D=function(e){return 0===e?40:8},F=function(e){"use strict";function r(e,n,a,i,s,o){(0,u._)(this,r),(l=(0,c._)(this,r,[e,n])).codec=a,l.decoderConfig=i,l.rotation=s,l.timeResolution=o,l.decoder=null,l.customDecoder=null,l.customDecoderCallSerializer=new(0,T.CallSerializer),l.customDecoderQueueSize=0,l.inputTimestamps=[],l.sampleQueue=[],l.currentPacketIndex=0,l.raslSkipped=!1,l.alphaDecoder=null,l.alphaHadKeyframe=!1,l.colorQueue=[],l.alphaQueue=[],l.merger=null,l.mergerCreationFailed=!1,l.decodedAlphaChunkCount=0,l.alphaDecoderQueueSize=0,l.nullAlphaFrameQueue=[],l.currentAlphaPacketIndex=0,l.alphaRaslSkipped=!1;var l,d=y.customVideoDecoders.find(function(e){return e.supports(a,i)});if(d)l.customDecoder=new d,l.customDecoder.codec=a,l.customDecoder.config=i,l.customDecoder.onSample=function(e){if(!(e instanceof E.VideoSample))throw TypeError("The argument passed to onSample must be a VideoSample.");l.finalizeAndEmitSample(e)},l.customDecoderCallSerializer.call(function(){return l.customDecoder.init()});else{var f=function(e){if(l.alphaQueue.length>0){var r=l.alphaQueue.shift();(0,T.assert)(void 0!==r),l.mergeAlpha(e,r)}else l.colorQueue.push(e)};if("avc"===a&&l.decoderConfig.description&&(0,T.isChromium)()){var m=(0,_.deserializeAvcDecoderConfigurationRecord)((0,T.toUint8Array)(l.decoderConfig.description));if(m&&m.sequenceParameterSets.length>0){var g=(0,_.parseAvcSps)(m.sequenceParameterSets[0]);g&&0===g.frameMbsOnlyFlag&&(l.decoderConfig=(0,p._)((0,h._)({},l.decoderConfig),{hardwareAcceleration:"prefer-software"}))}}l.decoder=new VideoDecoder({output:function(e){try{f(e)}catch(e){l.onError(e)}},error:n}),l.decoder.configure(l.decoderConfig)}return l}return(0,f._)(r,e),(0,l._)(r,[{key:"getDecodeQueueSize",value:function(){var e,r;return this.customDecoder?this.customDecoderQueueSize:((0,T.assert)(this.decoder),Math.max(this.decoder.decodeQueueSize,null!=(r=null==(e=this.alphaDecoder)?void 0:e.decodeQueueSize)?r:0))}},{key:"decode",value:function(e){var r=this;if("hevc"===this.codec&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}this.currentPacketIndex++,this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(function(){return r.customDecoder.decode(e)}).then(function(){return r.customDecoderQueueSize--})):((0,T.assert)(this.decoder),(0,T.isWebKit)()||(0,T.insertSorted)(this.inputTimestamps,e.timestamp,function(e){return e}),this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e))}},{key:"decodeAlphaData",value:function(e){var r=this;if(!e.sideData.alpha||this.mergerCreationFailed)return void this.pushNullAlphaFrame();if(!this.merger)try{this.merger=new R}catch(r){console.error("Due to an error, only color data will be decoded.",r),this.mergerCreationFailed=!0,this.decodeAlphaData(e);return}if(!this.alphaDecoder){var n=function(e){if(r.alphaDecoderQueueSize--,r.colorQueue.length>0){var n=r.colorQueue.shift();(0,T.assert)(void 0!==n),r.mergeAlpha(n,e)}else r.alphaQueue.push(e);for(r.decodedAlphaChunkCount++;r.nullAlphaFrameQueue.length>0&&r.nullAlphaFrameQueue[0]===r.decodedAlphaChunkCount;)if(r.nullAlphaFrameQueue.shift(),r.colorQueue.length>0){var a=r.colorQueue.shift();(0,T.assert)(void 0!==a),r.mergeAlpha(a,null)}else r.alphaQueue.push(null)};this.alphaDecoder=new VideoDecoder({output:function(e){try{n(e)}catch(e){r.onError(e)}},error:this.onError}),this.alphaDecoder.configure(this.decoderConfig)}var a=(0,_.determineVideoPacketType)(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||(this.alphaHadKeyframe="key"===a),this.alphaHadKeyframe){if("hevc"===this.codec&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha))return void this.pushNullAlphaFrame();this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(null!=a?a:e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}},{key:"pushNullAlphaFrame",value:function(){0===this.alphaDecoderQueueSize?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}},{key:"hasHevcRaslPicture",value:function(e){return(0,_.extractHevcNalUnits)(e,this.decoderConfig).some(function(e){var r=(0,_.extractNalUnitTypeForHevc)(e);return r===_.HevcNalUnitType.RASL_N||r===_.HevcNalUnitType.RASL_R})}},{key:"sampleHandler",value:function(e){if((0,T.isWebKit)()){if(this.sampleQueue.length>0&&e.timestamp>=(0,T.last)(this.sampleQueue).timestamp){var r=!0,n=!1,a=void 0;try{for(var i,s=this.sampleQueue[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var o=i.value;this.finalizeAndEmitSample(o)}}catch(e){n=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(n)throw a}}this.sampleQueue.length=0}(0,T.insertSorted)(this.sampleQueue,e,function(e){return e.timestamp})}else{var c=this.inputTimestamps.shift();(0,T.assert)(void 0!==c),e.setTimestamp(c),this.finalizeAndEmitSample(e)}}},{key:"finalizeAndEmitSample",value:function(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}},{key:"mergeAlpha",value:function(e,r){if(!r){var n,a=new(0,E.VideoSample)(e);this.sampleHandler(a);return}(0,T.assert)(this.merger),this.merger.update(e,r),e.close(),r.close();var i=new VideoFrame(this.merger.canvas,{timestamp:e.timestamp,duration:null!=(n=e.duration)?n:void 0}),s=new(0,E.VideoSample)(i);this.sampleHandler(s)}},{key:"flush",value:function(){return(0,o._)(function(){var e,r,n,a,i,s,o,c;return(0,b._)(this,function(u){switch(u.label){case 0:if(e=this,!this.customDecoder)return[3,2];return[4,this.customDecoderCallSerializer.call(function(){return e.customDecoder.flush()})];case 1:return u.sent(),[3,4];case 2:return(0,T.assert)(this.decoder),[4,Promise.all([this.decoder.flush(),null==(r=this.alphaDecoder)?void 0:r.flush()])];case 3:u.sent(),this.colorQueue.forEach(function(e){return e.close()}),this.colorQueue.length=0,this.alphaQueue.forEach(function(e){return null==e?void 0:e.close()}),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1,u.label=4;case 4:if((0,T.isWebKit)()){n=!0,a=!1,i=void 0;try{for(s=this.sampleQueue[Symbol.iterator]();!(n=(o=s.next()).done);n=!0)c=o.value,this.finalizeAndEmitSample(c)}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}this.sampleQueue.length=0}return this.currentPacketIndex=0,this.raslSkipped=!1,[2]}})}).call(this)}},{key:"close",value:function(){var e=this;this.customDecoder?this.customDecoderCallSerializer.call(function(){return e.customDecoder.close()}):((0,T.assert)(this.decoder),this.decoder.close(),null==(i=this.alphaDecoder)||i.close(),this.colorQueue.forEach(function(e){return e.close()}),this.colorQueue.length=0,this.alphaQueue.forEach(function(e){return null==e?void 0:e.close()}),this.alphaQueue.length=0,null==(s=this.merger)||s.close());var r=!0,n=!1,a=void 0;try{for(var i,s,o,c=this.sampleQueue[Symbol.iterator]();!(r=(o=c.next()).done);r=!0)o.value.close()}catch(e){n=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(n)throw a}}this.sampleQueue.length=0}}]),r}(B),R=function(){"use strict";function e(){(0,u._)(this,e),"undefined"!=typeof OffscreenCanvas?this.canvas=new OffscreenCanvas(300,150):this.canvas=document.createElement("canvas");var r=this.canvas.getContext("webgl2",{premultipliedAlpha:!1});if(!r)throw Error("Couldn't acquire WebGL 2 context.");this.gl=r,this.program=this.createProgram(),this.vao=this.createVAO(),this.colorTexture=this.createTexture(),this.alphaTexture=this.createTexture(),this.gl.useProgram(this.program),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_colorTexture"),0),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_alphaTexture"),1)}return(0,l._)(e,[{key:"createProgram",value:function(){var e=this.createShader(this.gl.VERTEX_SHADER,"#version 300 es\n in vec2 a_position;\n in vec2 a_texCoord;\n out vec2 v_texCoord;\n \n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n "),r=this.createShader(this.gl.FRAGMENT_SHADER,"#version 300 es\n precision highp float;\n \n uniform sampler2D u_colorTexture;\n uniform sampler2D u_alphaTexture;\n in vec2 v_texCoord;\n out vec4 fragColor;\n \n void main() {\n vec3 color = texture(u_colorTexture, v_texCoord).rgb;\n float alpha = texture(u_alphaTexture, v_texCoord).r;\n fragColor = vec4(color, alpha);\n }\n "),n=this.gl.createProgram();return this.gl.attachShader(n,e),this.gl.attachShader(n,r),this.gl.linkProgram(n),n}},{key:"createShader",value:function(e,r){var n=this.gl.createShader(e);return this.gl.shaderSource(n,r),this.gl.compileShader(n),n}},{key:"createVAO",value:function(){var e=this.gl.createVertexArray();this.gl.bindVertexArray(e);var r=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),n=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,n),this.gl.bufferData(this.gl.ARRAY_BUFFER,r,this.gl.STATIC_DRAW);var a=this.gl.getAttribLocation(this.program,"a_position"),i=this.gl.getAttribLocation(this.program,"a_texCoord");return this.gl.enableVertexAttribArray(a),this.gl.vertexAttribPointer(a,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(i),this.gl.vertexAttribPointer(i,2,this.gl.FLOAT,!1,16,8),e}},{key:"createTexture",value:function(){var e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}},{key:"update",value:function(e,r){(e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.colorTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,this.alphaTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,r),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}},{key:"close",value:function(){var e;null==(e=this.gl.getExtension("WEBGL_lose_context"))||e.loseContext(),this.gl=null}}]),e}(),U=function(e){"use strict";function r(e){var n;if((0,u._)(this,r),!(e instanceof w.InputVideoTrack))throw TypeError("videoTrack must be an InputVideoTrack.");return(n=(0,c._)(this,r))._track=e,n}return(0,f._)(r,e),(0,l._)(r,[{key:"_createDecoder",value:function(e,r){return(0,o._)(function(){var n,a,i,s;return(0,b._)(this,function(o){switch(o.label){case 0:return[4,this._track.canDecode()];case 1:if(!o.sent())throw Error("This video track cannot be decoded by this browser. Make sure to check decodability before using a track.");return n=this._track.codec,a=this._track.rotation,[4,this._track.getDecoderConfig()];case 2:return i=o.sent(),s=this._track.timeResolution,(0,T.assert)(n&&i),[2,new F(e,r,n,i,a,s)]}})}).call(this)}},{key:"_createPacketSink",value:function(){return new A(this._track)}},{key:"getSample",value:function(e){return(0,o._)(function(){var r,n,a,i,o,c;return(0,b._)(this,function(u){switch(u.label){case 0:P(e),r=!1,n=!1,u.label=1;case 1:u.trys.push([1,6,7,12]),i=(0,s._)(this.mediaSamplesAtTimestamps([e])),u.label=2;case 2:return[4,i.next()];case 3:if(!(r=!(o=u.sent()).done))return[3,5];return[2,o.value];case 4:return r=!1,[3,2];case 5:return[3,12];case 6:return c=u.sent(),n=!0,a=c,[3,12];case 7:if(u.trys.push([7,,10,11]),!(r&&null!=i.return))return[3,9];return[4,i.return()];case 8:u.sent(),u.label=9;case 9:return[3,11];case 10:if(n)throw a;return[7];case 11:return[7];case 12:throw Error("Internal error: Iterator returned nothing.")}})}).call(this)}},{key:"samples",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;return this.mediaSamplesInRange(e,r)}},{key:"samplesAtTimestamps",value:function(e){return this.mediaSamplesAtTimestamps(e)}}]),r}(M),O=function(){"use strict";function e(r){var n,a,i,s,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,u._)(this,e),this._nextCanvasIndex=0,!(r instanceof w.InputVideoTrack))throw TypeError("videoTrack must be an InputVideoTrack.");if(o&&(void 0===o?"undefined":(0,g._)(o))!=="object")throw TypeError("options must be an object.");if(void 0!==o.alpha&&"boolean"!=typeof o.alpha)throw TypeError("options.alpha, when provided, must be a boolean.");if(void 0!==o.width&&(!Number.isInteger(o.width)||o.width<=0))throw TypeError("options.width, when defined, must be a positive integer.");if(void 0!==o.height&&(!Number.isInteger(o.height)||o.height<=0))throw TypeError("options.height, when defined, must be a positive integer.");if(void 0!==o.fit&&!["fill","contain","cover"].includes(o.fit))throw TypeError('options.fit, when provided, must be one of "fill", "contain", or "cover".');if(void 0!==o.width&&void 0!==o.height&&void 0===o.fit)throw TypeError("When both options.width and options.height are provided, options.fit must also be provided.");if(void 0!==o.rotation&&![0,90,180,270].includes(o.rotation))throw TypeError("options.rotation, when provided, must be 0, 90, 180 or 270.");if(void 0!==o.crop&&(0,E.validateCropRectangle)(o.crop,"options."),void 0!==o.poolSize&&("number"!=typeof o.poolSize||!Number.isInteger(o.poolSize)||o.poolSize<0))throw TypeError("poolSize must be a non-negative integer.");var c=null!=(n=o.rotation)?n:r.rotation,l=(0,m._)(c%180==0?[r.codedWidth,r.codedHeight]:[r.codedHeight,r.codedWidth],2),d=l[0],f=l[1],h=o.crop;h&&(0,E.clampCropRectangle)(h,d,f);var p=(0,m._)(h?[h.width,h.height]:[d,f],2),b=p[0],k=p[1],_=b/k;void 0!==o.width&&void 0===o.height?k=Math.round((b=o.width)/_):void 0===o.width&&void 0!==o.height?b=Math.round((k=o.height)*_):void 0!==o.width&&void 0!==o.height&&(b=o.width,k=o.height),this._videoTrack=r,this._alpha=null!=(a=o.alpha)&&a,this._width=b,this._height=k,this._rotation=c,this._crop=h,this._fit=null!=(i=o.fit)?i:"fill",this._videoSampleSink=new U(r),this._canvasPool=Array.from({length:null!=(s=o.poolSize)?s:0},function(){return null})}return(0,l._)(e,[{key:"_videoSampleToWrappedCanvas",value:function(e){var r=this._canvasPool[this._nextCanvasIndex],n=!1;r||("undefined"!=typeof document?((r=document.createElement("canvas")).width=this._width,r.height=this._height):r=new OffscreenCanvas(this._width,this._height),this._canvasPool.length>0&&(this._canvasPool[this._nextCanvasIndex]=r),n=!0),this._canvasPool.length>0&&(this._nextCanvasIndex=(this._nextCanvasIndex+1)%this._canvasPool.length);var a=r.getContext("2d",{alpha:this._alpha||(0,T.isFirefox)()});(0,T.assert)(a),a.resetTransform(),n||(!this._alpha&&(0,T.isFirefox)()?(a.fillStyle="black",a.fillRect(0,0,this._width,this._height)):a.clearRect(0,0,this._width,this._height)),e.drawWithFit(a,{fit:this._fit,rotation:this._rotation,crop:this._crop});var i={canvas:r,timestamp:e.timestamp,duration:e.duration};return e.close(),i}},{key:"getCanvas",value:function(e){return(0,o._)(function(){var r;return(0,b._)(this,function(n){switch(n.label){case 0:return P(e),[4,this._videoSampleSink.getSample(e)];case 1:return[2,(r=n.sent())&&this._videoSampleToWrappedCanvas(r)]}})}).call(this)}},{key:"canvases",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;return(0,T.mapAsyncGenerator)(this._videoSampleSink.samples(r,n),function(r){return e._videoSampleToWrappedCanvas(r)})}},{key:"canvasesAtTimestamps",value:function(e){var r=this;return(0,T.mapAsyncGenerator)(this._videoSampleSink.samplesAtTimestamps(e),function(e){return e&&r._videoSampleToWrappedCanvas(e)})}}]),e}(),L=function(e){"use strict";function r(e,n,a,i){(0,u._)(this,r),(s=(0,c._)(this,r,[e,n])).decoder=null,s.customDecoder=null,s.customDecoderCallSerializer=new(0,T.CallSerializer),s.customDecoderQueueSize=0,s.currentTimestamp=null;var s,o=function(r){(null===s.currentTimestamp||Math.abs(r.timestamp-s.currentTimestamp)>=r.duration)&&(s.currentTimestamp=r.timestamp);var n=s.currentTimestamp;if(s.currentTimestamp+=r.duration,0===r.numberOfFrames)return void r.close();var a=i.sampleRate;r.setTimestamp(Math.round(n*a)/a),e(r)},l=y.customAudioDecoders.find(function(e){return e.supports(a,i)});return l?(s.customDecoder=new l,s.customDecoder.codec=a,s.customDecoder.config=i,s.customDecoder.onSample=function(e){if(!(e instanceof E.AudioSample))throw TypeError("The argument passed to onSample must be an AudioSample.");o(e)},s.customDecoderCallSerializer.call(function(){return s.customDecoder.init()})):(s.decoder=new AudioDecoder({output:function(e){try{o(new(0,E.AudioSample)(e))}catch(e){s.onError(e)}},error:n}),s.decoder.configure(i)),s}return(0,f._)(r,e),(0,l._)(r,[{key:"getDecodeQueueSize",value:function(){return this.customDecoder?this.customDecoderQueueSize:((0,T.assert)(this.decoder),this.decoder.decodeQueueSize)}},{key:"decode",value:function(e){var r=this;this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(function(){return r.customDecoder.decode(e)}).then(function(){return r.customDecoderQueueSize--})):((0,T.assert)(this.decoder),this.decoder.decode(e.toEncodedAudioChunk()))}},{key:"flush",value:function(){var e=this;return this.customDecoder?this.customDecoderCallSerializer.call(function(){return e.customDecoder.flush()}):((0,T.assert)(this.decoder),this.decoder.flush())}},{key:"close",value:function(){var e=this;this.customDecoder?this.customDecoderCallSerializer.call(function(){return e.customDecoder.close()}):((0,T.assert)(this.decoder),this.decoder.close())}}]),r}(B),N=function(e){"use strict";function r(e,n,a){(0,u._)(this,r),(i=(0,c._)(this,r,[e,n])).decoderConfig=a,i.currentTimestamp=null,(0,T.assert)(k.PCM_AUDIO_CODECS.includes(a.codec)),i.codec=a.codec;var i,s=(0,k.parsePcmCodec)(i.codec),o=s.dataType,l=s.sampleSize,d=s.littleEndian;switch(i.inputSampleSize=l,l){case 1:"unsigned"===o?i.readInputValue=function(e,r){return e.getUint8(r)-128}:"signed"===o?i.readInputValue=function(e,r){return e.getInt8(r)}:"ulaw"===o?i.readInputValue=function(e,r){return(0,I.fromUlaw)(e.getUint8(r))}:"alaw"===o?i.readInputValue=function(e,r){return(0,I.fromAlaw)(e.getUint8(r))}:(0,T.assert)(!1);break;case 2:"unsigned"===o?i.readInputValue=function(e,r){return e.getUint16(r,d)-32768}:"signed"===o?i.readInputValue=function(e,r){return e.getInt16(r,d)}:(0,T.assert)(!1);break;case 3:"unsigned"===o?i.readInputValue=function(e,r){return(0,T.getUint24)(e,r,d)-8388608}:"signed"===o?i.readInputValue=function(e,r){return(0,T.getInt24)(e,r,d)}:(0,T.assert)(!1);break;case 4:"unsigned"===o?i.readInputValue=function(e,r){return e.getUint32(r,d)-0x80000000}:"signed"===o?i.readInputValue=function(e,r){return e.getInt32(r,d)}:"float"===o?i.readInputValue=function(e,r){return e.getFloat32(r,d)}:(0,T.assert)(!1);break;case 8:"float"===o?i.readInputValue=function(e,r){return e.getFloat64(r,d)}:(0,T.assert)(!1);break;default:(0,T.assertNever)(l),(0,T.assert)(!1)}switch(l){case 1:"ulaw"===o||"alaw"===o?(i.outputSampleSize=2,i.outputFormat="s16",i.writeOutputValue=function(e,r,n){return e.setInt16(r,n,!0)}):(i.outputSampleSize=1,i.outputFormat="u8",i.writeOutputValue=function(e,r,n){return e.setUint8(r,n+128)});break;case 2:i.outputSampleSize=2,i.outputFormat="s16",i.writeOutputValue=function(e,r,n){return e.setInt16(r,n,!0)};break;case 3:i.outputSampleSize=4,i.outputFormat="s32",i.writeOutputValue=function(e,r,n){return e.setInt32(r,n<<8,!0)};break;case 4:i.outputSampleSize=4,"float"===o?(i.outputFormat="f32",i.writeOutputValue=function(e,r,n){return e.setFloat32(r,n,!0)}):(i.outputFormat="s32",i.writeOutputValue=function(e,r,n){return e.setInt32(r,n,!0)});break;case 8:i.outputSampleSize=4,i.outputFormat="f32",i.writeOutputValue=function(e,r,n){return e.setFloat32(r,n,!0)};break;default:(0,T.assertNever)(l),(0,T.assert)(!1)}return i}return(0,f._)(r,e),(0,l._)(r,[{key:"getDecodeQueueSize",value:function(){return 0}},{key:"decode",value:function(e){for(var r=(0,T.toDataView)(e.data),n=e.byteLength/this.decoderConfig.numberOfChannels/this.inputSampleSize,a=new ArrayBuffer(n*this.decoderConfig.numberOfChannels*this.outputSampleSize),i=new DataView(a),s=0;s<n*this.decoderConfig.numberOfChannels;s++){var o=s*this.inputSampleSize,c=s*this.outputSampleSize,u=this.readInputValue(r,o);this.writeOutputValue(i,c,u)}var l=n/this.decoderConfig.sampleRate;(null===this.currentTimestamp||Math.abs(e.timestamp-this.currentTimestamp)>=l)&&(this.currentTimestamp=e.timestamp);var d=this.currentTimestamp;this.currentTimestamp+=l;var f=new(0,E.AudioSample)({format:this.outputFormat,data:a,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:n,timestamp:d});this.onSample(f)}},{key:"flush",value:function(){return(0,o._)(function(){return(0,b._)(this,function(e){return[2]})})()}},{key:"close",value:function(){}}]),r}(B),V=function(e){"use strict";function r(e){var n;if((0,u._)(this,r),!(e instanceof w.InputAudioTrack))throw TypeError("audioTrack must be an InputAudioTrack.");return(n=(0,c._)(this,r))._track=e,n}return(0,f._)(r,e),(0,l._)(r,[{key:"_createDecoder",value:function(e,r){return(0,o._)(function(){var n,a;return(0,b._)(this,function(i){switch(i.label){case 0:return[4,this._track.canDecode()];case 1:if(!i.sent())throw Error("This audio track cannot be decoded by this browser. Make sure to check decodability before using a track.");return n=this._track.codec,[4,this._track.getDecoderConfig()];case 2:if(a=i.sent(),(0,T.assert)(n&&a),k.PCM_AUDIO_CODECS.includes(a.codec))return[2,new N(e,r,a)];return[2,new L(e,r,n,a)]}})}).call(this)}},{key:"_createPacketSink",value:function(){return new A(this._track)}},{key:"getSample",value:function(e){return(0,o._)(function(){var r,n,a,i,o,c;return(0,b._)(this,function(u){switch(u.label){case 0:P(e),r=!1,n=!1,u.label=1;case 1:u.trys.push([1,6,7,12]),i=(0,s._)(this.mediaSamplesAtTimestamps([e])),u.label=2;case 2:return[4,i.next()];case 3:if(!(r=!(o=u.sent()).done))return[3,5];return[2,o.value];case 4:return r=!1,[3,2];case 5:return[3,12];case 6:return c=u.sent(),n=!0,a=c,[3,12];case 7:if(u.trys.push([7,,10,11]),!(r&&null!=i.return))return[3,9];return[4,i.return()];case 8:u.sent(),u.label=9;case 9:return[3,11];case 10:if(n)throw a;return[7];case 11:return[7];case 12:throw Error("Internal error: Iterator returned nothing.")}})}).call(this)}},{key:"samples",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;return this.mediaSamplesInRange(e,r)}},{key:"samplesAtTimestamps",value:function(e){return this.mediaSamplesAtTimestamps(e)}}]),r}(M),z=function(){"use strict";function e(r){if((0,u._)(this,e),!(r instanceof w.InputAudioTrack))throw TypeError("audioTrack must be an InputAudioTrack.");this._audioSampleSink=new V(r)}return(0,l._)(e,[{key:"_audioSampleToWrappedArrayBuffer",value:function(e){var r={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),r}},{key:"getBuffer",value:function(e){return(0,o._)(function(){var r;return(0,b._)(this,function(n){switch(n.label){case 0:return P(e),[4,this._audioSampleSink.getSample(e)];case 1:return[2,(r=n.sent())&&this._audioSampleToWrappedArrayBuffer(r)]}})}).call(this)}},{key:"buffers",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;return(0,T.mapAsyncGenerator)(this._audioSampleSink.samples(r,n),function(r){return e._audioSampleToWrappedArrayBuffer(r)})}},{key:"buffersAtTimestamps",value:function(e){var r=this;return(0,T.mapAsyncGenerator)(this._audioSampleSink.samplesAtTimestamps(e),function(e){return e&&r._audioSampleToWrappedArrayBuffer(e)})}}]),e}()},{"@swc/helpers/cjs/_async_iterator.cjs":"f3IhJ","@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_define_property.cjs":"ltU3W","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./codec.js":"fXWqW","./codec-data.js":"kWTYV","./custom-coder.js":"hAl48","./input.js":"3sapy","./input-track.js":"b22CJ","./misc.js":"j7iGm","./packet.js":"QfqGG","./pcm.js":"501Zr","./sample.js":"1oMH7","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"3G1wX":[function(e,r,n,a){"use strict";n._=function(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n.push.apply(n,a)}return n})(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}),e}},{}],QfqGG:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"PLACEHOLDER_DATA",function(){return l}),i.export(n,"EncodedPacket",function(){return d});var s=e("@swc/helpers/cjs/_class_call_check.cjs"),o=e("@swc/helpers/cjs/_create_class.cjs"),c=e("@swc/helpers/cjs/_type_of.cjs"),u=e("./misc.js"),l=new Uint8Array(0),d=function(){"use strict";function e(r,n,a,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,u=arguments.length>5?arguments[5]:void 0,d=arguments.length>6?arguments[6]:void 0;if((0,s._)(this,e),this.data=r,this.type=n,this.timestamp=a,this.duration=i,this.sequenceNumber=o,r===l&&void 0===u)throw Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===u&&(u=r.byteLength),!(r instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if("key"!==n&&"delta"!==n)throw TypeError('type must be either "key" or "delta".');if(!Number.isFinite(a))throw TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw TypeError("duration must be a non-negative number.");if(!Number.isFinite(o))throw TypeError("sequenceNumber must be a number.");if(!Number.isInteger(u)||u<0)throw TypeError("byteLength must be a non-negative integer.");if(void 0!==d&&((void 0===d?"undefined":(0,c._)(d))!=="object"||!d))throw TypeError("sideData, when provided, must be an object.");if((null==d?void 0:d.alpha)!==void 0&&!(d.alpha instanceof Uint8Array))throw TypeError("sideData.alpha, when provided, must be a Uint8Array.");if((null==d?void 0:d.alphaByteLength)!==void 0&&(!Number.isInteger(d.alphaByteLength)||d.alphaByteLength<0))throw TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=u,this.sideData=null!=d?d:{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}return(0,o._)(e,[{key:"isMetadataOnly",get:function(){return this.data===l}},{key:"microsecondTimestamp",get:function(){return Math.trunc(u.SECOND_TO_MICROSECOND_FACTOR*this.timestamp)}},{key:"microsecondDuration",get:function(){return Math.trunc(u.SECOND_TO_MICROSECOND_FACTOR*this.duration)}},{key:"toEncodedVideoChunk",value:function(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}},{key:"alphaToEncodedVideoChunk",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;if(!this.sideData.alpha)throw TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}},{key:"toEncodedAudioChunk",value:function(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}},{key:"clone",value:function(r){var n,a;if(void 0!==r&&((void 0===r?"undefined":(0,c._)(r))!=="object"||null===r))throw TypeError("options, when provided, must be an object.");if((null==r?void 0:r.timestamp)!==void 0&&!Number.isFinite(r.timestamp))throw TypeError("options.timestamp, when provided, must be a number.");if((null==r?void 0:r.duration)!==void 0&&!Number.isFinite(r.duration))throw TypeError("options.duration, when provided, must be a number.");return new e(this.data,this.type,null!=(n=null==r?void 0:r.timestamp)?n:this.timestamp,null!=(a=null==r?void 0:r.duration)?a:this.duration,this.sequenceNumber,this.byteLength)}}],[{key:"fromEncodedChunk",value:function(r,n){if(!(r instanceof EncodedVideoChunk||r instanceof EncodedAudioChunk))throw TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");var a,i=new Uint8Array(r.byteLength);return r.copyTo(i),new e(i,r.type,r.timestamp/1e6,(null!=(a=r.duration)?a:0)/1e6,void 0,void 0,n)}}]),e}()},{"@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_type_of.cjs":"iXhRw","./misc.js":"j7iGm","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"501Zr":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"toUlaw",function(){return s}),i.export(n,"fromUlaw",function(){return o}),i.export(n,"toAlaw",function(){return c}),i.export(n,"fromAlaw",function(){return u});var s=function(e){var r=e,n=4096,a=0,i=12,s=0;for(r<0&&(r=-r,a=128),(r+=33)>8191&&(r=8191);(r&n)!==n&&i>=5;)n>>=1,i--;return s=r>>i-4&15,255&~(a|i-5<<4|s)},o=function(e){var r=0,n=0,a=~e;128&a&&(a&=-129,r=-1);var i=(1<<(n=((240&a)>>4)+5)|(15&a)<<n-4|1<<n-5)-33;return 0===r?i:-i},c=function(e){var r=2048,n=0,a=11,i=0,s=e;for(s<0&&(s=-s,n=128),s>4095&&(s=4095);(s&r)!==r&&a>=5;)r>>=1,a--;return i=s>>(4===a?1:a-4)&15,(n|a-4<<4|i)^85},u=function(e){var r=0,n=0,a=85^e;128&a&&(a&=-129,r=-1);var i=0;return i=4!=(n=((240&a)>>4)+4)?1<<n|(15&a)<<n-4|1<<n-5:a<<1|1,0===r?i:-i}},{"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"1oMH7":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"VideoSample",function(){return g}),i.export(n,"clampCropRectangle",function(){return k}),i.export(n,"validateCropRectangle",function(){return _}),i.export(n,"AudioSample",function(){return S});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_class_call_check.cjs"),c=e("@swc/helpers/cjs/_create_class.cjs"),u=e("@swc/helpers/cjs/_sliced_to_array.cjs"),l=e("@swc/helpers/cjs/_type_of.cjs"),d=e("@swc/helpers/cjs/_ts_generator.cjs"),f=e("./misc.js");(0,f.polyfillSymbolDispose)();var h=-1/0,p=-1/0,m=null;"undefined"!=typeof FinalizationRegistry&&(m=new FinalizationRegistry(function(e){var r=Date.now();"video"===e.type?(r-h>=1e3&&(console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),h=r),"undefined"!=typeof VideoFrame&&e.data instanceof VideoFrame&&e.data.close()):(r-p>=1e3&&(console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),p=r),"undefined"!=typeof AudioData&&e.data instanceof AudioData&&e.data.close())}));var g=function(){"use strict";function e(r,n){if((0,o._)(this,e),this._closed=!1,r instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&r instanceof SharedArrayBuffer||ArrayBuffer.isView(r)){if(!n||(void 0===n?"undefined":(0,l._)(n))!=="object")throw TypeError("init must be an object.");if(!("format"in n)||"string"!=typeof n.format)throw TypeError("init.format must be a string.");if(!Number.isInteger(n.codedWidth)||n.codedWidth<=0)throw TypeError("init.codedWidth must be a positive integer.");if(!Number.isInteger(n.codedHeight)||n.codedHeight<=0)throw TypeError("init.codedHeight must be a positive integer.");if(void 0!==n.rotation&&![0,90,180,270].includes(n.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(n.timestamp))throw TypeError("init.timestamp must be a number.");if(void 0!==n.duration&&(!Number.isFinite(n.duration)||n.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=(0,f.toUint8Array)(r).slice(),this.format=n.format,this.codedWidth=n.codedWidth,this.codedHeight=n.codedHeight,this.rotation=null!=(a=n.rotation)?a:0,this.timestamp=n.timestamp,this.duration=null!=(i=n.duration)?i:0,this.colorSpace=new VideoColorSpace(n.colorSpace)}else if("undefined"!=typeof VideoFrame&&r instanceof VideoFrame){if((null==n?void 0:n.rotation)!==void 0&&![0,90,180,270].includes(n.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if((null==n?void 0:n.timestamp)!==void 0&&!Number.isFinite(null==n?void 0:n.timestamp))throw TypeError("init.timestamp, when provided, must be a number.");if((null==n?void 0:n.duration)!==void 0&&(!Number.isFinite(n.duration)||n.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=r,this.format=r.format,this.codedWidth=r.displayWidth,this.codedHeight=r.displayHeight,this.rotation=null!=(s=null==n?void 0:n.rotation)?s:0,this.timestamp=null!=(c=null==n?void 0:n.timestamp)?c:r.timestamp/1e6,this.duration=null!=(d=null==n?void 0:n.duration)?d:(null!=(u=r.duration)?u:0)/1e6,this.colorSpace=r.colorSpace}else if("undefined"!=typeof HTMLImageElement&&r instanceof HTMLImageElement||"undefined"!=typeof SVGImageElement&&r instanceof SVGImageElement||"undefined"!=typeof ImageBitmap&&r instanceof ImageBitmap||"undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement||"undefined"!=typeof HTMLCanvasElement&&r instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&r instanceof OffscreenCanvas){if(!n||(void 0===n?"undefined":(0,l._)(n))!=="object")throw TypeError("init must be an object.");if(void 0!==n.rotation&&![0,90,180,270].includes(n.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(n.timestamp))throw TypeError("init.timestamp must be a number.");if(void 0!==n.duration&&(!Number.isFinite(n.duration)||n.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");if("undefined"!=typeof VideoFrame)return new e(new VideoFrame(r,{timestamp:Math.trunc(n.timestamp*f.SECOND_TO_MICROSECOND_FACTOR),duration:Math.trunc((null!=(h=n.duration)?h:0)*f.SECOND_TO_MICROSECOND_FACTOR)||void 0}),n);var a,i,s,c,u,d,h,p,g,b=0,k=0;if("naturalWidth"in r?(b=r.naturalWidth,k=r.naturalHeight):"videoWidth"in r?(b=r.videoWidth,k=r.videoHeight):"width"in r&&(b=Number(r.width),k=Number(r.height)),!b||!k)throw TypeError("Could not determine dimensions.");var _=new OffscreenCanvas(b,k),y=_.getContext("2d",{alpha:(0,f.isFirefox)(),willReadFrequently:!0});(0,f.assert)(y),y.drawImage(r,0,0),this._data=_,this.format="RGBX",this.codedWidth=b,this.codedHeight=k,this.rotation=null!=(p=n.rotation)?p:0,this.timestamp=n.timestamp,this.duration=null!=(g=n.duration)?g:0,this.colorSpace=new VideoColorSpace({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");null==m||m.register(this,{type:"video",data:this._data},this)}return(0,c._)(e,[{key:"displayWidth",get:function(){return this.rotation%180==0?this.codedWidth:this.codedHeight}},{key:"displayHeight",get:function(){return this.rotation%180==0?this.codedHeight:this.codedWidth}},{key:"microsecondTimestamp",get:function(){return Math.trunc(f.SECOND_TO_MICROSECOND_FACTOR*this.timestamp)}},{key:"microsecondDuration",get:function(){return Math.trunc(f.SECOND_TO_MICROSECOND_FACTOR*this.duration)}},{key:"hasAlpha",get:function(){return this.format&&this.format.includes("A")}},{key:"clone",value:function(){if(this._closed)throw Error("VideoSample is closed.");return((0,f.assert)(null!==this._data),b(this._data))?new e(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?new e(this._data.slice(),{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation}):new e(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}},{key:"close",value:function(){this._closed||(null==m||m.unregister(this),b(this._data)?this._data.close():this._data=null,this._closed=!0)}},{key:"allocationSize",value:function(){if(this._closed)throw Error("VideoSample is closed.");return((0,f.assert)(null!==this._data),b(this._data))?this._data.allocationSize():this._data instanceof Uint8Array?this._data.byteLength:this.codedWidth*this.codedHeight*4}},{key:"copyTo",value:function(e){return(0,s._)(function(){var r,n;return(0,d._)(this,function(a){switch(a.label){case 0:if(!(0,f.isAllowSharedBufferSource)(e))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(this._closed)throw Error("VideoSample is closed.");if((0,f.assert)(null!==this._data),!b(this._data))return[3,2];return[4,this._data.copyTo(e)];case 1:return a.sent(),[3,3];case 2:this._data instanceof Uint8Array?(0,f.toUint8Array)(e).set(this._data):(r=this._data.getContext("2d"),(0,f.assert)(r),n=r.getImageData(0,0,this.codedWidth,this.codedHeight),(0,f.toUint8Array)(e).set(n.data)),a.label=3;case 3:return[2]}})}).call(this)}},{key:"toVideoFrame",value:function(){if(this._closed)throw Error("VideoSample is closed.");return((0,f.assert)(null!==this._data),b(this._data))?new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0}):this._data instanceof Uint8Array?new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace}):new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}},{key:"draw",value:function(e,r,n,a,i,s,o,c,u){var l,d=0,f=0,h=this.displayWidth,p=this.displayHeight,m=0,g=0,b=this.displayWidth,k=this.displayHeight;if(void 0!==s?(d=r,f=n,h=a,p=i,m=s,g=o,void 0!==c?(b=c,k=u):(b=h,k=p)):(m=r,g=n,void 0!==a&&(b=a,k=i)),!("undefined"!=typeof CanvasRenderingContext2D&&e instanceof CanvasRenderingContext2D||"undefined"!=typeof OffscreenCanvasRenderingContext2D&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(d))throw TypeError("sx must be a number.");if(!Number.isFinite(f))throw TypeError("sy must be a number.");if(!Number.isFinite(h)||h<0)throw TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(p)||p<0)throw TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(m))throw TypeError("dx must be a number.");if(!Number.isFinite(g))throw TypeError("dy must be a number.");if(!Number.isFinite(b)||b<0)throw TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(k)||k<0)throw TypeError("dHeight must be a non-negative number.");if(this._closed)throw Error("VideoSample is closed.");d=(l=this._rotateSourceRegion(d,f,h,p,this.rotation)).sx,f=l.sy,h=l.sWidth,p=l.sHeight;var _=this.toCanvasImageSource();e.save();var y=m+b/2,S=g+k/2;e.translate(y,S),e.rotate(this.rotation*Math.PI/180);var w=this.rotation%180==0?1:b/k;e.scale(1/w,w),e.drawImage(_,d,f,h,p,-b/2,-k/2,b,k),e.restore()}},{key:"drawWithFit",value:function(e,r){if(!("undefined"!=typeof CanvasRenderingContext2D&&e instanceof CanvasRenderingContext2D||"undefined"!=typeof OffscreenCanvasRenderingContext2D&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!r||(void 0===r?"undefined":(0,l._)(r))!=="object")throw TypeError("options must be an object.");if(!["fill","contain","cover"].includes(r.fit))throw TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(void 0!==r.rotation&&![0,90,180,270].includes(r.rotation))throw TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");void 0!==r.crop&&_(r.crop,"options.");var n,a,i,s,o,c,d,f,h,p,m,g,b,y=e.canvas.width,S=e.canvas.height,w=null!=(o=r.rotation)?o:this.rotation,T=(0,u._)(w%180==0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth],2),x=T[0],I=T[1];r.crop&&k(r.crop,x,I);var E=this._rotateSourceRegion(null!=(p=null==(n=r.crop)?void 0:n.left)?p:0,null!=(m=null==(a=r.crop)?void 0:a.top)?m:0,null!=(g=null==(i=r.crop)?void 0:i.width)?g:x,null!=(b=null==(s=r.crop)?void 0:s.height)?b:I,w),j=E.sx,P=E.sy,C=E.sWidth,A=E.sHeight;if("fill"===r.fit)c=0,d=0,f=y,h=S;else{var B=(0,u._)(r.crop?[r.crop.width,r.crop.height]:[x,I],2),M=B[0],D=B[1],F="contain"===r.fit?Math.min(y/M,S/D):Math.max(y/M,S/D);f=M*F,h=D*F,c=(y-f)/2,d=(S-h)/2}e.save();var R=w%180==0?1:f/h;e.translate(y/2,S/2),e.rotate(w*Math.PI/180),e.scale(1/R,R),e.translate(-y/2,-S/2),e.drawImage(this.toCanvasImageSource(),j,P,C,A,c,d,f,h),e.restore()}},{key:"_rotateSourceRegion",value:function(e,r,n,a,i){var s,o,c;return 90===i?(e=(s=[r,this.codedHeight-e-n,a,n])[0],r=s[1],n=s[2],a=s[3]):180===i?(e=(o=[this.codedWidth-e-n,this.codedHeight-r-a])[0],r=o[1]):270===i&&(e=(c=[this.codedWidth-r-a,e,a,n])[0],r=c[1],n=c[2],a=c[3]),{sx:e,sy:r,sWidth:n,sHeight:a}}},{key:"toCanvasImageSource",value:function(){if(this._closed)throw Error("VideoSample is closed.");if((0,f.assert)(null!==this._data),!(this._data instanceof Uint8Array))return this._data;var e=this.toVideoFrame();return queueMicrotask(function(){return e.close()}),e}},{key:"setRotation",value:function(e){if(![0,90,180,270].includes(e))throw TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=e}},{key:"setTimestamp",value:function(e){if(!Number.isFinite(e))throw TypeError("newTimestamp must be a number.");this.timestamp=e}},{key:"setDuration",value:function(e){if(!Number.isFinite(e)||e<0)throw TypeError("newDuration must be a non-negative number.");this.duration=e}},{key:Symbol.dispose,value:function(){this.close()}}]),e}(),b=function(e){return"undefined"!=typeof VideoFrame&&e instanceof VideoFrame},k=function(e,r,n){e.left=Math.min(e.left,r),e.top=Math.min(e.top,n),e.width=Math.min(e.width,r-e.left),e.height=Math.min(e.height,n-e.top),(0,f.assert)(e.width>=0),(0,f.assert)(e.height>=0)},_=function(e,r){if(!e||(void 0===e?"undefined":(0,l._)(e))!=="object")throw TypeError(r+"crop, when provided, must be an object.");if(!Number.isInteger(e.left)||e.left<0)throw TypeError(r+"crop.left must be a non-negative integer.");if(!Number.isInteger(e.top)||e.top<0)throw TypeError(r+"crop.top must be a non-negative integer.");if(!Number.isInteger(e.width)||e.width<0)throw TypeError(r+"crop.width must be a non-negative integer.");if(!Number.isInteger(e.height)||e.height<0)throw TypeError(r+"crop.height must be a non-negative integer.")},y=new Set(["f32","f32-planar","s16","s16-planar","s32","s32-planar","u8","u8-planar"]),S=function(){"use strict";function e(r){if((0,o._)(this,e),this._closed=!1,E(r)){if(null===r.format)throw TypeError("AudioData with null format is not supported.");this._data=r,this.format=r.format,this.sampleRate=r.sampleRate,this.numberOfFrames=r.numberOfFrames,this.numberOfChannels=r.numberOfChannels,this.timestamp=r.timestamp/1e6,this.duration=r.numberOfFrames/r.sampleRate}else{if(!r||(void 0===r?"undefined":(0,l._)(r))!=="object")throw TypeError("Invalid AudioDataInit: must be an object.");if(!y.has(r.format))throw TypeError("Invalid AudioDataInit: invalid format.");if(!Number.isFinite(r.sampleRate)||r.sampleRate<=0)throw TypeError("Invalid AudioDataInit: sampleRate must be >0.");if(!Number.isInteger(r.numberOfChannels)||0===r.numberOfChannels)throw TypeError("Invalid AudioDataInit: numberOfChannels must be an integer > 0.");if(!Number.isFinite(null==r?void 0:r.timestamp))throw TypeError("init.timestamp must be a number.");var n,a=r.data.byteLength/(w(r.format)*r.numberOfChannels);if(!Number.isInteger(a))throw TypeError("Invalid AudioDataInit: data size is not a multiple of frame size.");if(this.format=r.format,this.sampleRate=r.sampleRate,this.numberOfFrames=a,this.numberOfChannels=r.numberOfChannels,this.timestamp=r.timestamp,this.duration=a/r.sampleRate,r.data instanceof ArrayBuffer)n=new Uint8Array(r.data);else if(ArrayBuffer.isView(r.data))n=new Uint8Array(r.data.buffer,r.data.byteOffset,r.data.byteLength);else throw TypeError("Invalid AudioDataInit: data is not a BufferSource.");var i=this.numberOfFrames*this.numberOfChannels*w(this.format);if(n.byteLength<i)throw TypeError("Invalid AudioDataInit: insufficient data size.");this._data=n}null==m||m.register(this,{type:"audio",data:this._data},this)}return(0,c._)(e,[{key:"microsecondTimestamp",get:function(){return Math.trunc(f.SECOND_TO_MICROSECOND_FACTOR*this.timestamp)}},{key:"microsecondDuration",get:function(){return Math.trunc(f.SECOND_TO_MICROSECOND_FACTOR*this.duration)}},{key:"allocationSize",value:function(e){if(!e||(void 0===e?"undefined":(0,l._)(e))!=="object")throw TypeError("options must be an object.");if(!Number.isInteger(e.planeIndex)||e.planeIndex<0)throw TypeError("planeIndex must be a non-negative integer.");if(void 0!==e.format&&!y.has(e.format))throw TypeError("Invalid format.");if(void 0!==e.frameOffset&&(!Number.isInteger(e.frameOffset)||e.frameOffset<0))throw TypeError("frameOffset must be a non-negative integer.");if(void 0!==e.frameCount&&(!Number.isInteger(e.frameCount)||e.frameCount<0))throw TypeError("frameCount must be a non-negative integer.");if(this._closed)throw Error("AudioSample is closed.");var r,n,a=null!=(r=e.format)?r:this.format,i=null!=(n=e.frameOffset)?n:0;if(i>=this.numberOfFrames)throw RangeError("frameOffset out of range");var s=void 0!==e.frameCount?e.frameCount:this.numberOfFrames-i;if(s>this.numberOfFrames-i)throw RangeError("frameCount out of range");var o=w(a),c=T(a);if(c&&e.planeIndex>=this.numberOfChannels||!c&&0!==e.planeIndex)throw RangeError("planeIndex out of range");return(c?s:s*this.numberOfChannels)*o}},{key:"copyTo",value:function(e,r){if(!(0,f.isAllowSharedBufferSource)(e))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(!r||(void 0===r?"undefined":(0,l._)(r))!=="object")throw TypeError("options must be an object.");if(!Number.isInteger(r.planeIndex)||r.planeIndex<0)throw TypeError("planeIndex must be a non-negative integer.");if(void 0!==r.format&&!y.has(r.format))throw TypeError("Invalid format.");if(void 0!==r.frameOffset&&(!Number.isInteger(r.frameOffset)||r.frameOffset<0))throw TypeError("frameOffset must be a non-negative integer.");if(void 0!==r.frameCount&&(!Number.isInteger(r.frameCount)||r.frameCount<0))throw TypeError("frameCount must be a non-negative integer.");if(this._closed)throw Error("AudioSample is closed.");var n=r.planeIndex,a=r.format,i=r.frameCount,s=r.frameOffset,o=null!=a?a:this.format;if(!o)throw Error("Destination format not determined");var c=this.numberOfFrames,u=this.numberOfChannels,d=null!=s?s:0;if(d>=c)throw RangeError("frameOffset out of range");var h=void 0!==i?i:c-d;if(h>c-d)throw RangeError("frameCount out of range");var p=w(o),m=T(o);if(m&&n>=u||!m&&0!==n)throw RangeError("planeIndex out of range");var g=m?h:h*u;if(e.byteLength<g*p)throw RangeError("Destination buffer is too small");var b=(0,f.toDataView)(e),k=I(o);if(E(this._data))if(m)if("f32-planar"===o)this._data.copyTo(e,{planeIndex:n,frameOffset:d,frameCount:h,format:"f32-planar"});else{var _=new ArrayBuffer(4*h),S=new Float32Array(_);this._data.copyTo(S,{planeIndex:n,frameOffset:d,frameCount:h,format:"f32-planar"});for(var j=new DataView(_),P=0;P<h;P++)k(b,P*p,j.getFloat32(4*P,!0))}else for(var C=new Float32Array(h),A=0;A<u;A++){this._data.copyTo(C,{planeIndex:A,frameOffset:d,frameCount:h,format:"f32-planar"});for(var B=0;B<h;B++)k(b,(B*u+A)*p,C[B])}else for(var M=this._data,D=(0,f.toDataView)(M),F=this.format,R=x(F),U=w(F),O=T(F),L=0;L<h;L++)if(m)k(b,L*p,R(D,O?(n*c+(L+d))*U:((L+d)*u+n)*U));else for(var N=0;N<u;N++)k(b,(L*u+N)*p,R(D,O?(N*c+(L+d))*U:((L+d)*u+N)*U))}},{key:"clone",value:function(){if(this._closed)throw Error("AudioSample is closed.");if(!E(this._data))return new e({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data});var r=new e(this._data.clone());return r.setTimestamp(this.timestamp),r}},{key:"close",value:function(){this._closed||(null==m||m.unregister(this),E(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}},{key:"toAudioData",value:function(){if(this._closed)throw Error("AudioSample is closed.");if(!E(this._data))return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:this._data.buffer instanceof ArrayBuffer?this._data.buffer:this._data.slice()});if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(T(this.format)){for(var e=this.allocationSize({planeIndex:0,format:this.format}),r=new ArrayBuffer(e*this.numberOfChannels),n=0;n<this.numberOfChannels;n++)this.copyTo(new Uint8Array(r,n*e,e),{planeIndex:n,format:this.format});return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:r})}var a=new ArrayBuffer(this.allocationSize({planeIndex:0,format:this.format}));return this.copyTo(a,{planeIndex:0,format:this.format}),new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:a})}},{key:"toAudioBuffer",value:function(){if(this._closed)throw Error("AudioSample is closed.");for(var e=new AudioBuffer({numberOfChannels:this.numberOfChannels,length:this.numberOfFrames,sampleRate:this.sampleRate}),r=new Float32Array(this.allocationSize({planeIndex:0,format:"f32-planar"})/4),n=0;n<this.numberOfChannels;n++)this.copyTo(r,{planeIndex:n,format:"f32-planar"}),e.copyToChannel(r,n);return e}},{key:"setTimestamp",value:function(e){if(!Number.isFinite(e))throw TypeError("newTimestamp must be a number.");this.timestamp=e}},{key:Symbol.dispose,value:function(){this.close()}}],[{key:"_fromAudioBuffer",value:function(r,n){var a,i,s,o,c,u,l,f,h;return(0,d._)(this,function(d){switch(d.label){case 0:if(!(r instanceof AudioBuffer))throw TypeError("audioBuffer must be an AudioBuffer.");a=r.numberOfChannels,i=r.sampleRate,s=r.length,o=Math.floor(24e4/a),c=0,u=s,d.label=1;case 1:if(!(u>0))return[3,3];for(h=0,f=new Float32Array(a*(l=Math.min(o,u)));h<a;h++)r.copyFromChannel(f.subarray(h*l,(h+1)*l),h,c);return[4,new e({format:"f32-planar",sampleRate:i,numberOfFrames:l,numberOfChannels:a,timestamp:n+c/i,data:f})];case 2:return d.sent(),c+=l,u-=l,[3,1];case 3:return[2]}})}},{key:"fromAudioBuffer",value:function(r,n){if(!(r instanceof AudioBuffer))throw TypeError("audioBuffer must be an AudioBuffer.");for(var a=r.numberOfChannels,i=r.sampleRate,s=r.length,o=Math.floor(24e4/a),c=0,u=s,l=[];u>0;){for(var d=Math.min(o,u),f=new Float32Array(a*d),h=0;h<a;h++)r.copyFromChannel(f.subarray(h*d,(h+1)*d),h,c);var p=new e({format:"f32-planar",sampleRate:i,numberOfFrames:d,numberOfChannels:a,timestamp:n+c/i,data:f});l.push(p),c+=d,u-=d}return l}}]),e}(),w=function(e){switch(e){case"u8":case"u8-planar":return 1;case"s16":case"s16-planar":return 2;case"s32":case"s32-planar":case"f32":case"f32-planar":return 4;default:throw Error("Unknown AudioSampleFormat")}},T=function(e){switch(e){case"u8-planar":case"s16-planar":case"s32-planar":case"f32-planar":return!0;default:return!1}},x=function(e){switch(e){case"u8":case"u8-planar":return function(e,r){return(e.getUint8(r)-128)/128};case"s16":case"s16-planar":return function(e,r){return e.getInt16(r,!0)/32768};case"s32":case"s32-planar":return function(e,r){return e.getInt32(r,!0)/0x80000000};case"f32":case"f32-planar":return function(e,r){return e.getFloat32(r,!0)}}},I=function(e){switch(e){case"u8":case"u8-planar":return function(e,r,n){return e.setUint8(r,(0,f.clamp)((n+1)*127.5,0,255))};case"s16":case"s16-planar":return function(e,r,n){return e.setInt16(r,(0,f.clamp)(Math.round(32767*n),-32768,32767),!0)};case"s32":case"s32-planar":return function(e,r,n){return e.setInt32(r,(0,f.clamp)(Math.round(0x7fffffff*n),-0x80000000,0x7fffffff),!0)};case"f32":case"f32-planar":return function(e,r,n){return e.setFloat32(r,n,!0)}}},E=function(e){return"undefined"!=typeof AudioData&&e instanceof AudioData}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./misc.js":"j7iGm","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gw3Ca:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"buildIsobmffMimeType",function(){return o});var s=e("@swc/helpers/cjs/_to_consumable_array.cjs"),o=function(e){var r=(e.hasVideo?"video/":e.hasAudio?"audio/":"application/")+(e.isQuickTime?"quicktime":"mp4");if(e.codecStrings.length>0){var n=(0,s._)(new Set(e.codecStrings));r+='; codecs="'.concat(n.join(", "),'"')}return r}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],fSW0K:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"MIN_BOX_HEADER_SIZE",function(){return u}),i.export(n,"MAX_BOX_HEADER_SIZE",function(){return l}),i.export(n,"readBoxHeader",function(){return d}),i.export(n,"readFixed_16_16",function(){return f}),i.export(n,"readFixed_2_30",function(){return h}),i.export(n,"readIsomVariableInteger",function(){return p}),i.export(n,"readMetadataStringShort",function(){return m}),i.export(n,"readDataBox",function(){return g});var s=e("../metadata.js"),o=e("../misc.js"),c=e("../reader.js"),u=8,l=16,d=function(e){var r=(0,c.readU32Be)(e),n=(0,c.readAscii)(e,4),a=8;1===r&&(r=(0,c.readU64Be)(e),a=16);var i=r-a;return i<0?null:{name:n,totalSize:r,headerSize:a,contentSize:i}},f=function(e){return(0,c.readI32Be)(e)/65536},h=function(e){return(0,c.readI32Be)(e)/0x40000000},p=function(e){for(var r=0,n=0;n<4;n++){r<<=7;var a=(0,c.readU8)(e);if(r|=127&a,(128&a)==0)break}return r},m=function(e){var r=(0,c.readU16Be)(e);return e.skip(2),r=Math.min(r,e.remainingLength),o.textDecoder.decode((0,c.readBytes)(e,r))},g=function(e){var r=d(e);if(!r||"data"!==r.name||e.remainingLength<8)return null;var n=(0,c.readU32Be)(e);e.skip(4);var a=(0,c.readBytes)(e,r.contentSize-8);switch(n){case 1:return o.textDecoder.decode(a);case 2:return new TextDecoder("utf-16be").decode(a);case 13:return new(0,s.RichImageData)(a,"image/jpeg");case 14:return new(0,s.RichImageData)(a,"image/png");case 27:return new(0,s.RichImageData)(a,"image/bmp");default:return a}}},{"../metadata.js":"eSjom","../misc.js":"j7iGm","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],eSjom:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"RichImageData",function(){return c}),i.export(n,"AttachedFile",function(){return u}),i.export(n,"validateMetadataTags",function(){return l}),i.export(n,"metadataTagsAreEmpty",function(){return d}),i.export(n,"DEFAULT_TRACK_DISPOSITION",function(){return f}),i.export(n,"validateTrackDisposition",function(){return h});var s=e("@swc/helpers/cjs/_class_call_check.cjs"),o=e("@swc/helpers/cjs/_type_of.cjs"),c=function e(r,n){"use strict";if((0,s._)(this,e),this.data=r,this.mimeType=n,!(r instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if("string"!=typeof n)throw TypeError("mimeType must be a string.")},u=function e(r,n,a,i){"use strict";if((0,s._)(this,e),this.data=r,this.mimeType=n,this.name=a,this.description=i,!(r instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if(void 0!==n&&"string"!=typeof n)throw TypeError("mimeType, when provided, must be a string.");if(void 0!==a&&"string"!=typeof a)throw TypeError("name, when provided, must be a string.");if(void 0!==i&&"string"!=typeof i)throw TypeError("description, when provided, must be a string.")},l=function(e){if(!e||(void 0===e?"undefined":(0,o._)(e))!=="object")throw TypeError("tags must be an object.");if(void 0!==e.title&&"string"!=typeof e.title)throw TypeError("tags.title, when provided, must be a string.");if(void 0!==e.description&&"string"!=typeof e.description)throw TypeError("tags.description, when provided, must be a string.");if(void 0!==e.artist&&"string"!=typeof e.artist)throw TypeError("tags.artist, when provided, must be a string.");if(void 0!==e.album&&"string"!=typeof e.album)throw TypeError("tags.album, when provided, must be a string.");if(void 0!==e.albumArtist&&"string"!=typeof e.albumArtist)throw TypeError("tags.albumArtist, when provided, must be a string.");if(void 0!==e.trackNumber&&(!Number.isInteger(e.trackNumber)||e.trackNumber<=0))throw TypeError("tags.trackNumber, when provided, must be a positive integer.");if(void 0!==e.tracksTotal&&(!Number.isInteger(e.tracksTotal)||e.tracksTotal<=0))throw TypeError("tags.tracksTotal, when provided, must be a positive integer.");if(void 0!==e.discNumber&&(!Number.isInteger(e.discNumber)||e.discNumber<=0))throw TypeError("tags.discNumber, when provided, must be a positive integer.");if(void 0!==e.discsTotal&&(!Number.isInteger(e.discsTotal)||e.discsTotal<=0))throw TypeError("tags.discsTotal, when provided, must be a positive integer.");if(void 0!==e.genre&&"string"!=typeof e.genre)throw TypeError("tags.genre, when provided, must be a string.");if(void 0!==e.date&&(!(e.date instanceof Date)||Number.isNaN(e.date.getTime())))throw TypeError("tags.date, when provided, must be a valid Date.");if(void 0!==e.lyrics&&"string"!=typeof e.lyrics)throw TypeError("tags.lyrics, when provided, must be a string.");if(void 0!==e.images){if(!Array.isArray(e.images))throw TypeError("tags.images, when provided, must be an array.");var r=!0,n=!1,a=void 0;try{for(var i,s=e.images[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var l=i.value;if(!l||(void 0===l?"undefined":(0,o._)(l))!=="object")throw TypeError("Each image in tags.images must be an object.");if(!(l.data instanceof Uint8Array))throw TypeError("Each image.data must be a Uint8Array.");if("string"!=typeof l.mimeType)throw TypeError("Each image.mimeType must be a string.");if(!["coverFront","coverBack","unknown"].includes(l.kind))throw TypeError("Each image.kind must be 'coverFront', 'coverBack', or 'unknown'.")}}catch(e){n=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(n)throw a}}}if(void 0!==e.comment&&"string"!=typeof e.comment)throw TypeError("tags.comment, when provided, must be a string.");if(void 0!==e.raw){if(!e.raw||"object"!==(0,o._)(e.raw))throw TypeError("tags.raw, when provided, must be an object.");var d=!0,f=!1,h=void 0;try{for(var p,m=Object.values(e.raw)[Symbol.iterator]();!(d=(p=m.next()).done);d=!0){var g=p.value;if(null!==g&&"string"!=typeof g&&!(g instanceof Uint8Array)&&!(g instanceof c)&&!(g instanceof u))throw TypeError("Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, or null.")}}catch(e){f=!0,h=e}finally{try{d||null==m.return||m.return()}finally{if(f)throw h}}}},d=function(e){return void 0===e.title&&void 0===e.description&&void 0===e.artist&&void 0===e.album&&void 0===e.albumArtist&&void 0===e.trackNumber&&void 0===e.tracksTotal&&void 0===e.discNumber&&void 0===e.discsTotal&&void 0===e.genre&&void 0===e.date&&void 0===e.lyrics&&(!e.images||0===e.images.length)&&void 0===e.comment&&(void 0===e.raw||0===Object.keys(e.raw).length)},f={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1},h=function(e){if(!e||(void 0===e?"undefined":(0,o._)(e))!=="object")throw TypeError("disposition must be an object.");if(void 0!==e.default&&"boolean"!=typeof e.default)throw TypeError("disposition.default must be a boolean.");if(void 0!==e.forced&&"boolean"!=typeof e.forced)throw TypeError("disposition.forced must be a boolean.");if(void 0!==e.original&&"boolean"!=typeof e.original)throw TypeError("disposition.original must be a boolean.");if(void 0!==e.commentary&&"boolean"!=typeof e.commentary)throw TypeError("disposition.commentary must be a boolean.");if(void 0!==e.hearingImpaired&&"boolean"!=typeof e.hearingImpaired)throw TypeError("disposition.hearingImpaired must be a boolean.");if(void 0!==e.visuallyImpaired&&"boolean"!=typeof e.visuallyImpaired)throw TypeError("disposition.visuallyImpaired must be a boolean.")}},{"@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"8KRfO":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"Reader",function(){return l}),i.export(n,"FileSlice",function(){return d}),i.export(n,"readBytes",function(){return h}),i.export(n,"readU8",function(){return p}),i.export(n,"readU16",function(){return m}),i.export(n,"readU16Be",function(){return g}),i.export(n,"readU24Be",function(){return b}),i.export(n,"readI16Be",function(){return k}),i.export(n,"readU32",function(){return _}),i.export(n,"readU32Be",function(){return y}),i.export(n,"readU32Le",function(){return S}),i.export(n,"readI32Be",function(){return w}),i.export(n,"readI32Le",function(){return T}),i.export(n,"readU64",function(){return x}),i.export(n,"readU64Be",function(){return I}),i.export(n,"readI64Be",function(){return E}),i.export(n,"readI64Le",function(){return j}),i.export(n,"readF32Be",function(){return P}),i.export(n,"readF64Be",function(){return C}),i.export(n,"readAscii",function(){return A});var s=e("@swc/helpers/cjs/_class_call_check.cjs"),o=e("@swc/helpers/cjs/_create_class.cjs"),c=e("./input.js"),u=e("./misc.js"),l=function(){"use strict";function e(r){(0,s._)(this,e),this.source=r}return(0,o._)(e,[{key:"requestSlice",value:function(e,r){if(this.source._disposed)throw new(0,c.InputDisposedError);if(null!==this.fileSize&&e+r>this.fileSize)return null;var n=e+r,a=this.source._read(e,n);return a instanceof Promise?a.then(function(r){return r?new d(r.bytes,r.view,r.offset,e,n):null}):a?new d(a.bytes,a.view,a.offset,e,n):null}},{key:"requestSliceRange",value:function(e,r,n){var a=this;if(this.source._disposed)throw new(0,c.InputDisposedError);if(null!==this.fileSize)return this.requestSlice(e,(0,u.clamp)(this.fileSize-e,r,n));var i=this.requestSlice(e,n),s=function(i){if(i)return i;var s=function(i){return(0,u.assert)(null!==i),a.requestSlice(e,(0,u.clamp)(i-e,r,n))},o=a.source._retrieveSize();return o instanceof Promise?o.then(s):s(o)};return i instanceof Promise?i.then(s):s(i)}}]),e}(),d=function(){"use strict";function e(r,n,a,i,o){(0,s._)(this,e),this.bytes=r,this.view=n,this.offset=a,this.start=i,this.end=o,this.bufferPos=i-a}return(0,o._)(e,[{key:"length",get:function(){return this.end-this.start}},{key:"filePos",get:function(){return this.offset+this.bufferPos},set:function(e){this.bufferPos=e-this.offset}},{key:"remainingLength",get:function(){return Math.max(this.end-this.filePos,0)}},{key:"skip",value:function(e){this.bufferPos+=e}},{key:"slice",value:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.end-r;if(r<this.start||r+n>this.end)throw RangeError("Slicing outside of original slice.");return new e(this.bytes,this.view,this.offset,r,r+n)}}],[{key:"tempFromBytes",value:function(r){return new e(r,(0,u.toDataView)(r),0,0,r.length)}}]),e}(),f=function(e,r){if(e.filePos<e.start||e.filePos+r>e.end)throw RangeError("Tried reading [".concat(e.filePos,", ").concat(e.filePos+r,"), but slice is")+" [".concat(e.start,", ").concat(e.end,"). This is likely an internal error, please report it alongside the file")+" that caused it.")},h=function(e,r){f(e,r);var n=e.bytes.subarray(e.bufferPos,e.bufferPos+r);return e.bufferPos+=r,n},p=function(e){return f(e,1),e.view.getUint8(e.bufferPos++)},m=function(e,r){f(e,2);var n=e.view.getUint16(e.bufferPos,r);return e.bufferPos+=2,n},g=function(e){f(e,2);var r=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,r},b=function(e){f(e,3);var r=(0,u.getUint24)(e.view,e.bufferPos,!1);return e.bufferPos+=3,r},k=function(e){f(e,2);var r=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,r},_=function(e,r){f(e,4);var n=e.view.getUint32(e.bufferPos,r);return e.bufferPos+=4,n},y=function(e){f(e,4);var r=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,r},S=function(e){f(e,4);var r=e.view.getUint32(e.bufferPos,!0);return e.bufferPos+=4,r},w=function(e){f(e,4);var r=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,r},T=function(e){f(e,4);var r=e.view.getInt32(e.bufferPos,!0);return e.bufferPos+=4,r},x=function(e,r){var n,a;return r?(n=_(e,!0),a=_(e,!0)):(a=_(e,!1),n=_(e,!1)),0x100000000*a+n},I=function(e){return 0x100000000*y(e)+y(e)},E=function(e){return 0x100000000*w(e)+y(e)},j=function(e){var r=S(e);return 0x100000000*T(e)+r},P=function(e){f(e,4);var r=e.view.getFloat32(e.bufferPos,!1);return e.bufferPos+=4,r},C=function(e){f(e,8);var r=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,r},A=function(e,r){f(e,r);for(var n="",a=0;a<r;a++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n}},{"@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","./input.js":"3sapy","./misc.js":"j7iGm","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],fq2QE:[function(e,r,n,a){var i,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"EBMLFloat32",function(){return g}),o.export(n,"EBMLFloat64",function(){return b}),o.export(n,"EBMLSignedInt",function(){return k}),o.export(n,"EBMLUnicodeString",function(){return _}),o.export(n,"EBMLId",function(){return s}),o.export(n,"LEVEL_0_EBML_IDS",function(){return y}),o.export(n,"LEVEL_1_EBML_IDS",function(){return S}),o.export(n,"LEVEL_0_AND_1_EBML_IDS",function(){return w}),o.export(n,"measureUnsignedInt",function(){return T}),o.export(n,"measureUnsignedBigInt",function(){return x}),o.export(n,"measureSignedInt",function(){return I}),o.export(n,"measureVarInt",function(){return E}),o.export(n,"EBMLWriter",function(){return j}),o.export(n,"MAX_VAR_INT_SIZE",function(){return P}),o.export(n,"MIN_HEADER_SIZE",function(){return C}),o.export(n,"MAX_HEADER_SIZE",function(){return A}),o.export(n,"readVarIntSize",function(){return B}),o.export(n,"readVarInt",function(){return M}),o.export(n,"readUnsignedInt",function(){return D}),o.export(n,"readUnsignedBigInt",function(){return F}),o.export(n,"readSignedInt",function(){return R}),o.export(n,"readElementId",function(){return U}),o.export(n,"readElementSize",function(){return O}),o.export(n,"readElementHeader",function(){return L}),o.export(n,"readAsciiString",function(){return N}),o.export(n,"readUnicodeString",function(){return V}),o.export(n,"readFloat",function(){return z}),o.export(n,"searchForNextElementId",function(){return H}),o.export(n,"resync",function(){return G}),o.export(n,"CODEC_STRING_MAP",function(){return q}),o.export(n,"assertDefinedSize",function(){return W});var c=e("@swc/helpers/cjs/_async_to_generator.cjs"),u=e("@swc/helpers/cjs/_class_call_check.cjs"),l=e("@swc/helpers/cjs/_create_class.cjs"),d=e("@swc/helpers/cjs/_to_consumable_array.cjs"),f=e("@swc/helpers/cjs/_type_of.cjs"),h=e("@swc/helpers/cjs/_ts_generator.cjs"),p=e("../misc.js"),m=e("../reader.js"),g=function e(r){"use strict";(0,u._)(this,e),this.value=r},b=function e(r){"use strict";(0,u._)(this,e),this.value=r},k=function e(r){"use strict";(0,u._)(this,e),this.value=r},_=function e(r){"use strict";(0,u._)(this,e),this.value=r};(i=s||(s={}))[i.EBML=0x1a45dfa3]="EBML",i[i.EBMLVersion=17030]="EBMLVersion",i[i.EBMLReadVersion=17143]="EBMLReadVersion",i[i.EBMLMaxIDLength=17138]="EBMLMaxIDLength",i[i.EBMLMaxSizeLength=17139]="EBMLMaxSizeLength",i[i.DocType=17026]="DocType",i[i.DocTypeVersion=17031]="DocTypeVersion",i[i.DocTypeReadVersion=17029]="DocTypeReadVersion",i[i.Void=236]="Void",i[i.Segment=0x18538067]="Segment",i[i.SeekHead=0x114d9b74]="SeekHead",i[i.Seek=19899]="Seek",i[i.SeekID=21419]="SeekID",i[i.SeekPosition=21420]="SeekPosition",i[i.Duration=17545]="Duration",i[i.Info=0x1549a966]="Info",i[i.TimestampScale=2807729]="TimestampScale",i[i.MuxingApp=19840]="MuxingApp",i[i.WritingApp=22337]="WritingApp",i[i.Tracks=0x1654ae6b]="Tracks",i[i.TrackEntry=174]="TrackEntry",i[i.TrackNumber=215]="TrackNumber",i[i.TrackUID=29637]="TrackUID",i[i.TrackType=131]="TrackType",i[i.FlagEnabled=185]="FlagEnabled",i[i.FlagDefault=136]="FlagDefault",i[i.FlagForced=21930]="FlagForced",i[i.FlagOriginal=21934]="FlagOriginal",i[i.FlagHearingImpaired=21931]="FlagHearingImpaired",i[i.FlagVisualImpaired=21932]="FlagVisualImpaired",i[i.FlagCommentary=21935]="FlagCommentary",i[i.FlagLacing=156]="FlagLacing",i[i.Name=21358]="Name",i[i.Language=2274716]="Language",i[i.LanguageBCP47=2274717]="LanguageBCP47",i[i.CodecID=134]="CodecID",i[i.CodecPrivate=25506]="CodecPrivate",i[i.CodecDelay=22186]="CodecDelay",i[i.SeekPreRoll=22203]="SeekPreRoll",i[i.DefaultDuration=2352003]="DefaultDuration",i[i.Video=224]="Video",i[i.PixelWidth=176]="PixelWidth",i[i.PixelHeight=186]="PixelHeight",i[i.AlphaMode=21440]="AlphaMode",i[i.Audio=225]="Audio",i[i.SamplingFrequency=181]="SamplingFrequency",i[i.Channels=159]="Channels",i[i.BitDepth=25188]="BitDepth",i[i.SimpleBlock=163]="SimpleBlock",i[i.BlockGroup=160]="BlockGroup",i[i.Block=161]="Block",i[i.BlockAdditions=30113]="BlockAdditions",i[i.BlockMore=166]="BlockMore",i[i.BlockAdditional=165]="BlockAdditional",i[i.BlockAddID=238]="BlockAddID",i[i.BlockDuration=155]="BlockDuration",i[i.ReferenceBlock=251]="ReferenceBlock",i[i.Cluster=0x1f43b675]="Cluster",i[i.Timestamp=231]="Timestamp",i[i.Cues=0x1c53bb6b]="Cues",i[i.CuePoint=187]="CuePoint",i[i.CueTime=179]="CueTime",i[i.CueTrackPositions=183]="CueTrackPositions",i[i.CueTrack=247]="CueTrack",i[i.CueClusterPosition=241]="CueClusterPosition",i[i.Colour=21936]="Colour",i[i.MatrixCoefficients=21937]="MatrixCoefficients",i[i.TransferCharacteristics=21946]="TransferCharacteristics",i[i.Primaries=21947]="Primaries",i[i.Range=21945]="Range",i[i.Projection=30320]="Projection",i[i.ProjectionType=30321]="ProjectionType",i[i.ProjectionPoseRoll=30325]="ProjectionPoseRoll",i[i.Attachments=0x1941a469]="Attachments",i[i.AttachedFile=24999]="AttachedFile",i[i.FileDescription=18046]="FileDescription",i[i.FileName=18030]="FileName",i[i.FileMediaType=18016]="FileMediaType",i[i.FileData=18012]="FileData",i[i.FileUID=18094]="FileUID",i[i.Chapters=0x1043a770]="Chapters",i[i.Tags=0x1254c367]="Tags",i[i.Tag=29555]="Tag",i[i.Targets=25536]="Targets",i[i.TargetTypeValue=26826]="TargetTypeValue",i[i.TargetType=25546]="TargetType",i[i.TagTrackUID=25541]="TagTrackUID",i[i.TagEditionUID=25545]="TagEditionUID",i[i.TagChapterUID=25540]="TagChapterUID",i[i.TagAttachmentUID=25542]="TagAttachmentUID",i[i.SimpleTag=26568]="SimpleTag",i[i.TagName=17827]="TagName",i[i.TagLanguage=17530]="TagLanguage",i[i.TagString=17543]="TagString",i[i.TagBinary=17541]="TagBinary",i[i.ContentEncodings=28032]="ContentEncodings",i[i.ContentEncoding=25152]="ContentEncoding",i[i.ContentEncodingOrder=20529]="ContentEncodingOrder",i[i.ContentEncodingScope=20530]="ContentEncodingScope",i[i.ContentCompression=20532]="ContentCompression",i[i.ContentCompAlgo=16980]="ContentCompAlgo",i[i.ContentCompSettings=16981]="ContentCompSettings",i[i.ContentEncryption=20533]="ContentEncryption";var y=[s.EBML,s.Segment],S=[s.SeekHead,s.Info,s.Cluster,s.Tracks,s.Cues,s.Attachments,s.Chapters,s.Tags],w=(0,d._)(y).concat((0,d._)(S)),T=function(e){if(e<256)return 1;if(e<65536)return 2;if(e<0x1000000)return 3;if(e<0x100000000)return 4;if(e<0x10000000000)return 5;else return 6},x=function(e){if(e<1n<<8n)return 1;if(e<1n<<16n)return 2;if(e<1n<<24n)return 3;if(e<1n<<32n)return 4;if(e<1n<<40n)return 5;else if(e<1n<<48n)return 6;else if(e<1n<<56n)return 7;else return 8},I=function(e){if(e>=-64&&e<64)return 1;if(e>=-8192&&e<8192)return 2;if(e>=-1048576&&e<1048576)return 3;if(e>=-0x8000000&&e<0x8000000)return 4;if(e>=-0x400000000&&e<0x400000000)return 5;else return 6},E=function(e){if(e<127)return 1;if(e<16383)return 2;if(e<2097151)return 3;if(e<0xfffffff)return 4;if(e<0x7ffffffff)return 5;else if(e<0x3ffffffffff)return 6;else throw Error("EBML varint size not supported "+e)},j=function(){"use strict";function e(r){(0,u._)(this,e),this.writer=r,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap,this.dataOffsets=new WeakMap}return(0,l._)(e,[{key:"writeByte",value:function(e){this.helperView.setUint8(0,e),this.writer.write(this.helper.subarray(0,1))}},{key:"writeFloat32",value:function(e){this.helperView.setFloat32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}},{key:"writeFloat64",value:function(e){this.helperView.setFloat64(0,e,!1),this.writer.write(this.helper)}},{key:"writeUnsignedInt",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T(e),n=0;switch(r){case 6:this.helperView.setUint8(n++,e/0x10000000000|0);case 5:this.helperView.setUint8(n++,e/0x100000000|0);case 4:this.helperView.setUint8(n++,e>>24);case 3:this.helperView.setUint8(n++,e>>16);case 2:this.helperView.setUint8(n++,e>>8);case 1:this.helperView.setUint8(n++,e);break;default:throw Error("Bad unsigned int size "+r)}this.writer.write(this.helper.subarray(0,n))}},{key:"writeUnsignedBigInt",value:function(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:x(e),n=0,a=r-1;a>=0;a--)this.helperView.setUint8(n++,Number(e>>BigInt(8*a)&255n));this.writer.write(this.helper.subarray(0,n))}},{key:"writeSignedInt",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:I(e);e<0&&(e+=Math.pow(2,8*r)),this.writeUnsignedInt(e,r)}},{key:"writeVarInt",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E(e),n=0;switch(r){case 1:this.helperView.setUint8(n++,128|e);break;case 2:this.helperView.setUint8(n++,64|e>>8),this.helperView.setUint8(n++,e);break;case 3:this.helperView.setUint8(n++,32|e>>16),this.helperView.setUint8(n++,e>>8),this.helperView.setUint8(n++,e);break;case 4:this.helperView.setUint8(n++,16|e>>24),this.helperView.setUint8(n++,e>>16),this.helperView.setUint8(n++,e>>8),this.helperView.setUint8(n++,e);break;case 5:this.helperView.setUint8(n++,8|e/0x100000000&7),this.helperView.setUint8(n++,e>>24),this.helperView.setUint8(n++,e>>16),this.helperView.setUint8(n++,e>>8),this.helperView.setUint8(n++,e);break;case 6:this.helperView.setUint8(n++,4|e/0x10000000000&3),this.helperView.setUint8(n++,e/0x100000000|0),this.helperView.setUint8(n++,e>>24),this.helperView.setUint8(n++,e>>16),this.helperView.setUint8(n++,e>>8),this.helperView.setUint8(n++,e);break;default:throw Error("Bad EBML varint size "+r)}this.writer.write(this.helper.subarray(0,n))}},{key:"writeAsciiString",value:function(e){this.writer.write(new Uint8Array(e.split("").map(function(e){return e.charCodeAt(0)})))}},{key:"writeEBML",value:function(e){if(null!==e){var r=!0,n=!1,a=void 0;if(e instanceof Uint8Array)this.writer.write(e);else if(Array.isArray(e))try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var o=i.value;this.writeEBML(o)}}catch(e){n=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(n)throw a}}else if(this.offsets.set(e,this.writer.getPos()),this.writeUnsignedInt(e.id),Array.isArray(e.data)){var c,u=this.writer.getPos(),l=-1===e.size?1:null!=(c=e.size)?c:4;-1===e.size?this.writeByte(255):this.writer.seek(this.writer.getPos()+l);var d=this.writer.getPos();if(this.dataOffsets.set(e,d),this.writeEBML(e.data),-1!==e.size){var h=this.writer.getPos()-d,m=this.writer.getPos();this.writer.seek(u),this.writeVarInt(h,l),this.writer.seek(m)}}else if("number"==typeof e.data){var y,S=null!=(y=e.size)?y:T(e.data);this.writeVarInt(S),this.writeUnsignedInt(e.data,S)}else if("bigint"===(0,f._)(e.data)){var w,E=null!=(w=e.size)?w:x(e.data);this.writeVarInt(E),this.writeUnsignedBigInt(e.data,E)}else if("string"==typeof e.data)this.writeVarInt(e.data.length),this.writeAsciiString(e.data);else if(e.data instanceof Uint8Array)this.writeVarInt(e.data.byteLength,e.size),this.writer.write(e.data);else if(e.data instanceof g)this.writeVarInt(4),this.writeFloat32(e.data.value);else if(e.data instanceof b)this.writeVarInt(8),this.writeFloat64(e.data.value);else if(e.data instanceof k){var j,P=null!=(j=e.size)?j:I(e.data.value);this.writeVarInt(P),this.writeSignedInt(e.data.value,P)}else if(e.data instanceof _){var C=p.textEncoder.encode(e.data.value);this.writeVarInt(C.length),this.writer.write(C)}else(0,p.assertNever)(e.data)}}}]),e}(),P=8,C=2,A=16,B=function(e){var r=(0,m.readU8)(e);if(e.skip(-1),0===r)return null;for(var n=1,a=128;(r&a)==0;)n++,a>>=1;return n},M=function(e){var r=(0,m.readU8)(e);if(0===r)return null;for(var n=1,a=128;(r&a)==0;)n++,a>>=1;for(var i=r&a-1,s=1;s<n;s++)i*=256,i+=(0,m.readU8)(e);return i},D=function(e,r){if(r<1||r>8)throw Error("Bad unsigned int size "+r);for(var n=0,a=0;a<r;a++)n*=256,n+=(0,m.readU8)(e);return n},F=function(e,r){if(r<1)throw Error("Bad unsigned int size "+r);for(var n=0n,a=0;a<r;a++)n<<=8n,n+=BigInt((0,m.readU8)(e));return n},R=function(e,r){var n=D(e,r);return n&1<<8*r-1&&(n-=Math.pow(2,8*r)),n},U=function(e){var r=B(e);return null===r?null:D(e,r)},O=function(e){var r=(0,m.readU8)(e);return 255===r?r=null:(e.skip(-1),0x100000000000000===(r=M(e))&&(r=null)),r},L=function(e){var r=U(e);return null===r?null:{id:r,size:O(e)}},N=function(e,r){for(var n,a=(0,m.readBytes)(e,r),i=0;i<r&&0!==a[i];)i+=1;return(n=String).fromCharCode.apply(n,(0,d._)(a.subarray(0,i)))},V=function(e,r){for(var n=(0,m.readBytes)(e,r),a=0;a<r&&0!==n[a];)a+=1;return p.textDecoder.decode(n.subarray(0,a))},z=function(e,r){if(0===r)return 0;if(4!==r&&8!==r)throw Error("Bad float size "+r);return 4===r?(0,m.readF32Be)(e):(0,m.readF64Be)(e)},H=function(e,r,n,a){return(0,c._)(function(){var i,s,o,c;return(0,h._)(this,function(u){switch(u.label){case 0:i=new Set(n),s=r,u.label=1;case 1:if(!(null===a||s<a))return[3,4];if(!((o=e.requestSliceRange(s,C,A))instanceof Promise))return[3,3];return[4,o];case 2:o=u.sent(),u.label=3;case 3:if(!o||!(c=L(o)))return[3,4];if(i.has(c.id))return[2,{pos:s,found:!0}];return W(c.size),s=o.filePos+c.size,[3,1];case 4:return[2,{pos:null!==a&&a>s?a:s,found:!1}]}})})()},G=function(e,r,n,a){return(0,c._)(function(){var i,s,o,c,u,l;return(0,h._)(this,function(d){switch(d.label){case 0:i=65536,s=new Set(n),o=r,d.label=1;case 1:if(!(o<a))return[3,4];if(!((c=e.requestSliceRange(o,0,Math.min(i,a-o)))instanceof Promise))return[3,3];return[4,c];case 2:c=d.sent(),d.label=3;case 3:if(!c||c.length<P)return[3,4];for(u=0;u<c.length-P;u++){if(c.filePos=o,null!==(l=U(c))&&s.has(l))return[2,o];o++}return[3,1];case 4:return[2,null]}})})()},q={avc:"V_MPEG4/ISO/AVC",hevc:"V_MPEGH/ISO/HEVC",vp8:"V_VP8",vp9:"V_VP9",av1:"V_AV1",aac:"A_AAC",mp3:"A_MPEG/L3",opus:"A_OPUS",vorbis:"A_VORBIS",flac:"A_FLAC","pcm-u8":"A_PCM/INT/LIT","pcm-s16":"A_PCM/INT/LIT","pcm-s16be":"A_PCM/INT/BIG","pcm-s24":"A_PCM/INT/LIT","pcm-s24be":"A_PCM/INT/BIG","pcm-s32":"A_PCM/INT/LIT","pcm-s32be":"A_PCM/INT/BIG","pcm-f32":"A_PCM/FLOAT/IEEE","pcm-f64":"A_PCM/FLOAT/IEEE",webvtt:"S_TEXT/WEBVTT"};function W(e){if(null===e)throw Error("Undefined element size is used in a place where it is not supported.")}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../misc.js":"j7iGm","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kY1ME:[function(e,r,n,a){var i,s,o,c,u,l,d=e("@parcel/transformer-js/src/esmodule-helpers.js");d.defineInteropFlag(n),d.export(n,"MatroskaDemuxer",function(){return D});var f=e("@swc/helpers/cjs/_async_to_generator.cjs"),h=e("@swc/helpers/cjs/_call_super.cjs"),p=e("@swc/helpers/cjs/_class_call_check.cjs"),m=e("@swc/helpers/cjs/_create_class.cjs"),g=e("@swc/helpers/cjs/_inherits.cjs"),b=e("@swc/helpers/cjs/_object_spread.cjs"),k=e("@swc/helpers/cjs/_sliced_to_array.cjs"),_=e("@swc/helpers/cjs/_to_consumable_array.cjs"),y=e("@swc/helpers/cjs/_ts_generator.cjs"),S=e("@swc/helpers/cjs/_ts_values.cjs"),w=e("../codec-data.js"),T=e("../codec.js"),x=e("../demuxer.js"),I=e("../input-track.js"),E=e("../metadata.js"),j=e("../misc.js"),P=e("../packet.js"),C=e("./ebml.js"),A=e("./matroska-misc.js"),B=e("../reader.js");(i=c||(c={}))[i.None=0]="None",i[i.Xiph=1]="Xiph",i[i.FixedSize=2]="FixedSize",i[i.Ebml=3]="Ebml",(s=u||(u={}))[s.Block=1]="Block",s[s.Private=2]="Private",s[s.Next=4]="Next",(o=l||(l={}))[o.Zlib=0]="Zlib",o[o.Bzlib=1]="Bzlib",o[o.lzo1x=2]="lzo1x",o[o.HeaderStripping=3]="HeaderStripping";var M=[{id:C.EBMLId.SeekHead,flag:"seekHeadSeen"},{id:C.EBMLId.Info,flag:"infoSeen"},{id:C.EBMLId.Tracks,flag:"tracksSeen"},{id:C.EBMLId.Cues,flag:"cuesSeen"}],D=function(e){"use strict";function r(e){var n;return(0,p._)(this,r),(n=(0,h._)(this,r,[e])).readMetadataPromise=null,n.segments=[],n.currentSegment=null,n.currentTrack=null,n.currentCluster=null,n.currentBlock=null,n.currentBlockAdditional=null,n.currentCueTime=null,n.currentDecodingInstruction=null,n.currentTagTargetIsMovie=!0,n.currentSimpleTagName=null,n.currentAttachedFile=null,n.isWebM=!1,n.reader=e._reader,n}return(0,g._)(r,e),(0,m._)(r,[{key:"computeDuration",value:function(){return(0,f._)(function(){var e,r;return(0,y._)(this,function(n){switch(n.label){case 0:return[4,this.getTracks()];case 1:return[4,Promise.all(n.sent().map(function(e){return e.computeDuration()}))];case 2:return r=n.sent(),[2,(e=Math).max.apply(e,[0].concat((0,_._)(r)))]}})}).call(this)}},{key:"getTracks",value:function(){return(0,f._)(function(){return(0,y._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.segments.flatMap(function(e){return e.tracks.map(function(e){return e.inputTrack})})]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,f._)(function(){var e;return(0,y._)(this,function(r){switch(r.label){case 0:return[4,this.readMetadata()];case 1:return r.sent(),[4,this.getTracks()];case 2:return[4,Promise.all(r.sent().map(function(e){return e.getCodecParameterString()}))];case 3:return e=r.sent(),[2,(0,A.buildMatroskaMimeType)({isWebM:this.isWebM,hasVideo:this.segments.some(function(e){return e.tracks.some(function(e){var r;return(null==(r=e.info)?void 0:r.type)==="video"})}),hasAudio:this.segments.some(function(e){return e.tracks.some(function(e){var r;return(null==(r=e.info)?void 0:r.type)==="audio"})}),codecStrings:e.filter(Boolean)})]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,f._)(function(){var e,r,n,a,i,s,o,c,u,l,d,f,h,p;return(0,y._)(this,function(m){switch(m.label){case 0:return[4,this.readMetadata()];case 1:m.sent(),e=!0,r=!1,n=void 0,m.label=2;case 2:m.trys.push([2,8,9,10]),a=this.segments[Symbol.iterator](),m.label=3;case 3:if(e=(i=a.next()).done)return[3,7];if((s=i.value).metadataTagsCollected)return[3,6];if(null===this.reader.fileSize)return[3,5];return[4,this.loadSegmentMetadata(s)];case 4:m.sent(),m.label=5;case 5:s.metadataTagsCollected=!0,m.label=6;case 6:return e=!0,[3,3];case 7:return[3,10];case 8:return o=m.sent(),r=!0,n=o,[3,10];case 9:try{e||null==a.return||a.return()}finally{if(r)throw n}return[7];case 10:c={},u=!0,l=!1,d=void 0;try{for(f=this.segments[Symbol.iterator]();!(u=(h=f.next()).done);u=!0)p=h.value,c=(0,b._)({},c,p.metadataTags)}catch(e){l=!0,d=e}finally{try{u||null==f.return||f.return()}finally{if(l)throw d}}return[2,c]}})}).call(this)}},{key:"readMetadata",value:function(){var e;return null!=(e=this.readMetadataPromise)?e:this.readMetadataPromise=(0,f._)(function(){var e,r,n,a,i,s,o,c;return(0,y._)(this,function(u){switch(u.label){case 0:e=0,u.label=1;case 1:if(!((r=this.reader.requestSliceRange(e,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,3];return[4,r];case 2:r=u.sent(),u.label=3;case 3:if(!r||!(n=(0,C.readElementHeader)(r)))return[3,12];if(a=n.id,i=n.size,s=r.filePos,a!==C.EBMLId.EBML)return[3,6];if((0,C.assertDefinedSize)(i),!((o=this.reader.requestSlice(s,i))instanceof Promise))return[3,5];return[4,o];case 4:o=u.sent(),u.label=5;case 5:if(!o)return[3,12];return this.readContiguousElements(o),[3,11];case 6:if(a!==C.EBMLId.Segment)return[3,8];return[4,this.readSegment(s,i)];case 7:if(u.sent(),null===i||null===this.reader.fileSize)return[3,12];return[3,11];case 8:if(a!==C.EBMLId.Cluster)return[3,11];if(null===this.reader.fileSize)return[3,12];if(null!==i)return[3,10];return[4,(0,C.searchForNextElementId)(this.reader,s,C.LEVEL_0_AND_1_EBML_IDS,this.reader.fileSize)];case 9:i=u.sent().pos-s,u.label=10;case 10:(c=(0,j.last)(this.segments))&&(c.elementEndPos=s+i),u.label=11;case 11:return(0,C.assertDefinedSize)(i),e=s+i,[3,1];case 12:return[2]}})}).call(this)}},{key:"readSegment",value:function(e,r){return(0,f._)(function(){var n,a,i,s,o,c,u,l,d,f,h,p,m,g,b,k,_,w,T,x,I,E,j,P,A,B,D,F,R,U,O,L,N,V,z,H,G,q,W,K,X,Q;return(0,y._)(this,function(Z){switch(Z.label){case 0:a=function(){var e,r,a,s,o,c,u,l,d,f,h,p;return(0,y._)(this,function(m){switch(m.label){case 0:if(!((e=n.reader.requestSliceRange(i,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,2];return[4,e];case 1:e=m.sent(),m.label=2;case 2:if(!e)return[2,"break"];if(r=i,!(!(a=(0,C.readElementHeader)(e))||!C.LEVEL_1_EBML_IDS.includes(a.id)&&a.id!==C.EBMLId.Void))return[3,4];return[4,(0,C.resync)(n.reader,r,C.LEVEL_1_EBML_IDS,Math.min(null!=(s=n.currentSegment.elementEndPos)?s:1/0,r+0xa00000))];case 3:if(o=m.sent())return i=o,[2,"continue"];return[2,"break"];case 4:if(c=a.id,u=a.size,l=e.filePos,-1===(d=M.findIndex(function(e){return e.id===c})))return[3,7];if(f=M[d].flag,n.currentSegment[f]=!0,(0,C.assertDefinedSize)(u),!((h=n.reader.requestSlice(l,u))instanceof Promise))return[3,6];return[4,h];case 5:h=m.sent(),m.label=6;case 6:return h&&n.readContiguousElements(h),[3,11];case 7:if(c!==C.EBMLId.Tags&&c!==C.EBMLId.Attachments)return[3,10];if(c===C.EBMLId.Tags?n.currentSegment.tagsSeen=!0:n.currentSegment.attachmentsSeen=!0,(0,C.assertDefinedSize)(u),!((p=n.reader.requestSlice(l,u))instanceof Promise))return[3,9];return[4,p];case 8:p=m.sent(),m.label=9;case 9:return p&&n.readContiguousElements(p),[3,11];case 10:if(c===C.EBMLId.Cluster)return n.currentSegment.clusterSeekStartPos=r,[2,"break"];m.label=11;case 11:if(null===u)return[2,"break"];return i=l+u,[2]}})},this.currentSegment={seekHeadSeen:!1,infoSeen:!1,tracksSeen:!1,cuesSeen:!1,tagsSeen:!1,attachmentsSeen:!1,timestampScale:-1,timestampFactor:-1,duration:-1,seekEntries:[],tracks:[],cuePoints:[],dataStartPos:e,elementEndPos:null===r?null:e+r,clusterSeekStartPos:e,lastReadCluster:null,metadataTags:{},metadataTagsCollected:!1},this.segments.push(this.currentSegment),i=e,Z.label=1;case 1:if(!(null===this.currentSegment.elementEndPos||i<this.currentSegment.elementEndPos))return[3,3];return n=this,[5,(0,S._)(a())];case 2:if("break"===Z.sent())return[3,3];return[3,1];case 3:if(this.currentSegment.seekEntries.sort(function(e,r){return e.segmentPosition-r.segmentPosition}),s=!0,o=!1,c=void 0,null===this.reader.fileSize)return[3,11];Z.label=4;case 4:Z.trys.push([4,9,10,11]),l=function(){var r,n,a,i,s,o,c;return(0,y._)(this,function(l){switch(l.label){case 0:if(r=f.value,!(n=M.find(function(e){return e.id===r.id}))||u.currentSegment[n.flag])return[2,"continue"];if(!((a=u.reader.requestSliceRange(e+r.segmentPosition,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,2];return[4,a];case 1:a=l.sent(),l.label=2;case 2:if(!a||!(i=(0,C.readElementHeader)(a))||(s=i.id,o=i.size,s!==n.id))return[2,"continue"];if((0,C.assertDefinedSize)(o),u.currentSegment[n.flag]=!0,!((c=u.reader.requestSlice(a.filePos,o))instanceof Promise))return[3,4];return[4,c];case 3:c=l.sent(),l.label=4;case 4:if(!c)return[2,"continue"];return u.readContiguousElements(c),[2]}})},d=this.currentSegment.seekEntries[Symbol.iterator](),Z.label=5;case 5:if(s=(f=d.next()).done)return[3,8];return u=this,[5,(0,S._)(l())];case 6:Z.sent(),Z.label=7;case 7:return s=!0,[3,5];case 8:return[3,11];case 9:return h=Z.sent(),o=!0,c=h,[3,11];case 10:try{s||null==d.return||d.return()}finally{if(o)throw c}return[7];case 11:-1===this.currentSegment.timestampScale&&(this.currentSegment.timestampScale=1e6,this.currentSegment.timestampFactor=1e3),this.currentSegment.tracks.sort(function(e,r){return Number(r.disposition.default)-Number(e.disposition.default)}),p=new Map(this.currentSegment.tracks.map(function(e){return[e.id,e]})),m=!0,g=!1,b=void 0;try{for(k=this.currentSegment.cuePoints[Symbol.iterator]();!(m=(_=k.next()).done);m=!0)w=_.value,(T=p.get(w.trackId))&&T.cuePoints.push(w)}catch(e){g=!0,b=e}finally{try{m||null==k.return||k.return()}finally{if(g)throw b}}x=!0,I=!1,E=void 0;try{for(j=this.currentSegment.tracks[Symbol.iterator]();!(x=(P=j.next()).done);x=!0)for((A=P.value).cuePoints.sort(function(e,r){return e.time-r.time}),B=0;B<A.cuePoints.length-1;B++)D=A.cuePoints[B],F=A.cuePoints[B+1],D.time===F.time&&(A.cuePoints.splice(B+1,1),B--)}catch(e){I=!0,E=e}finally{try{x||null==j.return||j.return()}finally{if(I)throw E}}R=null,U=-1/0,O=!0,L=!1,N=void 0;try{for(V=this.currentSegment.tracks[Symbol.iterator]();!(O=(z=V.next()).done);O=!0)(H=z.value).cuePoints.length>U&&(U=H.cuePoints.length,R=H)}catch(e){L=!0,N=e}finally{try{O||null==V.return||V.return()}finally{if(L)throw N}}G=!0,q=!1,W=void 0;try{for(K=this.currentSegment.tracks[Symbol.iterator]();!(G=(X=K.next()).done);G=!0)Q=X.value,0===Q.cuePoints.length&&(Q.cuePoints=R.cuePoints)}catch(e){q=!0,W=e}finally{try{G||null==K.return||K.return()}finally{if(q)throw W}}return this.currentSegment=null,[2]}})}).call(this)}},{key:"readCluster",value:function(e,r){return(0,f._)(function(){var n,a,i,s,o,u,l,d,f,h,p,m,g,b,_,S,w,T,x,I,E,P,A,B,M;return(0,y._)(this,function(y){switch(y.label){case 0:if((null==(n=r.lastReadCluster)?void 0:n.elementStartPos)===e)return[2,r.lastReadCluster];if(!((a=this.reader.requestSliceRange(e,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,2];return[4,a];case 1:a=y.sent(),y.label=2;case 2:if((0,j.assert)(a),i=e,s=(0,C.readElementHeader)(a),(0,j.assert)(s),o=s.id,(0,j.assert)(o===C.EBMLId.Cluster),u=s.size,l=a.filePos,null!==u)return[3,4];return[4,(0,C.searchForNextElementId)(this.reader,l,C.LEVEL_0_AND_1_EBML_IDS,r.elementEndPos)];case 3:u=y.sent().pos-l,y.label=4;case 4:if(!((d=this.reader.requestSlice(l,u))instanceof Promise))return[3,6];return[4,d];case 5:d=y.sent(),y.label=6;case 6:f={segment:r,elementStartPos:i,elementEndPos:l+u,dataStartPos:l,timestamp:-1,trackData:new Map},this.currentCluster=f,d&&(f.elementEndPos=this.readContiguousElements(d,C.LEVEL_0_AND_1_EBML_IDS)),h=!0,p=!1,m=void 0;try{for(g=f.trackData[Symbol.iterator]();!(h=(b=g.next()).done);h=!0){for(S=(_=(0,k._)(b.value,2)[1]).track,(0,j.assert)(_.blocks.length>0),w=!1,T=0;T<_.blocks.length;T++)x=_.blocks[T],x.timestamp+=f.timestamp,w||(w=x.lacing!==c.None);for(I=0,_.presentationTimestamps=_.blocks.map(function(e,r){return{timestamp:e.timestamp,blockIndex:r}}).sort(function(e,r){return e.timestamp-r.timestamp});I<_.presentationTimestamps.length;I++)E=_.presentationTimestamps[I],P=_.blocks[E.blockIndex],null===_.firstKeyFrameTimestamp&&P.isKeyFrame&&(_.firstKeyFrameTimestamp=P.timestamp),I<_.presentationTimestamps.length-1?P.duration=_.presentationTimestamps[I+1].timestamp-P.timestamp:0===P.duration&&null!=S.defaultDuration&&P.lacing===c.None&&(P.duration=S.defaultDuration);w&&(this.expandLacedBlocks(_.blocks,S),_.presentationTimestamps=_.blocks.map(function(e,r){return{timestamp:e.timestamp,blockIndex:r}}).sort(function(e,r){return e.timestamp-r.timestamp})),A=_.blocks[_.presentationTimestamps[0].blockIndex],B=_.blocks[(0,j.last)(_.presentationTimestamps).blockIndex],_.startTimestamp=A.timestamp,_.endTimestamp=B.timestamp+B.duration,M=(0,j.binarySearchLessOrEqual)(S.clusterPositionCache,_.startTimestamp,function(e){return e.startTimestamp}),(-1===M||S.clusterPositionCache[M].elementStartPos!==i)&&S.clusterPositionCache.splice(M+1,0,{elementStartPos:f.elementStartPos,startTimestamp:_.startTimestamp})}}catch(e){p=!0,m=e}finally{try{h||null==g.return||g.return()}finally{if(p)throw m}}return r.lastReadCluster=f,[2,f]}})}).call(this)}},{key:"getTrackDataInCluster",value:function(e,r){var n=e.trackData.get(r);if(!n){var a=e.segment.tracks.find(function(e){return e.id===r});if(!a)return null;n={track:a,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,blocks:[],presentationTimestamps:[]},e.trackData.set(r,n)}return n}},{key:"expandLacedBlocks",value:function(e,r){for(var n=0;n<e.length;n++){var a,i=e[n];if(i.lacing!==c.None){i.decoded||(i.data=this.decodeBlockData(r,i.data),i.decoded=!0);var s=B.FileSlice.tempFromBytes(i.data),o=[],u=(0,B.readU8)(s)+1;switch(i.lacing){case c.Xiph:for(var l=0,d=0;d<u-1;d++)for(var f=0;s.bufferPos<s.length;){var h=(0,B.readU8)(s);if(f+=h,h<255){o.push(f),l+=f;break}}o.push(s.length-(s.bufferPos+l));break;case c.FixedSize:for(var p=Math.floor((s.length-1)/u),m=0;m<u;m++)o.push(p);break;case c.Ebml:var g=(0,C.readVarInt)(s);(0,j.assert)(null!==g);var b=g;o.push(b);for(var k=b,_=1;_<u-1;_++){var y=s.bufferPos,S=(0,C.readVarInt)(s);(0,j.assert)(null!==S),b+=S-((1<<7*(s.bufferPos-y)-1)-1),o.push(b),k+=b}o.push(s.length-(s.bufferPos+k));break;default:(0,j.assert)(!1)}(0,j.assert)(o.length===u),e.splice(n,1);for(var w=i.duration||u*(null!=(a=r.defaultDuration)?a:0),T=0;T<u;T++){var x=o[T],I=(0,B.readBytes)(s,x),E=i.timestamp+w*T/u,P=w/u;e.splice(n+T,0,{timestamp:E,duration:P,isKeyFrame:i.isKeyFrame,data:I,lacing:c.None,decoded:!0,mainAdditional:i.mainAdditional})}n+=u,n--}}}},{key:"loadSegmentMetadata",value:function(e){return(0,f._)(function(){var r,n,a,i,s,o,c,u,l,d,f;return(0,y._)(this,function(h){switch(h.label){case 0:r=!0,n=!1,a=void 0,h.label=1;case 1:h.trys.push([1,9,10,11]),i=e.seekEntries[Symbol.iterator](),h.label=2;case 2:if(r=(s=i.next()).done)return[3,8];if(((o=s.value).id!==C.EBMLId.Tags||e.tagsSeen)&&(o.id!==C.EBMLId.Attachments||e.attachmentsSeen))return[3,7];if(!((c=this.reader.requestSliceRange(e.dataStartPos+o.segmentPosition,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,4];return[4,c];case 3:c=h.sent(),h.label=4;case 4:if(!c||!(u=(0,C.readElementHeader)(c))||u.id!==o.id)return[3,7];if(l=u.size,(0,C.assertDefinedSize)(l),(0,j.assert)(!this.currentSegment),this.currentSegment=e,!((d=this.reader.requestSlice(c.filePos,l))instanceof Promise))return[3,6];return[4,d];case 5:d=h.sent(),h.label=6;case 6:d&&this.readContiguousElements(d),this.currentSegment=null,o.id===C.EBMLId.Tags?e.tagsSeen=!0:o.id===C.EBMLId.Attachments&&(e.attachmentsSeen=!0),h.label=7;case 7:return r=!0,[3,2];case 8:return[3,11];case 9:return f=h.sent(),n=!0,a=f,[3,11];case 10:try{r||null==i.return||i.return()}finally{if(n)throw a}return[7];case 11:return[2]}})}).call(this)}},{key:"readContiguousElements",value:function(e,r){for(var n=e.filePos;e.filePos-n<=e.length-C.MIN_HEADER_SIZE;){var a=e.filePos;if(!this.traverseElement(e,r))return a}return e.filePos}},{key:"traverseElement",value:function(e,r){var n,a,i,s,o=(0,C.readElementHeader)(e);if(!o||r&&r.includes(o.id))return!1;var c=o.id,d=o.size,f=e.filePos;switch((0,C.assertDefinedSize)(d),c){case C.EBMLId.DocType:this.isWebM="webm"===(0,C.readAsciiString)(e,d);break;case C.EBMLId.Seek:if(!this.currentSegment)break;var h={id:-1,segmentPosition:-1};this.currentSegment.seekEntries.push(h),this.readContiguousElements(e.slice(f,d)),(-1===h.id||-1===h.segmentPosition)&&this.currentSegment.seekEntries.pop();break;case C.EBMLId.SeekID:var p,m=null==(p=this.currentSegment)?void 0:p.seekEntries[this.currentSegment.seekEntries.length-1];if(!m)break;m.id=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.SeekPosition:var g,k=null==(g=this.currentSegment)?void 0:g.seekEntries[this.currentSegment.seekEntries.length-1];if(!k)break;k.segmentPosition=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.TimestampScale:if(!this.currentSegment)break;this.currentSegment.timestampScale=(0,C.readUnsignedInt)(e,d),this.currentSegment.timestampFactor=1e9/this.currentSegment.timestampScale;break;case C.EBMLId.Duration:if(!this.currentSegment)break;this.currentSegment.duration=(0,C.readFloat)(e,d);break;case C.EBMLId.TrackEntry:if(!this.currentSegment)break;if(this.currentTrack={id:-1,segment:this.currentSegment,demuxer:this,clusterPositionCache:[],cuePoints:[],disposition:(0,b._)({},E.DEFAULT_TRACK_DISPOSITION),inputTrack:null,codecId:null,codecPrivate:null,defaultDuration:null,name:null,languageCode:j.UNDETERMINED_LANGUAGE,decodingInstructions:[],info:null},this.readContiguousElements(e.slice(f,d)),this.currentTrack.decodingInstructions.some(function(e){var r;return(null==(r=e.data)?void 0:r.type)!=="decompress"||e.scope!==u.Block||e.data.algorithm!==l.HeaderStripping})&&(console.warn("Track #".concat(this.currentTrack.id," has an unsupported content encoding; dropping.")),this.currentTrack=null),this.currentTrack&&-1!==this.currentTrack.id&&this.currentTrack.codecId&&this.currentTrack.info){var _=this.currentTrack.codecId.indexOf("/"),y=-1===_?this.currentTrack.codecId:this.currentTrack.codecId.slice(0,_);if("video"===this.currentTrack.info.type&&-1!==this.currentTrack.info.width&&-1!==this.currentTrack.info.height){this.currentTrack.codecId===C.CODEC_STRING_MAP.avc?(this.currentTrack.info.codec="avc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===C.CODEC_STRING_MAP.hevc?(this.currentTrack.info.codec="hevc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):y===C.CODEC_STRING_MAP.vp8?this.currentTrack.info.codec="vp8":y===C.CODEC_STRING_MAP.vp9?this.currentTrack.info.codec="vp9":y===C.CODEC_STRING_MAP.av1&&(this.currentTrack.info.codec="av1");var S=this.currentTrack,w=new(0,I.InputVideoTrack)(this.input,new R(S));this.currentTrack.inputTrack=w,this.currentSegment.tracks.push(this.currentTrack)}else if("audio"===this.currentTrack.info.type&&-1!==this.currentTrack.info.numberOfChannels&&-1!==this.currentTrack.info.sampleRate){y===C.CODEC_STRING_MAP.aac?(this.currentTrack.info.codec="aac",this.currentTrack.info.aacCodecInfo={isMpeg2:this.currentTrack.codecId.includes("MPEG2")},this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===C.CODEC_STRING_MAP.mp3?this.currentTrack.info.codec="mp3":y===C.CODEC_STRING_MAP.opus?(this.currentTrack.info.codec="opus",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate,this.currentTrack.info.sampleRate=T.OPUS_SAMPLE_RATE):y===C.CODEC_STRING_MAP.vorbis?(this.currentTrack.info.codec="vorbis",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):y===C.CODEC_STRING_MAP.flac?(this.currentTrack.info.codec="flac",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):"A_PCM/INT/LIT"===this.currentTrack.codecId?8===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-u8":16===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-s16":24===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-s24":32===this.currentTrack.info.bitDepth&&(this.currentTrack.info.codec="pcm-s32"):"A_PCM/INT/BIG"===this.currentTrack.codecId?8===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-u8":16===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-s16be":24===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-s24be":32===this.currentTrack.info.bitDepth&&(this.currentTrack.info.codec="pcm-s32be"):"A_PCM/FLOAT/IEEE"===this.currentTrack.codecId&&(32===this.currentTrack.info.bitDepth?this.currentTrack.info.codec="pcm-f32":64===this.currentTrack.info.bitDepth&&(this.currentTrack.info.codec="pcm-f64"));var x=this.currentTrack,P=new(0,I.InputAudioTrack)(this.input,new U(x));this.currentTrack.inputTrack=P,this.currentSegment.tracks.push(this.currentTrack)}}this.currentTrack=null;break;case C.EBMLId.TrackNumber:if(!this.currentTrack)break;this.currentTrack.id=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.TrackType:if(!this.currentTrack)break;var A=(0,C.readUnsignedInt)(e,d);1===A?this.currentTrack.info={type:"video",width:-1,height:-1,rotation:0,codec:null,codecDescription:null,colorSpace:null,alphaMode:!1}:2===A&&(this.currentTrack.info={type:"audio",numberOfChannels:-1,sampleRate:-1,bitDepth:-1,codec:null,codecDescription:null,aacCodecInfo:null});break;case C.EBMLId.FlagEnabled:if(!this.currentTrack)break;(0,C.readUnsignedInt)(e,d)||(this.currentSegment.tracks.pop(),this.currentTrack=null);break;case C.EBMLId.FlagDefault:if(!this.currentTrack)break;this.currentTrack.disposition.default=!!(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.FlagForced:if(!this.currentTrack)break;this.currentTrack.disposition.forced=!!(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.FlagOriginal:if(!this.currentTrack)break;this.currentTrack.disposition.original=!!(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.FlagHearingImpaired:if(!this.currentTrack)break;this.currentTrack.disposition.hearingImpaired=!!(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.FlagVisualImpaired:if(!this.currentTrack)break;this.currentTrack.disposition.visuallyImpaired=!!(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.FlagCommentary:if(!this.currentTrack)break;this.currentTrack.disposition.commentary=!!(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.CodecID:if(!this.currentTrack)break;this.currentTrack.codecId=(0,C.readAsciiString)(e,d);break;case C.EBMLId.CodecPrivate:if(!this.currentTrack)break;this.currentTrack.codecPrivate=(0,B.readBytes)(e,d);break;case C.EBMLId.DefaultDuration:if(!this.currentTrack)break;this.currentTrack.defaultDuration=this.currentTrack.segment.timestampFactor*(0,C.readUnsignedInt)(e,d)/1e9;break;case C.EBMLId.Name:if(!this.currentTrack)break;this.currentTrack.name=(0,C.readUnicodeString)(e,d);break;case C.EBMLId.Language:if(!this.currentTrack||this.currentTrack.languageCode!==j.UNDETERMINED_LANGUAGE)break;this.currentTrack.languageCode=(0,C.readAsciiString)(e,d),(0,j.isIso639Dash2LanguageCode)(this.currentTrack.languageCode)||(this.currentTrack.languageCode=j.UNDETERMINED_LANGUAGE);break;case C.EBMLId.LanguageBCP47:if(!this.currentTrack)break;var M=(0,C.readAsciiString)(e,d).split("-")[0];M?this.currentTrack.languageCode=M:this.currentTrack.languageCode=j.UNDETERMINED_LANGUAGE;break;case C.EBMLId.Video:if((null==(F=this.currentTrack)||null==(D=F.info)?void 0:D.type)!=="video")break;this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.PixelWidth:if((null==(L=this.currentTrack)||null==(O=L.info)?void 0:O.type)!=="video")break;this.currentTrack.info.width=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.PixelHeight:if((null==(V=this.currentTrack)||null==(N=V.info)?void 0:N.type)!=="video")break;this.currentTrack.info.height=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.AlphaMode:if((null==(H=this.currentTrack)||null==(z=H.info)?void 0:z.type)!=="video")break;this.currentTrack.info.alphaMode=1===(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.Colour:if((null==(q=this.currentTrack)||null==(G=q.info)?void 0:G.type)!=="video")break;this.currentTrack.info.colorSpace={},this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.MatrixCoefficients:if((null==(K=this.currentTrack)||null==(W=K.info)?void 0:W.type)!=="video"||!this.currentTrack.info.colorSpace)break;var D,F,O,L,N,V,z,H,G,q,W,K,X,Q=(0,C.readUnsignedInt)(e,d),Z=null!=(X=j.MATRIX_COEFFICIENTS_MAP_INVERSE[Q])?X:null;this.currentTrack.info.colorSpace.matrix=Z;break;case C.EBMLId.Range:if((null==(J=this.currentTrack)||null==(Y=J.info)?void 0:Y.type)!=="video"||!this.currentTrack.info.colorSpace)break;this.currentTrack.info.colorSpace.fullRange=2===(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.TransferCharacteristics:if((null==(ee=this.currentTrack)||null==($=ee.info)?void 0:$.type)!=="video"||!this.currentTrack.info.colorSpace)break;var Y,J,$,ee,et,er=(0,C.readUnsignedInt)(e,d),en=null!=(et=j.TRANSFER_CHARACTERISTICS_MAP_INVERSE[er])?et:null;this.currentTrack.info.colorSpace.transfer=en;break;case C.EBMLId.Primaries:if((null==(ei=this.currentTrack)||null==(ea=ei.info)?void 0:ea.type)!=="video"||!this.currentTrack.info.colorSpace)break;var ea,ei,es,eo=(0,C.readUnsignedInt)(e,d),ec=null!=(es=j.COLOR_PRIMARIES_MAP_INVERSE[eo])?es:null;this.currentTrack.info.colorSpace.primaries=ec;break;case C.EBMLId.Projection:if((null==(el=this.currentTrack)||null==(eu=el.info)?void 0:eu.type)!=="video")break;this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.ProjectionPoseRoll:if((null==(ef=this.currentTrack)||null==(ed=ef.info)?void 0:ed.type)!=="video")break;var eu,el,ed,ef,eh=(0,C.readFloat)(e,d);try{this.currentTrack.info.rotation=(0,j.normalizeRotation)(-eh)}catch(e){}break;case C.EBMLId.Audio:if((null==(eg=this.currentTrack)||null==(em=eg.info)?void 0:em.type)!=="audio")break;this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.SamplingFrequency:if((null==(eb=this.currentTrack)||null==(ev=eb.info)?void 0:ev.type)!=="audio")break;this.currentTrack.info.sampleRate=(0,C.readFloat)(e,d);break;case C.EBMLId.Channels:if((null==(e_=this.currentTrack)||null==(ek=e_.info)?void 0:ek.type)!=="audio")break;this.currentTrack.info.numberOfChannels=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.BitDepth:if((null==(eS=this.currentTrack)||null==(ey=eS.info)?void 0:ey.type)!=="audio")break;this.currentTrack.info.bitDepth=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.CuePoint:if(!this.currentSegment)break;this.readContiguousElements(e.slice(f,d)),this.currentCueTime=null;break;case C.EBMLId.CueTime:this.currentCueTime=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.CueTrackPositions:if(null===this.currentCueTime)break;(0,j.assert)(this.currentSegment);var ep={time:this.currentCueTime,trackId:-1,clusterPosition:-1};this.currentSegment.cuePoints.push(ep),this.readContiguousElements(e.slice(f,d)),(-1===ep.trackId||-1===ep.clusterPosition)&&this.currentSegment.cuePoints.pop();break;case C.EBMLId.CueTrack:var em,eg,ev,eb,ek,e_,ey,eS,ew,eT=null==(ew=this.currentSegment)?void 0:ew.cuePoints[this.currentSegment.cuePoints.length-1];if(!eT)break;eT.trackId=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.CueClusterPosition:var ex,eI=null==(ex=this.currentSegment)?void 0:ex.cuePoints[this.currentSegment.cuePoints.length-1];if(!eI)break;(0,j.assert)(this.currentSegment),eI.clusterPosition=this.currentSegment.dataStartPos+(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.Timestamp:if(!this.currentCluster)break;this.currentCluster.timestamp=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.SimpleBlock:if(!this.currentCluster)break;var eE,ej=(0,C.readVarInt)(e);if(null===ej)break;var eP=this.getTrackDataInCluster(this.currentCluster,ej);if(!eP)break;var eC=(0,B.readI16Be)(e),eA=(0,B.readU8)(e),eB=!!(128&eA);(null==(eE=eP.track.info)?void 0:eE.type)==="audio"&&eP.track.info.codec&&(eB=!0);var eM=(0,B.readBytes)(e,d-(e.filePos-f)),eD=eP.track.decodingInstructions.length>0;eP.blocks.push({timestamp:eC,duration:0,isKeyFrame:eB,data:eM,lacing:eA>>1&3,decoded:!eD,mainAdditional:null});break;case C.EBMLId.BlockGroup:if(!this.currentCluster)break;this.readContiguousElements(e.slice(f,d)),this.currentBlock=null;break;case C.EBMLId.Block:if(!this.currentCluster)break;var eF=(0,C.readVarInt)(e);if(null===eF)break;var eR=this.getTrackDataInCluster(this.currentCluster,eF);if(!eR)break;var eU=(0,B.readI16Be)(e),eO=(0,B.readU8)(e),eL=(0,B.readBytes)(e,d-(e.filePos-f)),eN=eR.track.decodingInstructions.length>0;this.currentBlock={timestamp:eU,duration:0,isKeyFrame:!0,data:eL,lacing:eO>>1&3,decoded:!eN,mainAdditional:null},eR.blocks.push(this.currentBlock);break;case C.EBMLId.BlockAdditions:this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.BlockMore:if(!this.currentBlock)break;this.currentBlockAdditional={addId:1,data:null},this.readContiguousElements(e.slice(f,d)),this.currentBlockAdditional.data&&1===this.currentBlockAdditional.addId&&(this.currentBlock.mainAdditional=this.currentBlockAdditional.data),this.currentBlockAdditional=null;break;case C.EBMLId.BlockAdditional:if(!this.currentBlockAdditional)break;this.currentBlockAdditional.data=(0,B.readBytes)(e,d);break;case C.EBMLId.BlockAddID:if(!this.currentBlockAdditional)break;this.currentBlockAdditional.addId=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.BlockDuration:if(!this.currentBlock)break;this.currentBlock.duration=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.ReferenceBlock:if(!this.currentBlock)break;this.currentBlock.isKeyFrame=!1;break;case C.EBMLId.Tag:this.currentTagTargetIsMovie=!0,this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.Targets:this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.TargetTypeValue:50!==(0,C.readUnsignedInt)(e,d)&&(this.currentTagTargetIsMovie=!1);break;case C.EBMLId.TagTrackUID:case C.EBMLId.TagEditionUID:case C.EBMLId.TagChapterUID:case C.EBMLId.TagAttachmentUID:this.currentTagTargetIsMovie=!1;break;case C.EBMLId.SimpleTag:if(!this.currentTagTargetIsMovie)break;this.currentSimpleTagName=null,this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.TagName:this.currentSimpleTagName=(0,C.readUnicodeString)(e,d);break;case C.EBMLId.TagString:if(!this.currentSimpleTagName)break;var eV=(0,C.readUnicodeString)(e,d);this.processTagValue(this.currentSimpleTagName,eV);break;case C.EBMLId.TagBinary:if(!this.currentSimpleTagName)break;var ez=(0,B.readBytes)(e,d);this.processTagValue(this.currentSimpleTagName,ez);break;case C.EBMLId.AttachedFile:if(!this.currentSegment)break;this.currentAttachedFile={fileUid:null,fileName:null,fileMediaType:null,fileData:null,fileDescription:null},this.readContiguousElements(e.slice(f,d));var eH=this.currentSegment.metadataTags;if(this.currentAttachedFile.fileUid&&this.currentAttachedFile.fileData&&(null!=eH.raw||(eH.raw={}),eH.raw[this.currentAttachedFile.fileUid.toString()]=new(0,E.AttachedFile)(this.currentAttachedFile.fileData,null!=(eq=this.currentAttachedFile.fileMediaType)?eq:void 0,null!=(eW=this.currentAttachedFile.fileName)?eW:void 0,null!=(eK=this.currentAttachedFile.fileDescription)?eK:void 0)),(null==(eG=this.currentAttachedFile.fileMediaType)?void 0:eG.startsWith("image/"))&&this.currentAttachedFile.fileData){var eG,eq,eW,eK,eX,eQ,eZ=this.currentAttachedFile.fileName,eY="unknown";if(eZ){var eJ=eZ.toLowerCase();eJ.startsWith("cover.")?eY="coverFront":eJ.startsWith("back.")&&(eY="coverBack")}null!=eH.images||(eH.images=[]),eH.images.push({data:this.currentAttachedFile.fileData,mimeType:this.currentAttachedFile.fileMediaType,kind:eY,name:null!=(eX=this.currentAttachedFile.fileName)?eX:void 0,description:null!=(eQ=this.currentAttachedFile.fileDescription)?eQ:void 0})}this.currentAttachedFile=null;break;case C.EBMLId.FileUID:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileUid=(0,C.readUnsignedBigInt)(e,d);break;case C.EBMLId.FileName:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileName=(0,C.readUnicodeString)(e,d);break;case C.EBMLId.FileMediaType:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileMediaType=(0,C.readAsciiString)(e,d);break;case C.EBMLId.FileData:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileData=(0,B.readBytes)(e,d);break;case C.EBMLId.FileDescription:if(!this.currentAttachedFile)break;this.currentAttachedFile.fileDescription=(0,C.readUnicodeString)(e,d);break;case C.EBMLId.ContentEncodings:if(!this.currentTrack)break;this.readContiguousElements(e.slice(f,d)),this.currentTrack.decodingInstructions.sort(function(e,r){return r.order-e.order});break;case C.EBMLId.ContentEncoding:this.currentDecodingInstruction={order:0,scope:u.Block,data:null},this.readContiguousElements(e.slice(f,d)),this.currentDecodingInstruction.data&&this.currentTrack.decodingInstructions.push(this.currentDecodingInstruction),this.currentDecodingInstruction=null;break;case C.EBMLId.ContentEncodingOrder:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.order=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.ContentEncodingScope:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.scope=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.ContentCompression:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decompress",algorithm:l.Zlib,settings:null},this.readContiguousElements(e.slice(f,d));break;case C.EBMLId.ContentCompAlgo:if((null==(a=this.currentDecodingInstruction)||null==(n=a.data)?void 0:n.type)!=="decompress")break;this.currentDecodingInstruction.data.algorithm=(0,C.readUnsignedInt)(e,d);break;case C.EBMLId.ContentCompSettings:if((null==(s=this.currentDecodingInstruction)||null==(i=s.data)?void 0:i.type)!=="decompress")break;this.currentDecodingInstruction.data.settings=(0,B.readBytes)(e,d);break;case C.EBMLId.ContentEncryption:if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decrypt"}}return e.filePos=f+d,!0}},{key:"decodeBlockData",value:function(e,r){(0,j.assert)(e.decodingInstructions.length>0);var n=r,a=!0,i=!1,s=void 0;try{for(var o,c=e.decodingInstructions[Symbol.iterator]();!(a=(o=c.next()).done);a=!0){var u=o.value;if((0,j.assert)(u.data),"decompress"===u.data.type&&u.data.algorithm===l.HeaderStripping&&u.data.settings&&u.data.settings.length>0){var d=u.data.settings,f=new Uint8Array(d.length+n.length);f.set(d,0),f.set(n,d.length),n=f}}}catch(e){i=!0,s=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw s}}return n}},{key:"processTagValue",value:function(e,r){if(null==(a=this.currentSegment)?void 0:a.metadataTags){var n=this.currentSegment.metadataTags;if(null!=n.raw||(n.raw={}),null!=(i=n.raw)[e]||(i[e]=r),"string"==typeof r)switch(e.toLowerCase()){case"title":null!=n.title||(n.title=r);break;case"description":null!=n.description||(n.description=r);break;case"artist":null!=n.artist||(n.artist=r);break;case"album":null!=n.album||(n.album=r);break;case"album_artist":null!=n.albumArtist||(n.albumArtist=r);break;case"genre":null!=n.genre||(n.genre=r);break;case"comment":null!=n.comment||(n.comment=r);break;case"lyrics":null!=n.lyrics||(n.lyrics=r);break;case"date":var a,i,s=new Date(r);Number.isNaN(s.getTime())||null!=n.date||(n.date=s);break;case"track_number":case"part_number":var o=r.split("/"),c=Number.parseInt(o[0],10),u=o[1]&&Number.parseInt(o[1],10);Number.isInteger(c)&&c>0&&(null!=n.trackNumber||(n.trackNumber=c)),u&&Number.isInteger(u)&&u>0&&(null!=n.tracksTotal||(n.tracksTotal=u));break;case"disc_number":case"disc":var l=r.split("/"),d=Number.parseInt(l[0],10),f=l[1]&&Number.parseInt(l[1],10);Number.isInteger(d)&&d>0&&(null!=n.discNumber||(n.discNumber=d)),f&&Number.isInteger(f)&&f>0&&(null!=n.discsTotal||(n.discsTotal=f))}}}}]),r}(x.Demuxer),F=function(){"use strict";function e(r){(0,p._)(this,e),this.internalTrack=r,this.packetToClusterLocation=new WeakMap}return(0,m._)(e,[{key:"getId",value:function(){return this.internalTrack.id}},{key:"getCodec",value:function(){throw Error("Not implemented on base class.")}},{key:"getInternalCodecId",value:function(){return this.internalTrack.codecId}},{key:"computeDuration",value:function(){return(0,f._)(function(){var e,r,n;return(0,y._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"getName",value:function(){return this.internalTrack.name}},{key:"getLanguageCode",value:function(){return this.internalTrack.languageCode}},{key:"getFirstTimestamp",value:function(){return(0,f._)(function(){var e,r;return(0,y._)(this,function(n){switch(n.label){case 0:return[4,this.getFirstPacket({metadataOnly:!0})];case 1:return[2,null!=(r=null==(e=n.sent())?void 0:e.timestamp)?r:0]}})}).call(this)}},{key:"getTimeResolution",value:function(){return this.internalTrack.segment.timestampFactor}},{key:"getDisposition",value:function(){return this.internalTrack.disposition}},{key:"getFirstPacket",value:function(e){return(0,f._)(function(){var r;return(0,y._)(this,function(n){return r=this,[2,this.performClusterLookup(null,function(e){return e.trackData.get(r.internalTrack.id)?{blockIndex:0,correctBlockFound:!0}:{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,e)]})}).call(this)}},{key:"intoTimescale",value:function(e){return(0,j.roundIfAlmostInteger)(e*this.internalTrack.segment.timestampFactor)}},{key:"getPacket",value:function(e,r){return(0,f._)(function(){var n,a;return(0,y._)(this,function(i){return n=this,a=this.intoTimescale(e),[2,this.performClusterLookup(null,function(e){var r=e.trackData.get(n.internalTrack.id);if(!r)return{blockIndex:-1,correctBlockFound:!1};var i=(0,j.binarySearchLessOrEqual)(r.presentationTimestamps,a,function(e){return e.timestamp});return{blockIndex:-1!==i?r.presentationTimestamps[i].blockIndex:-1,correctBlockFound:-1!==i&&a<r.endTimestamp}},a,a,r)]})}).call(this)}},{key:"getNextPacket",value:function(e,r){return(0,f._)(function(){var n,a;return(0,y._)(this,function(i){if(n=this,void 0===(a=this.packetToClusterLocation.get(e)))throw Error("Packet was not created from this track.");return[2,this.performClusterLookup(a.cluster,function(e){if(e===a.cluster){var r=e.trackData.get(n.internalTrack.id);if(a.blockIndex+1<r.blocks.length)return{blockIndex:a.blockIndex+1,correctBlockFound:!0}}else if(e.trackData.get(n.internalTrack.id))return{blockIndex:0,correctBlockFound:!0};return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,r)]})}).call(this)}},{key:"getKeyPacket",value:function(e,r){return(0,f._)(function(){var n,a;return(0,y._)(this,function(i){return n=this,a=this.intoTimescale(e),[2,this.performClusterLookup(null,function(e){var r=e.trackData.get(n.internalTrack.id);if(!r)return{blockIndex:-1,correctBlockFound:!1};var i=(0,j.findLastIndex)(r.presentationTimestamps,function(e){return r.blocks[e.blockIndex].isKeyFrame&&e.timestamp<=a});return{blockIndex:-1!==i?r.presentationTimestamps[i].blockIndex:-1,correctBlockFound:-1!==i&&a<r.endTimestamp}},a,a,r)]})}).call(this)}},{key:"getNextKeyPacket",value:function(e,r){return(0,f._)(function(){var n,a;return(0,y._)(this,function(i){if(n=this,void 0===(a=this.packetToClusterLocation.get(e)))throw Error("Packet was not created from this track.");return[2,this.performClusterLookup(a.cluster,function(e){if(e===a.cluster){var r=e.trackData.get(n.internalTrack.id).blocks.findIndex(function(e,r){return e.isKeyFrame&&r>a.blockIndex});if(-1!==r)return{blockIndex:r,correctBlockFound:!0}}else{var i=e.trackData.get(n.internalTrack.id);if(i&&null!==i.firstKeyFrameTimestamp){var s=i.blocks.findIndex(function(e){return e.isKeyFrame});return(0,j.assert)(-1!==s),{blockIndex:s,correctBlockFound:!0}}}return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,r)]})}).call(this)}},{key:"fetchPacketInCluster",value:function(e,r,n){return(0,f._)(function(){var a,i,s,o,c,u,l;return(0,y._)(this,function(d){return -1===r?[2,null]:(i=e.trackData.get(this.internalTrack.id).blocks[r],(0,j.assert)(i),i.decoded||(i.data=this.internalTrack.demuxer.decodeBlockData(this.internalTrack,i.data),i.decoded=!0),s=n.metadataOnly?P.PLACEHOLDER_DATA:i.data,o=i.timestamp/this.internalTrack.segment.timestampFactor,c=i.duration/this.internalTrack.segment.timestampFactor,u={},i.mainAdditional&&(null==(a=this.internalTrack.info)?void 0:a.type)==="video"&&this.internalTrack.info.alphaMode&&(u.alpha=n.metadataOnly?P.PLACEHOLDER_DATA:i.mainAdditional,u.alphaByteLength=i.mainAdditional.byteLength),l=new(0,P.EncodedPacket)(s,i.isKeyFrame?"key":"delta",o,c,e.dataStartPos+r,i.data.byteLength,u),this.packetToClusterLocation.set(l,{cluster:e,blockIndex:r}),[2,l])})}).call(this)}},{key:"performClusterLookup",value:function(e,r,n,a,i){return(0,f._)(function(){var s,o,c,u,l,d,f,h,p,m,g,b,k,_,S,w,T,x,I,E,P,A,B,M,D,F,R,U,O,L,N,V;return(0,y._)(this,function(y){switch(y.label){case 0:if(o=(s=this.internalTrack).demuxer,c=s.segment,u=null,l=null,d=-1,e){if(h=(f=r(e)).blockIndex,f.correctBlockFound)return[2,this.fetchPacketInCluster(e,h,i)];-1!==h&&(l=e,d=h)}m=-1!==(p=(0,j.binarySearchLessOrEqual)(this.internalTrack.cuePoints,n,function(e){return e.time}))?this.internalTrack.cuePoints[p]:null,b=-1!==(g=(0,j.binarySearchLessOrEqual)(this.internalTrack.clusterPositionCache,n,function(e){return e.startTimestamp}))?this.internalTrack.clusterPositionCache[g]:null,S=Math.max(null!=(k=null==m?void 0:m.clusterPosition)?k:0,null!=(_=null==b?void 0:b.elementStartPos)?_:0)||null,e?null===S||e.elementStartPos>=S?(w=e.elementEndPos,u=e):w=S:w=null!=S?S:c.clusterSeekStartPos,y.label=1;case 1:if(!(null===c.elementEndPos||w<=c.elementEndPos-C.MIN_HEADER_SIZE)||u&&(T=u.trackData.get(this.internalTrack.id))&&T.startTimestamp>a)return[3,13];if(!((x=o.reader.requestSliceRange(w,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,3];return[4,x];case 2:x=y.sent(),y.label=3;case 3:if(!x)return[3,13];if(I=w,!(!(E=(0,C.readElementHeader)(x))||!C.LEVEL_1_EBML_IDS.includes(E.id)&&E.id!==C.EBMLId.Void))return[3,5];return[4,(0,C.resync)(o.reader,I,C.LEVEL_1_EBML_IDS,Math.min(null!=(P=c.elementEndPos)?P:1/0,I+0xa00000))];case 4:if(A=y.sent())return w=A,[3,1];return[3,13];case 5:if(B=E.id,M=E.size,D=x.filePos,B!==C.EBMLId.Cluster)return[3,7];return[4,o.readCluster(I,c)];case 6:if(M=(u=y.sent()).elementEndPos-D,R=(F=r(u)).blockIndex,F.correctBlockFound)return[2,this.fetchPacketInCluster(u,R,i)];-1!==R&&(l=u,d=R),y.label=7;case 7:if(null!==M)return[3,9];return(0,j.assert)(B!==C.EBMLId.Cluster),[4,(0,C.searchForNextElementId)(o.reader,D,C.LEVEL_0_AND_1_EBML_IDS,c.elementEndPos)];case 8:M=y.sent().pos-D,y.label=9;case 9:if(U=D+M,null!==c.elementEndPos)return[3,12];if(!((O=o.reader.requestSliceRange(U,C.MIN_HEADER_SIZE,C.MAX_HEADER_SIZE))instanceof Promise))return[3,11];return[4,O];case 10:O=y.sent(),y.label=11;case 11:if(!O)return[3,13];if((0,C.readElementId)(O)===C.EBMLId.Segment)return c.elementEndPos=U,[3,13];y.label=12;case 12:return w=U,[3,1];case 13:if(m&&(!l||l.elementStartPos<m.clusterPosition))return L=this.internalTrack.cuePoints[p-1],(0,j.assert)(!L||L.time<m.time),V=null!=(N=null==L?void 0:L.time)?N:-1/0,[2,this.performClusterLookup(null,r,V,a,i)];if(l)return[2,this.fetchPacketInCluster(l,d,i)];return[2,null]}})}).call(this)}}]),e}(),R=function(e){"use strict";function r(e){var n;return(0,p._)(this,r),(n=(0,h._)(this,r,[e])).decoderConfigPromise=null,n.internalTrack=e,n}return(0,g._)(r,e),(0,m._)(r,[{key:"getCodec",value:function(){return this.internalTrack.info.codec}},{key:"getCodedWidth",value:function(){return this.internalTrack.info.width}},{key:"getCodedHeight",value:function(){return this.internalTrack.info.height}},{key:"getRotation",value:function(){return this.internalTrack.info.rotation}},{key:"getColorSpace",value:function(){return(0,f._)(function(){var e,r,n,a;return(0,y._)(this,function(i){return[2,{primaries:null==(e=this.internalTrack.info.colorSpace)?void 0:e.primaries,transfer:null==(r=this.internalTrack.info.colorSpace)?void 0:r.transfer,matrix:null==(n=this.internalTrack.info.colorSpace)?void 0:n.matrix,fullRange:null==(a=this.internalTrack.info.colorSpace)?void 0:a.fullRange}]})}).call(this)}},{key:"canBeTransparent",value:function(){return(0,f._)(function(){return(0,y._)(this,function(e){return[2,this.internalTrack.info.alphaMode]})}).call(this)}},{key:"getDecoderConfig",value:function(){return(0,f._)(function(){var e,r;return(0,y._)(this,function(n){return(e=this,this.internalTrack.info.codec)?[2,null!=(r=this.decoderConfigPromise)?r:this.decoderConfigPromise=(0,f._)(function(){var e,r,n;return(0,y._)(this,function(a){switch(a.label){case 0:if(e=null,!("vp9"===this.internalTrack.info.codec||"av1"===this.internalTrack.info.codec||"avc"===this.internalTrack.info.codec&&!this.internalTrack.info.codecDescription||"hevc"===this.internalTrack.info.codec&&!this.internalTrack.info.codecDescription))return[3,2];return[4,this.getFirstPacket({})];case 1:e=a.sent(),a.label=2;case 2:return[2,{codec:(0,T.extractVideoCodecString)({width:this.internalTrack.info.width,height:this.internalTrack.info.height,codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,colorSpace:this.internalTrack.info.colorSpace,avcType:1,avcCodecInfo:"avc"===this.internalTrack.info.codec&&e?(0,w.extractAvcDecoderConfigurationRecord)(e.data):null,hevcCodecInfo:"hevc"===this.internalTrack.info.codec&&e?(0,w.extractHevcDecoderConfigurationRecord)(e.data):null,vp9CodecInfo:"vp9"===this.internalTrack.info.codec&&e?(0,w.extractVp9CodecInfoFromPacket)(e.data):null,av1CodecInfo:"av1"===this.internalTrack.info.codec&&e?(0,w.extractAv1CodecInfoFromPacket)(e.data):null}),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:null!=(r=this.internalTrack.info.codecDescription)?r:void 0,colorSpace:null!=(n=this.internalTrack.info.colorSpace)?n:void 0}]}})}).call(e)]:[2,null]})}).call(this)}}]),r}(F),U=function(e){"use strict";function r(e){var n;return(0,p._)(this,r),(n=(0,h._)(this,r,[e])).decoderConfig=null,n.internalTrack=e,n}return(0,g._)(r,e),(0,m._)(r,[{key:"getCodec",value:function(){return this.internalTrack.info.codec}},{key:"getNumberOfChannels",value:function(){return this.internalTrack.info.numberOfChannels}},{key:"getSampleRate",value:function(){return this.internalTrack.info.sampleRate}},{key:"getDecoderConfig",value:function(){return(0,f._)(function(){var e,r;return(0,y._)(this,function(n){return this.internalTrack.info.codec?[2,null!=(r=this.decoderConfig)?r:this.decoderConfig={codec:(0,T.extractAudioCodecString)({codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,aacCodecInfo:this.internalTrack.info.aacCodecInfo}),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!=(e=this.internalTrack.info.codecDescription)?e:void 0}]:[2,null]})}).call(this)}}]),r}(F)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@swc/helpers/cjs/_ts_values.cjs":"94P5Q","../codec-data.js":"kWTYV","../codec.js":"fXWqW","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../metadata.js":"eSjom","../misc.js":"j7iGm","../packet.js":"QfqGG","./ebml.js":"fq2QE","./matroska-misc.js":"jz4IV","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],jz4IV:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"buildMatroskaMimeType",function(){return o});var s=e("@swc/helpers/cjs/_to_consumable_array.cjs"),o=function(e){var r=(e.hasVideo?"video/":e.hasAudio?"audio/":"application/")+(e.isWebM?"webm":"x-matroska");if(e.codecStrings.length>0){var n=(0,s._)(new Set(e.codecStrings.filter(Boolean)));r+='; codecs="'.concat(n.join(", "),'"')}return r}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],ifShX:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"Mp3Demuxer",function(){return w});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_ts_generator.cjs"),h=e("../demuxer.js"),p=e("../input-track.js"),m=e("../metadata.js"),g=e("../misc.js"),b=e("../packet.js"),k=e("../../shared/mp3-misc.js"),_=e("../id3.js"),y=e("./mp3-reader.js"),S=e("../reader.js"),w=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).metadataPromise=null,n.firstFrameHeader=null,n.loadedSamples=[],n.metadataTags=null,n.tracks=[],n.readingMutex=new(0,g.AsyncMutex),n.lastSampleLoaded=!1,n.lastLoadedPos=0,n.nextTimestampInSamples=0,n.reader=e._reader,n}return(0,l._)(r,e),(0,u._)(r,[{key:"readMetadata",value:function(){return(0,s._)(function(){var e,r;return(0,f._)(this,function(n){return e=this,[2,null!=(r=this.metadataPromise)?r:this.metadataPromise=(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:if(!(!this.firstFrameHeader&&!this.lastSampleLoaded))return[3,2];return[4,this.advanceReader()];case 1:return e.sent(),[3,0];case 2:if(!this.firstFrameHeader)throw Error("No valid MP3 frame found.");return this.tracks=[new(0,p.InputAudioTrack)(this.input,new T(this))],[2]}})}).call(e)]})}).call(this)}},{key:"advanceReader",value:function(){return(0,s._)(function(){var e,r,n,a,i,s,o,c,u;return(0,f._)(this,function(l){switch(l.label){case 0:if(0!==this.lastLoadedPos)return[3,4];l.label=1;case 1:if(!((e=this.reader.requestSlice(this.lastLoadedPos,_.ID3_V2_HEADER_SIZE))instanceof Promise))return[3,3];return[4,e];case 2:e=l.sent(),l.label=3;case 3:if(!e)return this.lastSampleLoaded=!0,[2];if(!(r=(0,_.readId3V2Header)(e)))return[3,4];return this.lastLoadedPos=e.filePos+r.size,[3,1];case 4:return[4,(0,y.readNextFrameHeader)(this.reader,this.lastLoadedPos,this.reader.fileSize)];case 5:if(!(n=l.sent()))return this.lastSampleLoaded=!0,[2];if(a=n.header,this.lastLoadedPos=n.startPos+a.totalSize-1,i=(0,k.getXingOffset)(a.mpegVersionId,a.channel),!((s=this.reader.requestSlice(n.startPos+i,4))instanceof Promise))return[3,7];return[4,s];case 6:s=l.sent(),l.label=7;case 7:if(s&&((o=(0,S.readU32Be)(s))===k.XING||o===k.INFO))return[2];return this.firstFrameHeader||(this.firstFrameHeader=a),a.sampleRate!==this.firstFrameHeader.sampleRate&&console.warn("MP3 changed sample rate mid-file: ".concat(this.firstFrameHeader.sampleRate," Hz to ").concat(a.sampleRate," Hz.")+" Might be a bug, so please report this file."),c=a.audioSamplesInFrame/this.firstFrameHeader.sampleRate,u={timestamp:this.nextTimestampInSamples/this.firstFrameHeader.sampleRate,duration:c,dataStart:n.startPos,dataSize:a.totalSize},this.loadedSamples.push(u),this.nextTimestampInSamples+=a.audioSamplesInFrame,[2]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,"audio/mpeg"]})})()}},{key:"getTracks",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.tracks]}})}).call(this)}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e;return(0,f._)(this,function(r){switch(r.label){case 0:return[4,this.readMetadata()];case 1:return r.sent(),e=this.tracks[0],(0,g.assert)(e),[2,e.computeDuration()]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,s._)(function(){var e,r,n,a,i,s,o;return(0,f._)(this,function(c){switch(c.label){case 0:return[4,this.readingMutex.acquire()];case 1:e=c.sent(),c.label=2;case 2:return c.trys.push([2,,13,14]),[4,this.readMetadata()];case 3:if(c.sent(),this.metadataTags)return[2,this.metadataTags];this.metadataTags={},r=0,n=!1,c.label=4;case 4:if(!((a=this.reader.requestSlice(r,_.ID3_V2_HEADER_SIZE))instanceof Promise))return[3,6];return[4,a];case 5:a=c.sent(),c.label=6;case 6:if(!a||!(i=(0,_.readId3V2Header)(a)))return[3,9];if(n=!0,!((s=this.reader.requestSlice(a.filePos,i.size))instanceof Promise))return[3,8];return[4,s];case 7:s=c.sent(),c.label=8;case 8:if(!s)return[3,9];return(0,_.parseId3V2Tag)(s,i,this.metadataTags),r=a.filePos+i.size,[3,4];case 9:if(!(!n&&null!==this.reader.fileSize&&this.reader.fileSize>=_.ID3_V1_TAG_SIZE))return[3,12];if(!((o=this.reader.requestSlice(this.reader.fileSize-_.ID3_V1_TAG_SIZE,_.ID3_V1_TAG_SIZE))instanceof Promise))return[3,11];return[4,o];case 10:o=c.sent(),c.label=11;case 11:(0,g.assert)(o),"TAG"===(0,S.readAscii)(o,3)&&(0,_.parseId3V1Tag)(o,this.metadataTags),c.label=12;case 12:return[2,this.metadataTags];case 13:return e(),[7];case 14:return[2]}})}).call(this)}}]),r}(h.Demuxer),T=function(){"use strict";function e(r){(0,c._)(this,e),this.demuxer=r}return(0,u._)(e,[{key:"getId",value:function(){return 1}},{key:"getFirstTimestamp",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,0]})})()}},{key:"getTimeResolution",value:function(){return(0,g.assert)(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate/this.demuxer.firstFrameHeader.audioSamplesInFrame}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r,n;return(0,f._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"getName",value:function(){return null}},{key:"getLanguageCode",value:function(){return g.UNDETERMINED_LANGUAGE}},{key:"getCodec",value:function(){return"mp3"}},{key:"getInternalCodecId",value:function(){return null}},{key:"getNumberOfChannels",value:function(){return(0,g.assert)(this.demuxer.firstFrameHeader),3===this.demuxer.firstFrameHeader.channel?1:2}},{key:"getSampleRate",value:function(){return(0,g.assert)(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate}},{key:"getDisposition",value:function(){return(0,d._)({},m.DEFAULT_TRACK_DISPOSITION)}},{key:"getDecoderConfig",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return(0,g.assert)(this.demuxer.firstFrameHeader),[2,{codec:"mp3",numberOfChannels:3===this.demuxer.firstFrameHeader.channel?1:2,sampleRate:this.demuxer.firstFrameHeader.sampleRate}]})}).call(this)}},{key:"getPacketAtIndex",value:function(e,r){return(0,s._)(function(){var n,a,i;return(0,f._)(this,function(s){switch(s.label){case 0:if(-1===e||!(n=this.demuxer.loadedSamples[e]))return[2,null];if(!r.metadataOnly)return[3,1];return a=b.PLACEHOLDER_DATA,[3,4];case 1:if(!((i=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize))instanceof Promise))return[3,3];return[4,i];case 2:i=s.sent(),s.label=3;case 3:if(!i)return[2,null];a=(0,S.readBytes)(i,n.dataSize),s.label=4;case 4:return[2,new(0,b.EncodedPacket)(a,"key",n.timestamp,n.duration,e,n.dataSize)]}})}).call(this)}},{key:"getFirstPacket",value:function(e){return this.getPacketAtIndex(0,e)}},{key:"getNextPacket",value:function(e,r){return(0,s._)(function(){var n,a,i;return(0,f._)(this,function(s){switch(s.label){case 0:return[4,this.demuxer.readingMutex.acquire()];case 1:n=s.sent(),s.label=2;case 2:if(s.trys.push([2,,6,7]),-1===(a=(0,g.binarySearchExact)(this.demuxer.loadedSamples,e.timestamp,function(e){return e.timestamp})))throw Error("Packet was not created from this track.");i=a+1,s.label=3;case 3:if(!(i>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded))return[3,5];return[4,this.demuxer.advanceReader()];case 4:return s.sent(),[3,3];case 5:return[2,this.getPacketAtIndex(i,r)];case 6:return n(),[7];case 7:return[2]}})}).call(this)}},{key:"getPacket",value:function(e,r){return(0,s._)(function(){var n,a;return(0,f._)(this,function(i){switch(i.label){case 0:return[4,this.demuxer.readingMutex.acquire()];case 1:n=i.sent(),i.label=2;case 2:i.trys.push([2,,6,7]),i.label=3;case 3:if(-1===(a=(0,g.binarySearchLessOrEqual)(this.demuxer.loadedSamples,e,function(e){return e.timestamp}))&&this.demuxer.loadedSamples.length>0)return[2,null];if(this.demuxer.lastSampleLoaded||a>=0&&a+1<this.demuxer.loadedSamples.length)return[2,this.getPacketAtIndex(a,r)];return[4,this.demuxer.advanceReader()];case 4:return i.sent(),[3,3];case 5:return[3,7];case 6:return n(),[7];case 7:return[2]}})}).call(this)}},{key:"getKeyPacket",value:function(e,r){return this.getPacket(e,r)}},{key:"getNextKeyPacket",value:function(e,r){return this.getNextPacket(e,r)}}]),e}()},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../metadata.js":"eSjom","../misc.js":"j7iGm","../packet.js":"QfqGG","../../shared/mp3-misc.js":"gcure","../id3.js":"42Y2c","./mp3-reader.js":"gFWvE","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gcure:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"FRAME_HEADER_SIZE",function(){return s}),i.export(n,"SAMPLING_RATES",function(){return o}),i.export(n,"KILOBIT_RATES",function(){return c}),i.export(n,"XING",function(){return u}),i.export(n,"INFO",function(){return l}),i.export(n,"computeMp3FrameSize",function(){return d}),i.export(n,"getXingOffset",function(){return f}),i.export(n,"readFrameHeader",function(){return h}),i.export(n,"encodeSynchsafe",function(){return p}),i.export(n,"decodeSynchsafe",function(){return m});var s=4,o=[44100,48e3,32e3],c=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1,-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1,-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],u=0x58696e67,l=0x496e666f,d=function(e,r,n,a,i){return 0===r?0:1===r?Math.floor(144*n/(a<<e))+i:2===r?Math.floor(144*n/a)+i:(Math.floor(12*n/a)+i)*4},f=function(e,r){return 3===e?3===r?21:36:3===r?13:21},h=function(e,r){var n,a=e>>>24,i=e>>>16&255,s=e>>>8&255,u=255&e;if(255!==a&&255!==i&&255!==s&&255!==u)return{header:null,bytesAdvanced:4};if(255!==a||(224&i)!=224)return{header:null,bytesAdvanced:1};var l=0,f=0;16&i?l=8&i?0:1:(l=1,f=1);var h=i>>3&3,p=i>>1&3,m=(s>>2&3)%3,g=c[64*l+16*p+(s>>4&15)];if(-1===g)return{header:null,bytesAdvanced:1};var b=1e3*g,k=o[m]>>l+f,_=d(l,p,b,k,s>>1&1);return null!==r&&r<_?{header:null,bytesAdvanced:1}:(n=3===h?3===p?384:1152:3===p?384:2===p?1152:576,{header:{totalSize:_,mpegVersionId:h,layer:p,bitrate:b,frequencyIndex:m,sampleRate:k,channel:u>>6&3,modeExtension:u>>4&3,copyright:u>>3&1,original:u>>2&1,emphasis:3&u,audioSamplesInFrame:n},bytesAdvanced:1})},p=function(e){for(var r=127,n=0,a=e;(0x7fffffff^r)!=0;)n=(a&~r)<<1|a&r,r=(r+1<<8)-1,a=n;return n},m=function(e){for(var r=0x7f000000,n=0;0!==r;)n>>=1,n|=e&r,r>>=8;return n}},{"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"42Y2c":[function(e,r,n,a){var i,s,o,c,u=e("@parcel/transformer-js/src/esmodule-helpers.js");u.defineInteropFlag(n),u.export(n,"Id3V2HeaderFlags",function(){return o}),u.export(n,"Id3V2TextEncoding",function(){return c}),u.export(n,"ID3_V1_TAG_SIZE",function(){return m}),u.export(n,"ID3_V2_HEADER_SIZE",function(){return g}),u.export(n,"ID3_V1_GENRES",function(){return b}),u.export(n,"parseId3V1Tag",function(){return k}),u.export(n,"readId3V1String",function(){return _}),u.export(n,"readId3V2Header",function(){return y}),u.export(n,"parseId3V2Tag",function(){return S}),u.export(n,"Id3V2Reader",function(){return w}),u.export(n,"Id3V2Writer",function(){return T});var l=e("@swc/helpers/cjs/_class_call_check.cjs"),d=e("@swc/helpers/cjs/_create_class.cjs"),f=e("../shared/mp3-misc.js"),h=e("./misc.js"),p=e("./reader.js");(i=o||(o={}))[i.Unsynchronisation=128]="Unsynchronisation",i[i.ExtendedHeader=64]="ExtendedHeader",i[i.ExperimentalIndicator=32]="ExperimentalIndicator",i[i.Footer=16]="Footer",(s=c||(c={}))[s.ISO_8859_1=0]="ISO_8859_1",s[s.UTF_16_WITH_BOM=1]="UTF_16_WITH_BOM",s[s.UTF_16_BE_NO_BOM=2]="UTF_16_BE_NO_BOM",s[s.UTF_8=3]="UTF_8";var m=128,g=10,b=["Blues","Classic rock","Country","Dance","Disco","Funk","Grunge","Hip-hop","Jazz","Metal","New age","Oldies","Other","Pop","Rhythm and blues","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death metal","Pranks","Soundtrack","Euro-techno","Ambient","Trip-hop","Vocal","Jazz & funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound clip","Gospel","Noise","Alternative rock","Bass","Soul","Punk","Space","Meditative","Instrumental pop","Instrumental rock","Ethnic","Gothic","Darkwave","Techno-industrial","Electronic","Pop-folk","Eurodance","Dream","Southern rock","Comedy","Cult","Gangsta","Top 40","Christian rap","Pop/funk","Jungle music","Native US","Cabaret","New wave","Psychedelic","Rave","Showtunes","Trailer","Lo-fi","Tribal","Acid punk","Acid jazz","Polka","Retro","Musical","Rock 'n' roll","Hard rock","Folk","Folk rock","National folk","Swing","Fast fusion","Bebop","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic rock","Progressive rock","Psychedelic rock","Symphonic rock","Slow rock","Big band","Chorus","Easy listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber music","Sonata","Symphony","Booty bass","Primus","Porn groove","Satire","Slow jam","Club","Tango","Samba","Folklore","Ballad","Power ballad","Rhythmic Soul","Freestyle","Duet","Punk rock","Drum solo","A cappella","Euro-house","Dance hall","Goa music","Drum & bass","Club-house","Hardcore techno","Terror","Indie","Britpop","Negerpunk","Polsk punk","Beat","Christian gangsta rap","Heavy metal","Black metal","Crossover","Contemporary Christian","Christian rock","Merengue","Salsa","Thrash metal","Anime","Jpop","Synthpop","Christmas","Art rock","Baroque","Bhangra","Big beat","Breakbeat","Chillout","Downtempo","Dub","EBM","Eclectic","Electro","Electroclash","Emo","Experimental","Garage","Global","IDM","Illbient","Industro-Goth","Jam Band","Krautrock","Leftfield","Lounge","Math rock","New romantic","Nu-breakz","Post-punk","Post-rock","Psytrance","Shoegaze","Space rock","Trop rock","World music","Neoclassical","Audiobook","Audio theatre","Neue Deutsche Welle","Podcast","Indie rock","G-Funk","Dubstep","Garage rock","Psybient"],k=function(e,r){var n=e.filePos;null!=r.raw||(r.raw={}),null!=(u=r.raw).TAG||(u.TAG=(0,p.readBytes)(e,m-3)),e.filePos=n;var a=_(e,30);a&&(null!=r.title||(r.title=a));var i=_(e,30);i&&(null!=r.artist||(r.artist=i));var s=_(e,30);s&&(null!=r.album||(r.album=s));var o=Number.parseInt(_(e,4),10);Number.isInteger(o)&&o>0&&(null!=r.date||(r.date=new Date(o,0,1)));var c=(0,p.readBytes)(e,30);if(0===c[28]&&0!==c[29]){var u,l,d=c[29];d>0&&(null!=r.trackNumber||(r.trackNumber=d)),e.skip(-30),l=_(e,28),e.skip(2)}else e.skip(-30),l=_(e,30);l&&(null!=r.comment||(r.comment=l));var f=(0,p.readU8)(e);f<b.length&&(null!=r.genre||(r.genre=b[f]))},_=function(e,r){for(var n=(0,p.readBytes)(e,r),a=(0,h.coalesceIndex)(n.indexOf(0),n.length),i=n.subarray(0,a),s="",o=0;o<i.length;o++)s+=String.fromCharCode(i[o]);return s.trimEnd()},y=function(e){var r=e.filePos,n=(0,p.readAscii)(e,3),a=(0,p.readU8)(e),i=(0,p.readU8)(e),s=(0,p.readU8)(e),o=(0,p.readU32Be)(e);return"ID3"!==n||255===a||255===i||(0x80808080&o)!=0?(e.filePos=r,null):{majorVersion:a,revision:i,flags:s,size:(0,f.decodeSynchsafe)(o)}},S=function(e,r,n){if(![2,3,4].includes(r.majorVersion))return void console.warn("Unsupported ID3v2 major version: ".concat(r.majorVersion));var a=(0,p.readBytes)(e,r.size),i=new w(r,a);if(r.flags&o.Footer&&i.removeFooter(),r.flags&o.Unsynchronisation&&3===r.majorVersion&&i.ununsynchronizeAll(),r.flags&o.ExtendedHeader){var s=i.readU32();3===r.majorVersion?i.pos+=s:i.pos+=s-4}for(;i.pos<=i.bytes.length-i.frameHeaderSize();){var c=i.readId3V2Frame();if(!c)break;var u=i.pos,l=i.pos+c.size,d=!1,f=!1,h=!1;if(3===r.majorVersion?(d=!!(64&c.flags),f=!!(128&c.flags)):4===r.majorVersion&&(d=!!(4&c.flags),f=!!(8&c.flags),h=!!(2&c.flags)||!!(r.flags&o.Unsynchronisation)),d){console.warn("Skipping encrypted ID3v2 frame ".concat(c.id)),i.pos=l;continue}if(f){console.warn("Skipping compressed ID3v2 frame ".concat(c.id)),i.pos=l;continue}switch(h&&i.ununsynchronizeRegion(i.pos,l),null!=n.raw||(n.raw={}),"T"===c.id[0]?null!=(m=n.raw)[g=c.id]||(m[g]=i.readId3V2EncodingAndText(l)):null!=(k=n.raw)[_=c.id]||(k[_]=i.readBytes(c.size)),i.pos=u,c.id){case"TIT2":case"TT2":null!=n.title||(n.title=i.readId3V2EncodingAndText(l));break;case"TIT3":case"TT3":null!=n.description||(n.description=i.readId3V2EncodingAndText(l));break;case"TPE1":case"TP1":null!=n.artist||(n.artist=i.readId3V2EncodingAndText(l));break;case"TALB":case"TAL":null!=n.album||(n.album=i.readId3V2EncodingAndText(l));break;case"TPE2":case"TP2":null!=n.albumArtist||(n.albumArtist=i.readId3V2EncodingAndText(l));break;case"TRCK":case"TRK":var m,g,k,_,y=i.readId3V2EncodingAndText(l).split("/"),S=Number.parseInt(y[0],10),T=y[1]&&Number.parseInt(y[1],10);Number.isInteger(S)&&S>0&&(null!=n.trackNumber||(n.trackNumber=S)),T&&Number.isInteger(T)&&T>0&&(null!=n.tracksTotal||(n.tracksTotal=T));break;case"TPOS":case"TPA":var x=i.readId3V2EncodingAndText(l).split("/"),I=Number.parseInt(x[0],10),E=x[1]&&Number.parseInt(x[1],10);Number.isInteger(I)&&I>0&&(null!=n.discNumber||(n.discNumber=I)),E&&Number.isInteger(E)&&E>0&&(null!=n.discsTotal||(n.discsTotal=E));break;case"TCON":case"TCO":var j=i.readId3V2EncodingAndText(l),P=/^\((\d+)\)/.exec(j);if(P){var C=Number.parseInt(P[1]);if(void 0!==b[C]){null!=n.genre||(n.genre=b[C]);break}}if(P=/^\d+$/.exec(j)){var A=Number.parseInt(P[0]);if(void 0!==b[A]){null!=n.genre||(n.genre=b[A]);break}}null!=n.genre||(n.genre=j);break;case"TDRC":case"TDAT":var B=new Date(i.readId3V2EncodingAndText(l));Number.isNaN(B.getTime())||null!=n.date||(n.date=B);break;case"TYER":case"TYE":var M=Number.parseInt(i.readId3V2EncodingAndText(l),10);Number.isInteger(M)&&(null!=n.date||(n.date=new Date(M,0,1)));break;case"USLT":case"ULT":var D=i.readU8();i.pos+=3,i.readId3V2Text(D,l),null!=n.lyrics||(n.lyrics=i.readId3V2Text(D,l));break;case"COMM":case"COM":var F=i.readU8();i.pos+=3,i.readId3V2Text(F,l),null!=n.comment||(n.comment=i.readId3V2Text(F,l));break;case"APIC":case"PIC":var R=i.readId3V2TextEncoding(),U=void 0;if(2===r.majorVersion){var O=i.readAscii(3);U="PNG"===O?"image/png":"JPG"===O?"image/jpeg":"image/*"}else U=i.readId3V2Text(R,l);var L=i.readU8(),N=i.readId3V2Text(R,l).trimEnd(),V=l-i.pos;if(V>=0){var z=i.readBytes(V);n.images||(n.images=[]),n.images.push({data:z,mimeType:U,kind:3===L?"coverFront":4===L?"coverBack":"unknown",description:N})}break;default:i.pos+=c.size}i.pos=l}},w=function(){"use strict";function e(r,n){(0,l._)(this,e),this.header=r,this.bytes=n,this.pos=0,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength)}return(0,d._)(e,[{key:"frameHeaderSize",value:function(){return 2===this.header.majorVersion?6:10}},{key:"ununsynchronizeAll",value:function(){for(var e=[],r=0;r<this.bytes.length;r++){var n=this.bytes[r];e.push(n),255===n&&r!==this.bytes.length-1&&0===this.bytes[r]&&r++}this.bytes=new Uint8Array(e),this.view=new DataView(this.bytes.buffer)}},{key:"ununsynchronizeRegion",value:function(e,r){for(var n=[],a=e;a<r;a++){var i=this.bytes[a];n.push(i),255===i&&a!==r-1&&0===this.bytes[a+1]&&a++}var s=this.bytes.subarray(0,e),o=this.bytes.subarray(r);this.bytes=new Uint8Array(s.length+n.length+o.length),this.bytes.set(s,0),this.bytes.set(n,s.length),this.bytes.set(o,s.length+n.length),this.view=new DataView(this.bytes.buffer)}},{key:"removeFooter",value:function(){this.bytes=this.bytes.subarray(0,this.bytes.length-g),this.view=new DataView(this.bytes.buffer)}},{key:"readBytes",value:function(e){var r=this.bytes.subarray(this.pos,this.pos+e);return this.pos+=e,r}},{key:"readU8",value:function(){var e=this.view.getUint8(this.pos);return this.pos+=1,e}},{key:"readU16",value:function(){var e=this.view.getUint16(this.pos,!1);return this.pos+=2,e}},{key:"readU24",value:function(){var e=this.view.getUint16(this.pos,!1),r=this.view.getUint8(this.pos+1);return this.pos+=3,256*e+r}},{key:"readU32",value:function(){var e=this.view.getUint32(this.pos,!1);return this.pos+=4,e}},{key:"readAscii",value:function(e){for(var r="",n=0;n<e;n++)r+=String.fromCharCode(this.view.getUint8(this.pos+n));return this.pos+=e,r}},{key:"readId3V2Frame",value:function(){var e=this;if(2===this.header.majorVersion){var r=this.readAscii(3);return"\0\0\0"===r?null:{id:r,size:this.readU24(),flags:0}}var n=this.readAscii(4);if("\0\0\0\0"===n)return null;var a=this.readU32(),i=4===this.header.majorVersion?(0,f.decodeSynchsafe)(a):a,s=this.readU16(),o=this.pos,c=function(r){var n=e.pos+r;if(n>e.bytes.length)return!1;if(n<=e.bytes.length-e.frameHeaderSize()){e.pos+=r;var a=e.readAscii(4);if("\0\0\0\0"!==a&&!/[0-9A-Z]{4}/.test(a))return!1}return!0};if(!c(i)){var u=4===this.header.majorVersion?a:(0,f.decodeSynchsafe)(a);c(u)&&(i=u)}return this.pos=o,{id:n,size:i,flags:s}}},{key:"readId3V2TextEncoding",value:function(){var e=this.readU8();if(e>3)throw Error("Unsupported text encoding: ".concat(e));return e}},{key:"readId3V2Text",value:function(e,r){var n=this.pos,a=this.readBytes(r-this.pos);switch(e){case c.ISO_8859_1:for(var i="",s=0;s<a.length;s++){var o=a[s];if(0===o){this.pos=n+s+1;break}i+=String.fromCharCode(o)}return i;case c.UTF_16_WITH_BOM:if(255===a[0]&&254===a[1]){var u=new TextDecoder("utf-16le"),l=(0,h.coalesceIndex)(a.findIndex(function(e,r){return 0===e&&0===a[r+1]&&r%2==0}),a.length);return this.pos=n+Math.min(l+2,a.length),u.decode(a.subarray(2,l))}if(254===a[0]&&255===a[1]){var d=new TextDecoder("utf-16be"),f=(0,h.coalesceIndex)(a.findIndex(function(e,r){return 0===e&&0===a[r+1]&&r%2==0}),a.length);return this.pos=n+Math.min(f+2,a.length),d.decode(a.subarray(2,f))}var p=(0,h.coalesceIndex)(a.findIndex(function(e){return 0===e}),a.length);return this.pos=n+Math.min(p+1,a.length),h.textDecoder.decode(a.subarray(0,p));case c.UTF_16_BE_NO_BOM:var m=new TextDecoder("utf-16be"),g=(0,h.coalesceIndex)(a.findIndex(function(e,r){return 0===e&&0===a[r+1]&&r%2==0}),a.length);return this.pos=n+Math.min(g+2,a.length),m.decode(a.subarray(0,g));case c.UTF_8:var b=(0,h.coalesceIndex)(a.findIndex(function(e){return 0===e}),a.length);return this.pos=n+Math.min(b+1,a.length),h.textDecoder.decode(a.subarray(0,b))}}},{key:"readId3V2EncodingAndText",value:function(e){if(this.pos>=e)return"";var r=this.readId3V2TextEncoding();return this.readId3V2Text(r,e)}}]),e}(),T=function(){"use strict";function e(r){(0,l._)(this,e),this.helper=new Uint8Array(8),this.helperView=(0,h.toDataView)(this.helper),this.writer=r}return(0,d._)(e,[{key:"writeId3V2Tag",value:function(e){var r=this.writer.getPos();this.writeAscii("ID3"),this.writeU8(4),this.writeU8(0),this.writeU8(0),this.writeSynchsafeU32(0);var n=this.writer.getPos(),a=new Set,i=!0,s=!1,o=void 0;try{for(var u,l=(0,h.keyValueIterator)(e)[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var d=u.value,f=d.key,p=d.value;switch(f){case"title":this.writeId3V2TextFrame("TIT2",p),a.add("TIT2");break;case"description":this.writeId3V2TextFrame("TIT3",p),a.add("TIT3");break;case"artist":this.writeId3V2TextFrame("TPE1",p),a.add("TPE1");break;case"album":this.writeId3V2TextFrame("TALB",p),a.add("TALB");break;case"albumArtist":this.writeId3V2TextFrame("TPE2",p),a.add("TPE2");break;case"trackNumber":var m=void 0!==e.tracksTotal?"".concat(p,"/").concat(e.tracksTotal):p.toString();this.writeId3V2TextFrame("TRCK",m),a.add("TRCK");break;case"discNumber":var g=void 0!==e.discsTotal?"".concat(p,"/").concat(e.discsTotal):p.toString();this.writeId3V2TextFrame("TPOS",g),a.add("TPOS");break;case"genre":this.writeId3V2TextFrame("TCON",p),a.add("TCON");break;case"date":this.writeId3V2TextFrame("TDRC",p.toISOString().slice(0,10)),a.add("TDRC");break;case"lyrics":this.writeId3V2LyricsFrame(p),a.add("USLT");break;case"comment":this.writeId3V2CommentFrame(p),a.add("COMM");break;case"images":var b={coverFront:3,coverBack:4,unknown:0},k=!0,_=!1,y=void 0;try{for(var S,w=p[Symbol.iterator]();!(k=(S=w.next()).done);k=!0){var T,x,I=S.value,E=null!=(T=b[I.kind])?T:0,j=null!=(x=I.description)?x:"";this.writeId3V2ApicFrame(I.mimeType,E,j,I.data)}}catch(e){_=!0,y=e}finally{try{k||null==w.return||w.return()}finally{if(_)throw y}}break;case"tracksTotal":case"discsTotal":case"raw":break;default:(0,h.assertNever)(f)}}}catch(e){s=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(s)throw o}}if(e.raw)for(var P in e.raw){var C=e.raw[P];if(!(null==C||4!==P.length||a.has(P))){var A=void 0;if("string"==typeof C){var B=h.textEncoder.encode(C);(A=new Uint8Array(B.byteLength+2))[0]=c.UTF_8,A.set(B,1)}else{if(!(C instanceof Uint8Array))continue;A=C}this.writeAscii(P),this.writeSynchsafeU32(A.byteLength),this.writeU16(0),this.writer.write(A)}}var M=this.writer.getPos(),D=M-n;return this.writer.seek(r+6),this.writeSynchsafeU32(D),this.writer.seek(M),D+10}},{key:"writeU8",value:function(e){this.helper[0]=e,this.writer.write(this.helper.subarray(0,1))}},{key:"writeU16",value:function(e){this.helperView.setUint16(0,e,!1),this.writer.write(this.helper.subarray(0,2))}},{key:"writeU32",value:function(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}},{key:"writeAscii",value:function(e){for(var r=0;r<e.length;r++)this.helper[r]=e.charCodeAt(r);this.writer.write(this.helper.subarray(0,e.length))}},{key:"writeSynchsafeU32",value:function(e){this.writeU32((0,f.encodeSynchsafe)(e))}},{key:"writeIsoString",value:function(e){for(var r=new Uint8Array(e.length+1),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);r[e.length]=0,this.writer.write(r)}},{key:"writeUtf8String",value:function(e){var r=h.textEncoder.encode(e);this.writer.write(r),this.writeU8(0)}},{key:"writeId3V2TextFrame",value:function(e,r){var n=(0,h.isIso88591Compatible)(r),a=n?r.length:h.textEncoder.encode(r).byteLength;this.writeAscii(e),this.writeSynchsafeU32(1+a+1),this.writeU16(0),this.writeU8(n?c.ISO_8859_1:c.UTF_8),n?this.writeIsoString(r):this.writeUtf8String(r)}},{key:"writeId3V2LyricsFrame",value:function(e){var r=(0,h.isIso88591Compatible)(e),n=5+e.length+1;this.writeAscii("USLT"),this.writeSynchsafeU32(n),this.writeU16(0),this.writeU8(r?c.ISO_8859_1:c.UTF_8),this.writeAscii("und"),r?(this.writeIsoString(""),this.writeIsoString(e)):(this.writeUtf8String(""),this.writeUtf8String(e))}},{key:"writeId3V2CommentFrame",value:function(e){var r=(0,h.isIso88591Compatible)(e),n=r?e.length:h.textEncoder.encode(e).byteLength;this.writeAscii("COMM"),this.writeSynchsafeU32(5+n+1),this.writeU16(0),this.writeU8(r?c.ISO_8859_1:c.UTF_8),this.writeU8(117),this.writeU8(110),this.writeU8(100),r?(this.writeIsoString(""),this.writeIsoString(e)):(this.writeUtf8String(""),this.writeUtf8String(e))}},{key:"writeId3V2ApicFrame",value:function(e,r,n,a){var i=(0,h.isIso88591Compatible)(e)&&(0,h.isIso88591Compatible)(n),s=i?n.length:h.textEncoder.encode(n).byteLength,o=1+e.length+1+1+s+1+a.byteLength;this.writeAscii("APIC"),this.writeSynchsafeU32(o),this.writeU16(0),this.writeU8(i?c.ISO_8859_1:c.UTF_8),i?this.writeIsoString(e):this.writeUtf8String(e),this.writeU8(r),i?this.writeIsoString(n):this.writeUtf8String(n),this.writer.write(a)}}]),e}()},{"@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","../shared/mp3-misc.js":"gcure","./misc.js":"j7iGm","./reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gFWvE:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"readNextFrameHeader",function(){return l});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("../../shared/mp3-misc.js"),u=e("../reader.js"),l=function(e,r,n){return(0,s._)(function(){var a,i,s,l;return(0,o._)(this,function(o){switch(o.label){case 0:a=r,o.label=1;case 1:if(!(null===n||a<n))return[3,4];if(!((i=e.requestSlice(a,c.FRAME_HEADER_SIZE))instanceof Promise))return[3,3];return[4,i];case 2:i=o.sent(),o.label=3;case 3:if(!i)return[3,4];if(s=(0,u.readU32Be)(i),(l=(0,c.readFrameHeader)(s,null!==e.fileSize?e.fileSize-a:null)).header)return[2,{header:l.header,startPos:a}];return a+=l.bytesAdvanced,[3,1];case 4:return[2,null]}})})()}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../../shared/mp3-misc.js":"gcure","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],hRJRs:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"OggDemuxer",function(){return x});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_to_consumable_array.cjs"),h=e("@swc/helpers/cjs/_ts_generator.cjs"),p=e("../codec.js"),m=e("../codec-data.js"),g=e("../demuxer.js"),b=e("../input-track.js"),k=e("../metadata.js"),_=e("../misc.js"),y=e("../packet.js"),S=e("../reader.js"),w=e("./ogg-misc.js"),T=e("./ogg-reader.js"),x=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).metadataPromise=null,n.bitstreams=[],n.tracks=[],n.metadataTags={},n.reader=e._reader,n}return(0,l._)(r,e),(0,u._)(r,[{key:"readMetadata",value:function(){return(0,s._)(function(){var e,r;return(0,h._)(this,function(n){return e=this,[2,null!=(r=this.metadataPromise)?r:this.metadataPromise=(0,s._)(function(){var e,r,n,a,i,s,o,c,u,l,d;return(0,h._)(this,function(f){switch(f.label){case 0:e=0,f.label=1;case 1:if(!((r=this.reader.requestSliceRange(e,T.MIN_PAGE_HEADER_SIZE,T.MAX_PAGE_HEADER_SIZE))instanceof Promise))return[3,3];return[4,r];case 2:r=f.sent(),f.label=3;case 3:if(!r||!(n=(0,T.readPageHeader)(r))||!(2&n.headerType))return[3,4];return this.bitstreams.push({serialNumber:n.serialNumber,bosPage:n,description:null,numberOfChannels:-1,sampleRate:-1,codecInfo:{codec:null,vorbisInfo:null,opusInfo:null},lastMetadataPacket:null}),e=n.headerStartPos+n.totalSize,[3,1];case 4:a=!0,i=!1,s=void 0,f.label=5;case 5:f.trys.push([5,14,15,16]),o=this.bitstreams[Symbol.iterator](),f.label=6;case 6:if(a=(c=o.next()).done)return[3,13];return u=c.value,[4,this.readPacket(u.bosPage,0)];case 7:if(!(l=f.sent()))return[3,12];if(!(l.data.byteLength>=7&&1===l.data[0]&&118===l.data[1]&&111===l.data[2]&&114===l.data[3]&&98===l.data[4]&&105===l.data[5]&&115===l.data[6]))return[3,9];return[4,this.readVorbisMetadata(l,u)];case 8:return f.sent(),[3,11];case 9:if(!(l.data.byteLength>=8&&79===l.data[0]&&112===l.data[1]&&117===l.data[2]&&115===l.data[3]&&72===l.data[4]&&101===l.data[5]&&97===l.data[6]&&100===l.data[7]))return[3,11];return[4,this.readOpusMetadata(l,u)];case 10:f.sent(),f.label=11;case 11:null!==u.codecInfo.codec&&this.tracks.push(new(0,b.InputAudioTrack)(this.input,new I(u,this))),f.label=12;case 12:return a=!0,[3,6];case 13:return[3,16];case 14:return d=f.sent(),i=!0,s=d,[3,16];case 15:try{a||null==o.return||o.return()}finally{if(i)throw s}return[7];case 16:return[2]}})}).call(e)]})}).call(this)}},{key:"readVorbisMetadata",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o,c,u,l;return(0,h._)(this,function(d){switch(d.label){case 0:return[4,this.findNextPacketStart(e)];case 1:case 3:if(!(n=d.sent()))return[2];return[4,this.readPacket(n.startPage,n.startSegmentIndex)];case 2:if(!(a=d.sent()))return[2];return[4,this.findNextPacketStart(a)];case 4:if(!(i=d.sent())||3!==a.data[0]||5!==i.data[0])return[2];return s=[],(o=function(e){for(;s.push(Math.min(255,e)),!(e<255);)e-=255})(e.data.length),o(a.data.length),(c=new Uint8Array(1+s.length+e.data.length+a.data.length+i.data.length))[0]=2,c.set(s,1),c.set(e.data,1+s.length),c.set(a.data,1+s.length+e.data.length),c.set(i.data,1+s.length+e.data.length+a.data.length),r.codecInfo.codec="vorbis",r.description=c,r.lastMetadataPacket=i,r.numberOfChannels=(u=(0,_.toDataView)(e.data)).getUint8(11),r.sampleRate=u.getUint32(12,!0),l=u.getUint8(28),r.codecInfo.vorbisInfo={blocksizes:[1<<(15&l),1<<(l>>4)],modeBlockflags:(0,m.parseModesFromVorbisSetupPacket)(i.data).modeBlockflags},(0,m.readVorbisComments)(a.data.subarray(7),this.metadataTags),[2]}})}).call(this)}},{key:"readOpusMetadata",value:function(e,r){return(0,s._)(function(){var n,a,i;return(0,h._)(this,function(s){switch(s.label){case 0:return[4,this.findNextPacketStart(e)];case 1:if(!(n=s.sent()))return[2];return[4,this.readPacket(n.startPage,n.startSegmentIndex)];case 2:if(!(a=s.sent()))return[2];return r.codecInfo.codec="opus",r.description=e.data,r.lastMetadataPacket=a,r.numberOfChannels=(i=(0,m.parseOpusIdentificationHeader)(e.data)).outputChannelCount,r.sampleRate=p.OPUS_SAMPLE_RATE,r.codecInfo.opusInfo={preSkip:i.preSkip},(0,m.readVorbisComments)(a.data.subarray(8),this.metadataTags),[2]}})}).call(this)}},{key:"readPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o,c,u,l,d,f,p,m,g,b,k,y;return(0,h._)(this,function(h){switch(h.label){case 0:for((0,_.assert)(r<e.lacingValues.length),n=0,a=0;a<r;a++)n+=e.lacingValues[a];i=e,s=n,o=r,c=[],h.label=1;case 1:if(!((u=this.reader.requestSlice(i.dataStartPos,i.dataSize))instanceof Promise))return[3,3];return[4,u];case 2:u=h.sent(),h.label=3;case 3:for((0,_.assert)(u),l=(0,S.readBytes)(u,i.dataSize);;){if(o===i.lacingValues.length){c.push(l.subarray(n,s));break}if(d=i.lacingValues[o],s+=d,d<255)return c.push(l.subarray(n,s)),[3,8];o++}f=i.headerStartPos+i.totalSize,h.label=4;case 4:if(!((p=this.reader.requestSliceRange(f,T.MIN_PAGE_HEADER_SIZE,T.MAX_PAGE_HEADER_SIZE))instanceof Promise))return[3,6];return[4,p];case 5:p=h.sent(),h.label=6;case 6:if(!p||!(m=(0,T.readPageHeader)(p)))return[2,null];if((i=m).serialNumber===e.serialNumber)return[3,7];return f=i.headerStartPos+i.totalSize,[3,4];case 7:return n=0,s=0,o=0,[3,1];case 8:for(k=0,g=new Uint8Array(c.reduce(function(e,r){return e+r.length},0)),b=0;k<c.length;k++)y=c[k],g.set(y,b),b+=y.length;return[2,{data:g,endPage:i,endSegmentIndex:o}]}})}).call(this)}},{key:"findNextPacketStart",value:function(e){return(0,s._)(function(){var r,n,a;return(0,h._)(this,function(i){switch(i.label){case 0:if(e.endSegmentIndex<e.endPage.lacingValues.length-1)return[2,{startPage:e.endPage,startSegmentIndex:e.endSegmentIndex+1}];if(4&e.endPage.headerType)return[2,null];r=e.endPage.headerStartPos+e.endPage.totalSize,i.label=1;case 1:if(!((n=this.reader.requestSliceRange(r,T.MIN_PAGE_HEADER_SIZE,T.MAX_PAGE_HEADER_SIZE))instanceof Promise))return[3,3];return[4,n];case 2:n=i.sent(),i.label=3;case 3:if(!n||!(a=(0,T.readPageHeader)(n)))return[2,null];if(a.serialNumber===e.endPage.serialNumber)return[2,{startPage:a,startSegmentIndex:0}];return r=a.headerStartPos+a.totalSize,[3,1];case 4:return[2]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,s._)(function(){var e;return(0,h._)(this,function(r){switch(r.label){case 0:return[4,this.readMetadata()];case 1:return r.sent(),[4,Promise.all(this.tracks.map(function(e){return e.getCodecParameterString()}))];case 2:return e=r.sent(),[2,(0,w.buildOggMimeType)({codecStrings:e.filter(Boolean)})]}})}).call(this)}},{key:"getTracks",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.tracks]}})}).call(this)}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r;return(0,h._)(this,function(n){switch(n.label){case 0:return[4,this.getTracks()];case 1:return[4,Promise.all(n.sent().map(function(e){return e.computeDuration()}))];case 2:return r=n.sent(),[2,(e=Math).max.apply(e,[0].concat((0,f._)(r)))]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.metadataTags]}})}).call(this)}}]),r}(g.Demuxer),I=function(){"use strict";function e(r,n){(0,c._)(this,e),this.bitstream=r,this.demuxer=n,this.encodedPacketToMetadata=new WeakMap,this.sequentialScanCache=[],this.sequentialScanMutex=new(0,_.AsyncMutex),this.internalSampleRate="opus"===r.codecInfo.codec?p.OPUS_SAMPLE_RATE:r.sampleRate}return(0,u._)(e,[{key:"getId",value:function(){return this.bitstream.serialNumber}},{key:"getNumberOfChannels",value:function(){return this.bitstream.numberOfChannels}},{key:"getSampleRate",value:function(){return this.bitstream.sampleRate}},{key:"getTimeResolution",value:function(){return this.bitstream.sampleRate}},{key:"getCodec",value:function(){return this.bitstream.codecInfo.codec}},{key:"getInternalCodecId",value:function(){return null}},{key:"getDecoderConfig",value:function(){return(0,s._)(function(){var e;return(0,h._)(this,function(r){return(0,_.assert)(this.bitstream.codecInfo.codec),[2,{codec:this.bitstream.codecInfo.codec,numberOfChannels:this.bitstream.numberOfChannels,sampleRate:this.bitstream.sampleRate,description:null!=(e=this.bitstream.description)?e:void 0}]})}).call(this)}},{key:"getName",value:function(){return null}},{key:"getLanguageCode",value:function(){return _.UNDETERMINED_LANGUAGE}},{key:"getDisposition",value:function(){return(0,d._)({},k.DEFAULT_TRACK_DISPOSITION)}},{key:"getFirstTimestamp",value:function(){return(0,s._)(function(){return(0,h._)(this,function(e){return[2,0]})})()}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r,n;return(0,h._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"granulePositionToTimestampInSamples",value:function(e){return"opus"===this.bitstream.codecInfo.codec?((0,_.assert)(this.bitstream.codecInfo.opusInfo),e-this.bitstream.codecInfo.opusInfo.preSkip):e}},{key:"createEncodedPacketFromOggPacket",value:function(e,r,n){if(!e)return null;var a=(0,w.extractSampleMetadata)(e.data,this.bitstream.codecInfo,r.vorbisLastBlocksize),i=a.durationInSamples,s=a.vorbisBlockSize,o=new(0,y.EncodedPacket)(n.metadataOnly?y.PLACEHOLDER_DATA:e.data,"key",Math.max(0,r.timestampInSamples)/this.internalSampleRate,i/this.internalSampleRate,e.endPage.headerStartPos+e.endSegmentIndex,e.data.byteLength);return this.encodedPacketToMetadata.set(o,{packet:e,timestampInSamples:r.timestampInSamples,durationInSamples:i,vorbisLastBlockSize:r.vorbisLastBlocksize,vorbisBlockSize:s}),o}},{key:"getFirstPacket",value:function(e){return(0,s._)(function(){var r,n,a;return(0,h._)(this,function(i){switch(i.label){case 0:return(0,_.assert)(this.bitstream.lastMetadataPacket),[4,this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket)];case 1:if(!(r=i.sent()))return[2,null];return n=0,"opus"===this.bitstream.codecInfo.codec&&((0,_.assert)(this.bitstream.codecInfo.opusInfo),n-=this.bitstream.codecInfo.opusInfo.preSkip),[4,this.demuxer.readPacket(r.startPage,r.startSegmentIndex)];case 2:return a=i.sent(),[2,this.createEncodedPacketFromOggPacket(a,{timestampInSamples:n,vorbisLastBlocksize:null},e)]}})}).call(this)}},{key:"getNextPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s;return(0,h._)(this,function(o){switch(o.label){case 0:if(!(n=this.encodedPacketToMetadata.get(e)))throw Error("Packet was not created from this track.");return[4,this.demuxer.findNextPacketStart(n.packet)];case 1:if(!(a=o.sent()))return[2,null];return i=n.timestampInSamples+n.durationInSamples,[4,this.demuxer.readPacket(a.startPage,a.startSegmentIndex)];case 2:return s=o.sent(),[2,this.createEncodedPacketFromOggPacket(s,{timestampInSamples:i,vorbisLastBlocksize:n.vorbisBlockSize},r)]}})}).call(this)}},{key:"getPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o,c,u,l,d,f,p,m,g,b,k,x,I,P,C,A,B,M,D,F,R,U,O,L,N,V,z,H,G,q,W,K,X,Q,Z,Y,J,$,ee,et,er;return(0,h._)(this,function(h){switch(h.label){case 0:if(null===this.demuxer.reader.fileSize)return[2,this.getPacketSequential(e,r)];if(0===(n=(0,_.roundIfAlmostInteger)(e*this.internalSampleRate)))return[2,this.getFirstPacket(r)];if(n<0)return[2,null];return(0,_.assert)(this.bitstream.lastMetadataPacket),[4,this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket)];case 1:if(!(a=h.sent()))return[2,null];i=a.startPage,s=this.demuxer.reader.fileSize,o=[i],h.label=2;case 2:if(!(i.headerStartPos+i.totalSize<s))return[3,13];u=c=Math.floor((i.headerStartPos+s)/2),h.label=3;case 3:if(l=Math.min(u+T.MAX_PAGE_SIZE,s-T.MIN_PAGE_HEADER_SIZE),!((d=this.demuxer.reader.requestSlice(u,l-u))instanceof Promise))return[3,5];return[4,d];case 4:d=h.sent(),h.label=5;case 5:if((0,_.assert)(d),!(0,T.findNextPageHeader)(d,l))return s=c+T.MIN_PAGE_HEADER_SIZE,[3,2];if(!((f=this.demuxer.reader.requestSliceRange(d.filePos,T.MIN_PAGE_HEADER_SIZE,T.MAX_PAGE_HEADER_SIZE))instanceof Promise))return[3,7];return[4,f];case 6:f=h.sent(),h.label=7;case 7:if((0,_.assert)(f),p=(0,T.readPageHeader)(f),(0,_.assert)(p),m=!1,p.serialNumber!==this.bitstream.serialNumber)return[3,8];return m=!0,[3,11];case 8:if(!((g=this.demuxer.reader.requestSlice(p.headerStartPos,p.totalSize))instanceof Promise))return[3,10];return[4,g];case 9:g=h.sent(),h.label=10;case 10:(0,_.assert)(g),b=(0,S.readBytes)(g,p.totalSize),m=(0,w.computeOggPageCrc)(b)===p.checksum,h.label=11;case 11:if(!m)return u=p.headerStartPos+4,[3,3];if(m&&p.serialNumber!==this.bitstream.serialNumber||-1===p.granulePosition)return u=p.headerStartPos+p.totalSize,[3,3];return this.granulePositionToTimestampInSamples(p.granulePosition)>n?s=p.headerStartPos:(i=p,o.push(p)),[3,2];case 12:return[3,2];case 13:k=a.startPage,x=!0,I=!1,P=void 0;try{for(C=o[Symbol.iterator]();!(x=(A=C.next()).done)&&(B=A.value).granulePosition!==i.granulePosition;x=!0)(!k||B.headerStartPos>k.headerStartPos)&&(k=B)}catch(e){I=!0,P=e}finally{try{x||null==C.return||C.return()}finally{if(I)throw P}}D=[M=k],h.label=14;case 14:if(M.serialNumber===this.bitstream.serialNumber&&M.granulePosition===i.granulePosition)return[3,17];if(F=M.headerStartPos+M.totalSize,!((R=this.demuxer.reader.requestSliceRange(F,T.MIN_PAGE_HEADER_SIZE,T.MAX_PAGE_HEADER_SIZE))instanceof Promise))return[3,16];return[4,R];case 15:R=h.sent(),h.label=16;case 16:return(0,_.assert)(R),U=(0,T.readPageHeader)(R),(0,_.assert)(U),(M=U).serialNumber===this.bitstream.serialNumber&&D.push(M),[3,14];case 17:if((0,_.assert)(-1!==M.granulePosition),O=null,V=M,z=0,M.headerStartPos!==a.startPage.headerStartPos)return[3,18];return L=this.granulePositionToTimestampInSamples(0),N=!0,O=0,[3,20];case 18:for(L=0,N=!1,H=M.lacingValues.length-1;H>=0;H--)if(M.lacingValues[H]<255){O=H+1;break}if(null===O)throw Error("Invalid page with granule position: no packets end on this page.");return z=O-1,G={data:y.PLACEHOLDER_DATA,endPage:V,endSegmentIndex:z},[4,this.demuxer.findNextPacketStart(G)];case 19:if(h.sent())q=j(D,M,O),(0,_.assert)(q),(W=E(D,q.page,q.segmentIndex))&&(M=W.page,O=W.segmentIndex);else for(;(K=j(D,M,O))&&(X=E(D,K.page,K.segmentIndex));)if(M=X.page,O=X.segmentIndex,K.page.headerStartPos!==V.headerStartPos){V=K.page,z=K.segmentIndex;break}h.label=20;case 20:Q=null,Z=null,h.label=21;case 21:if(null===M)return[3,24];return(0,_.assert)(null!==O),[4,this.demuxer.readPacket(M,O)];case 22:if(!(Y=h.sent())||!(M.headerStartPos===a.startPage.headerStartPos&&O<a.startSegmentIndex)&&($=this.createEncodedPacketFromOggPacket(Y,{timestampInSamples:L,vorbisLastBlocksize:null!=(J=null==Z?void 0:Z.vorbisBlockSize)?J:null},r),(0,_.assert)($),ee=this.encodedPacketToMetadata.get($),(0,_.assert)(ee),N||Y.endPage.headerStartPos!==V.headerStartPos||Y.endSegmentIndex!==z?L+=ee.durationInSamples:(L=this.granulePositionToTimestampInSamples(M.granulePosition),N=!0,$=this.createEncodedPacketFromOggPacket(Y,{timestampInSamples:L-ee.durationInSamples,vorbisLastBlocksize:null!=(et=null==Z?void 0:Z.vorbisBlockSize)?et:null},r),(0,_.assert)($),ee=this.encodedPacketToMetadata.get($),(0,_.assert)(ee)),Q=$,Z=ee,N&&(Math.max(L,0)>n||Math.max(ee.timestampInSamples,0)===n)))return[3,24];return[4,this.demuxer.findNextPacketStart(Y)];case 23:if(!(er=h.sent()))return[3,24];return M=er.startPage,O=er.startSegmentIndex,[3,21];case 24:return[2,Q]}})}).call(this)}},{key:"getPacketSequential",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o,c,u,l;return(0,h._)(this,function(d){switch(d.label){case 0:return[4,this.sequentialScanMutex.acquire()];case 1:n=d.sent(),d.label=2;case 2:if(d.trys.push([2,,9,10]),e=(a=(0,_.roundIfAlmostInteger)(e*this.internalSampleRate))/this.internalSampleRate,-1===(i=(0,_.binarySearchLessOrEqual)(this.sequentialScanCache,a,function(e){return e.timestampInSamples})))return[3,3];return o=this.sequentialScanCache[i],s=this.createEncodedPacketFromOggPacket(o.packet,{timestampInSamples:o.timestampInSamples,vorbisLastBlocksize:o.vorbisLastBlockSize},r),[3,5];case 3:return[4,this.getFirstPacket(r)];case 4:s=d.sent(),d.label=5;case 5:c=0,d.label=6;case 6:if(!(s&&s.timestamp<e))return[3,8];return[4,this.getNextPacket(s,r)];case 7:if(!(u=d.sent())||u.timestamp>e)return[3,8];return s=u,100==++c&&(c=0,l=this.encodedPacketToMetadata.get(s),(0,_.assert)(l),this.sequentialScanCache.length>0&&(0,_.assert)((0,_.last)(this.sequentialScanCache).timestampInSamples<=l.timestampInSamples),this.sequentialScanCache.push(l)),[3,6];case 8:return[2,s];case 9:return n(),[7];case 10:return[2]}})}).call(this)}},{key:"getKeyPacket",value:function(e,r){return this.getPacket(e,r)}},{key:"getNextKeyPacket",value:function(e,r){return this.getNextPacket(e,r)}}]),e}(),E=function(e,r,n){var a=r,i=n;e:for(;;){for(i--;i>=0;i--)if(a.lacingValues[i]<255){i++;break e}if((0,_.assert)(-1===i),!(1&a.headerType)){i=0;break}var s=(0,_.findLast)(e,function(e){return e.headerStartPos<a.headerStartPos});if(!s)return null;i=(a=s).lacingValues.length}if((0,_.assert)(-1!==i),i===a.lacingValues.length){var o=e[e.indexOf(a)+1];(0,_.assert)(o),a=o,i=0}return{page:a,segmentIndex:i}},j=function(e,r,n){if(n>0)return{page:r,segmentIndex:n-1};var a=(0,_.findLast)(e,function(e){return e.headerStartPos<r.headerStartPos});return a?{page:a,segmentIndex:a.lacingValues.length-1}:null}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../codec.js":"fXWqW","../codec-data.js":"kWTYV","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../metadata.js":"eSjom","../misc.js":"j7iGm","../packet.js":"QfqGG","../reader.js":"8KRfO","./ogg-misc.js":"g1LsD","./ogg-reader.js":"fY5up","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],g1LsD:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"OGGS",function(){return u}),i.export(n,"computeOggPageCrc",function(){return p}),i.export(n,"extractSampleMetadata",function(){return m}),i.export(n,"buildOggMimeType",function(){return g});for(var s=e("@swc/helpers/cjs/_to_consumable_array.cjs"),o=e("../codec-data.js"),c=e("../misc.js"),u=0x5367674f,l=new Uint32Array(256),d=0;d<256;d++){for(var f=d<<24,h=0;h<8;h++)f=0x80000000&f?f<<1^0x4c11db7:f<<1;l[d]=f>>>0}var p=function(e){var r=(0,c.toDataView)(e),n=r.getUint32(22,!0);r.setUint32(22,0,!0);for(var a=0,i=0;i<e.length;i++)a=(a<<8^l[a>>>24^e[i]])>>>0;return r.setUint32(22,n,!0),a},m=function(e,r,n){var a=0,i=null;if(e.length>0)if("vorbis"===r.codec){(0,c.assert)(r.vorbisInfo);var s=r.vorbisInfo.modeBlockflags.length,u=(1<<(0,c.ilog)(s-1))-1<<1,l=(e[0]&u)>>1;if(l>=r.vorbisInfo.modeBlockflags.length)throw Error("Invalid mode number.");var d=n,f=r.vorbisInfo.modeBlockflags[l];if(i=r.vorbisInfo.blocksizes[f],1===f){var h=e[0]&(1|u)+1?1:0;d=r.vorbisInfo.blocksizes[h]}a=null!==d?d+i>>2:0}else"opus"===r.codec&&(a=(0,o.parseOpusTocByte)(e).durationInSamples);return{durationInSamples:a,vorbisBlockSize:i}},g=function(e){var r="audio/ogg";if(e.codecStrings){var n=(0,s._)(new Set(e.codecStrings));r+='; codecs="'.concat(n.join(", "),'"')}return r}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","../codec-data.js":"kWTYV","../misc.js":"j7iGm","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],fY5up:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"MIN_PAGE_HEADER_SIZE",function(){return c}),i.export(n,"MAX_PAGE_HEADER_SIZE",function(){return u}),i.export(n,"MAX_PAGE_SIZE",function(){return l}),i.export(n,"readPageHeader",function(){return d}),i.export(n,"findNextPageHeader",function(){return f});var s=e("../reader.js"),o=e("./ogg-misc.js"),c=27,u=282,l=65307,d=function(e){var r=e.filePos;if((0,s.readU32Le)(e)!==o.OGGS)return null;e.skip(1);for(var n=(0,s.readU8)(e),a=(0,s.readI64Le)(e),i=(0,s.readU32Le)(e),c=(0,s.readU32Le)(e),u=(0,s.readU32Le)(e),l=(0,s.readU8)(e),d=new Uint8Array(l),f=0;f<l;f++)d[f]=(0,s.readU8)(e);var h=27+l,p=d.reduce(function(e,r){return e+r},0);return{headerStartPos:r,totalSize:h+p,dataStartPos:r+h,dataSize:p,headerType:n,granulePosition:a,serialNumber:i,sequenceNumber:c,checksum:u,lacingValues:d}},f=function(e,r){for(;e.filePos<r-3;){var n=(0,s.readU32Le)(e),a=255&n,i=n>>>8&255,c=n>>>16&255,u=n>>>24&255;if(79===a||79===i||79===c||79===u){if(e.skip(-4),n===o.OGGS)return!0;e.skip(1)}}return!1}},{"../reader.js":"8KRfO","./ogg-misc.js":"g1LsD","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cokSU:[function(e,r,n,a){var i,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"WaveFormat",function(){return s}),o.export(n,"WaveDemuxer",function(){return T});var c=e("@swc/helpers/cjs/_async_to_generator.cjs"),u=e("@swc/helpers/cjs/_call_super.cjs"),l=e("@swc/helpers/cjs/_class_call_check.cjs"),d=e("@swc/helpers/cjs/_create_class.cjs"),f=e("@swc/helpers/cjs/_inherits.cjs"),h=e("@swc/helpers/cjs/_object_spread.cjs"),p=e("@swc/helpers/cjs/_to_consumable_array.cjs"),m=e("@swc/helpers/cjs/_ts_generator.cjs"),g=e("../demuxer.js"),b=e("../input-track.js"),k=e("../metadata.js"),_=e("../misc.js"),y=e("../packet.js"),S=e("../reader.js"),w=e("../id3.js");(i=s||(s={}))[i.PCM=1]="PCM",i[i.IEEE_FLOAT=3]="IEEE_FLOAT",i[i.ALAW=6]="ALAW",i[i.MULAW=7]="MULAW",i[i.EXTENSIBLE=65534]="EXTENSIBLE";var T=function(e){"use strict";function r(e){var n;return(0,l._)(this,r),(n=(0,u._)(this,r,[e])).metadataPromise=null,n.dataStart=-1,n.dataSize=-1,n.audioInfo=null,n.tracks=[],n.lastKnownPacketIndex=0,n.metadataTags={},n.reader=e._reader,n}return(0,f._)(r,e),(0,d._)(r,[{key:"readMetadata",value:function(){return(0,c._)(function(){var e,r;return(0,m._)(this,function(n){return e=this,[2,null!=(r=this.metadataPromise)?r:this.metadataPromise=(0,c._)(function(){var e,r,n,a,i,s,o,c,u,l,d,f,h,p,g,k,y,w;return(0,m._)(this,function(m){switch(m.label){case 0:if(!((e=this.reader.requestSlice(0,12))instanceof Promise))return[3,2];return[4,e];case 1:e=m.sent(),m.label=2;case 2:if((0,_.assert)(e),n="RIFX"!==(r=(0,S.readAscii)(e,4)),a="RF64"===r,i=(0,S.readU32)(e,n),o=a?this.reader.fileSize:Math.min(i+8,null!=(s=this.reader.fileSize)?s:1/0),"WAVE"!==(0,S.readAscii)(e,4))throw Error("Invalid WAVE file - wrong format");c=0,u=null,l=e.filePos,m.label=3;case 3:if(!(null===o||l<o))return[3,16];if(!((d=this.reader.requestSlice(l,8))instanceof Promise))return[3,5];return[4,d];case 4:d=m.sent(),m.label=5;case 5:if(!d)return[3,16];if(f=(0,S.readAscii)(d,4),h=(0,S.readU32)(d,n),p=d.filePos,a&&0===c&&"ds64"!==f)throw Error('Invalid RF64 file: First chunk must be "ds64".');if("fmt "!==f)return[3,7];return[4,this.parseFmtChunk(p,h,n)];case 6:return m.sent(),[3,15];case 7:if("data"!==f)return[3,8];if(null!=u||(u=h),this.dataStart=d.filePos,this.dataSize=Math.min(u,(null!=o?o:1/0)-this.dataStart),null===this.reader.fileSize)return[3,16];return[3,15];case 8:if("ds64"!==f)return[3,11];if(!((g=this.reader.requestSlice(p,h))instanceof Promise))return[3,10];return[4,g];case 9:g=m.sent(),m.label=10;case 10:if(!g)return[3,16];return k=(0,S.readU64)(g,n),u=(0,S.readU64)(g,n),o=Math.min(k+8,null!=(y=this.reader.fileSize)?y:1/0),[3,15];case 11:if("LIST"!==f)return[3,13];return[4,this.parseListChunk(p,h,n)];case 12:return m.sent(),[3,15];case 13:if("ID3 "!==f&&"id3 "!==f)return[3,15];return[4,this.parseId3Chunk(p,h)];case 14:m.sent(),m.label=15;case 15:return l=p+h+(1&h),c++,[3,3];case 16:if(!this.audioInfo)throw Error('Invalid WAVE file - missing "fmt " chunk');if(-1===this.dataStart)throw Error('Invalid WAVE file - missing "data" chunk');return w=this.audioInfo.blockSizeInBytes,this.dataSize=Math.floor(this.dataSize/w)*w,this.tracks.push(new(0,b.InputAudioTrack)(this.input,new x(this))),[2]}})}).call(e)]})}).call(this)}},{key:"parseFmtChunk",value:function(e,r,n){return(0,c._)(function(){var a,i,o,c,u,l,d;return(0,m._)(this,function(f){switch(f.label){case 0:if(!((a=this.reader.requestSlice(e,r))instanceof Promise))return[3,2];return[4,a];case 1:a=f.sent(),f.label=2;case 2:if(!a)return[2];return i=(0,S.readU16)(a,n),o=(0,S.readU16)(a,n),c=(0,S.readU32)(a,n),a.skip(4),u=(0,S.readU16)(a,n),l=14===r?8:(0,S.readU16)(a,n),r>=18&&357!==i&&Math.min(r-18,(0,S.readU16)(a,n))>=22&&i===s.EXTENSIBLE&&(a.skip(6),i=(d=(0,S.readBytes)(a,16))[0]|d[1]<<8),(i===s.MULAW||i===s.ALAW)&&(l=8),this.audioInfo={format:i,numberOfChannels:o,sampleRate:c,sampleSizeInBytes:Math.ceil(l/8),blockSizeInBytes:u},[2]}})}).call(this)}},{key:"parseListChunk",value:function(e,r,n){return(0,c._)(function(){var a,i,s,o,c,u,l,d,f,h,g,b,k,_,y,w,T,x,I,E,j,P,C,A,B,M;return(0,m._)(this,function(m){switch(m.label){case 0:if(!((a=this.reader.requestSlice(e,r))instanceof Promise))return[3,2];return[4,a];case 1:a=m.sent(),m.label=2;case 2:if(!a||"INFO"!==(i=(0,S.readAscii)(a,4))&&"INF0"!==i)return[2];for(s=a.filePos;s<=e+r-8;){for(h=0,a.filePos=s,u=(0,S.readAscii)(a,4),l=(0,S.readU32)(a,n),d=(0,S.readBytes)(a,l),f=0;h<d.length&&0!==d[h];h++)f++;switch(g=(o=String).fromCharCode.apply(o,(0,p._)(d.subarray(0,f))),null!=(c=this.metadataTags).raw||(c.raw={}),this.metadataTags.raw[u]=g,u){case"INAM":case"TITL":null!=(b=this.metadataTags).title||(b.title=g);break;case"TIT3":null!=(k=this.metadataTags).description||(k.description=g);break;case"IART":null!=(_=this.metadataTags).artist||(_.artist=g);break;case"IPRD":null!=(y=this.metadataTags).album||(y.album=g);break;case"IPRT":case"ITRK":case"TRCK":I=Number.parseInt((x=g.split("/"))[0],10),E=x[1]&&Number.parseInt(x[1],10),Number.isInteger(I)&&I>0&&(null!=(w=this.metadataTags).trackNumber||(w.trackNumber=I)),E&&Number.isInteger(E)&&E>0&&(null!=(T=this.metadataTags).tracksTotal||(T.tracksTotal=E));break;case"ICRD":case"IDIT":Number.isNaN((P=new Date(g)).getTime())||null!=(j=this.metadataTags).date||(j.date=P);break;case"YEAR":Number.isInteger(A=Number.parseInt(g,10))&&A>0&&(null!=(C=this.metadataTags).date||(C.date=new Date(A,0,1)));break;case"IGNR":case"GENR":null!=(B=this.metadataTags).genre||(B.genre=g);break;case"ICMT":case"CMNT":case"COMM":null!=(M=this.metadataTags).comment||(M.comment=g)}s+=8+l+(1&l)}return[2]}})}).call(this)}},{key:"parseId3Chunk",value:function(e,r){return(0,c._)(function(){var n,a,i;return(0,m._)(this,function(s){switch(s.label){case 0:if(!((n=this.reader.requestSlice(e,r))instanceof Promise))return[3,2];return[4,n];case 1:n=s.sent(),s.label=2;case 2:if(!n)return[2];return(a=(0,w.readId3V2Header)(n))&&(i=n.slice(e+10,a.size),(0,w.parseId3V2Tag)(i,a,this.metadataTags)),[2]}})}).call(this)}},{key:"getCodec",value:function(){if((0,_.assert)(this.audioInfo),this.audioInfo.format===s.MULAW)return"ulaw";if(this.audioInfo.format===s.ALAW)return"alaw";if(this.audioInfo.format===s.PCM){if(1===this.audioInfo.sampleSizeInBytes)return"pcm-u8";else if(2===this.audioInfo.sampleSizeInBytes)return"pcm-s16";else if(3===this.audioInfo.sampleSizeInBytes)return"pcm-s24";else if(4===this.audioInfo.sampleSizeInBytes)return"pcm-s32"}return this.audioInfo.format===s.IEEE_FLOAT&&4===this.audioInfo.sampleSizeInBytes?"pcm-f32":null}},{key:"getMimeType",value:function(){return(0,c._)(function(){return(0,m._)(this,function(e){return[2,"audio/wav"]})})()}},{key:"computeDuration",value:function(){return(0,c._)(function(){var e;return(0,m._)(this,function(r){switch(r.label){case 0:return[4,this.readMetadata()];case 1:return r.sent(),e=this.tracks[0],(0,_.assert)(e),[2,e.computeDuration()]}})}).call(this)}},{key:"getTracks",value:function(){return(0,c._)(function(){return(0,m._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.tracks]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,c._)(function(){return(0,m._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.metadataTags]}})}).call(this)}}]),r}(g.Demuxer),x=function(){"use strict";function e(r){(0,l._)(this,e),this.demuxer=r}return(0,d._)(e,[{key:"getId",value:function(){return 1}},{key:"getCodec",value:function(){return this.demuxer.getCodec()}},{key:"getInternalCodecId",value:function(){return(0,_.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.format}},{key:"getDecoderConfig",value:function(){return(0,c._)(function(){var e;return(0,m._)(this,function(r){return(e=this.demuxer.getCodec())?((0,_.assert)(this.demuxer.audioInfo),[2,{codec:e,numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate}]):[2,null]})}).call(this)}},{key:"computeDuration",value:function(){return(0,c._)(function(){var e,r,n;return(0,m._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"getNumberOfChannels",value:function(){return(0,_.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}},{key:"getSampleRate",value:function(){return(0,_.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}},{key:"getTimeResolution",value:function(){return(0,_.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}},{key:"getName",value:function(){return null}},{key:"getLanguageCode",value:function(){return _.UNDETERMINED_LANGUAGE}},{key:"getDisposition",value:function(){return(0,h._)({},k.DEFAULT_TRACK_DISPOSITION)}},{key:"getFirstTimestamp",value:function(){return(0,c._)(function(){return(0,m._)(this,function(e){return[2,0]})})()}},{key:"getPacketAtIndex",value:function(e,r){return(0,c._)(function(){var n,a,i,s,o,c,u;return(0,m._)(this,function(l){switch(l.label){case 0:if((0,_.assert)(this.demuxer.audioInfo),(n=2048*e*this.demuxer.audioInfo.blockSizeInBytes)>=this.demuxer.dataSize)return[2,null];if(a=Math.min(2048*this.demuxer.audioInfo.blockSizeInBytes,this.demuxer.dataSize-n),null!==this.demuxer.reader.fileSize)return[3,3];if(!((i=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,a))instanceof Promise))return[3,2];return[4,i];case 1:i=l.sent(),l.label=2;case 2:if(!i)return[2,null];l.label=3;case 3:if(!r.metadataOnly)return[3,4];return s=y.PLACEHOLDER_DATA,[3,7];case 4:if(!((o=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,a))instanceof Promise))return[3,6];return[4,o];case 5:o=l.sent(),l.label=6;case 6:(0,_.assert)(o),s=(0,S.readBytes)(o,a),l.label=7;case 7:return c=2048*e/this.demuxer.audioInfo.sampleRate,u=a/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate,this.demuxer.lastKnownPacketIndex=Math.max(e,c),[2,new(0,y.EncodedPacket)(s,"key",c,u,e,a)]}})}).call(this)}},{key:"getFirstPacket",value:function(e){return this.getPacketAtIndex(0,e)}},{key:"getPacket",value:function(e,r){return(0,c._)(function(){var n,a,i,s;return(0,m._)(this,function(o){switch(o.label){case 0:return(0,_.assert)(this.demuxer.audioInfo),n=Math.floor(Math.min(e*this.demuxer.audioInfo.sampleRate/2048,(this.demuxer.dataSize-1)/(2048*this.demuxer.audioInfo.blockSizeInBytes))),[4,this.getPacketAtIndex(n,r)];case 1:if(a=o.sent())return[2,a];if(0===n)return[2,null];return(0,_.assert)(null===this.demuxer.reader.fileSize),[4,this.getPacketAtIndex(this.demuxer.lastKnownPacketIndex,r)];case 2:i=o.sent(),o.label=3;case 3:if(!i)return[3,5];return[4,this.getNextPacket(i,r)];case 4:if(!(s=o.sent()))return[3,5];return i=s,[3,3];case 5:return[2,i]}})}).call(this)}},{key:"getNextPacket",value:function(e,r){(0,_.assert)(this.demuxer.audioInfo);var n=Math.round(e.timestamp*this.demuxer.audioInfo.sampleRate/2048);return this.getPacketAtIndex(n+1,r)}},{key:"getKeyPacket",value:function(e,r){return this.getPacket(e,r)}},{key:"getNextKeyPacket",value:function(e,r){return this.getNextPacket(e,r)}}]),e}()},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../metadata.js":"eSjom","../misc.js":"j7iGm","../packet.js":"QfqGG","../reader.js":"8KRfO","../id3.js":"42Y2c","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"5AUBv":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"MIN_FRAME_HEADER_SIZE",function(){return c}),i.export(n,"MAX_FRAME_HEADER_SIZE",function(){return u}),i.export(n,"readFrameHeader",function(){return l});var s=e("../misc.js"),o=e("../reader.js"),c=7,u=9,l=function(e){var r=e.filePos,n=(0,o.readBytes)(e,9),a=new(0,s.Bitstream)(n);if(4095!==a.readBits(12)||(a.skipBits(1),0!==a.readBits(2)))return null;var i=a.readBits(1),c=a.readBits(2)+1,u=a.readBits(4);if(15===u)return null;a.skipBits(1);var l=a.readBits(3);if(0===l)throw Error("ADTS frames with channel configuration 0 are not supported.");a.skipBits(1),a.skipBits(1),a.skipBits(1),a.skipBits(1);var d=a.readBits(13);a.skipBits(11);var f=a.readBits(2)+1;if(1!==f)throw Error("ADTS frames with more than one AAC frame are not supported.");var h=null;return 1===i?e.filePos-=2:h=a.readBits(16),{objectType:c,samplingFrequencyIndex:u,channelConfiguration:l,frameLength:d,numberOfAacFrames:f,crcCheck:h,startPos:r}}},{"../misc.js":"j7iGm","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"3t0bF":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"AdtsDemuxer",function(){return S});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_ts_generator.cjs"),h=e("../codec.js"),p=e("../demuxer.js"),m=e("../input-track.js"),g=e("../misc.js"),b=e("../packet.js"),k=e("../reader.js"),_=e("../metadata.js"),y=e("./adts-reader.js"),S=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).metadataPromise=null,n.firstFrameHeader=null,n.loadedSamples=[],n.tracks=[],n.readingMutex=new(0,g.AsyncMutex),n.lastSampleLoaded=!1,n.lastLoadedPos=0,n.nextTimestampInSamples=0,n.reader=e._reader,n}return(0,l._)(r,e),(0,u._)(r,[{key:"readMetadata",value:function(){return(0,s._)(function(){var e,r;return(0,f._)(this,function(n){return e=this,[2,null!=(r=this.metadataPromise)?r:this.metadataPromise=(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:if(!(!this.firstFrameHeader&&!this.lastSampleLoaded))return[3,2];return[4,this.advanceReader()];case 1:return e.sent(),[3,0];case 2:return(0,g.assert)(this.firstFrameHeader),this.tracks=[new(0,m.InputAudioTrack)(this.input,new w(this))],[2]}})}).call(e)]})}).call(this)}},{key:"advanceReader",value:function(){return(0,s._)(function(){var e,r,n,a,i,s;return(0,f._)(this,function(o){switch(o.label){case 0:if(!((e=this.reader.requestSliceRange(this.lastLoadedPos,y.MIN_FRAME_HEADER_SIZE,y.MAX_FRAME_HEADER_SIZE))instanceof Promise))return[3,2];return[4,e];case 1:e=o.sent(),o.label=2;case 2:if(!e||!(r=(0,y.readFrameHeader)(e))||null!==this.reader.fileSize&&r.startPos+r.frameLength>this.reader.fileSize)return this.lastSampleLoaded=!0,[2];return this.firstFrameHeader||(this.firstFrameHeader=r),n=h.aacFrequencyTable[r.samplingFrequencyIndex],(0,g.assert)(void 0!==n),a=1024/n,i=r.crcCheck?y.MAX_FRAME_HEADER_SIZE:y.MIN_FRAME_HEADER_SIZE,s={timestamp:this.nextTimestampInSamples/n,duration:a,dataStart:r.startPos+i,dataSize:r.frameLength-i},this.loadedSamples.push(s),this.nextTimestampInSamples+=1024,this.lastLoadedPos=r.startPos+r.frameLength,[2]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,"audio/aac"]})})()}},{key:"getTracks",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.tracks]}})}).call(this)}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e;return(0,f._)(this,function(r){switch(r.label){case 0:return[4,this.readMetadata()];case 1:return r.sent(),e=this.tracks[0],(0,g.assert)(e),[2,e.computeDuration()]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,{}]})})()}}]),r}(p.Demuxer),w=function(){"use strict";function e(r){(0,c._)(this,e),this.demuxer=r}return(0,u._)(e,[{key:"getId",value:function(){return 1}},{key:"getFirstTimestamp",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,0]})})()}},{key:"getTimeResolution",value:function(){return this.getSampleRate()/1024}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r,n;return(0,f._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"getName",value:function(){return null}},{key:"getLanguageCode",value:function(){return g.UNDETERMINED_LANGUAGE}},{key:"getCodec",value:function(){return"aac"}},{key:"getInternalCodecId",value:function(){return(0,g.assert)(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.objectType}},{key:"getNumberOfChannels",value:function(){(0,g.assert)(this.demuxer.firstFrameHeader);var e=h.aacChannelMap[this.demuxer.firstFrameHeader.channelConfiguration];return(0,g.assert)(void 0!==e),e}},{key:"getSampleRate",value:function(){(0,g.assert)(this.demuxer.firstFrameHeader);var e=h.aacFrequencyTable[this.demuxer.firstFrameHeader.samplingFrequencyIndex];return(0,g.assert)(void 0!==e),e}},{key:"getDisposition",value:function(){return(0,d._)({},_.DEFAULT_TRACK_DISPOSITION)}},{key:"getDecoderConfig",value:function(){return(0,s._)(function(){var e,r,n,a,i,s;return(0,f._)(this,function(o){return(0,g.assert)(this.demuxer.firstFrameHeader),e=new Uint8Array(3),r=new(0,g.Bitstream)(e),a=(n=this.demuxer.firstFrameHeader).objectType,i=n.samplingFrequencyIndex,s=n.channelConfiguration,a>31?(r.writeBits(5,31),r.writeBits(6,a-32)):r.writeBits(5,a),r.writeBits(4,i),r.writeBits(4,s),[2,{codec:"mp4a.40.".concat(this.demuxer.firstFrameHeader.objectType),numberOfChannels:this.getNumberOfChannels(),sampleRate:this.getSampleRate(),description:e.subarray(0,Math.ceil((r.pos-1)/8))}]})}).call(this)}},{key:"getPacketAtIndex",value:function(e,r){return(0,s._)(function(){var n,a,i;return(0,f._)(this,function(s){switch(s.label){case 0:if(-1===e||!(n=this.demuxer.loadedSamples[e]))return[2,null];if(!r.metadataOnly)return[3,1];return a=b.PLACEHOLDER_DATA,[3,4];case 1:if(!((i=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize))instanceof Promise))return[3,3];return[4,i];case 2:i=s.sent(),s.label=3;case 3:if(!i)return[2,null];a=(0,k.readBytes)(i,n.dataSize),s.label=4;case 4:return[2,new(0,b.EncodedPacket)(a,"key",n.timestamp,n.duration,e,n.dataSize)]}})}).call(this)}},{key:"getFirstPacket",value:function(e){return this.getPacketAtIndex(0,e)}},{key:"getNextPacket",value:function(e,r){return(0,s._)(function(){var n,a,i;return(0,f._)(this,function(s){switch(s.label){case 0:return[4,this.demuxer.readingMutex.acquire()];case 1:n=s.sent(),s.label=2;case 2:if(s.trys.push([2,,6,7]),-1===(a=(0,g.binarySearchExact)(this.demuxer.loadedSamples,e.timestamp,function(e){return e.timestamp})))throw Error("Packet was not created from this track.");i=a+1,s.label=3;case 3:if(!(i>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded))return[3,5];return[4,this.demuxer.advanceReader()];case 4:return s.sent(),[3,3];case 5:return[2,this.getPacketAtIndex(i,r)];case 6:return n(),[7];case 7:return[2]}})}).call(this)}},{key:"getPacket",value:function(e,r){return(0,s._)(function(){var n,a;return(0,f._)(this,function(i){switch(i.label){case 0:return[4,this.demuxer.readingMutex.acquire()];case 1:n=i.sent(),i.label=2;case 2:i.trys.push([2,,6,7]),i.label=3;case 3:if(-1===(a=(0,g.binarySearchLessOrEqual)(this.demuxer.loadedSamples,e,function(e){return e.timestamp}))&&this.demuxer.loadedSamples.length>0)return[2,null];if(this.demuxer.lastSampleLoaded||a>=0&&a+1<this.demuxer.loadedSamples.length)return[2,this.getPacketAtIndex(a,r)];return[4,this.demuxer.advanceReader()];case 4:return i.sent(),[3,3];case 5:return[3,7];case 6:return n(),[7];case 7:return[2]}})}).call(this)}},{key:"getKeyPacket",value:function(e,r){return this.getPacket(e,r)}},{key:"getNextKeyPacket",value:function(e,r){return this.getNextPacket(e,r)}}]),e}()},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../codec.js":"fXWqW","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../misc.js":"j7iGm","../packet.js":"QfqGG","../reader.js":"8KRfO","../metadata.js":"eSjom","./adts-reader.js":"5AUBv","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],e0w8C:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"FlacDemuxer",function(){return S});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_call_super.cjs"),c=e("@swc/helpers/cjs/_class_call_check.cjs"),u=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_ts_generator.cjs"),h=e("../codec-data.js"),p=e("../demuxer.js"),m=e("../input-track.js"),g=e("../misc.js"),b=e("../packet.js"),k=e("../reader.js"),_=e("../metadata.js"),y=e("./flac-misc.js"),S=function(e){"use strict";function r(e){var n;return(0,c._)(this,r),(n=(0,o._)(this,r,[e])).loadedSamples=[],n.metadataPromise=null,n.track=null,n.metadataTags={},n.audioInfo=null,n.lastLoadedPos=null,n.blockingBit=null,n.readingMutex=new(0,g.AsyncMutex),n.lastSampleLoaded=!1,n.reader=e._reader,n}return(0,l._)(r,e),(0,u._)(r,[{key:"computeDuration",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),(0,g.assert)(this.track),[2,this.track.computeDuration()]}})}).call(this)}},{key:"getMetadataTags",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),[2,this.metadataTags]}})}).call(this)}},{key:"getTracks",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){switch(e.label){case 0:return[4,this.readMetadata()];case 1:return e.sent(),(0,g.assert)(this.track),[2,[this.track]]}})}).call(this)}},{key:"getMimeType",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,"audio/flac"]})})()}},{key:"readMetadata",value:function(){return(0,s._)(function(){var e,r,n;return(0,f._)(this,function(a){return e=this,r=4,[2,null!=(n=this.metadataPromise)?n:this.metadataPromise=(0,s._)(function(){var e,n,a,i,s,o,c,u,l,d,p,b,_,y,S,T,x,I,E,j,P,C,A,B,M;return(0,f._)(this,function(f){switch(f.label){case 0:if(!(null===this.reader.fileSize||r<this.reader.fileSize))return[3,14];if(!((e=this.reader.requestSlice(r,4))instanceof Promise))return[3,2];return[4,e];case 1:e=f.sent(),f.label=2;case 2:if(r+=4,null===e)throw Error("Metadata block at position ".concat(r," is too small! Corrupted file."));switch((0,g.assert)(e),n=(0,k.readU8)(e),a=(0,k.readU24Be)(e),i=(128&n)!=0,127&n){case h.FlacBlockType.STREAMINFO:return[3,3];case h.FlacBlockType.VORBIS_COMMENT:return[3,6];case h.FlacBlockType.PICTURE:return[3,9]}return[3,12];case 3:if(!((s=this.reader.requestSlice(r,a))instanceof Promise))return[3,5];return[4,s];case 4:s=f.sent(),f.label=5;case 5:if((0,g.assert)(s),null===s)throw Error("StreamInfo block at position ".concat(r," is too small! Corrupted file."));return o=(0,k.readBytes)(s,34),u=(c=new(0,g.Bitstream)(o)).readBits(16),l=c.readBits(16),d=c.readBits(24),p=c.readBits(24),b=c.readBits(20),_=c.readBits(3)+1,c.readBits(5),y=c.readBits(36),c.skipBits(128),(S=new Uint8Array(42)).set(new Uint8Array([102,76,97,67]),0),S.set(new Uint8Array([128,0,0,34]),4),S.set(o,8),this.audioInfo={numberOfChannels:_,sampleRate:b,totalSamples:y,minimumBlockSize:u,maximumBlockSize:l,minimumFrameSize:d,maximumFrameSize:p,description:S},this.track=new(0,m.InputAudioTrack)(this.input,new w(this)),[3,13];case 6:if(!((T=this.reader.requestSlice(r,a))instanceof Promise))return[3,8];return[4,T];case 7:T=f.sent(),f.label=8;case 8:return(0,g.assert)(T),(0,h.readVorbisComments)((0,k.readBytes)(T,a),this.metadataTags),[3,13];case 9:if(!((I=this.reader.requestSlice(r,a))instanceof Promise))return[3,11];return[4,I];case 10:I=f.sent(),f.label=11;case 11:return(0,g.assert)(I),E=(0,k.readU32Be)(I),j=(0,k.readU32Be)(I),P=g.textDecoder.decode((0,k.readBytes)(I,j)),C=(0,k.readU32Be)(I),A=g.textDecoder.decode((0,k.readBytes)(I,C)),I.skip(16),B=(0,k.readU32Be)(I),M=(0,k.readBytes)(I,B),null!=(x=this.metadataTags).images||(x.images=[]),this.metadataTags.images.push({data:M,mimeType:P,kind:3===E?"coverFront":4===E?"coverBack":"unknown",description:A}),[3,13];case 12:return[3,13];case 13:if(r+=a,i)return this.lastLoadedPos=r,[3,14];return[3,0];case 14:return[2]}})}).call(e)]})}).call(this)}},{key:"readNextFlacFrame",value:function(e){return(0,s._)(function(e){var r,n,a,i,s,o,c,u,l;return(0,f._)(this,function(d){switch(d.label){case 0:return r=e.startPos,n=e.isFirstPacket,(0,g.assert)(this.audioInfo),a=6,i=this.audioInfo.maximumFrameSize+16,[4,this.reader.requestSliceRange(r,this.audioInfo.minimumFrameSize,i)];case 1:if(!(s=d.sent())||!(o=this.readFlacFrameHeader({slice:s,isFirstPacket:n})))return[2,null];for(s.filePos=r+this.audioInfo.minimumFrameSize;;){if(s.filePos>s.end-a)return[2,{num:o.num,blockSize:o.blockSize,sampleRate:o.sampleRate,size:s.end-r,isLastFrame:!0}];if(255===(0,k.readU8)(s)){if(c=s.filePos,(0,k.readU8)(s)!==(1===this.blockingBit?249:248)||(s.skip(-2),u=s.filePos-r,!(l=this.readFlacFrameHeader({slice:s,isFirstPacket:!1})))){s.filePos=c;continue}if(0===this.blockingBit){if(l.num-o.num!=1){s.filePos=c;continue}}else if(l.num-o.num!==o.blockSize){s.filePos=c;continue}return[2,{num:o.num,blockSize:o.blockSize,sampleRate:o.sampleRate,size:u,isLastFrame:!1}]}}return[2]}})}).apply(this,arguments)}},{key:"readFlacFrameHeader",value:function(e){var r=e.slice,n=e.isFirstPacket,a=r.filePos,i=(0,k.readBytes)(r,4),s=new(0,g.Bitstream)(i);if(32764!==s.readBits(15))return null;if(null===this.blockingBit){(0,g.assert)(n);var o=s.readBits(1);this.blockingBit=o}else if(1===this.blockingBit){if((0,g.assert)(!n),1!==s.readBits(1))return null}else if(0===this.blockingBit){if((0,g.assert)(!n),0!==s.readBits(1))return null}else throw Error("Invalid blocking bit");var c=(0,y.getBlockSizeOrUncommon)(s.readBits(4));if(!c)return null;(0,g.assert)(this.audioInfo);var u=(0,y.getSampleRateOrUncommon)(s.readBits(4),this.audioInfo.sampleRate);if(!u||(s.readBits(4),s.readBits(3),0!==s.readBits(1)))return null;var l=(0,y.readCodedNumber)(r),d=(0,y.readBlockSize)(r,c),f=(0,y.readSampleRate)(r,u);if(null===f||f!==this.audioInfo.sampleRate)return null;var h=r.filePos-a,p=(0,k.readU8)(r);return(r.skip(-h),r.skip(-1),p!==(0,y.calculateCrc8)((0,k.readBytes)(r,h)))?null:{num:l,blockSize:d,sampleRate:f}}},{key:"advanceReader",value:function(){return(0,s._)(function(){var e,r,n,a;return(0,f._)(this,function(i){switch(i.label){case 0:return[4,this.readMetadata()];case 1:return i.sent(),(0,g.assert)(null!==this.lastLoadedPos),(0,g.assert)(this.audioInfo),e=this.lastLoadedPos,[4,this.readNextFlacFrame({startPos:e,isFirstPacket:0===this.loadedSamples.length})];case 2:if(!(r=i.sent()))return this.lastSampleLoaded=!0,[2];return a={blockOffset:(n=this.loadedSamples[this.loadedSamples.length-1])?n.blockOffset+n.blockSize:0,blockSize:r.blockSize,byteOffset:e,byteSize:r.size},this.lastLoadedPos=this.lastLoadedPos+r.size,this.loadedSamples.push(a),r.isLastFrame&&(this.lastSampleLoaded=!0),[2]}})}).call(this)}}]),r}(p.Demuxer),w=function(){"use strict";function e(r){(0,c._)(this,e),this.demuxer=r}return(0,u._)(e,[{key:"getId",value:function(){return 1}},{key:"getCodec",value:function(){return"flac"}},{key:"getInternalCodecId",value:function(){return null}},{key:"getNumberOfChannels",value:function(){return(0,g.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}},{key:"computeDuration",value:function(){return(0,s._)(function(){var e,r,n;return(0,f._)(this,function(a){switch(a.label){case 0:return[4,this.getPacket(1/0,{metadataOnly:!0})];case 1:return[2,(null!=(r=null==(e=a.sent())?void 0:e.timestamp)?r:0)+(null!=(n=null==e?void 0:e.duration)?n:0)]}})}).call(this)}},{key:"getSampleRate",value:function(){return(0,g.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}},{key:"getName",value:function(){return null}},{key:"getLanguageCode",value:function(){return g.UNDETERMINED_LANGUAGE}},{key:"getTimeResolution",value:function(){return(0,g.assert)(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}},{key:"getDisposition",value:function(){return(0,d._)({},_.DEFAULT_TRACK_DISPOSITION)}},{key:"getFirstTimestamp",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return[2,0]})})()}},{key:"getDecoderConfig",value:function(){return(0,s._)(function(){return(0,f._)(this,function(e){return(0,g.assert)(this.demuxer.audioInfo),[2,{codec:"flac",numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate,description:this.demuxer.audioInfo.description}]})}).call(this)}},{key:"getPacket",value:function(e,r){return(0,s._)(function(){var n,a,i,s;return(0,f._)(this,function(o){switch(o.label){case 0:if(n=this,(0,g.assert)(this.demuxer.audioInfo),e<0)throw Error("Timestamp cannot be negative");return[4,this.demuxer.readingMutex.acquire()];case 1:a=o.sent(),o.label=2;case 2:o.trys.push([2,,9,10]),o.label=3;case 3:if(-1!==(i=(0,g.binarySearchLessOrEqual)(this.demuxer.loadedSamples,e,function(e){return e.blockOffset/n.demuxer.audioInfo.sampleRate})))return[3,5];return[4,this.demuxer.advanceReader()];case 4:case 6:return o.sent(),[3,3];case 5:if(!((s=this.demuxer.loadedSamples[i]).blockOffset/this.demuxer.audioInfo.sampleRate+s.blockSize/this.demuxer.audioInfo.sampleRate<=e))return[3,7];if(this.demuxer.lastSampleLoaded)return[2,this.getPacketAtIndex(this.demuxer.loadedSamples.length-1,r)];return[4,this.demuxer.advanceReader()];case 7:return[2,this.getPacketAtIndex(i,r)];case 8:return[3,10];case 9:return a(),[7];case 10:return[2]}})}).call(this)}},{key:"getNextPacket",value:function(e,r){return(0,s._)(function(){var n,a;return(0,f._)(this,function(i){switch(i.label){case 0:return[4,this.demuxer.readingMutex.acquire()];case 1:n=i.sent(),i.label=2;case 2:if(i.trys.push([2,,6,7]),a=e.sequenceNumber+1,this.demuxer.lastSampleLoaded&&a>=this.demuxer.loadedSamples.length)return[2,null];i.label=3;case 3:if(!(a>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded))return[3,5];return[4,this.demuxer.advanceReader()];case 4:return i.sent(),[3,3];case 5:return[2,this.getPacketAtIndex(a,r)];case 6:return n(),[7];case 7:return[2]}})}).call(this)}},{key:"getKeyPacket",value:function(e,r){return this.getPacket(e,r)}},{key:"getNextKeyPacket",value:function(e,r){return this.getNextPacket(e,r)}},{key:"getPacketAtIndex",value:function(e,r){return(0,s._)(function(){var n,a,i,s,o;return(0,f._)(this,function(c){switch(c.label){case 0:if(!(n=this.demuxer.loadedSamples[e]))return[2,null];if(!r.metadataOnly)return[3,1];return a=b.PLACEHOLDER_DATA,[3,4];case 1:if(!((i=this.demuxer.reader.requestSlice(n.byteOffset,n.byteSize))instanceof Promise))return[3,3];return[4,i];case 2:i=c.sent(),c.label=3;case 3:if(!i)return[2,null];a=(0,k.readBytes)(i,n.byteSize),c.label=4;case 4:return(0,g.assert)(this.demuxer.audioInfo),s=n.blockOffset/this.demuxer.audioInfo.sampleRate,o=n.blockSize/this.demuxer.audioInfo.sampleRate,[2,new(0,b.EncodedPacket)(a,"key",s,o,e,n.byteSize)]}})}).call(this)}},{key:"getFirstPacket",value:function(e){return(0,s._)(function(){return(0,f._)(this,function(r){switch(r.label){case 0:if(!(0===this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded))return[3,2];return[4,this.demuxer.advanceReader()];case 1:return r.sent(),[3,0];case 2:return[2,this.getPacketAtIndex(0,e)]}})}).call(this)}}]),e}()},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_call_super.cjs":"clpdF","@swc/helpers/cjs/_class_call_check.cjs":"4Uf9M","@swc/helpers/cjs/_create_class.cjs":"igUuK","@swc/helpers/cjs/_inherits.cjs":"jtSwf","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","../codec-data.js":"kWTYV","../demuxer.js":"d4thC","../input-track.js":"b22CJ","../misc.js":"j7iGm","../packet.js":"QfqGG","../reader.js":"8KRfO","../metadata.js":"eSjom","./flac-misc.js":"4iR5P","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"4iR5P":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"getBlockSizeOrUncommon",function(){return c}),i.export(n,"getSampleRateOrUncommon",function(){return u}),i.export(n,"readCodedNumber",function(){return l}),i.export(n,"readBlockSize",function(){return d}),i.export(n,"readSampleRate",function(){return f}),i.export(n,"calculateCrc8",function(){return h});var s=e("../misc.js"),o=e("../reader.js"),c=function(e){if(0===e)return null;if(1===e)return 192;if(e>=2&&e<=5)return 144*Math.pow(2,e);if(6===e)return"uncommon-u8";if(7===e)return"uncommon-u16";else if(e>=8&&e<=15)return Math.pow(2,e);else return null},u=function(e,r){switch(e){case 0:return r;case 1:return 88200;case 2:return 176400;case 3:return 192e3;case 4:return 8e3;case 5:return 16e3;case 6:return 22050;case 7:return 24e3;case 8:return 32e3;case 9:return 44100;case 10:return 48e3;case 11:return 96e3;case 12:return"uncommon-u8";case 13:return"uncommon-u16";case 14:return"uncommon-u16-10";default:return null}},l=function(e){for(var r=0,n=new(0,s.Bitstream)((0,o.readBytes)(e,1));1===n.readBits(1);)r++;if(0===r)return n.readBits(7);for(var a=[],i=r-1,c=new(0,s.Bitstream)((0,o.readBytes)(e,i)),u=8-r-1,l=0;l<u;l++)a.unshift(n.readBits(1));for(var d=0;d<i;d++)for(var f=0;f<8;f++){var h=c.readBits(1);f<2||a.unshift(h)}return a.reduce(function(e,r,n){return e|r<<n},0)},d=function(e,r){return"uncommon-u16"===r?(0,o.readU16Be)(e)+1:"uncommon-u8"===r?(0,o.readU8)(e)+1:"number"==typeof r?r:void((0,s.assertNever)(r),(0,s.assert)(!1))},f=function(e,r){return"uncommon-u16"===r?(0,o.readU16Be)(e):"uncommon-u16-10"===r?10*(0,o.readU16Be)(e):"uncommon-u8"===r?(0,o.readU8)(e):"number"==typeof r?r:null},h=function(e){var r=0,n=!0,a=!1,i=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var c=s.value;r^=c;for(var u=0;u<8;u++)(128&r)!=0?r=r<<1^7:r<<=1,r&=255}}catch(e){a=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}return r}},{"../misc.js":"j7iGm","../reader.js":"8KRfO","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],iWP57:[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return u});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("mediabunny");function u(e){var r=e.canvas,n=e.ctx,a=e.events,i=e.timeupdateInterval,u=void 0===i?250:i,l=e.avSyncTolerance,d=void 0===l?.12:l,f=e.dropLateFrames,h=void 0!==f&&f,p=e.poster,m=void 0===p?"":p,g=e.preflightRange,b=void 0!==g&&g,k=null,_=null,y=null,S=null,w=0,T=0,x=0,I=0,E=NaN,j=null,P=0,C=!1,A=1,B=!1;function M(){if(m&&!B){var e=new Image;e.onload=function(){n.clearRect(0,0,r.width,r.height),r.width=e.naturalWidth||r.width,r.height=e.naturalHeight||r.height,n.drawImage(e,0,0,r.width,r.height),B=!0},e.src=m}}function D(){return(0,s._)(function(){return(0,o._)(this,function(e){switch(e.label){case 0:return[4,null==y?void 0:y.return()];case 1:return e.sent(),y=null,[2]}})})()}function F(){n.clearRect(0,0,r.width,r.height)}function R(e){return(0,s._)(function(){var r,i,s;return(0,o._)(this,function(o){switch(o.label){case 0:return[4,D()];case 1:if(o.sent(),!_)return[2];return[4,(y=_.canvases(e)).next()];case 2:return i=null!=(r=o.sent().value)?r:null,[4,y.next()];case 3:return S=null!=(s=o.sent().value)?s:null,i?(n.drawImage(i.canvas,0,0),a.emit("loadeddata")):M(),[2]}})})()}function U(e){return(0,s._)(function(){var a,i,s,c;return(0,o._)(this,function(o){switch(o.label){case 0:if(!y)return[2];o.label=1;case 1:return[4,y.next()];case 2:if(!(i=null!=(a=o.sent().value)?a:null)||e!==T)return[2];if(s=j.currentTime,h){if(c=Math.max(.06,d/Math.max(1,A)),i.timestamp<s-c)return[3,1];if(!(i.timestamp<=s+c))return S=i,[2];n.clearRect(0,0,r.width,r.height),n.drawImage(i.canvas,0,0)}else{if(!(i.timestamp<=s))return S=i,[2];n.clearRect(0,0,r.width,r.height),n.drawImage(i.canvas,0,0)}return[3,1];case 3:return[2]}})})()}function O(){if(j){var e=j.currentTime,i=Date.now();if(i-P>=u&&(a.emit("timeupdate"),P=i),Number.isFinite(E)&&e>=E){L(),a.emit("ended");return}S&&S.timestamp<=e?(n.clearRect(0,0,r.width,r.height),n.drawImage(S.canvas,0,0),S=null,U(T),C&&(a.emit("canplay"),a.emit("playing"),C=!1)):!S&&(U(T),!S&&Number.isFinite(E)&&e<E&&!C&&(C=!0,a.emit("waiting"))),w=requestAnimationFrame(O)}}function L(){cancelAnimationFrame(w)}return{load:function(e,n){return(0,s._)(function(){var i,u,l,d,f;return(0,o._)(this,function(h){switch(h.label){case 0:return i=++T,[4,D()];case 1:return h.sent(),F(),B=!1,[4,(0,s._)(function(){var r;return(0,o._)(this,function(n){switch(n.label){case 0:if(!b||"string"!=typeof e)return[2,!0];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch(e,{method:"HEAD"})];case 2:if(!(r=n.sent().headers.get("accept-ranges"))||"none"===r)return a.emit("error",new Event("RangeNotSupported")),[2,!1];return[2,!0];case 3:return console.warn("preflight failed",n.sent()),[2,!0];case 4:return[2]}})})()];case 2:if(!h.sent())return[2];if(!(u="string"==typeof e?new(0,c.UrlSource)(e):e instanceof Blob?new(0,c.BlobSource)(e):"undefined"!=typeof ReadableStream&&e instanceof ReadableStream?new(0,c.ReadableStreamSource)(e):e))return M(),[2];return[4,(k=new(0,c.Input)({source:u,formats:c.ALL_FORMATS})).computeDuration()];case 3:if(E=h.sent(),i!==T)return[2];return[4,k.getPrimaryVideoTrack()];case 4:if(!(l=h.sent()))return _=null,x=0,I=0,r.width=0,r.height=0,M(),n&&n(),[2];if(d=null===l.codec)return[3,6];return[4,l.canDecode()];case 5:d=!h.sent(),h.label=6;case 6:if(d)return _=null,x=0,I=0,r.width=0,r.height=0,F(),M(),n&&n(),[2];return[4,l.canBeTransparent()];case 7:return f=h.sent(),_=new(0,c.CanvasSink)(l,{poolSize:2,fit:"contain",alpha:f}),x=l.displayWidth,I=l.displayHeight,r.width=x,r.height=I,n&&n(),[4,R(0)];case 8:return h.sent(),[2]}})})()},start:function(e){j=e,T++,C=!1,U(T),w=requestAnimationFrame(O)},stop:L,seek:function(e){return(0,s._)(function(){return(0,o._)(this,function(r){switch(r.label){case 0:return T++,[4,R(e)];case 1:return r.sent(),[2]}})})()},setPlaybackRate:function(e){A=Math.max(.1,Number(e)||1)},destroy:function(){T++,L(),D(),B=!1,k=null,_=null},get width(){return x},get height(){return I},get duration(){return E}}}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh",mediabunny:"b8Ej9","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"39E3e":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");function s(e,r,n){return Math.max(r,Math.min(n,Number(e)||0))}i.defineInteropFlag(n),i.export(n,"default",function(){return s})},{"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"2Lzla":[function(e,r,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");function s(){var e=new Map;return{addEventListener:function(r,n){e.has(r)||e.set(r,[]),e.get(r).push(n)},removeEventListener:function(r,n){var a=e.get(r);if(a){var i=a.indexOf(n);i>=0&&a.splice(i,1)}},emit:function(r,n){var a=new Event(r);a.detail=n;var i=e.get(r);i&&i.forEach(function(e){return e(a)})}}}i.defineInteropFlag(n),i.export(n,"createVideoEventTarget",function(){return s})},{"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}]},["OIaIB"],"OIaIB","parcelRequire4dc0",{});