UNPKG

theoplayer

Version:

THEOplayer is the universal video player solution, enabling you to quickly deliver cross-platform content playback.

39 lines (31 loc) 2.16 MB
/*! 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: long.js (Apache 2.0), 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 */ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(t):"function"==typeof define&&define.amd?define([],function(){return i(t)}):t.THEOplayer=i(t)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof s?s:"undefined"!=typeof global?global:this,function(t){"use strict";var i,n,r,e,s,u,o,h,c,a={exports:{}},f=(a.exports,t.window),v=t.document,d=t.location,l=t.navigator,w=t.setTimeout,g=t.clearTimeout,m=t.setInterval,_=t.clearInterval,y=t.Error,p=t.TypeError,k=(t.SyntaxError,t.Object),b=t.Math,A=t.parseInt,T=t.parseFloat,S=t.isNaN,E=t.Uint8Array,I=t.Worker,R=(t.WorkerGlobalScope,t.XMLHttpRequest),C=k.create,N=k.defineProperty,P=k.getOwnPropertyDescriptor,D=k.getOwnPropertyNames,x=k.getPrototypeOf,B=k.prototype.hasOwnProperty,L=function(t,i){return function(){return t&&(i=t(t=0)),i}},M=function(t,i){return function(){return i||t((i={exports:{}}).exports,i),i.exports}},O=function(t,i,n,r){if(i&&"object"==typeof i||"function"==typeof i)for(var e,s=D(i),u=0,o=s.length;u<o;u++)e=s[u],B.call(t,e)||e===n||N(t,e,{get:function(t){return i[t]}.bind(null,e),enumerable:!(r=P(i,e))||r.enumerable});return t},V=function(t,i,n){return n=null!=t?C(x(t)):{},O(!i&&t&&t.__esModule?n:N(n,"default",{value:t,enumerable:!0}),t)},F=L(function(){"function"==typeof Symbol&&Symbol.iterator?(i=Symbol,n=null!=(u=Symbol.for)?u:Symbol,r=Symbol.iterator,e=null!=(o=Symbol.dispose)?o:n("Symbol.dispose"),s=null!=(h=Symbol.asyncDispose)?h:n("Symbol.asyncDispose")):(c=0,i=function(t){return"hd"+t+"_"+ ++c},r=(n=function(t){return"hd"+t})("Symbol.iterator"),e=n("Symbol.dispose"),s=n("Symbol.asyncDispose"),i.for=n,i.iterator=r,i.dispose=e,i.asyncDispose=s)});function U(t,n){return null!=n&&void 0!==i&&n[i.hasInstance]?!!n[i.hasInstance](t):t instanceof n}var W=L(function(){F(),Et()});function Z(t){return t&&void 0!==i&&t.constructor===i?"symbol":typeof t}var X,G,H,z,Y,K,j,J,q,Q,tt,it,nt,rt,et,st,ut,ot,ht,ct,at=L(function(){F(),Et()});function ft(t){var i=this.constructor;return this.then(function(n){return i.resolve(t()).then(function(){return n})},function(n){return i.resolve(t()).then(function(){return i.reject(n)})})}function vt(t){return new this(function(i,n){if(!t||void 0===t.length)return n(new p((void 0===t?"undefined":Z(t))+" "+t+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(t);if(0===r.length)return i([]);var e=r.length;function s(t,n){if(n&&("object"===(void 0===n?"undefined":Z(n))||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(i){s(t,i)},function(n){r[t]={status:"rejected",reason:n},0===--e&&i(r)})}r[t]={status:"fulfilled",value:n},0===--e&&i(r)}for(var u=0;u<r.length;u++)s(u,r[u])})}function dt(t){return Boolean(t&&void 0!==t.length)}function lt(){}function wt(t){if(!U(this,wt))throw new p("Promises must be constructed via new");if("function"!=typeof t)throw new p("not a function");this.Ra=0,this.tki=!1,this.iTt=void 0,this.iki=[],kt(t,this)}function gt(t,i){for(;3===t.Ra;)t=t.iTt;0!==t.Ra?(t.tki=!0,wt.nki(function(){var n=1===t.Ra?i.onFulfilled:i.onRejected;if(null!==n){var r;try{r=n(t.iTt)}catch(t){return void _t(i.promise,t)}mt(i.promise,r)}else(1===t.Ra?mt:_t)(i.promise,t.iTt)})):t.iki.push(i)}function mt(t,i){try{if(i===t)throw new p("A promise cannot be resolved with itself.");if(i&&("object"===(void 0===i?"undefined":Z(i))||"function"==typeof i)){var n=i.then;if(U(i,wt))return t.Ra=3,t.iTt=i,void yt(t);if("function"==typeof n)return void kt(function(t,i){return function(){t.apply(i,arguments)}}(n,i),t)}t.Ra=1,t.iTt=i,yt(t)}catch(i){_t(t,i)}}function _t(t,i){t.Ra=2,t.iTt=i,yt(t)}function yt(t){2===t.Ra&&0===t.iki.length&&wt.nki(function(){t.tki||wt.rki(t.iTt)});for(var i=0,n=t.iki.length;i<n;i++)gt(t,t.iki[i]);t.iki=null}function pt(t,i,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof i?i:null,this.promise=n}function kt(t,i){var n=!1;try{t(function(t){n||(n=!0,mt(i,t))},function(t){n||(n=!0,_t(i,t))})}catch(t){if(n)return;n=!0,_t(i,t)}}function bt(t){return new it(tt,{reason:t,promise:G.reject(t).catch(function(){}),cancelable:!0})}function At(t){var i=new nt(tt,{detail:{reason:t},cancelable:!0});return k.defineProperty(i,"reason",{value:t}),i}function Tt(t){var i=v.createEvent("CustomEvent");return i.initCustomEvent(tt,!1,!0,{reason:t}),i}var St=L(function(){var t,i,n,r;F(),Et(),W(),at(),X=w,wt.prototype.catch=function(t){return this.then(null,t)},wt.prototype.then=function(t,i){var n=new this.constructor(lt);return gt(this,new pt(t,i,n)),n},wt.prototype.finally=ft,wt.all=function(t){return new wt(function(i,n){if(!dt(t))return n(new p("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return i([]);var e=r.length;function s(t,u){try{if(u&&("object"===(void 0===u?"undefined":Z(u))||"function"==typeof u)){var o=u.then;if("function"==typeof o)return void o.call(u,function(i){s(t,i)},n)}r[t]=u,0===--e&&i(r)}catch(t){n(t)}}for(var u=0;u<r.length;u++)s(u,r[u])})},wt.allSettled=vt,wt.resolve=function(t){return t&&"object"===(void 0===t?"undefined":Z(t))&&t.constructor===wt?t:new wt(function(i){i(t)})},wt.reject=function(t){return new wt(function(i,n){n(t)})},wt.race=function(t){return new wt(function(i,n){if(!dt(t))return n(new p("Promise.race accepts an array"));for(var r=0,e=t.length;r<e;r++)wt.resolve(t[r]).then(i,n)})},wt.nki="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){X(t,0)},wt.rki=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},G=function(){var t=self.Promise;if(void 0!==t)try{if(-1!==t.toString().indexOf("[native code]"))return t}catch(t){}}(),H=l?l.userAgent:"",z=H.match(/Firefox\/([0-9]+)/i),Y=null!=z,K=z?Number(z[1]):0,j=H.match(/(Version)\/((\d+)\.(\d+)(?:\.(\d+))?).*Safari/),J=null!=j,q=j?Number(j[3]):0,Q=function(){function t(t){this.hb=0,this.Ld=0,this.qm=[],this.eki=t}return t.prototype.ski=function(t){var i=this.length();this.uki(i+1);var n=this.Ld+i&this.eki-1;this.qm[n]=t,this.hb=i+1},t.prototype.push=function(t){var i=this.length()+1;if(this.eki<i)this.ski(t);else{var n=this.Ld+i-1,r=this.eki-1;this.qm[n&r]=t,this.hb=i}},t.prototype.shift=function(){var t=this.Ld,i=this.qm[t];return this.qm[t]=void 0,this.Ld=t+1&this.eki-1,this.hb--,i},t.prototype.length=function(){return this.hb},t.prototype.uki=function(t){this.eki<t&&this.oki(this.eki<<1)},t.prototype.oki=function(t){var i=this.eki;this.eki=t;var n=this.Ld+this.hb&i-1;!function(t,i,n,r){for(var e=0;e<r;++e)t[e+n]=t[e+i],t[e+i]=void 0}(this.qm,0,i,n)},t}(),tt="unhandledrejection",it=self.PromiseRejectionEvent,nt=self.CustomEvent,rt=function(t){return rt=function(){try{var t=G.resolve(),i="error",n=new it(tt,{reason:i,promise:t});return tt===n.type&&i===n.reason}catch(t){}return!1}()?bt:function(){try{var t="error",i=new nt(tt,{detail:{reason:t}});return tt===i.type&&t===i.detail.reason}catch(t){}return!1}()?At:Tt,rt(t)},st=Y&&K<60||J&&q<15,G&&!st?(ut=G,ot=function(){}):(ut=wt,ht=null!==(et=function(){var t=self.queueMicrotask;if("function"==typeof t)return function(i){return t(i)};var i=G;if(i&&"function"==typeof i.resolve){var n=i.resolve();return function(t){return n.then(t)}}}())&&void 0!==et?et:wt.nki,t=ht,i=new Q(16),n=!1,ot=(ct={l6:function(e){i.push(e),n||(n=!0,t(r))},qY:r=function(){for(;i.length()>0;)i.shift()();n=!1}}).qY,wt.nki=ct.l6,wt.rki=function(t){try{var i=rt(t);if(!self.dispatchEvent(i)||i.defaultPrevented)return}catch(t){}w(function(){throw new y("Unhandled promise rejection: ".concat(t))},0)})}),Et=L(function(){St()});function It(t,i){return(It=k.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}var Rt=L(function(){F(),Et()});function Ct(t,i){if("function"!=typeof i&&null!==i)throw new p("Super expression must either be null or a function");t.prototype=k.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&It(t,i)}var Nt=L(function(){F(),Et(),Rt()});function Pt(t,i){for(var n=0;n<i.length;n++){var r=i[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),k.defineProperty(t,r.key,r)}}function Dt(t,i,n){return i&&Pt(t.prototype,i),n&&Pt(t,n),t}var xt=L(function(){F(),Et()});function Bt(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,r=new Array(i);n<i;n++)r[n]=t[n];return r}var Lt=L(function(){F(),Et()});var Mt=L(function(){F(),Et(),Lt()});function Ot(t,n){var e=void 0!==i&&t[r]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,i){if(t){if("string"==typeof t)return Bt(t,i);var n=k.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bt(t,i):void 0}}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var s=0;return function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}}}throw new p("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Vt=L(function(){F(),Et(),Mt()});function Ft(t,i,n,r,e,s,u){try{var o=t[s](u),h=o.value}catch(t){return void n(t)}o.done?i(h):ut.resolve(h).then(r,e)}function Ut(t){return function(){var i=this,n=arguments;return new ut(function(r,e){var s=t.apply(i,n);function u(t){Ft(s,r,e,u,o,"next",t)}function o(t){Ft(s,r,e,u,o,"throw",t)}u(void 0)})}}var Wt,Zt=L(function(){F(),Et()});function Xt(t,n){var e,s,u,o={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},h=k.create(("function"==typeof Iterator?Iterator:k).prototype);return h.next=c(0),h.throw=c(1),h.return=c(2),"function"==typeof i&&(h[r]=function(){return this}),h;function c(i){return function(r){return function(i){if(e)throw new p("Generator is already executing.");for(;h&&(h=0,i[0]&&(o=0)),o;)try{if(e=1,s&&(u=2&i[0]?s.return:i[0]?s.throw||((u=s.return)&&u.call(s),0):s.next)&&!(u=u.call(s,i[1])).done)return u;switch(s=0,u&&(i=[2&i[0],u.value]),i[0]){case 0:case 1:u=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,s=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(u=o.trys,(u=u.length>0&&u[u.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!u||i[1]>u[0]&&i[1]<u[3])){o.label=i[1];break}if(6===i[0]&&o.label<u[1]){o.label=u[1],u=i;break}if(u&&o.label<u[2]){o.label=u[2],o.ops.push(i);break}u[2]&&o.ops.pop(),o.trys.pop();continue}i=n.call(t,o)}catch(t){i=[6,t],s=0}finally{e=u=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,r])}}}function Gt(t){var n="function"==typeof i&&r,e=n&&t[n],s=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new p(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ht(t,i,n){if(null!=i){if("object"!=typeof i&&"function"!=typeof i)throw new p("Object expected.");var r,u;if(n){if(!s)throw new p("Symbol.asyncDispose is not defined.");r=i[s]}if(void 0===r){if(!e)throw new p("Symbol.dispose is not defined.");r=i[e],n&&(u=r)}if("function"!=typeof r)throw new p("Object not disposable.");u&&(r=function(){try{u.call(this)}catch(t){return ut.reject(t)}}),t.stack.push({value:i,dispose:r,async:n})}else n&&t.stack.push({async:!0});return i}function zt(t){function i(i){t.error=t.hasError?new Wt(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;return function e(){for(;n=t.stack.pop();)try{if(!n.async&&1===r)return r=0,t.stack.push(n),ut.resolve().then(e);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,ut.resolve(s).then(e,function(t){return i(t),e()})}else r|=1}catch(t){i(t)}if(1===r)return t.hasError?ut.reject(t.error):ut.resolve();if(t.hasError)throw t.error}()}var Yt=L(function(){F(),Et(),Wt="function"==typeof SuppressedError?SuppressedError:function(t,i,n){var r=new y(n);return r.name="SuppressedError",r.error=t,r.suppressed=i,r}}),Kt=L(function(){F(),Et(),Yt()}),jt=M(function(t,n){var e,s;F(),Et(),at(),e=t,s=function(t){var n="function"==typeof i&&"symbol"===Z(r)?i:function(t){return"Symbol("+t+")"};function e(){}var s=Number.isNaN||function(t){return t!=t},u=e;function o(t){return"object"===(void 0===t?"undefined":Z(t))&&null!==t||"function"==typeof t}function h(t){return t.slice()}function c(t,i,n,r,e){new E(t).set(new E(n,r,e),i)}function a(t){return!1!==function(t){return"number"==typeof t&&(!s(t)&&!(t<0))}(t)&&t!==1/0}function f(t,i,n){if("function"!=typeof t)throw new p("Argument is not a function");return Function.prototype.apply.call(t,i,n)}function v(t,i,n,r){var e=t[i];if(void 0!==e){if("function"!=typeof e)throw new p(e+" is not a method");switch(n){case 0:return function(){return l(e,t,r)};case 1:return function(i){var n=[i].concat(r);return l(e,t,n)}}}return function(){return I(void 0)}}function d(t,i,n){var r=t[i];if(void 0!==r)return f(r,t,n)}function l(t,i,n){try{return I(f(t,i,n))}catch(t){return R(t)}}function w(t){if(t=Number(t),s(t)||t<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return t}function g(t){if(void 0===t)return function(){return 1};if("function"!=typeof t)throw new p("size property of a queuing strategy must be a function");return function(i){return t(i)}}var m=ut,_=ut.prototype.then,A=ut.resolve.bind(m),T=ut.reject.bind(m);function S(t){return new m(t)}function I(t){return A(t)}function R(t){return T(t)}function C(t,i,n){return _.call(t,i,n)}function N(t,i,n){C(C(t,i,n),void 0,u)}function P(t,i){N(t,i)}function D(t,i){N(t,void 0,i)}function x(t,i,n){return C(t,i,n)}function B(t){C(t,void 0,u)}var L=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 k.defineProperty(t.prototype,"length",{get:function(){return this.Dd},enumerable:!0,configurable:!0}),t.prototype.push=function(t){var i=this.Vd,n=i;16383===i.Od.length&&(n={Od:[],Fd:void 0}),i.Od.push(t),n!==i&&(this.Vd=n,i.Fd=n),++this.Dd},t.prototype.shift=function(){var t=this.Ld,i=t,n=this.Rd,r=n+1,e=t.Od,s=e[n];return 16384===r&&(i=t.Fd,r=0),--this.Dd,this.Rd=r,t!==i&&(this.Ld=i),e[n]=void 0,s},t.prototype.forEach=function(t){for(var i=this.Rd,n=this.Ld,r=n.Od;!(i===r.length&&void 0===n.Fd||i===r.length&&(i=0,0===(r=(n=n.Fd).Od).length));)t(r[i]),++i},t.prototype.peek=function(){var t=this.Ld,i=this.Rd;return t.Od[i]},t}();function M(t,i,n){var r=null;!0===n&&(r=k.prototype);var e=k.create(r);return e.value=t,e.done=i,e}function O(t,i){t.Wd=!0,t.Ud=i,i.Gd=t,"readable"===i.Ra?W(t):"closed"===i.Ra?function(t){W(t),H(t)}(t):X(t,i.Xd)}function V(t,i){return Ji(t.Ud,i)}function F(t){"readable"===t.Ud.Ra?G(t,new p("Reader was released and can no longer be used to monitor the stream's closedness")):function(t,i){X(t,i)}(t,new p("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 U(t){return new p("Cannot "+t+" a stream using a released reader")}function W(t){t.Zd=S(function(i,n){t.Hd=i,t.zd=n})}function X(t,i){W(t),G(t,i)}function G(t,i){B(t.Zd),t.zd(i),t.Hd=void 0,t.zd=void 0}function H(t){t.Hd(void 0),t.Hd=void 0,t.zd=void 0}var z=n("[[CancelSteps]]"),Y=n("[[PullSteps]]");function K(t,i){void 0===i&&(i=!1);var n=new it(t);return n.Wd=i,n}function j(t){return S(function(i,n){var r={Yd:i,Kd:n};t.Gd.qd.push(r)})}function J(t,i,n){var r=t.Gd;r.qd.shift().Yd(M(i,n,r.Wd))}function q(t){return t.Gd.qd.length}function Q(t){var i=t.Gd;return void 0!==i&&!!nt(i)}var $,tt,it=function(){function t(t){if(!1===Ki(t))throw new p("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===ji(t))throw new p("This stream has already been locked for exclusive reading by another reader");O(this,t),this.qd=new L}return k.defineProperty(t.prototype,"closed",{get:function(){return nt(this)?this.Zd:R(et("closed"))},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return nt(this)?void 0===this.Ud?R(U("cancel")):V(this,t):R(et("cancel"))},t.prototype.read=function(){return nt(this)?void 0===this.Ud?R(U("read from")):rt(this):R(et("read"))},t.prototype.releaseLock=function(){if(!nt(this))throw et("releaseLock");if(void 0!==this.Ud){if(this.qd.length>0)throw new p("Tried to release a reader lock when that reader has pending read() calls un-settled");F(this)}},t}();function nt(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"qd")}function rt(t){var i=t.Ud;return i.Qd=!0,"closed"===i.Ra?I(M(void 0,!0,t.Wd)):"errored"===i.Ra?R(i.Xd):i.Jd[Y]()}function et(t){return new p("ReadableStreamDefaultReader.prototype."+t+" can only be used on a ReadableStreamDefaultReader")}"symbol"===Z(n.asyncIterator)&&(($={})[n.asyncIterator]=function(){return this},tt=$,k.defineProperty(tt,n.asyncIterator,{enumerable:!1}));var st={next:function(){if(!1===ot(this))return R(ht("next"));var t=this.$d;return void 0===t.Ud?R(U("iterate")):x(rt(t),function(i){var n=i.done;return n&&F(t),M(i.value,n,!0)})},return:function(t){if(!1===ot(this))return R(ht("next"));var i=this.$d;if(void 0===i.Ud)return R(U("finish iterating"));if(i.qd.length>0)return R(new p("Tried to release a reader lock when that reader has pending read() calls un-settled"));if(!1===this.ul){var n=V(i,t);return F(i),x(n,function(){return M(t,!0,!0)})}return F(i),I(M(t,!0,!0))}};function ot(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"$d")}function ht(t){return new p("ReadableStreamAsyncIterator."+t+" can only be used on a ReadableSteamAsyncIterator")}function ct(t){var i=t.tf.shift();return t.if-=i.size,t.if<0&&(t.if=0),i.value}function at(t,i,n){if(!a(n=Number(n)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");t.tf.push({value:i,size:n}),t.if+=n}function ft(t){t.tf=new L,t.if=0}void 0!==tt&&k.setPrototypeOf(st,tt),k.defineProperty(st,"next",{enumerable:!1}),k.defineProperty(st,"return",{enumerable:!1});var vt=n("[[AbortSteps]]"),dt=n("[[ErrorSteps]]"),lt=function(){function t(t,i){void 0===t&&(t={}),void 0===i&&(i={}),gt(this);var n=i.size,r=i.highWaterMark;if(void 0!==t.type)throw new RangeError("Invalid type is specified");var e=g(n);void 0===r&&(r=1),function(t,i,n,r){var e=k.create(Bt.prototype);function s(){return d(i,"start",[e])}var u=v(i,"write",1,[e]),o=v(i,"close",0,[]),h=v(i,"abort",1,[]);Lt(t,e,s,u,o,h,n,r)}(this,t,r=w(r),e)}return k.defineProperty(t.prototype,"locked",{get:function(){if(!1===mt(this))throw Zt("locked");return _t(this)},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){return!1===mt(this)?R(Zt("abort")):!0===_t(this)?R(new p("Cannot abort a stream that already has a writer")):yt(this,t)},t.prototype.close=function(){return!1===mt(this)?R(Zt("close")):!0===_t(this)?R(new p("Cannot close a stream that already has a writer")):!0===Tt(this)?R(new p("Cannot close an already-closing stream")):pt(this)},t.prototype.getWriter=function(){if(!1===mt(this))throw Zt("getWriter");return wt(this)},t}();function wt(t){return new It(t)}function gt(t){t.Ra="writable",t.Xd=void 0,t.ef=void 0,t.nf=void 0,t.rf=new L,t.hf=void 0,t.uf=void 0,t.cf=void 0,t.df=void 0,t.lf=!1}function mt(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"nf")}function _t(t){return void 0!==t.ef}function yt(t,i){var n=t.Ra;if("closed"===n||"errored"===n)return I(void 0);if(void 0!==t.df)return t.df.vf;var r=!1;"erroring"===n&&(r=!0,i=void 0);var e=S(function(n,e){t.df={vf:void 0,Yd:n,Kd:e,_f:i,gf:r}});return t.df.vf=e,!1===r&&bt(t,i),e}function pt(t){var i=t.Ra;if("closed"===i||"errored"===i)return R(new p("The stream (in "+i+" state) is not in the writable state and cannot be closed"));var n=S(function(i,n){var r={Yd:i,Kd:n};t.uf=r}),r=t.ef;return void 0!==r&&!0===t.lf&&"writable"===i&&$t(r),function(t){at(t,"close",0),Vt(t)}(t.nf),n}function kt(t,i){"writable"!==t.Ra?At(t):bt(t,i)}function bt(t,i){var n=t.nf;t.Ra="erroring",t.Xd=i;var r=t.ef;void 0!==r&&Pt(r,i),!1===function(t){return void 0!==t.hf||void 0!==t.cf}(t)&&!0===n.mf&&At(t)}function At(t){t.Ra="errored",t.nf[dt]();var i=t.Xd;if(t.rf.forEach(function(t){t.Kd(i)}),t.rf=new L,void 0!==t.df){var n=t.df;if(t.df=void 0,!0===n.gf)return n.Kd(i),void St(t);N(t.nf[vt](n._f),function(){n.Yd(),St(t)},function(i){n.Kd(i),St(t)})}else St(t)}function Tt(t){return void 0!==t.uf||void 0!==t.cf}function St(t){void 0!==t.uf&&(t.uf.Kd(t.Xd),t.uf=void 0);var i=t.ef;void 0!==i&&Yt(i,t.Xd)}function Et(t,i){var n=t.ef;void 0!==n&&i!==t.lf&&(!0===i?function(t){jt(t)}(n):$t(n)),t.lf=i}var It=function(){function t(t){if(!1===mt(t))throw new p("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===_t(t))throw new p("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===Tt(t)&&!0===t.lf?jt(this):qt(this),Ht(this);else if("erroring"===i)Jt(this,t.Xd),Ht(this);else if("closed"===i)qt(this),function(t){Ht(t),Kt(t)}(this);else{var n=t.Xd;Jt(this,n),zt(this,n)}}return k.defineProperty(t.prototype,"closed",{get:function(){return!1===Rt(this)?R(Xt("closed")):this.Zd},enumerable:!0,configurable:!0}),k.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===Rt(this))throw Xt("desiredSize");if(void 0===this.pf)throw Gt("desiredSize");return function(t){var i=t.pf,n=i.Ra;return"errored"===n||"erroring"===n?null:"closed"===n?0:Ot(i.nf)}(this)},enumerable:!0,configurable:!0}),k.defineProperty(t.prototype,"ready",{get:function(){return!1===Rt(this)?R(Xt("ready")):this.wf},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){return!1===Rt(this)?R(Xt("abort")):void 0===this.pf?R(Gt("abort")):function(t,i){var n=t.pf;return yt(n,i)}(this,t)},t.prototype.close=function(){if(!1===Rt(this))return R(Xt("close"));var t=this.pf;return void 0===t?R(Gt("close")):!0===Tt(t)?R(new p("Cannot close an already-closing stream")):Ct(this)},t.prototype.releaseLock=function(){if(!1===Rt(this))throw Xt("releaseLock");void 0!==this.pf&&Dt(this)},t.prototype.write=function(t){return!1===Rt(this)?R(Xt("write")):void 0===this.pf?R(Gt("write to")):xt(this,t)},t}();function Rt(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"pf")}function Ct(t){return pt(t.pf)}function Nt(t,i){"pending"===t.yf?Yt(t,i):function(t,i){zt(t,i)}(t,i)}function Pt(t,i){"pending"===t.bf?Qt(t,i):function(t,i){Jt(t,i)}(t,i)}function Dt(t){var i=t.pf,n=new p("Writer was released and can no longer be used to monitor the stream's closedness");Pt(t,n),Nt(t,n),i.ef=void 0,t.pf=void 0}function xt(t,i){var n=t.pf,r=n.nf,e=function(t,i){try{return t.Af(i)}catch(i){return Ft(t,i),1}}(r,i);if(n!==t.pf)return R(Gt("write to"));var s=n.Ra;if("errored"===s)return R(n.Xd);if(!0===Tt(n)||"closed"===s)return R(new p("The stream is closing or closed and cannot be written to"));if("erroring"===s)return R(n.Xd);var u=function(t){return S(function(i,n){var r={Yd:i,Kd:n};t.rf.push(r)})}(n);return function(t,i,n){var r={chunk:i};try{at(t,r,n)}catch(i){return void Ft(t,i)}var e=t.Sf;!1===Tt(e)&&"writable"===e.Ra&&Et(e,Ut(t)),Vt(t)}(r,i,e),u}var Bt=function(){function t(){throw new p("WritableStreamDefaultController cannot be constructed explicitly")}return t.prototype.error=function(t){if(!1===function(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Sf")}(this))throw new p("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this.Sf.Ra&&Wt(this,t)},t.prototype[vt]=function(t){var i=this.Tf(t);return Mt(this),i},t.prototype[dt]=function(){ft(this)},t}();function Lt(t,i,n,r,e,s,u,o){i.Sf=t,t.nf=i,i.tf=void 0,i.if=void 0,ft(i),i.mf=!1,i.Af=o,i.kf=u,i.Ef=r,i.Rf=e,i.Tf=s;var h=Ut(i);Et(t,h),N(I(n()),function(){i.mf=!0,Vt(i)},function(n){i.mf=!0,kt(t,n)})}function Mt(t){t.Ef=void 0,t.Rf=void 0,t.Tf=void 0,t.Af=void 0}function Ot(t){return t.kf-t.if}function Vt(t){var i=t.Sf;if(!1!==t.mf&&void 0===i.hf)if("erroring"!==i.Ra){if(0!==t.tf.length){var n=function(t){return t.tf.peek().value}(t);"close"===n?function(t){var i=t.Sf;(function(t){t.cf=t.uf,t.uf=void 0})(i),ct(t);var n=t.Rf();Mt(t),N(n,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&&Kt(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),kt(t,i)}(i,t)})}(t):function(t,i){var n=t.Sf;!function(t){t.hf=t.rf.shift()}(n);var r=t.Ef(i);N(r,function(){!function(t){t.hf.Yd(void 0),t.hf=void 0}(n);var i=n.Ra;if(ct(t),!1===Tt(n)&&"writable"===i){var r=Ut(t);Et(n,r)}Vt(t)},function(i){"writable"===n.Ra&&Mt(t),function(t,i){t.hf.Kd(i),t.hf=void 0,kt(t,i)}(n,i)})}(t,n.chunk)}}else At(i)}function Ft(t,i){"writable"===t.Sf.Ra&&Wt(t,i)}function Ut(t){return Ot(t)<=0}function Wt(t,i){var n=t.Sf;Mt(t),bt(n,i)}function Zt(t){return new p("WritableStream.prototype."+t+" can only be used on a WritableStream")}function Xt(t){return new p("WritableStreamDefaultWriter.prototype."+t+" can only be used on a WritableStreamDefaultWriter")}function Gt(t){return new p("Cannot "+t+" a stream using a released writer")}function Ht(t){t.Zd=S(function(i,n){t.Hd=i,t.zd=n,t.yf="pending"})}function zt(t,i){Ht(t),Yt(t,i)}function Yt(t,i){B(t.Zd),t.zd(i),t.Hd=void 0,t.zd=void 0,t.yf="rejected"}function Kt(t){t.Hd(void 0),t.Hd=void 0,t.zd=void 0,t.yf="resolved"}function jt(t){t.wf=S(function(i,n){t.If=i,t.xf=n}),t.bf="pending"}function Jt(t,i){jt(t),Qt(t,i)}function qt(t){jt(t),$t(t)}function Qt(t,i){B(t.wf),t.xf(i),t.If=void 0,t.xf=void 0,t.bf="rejected"}function $t(t){t.If(void 0),t.If=void 0,t.xf=void 0,t.bf="fulfilled"}function ti(t){if("object"!==(void 0===t?"undefined":Z(t))||null===t)return!1;try{return"boolean"==typeof t.aborted}catch(t){return!1}}var ii,ni="undefined"!=typeof DOMException?DOMException:void 0,ri=function(t){if("function"!=typeof t&&"object"!==(void 0===t?"undefined":Z(t)))return!1;try{return new t,!0}catch(t){return!1}}(ni)?ni:((ii=function(t,i){this.message=t||"",this.name=i||"Error",y.captureStackTrace&&y.captureStackTrace(this,this.constructor)}).prototype=k.create(y.prototype),k.defineProperty(ii.prototype,"constructor",{value:ii,writable:!0,configurable:!0}),ii);function ei(t,i,n,r,s,u){var o=K(t),h=wt(i);t.Qd=!0;var c=!1,a=I(void 0);return S(function(f,v){var d,l,w,g;if(void 0!==u){if(d=function(){var n=new ri("Aborted","AbortError"),e=[];!1===r&&e.push(function(){return"writable"===i.Ra?yt(i,n):I(void 0)}),!1===s&&e.push(function(){return"readable"===t.Ra?Ji(t,n):I(void 0)}),k(function(){return ut.all(e.map(function(t){return t()}))},!0,n)},!0===u.aborted)return void d();u.addEventListener("abort",d)}if(y(t,o.Zd,function(t){!1===r?k(function(){return yt(i,t)},!0,t):b(!0,t)}),y(i,h.Zd,function(i){!1===s?k(function(){return Ji(t,i)},!0,i):b(!0,i)}),l=t,w=o.Zd,g=function(){!1===n?k(function(){return function(t){var i=t.pf,n=i.Ra;return!0===Tt(i)||"closed"===n?I(void 0):"errored"===n?R(i.Xd):Ct(t)}(h)}):b()},"closed"===l.Ra?g():P(w,g),!0===Tt(i)||"closed"===i.Ra){var m=new p("the destination writable stream closed before all data could be piped to it");!1===s?k(function(){return Ji(t,m)},!0,m):b(!0,m)}function _(){var t=a;return C(a,function(){return t!==a?_():void 0})}function y(t,i,n){"errored"===t.Ra?n(t.Xd):D(i,n)}function k(t,n,r){function e(){N(t(),function(){return A(n,r)},function(t){return A(!0,t)})}!0!==c&&(c=!0,"writable"===i.Ra&&!1===Tt(i)?P(_(),e):e())}function b(t,n){!0!==c&&(c=!0,"writable"===i.Ra&&!1===Tt(i)?P(_(),function(){return A(t,n)}):A(t,n))}function A(t,i){Dt(h),F(o),void 0!==u&&u.removeEventListener("abort",d),t?v(i):f(void 0)}B(S(function(t,i){!function n(r){r?t():C(!0===c?I(!0):C(h.wf,function(){return C(rt(o),function(t){return!0===t.done||(a=C(xt(h,t.value),void 0,e),!1)})}),n,i)}(!1)}))})}var si=function(){function t(){throw new p}return k.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===ui(this))throw gi("desiredSize");return di(this)},enumerable:!0,configurable:!0}),t.prototype.close=function(){if(!1===ui(this))throw gi("close");if(!1===li(this))throw new p("The stream is not in a state that permits close");ai(this)},t.prototype.enqueue=function(t){if(!1===ui(this))throw gi("enqueue");if(!1===li(this))throw new p("The stream is not in a state that permits enqueue");return fi(this,t)},t.prototype.error=function(t){if(!1===ui(this))throw gi("error");vi(this,t)},t.prototype[z]=function(t){ft(this);var i=this.Cf(t);return ci(this),i},t.prototype[Y]=function(){var t=this.Pf;if(this.tf.length>0){var i=ct(this);return!0===this.Nf&&0===this.tf.length?(ci(this),qi(t)):oi(this),I(M(i,!1,t.Gd.Wd))}var n=j(t);return oi(this),n},t}();function ui(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Pf")}function oi(t){!1!==hi(t)&&(!0!==t.Df?(t.Df=!0,N(t.Bf(),function(){t.Df=!1,!0===t.Lf&&(t.Lf=!1,oi(t))},function(i){vi(t,i)})):t.Lf=!0)}function hi(t){var i=t.Pf;return!1!==li(t)&&!1!==t.mf&&(!0===ji(i)&&q(i)>0||di(t)>0)}function ci(t){t.Bf=void 0,t.Cf=void 0,t.Af=void 0}function ai(t){var i=t.Pf;t.Nf=!0,0===t.tf.length&&(ci(t),qi(i))}function fi(t,i){var n=t.Pf;if(!0===ji(n)&&q(n)>0)J(n,i,!1);else{var r=void 0;try{r=t.Af(i)}catch(i){throw vi(t,i),i}try{at(t,i,r)}catch(i){throw vi(t,i),i}}oi(t)}function vi(t,i){var n=t.Pf;"readable"===n.Ra&&(ft(t),ci(t),Qi(n,i))}function di(t){var i=t.Pf.Ra;return"errored"===i?null:"closed"===i?0:t.kf-t.if}function li(t){var i=t.Pf.Ra;return!1===t.Nf&&"readable"===i}function wi(t,i,n,r,e,s,u){i.Pf=t,i.tf=void 0,i.if=void 0,ft(i),i.mf=!1,i.Nf=!1,i.Lf=!1,i.Df=!1,i.Af=u,i.kf=s,i.Bf=r,i.Cf=e,t.Jd=i,N(I(n()),function(){i.mf=!0,oi(i)},function(t){vi(i,t)})}function gi(t){return new p("ReadableStreamDefaultController.prototype."+t+" can only be used on a ReadableStreamDefaultController")}var mi=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&b.floor(t)===t},_i=function(){function t(){throw new p("ReadableStreamBYOBRequest cannot be used directly")}return k.defineProperty(t.prototype,"view",{get:function(){if(!1===ki(this))throw Oi("view");return this.Mf},enumerable:!0,configurable:!0}),t.prototype.respond=function(t){if(!1===ki(this))throw Oi("respond");if(void 0===this.Of)throw new p("This BYOB request has been invalidated");this.Mf.buffer,function(t,i){if(!1===a(i=Number(i)))throw new RangeError("bytesWritten must be a finite");Pi(t,i)}(this.Of,t)},t.prototype.respondWithNewView=function(t){if(!1===ki(this))throw Oi("respond");if(void 0===this.Of)throw new p("This BYOB request has been invalidated");if(!ArrayBuffer.isView(t))throw new p("You can only respond with array buffer views");t.buffer,function(t,i){var n=t.Ff.peek();if(n.byteOffset+n.bytesFilled!==i.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(n.byteLength!==i.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");n.buffer=i.buffer,Pi(t,i.byteLength)}(this.Of,t)},t}(),yi=function(){function t(){throw new p("ReadableByteStreamController constructor cannot be used directly")}return k.defineProperty(t.prototype,"byobRequest",{get:function(){if(!1===pi(this))throw Vi("byobRequest");if(void 0===this.Vf&&this.Ff.length>0){var t=this.Ff.peek(),i=new E(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=k.create(_i.prototype);!function(t,i,n){t.Of=i,t.Mf=n}(n,this,i),this.Vf=n}return this.Vf},enumerable:!0,configurable:!0}),k.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===pi(this))throw Vi("desiredSize");return Li(this)},enumerable:!0,configurable:!0}),t.prototype.close=function(){if(!1===pi(this))throw Vi("close");if(!0===this.Nf)throw new p("The stream has already been closed; do not close it again!");var t=this.Wf.Ra;if("readable"!==t)throw new p("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)t.Nf=!0;else{if(t.Ff.length>0&&t.Ff.peek().bytesFilled>0){var n=new p("Insufficient bytes to fill elements in the given buffer");throw Bi(t,n),n}xi(t),qi(i)}}(this)},t.prototype.enqueue=function(t){if(!1===pi(this))throw Vi("enqueue");if(!0===this.Nf)throw new p("stream is closed or draining");var i=this.Wf.Ra;if("readable"!==i)throw new p("The stream (in "+i+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(t))throw new p("You can only enqueue array buffer views when using a ReadableByteStreamController");t.buffer,function(t,i){var n=t.Wf,r=i.buffer,e=i.byteOffset,s=i.byteLength,u=r;!0===Q(n)?0===q(n)?Si(t,u,e,s):J(n,new E(u,e,s),!1):!0===Wi(n)?(Si(t,u,e,s),Ni(t)):Si(t,u,e,s),bi(t)}(this,t)},t.prototype.error=function(t){if(!1===pi(this))throw Vi("error");Bi(this,t)},t.prototype[z]=function(t){this.Ff.length>0&&(this.Ff.peek().bytesFilled=0),ft(this);var i=this.Cf(t);return xi(this),i},t.prototype[Y]=function(){var t=this.Wf;if(this.if>0){var i=this.tf.shift();this.if-=i.byteLength,Ri(this);var n=void 0;try{n=new E(i.buffer,i.byteOffset,i.byteLength)}catch(t){return R(t)}return I(M(n,!1,t.Gd.Wd))}var r=this.Uf;if(void 0!==r){var e=void 0;try{e=new ArrayBuffer(r)}catch(t){return R(t)}var s={buffer:e,byteOffset:0,byteLength:r,bytesFilled:0,elementSize:1,ctor:E,readerType:"default"};this.Ff.push(s)}var u=j(t);return bi(this),u},t}();function pi(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Wf")}function ki(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Of")}function bi(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===Q(i)&&q(i)>0)return!0;if(!0===Wi(i)&&Ui(i)>0)return!0;var n=Li(t);return n>0}(t);!1!==i&&(!0!==t.Df?(t.Df=!0,N(t.Bf(),function(){t.Df=!1,!0===t.Lf&&(t.Lf=!1,bi(t))},function(i){Bi(t,i)})):t.Lf=!0)}function Ai(t,i){var n=!1;"closed"===t.Ra&&(n=!0);var r=Ti(i);"default"===i.readerType?J(t,r,n):function(t,i,n){var r=t.Gd,e=r.Gf.shift();e.Yd(M(i,n,r.Wd))}(t,r,n)}function Ti(t){var i=t.bytesFilled,n=t.elementSize;return new t.ctor(t.buffer,t.byteOffset,i/n)}function Si(t,i,n,r){t.tf.push({buffer:i,byteOffset:n,byteLength:r}),t.if+=r}function Ei(t,i){var n=i.elementSize,r=i.bytesFilled-i.bytesFilled%n,e=b.min(t.if,i.byteLength-i.bytesFilled),s=i.bytesFilled+e,u=s-s%n,o=e,h=!1;u>r&&(o=u-i.bytesFilled,h=!0);for(var a=t.tf;o>0;){var f=a.peek(),v=b.min(o,f.byteLength),d=i.byteOffset+i.bytesFilled;c(i.buffer,d,f.buffer,f.byteOffset,v),f.byteLength===v?a.shift():(f.byteOffset+=v,f.byteLength-=v),t.if-=v,Ii(t,v,i),o-=v}return h}function Ii(t,i,n){Ci(t),n.bytesFilled+=i}function Ri(t){0===t.if&&!0===t.Nf?(xi(t),qi(t.Wf)):bi(t)}function Ci(t){void 0!==t.Vf&&(t.Vf.Of=void 0,t.Vf.Mf=void 0,t.Vf=void 0)}function Ni(t){for(;t.Ff.length>0;){if(0===t.if)return;var i=t.Ff.peek();!0===Ei(t,i)&&(Di(t),Ai(t.Wf,i))}}function Pi(t,i){var n=t.Ff.peek();if("closed"===t.Wf.Ra){if(0!==i)throw new p("bytesWritten must be 0 when calling respond() on a closed stream");!function(t,i){i.buffer=i.buffer;var n=t.Wf;if(!0===Wi(n))for(;Ui(n)>0;)Ai(n,Di(t))}(t,n)}else!function(t,i,n){if(n.bytesFilled+i>n.byteLength)throw new RangeError("bytesWritten out of range");if(Ii(t,i,n),!(n.bytesFilled<n.elementSize)){Di(t);var r=n.bytesFilled%n.elementSize;if(r>0){var e=n.byteOffset+n.bytesFilled,s=n.buffer.slice(e-r,e);Si(t,s,0,s.byteLength)}n.buffer=n.buffer,n.bytesFilled-=r,Ai(t.Wf,n),Ni(t)}}(t,i,n);bi(t)}function Di(t){var i=t.Ff.shift();return Ci(t),i}function xi(t){t.Bf=void 0,t.Cf=void 0}function Bi(t,i){var n=t.Wf;"readable"===n.Ra&&(function(t){Ci(t),t.Ff=new L}(t),ft(t),xi(t),Qi(n,i))}function Li(t){var i=t.Wf.Ra;return"errored"===i?null:"closed"===i?0:t.kf-t.if}function Mi(t,i,n){var r=k.create(yi.prototype),e=v(i,"pull",0,[r]),s=v(i,"cancel",1,[]),u=i.autoAllocateChunkSize;if(void 0!==u&&(u=Number(u),!1===mi(u)||u<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");!function(t,i,n,r,e,s,u){i.Wf=t,i.Lf=!1,i.Df=!1,i.Vf=void 0,i.tf=i.if=void 0,ft(i),i.Nf=!1,i.mf=!1,i.kf=w(s),i.Bf=r,i.Cf=e,i.Uf=u,i.Ff=new L,t.Jd=i,N(I(n()),function(){i.mf=!0,bi(i)},function(t){Bi(i,t)})}(t,r,function(){return d(i,"start",[r])},e,s,n,u)}function Oi(t){return new p("ReadableStreamBYOBRequest.prototype."+t+" can only be used on a ReadableStreamBYOBRequest")}function Vi(t){return new p("ReadableByteStreamController.prototype."+t+" can only be used on a ReadableByteStreamController")}function Fi(t){return S(function(i,n){var r={Yd:i,Kd:n};t.Gd.Gf.push(r)})}function Ui(t){return t.Gd.Gf.length}function Wi(t){var i=t.Gd;return void 0!==i&&!!Xi(i)}var Zi=function(){function t(t){if(!Ki(t))throw new p("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===pi(t.Jd))throw new p("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(ji(t))throw new p("This stream has already been locked for exclusive reading by another reader");O(this,t),this.Gf=new L}return k.defineProperty(t.prototype,"closed",{get:function(){return Xi(this)?this.Zd:R(Gi("closed"))},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return Xi(this)?void 0===this.Ud?R(U("cancel")):V(this,t):R(Gi("cancel"))},t.prototype.read=function(t){return Xi(this)?void 0===this.Ud?R(U("read from")):ArrayBuffer.isView(t)?(t.buffer,0===t.byteLength?R(new p("view must have non-zero byteLength")):function(t,i){var n=t.Ud;return n.Qd=!0,"errored"===n.Ra?R(n.Xd):function(t,i){var n=t.Wf,r=1;i.constructor!==DataView&&(r=i.constructor.BYTES_PER_ELEMENT);var e=i.constructor,s={buffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength,bytesFilled:0,elementSize:r,ctor:e,readerType:"byob"};if(t.Ff.length>0)return t.Ff.push(s),Fi(n);if("closed"===n.Ra)return I(M(new e(s.buffer,s.byteOffset,0),!0,n.Gd.Wd));if(t.if>0){if(!0===Ei(t,s)){var u=Ti(s);return Ri(t),I(M(u,!1,n.Gd.Wd))}if(!0===t.Nf){var o=new p("Insufficient bytes to fill elements in the given buffer");return Bi(t,o),R(o)}}t.Ff.push(s);var h=Fi(n);return bi(t),h}(n.Jd,i)}(this,t)):R(new p("view must be an array buffer view")):R(Gi("read"))},t.prototype.releaseLock=function(){if(!Xi(this))throw Gi("releaseLock");if(void 0!==this.Ud){if(this.Gf.length>0)throw new p("Tried to release a reader lock when that reader has pending read() calls un-settled");F(this)}},t}();function Xi(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Gf")}function Gi(t){return new p("ReadableStreamBYOBReader.prototype."+t+" can only be used on a ReadableStreamBYOBReader")}var Hi=function(){function t(t,i){void 0===t&&(t={}),void 0===i&&(i={}),Yi(this);var n=i.size,r=i.highWaterMark,e=t.type;if("bytes"===String(e)){if(void 0!==n)throw new RangeError("The strategy for a byte stream cannot have a size function");void 0===r&&(r=0),Mi(this,t,r=w(r))}else{if(void 0!==e)throw new RangeError("Invalid type is specified");var s=g(n);void 0===r&&(r=1),function(t,i,n,r){var e=k.create(si.prototype),s=v(i,"pull",0,[e]),u=v(i,"cancel",1,[]);wi(t,e,function(){return d(i,"start",[e])},s,u,n,r)}(this,t,r=w(r),s)}}return k.defineProperty(t.prototype,"locked",{get:function(){if(!1===Ki(this))throw $i("locked");return ji(this)},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return!1===Ki(this)?R($i("cancel")):!0===ji(this)?R(new p("Cannot cancel a stream that already has a reader")):Ji(this,t)},t.prototype.getReader=function(t){var i=(void 0===t?{}:t).mode;if(!1===Ki(this))throw $i("getReader");if(void 0===i)return K(this,!0);if("byob"===(i=String(i)))return function(t,i){void 0===i&&(i=!1);var n=new Zi(t);return n.Wd=i,n}(this,!0);throw new RangeError("Invalid mode is specified")},t.prototype.pipeThrough=function(t,i){var n=t.writable,r=t.readable,e=void 0===i?{}:i,s=e.preventClose,u=e.preventAbort,o=e.preventCancel,h=e.signal;if(!1===Ki(this))throw $i("pipeThrough");if(!1===mt(n))throw new p("writable argument to pipeThrough must be a WritableStream");if(!1===Ki(r))throw new p("readable argument to pipeThrough must be a ReadableStream");if(s=Boolean(s),u=Boolean(u),o=Boolean(o),void 0!==h&&!ti(h))throw new p("ReadableStream.prototype.pipeThrough's signal option must be an AbortSignal");if(!0===ji(this))throw new p("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(!0===_t(n))throw new p("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return B(ei(this,n,s,u,o,h)),r},t.prototype.pipeTo=function(t,i){var n=void 0===i?{}:i,r=n.preventClose,e=n.preventAbort,s=n.preventCancel,u=n.signal;return!1===Ki(this)?R($i("pipeTo")):!1===mt(t)?R(new p("ReadableStream.prototype.pipeTo's first argument must be a WritableStream")):(r=Boolean(r),e=Boolean(e),s=Boolean(s),void 0===u||ti(u)?!0===ji(this)?R(new p("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):!0===_t(t)?R(new p("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ei(this,t,r,e,s,u):R(new p("ReadableStream.prototype.pipeTo's signal option must be an AbortSignal")))},t.prototype.tee=function(){if(!1===Ki(this))throw $i("tee");var t=function(t){var i,n,r,e,s,u=K(t),o=!1,c=!1,a=!1,f=S(function(t){s=t});function v(){return!0===o||(o=!0,B(x(rt(u),function(t){if(o=!1,!0===t.done)return!1===c&&ai(r.Jd),void(!1===a&&ai(e.Jd));var i=t.value,n=i,s=i;!1===c&&fi(r.Jd,n),!1===a&&fi(e.Jd,s)}))),I(void 0)}function d(){}return r=zi(d,v,function(r){if(c=!0,i=r,!0===a){var e=h([i,n]),u=Ji(t,e);s(u)}return f}),e=zi(d,v,function(r){if(a=!0,n=r,!0===c){var e=h([i,n]),u=Ji(t,e);s(u)}return f}),D(u.Zd,function(t){vi(r.Jd,t),vi(e.Jd,t)}),[r,e]}(this);return h(t)},t.prototype.getIterator=function(t){var i=(void 0===t?{}:t).preventCancel,n=void 0!==i&&i;if(!1===Ki(this))throw $i("getIterator");return function(t,i){void 0===i&&(i=!1);var n=K(t),r=k.create(st);return r.$d=n,r.ul=Boolean(i),r}(this,n)},t}();function zi(t,i,n,r,e){void 0===r&&(r=1),void 0===e&&(e=function(){return 1});var s=k.create(Hi.prototype);return Yi(s),wi(s,k.create(si.prototype),t,i,n,r,e),s}function Yi(t){t.Ra="readable",t.Gd=void 0,t.Xd=void 0,t.Qd=!1}function Ki(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Jd")}function ji(t){return void 0!==t.Gd}function Ji(t,i){return t.Qd=!0,"closed"===t.Ra?I(void 0):"errored"===t.Ra?R(t.Xd):(qi(t),x(t.Jd[z](i),e))}function qi(t){t.Ra="closed";var i=t.Gd;void 0!==i&&(nt(i)&&(i.qd.forEach(function(t){t.Yd(M(void 0,!0,i.Wd))}),i.qd=new L),H(i))}function Qi(t,i){t.Ra="errored",t.Xd=i;var n=t.Gd;void 0!==n&&(nt(n)?(n.qd.forEach(function(t){t.Kd(i)}),n.qd=new L):(n.Gf.forEach(function(t){t.Kd(i)}),n.Gf=new L),G(n,i))}function $i(t){return new p("ReadableStream.prototype."+t+" can only be used on a ReadableStream")}"symbol"===Z(n.asyncIterator)&&k.defineProperty(Hi.prototype,n.asyncIterator,{value:Hi.prototype.getIterator,enumerable:!1,writable:!0,configurable:!0});var tn=function(){function t(t){var i=t.highWaterMark;this.highWaterMark=i}return t.prototype.size=function(t){return t.byteLength},t}(),nn=function(){function t(t){var i=t.highWaterMark;this.highWaterMark=i}return t.prototype.size=function(){return 1},t}(),rn=function(){function t(t,i,n){void 0===t&&(t={}),void 0===i&&(i={}),void 0===n&&(n={});var r=i.size,e=i.highWaterMark,s=n.size,u=n.highWaterMark;if(void 0!==t.writableType)throw new RangeError("Invalid writable type specified");var o=g(r);if(void 0===e&&(e=1),e=w(e),void 0!==t.readableType)throw new RangeError("Invalid readable type specified");var h,c=g(s);void 0===u&&(u=0),u=w(u),function(t,i,n,r,e,s){function u(){return i}function o(i){return function(t,i){var n=t.Xf;return!0===t.lf?x(t.Zf,function(){var r=t.Hf;if("erroring"===r.Ra)throw r.Xd;return vn(n,i)}):vn(n,i)}(t,i)}function h(i){return function(t,i){return sn(t,i),I(void 0)}(t,i)}function c(){return function(t){var i=t.zf,n=t.Xf,r=n.Yf();return an(n),x(r,function(){if("errored"===i.Ra)throw i.Xd;var t=i.Jd;!0===li(t)&&ai(t)},function(n){throw sn(t,n),i.Xd})}(t)}function a(){return function(t){return on(t,!1),t.Zf}(t)}function f(i){return un(t,i),I(void 0)}t.Hf=function(t,i,n,r,e,s){void 0===e&&(e=1),void 0===s&&(s=function(){return 1});var u=k.create(lt.prototype);return gt(u),Lt(u,k.create(Bt.prototype),t,i,n,r,e,s),u}(u,o,c,h,n,r),t.zf=zi(u,a,f,e,s),t.lf=void 0,t.Zf=void 0,t.Kf=void 0,on(t,!0),t.Xf=void 0}(this,S(function(t){h=t}),e,o,u,c),function(t,i){var n=k.create(hn.prototype),r=function(t){try{return fn(n,t),I(void 0)}catch(t){return R(t)}},e=i.transform;if(void 0!==e){if("function"!=typeof e)throw new p("transform is not a method");r=function(t){return l(e,i,[t,n])}}var s=v(i,"flush",0,[n]);!function(t,i,n,r){i.qf=t,t.Xf=i,i.jf=n,i.Yf=r}(t,n,r,s)}(this,t);var a=d(t,"start",[this.Xf]);h(a)}return k.defineProperty(t.prototype,"readable",{get:function(){if(!1===en(this))throw ln("readable");return this.zf},enumerable:!0,configurable:!0}),k.defineProperty(t.prototype,"writable",{get:function(){if(!1===en(this))throw ln("writable");return this.Hf},enumerable:!0,configurable:!0}),t}();function en(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"Xf")}function sn(t,i){vi(t.zf.Jd,i),un(t,i)}function un(t,i){an(t.Xf),Ft(t.Hf.nf,i),!0===t.lf&&on(t,!1)}function on(t,i){void 0!==t.Zf&&t.Kf(),t.Zf=S(function(i){t.Kf=i}),t.lf=i}var hn=function(){function t(){throw new p("TransformStreamDefaultController instances cannot be created directly")}return k.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===cn(this))throw dn("desiredSize");return di(this.qf.zf.Jd)},enumerable:!0,configurable:!0}),t.prototype.enqueue=function(t){if(!1===cn(this))throw dn("enqueue");fn(this,t)},t.prototype.error=function(t){if(!1===cn(this))throw dn("error");!function(t,i){sn(t.qf,i)}(this,t)},t.prototype.terminate=function(){if(!1===cn(this))throw dn("terminate");!function(t){var i=t.qf,n=i.zf.Jd;!0===li(n)&&ai(n);var r=new p("TransformStream terminated");un(i,r)}(this)},t}();function cn(t){return!!o(t)&&!!k.prototype.hasOwnProperty.call(t,"qf")}function an(t){t.jf=void 0,t.Yf=void 0}function fn(t,i){var n=t.qf,r=n.zf.Jd;if(!1===li(r))throw new p("Readable side is not in a state that permits enqueue");try{fi(r,i)}catch(t){throw un(n,t),n.zf.Xd}var e=function(t){return!0!==hi(t)}(r);e!==n.lf&&on(n,!0)}function vn(t,i){return x(t.jf(i),void 0,function(i){throw sn(t.qf,i),i})}function dn(t){return new p("TransformStreamDefaultController.prototype."+t+" can only be used on a TransformStreamDefaultController")}function ln(t){return new p("TransformStream.prototype."+t+" can only be used on a TransformStream")}t.ByteLengthQueuingStrategy=tn,t.CountQueuingStrategy=nn,t.ReadableStream=Hi,t.TransformStream=rn,t.WritableStream=lt,k.defineProperty(t,"__esModule",{value:!0})},"object"===(void 0===t?"undefined":Z(t))&&void 0!==n?s(t):"function"==typeof define&&define.amd?define(["exports"],s):s((e=e||self).WebStreamsPolyfill={})}),Jt=M(function(t){function i(){var t=jt();return i=function(){return t},t}F(),Et(),k.defineProperty(t,"__esModule",{value:!0}),function(t,i){for(var n in i)k.defineProperty(t,n,{enumerable:!0,get:k.getOwnPropertyDescriptor(i,n).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}})});function qt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(qt=function(){return!!t})()}var Qt=L(function(){F(),Et()});function $t(t,i,n){return($t=qt()?Reflect.construct:function(t,i,n){var r=[null];r.push.apply(r,i);var e=new(Function.bind.apply(t,r));return n&&It(e,n.prototype),e}).apply(null,arguments)}var ti=L(function(){F(),Et(),Qt(),Rt()});function ii(t){return(ii=k.setPrototypeOf?k.getPrototypeOf:function(t){return t.__proto__||k.getPrototypeOf(t)})(t)}var ni=L(function(){F(),Et()});var ri=L(function(){F(),Et()});function ei(t){var i="function"==typeof Map?new Map:void 0;return ei=function(t){if(null===t||!function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}(t))return t;if("function"!=typeof t)throw new p("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,n)}function n(){return $t(t,arguments,ii(this).constructor)}return n.prototype=k.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),It(n,t)},ei(t)}var si,ui=L(function(){F(),Et(),ti(),ni(),ri(),Rt()}),oi=M(function(t,r){var e,s;F(),Et(),Zt(),xt(),Nt(),W(),at(),ui(),Vt(),Kt(),e=t,s=function(t){var r,e=k.defineProperty,s=k.defineProper