theoplayer
Version:
THEOplayer is the universal video player solution, enabling you to quickly deliver cross-platform content playback.
40 lines (32 loc) • 1.78 MB
JavaScript
/*!
THEOplayer
Usage of this software is limited by the THEOplayer License.
It is prohibited to reverse engineer, decompile, translate,
disassemble, decipher, decrypt, or otherwise attempt to
discover the source code of this software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, visit https://www.theoplayer.com or contact
contact @ theoplayer . com
This product makes use of Open Source Software: video.js
(Apache 2.0 - Copyright Brightcove, Inc.), long.js (Apache 2.0),
nodejs-langs (MIT - Copyright Andrew Lawson), promise-polyfill
(MIT - Copyright (c) 2014 Taylor Hakes & Forbes Lindesay),
shaka-player (Apache 2.0 - Copyright 2016 Google LLC)
The code of these projects has been heavily modified during
integration.
More information on the licenses can be found here: Apache 2.0
(http://www.apache.org/licenses/LICENSE-2.0), MIT
(https://opensource.org/licenses/MIT)
THEOplayer is based on patented technology developed by
THEO Technologies (https://www.theoplayer.com).
Version: 9.10.1
Created: 2025-08-13T16:11:29.716Z
*/
var td,f,id,Nt,Mt,sd,ed,nd,y,rd,a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==s?s:"undefined"!=typeof global?global:this,s=a.window,h=a.document,hd=a.location,od=a.navigator,u=a.setTimeout,c=a.clearTimeout,v=a.setInterval,p=a.clearInterval,m=a.Error,g=a.TypeError,w=(a.SyntaxError,a.Object),_=a.Math,x=a.parseInt,C=a.parseFloat,S=a.isNaN,j=a.Uint8Array,ad=a.Worker,ud=(a.WorkerGlobalScope,a.XMLHttpRequest),cd=w.create,dd=w.defineProperty,ld=w.getOwnPropertyDescriptor,fd=w.getOwnPropertyNames,vd=w.getPrototypeOf,_d=w.prototype.hasOwnProperty,Qn=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports),on=(t,i,s)=>(s=null!=t?cd(vd(t)):{},((t,i,s,e)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of fd(i))_d.call(t,n)||n===s||dd(t,n,{get:()=>i[n],enumerable:!(e=ld(i,n))||e.enumerable});return t})(!i&&t&&t.__esModule?s:dd(s,"default",{value:t,enumerable:!0}),t)),r=(y=()=>{"use strict";if("function"==typeof Symbol&&Symbol.iterator)td=Symbol,f=null!=(sd=Symbol.for)?sd:Symbol,id=Symbol.iterator,Nt=null!=(ed=Symbol.dispose)?ed:f("Symbol.dispose"),Mt=null!=(nd=Symbol.asyncDispose)?nd:f("Symbol.asyncDispose");else{let t=0;td=function(i){return"hd"+i+"_"+ ++t},id=(f=function(t){return"hd"+t})("Symbol.iterator"),Nt=f("Symbol.dispose"),Mt=f("Symbol.asyncDispose"),td.for=f,td.iterator=id,td.dispose=Nt,td.asyncDispose=Mt}},()=>(y&&(rd=y(y=0)),rd)),gd=Qn((t,i)=>{r(),function(s,e){"object"==typeof t&&void 0!==i?e(t):"function"==typeof define&&define.amd?define(["exports"],e):e((s=s||self).WebStreamsPolyfill={})}(t,function(t){"use strict";var i="function"==typeof td&&"symbol"==typeof id?td:function(t){return"Symbol("+t+")"};function s(){}var e=Number.isNaN||function(t){return t!=t},n=s;function r(t){return"object"==typeof t&&null!==t||"function"==typeof t}function h(t){return t.slice()}function o(t,i,s,e,n){new j(t).set(new j(s,e,n),i)}function a(t){return!1!==function(t){if("number"!=typeof t)return!1;if(e(t))return!1;if(t<0)return!1;return!0}(t)&&t!==1/0}function u(t,i,s){if("function"!=typeof t)throw new g("Argument is not a function");return Function.prototype.apply.call(t,i,s)}function c(t,i,s,e){var n=t[i];if(void 0!==n){if("function"!=typeof n)throw new g(n+" is not a method");switch(s){case 0:return function(){return l(n,t,e)};case 1:return function(i){var s=[i].concat(e);return l(n,t,s)}}}return function(){return T(void 0)}}function d(t,i,s){var e=t[i];if(void 0!==e)return u(e,t,s)}function l(t,i,s){try{return T(u(t,i,s))}catch(t){return k(t)}}function f(t){if(t=Number(t),e(t)||t<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return t}function v(t){if(void 0===t)return function(){return 1};if("function"!=typeof t)throw new g("size property of a queuing strategy must be a function");return function(i){return t(i)}}var p=Promise,y=Promise.prototype.then,b=Promise.resolve.bind(p),A=Promise.reject.bind(p);function S(t){return new p(t)}function T(t){return b(t)}function k(t){return A(t)}function E(t,i,s){return y.call(t,i,s)}function R(t,i,s){E(E(t,i,s),void 0,n)}function I(t,i){R(t,i)}function x(t,i){R(t,void 0,i)}function C(t,i,s){return E(t,i,s)}function P(t){E(t,void 0,n)}var N=function(){function t(){this.Rd=0,this.Dd=0,this.Ld={Od:[],Fd:void 0},this.Vd=this.Ld,this.Rd=0,this.Dd=0}return w.defineProperty(t.prototype,"length",{get:function(){return this.Dd},enumerable:!0,configurable:!0}),t.prototype.push=function(t){var i=this.Vd,s=i;16383===i.Od.length&&(s={Od:[],Fd:void 0}),i.Od.push(t),s!==i&&(this.Vd=s,i.Fd=s),++this.Dd},t.prototype.shift=function(){var t=this.Ld,i=t,s=this.Rd,e=s+1,n=t.Od,r=n[s];return 16384===e&&(i=t.Fd,e=0),--this.Dd,this.Rd=e,t!==i&&(this.Ld=i),n[s]=void 0,r},t.prototype.forEach=function(t){for(var i=this.Rd,s=this.Ld,e=s.Od;!(i===e.length&&void 0===s.Fd||i===e.length&&(i=0,0===(e=(s=s.Fd).Od).length));)t(e[i]),++i},t.prototype.peek=function(){var t=this.Ld,i=this.Rd;return t.Od[i]},t}();function D(t,i,s){var e=null;!0===s&&(e=w.prototype);var n=w.create(e);return n.value=t,n.done=i,n}function B(t,i){t.Wd=!0,t.Ud=i,i.Gd=t,"readable"===i.Ra?F(t):"closed"===i.Ra?function(t){F(t),U(t)}(t):V(t,i.Xd)}function L(t,i){return zi(t.Ud,i)}function M(t){"readable"===t.Ud.Ra?W(t,new g("Reader was released and can no longer be used to monitor the stream's closedness")):function(t,i){V(t,i)}(t,new g("Reader was released and can no longer be used to monitor the stream's closedness")),t.Ud.Gd=void 0,t.Ud=void 0}function O(t){return new g("Cannot "+t+" a stream using a released reader")}function F(t){t.Zd=S(function(i,s){t.Hd=i,t.zd=s})}function V(t,i){F(t),W(t,i)}function W(t,i){P(t.Zd),t.zd(i),t.Hd=void 0,t.zd=void 0}function U(t){t.Hd(void 0),t.Hd=void 0,t.zd=void 0}var G=i("[[CancelSteps]]"),X=i("[[PullSteps]]");function Z(t,i){void 0===i&&(i=!1);var s=new J(t);return s.Wd=i,s}function H(t){return S(function(i,s){var e={Yd:i,Kd:s};t.Gd.qd.push(e)})}function z(t,i,s){var e=t.Gd;e.qd.shift().Yd(D(i,s,e.Wd))}function Y(t){return t.Gd.qd.length}function K(t){var i=t.Gd;return void 0!==i&&!!$(i)}var q,Q,J=function(){function t(t){if(!1===Zi(t))throw new g("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===Hi(t))throw new g("This stream has already been locked for exclusive reading by another reader");B(this,t),this.qd=new N}return w.defineProperty(t.prototype,"closed",{get:function(){return $(this)?this.Zd:k(it("closed"))},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return $(this)?void 0===this.Ud?k(O("cancel")):L(this,t):k(it("cancel"))},t.prototype.read=function(){return $(this)?void 0===this.Ud?k(O("read from")):tt(this):k(it("read"))},t.prototype.releaseLock=function(){if(!$(this))throw it("releaseLock");if(void 0!==this.Ud){if(this.qd.length>0)throw new g("Tried to release a reader lock when that reader has pending read() calls un-settled");M(this)}},t}();function $(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"qd")}function tt(t){var i=t.Ud;return i.Qd=!0,"closed"===i.Ra?T(D(void 0,!0,t.Wd)):"errored"===i.Ra?k(i.Xd):i.Jd[X]()}function it(t){return new g("ReadableStreamDefaultReader.prototype."+t+" can only be used on a ReadableStreamDefaultReader")}"symbol"==typeof i.asyncIterator&&((q={})[i.asyncIterator]=function(){return this},Q=q,w.defineProperty(Q,i.asyncIterator,{enumerable:!1}));var st={next:function(){if(!1===et(this))return k(nt("next"));var t=this.$d;return void 0===t.Ud?k(O("iterate")):C(tt(t),function(i){var s=i.done;return s&&M(t),D(i.value,s,!0)})},return:function(t){if(!1===et(this))return k(nt("next"));var i=this.$d;if(void 0===i.Ud)return k(O("finish iterating"));if(i.qd.length>0)return k(new g("Tried to release a reader lock when that reader has pending read() calls un-settled"));if(!1===this.ul){var s=L(i,t);return M(i),C(s,function(){return D(t,!0,!0)})}return M(i),T(D(t,!0,!0))}};function et(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"$d")}function nt(t){return new g("ReadableStreamAsyncIterator."+t+" can only be used on a ReadableSteamAsyncIterator")}function rt(t){var i=t.tf.shift();return t.if-=i.size,t.if<0&&(t.if=0),i.value}function ht(t,i,s){if(!a(s=Number(s)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");t.tf.push({value:i,size:s}),t.if+=s}function ot(t){t.tf=new N,t.if=0}void 0!==Q&&w.setPrototypeOf(st,Q),w.defineProperty(st,"next",{enumerable:!1}),w.defineProperty(st,"return",{enumerable:!1});var at=i("[[AbortSteps]]"),ut=i("[[ErrorSteps]]"),ct=function(){function t(t,i){void 0===t&&(t={}),void 0===i&&(i={}),lt(this);var s=i.size,e=i.highWaterMark;if(void 0!==t.type)throw new RangeError("Invalid type is specified");var n=v(s);void 0===e&&(e=1),function(t,i,s,e){var n=w.create(Ct.prototype);function r(){return d(i,"start",[n])}var h=c(i,"write",1,[n]),o=c(i,"close",0,[]),a=c(i,"abort",1,[]);Pt(t,n,r,h,o,a,s,e)}(this,t,e=f(e),n)}return w.defineProperty(t.prototype,"locked",{get:function(){if(!1===ft(this))throw Ft("locked");return vt(this)},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){return!1===ft(this)?k(Ft("abort")):!0===vt(this)?k(new g("Cannot abort a stream that already has a writer")):_t(this,t)},t.prototype.close=function(){return!1===ft(this)?k(Ft("close")):!0===vt(this)?k(new g("Cannot close a stream that already has a writer")):!0===yt(this)?k(new g("Cannot close an already-closing stream")):gt(this)},t.prototype.getWriter=function(){if(!1===ft(this))throw Ft("getWriter");return dt(this)},t}();function dt(t){return new St(t)}function lt(t){t.Ra="writable",t.Xd=void 0,t.ef=void 0,t.nf=void 0,t.rf=new N,t.hf=void 0,t.uf=void 0,t.cf=void 0,t.df=void 0,t.lf=!1}function ft(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"nf")}function vt(t){return void 0!==t.ef}function _t(t,i){var s=t.Ra;if("closed"===s||"errored"===s)return T(void 0);if(void 0!==t.df)return t.df.vf;var e=!1;"erroring"===s&&(e=!0,i=void 0);var n=S(function(s,n){t.df={vf:void 0,Yd:s,Kd:n,_f:i,gf:e}});return t.df.vf=n,!1===e&&pt(t,i),n}function gt(t){var i=t.Ra;if("closed"===i||"errored"===i)return k(new g("The stream (in "+i+" state) is not in the writable state and cannot be closed"));var s=S(function(i,s){var e={Yd:i,Kd:s};t.uf=e}),e=t.ef;return void 0!==e&&!0===t.lf&&"writable"===i&&qt(e),function(t){ht(t,"close",0),Bt(t)}(t.nf),s}function mt(t,i){"writable"!==t.Ra?wt(t):pt(t,i)}function pt(t,i){var s=t.nf;t.Ra="erroring",t.Xd=i;var e=t.ef;void 0!==e&&Rt(e,i),!1===function(t){if(void 0===t.hf&&void 0===t.cf)return!1;return!0}(t)&&!0===s.mf&&wt(t)}function wt(t){t.Ra="errored",t.nf[ut]();var i=t.Xd;if(t.rf.forEach(function(t){t.Kd(i)}),t.rf=new N,void 0!==t.df){var s=t.df;if(t.df=void 0,!0===s.gf)return s.Kd(i),void bt(t);R(t.nf[at](s._f),function(){s.Yd(),bt(t)},function(i){s.Kd(i),bt(t)})}else bt(t)}function yt(t){return void 0!==t.uf||void 0!==t.cf}function bt(t){void 0!==t.uf&&(t.uf.Kd(t.Xd),t.uf=void 0);var i=t.ef;void 0!==i&&Xt(i,t.Xd)}function At(t,i){var s=t.ef;void 0!==s&&i!==t.lf&&(!0===i?function(t){Ht(t)}(s):qt(s)),t.lf=i}var St=function(){function t(t){if(!1===ft(t))throw new g("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===vt(t))throw new g("This stream has already been locked for exclusive writing by another writer");this.pf=t,t.ef=this;var i=t.Ra;if("writable"===i)!1===yt(t)&&!0===t.lf?Ht(this):Yt(this),Ut(this);else if("erroring"===i)zt(this,t.Xd),Ut(this);else if("closed"===i)Yt(this),function(t){Ut(t),Zt(t)}(this);else{var s=t.Xd;zt(this,s),Gt(this,s)}}return w.defineProperty(t.prototype,"closed",{get:function(){return!1===Tt(this)?k(Vt("closed")):this.Zd},enumerable:!0,configurable:!0}),w.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===Tt(this))throw Vt("desiredSize");if(void 0===this.pf)throw Wt("desiredSize");return function(t){var i=t.pf,s=i.Ra;if("errored"===s||"erroring"===s)return null;if("closed"===s)return 0;return Dt(i.nf)}(this)},enumerable:!0,configurable:!0}),w.defineProperty(t.prototype,"ready",{get:function(){return!1===Tt(this)?k(Vt("ready")):this.wf},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){return!1===Tt(this)?k(Vt("abort")):void 0===this.pf?k(Wt("abort")):function(t,i){var s=t.pf;return _t(s,i)}(this,t)},t.prototype.close=function(){if(!1===Tt(this))return k(Vt("close"));var t=this.pf;return void 0===t?k(Wt("close")):!0===yt(t)?k(new g("Cannot close an already-closing stream")):kt(this)},t.prototype.releaseLock=function(){if(!1===Tt(this))throw Vt("releaseLock");void 0!==this.pf&&It(this)},t.prototype.write=function(t){return!1===Tt(this)?k(Vt("write")):void 0===this.pf?k(Wt("write to")):xt(this,t)},t}();function Tt(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"pf")}function kt(t){return gt(t.pf)}function Et(t,i){"pending"===t.yf?Xt(t,i):function(t,i){Gt(t,i)}(t,i)}function Rt(t,i){"pending"===t.bf?Kt(t,i):function(t,i){zt(t,i)}(t,i)}function It(t){var i=t.pf,s=new g("Writer was released and can no longer be used to monitor the stream's closedness");Rt(t,s),Et(t,s),i.ef=void 0,t.pf=void 0}function xt(t,i){var s=t.pf,e=s.nf,n=function(t,i){try{return t.Af(i)}catch(i){return Lt(t,i),1}}(e,i);if(s!==t.pf)return k(Wt("write to"));var r=s.Ra;if("errored"===r)return k(s.Xd);if(!0===yt(s)||"closed"===r)return k(new g("The stream is closing or closed and cannot be written to"));if("erroring"===r)return k(s.Xd);var h=function(t){return S(function(i,s){var e={Yd:i,Kd:s};t.rf.push(e)})}(s);return function(t,i,s){var e={chunk:i};try{ht(t,e,s)}catch(i){return void Lt(t,i)}var n=t.Sf;if(!1===yt(n)&&"writable"===n.Ra){At(n,Mt(t))}Bt(t)}(e,i,n),h}var Ct=function(){function t(){throw new g("WritableStreamDefaultController cannot be constructed explicitly")}return t.prototype.error=function(t){if(!1===function(t){if(!r(t))return!1;if(!w.prototype.hasOwnProperty.call(t,"Sf"))return!1;return!0}(this))throw new g("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this.Sf.Ra&&Ot(this,t)},t.prototype[at]=function(t){var i=this.Tf(t);return Nt(this),i},t.prototype[ut]=function(){ot(this)},t}();function Pt(t,i,s,e,n,r,h,o){i.Sf=t,t.nf=i,i.tf=void 0,i.if=void 0,ot(i),i.mf=!1,i.Af=o,i.kf=h,i.Ef=e,i.Rf=n,i.Tf=r;var a=Mt(i);At(t,a),R(T(s()),function(){i.mf=!0,Bt(i)},function(s){i.mf=!0,mt(t,s)})}function Nt(t){t.Ef=void 0,t.Rf=void 0,t.Tf=void 0,t.Af=void 0}function Dt(t){return t.kf-t.if}function Bt(t){var i=t.Sf;if(!1!==t.mf&&void 0===i.hf)if("erroring"!==i.Ra){if(0!==t.tf.length){var s=function(t){return t.tf.peek().value}(t);"close"===s?function(t){var i=t.Sf;(function(t){t.cf=t.uf,t.uf=void 0})(i),rt(t);var s=t.Rf();Nt(t),R(s,function(){!function(t){t.cf.Yd(void 0),t.cf=void 0,"erroring"===t.Ra&&(t.Xd=void 0,void 0!==t.df&&(t.df.Yd(),t.df=void 0)),t.Ra="closed";var i=t.ef;void 0!==i&&Zt(i)}(i)},function(t){!function(t,i){t.cf.Kd(i),t.cf=void 0,void 0!==t.df&&(t.df.Kd(i),t.df=void 0),mt(t,i)}(i,t)})}(t):function(t,i){var s=t.Sf;!function(t){t.hf=t.rf.shift()}(s);var e=t.Ef(i);R(e,function(){!function(t){t.hf.Yd(void 0),t.hf=void 0}(s);var i=s.Ra;if(rt(t),!1===yt(s)&&"writable"===i){var e=Mt(t);At(s,e)}Bt(t)},function(i){"writable"===s.Ra&&Nt(t),function(t,i){t.hf.Kd(i),t.hf=void 0,mt(t,i)}(s,i)})}(t,s.chunk)}}else wt(i)}function Lt(t,i){"writable"===t.Sf.Ra&&Ot(t,i)}function Mt(t){return Dt(t)<=0}function Ot(t,i){var s=t.Sf;Nt(t),pt(s,i)}function Ft(t){return new g("WritableStream.prototype."+t+" can only be used on a WritableStream")}function Vt(t){return new g("WritableStreamDefaultWriter.prototype."+t+" can only be used on a WritableStreamDefaultWriter")}function Wt(t){return new g("Cannot "+t+" a stream using a released writer")}function Ut(t){t.Zd=S(function(i,s){t.Hd=i,t.zd=s,t.yf="pending"})}function Gt(t,i){Ut(t),Xt(t,i)}function Xt(t,i){P(t.Zd),t.zd(i),t.Hd=void 0,t.zd=void 0,t.yf="rejected"}function Zt(t){t.Hd(void 0),t.Hd=void 0,t.zd=void 0,t.yf="resolved"}function Ht(t){t.wf=S(function(i,s){t.If=i,t.xf=s}),t.bf="pending"}function zt(t,i){Ht(t),Kt(t,i)}function Yt(t){Ht(t),qt(t)}function Kt(t,i){P(t.wf),t.xf(i),t.If=void 0,t.xf=void 0,t.bf="rejected"}function qt(t){t.If(void 0),t.If=void 0,t.xf=void 0,t.bf="fulfilled"}function jt(t){if("object"!=typeof t||null===t)return!1;try{return"boolean"==typeof t.aborted}catch(t){return!1}}var Qt="undefined"!=typeof DOMException?DOMException:void 0;var Jt,$t=function(t){if("function"!=typeof t&&"object"!=typeof t)return!1;try{return new t,!0}catch(t){return!1}}(Qt)?Qt:((Jt=function(t,i){this.message=t||"",this.name=i||"Error",m.captureStackTrace&&m.captureStackTrace(this,this.constructor)}).prototype=w.create(m.prototype),w.defineProperty(Jt.prototype,"constructor",{value:Jt,writable:!0,configurable:!0}),Jt);function ti(t,i,e,n,r,h){var o=Z(t),a=dt(i);t.Qd=!0;var u=!1,c=T(void 0);return S(function(d,l){var f,v,_,m;if(void 0!==h){if(f=function(){var s=new $t("Aborted","AbortError"),e=[];!1===n&&e.push(function(){return"writable"===i.Ra?_t(i,s):T(void 0)}),!1===r&&e.push(function(){return"readable"===t.Ra?zi(t,s):T(void 0)}),b(function(){return Promise.all(e.map(function(t){return t()}))},!0,s)},!0===h.aborted)return void f();h.addEventListener("abort",f)}if(y(t,o.Zd,function(t){!1===n?b(function(){return _t(i,t)},!0,t):A(!0,t)}),y(i,a.Zd,function(i){!1===r?b(function(){return zi(t,i)},!0,i):A(!0,i)}),v=t,_=o.Zd,m=function(){!1===e?b(function(){return function(t){var i=t.pf,s=i.Ra;return!0===yt(i)||"closed"===s?T(void 0):"errored"===s?k(i.Xd):kt(t)}(a)}):A()},"closed"===v.Ra?m():I(_,m),!0===yt(i)||"closed"===i.Ra){var p=new g("the destination writable stream closed before all data could be piped to it");!1===r?b(function(){return zi(t,p)},!0,p):A(!0,p)}function w(){var t=c;return E(c,function(){return t!==c?w():void 0})}function y(t,i,s){"errored"===t.Ra?s(t.Xd):x(i,s)}function b(t,s,e){function n(){R(t(),function(){return C(s,e)},function(t){return C(!0,t)})}!0!==u&&(u=!0,"writable"===i.Ra&&!1===yt(i)?I(w(),n):n())}function A(t,s){!0!==u&&(u=!0,"writable"===i.Ra&&!1===yt(i)?I(w(),function(){return C(t,s)}):C(t,s))}function C(t,i){It(a),M(o),void 0!==h&&h.removeEventListener("abort",f),t?l(i):d(void 0)}P(S(function(t,i){!function e(n){n?t():E(!0===u?T(!0):E(a.wf,function(){return E(tt(o),function(t){return!0===t.done||(c=E(xt(a,t.value),void 0,s),!1)})}),e,i)}(!1)}))})}var ii=function(){function t(){throw new g}return w.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===si(this))throw li("desiredSize");return ui(this)},enumerable:!0,configurable:!0}),t.prototype.close=function(){if(!1===si(this))throw li("close");if(!1===ci(this))throw new g("The stream is not in a state that permits close");hi(this)},t.prototype.enqueue=function(t){if(!1===si(this))throw li("enqueue");if(!1===ci(this))throw new g("The stream is not in a state that permits enqueue");return oi(this,t)},t.prototype.error=function(t){if(!1===si(this))throw li("error");ai(this,t)},t.prototype[G]=function(t){ot(this);var i=this.Cf(t);return ri(this),i},t.prototype[X]=function(){var t=this.Pf;if(this.tf.length>0){var i=rt(this);return!0===this.Nf&&0===this.tf.length?(ri(this),Yi(t)):ei(this),T(D(i,!1,t.Gd.Wd))}var s=H(t);return ei(this),s},t}();function si(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"Pf")}function ei(t){!1!==ni(t)&&(!0!==t.Df?(t.Df=!0,R(t.Bf(),function(){t.Df=!1,!0===t.Lf&&(t.Lf=!1,ei(t))},function(i){ai(t,i)})):t.Lf=!0)}function ni(t){var i=t.Pf;return!1!==ci(t)&&(!1!==t.mf&&(!0===Hi(i)&&Y(i)>0||ui(t)>0))}function ri(t){t.Bf=void 0,t.Cf=void 0,t.Af=void 0}function hi(t){var i=t.Pf;t.Nf=!0,0===t.tf.length&&(ri(t),Yi(i))}function oi(t,i){var s=t.Pf;if(!0===Hi(s)&&Y(s)>0)z(s,i,!1);else{var e=void 0;try{e=t.Af(i)}catch(i){throw ai(t,i),i}try{ht(t,i,e)}catch(i){throw ai(t,i),i}}ei(t)}function ai(t,i){var s=t.Pf;"readable"===s.Ra&&(ot(t),ri(t),Ki(s,i))}function ui(t){var i=t.Pf.Ra;return"errored"===i?null:"closed"===i?0:t.kf-t.if}function ci(t){var i=t.Pf.Ra;return!1===t.Nf&&"readable"===i}function di(t,i,s,e,n,r,h){i.Pf=t,i.tf=void 0,i.if=void 0,ot(i),i.mf=!1,i.Nf=!1,i.Lf=!1,i.Df=!1,i.Af=h,i.kf=r,i.Bf=e,i.Cf=n,t.Jd=i,R(T(s()),function(){i.mf=!0,ei(i)},function(t){ai(i,t)})}function li(t){return new g("ReadableStreamDefaultController.prototype."+t+" can only be used on a ReadableStreamDefaultController")}var fi=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&_.floor(t)===t},vi=function(){function t(){throw new g("ReadableStreamBYOBRequest cannot be used directly")}return w.defineProperty(t.prototype,"view",{get:function(){if(!1===mi(this))throw Di("view");return this.Mf},enumerable:!0,configurable:!0}),t.prototype.respond=function(t){if(!1===mi(this))throw Di("respond");if(void 0===this.Of)throw new g("This BYOB request has been invalidated");this.Mf.buffer,function(t,i){if(i=Number(i),!1===a(i))throw new RangeError("bytesWritten must be a finite");Ri(t,i)}(this.Of,t)},t.prototype.respondWithNewView=function(t){if(!1===mi(this))throw Di("respond");if(void 0===this.Of)throw new g("This BYOB request has been invalidated");if(!ArrayBuffer.isView(t))throw new g("You can only respond with array buffer views");t.buffer,function(t,i){var s=t.Ff.peek();if(s.byteOffset+s.bytesFilled!==i.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(s.byteLength!==i.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");s.buffer=i.buffer,Ri(t,i.byteLength)}(this.Of,t)},t}(),_i=function(){function t(){throw new g("ReadableByteStreamController constructor cannot be used directly")}return w.defineProperty(t.prototype,"byobRequest",{get:function(){if(!1===gi(this))throw Bi("byobRequest");if(void 0===this.Vf&&this.Ff.length>0){var t=this.Ff.peek(),i=new j(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),s=w.create(vi.prototype);!function(t,i,s){t.Of=i,t.Mf=s}(s,this,i),this.Vf=s}return this.Vf},enumerable:!0,configurable:!0}),w.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===gi(this))throw Bi("desiredSize");return Pi(this)},enumerable:!0,configurable:!0}),t.prototype.close=function(){if(!1===gi(this))throw Bi("close");if(!0===this.Nf)throw new g("The stream has already been closed; do not close it again!");var t=this.Wf.Ra;if("readable"!==t)throw new g("The stream (in "+t+" state) is not in the readable state and cannot be closed");!function(t){var i=t.Wf;if(t.if>0)return void(t.Nf=!0);if(t.Ff.length>0){if(t.Ff.peek().bytesFilled>0){var s=new g("Insufficient bytes to fill elements in the given buffer");throw Ci(t,s),s}}xi(t),Yi(i)}(this)},t.prototype.enqueue=function(t){if(!1===gi(this))throw Bi("enqueue");if(!0===this.Nf)throw new g("stream is closed or draining");var i=this.Wf.Ra;if("readable"!==i)throw new g("The stream (in "+i+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(t))throw new g("You can only enqueue array buffer views when using a ReadableByteStreamController");t.buffer,function(t,i){var s=t.Wf,e=i.buffer,n=i.byteOffset,r=i.byteLength,h=e;if(!0===K(s)){if(0===Y(s))bi(t,h,n,r);else z(s,new j(h,n,r),!1)}else!0===Oi(s)?(bi(t,h,n,r),Ei(t)):bi(t,h,n,r);pi(t)}(this,t)},t.prototype.error=function(t){if(!1===gi(this))throw Bi("error");Ci(this,t)},t.prototype[G]=function(t){this.Ff.length>0&&(this.Ff.peek().bytesFilled=0);ot(this);var i=this.Cf(t);return xi(this),i},t.prototype[X]=function(){var t=this.Wf;if(this.if>0){var i=this.tf.shift();this.if-=i.byteLength,Ti(this);var s=void 0;try{s=new j(i.buffer,i.byteOffset,i.byteLength)}catch(t){return k(t)}return T(D(s,!1,t.Gd.Wd))}var e=this.Uf;if(void 0!==e){var n=void 0;try{n=new ArrayBuffer(e)}catch(t){return k(t)}var r={buffer:n,byteOffset:0,byteLength:e,bytesFilled:0,elementSize:1,ctor:j,readerType:"default"};this.Ff.push(r)}var h=H(t);return pi(this),h},t}();function gi(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"Wf")}function mi(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"Of")}function pi(t){var i=function(t){var i=t.Wf;if("readable"!==i.Ra)return!1;if(!0===t.Nf)return!1;if(!1===t.mf)return!1;if(!0===K(i)&&Y(i)>0)return!0;if(!0===Oi(i)&&Mi(i)>0)return!0;var s=Pi(t);if(s>0)return!0;return!1}(t);!1!==i&&(!0!==t.Df?(t.Df=!0,R(t.Bf(),function(){t.Df=!1,!0===t.Lf&&(t.Lf=!1,pi(t))},function(i){Ci(t,i)})):t.Lf=!0)}function wi(t,i){var s=!1;"closed"===t.Ra&&(s=!0);var e=yi(i);"default"===i.readerType?z(t,e,s):function(t,i,s){var e=t.Gd,n=e.Gf.shift();n.Yd(D(i,s,e.Wd))}(t,e,s)}function yi(t){var i=t.bytesFilled,s=t.elementSize;return new t.ctor(t.buffer,t.byteOffset,i/s)}function bi(t,i,s,e){t.tf.push({buffer:i,byteOffset:s,byteLength:e}),t.if+=e}function Ai(t,i){var s=i.elementSize,e=i.bytesFilled-i.bytesFilled%s,n=_.min(t.if,i.byteLength-i.bytesFilled),r=i.bytesFilled+n,h=r-r%s,a=n,u=!1;h>e&&(a=h-i.bytesFilled,u=!0);for(var c=t.tf;a>0;){var d=c.peek(),l=_.min(a,d.byteLength),f=i.byteOffset+i.bytesFilled;o(i.buffer,f,d.buffer,d.byteOffset,l),d.byteLength===l?c.shift():(d.byteOffset+=l,d.byteLength-=l),t.if-=l,Si(t,l,i),a-=l}return u}function Si(t,i,s){ki(t),s.bytesFilled+=i}function Ti(t){0===t.if&&!0===t.Nf?(xi(t),Yi(t.Wf)):pi(t)}function ki(t){void 0!==t.Vf&&(t.Vf.Of=void 0,t.Vf.Mf=void 0,t.Vf=void 0)}function Ei(t){for(;t.Ff.length>0;){if(0===t.if)return;var i=t.Ff.peek();!0===Ai(t,i)&&(Ii(t),wi(t.Wf,i))}}function Ri(t,i){var s=t.Ff.peek();if("closed"===t.Wf.Ra){if(0!==i)throw new g("bytesWritten must be 0 when calling respond() on a closed stream");!function(t,i){i.buffer=i.buffer;var s=t.Wf;if(!0===Oi(s))for(;Mi(s)>0;)wi(s,Ii(t))}(t,s)}else!function(t,i,s){if(s.bytesFilled+i>s.byteLength)throw new RangeError("bytesWritten out of range");if(Si(t,i,s),!(s.bytesFilled<s.elementSize)){Ii(t);var e=s.bytesFilled%s.elementSize;if(e>0){var n=s.byteOffset+s.bytesFilled,r=s.buffer.slice(n-e,n);bi(t,r,0,r.byteLength)}s.buffer=s.buffer,s.bytesFilled-=e,wi(t.Wf,s),Ei(t)}}(t,i,s);pi(t)}function Ii(t){var i=t.Ff.shift();return ki(t),i}function xi(t){t.Bf=void 0,t.Cf=void 0}function Ci(t,i){var s=t.Wf;"readable"===s.Ra&&(!function(t){ki(t),t.Ff=new N}(t),ot(t),xi(t),Ki(s,i))}function Pi(t){var i=t.Wf.Ra;return"errored"===i?null:"closed"===i?0:t.kf-t.if}function Ni(t,i,s){var e=w.create(_i.prototype);var n=c(i,"pull",0,[e]),r=c(i,"cancel",1,[]),h=i.autoAllocateChunkSize;if(void 0!==h&&(h=Number(h),!1===fi(h)||h<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");!function(t,i,s,e,n,r,h){i.Wf=t,i.Lf=!1,i.Df=!1,i.Vf=void 0,i.tf=i.if=void 0,ot(i),i.Nf=!1,i.mf=!1,i.kf=f(r),i.Bf=e,i.Cf=n,i.Uf=h,i.Ff=new N,t.Jd=i,R(T(s()),function(){i.mf=!0,pi(i)},function(t){Ci(i,t)})}(t,e,function(){return d(i,"start",[e])},n,r,s,h)}function Di(t){return new g("ReadableStreamBYOBRequest.prototype."+t+" can only be used on a ReadableStreamBYOBRequest")}function Bi(t){return new g("ReadableByteStreamController.prototype."+t+" can only be used on a ReadableByteStreamController")}function Li(t){return S(function(i,s){var e={Yd:i,Kd:s};t.Gd.Gf.push(e)})}function Mi(t){return t.Gd.Gf.length}function Oi(t){var i=t.Gd;return void 0!==i&&!!Vi(i)}var Fi=function(){function t(t){if(!Zi(t))throw new g("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===gi(t.Jd))throw new g("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(Hi(t))throw new g("This stream has already been locked for exclusive reading by another reader");B(this,t),this.Gf=new N}return w.defineProperty(t.prototype,"closed",{get:function(){return Vi(this)?this.Zd:k(Wi("closed"))},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return Vi(this)?void 0===this.Ud?k(O("cancel")):L(this,t):k(Wi("cancel"))},t.prototype.read=function(t){return Vi(this)?void 0===this.Ud?k(O("read from")):ArrayBuffer.isView(t)?(t.buffer,0===t.byteLength?k(new g("view must have non-zero byteLength")):function(t,i){var s=t.Ud;if(s.Qd=!0,"errored"===s.Ra)return k(s.Xd);return function(t,i){var s=t.Wf,e=1;i.constructor!==DataView&&(e=i.constructor.BYTES_PER_ELEMENT);var n=i.constructor,r={buffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength,bytesFilled:0,elementSize:e,ctor:n,readerType:"byob"};if(t.Ff.length>0)return t.Ff.push(r),Li(s);if("closed"===s.Ra)return T(D(new n(r.buffer,r.byteOffset,0),!0,s.Gd.Wd));if(t.if>0){if(!0===Ai(t,r)){var h=yi(r);return Ti(t),T(D(h,!1,s.Gd.Wd))}if(!0===t.Nf){var o=new g("Insufficient bytes to fill elements in the given buffer");return Ci(t,o),k(o)}}t.Ff.push(r);var a=Li(s);return pi(t),a}(s.Jd,i)}(this,t)):k(new g("view must be an array buffer view")):k(Wi("read"))},t.prototype.releaseLock=function(){if(!Vi(this))throw Wi("releaseLock");if(void 0!==this.Ud){if(this.Gf.length>0)throw new g("Tried to release a reader lock when that reader has pending read() calls un-settled");M(this)}},t}();function Vi(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"Gf")}function Wi(t){return new g("ReadableStreamBYOBReader.prototype."+t+" can only be used on a ReadableStreamBYOBReader")}var Ui=function(){function t(t,i){void 0===t&&(t={}),void 0===i&&(i={}),Xi(this);var s=i.size,e=i.highWaterMark,n=t.type;if("bytes"===String(n)){if(void 0!==s)throw new RangeError("The strategy for a byte stream cannot have a size function");void 0===e&&(e=0),Ni(this,t,e=f(e))}else{if(void 0!==n)throw new RangeError("Invalid type is specified");var r=v(s);void 0===e&&(e=1),function(t,i,s,e){var n=w.create(ii.prototype),r=c(i,"pull",0,[n]),h=c(i,"cancel",1,[]);di(t,n,function(){return d(i,"start",[n])},r,h,s,e)}(this,t,e=f(e),r)}}return w.defineProperty(t.prototype,"locked",{get:function(){if(!1===Zi(this))throw qi("locked");return Hi(this)},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return!1===Zi(this)?k(qi("cancel")):!0===Hi(this)?k(new g("Cannot cancel a stream that already has a reader")):zi(this,t)},t.prototype.getReader=function(t){var i=(void 0===t?{}:t).mode;if(!1===Zi(this))throw qi("getReader");if(void 0===i)return Z(this,!0);if("byob"===(i=String(i)))return function(t,i){void 0===i&&(i=!1);var s=new Fi(t);return s.Wd=i,s}(this,!0);throw new RangeError("Invalid mode is specified")},t.prototype.pipeThrough=function(t,i){var s=t.writable,e=t.readable,n=void 0===i?{}:i,r=n.preventClose,h=n.preventAbort,o=n.preventCancel,a=n.signal;if(!1===Zi(this))throw qi("pipeThrough");if(!1===ft(s))throw new g("writable argument to pipeThrough must be a WritableStream");if(!1===Zi(e))throw new g("readable argument to pipeThrough must be a ReadableStream");if(r=Boolean(r),h=Boolean(h),o=Boolean(o),void 0!==a&&!jt(a))throw new g("ReadableStream.prototype.pipeThrough's signal option must be an AbortSignal");if(!0===Hi(this))throw new g("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(!0===vt(s))throw new g("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return P(ti(this,s,r,h,o,a)),e},t.prototype.pipeTo=function(t,i){var s=void 0===i?{}:i,e=s.preventClose,n=s.preventAbort,r=s.preventCancel,h=s.signal;return!1===Zi(this)?k(qi("pipeTo")):!1===ft(t)?k(new g("ReadableStream.prototype.pipeTo's first argument must be a WritableStream")):(e=Boolean(e),n=Boolean(n),r=Boolean(r),void 0===h||jt(h)?!0===Hi(this)?k(new g("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):!0===vt(t)?k(new g("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ti(this,t,e,n,r,h):k(new g("ReadableStream.prototype.pipeTo's signal option must be an AbortSignal")))},t.prototype.tee=function(){if(!1===Zi(this))throw qi("tee");var t=function(t){var i,s,e,n,r,o=Z(t),a=!1,u=!1,c=!1,d=S(function(t){r=t});function l(){return!0===a||(a=!0,P(C(tt(o),function(t){if(a=!1,!0===t.done)return!1===u&&hi(e.Jd),void(!1===c&&hi(n.Jd));var i=t.value,s=i,r=i;!1===u&&oi(e.Jd,s),!1===c&&oi(n.Jd,r)}))),T(void 0)}function f(){}return e=Gi(f,l,function(e){if(u=!0,i=e,!0===c){var n=h([i,s]),o=zi(t,n);r(o)}return d}),n=Gi(f,l,function(e){if(c=!0,s=e,!0===u){var n=h([i,s]),o=zi(t,n);r(o)}return d}),x(o.Zd,function(t){ai(e.Jd,t),ai(n.Jd,t)}),[e,n]}(this);return h(t)},t.prototype.getIterator=function(t){var i=(void 0===t?{}:t).preventCancel,s=void 0!==i&&i;if(!1===Zi(this))throw qi("getIterator");return function(t,i){void 0===i&&(i=!1);var s=Z(t),e=w.create(st);return e.$d=s,e.ul=Boolean(i),e}(this,s)},t}();function Gi(t,i,s,e,n){void 0===e&&(e=1),void 0===n&&(n=function(){return 1});var r=w.create(Ui.prototype);return Xi(r),di(r,w.create(ii.prototype),t,i,s,e,n),r}function Xi(t){t.Ra="readable",t.Gd=void 0,t.Xd=void 0,t.Qd=!1}function Zi(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"Jd")}function Hi(t){return void 0!==t.Gd}function zi(t,i){return t.Qd=!0,"closed"===t.Ra?T(void 0):"errored"===t.Ra?k(t.Xd):(Yi(t),C(t.Jd[G](i),s))}function Yi(t){t.Ra="closed";var i=t.Gd;void 0!==i&&($(i)&&(i.qd.forEach(function(t){t.Yd(D(void 0,!0,i.Wd))}),i.qd=new N),U(i))}function Ki(t,i){t.Ra="errored",t.Xd=i;var s=t.Gd;void 0!==s&&($(s)?(s.qd.forEach(function(t){t.Kd(i)}),s.qd=new N):(s.Gf.forEach(function(t){t.Kd(i)}),s.Gf=new N),W(s,i))}function qi(t){return new g("ReadableStream.prototype."+t+" can only be used on a ReadableStream")}"symbol"==typeof i.asyncIterator&&w.defineProperty(Ui.prototype,i.asyncIterator,{value:Ui.prototype.getIterator,enumerable:!1,writable:!0,configurable:!0});var ji=function(){function t(t){var i=t.highWaterMark;this.highWaterMark=i}return t.prototype.size=function(t){return t.byteLength},t}(),Qi=function(){function t(t){var i=t.highWaterMark;this.highWaterMark=i}return t.prototype.size=function(){return 1},t}(),Ji=function(){function t(t,i,s){void 0===t&&(t={}),void 0===i&&(i={}),void 0===s&&(s={});var e=i.size,n=i.highWaterMark,r=s.size,h=s.highWaterMark;if(void 0!==t.writableType)throw new RangeError("Invalid writable type specified");var o=v(e);if(void 0===n&&(n=1),n=f(n),void 0!==t.readableType)throw new RangeError("Invalid readable type specified");var a,u=v(r);void 0===h&&(h=0),h=f(h),function(t,i,s,e,n,r){function h(){return i}function o(i){return function(t,i){var s=t.Xf;if(!0===t.lf){return C(t.Zf,function(){var e=t.Hf;if("erroring"===e.Ra)throw e.Xd;return os(s,i)})}return os(s,i)}(t,i)}function a(i){return function(t,i){return ts(t,i),T(void 0)}(t,i)}function u(){return function(t){var i=t.zf,s=t.Xf,e=s.Yf();return rs(s),C(e,function(){if("errored"===i.Ra)throw i.Xd;var t=i.Jd;!0===ci(t)&&hi(t)},function(s){throw ts(t,s),i.Xd})}(t)}function c(){return function(t){return ss(t,!1),t.Zf}(t)}function d(i){return is(t,i),T(void 0)}t.Hf=function(t,i,s,e,n,r){void 0===n&&(n=1),void 0===r&&(r=function(){return 1});var h=w.create(ct.prototype);return lt(h),Pt(h,w.create(Ct.prototype),t,i,s,e,n,r),h}(h,o,u,a,s,e),t.zf=Gi(h,c,d,n,r),t.lf=void 0,t.Zf=void 0,t.Kf=void 0,ss(t,!0),t.Xf=void 0}(this,S(function(t){a=t}),n,o,h,u),function(t,i){var s=w.create(es.prototype),e=function(t){try{return hs(s,t),T(void 0)}catch(t){return k(t)}},n=i.transform;if(void 0!==n){if("function"!=typeof n)throw new g("transform is not a method");e=function(t){return l(n,i,[t,s])}}var r=c(i,"flush",0,[s]);!function(t,i,s,e){i.qf=t,t.Xf=i,i.jf=s,i.Yf=e}(t,s,e,r)}(this,t);var _=d(t,"start",[this.Xf]);a(_)}return w.defineProperty(t.prototype,"readable",{get:function(){if(!1===$i(this))throw us("readable");return this.zf},enumerable:!0,configurable:!0}),w.defineProperty(t.prototype,"writable",{get:function(){if(!1===$i(this))throw us("writable");return this.Hf},enumerable:!0,configurable:!0}),t}();function $i(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"Xf")}function ts(t,i){ai(t.zf.Jd,i),is(t,i)}function is(t,i){rs(t.Xf),Lt(t.Hf.nf,i),!0===t.lf&&ss(t,!1)}function ss(t,i){void 0!==t.Zf&&t.Kf(),t.Zf=S(function(i){t.Kf=i}),t.lf=i}var es=function(){function t(){throw new g("TransformStreamDefaultController instances cannot be created directly")}return w.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===ns(this))throw as("desiredSize");return ui(this.qf.zf.Jd)},enumerable:!0,configurable:!0}),t.prototype.enqueue=function(t){if(!1===ns(this))throw as("enqueue");hs(this,t)},t.prototype.error=function(t){if(!1===ns(this))throw as("error");!function(t,i){ts(t.qf,i)}(this,t)},t.prototype.terminate=function(){if(!1===ns(this))throw as("terminate");!function(t){var i=t.qf,s=i.zf.Jd;!0===ci(s)&&hi(s);var e=new g("TransformStream terminated");is(i,e)}(this)},t}();function ns(t){return!!r(t)&&!!w.prototype.hasOwnProperty.call(t,"qf")}function rs(t){t.jf=void 0,t.Yf=void 0}function hs(t,i){var s=t.qf,e=s.zf.Jd;if(!1===ci(e))throw new g("Readable side is not in a state that permits enqueue");try{oi(e,i)}catch(t){throw is(s,t),s.zf.Xd}var n=function(t){return!0!==ni(t)}(e);n!==s.lf&&ss(s,!0)}function os(t,i){return C(t.jf(i),void 0,function(i){throw ts(t.qf,i),i})}function as(t){return new g("TransformStreamDefaultController.prototype."+t+" can only be used on a TransformStreamDefaultController")}function us(t){return new g("TransformStream.prototype."+t+" can only be used on a TransformStream")}t.ByteLengthQueuingStrategy=ji,t.CountQueuingStrategy=Qi,t.ReadableStream=Ui,t.TransformStream=Ji,t.WritableStream=ct,w.defineProperty(t,"__esModule",{value:!0})})}),md=Qn(t=>{"use strict";function i(){const t=gd();return i=function(){return t},t}r(),w.defineProperty(t,"__esModule",{value:!0}),function(t,i){for(var s in i)w.defineProperty(t,s,{enumerable:!0,get:w.getOwnPropertyDescriptor(i,s).get})}(t,{get ByteLengthQueuingStrategy(){return i().ByteLengthQueuingStrategy},get CountQueuingStrategy(){return i().CountQueuingStrategy},get ReadableStream(){return i().ReadableStream},get TransformStream(){return i().TransformStream},get WritableStream(){return i().WritableStream}})}),pd=Qn((t,i)=>{r(),function(s,e){"object"==typeof t&&typeof i<"u"?e(t):"function"==typeof define&&define.amd?define(["exports"],e):e((s=typeof globalThis<"u"?globalThis:s||self).millicast={})}(t,function(t){"use strict";var i,e=w.defineProperty,n=w.defineProperties,r=w.getOwnPropertyDescriptors,o=w.getOwnPropertySymbols,a=w.prototype.hasOwnProperty,c=w.prototype.propertyIsEnumerable,d=(t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s,l=(t,i)=>{for(var s in i||(i={}))a.call(i,s)&&d(t,s,i[s]);if(o)for(var s of o(i))c.call(i,s)&&d(t,s,i[s]);return t},y=(t,i)=>n(t,r(i)),b=(t,i)=>{var s={};for(var e in t)a.call(t,e)&&i.indexOf(e)<0&&(s[e]=t[e]);if(null!=t&&o)for(var e of o(t))i.indexOf(e)<0&&c.call(t,e)&&(s[e]=t[e]);return s},A=typeof globalThis<"u"?globalThis:typeof s<"u"?s:typeof global<"u"?global:typeof self<"u"?self:{};function T(t){return t&&t.__esModule&&w.prototype.hasOwnProperty.call(t,"default")?t.default:t}var k,E={exports:{}};k=E,function(t){var i,s={VERSION:"1.6.1"},e={},n=function(t,i){return function(){return i.apply(t,arguments)}},r=function(){var t,i,s=arguments,e=s[0];for(i=1;i<s.length;i++)for(t in s[i])!(t in e)&&s[i].hasOwnProperty(t)&&(e[t]=s[i][t]);return e},h=function(t,i){return{value:t,name:i}};s.TRACE=h(1,"TRACE"),s.DEBUG=h(2,"DEBUG"),s.INFO=h(3,"INFO"),s.TIME=h(4,"TIME"),s.WARN=h(5,"WARN"),s.ERROR=h(8,"ERROR"),s.OFF=h(99,"OFF");var o=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};o.prototype={setLevel:function(t){t&&"value"in t&&(this.context.filterLevel=t)},getLevel:function(){return this.context.filterLevel},enabledFor:function(t){var i=this.context.filterLevel;return t.value>=i.value},trace:function(){this.invoke(s.TRACE,arguments)},debug:function(){this.invoke(s.DEBUG,arguments)},info:function(){this.invoke(s.INFO,arguments)},warn:function(){this.invoke(s.WARN,arguments)},error:function(){this.invoke(s.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"end"])},invoke:function(t,s){i&&this.enabledFor(t)&&i(s,r({level:t},this.context))}};var a,u=new o({filterLevel:s.OFF});(a=s).enabledFor=n(u,u.enabledFor),a.trace=n(u,u.trace),a.debug=n(u,u.debug),a.time=n(u,u.time),a.timeEnd=n(u,u.timeEnd),a.info=n(u,u.info),a.warn=n(u,u.warn),a.error=n(u,u.error),a.log=a.info,s.setHandler=function(t){i=t},s.setLevel=function(t){for(var i in u.setLevel(t),e)e.hasOwnProperty(i)&&e[i].setLevel(t)},s.getLevel=function(){return u.getLevel()},s.get=function(t){return e[t]||(e[t]=new o(r({name:t},u.context)))},s.createDefaultHandler=function(t){(t=t||{}).formatter=t.formatter||function(t,i){i.name&&t.unshift("["+i.name+"]")};var i={},e=function(t,i){Function.prototype.apply.call(t,console,i)};return typeof console>"u"?function(){}:function(n,r){n=Array.prototype.slice.call(n);var h,o=console.log;r.level===s.TIME?(h=(r.name?"["+r.name+"] ":"")+n[0],"start"===n[1]?console.time?console.time(h):i[h]=(new Date).getTime():console.timeEnd?console.timeEnd(h):e(o,[h+": "+((new Date).getTime()-i[h])+"ms"])):(r.level===s.WARN&&console.warn?o=console.warn:r.level===s.ERROR&&console.error?o=console.error:r.level===s.INFO&&console.info?o=console.info:r.level===s.DEBUG&&console.debug?o=console.debug:r.level===s.TRACE&&console.trace&&(o=console.trace),t.formatter(n,r),e(o,n))}},s.useDefaults=function(t){s.setLevel(t&&t.defaultLevel||s.DEBUG),s.setHandler(s.createDefaultHandler(t))},s.setDefaults=s.useDefaults,k.exports?k.exports=s:(s.Qf=t.Logger,s.noConflict=function(){return t.Logger=s.Qf,s},t.Logger=s)}(A);const R=T(E.exports),I="0.5.0",C=(null==(i=null==s?void 0:s.navigator)?void 0:i.userAgent)||"No user agent available";let P="",N="",D="",B="",L="",M="",O="",F=0;const V=[];const W=t=>{P=""===P?t:P},U=t=>{N=""===N?t:N},G=t=>{D=""===D?t:D},X=t=>{B=""===B?t:B},Z=t=>{L=""===L?t:L},H=t=>{F=0===F?t:F},z=t=>{M=t},Y=t=>{O=""===O?t:O},K=t=>{60===V.length&&V.shift(),V.push(t)},q=(t,i)=>{let s;void 0===t&&(t=60),void 0===i&&(i="JSON"),s=!Number.isInteger(t)||t>60||t<=0?60:t;const e={client:"@millicast/millicast-sdk",version:I,timestamp:(new Date).toISOString(),userAgent:C,clusterId:O,accountId:P,streamName:N,subscriberId:D,connection:M,stats:V.slice(-s),connectionDurationMs:(new Date).getTime()-F};return""!==L?e.feedId=L:""!==B&&(e.streamViewId=B),"CMCD"===i?function(t){function i(t,i){return{ts:_.round(i.timestamp)||"",ot:"audio"===t?"a":"v",bl:i.jitterBufferDelay||0,br:_.round(i.bitrateBitsPerSecond||0),pld:i.packetsLostDeltaPerSecond||0,j:i.jitter||0,mtp:i.packetRate||0,mid:i.mid||"",mimeType:i.mimeType||""}}return t.stats=t.stats.reduce((t,s)=>{const e=0!==s.audio.inbounds.length?s.audio.inbounds.map(t=>i("audio",t)):s.audio.outbounds.map(t=>i("audio",t)),n=0!==s.video.inbounds.length?s.video.inbounds.map(t=>i("video",t)):s.video.outbounds.map(t=>i("video",t));return t.concat([...e,...n])},[]),t}(e):e};R.useDefaults({defaultLevel:R.TRACE});const Q=["TRACE","DEBUG","INFO","WARN","ERROR"],J=(t,i)=>{t.unshift("[".concat(i.name||"Global","] ").concat((new Date).toISOString()," - ").concat(i.level.name," -"))},tt=(t,i)=>i?t.value>=rt[i].value:t.value>=nt.value,it=R.createDefaultHandler({formatter:J});R.setHandler((t,i)=>{((t,i)=>{t=(t=Array.prototype.slice.call(t)).map(t=>"object"==typeof t?JSON.stringify(t):t),J(t,i),0!==st?(et.push(t.join(" ")),et.length>=st&&(et=et.slice(-st))):et=[]})(t,i),tt(i.level,i.name)&&it(t,i);for(const{handler:s,level:e}of ht)i.level.value>=e.value&&s(t,i)});let st=1e4,et=[],nt=R.OFF;const rt={},ht=[],ot=y(l({},R),{enabledFor:tt,getHistory:()=>et,getHistoryMaxSize:()=>st,setHistoryMaxSize:t=>{st=t},setLevel:t=>{nt=t;for(const i in rt)rt[i]=t},getLevel:()=>nt,get:t=>{rt[t]||(rt[t]=nt);const i=R.get(t);return i.setLevel=i=>{rt[t]=i},i.getLevel=()=>rt[t],i},setHandler:(t,i)=>{ht.push({handler:t,level:i})},diagnose:t=>{let i;void 0===t&&(t={});const s={statsCount:60,historySize:1e3,minLogLevel:"TRACE",statsFormat:"JSON"};"number"==typeof t?(s.statsCount=t,i=s):i=l(l({},s),t);const{statsCount:e,historySize:n,minLogLevel:r,statsFormat:h}=i,o=q(e,h),a=ot.getHistory();if(!Number.isInteger(n)||n<=0)throw new m("Invalid Argument Exception : historySize must be a positive integer.");if(!Q.includes(r.toUpperCase()))throw new m('Invalid Argument Exception : the minLogLevel parameter only excepts "trace", "debug", "info", "warn", and "error" as arguments.');if(Q.includes(r.toUpperCase())){const t=Q.slice(Q.indexOf(r.toUpperCase())),i=a.filter(i=>t.some(t=>i.includes(t)));o.history=i.slice(-n)}return o},JSON:"JSON",CMCD:"CMCD",VERSION:I});var at,ut={exports:{}},ct="object"==typeof Reflect?Reflect:null,dt=ct&&"function"==typeof ct.apply?ct.apply:function(t,i,s){return Function.prototype.apply.call(t,i,s)};at=ct&&"function"==typeof ct.ownKeys?ct.ownKeys:w.getOwnPropertySymbols?function(t){return w.getOwnPropertyNames(t).concat(w.getOwnPropertySymbols(t))}:function(t){return w.getOwnPropertyNames(t)};var lt=Number.isNaN||function(t){return t!=t};function ft(){ft.init.call(this)}ut.exports=ft,ut.exports.once=function(t,i){return new Promise(function(s,e){function n(s){t.removeListener(i,r),e(s)}function r(){"function"==typeof t.removeListener&&t.removeListener("error",n),s([].slice.call(arguments))}St(t,i,r,{once:!0}),"error"!==i&&function(t,i,s){"function"==typeof t.on&&St(t,"error",i,s)}(t,n,{once:!0})})},ft.EventEmitter=ft,ft.prototype.Jf=void 0,ft.prototype.$f=0,ft.prototype.rv=void 0;var vt=10;function _t(t){if("function"!=typeof t)throw new g('The "listener" argument must be of type Function. Received type '+typeof t)}function gt(t){return void 0===t.rv?ft.defaultMaxListeners:t.rv}function mt(t,i,s,e){var n,r,h;if(_t(s),void 0===(r=t.Jf)?(r=t.Jf=w.create(null),t.$f=0):(void 0!==r.newListener&&(t.emit("newListener",i,s.listener?s.listener:s),r=t.Jf),h=r[i]),void 0===h)h=r[i]=s,++t.$f;else if("function"==typeof h?h=r[i]=e?[s,h]:[h,s]:e?h.unshift(s):h.push(s),(n=gt(t))>0&&h.length>n&&!h.warned){h.warned=!0;var o=new m("Possible EventEmitter memory leak detected. "+h.length+" "+String(i)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=t,o.type=i,o.count=h.length,function(t){console&&console.warn&&console.warn(t)}(o)}return t}function pt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function wt(t,i,s){var e={fired:!1,wrapFn:void 0,target:t,type:i,listener:s},n=pt.bind(e);return n.listener=s,e.wrapFn=n,n}function yt(t,i,s){var e=t.Jf;if(void 0===e)return[];var n=e[i];return void 0===n?[]:"function"==typeof n?s?[n.listener||n]:[n]:s?function(t){for(var i=new Array(t.length),s=0;s<i.length;++s)i[s]=t[s].listener||t[s];return i}(n):At(n,n.length)}function bt(t){var i=this.Jf;if(void 0!==i){var s=i[t];if("function"==typeof s)return 1;if(void 0!==s)return s.length}return 0}function At(t,i){for(var s=new Array(i),e=0;e<i;++e)s[e]=t[e];return s}function St(t,i,s,e){if("function"==typeof t.on)e.once?t.once(i,s):t.on(i,s);else{if("function"!=typeof t.addEventListener)throw new g('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(i,function n(r){e.once&&t.removeEventListener(i,n),s(r)})}}w.defineProperty(ft,"defaultMaxListeners",{enumerable:!0,get:function(){return vt},set:function(t){if("number"!=typeof t||t<0||lt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vt=t}}),ft.init=function(){(void 0===this.Jf||this.Jf===w.getPrototypeOf(this).Jf)&&(this.Jf=w.create(null),this.$f=0),this.rv=this.rv||void 0},ft.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||lt(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this.rv=t,this},ft.prototype.getMaxListeners=function(){return gt(this)},ft.prototype.emit=function(t){for(var i=[],s=1;s<arguments.length;s++)i.push(arguments[s]);var e="error"===t,n=this.Jf;if(void 0!==n)e=e&&void 0===n.error;else if(!e)return!1;if(e){var r;if(i.length>0&&(r=i[0]),r instanceof m)throw r;var h=new m("Unhandled error."+(r?" ("+r.message+")":""));throw h.context=r,h}var o=n[t];if(void 0===o)return!1;if("function"==typeof o)dt(o,this,i);else{var a=o.length,u=At(o,a);for(s=0;s<a;++s)dt(u[s],this,i)}return!0},ft.prototype.addListener=function(t,i){return mt(this,t,i,!1)},ft.prototype.on=ft.prototype.addListener,ft.prototype.prependListener=function(t,i){return mt(this,t,i,!0)},ft.prototype.once=function(t,i){return _t(i),this.on(t,wt(this,t,i)),this},ft.prototype.prependOnceListener=function(t,i){return _t(i),this.prependListener(t,wt(this,t,i)),this},ft.prototype.removeListener=function(t,i){var s,e,n,r,h;if(_t(i),void 0===(e=this.Jf))return this;if(void 0===(s=e[t]))return this;if(s===i||s.listener===i)0===--this.$f?this.Jf=w.create(null):(delete e[t],e.removeListener&&this.emit("removeListener",t,s.listener||i));else if("function"!=typeof s){for(n=-1,r=s.length-1;r>=0;r--)if(s[r]===i||s[r].listener===i){h=s[r].listener,n=r;break}if(n<0)return this;0===n?s.shift():function(t,i){for(;i+1<t.length;i++)t[i]=t[i+1];t.pop()}(s,n),1===s.length&&(e[t]=s[0]),void 0!==e.removeListener&&this.emit("removeListener",t,h||i)}return this},ft.prototype.off=ft.prototype.removeListener,ft.prototype.removeAllListeners=function(t){var i,s,e;if(void 0===(s=this.Jf))return this;if(void 0===s.removeListener)return 0===arguments.length?(this.Jf=w.create(null),this.$f=0):void 0!==s[t]&&(0===--this.$f?this.Jf=w.create(null):delete s[t]),this;if(