/** * @license * web-streams-polyfill v3.3.2 * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors. * This code is released under the MIT license. * SPDX-License-Identifier: MIT */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WebStreamsPolyfill={})}(this,(function(e){"use strict";const t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:e=>`Symbol(${e})`;function r(){}function o(e){return"object"==typeof e&&null!==e||"function"==typeof e}const n=r;function a(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const i=Promise,l=Promise.prototype.then,s=Promise.reject.bind(i);function u(e){return new i(e)}function c(e){return u((t=>t(e)))}function d(e){return s(e)}function f(e,t,r){return l.call(e,t,r)}function b(e,t,r){f(f(e,t,r),void 0,n)}function h(e,t){b(e,t)}function m(e,t){b(e,void 0,t)}function _(e,t,r){return f(e,t,r)}function p(e){f(e,void 0,n)}let y=e=>{if("function"==typeof queueMicrotask)y=queueMicrotask;else{const e=c(void 0);y=t=>f(e,t)}return y(e)};function S(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function g(e,t,r){try{return c(S(e,t,r))}catch(e){return d(e)}}class v{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let o=r+1;const n=e._elements,a=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,a}forEach(e){let t=this._cursor,r=this._front,o=r._elements;for(;!(t===o.length&&void 0===r._next||t===o.length&&(r=r._next,o=r._elements,t=0,0===o.length));)e(o[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const w=t("[[AbortSteps]]"),R=t("[[ErrorSteps]]"),T=t("[[CancelSteps]]"),C=t("[[PullSteps]]"),P=t("[[ReleaseSteps]]");function q(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?O(e):"closed"===t._state?function(e){O(e),A(e)}(e):j(e,t._storedError)}function E(e,t){return Br(e._ownerReadableStream,t)}function W(e){const t=e._ownerReadableStream;"readable"===t._state?k(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){j(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[P](),t._reader=void 0,e._ownerReadableStream=void 0}function B(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function O(e){e._closedPromise=u(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function j(e,t){O(e),k(e,t)}function k(e,t){void 0!==e._closedPromise_reject&&(p(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function A(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const D=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},z=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function I(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(`${t} is not an object.`);var r}function L(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function F(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function $(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function M(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Y(e){return Number(e)}function x(e){return 0===e?0:e}function Q(e,t){const r=Number.MAX_SAFE_INTEGER;let o=Number(e);if(o=x(o),!D(o))throw new TypeError(`${t} is not a finite number`);if(o=function(e){return x(z(e))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return D(o)&&0!==o?o:0}function N(e,t){if(!Er(e))throw new TypeError(`${t} is not a ReadableStream.`)}function H(e){return new ReadableStreamDefaultReader(e)}function V(e,t){e._reader._readRequests.push(t)}function U(e,t,r){const o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function G(e){return e._reader._readRequests.length}function X(e){const t=e._reader;return void 0!==t&&!!J(t)}class ReadableStreamDefaultReader{constructor(e){if($(e,1,"ReadableStreamDefaultReader"),N(e,"First parameter"),Wr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");q(this,e),this._readRequests=new v}get closed(){return J(this)?this._closedPromise:d(ee("closed"))}cancel(e=void 0){return J(this)?void 0===this._ownerReadableStream?d(B("cancel")):E(this,e):d(ee("cancel"))}read(){if(!J(this))return d(ee("read"));if(void 0===this._ownerReadableStream)return d(B("read from"));let e,t;const r=u(((r,o)=>{e=r,t=o}));return K(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!J(this))throw ee("releaseLock");void 0!==this._ownerReadableStream&&function(e){W(e);const t=new TypeError("Reader was released");Z(e,t)}(this)}}function J(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof ReadableStreamDefaultReader)}function K(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[C](t)}function Z(e,t){const r=e._readRequests;e._readRequests=new v,r.forEach((e=>{e._errorSteps(t)}))}function ee(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}let te;Object.defineProperties(ReadableStreamDefaultReader.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),a(ReadableStreamDefaultReader.prototype.cancel,"cancel"),a(ReadableStreamDefaultReader.prototype.read,"read"),a(ReadableStreamDefaultReader.prototype.releaseLock,"releaseLock"),"symbol"==typeof t.toStringTag&&Object.defineProperty(ReadableStreamDefaultReader.prototype,t.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),"symbol"==typeof t.asyncIterator&&(te={[t.asyncIterator](){return this}},Object.defineProperty(te,t.asyncIterator,{enumerable:!1}));class re{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?_(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?_(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const o=u(((e,o)=>{t=e,r=o}));return K(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,y((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,W(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,W(e),r(t)}}),o}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=E(t,e);return W(t),_(r,(()=>({value:e,done:!0})))}return W(t),c({value:e,done:!0})}}const oe={next(){return ne(this)?this._asyncIteratorImpl.next():d(ae("next"))},return(e){return ne(this)?this._asyncIteratorImpl.return(e):d(ae("return"))}};function ne(e){if(!o(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof re}catch(e){return!1}}function ae(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}void 0!==te&&Object.setPrototypeOf(oe,te);const ie=Number.isNaN||function(e){return e!=e};function le(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function se(e){return this instanceof se?(this.v=e,this):new se(e)}function ue(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,n=r.apply(e,t||[]),a=[];return o={},i("next"),i("throw"),i("return"),o[Symbol.asyncIterator]=function(){return this},o;function i(e){n[e]&&(o[e]=function(t){return new Promise((function(r,o){a.push([e,t,r,o])>1||l(e,t)}))})}function l(e,t){try{(r=n[e](t)).value instanceof se?Promise.resolve(r.value.v).then(s,u):c(a[0][2],r)}catch(e){c(a[0][3],e)}var r}function s(e){l("next",e)}function u(e){l("throw",e)}function c(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}function ce(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=le(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(r){t[r]=e[r]&&function(t){return new Promise((function(o,n){(function(e,t,r,o){Promise.resolve(o).then((function(t){e({value:t,done:r})}),t)})(o,n,(t=e[r](t)).done,t.value)}))}}}function de(e){return e.slice()}function fe(e,t,r,o,n){new Uint8Array(e).set(new Uint8Array(r,o,n),t)}"function"==typeof SuppressedError&&SuppressedError;let be=e=>(be="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,be(e)),he=e=>(he="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,he(e));function me(e,t,r){if(e.slice)return e.slice(t,r);const o=r-t,n=new ArrayBuffer(o);return fe(n,0,e,t,o),n}function _e(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(`${String(t)} is not a function`);return r}}function pe(e){const r={[t.iterator]:()=>e.iterator},o=function(){return ue(this,arguments,(function*(){return yield se(yield se(yield*function(e){var t,r;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,n){t[o]=e[o]?function(t){return(r=!r)?{value:se(e[o](t)),done:!1}:n?n(t):t}:n}}(ce(r))))}))}();return{iterator:o,nextMethod:o.next,done:!1}}function ye(e,r="sync",n){if(void 0===n)if("async"===r){if(void 0===(n=_e(e,t.asyncIterator))){return pe(ye(e,"sync",_e(e,t.iterator)))}}else n=_e(e,t.iterator);if(void 0===n)throw new TypeError("The object is not iterable");const a=S(n,e,[]);if(!o(a))throw new TypeError("The iterator method must return an object");return{iterator:a,nextMethod:a.next,done:!1}}function Se(e){const t=me(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function ge(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function ve(e,t,r){if("number"!=typeof(o=r)||ie(o)||o<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var o;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function we(e){e._queue=new v,e._queueTotalSize=0}function Re(e){return e===DataView}class ReadableStreamBYOBRequest{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Ce(this))throw Je("view");return this._view}respond(e){if(!Ce(this))throw Je("respond");if($(e,1,"respond"),e=Q(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(he(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Ue(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!Ce(this))throw Je("respondWithNewView");if($(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(he(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Ge(this._associatedReadableByteStreamController,e)}}Object.defineProperties(ReadableStreamBYOBRequest.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),a(ReadableStreamBYOBRequest.prototype.respond,"respond"),a(ReadableStreamBYOBRequest.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof t.toStringTag&&Object.defineProperty(ReadableStreamBYOBRequest.prototype,t.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class ReadableByteStreamController{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Te(this))throw Ke("byobRequest");return He(this)}get desiredSize(){if(!Te(this))throw Ke("desiredSize");return Ve(this)}close(){if(!Te(this))throw Ke("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);Ye(this)}enqueue(e){if(!Te(this))throw Ke("enqueue");if($(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);xe(this,e)}error(e=void 0){if(!Te(this))throw Ke("error");Qe(this,e)}[T](e){qe(this),we(this);const t=this._cancelAlgorithm(e);return Me(this),t}[C](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Ne(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let t;try{t=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:t,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}V(t,e),Pe(this)}[P](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new v,this._pendingPullIntos.push(e)}}}function Te(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof ReadableByteStreamController)}function Ce(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof ReadableStreamBYOBRequest)}function Pe(e){const t=function(e){const t=e._controlledReadableByteStream;if("readable"!==t._state)return!1;if(e._closeRequested)return!1;if(!e._started)return!1;if(X(t)&&G(t)>0)return!0;if(ot(t)&&rt(t)>0)return!0;const r=Ve(e);if(r>0)return!0;return!1}(e);if(!t)return;if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0;b(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Pe(e)),null)),(t=>(Qe(e,t),null)))}function qe(e){ze(e),e._pendingPullIntos=new v}function Ee(e,t){let r=!1;"closed"===e._state&&(r=!0);const o=We(t);"default"===t.readerType?U(e,o,r):function(e,t,r){const o=e._reader,n=o._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,o,r)}function We(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Be(e,t,r,o){e._queue.push({buffer:t,byteOffset:r,byteLength:o}),e._queueTotalSize+=o}function Oe(e,t,r,o){let n;try{n=me(t,r,r+o)}catch(t){throw Qe(e,t),t}Be(e,n,0,o)}function je(e,t){t.bytesFilled>0&&Oe(e,t.buffer,t.byteOffset,t.bytesFilled),$e(e)}function ke(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),o=t.bytesFilled+r;let n=r,a=!1;const i=o-o%t.elementSize;i>=t.minimumFill&&(n=i-t.bytesFilled,a=!0);const l=e._queue;for(;n>0;){const r=l.peek(),o=Math.min(n,r.byteLength),a=t.byteOffset+t.bytesFilled;fe(t.buffer,a,r.buffer,r.byteOffset,o),r.byteLength===o?l.shift():(r.byteOffset+=o,r.byteLength-=o),e._queueTotalSize-=o,Ae(e,o,t),n-=o}return a}function Ae(e,t,r){r.bytesFilled+=t}function De(e){0===e._queueTotalSize&&e._closeRequested?(Me(e),Or(e._controlledReadableByteStream)):Pe(e)}function ze(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Ie(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();ke(e,t)&&($e(e),Ee(e._controlledReadableByteStream,t))}}function Le(e,t,r,o){const n=e._controlledReadableByteStream,a=t.constructor,i=function(e){return Re(e)?1:e.BYTES_PER_ELEMENT}(a),{byteOffset:l,byteLength:s}=t,u=r*i;let c;try{c=be(t.buffer)}catch(e){return void o._errorSteps(e)}const d={buffer:c,bufferByteLength:c.byteLength,byteOffset:l,byteLength:s,bytesFilled:0,minimumFill:u,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(d),void tt(n,o);if("closed"!==n._state){if(e._queueTotalSize>0){if(ke(e,d)){const t=We(d);return De(e),void o._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Qe(e,t),void o._errorSteps(t)}}e._pendingPullIntos.push(d),tt(n,o),Pe(e)}else{const e=new a(d.buffer,d.byteOffset,0);o._closeSteps(e)}}function Fe(e,t){const r=e._pendingPullIntos.peek();ze(e);"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&$e(e);const r=e._controlledReadableByteStream;if(ot(r))for(;rt(r)>0;)Ee(r,$e(e))}(e,r):function(e,t,r){if(Ae(0,t,r),"none"===r.readerType)return je(e,r),void Ie(e);if(r.bytesFilled0){const t=r.byteOffset+r.bytesFilled;Oe(e,r.buffer,t-o,o)}r.bytesFilled-=o,Ee(e._controlledReadableByteStream,r),Ie(e)}(e,t,r),Pe(e)}function $e(e){return e._pendingPullIntos.shift()}function Me(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Ye(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Qe(e,t),t}}Me(e),Or(t)}}function xe(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:o,byteOffset:n,byteLength:a}=t;if(he(o))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const i=be(o);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(he(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");ze(e),t.buffer=be(t.buffer),"none"===t.readerType&&je(e,t)}if(X(r))if(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Ne(e,t._readRequests.shift())}}(e),0===G(r))Be(e,i,n,a);else{e._pendingPullIntos.length>0&&$e(e);U(r,new Uint8Array(i,n,a),!1)}else ot(r)?(Be(e,i,n,a),Ie(e)):Be(e,i,n,a);Pe(e)}function Qe(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(qe(e),we(e),Me(e),jr(r,t))}function Ne(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,De(e);const o=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(o)}function He(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),o=Object.create(ReadableStreamBYOBRequest.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(o,e,r),e._byobRequest=o}return e._byobRequest}function Ve(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ue(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=be(r.buffer),Fe(e,t)}function Ge(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const o=t.byteLength;r.buffer=be(t.buffer),Fe(e,o)}function Xe(e,t,r,o,n,a,i){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,we(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=o,t._cancelAlgorithm=n,t._autoAllocateChunkSize=i,t._pendingPullIntos=new v,e._readableStreamController=t;b(c(r()),(()=>(t._started=!0,Pe(t),null)),(e=>(Qe(t,e),null)))}function Je(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Ke(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Ze(e,t){if("byob"!==(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function et(e){return new ReadableStreamBYOBReader(e)}function tt(e,t){e._reader._readIntoRequests.push(t)}function rt(e){return e._reader._readIntoRequests.length}function ot(e){const t=e._reader;return void 0!==t&&!!nt(t)}Object.defineProperties(ReadableByteStreamController.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),a(ReadableByteStreamController.prototype.close,"close"),a(ReadableByteStreamController.prototype.enqueue,"enqueue"),a(ReadableByteStreamController.prototype.error,"error"),"symbol"==typeof t.toStringTag&&Object.defineProperty(ReadableByteStreamController.prototype,t.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class ReadableStreamBYOBReader{constructor(e){if($(e,1,"ReadableStreamBYOBReader"),N(e,"First parameter"),Wr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Te(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");q(this,e),this._readIntoRequests=new v}get closed(){return nt(this)?this._closedPromise:d(lt("closed"))}cancel(e=void 0){return nt(this)?void 0===this._ownerReadableStream?d(B("cancel")):E(this,e):d(lt("cancel"))}read(e,t={}){if(!nt(this))return d(lt("read"));if(!ArrayBuffer.isView(e))return d(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return d(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return d(new TypeError("view's buffer must have non-zero byteLength"));if(he(e.buffer))return d(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return I(e,t),{min:Q(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return d(e)}const o=r.min;if(0===o)return d(new TypeError("options.min must be greater than 0"));if(function(e){return Re(e.constructor)}(e)){if(o>e.byteLength)return d(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(o>e.length)return d(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return d(B("read from"));let n,a;const i=u(((e,t)=>{n=e,a=t}));return at(this,e,o,{_chunkSteps:e=>n({value:e,done:!1}),_closeSteps:e=>n({value:e,done:!0}),_errorSteps:e=>a(e)}),i}releaseLock(){if(!nt(this))throw lt("releaseLock");void 0!==this._ownerReadableStream&&function(e){W(e);const t=new TypeError("Reader was released");it(e,t)}(this)}}function nt(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof ReadableStreamBYOBReader)}function at(e,t,r,o){const n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?o._errorSteps(n._storedError):Le(n._readableStreamController,t,r,o)}function it(e,t){const r=e._readIntoRequests;e._readIntoRequests=new v,r.forEach((e=>{e._errorSteps(t)}))}function lt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function st(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(ie(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function ut(e){const{size:t}=e;return t||(()=>1)}function ct(e,t){I(e,t);const r=null==e?void 0:e.highWaterMark,o=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Y(r),size:void 0===o?void 0:dt(o,`${t} has member 'size' that`)}}function dt(e,t){return L(e,t),t=>Y(e(t))}function ft(e,t,r){return L(e,r),r=>g(e,t,[r])}function bt(e,t,r){return L(e,r),()=>g(e,t,[])}function ht(e,t,r){return L(e,r),r=>S(e,t,[r])}function mt(e,t,r){return L(e,r),(r,o)=>g(e,t,[r,o])}function _t(e,t){if(!gt(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(ReadableStreamBYOBReader.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),a(ReadableStreamBYOBReader.prototype.cancel,"cancel"),a(ReadableStreamBYOBReader.prototype.read,"read"),a(ReadableStreamBYOBReader.prototype.releaseLock,"releaseLock"),"symbol"==typeof t.toStringTag&&Object.defineProperty(ReadableStreamBYOBReader.prototype,t.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const pt="function"==typeof AbortController;class WritableStream{constructor(e={},t={}){void 0===e?e=null:F(e,"First parameter");const r=ct(t,"Second parameter"),o=function(e,t){I(e,t);const r=null==e?void 0:e.abort,o=null==e?void 0:e.close,n=null==e?void 0:e.start,a=null==e?void 0:e.type,i=null==e?void 0:e.write;return{abort:void 0===r?void 0:ft(r,e,`${t} has member 'abort' that`),close:void 0===o?void 0:bt(o,e,`${t} has member 'close' that`),start:void 0===n?void 0:ht(n,e,`${t} has member 'start' that`),write:void 0===i?void 0:mt(i,e,`${t} has member 'write' that`),type:a}}(e,"First parameter");St(this);if(void 0!==o.type)throw new RangeError("Invalid type is specified");const n=ut(r);!function(e,t,r,o){const n=Object.create(WritableStreamDefaultController.prototype);let a,i,l,s;a=void 0!==t.start?()=>t.start(n):()=>{};i=void 0!==t.write?e=>t.write(e,n):()=>c(void 0);l=void 0!==t.close?()=>t.close():()=>c(void 0);s=void 0!==t.abort?e=>t.abort(e):()=>c(void 0);Lt(e,n,a,i,l,s,r,o)}(this,o,st(r,1),n)}get locked(){if(!gt(this))throw Nt("locked");return vt(this)}abort(e=void 0){return gt(this)?vt(this)?d(new TypeError("Cannot abort a stream that already has a writer")):wt(this,e):d(Nt("abort"))}close(){return gt(this)?vt(this)?d(new TypeError("Cannot close a stream that already has a writer")):qt(this)?d(new TypeError("Cannot close an already-closing stream")):Rt(this):d(Nt("close"))}getWriter(){if(!gt(this))throw Nt("getWriter");return yt(this)}}function yt(e){return new WritableStreamDefaultWriter(e)}function St(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new v,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function gt(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof WritableStream)}function vt(e){return void 0!==e._writer}function wt(e,t){var r;if("closed"===e._state||"errored"===e._state)return c(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const o=e._state;if("closed"===o||"errored"===o)return c(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let n=!1;"erroring"===o&&(n=!0,t=void 0);const a=u(((r,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:o,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=a,n||Ct(e,t),a}function Rt(e){const t=e._state;if("closed"===t||"errored"===t)return d(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=u(((t,r)=>{const o={_resolve:t,_reject:r};e._closeRequest=o})),o=e._writer;var n;return void 0!==o&&e._backpressure&&"writable"===t&&or(o),ve(n=e._writableStreamController,zt,0),Mt(n),r}function Tt(e,t){"writable"!==e._state?Pt(e):Ct(e,t)}function Ct(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const o=e._writer;void 0!==o&&kt(o,t),!function(e){if(void 0===e._inFlightWriteRequest&&void 0===e._inFlightCloseRequest)return!1;return!0}(e)&&r._started&&Pt(e)}function Pt(e){e._state="errored",e._writableStreamController[R]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new v,void 0===e._pendingAbortRequest)return void Et(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Et(e);b(e._writableStreamController[w](r._reason),(()=>(r._resolve(),Et(e),null)),(t=>(r._reject(t),Et(e),null)))}function qt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Et(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Jt(t,e._storedError)}function Wt(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Zt(e)}(r):or(r)),e._backpressure=t}Object.defineProperties(WritableStream.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),a(WritableStream.prototype.abort,"abort"),a(WritableStream.prototype.close,"close"),a(WritableStream.prototype.getWriter,"getWriter"),"symbol"==typeof t.toStringTag&&Object.defineProperty(WritableStream.prototype,t.toStringTag,{value:"WritableStream",configurable:!0});class WritableStreamDefaultWriter{constructor(e){if($(e,1,"WritableStreamDefaultWriter"),_t(e,"First parameter"),vt(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!qt(e)&&e._backpressure?Zt(this):tr(this),Gt(this);else if("erroring"===t)er(this,e._storedError),Gt(this);else if("closed"===t)tr(this),Gt(r=this),Kt(r);else{const t=e._storedError;er(this,t),Xt(this,t)}var r}get closed(){return Bt(this)?this._closedPromise:d(Vt("closed"))}get desiredSize(){if(!Bt(this))throw Vt("desiredSize");if(void 0===this._ownerWritableStream)throw Ut("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return $t(t._writableStreamController)}(this)}get ready(){return Bt(this)?this._readyPromise:d(Vt("ready"))}abort(e=void 0){return Bt(this)?void 0===this._ownerWritableStream?d(Ut("abort")):function(e,t){return wt(e._ownerWritableStream,t)}(this,e):d(Vt("abort"))}close(){if(!Bt(this))return d(Vt("close"));const e=this._ownerWritableStream;return void 0===e?d(Ut("close")):qt(e)?d(new TypeError("Cannot close an already-closing stream")):Ot(this)}releaseLock(){if(!Bt(this))throw Vt("releaseLock");void 0!==this._ownerWritableStream&&At(this)}write(e=void 0){return Bt(this)?void 0===this._ownerWritableStream?d(Ut("write to")):Dt(this,e):d(Vt("write"))}}function Bt(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof WritableStreamDefaultWriter)}function Ot(e){return Rt(e._ownerWritableStream)}function jt(e,t){"pending"===e._closedPromiseState?Jt(e,t):function(e,t){Xt(e,t)}(e,t)}function kt(e,t){"pending"===e._readyPromiseState?rr(e,t):function(e,t){er(e,t)}(e,t)}function At(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");kt(e,r),jt(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Dt(e,t){const r=e._ownerWritableStream,o=r._writableStreamController,n=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Yt(e,t),1}}(o,t);if(r!==e._ownerWritableStream)return d(Ut("write to"));const a=r._state;if("errored"===a)return d(r._storedError);if(qt(r)||"closed"===a)return d(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return d(r._storedError);const i=function(e){return u(((t,r)=>{const o={_resolve:t,_reject:r};e._writeRequests.push(o)}))}(r);return function(e,t,r){try{ve(e,t,r)}catch(t){return void Yt(e,t)}const o=e._controlledWritableStream;if(!qt(o)&&"writable"===o._state){Wt(o,xt(e))}Mt(e)}(o,t,n),i}Object.defineProperties(WritableStreamDefaultWriter.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),a(WritableStreamDefaultWriter.prototype.abort,"abort"),a(WritableStreamDefaultWriter.prototype.close,"close"),a(WritableStreamDefaultWriter.prototype.releaseLock,"releaseLock"),a(WritableStreamDefaultWriter.prototype.write,"write"),"symbol"==typeof t.toStringTag&&Object.defineProperty(WritableStreamDefaultWriter.prototype,t.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const zt={};class WritableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!It(this))throw Ht("abortReason");return this._abortReason}get signal(){if(!It(this))throw Ht("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!It(this))throw Ht("error");"writable"===this._controlledWritableStream._state&&Qt(this,e)}[w](e){const t=this._abortAlgorithm(e);return Ft(this),t}[R](){we(this)}}function It(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof WritableStreamDefaultController)}function Lt(e,t,r,o,n,a,i,l){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,we(t),t._abortReason=void 0,t._abortController=function(){if(pt)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=l,t._strategyHWM=i,t._writeAlgorithm=o,t._closeAlgorithm=n,t._abortAlgorithm=a;const s=xt(t);Wt(e,s);b(c(r()),(()=>(t._started=!0,Mt(t),null)),(r=>(t._started=!0,Tt(e,r),null)))}function Ft(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function $t(e){return e._strategyHWM-e._queueTotalSize}function Mt(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void Pt(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===zt?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),ge(e);const r=e._closeAlgorithm();Ft(e),b(r,(()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&Kt(t)}(t),null)),(e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),Tt(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r);const o=e._writeAlgorithm(t);b(o,(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(ge(e),!qt(r)&&"writable"===t){const t=xt(e);Wt(r,t)}return Mt(e),null}),(t=>("writable"===r._state&&Ft(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,Tt(e,t)}(r,t),null)))}(e,r)}function Yt(e,t){"writable"===e._controlledWritableStream._state&&Qt(e,t)}function xt(e){return $t(e)<=0}function Qt(e,t){const r=e._controlledWritableStream;Ft(e),Ct(r,t)}function Nt(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Ht(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function Vt(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Ut(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Gt(e){e._closedPromise=u(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function Xt(e,t){Gt(e),Jt(e,t)}function Jt(e,t){void 0!==e._closedPromise_reject&&(p(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Kt(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Zt(e){e._readyPromise=u(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function er(e,t){Zt(e),rr(e,t)}function tr(e){Zt(e),or(e)}function rr(e,t){void 0!==e._readyPromise_reject&&(p(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function or(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(WritableStreamDefaultController.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(WritableStreamDefaultController.prototype,t.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const nr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0;const ar=function(){const e=null==nr?void 0:nr.DOMException;return function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;if("DOMException"!==e.name)return!1;try{return new e,!0}catch(e){return!1}}(e)?e:void 0}()||function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return a(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function ir(e,t,o,n,a,i){const l=H(e),s=yt(t);e._disturbed=!0;let _=!1,y=c(void 0);return u(((S,g)=>{let v;if(void 0!==i){if(v=()=>{const r=void 0!==i.reason?i.reason:new ar("Aborted","AbortError"),o=[];n||o.push((()=>"writable"===t._state?wt(t,r):c(void 0))),a||o.push((()=>"readable"===e._state?Br(e,r):c(void 0))),q((()=>Promise.all(o.map((e=>e())))),!0,r)},i.aborted)return void v();i.addEventListener("abort",v)}var w,R,T;if(P(e,l._closedPromise,(e=>(n?E(!0,e):q((()=>wt(t,e)),!0,e),null))),P(t,s._closedPromise,(t=>(a?E(!0,t):q((()=>Br(e,t)),!0,t),null))),w=e,R=l._closedPromise,T=()=>(o?E():q((()=>function(e){const t=e._ownerWritableStream,r=t._state;return qt(t)||"closed"===r?c(void 0):"errored"===r?d(t._storedError):Ot(e)}(s))),null),"closed"===w._state?T():h(R,T),qt(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");a?E(!0,t):q((()=>Br(e,t)),!0,t)}function C(){const e=y;return f(y,(()=>e!==y?C():void 0))}function P(e,t,r){"errored"===e._state?r(e._storedError):m(t,r)}function q(e,r,o){function n(){return b(e(),(()=>B(r,o)),(e=>B(!0,e))),null}_||(_=!0,"writable"!==t._state||qt(t)?n():h(C(),n))}function E(e,r){_||(_=!0,"writable"!==t._state||qt(t)?B(e,r):h(C(),(()=>B(e,r))))}function B(e,t){return At(s),W(l),void 0!==i&&i.removeEventListener("abort",v),e?g(t):S(void 0),null}p(u(((e,t)=>{!function o(n){n?e():f(_?c(!0):f(s._readyPromise,(()=>u(((e,t)=>{K(l,{_chunkSteps:t=>{y=f(Dt(s,t),void 0,r),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),o,t)}(!1)})))}))}class ReadableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!lr(this))throw pr("desiredSize");return hr(this)}close(){if(!lr(this))throw pr("close");if(!mr(this))throw new TypeError("The stream is not in a state that permits close");dr(this)}enqueue(e=void 0){if(!lr(this))throw pr("enqueue");if(!mr(this))throw new TypeError("The stream is not in a state that permits enqueue");return fr(this,e)}error(e=void 0){if(!lr(this))throw pr("error");br(this,e)}[T](e){we(this);const t=this._cancelAlgorithm(e);return cr(this),t}[C](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=ge(this);this._closeRequested&&0===this._queue.length?(cr(this),Or(t)):sr(this),e._chunkSteps(r)}else V(t,e),sr(this)}[P](){}}function lr(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof ReadableStreamDefaultController)}function sr(e){if(!ur(e))return;if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0;b(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,sr(e)),null)),(t=>(br(e,t),null)))}function ur(e){const t=e._controlledReadableStream;if(!mr(e))return!1;if(!e._started)return!1;if(Wr(t)&&G(t)>0)return!0;return hr(e)>0}function cr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function dr(e){if(!mr(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(cr(e),Or(t))}function fr(e,t){if(!mr(e))return;const r=e._controlledReadableStream;if(Wr(r)&&G(r)>0)U(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw br(e,t),t}try{ve(e,t,r)}catch(t){throw br(e,t),t}}sr(e)}function br(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(we(e),cr(e),jr(r,t))}function hr(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function mr(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function _r(e,t,r,o,n,a,i){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,we(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=i,t._strategyHWM=a,t._pullAlgorithm=o,t._cancelAlgorithm=n,e._readableStreamController=t;b(c(r()),(()=>(t._started=!0,sr(t),null)),(e=>(br(t,e),null)))}function pr(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function yr(e,t){return Te(e._readableStreamController)?function(e){let t,r,o,n,a,i=H(e),l=!1,s=!1,d=!1,f=!1,b=!1;const h=u((e=>{a=e}));function _(e){m(e._closedPromise,(t=>(e!==i||(Qe(o._readableStreamController,t),Qe(n._readableStreamController,t),f&&b||a(void 0)),null)))}function p(){nt(i)&&(W(i),i=H(e),_(i));K(i,{_chunkSteps:t=>{y((()=>{s=!1,d=!1;const r=t;let i=t;if(!f&&!b)try{i=Se(t)}catch(t){return Qe(o._readableStreamController,t),Qe(n._readableStreamController,t),void a(Br(e,t))}f||xe(o._readableStreamController,r),b||xe(n._readableStreamController,i),l=!1,s?g():d&&v()}))},_closeSteps:()=>{l=!1,f||Ye(o._readableStreamController),b||Ye(n._readableStreamController),o._readableStreamController._pendingPullIntos.length>0&&Ue(o._readableStreamController,0),n._readableStreamController._pendingPullIntos.length>0&&Ue(n._readableStreamController,0),f&&b||a(void 0)},_errorSteps:()=>{l=!1}})}function S(t,r){J(i)&&(W(i),i=et(e),_(i));const u=r?n:o,c=r?o:n;at(i,t,1,{_chunkSteps:t=>{y((()=>{s=!1,d=!1;const o=r?b:f;if(r?f:b)o||Ge(u._readableStreamController,t);else{let r;try{r=Se(t)}catch(t){return Qe(u._readableStreamController,t),Qe(c._readableStreamController,t),void a(Br(e,t))}o||Ge(u._readableStreamController,t),xe(c._readableStreamController,r)}l=!1,s?g():d&&v()}))},_closeSteps:e=>{l=!1;const t=r?b:f,o=r?f:b;t||Ye(u._readableStreamController),o||Ye(c._readableStreamController),void 0!==e&&(t||Ge(u._readableStreamController,e),!o&&c._readableStreamController._pendingPullIntos.length>0&&Ue(c._readableStreamController,0)),t&&o||a(void 0)},_errorSteps:()=>{l=!1}})}function g(){if(l)return s=!0,c(void 0);l=!0;const e=He(o._readableStreamController);return null===e?p():S(e._view,!1),c(void 0)}function v(){if(l)return d=!0,c(void 0);l=!0;const e=He(n._readableStreamController);return null===e?p():S(e._view,!0),c(void 0)}function w(o){if(f=!0,t=o,b){const o=de([t,r]),n=Br(e,o);a(n)}return h}function R(o){if(b=!0,r=o,f){const o=de([t,r]),n=Br(e,o);a(n)}return h}function T(){}return o=Pr(T,g,w),n=Pr(T,v,R),_(i),[o,n]}(e):function(e,t){const r=H(e);let o,n,a,i,l,s=!1,d=!1,f=!1,b=!1;const h=u((e=>{l=e}));function _(){if(s)return d=!0,c(void 0);s=!0;return K(r,{_chunkSteps:e=>{y((()=>{d=!1;const t=e,r=e;f||fr(a._readableStreamController,t),b||fr(i._readableStreamController,r),s=!1,d&&_()}))},_closeSteps:()=>{s=!1,f||dr(a._readableStreamController),b||dr(i._readableStreamController),f&&b||l(void 0)},_errorSteps:()=>{s=!1}}),c(void 0)}function p(t){if(f=!0,o=t,b){const t=de([o,n]),r=Br(e,t);l(r)}return h}function S(t){if(b=!0,n=t,f){const t=de([o,n]),r=Br(e,t);l(r)}return h}function g(){}return a=Cr(g,_,p),i=Cr(g,_,S),m(r._closedPromise,(e=>(br(a._readableStreamController,e),br(i._readableStreamController,e),f&&b||l(void 0),null))),[a,i]}(e)}function Sr(e){return o(t=e)&&void 0!==t.getReader?function(e){let t;function n(){let r;try{r=e.read()}catch(e){return d(e)}return _(r,(e=>{if(!o(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)dr(t._readableStreamController);else{const r=e.value;fr(t._readableStreamController,r)}}))}function a(t){try{return c(e.cancel(t))}catch(e){return d(e)}}return t=Cr(r,n,a,0),t}(e.getReader()):function(e){let t;const n=ye(e,"async");function a(){let e;try{e=function(e){const t=S(e.nextMethod,e.iterator,[]);if(!o(t))throw new TypeError("The iterator.next() method must return an object");return t}(n)}catch(e){return d(e)}return _(c(e),(e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");const r=function(e){return Boolean(e.done)}(e);if(r)dr(t._readableStreamController);else{const r=function(e){return e.value}(e);fr(t._readableStreamController,r)}}))}function i(e){const t=n.iterator;let r,a;try{r=_e(t,"return")}catch(e){return d(e)}if(void 0===r)return c(void 0);try{a=S(r,t,[e])}catch(e){return d(e)}return _(c(a),(e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}))}return t=Cr(r,a,i,0),t}(e);var t}function gr(e,t,r){return L(e,r),r=>g(e,t,[r])}function vr(e,t,r){return L(e,r),r=>g(e,t,[r])}function wr(e,t,r){return L(e,r),r=>S(e,t,[r])}function Rr(e,t){if("bytes"!==(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function Tr(e,t){I(e,t);const r=null==e?void 0:e.preventAbort,o=null==e?void 0:e.preventCancel,n=null==e?void 0:e.preventClose,a=null==e?void 0:e.signal;return void 0!==a&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(`${t} is not an AbortSignal.`)}(a,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(o),preventClose:Boolean(n),signal:a}}Object.defineProperties(ReadableStreamDefaultController.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),a(ReadableStreamDefaultController.prototype.close,"close"),a(ReadableStreamDefaultController.prototype.enqueue,"enqueue"),a(ReadableStreamDefaultController.prototype.error,"error"),"symbol"==typeof t.toStringTag&&Object.defineProperty(ReadableStreamDefaultController.prototype,t.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class ReadableStream{constructor(e={},t={}){void 0===e?e=null:F(e,"First parameter");const r=ct(t,"Second parameter"),o=function(e,t){I(e,t);const r=e,o=null==r?void 0:r.autoAllocateChunkSize,n=null==r?void 0:r.cancel,a=null==r?void 0:r.pull,i=null==r?void 0:r.start,l=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===o?void 0:Q(o,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===n?void 0:gr(n,r,`${t} has member 'cancel' that`),pull:void 0===a?void 0:vr(a,r,`${t} has member 'pull' that`),start:void 0===i?void 0:wr(i,r,`${t} has member 'start' that`),type:void 0===l?void 0:Rr(l,`${t} has member 'type' that`)}}(e,"First parameter");if(qr(this),"bytes"===o.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const o=Object.create(ReadableByteStreamController.prototype);let n,a,i;n=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.pull?()=>t.pull(o):()=>c(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>c(void 0);const l=t.autoAllocateChunkSize;if(0===l)throw new TypeError("autoAllocateChunkSize must be greater than 0");Xe(e,o,n,a,i,r,l)}(this,o,st(r,0))}else{const e=ut(r);!function(e,t,r,o){const n=Object.create(ReadableStreamDefaultController.prototype);let a,i,l;a=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>c(void 0),l=void 0!==t.cancel?e=>t.cancel(e):()=>c(void 0),_r(e,n,a,i,l,r,o)}(this,o,st(r,1),e)}}get locked(){if(!Er(this))throw kr("locked");return Wr(this)}cancel(e=void 0){return Er(this)?Wr(this)?d(new TypeError("Cannot cancel a stream that already has a reader")):Br(this,e):d(kr("cancel"))}getReader(e=void 0){if(!Er(this))throw kr("getReader");return void 0===function(e,t){I(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Ze(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?H(this):et(this)}pipeThrough(e,t={}){if(!Er(this))throw kr("pipeThrough");$(e,1,"pipeThrough");const r=function(e,t){I(e,t);const r=null==e?void 0:e.readable;M(r,"readable","ReadableWritablePair"),N(r,`${t} has member 'readable' that`);const o=null==e?void 0:e.writable;return M(o,"writable","ReadableWritablePair"),_t(o,`${t} has member 'writable' that`),{readable:r,writable:o}}(e,"First parameter"),o=Tr(t,"Second parameter");if(Wr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(vt(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return p(ir(this,r.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal)),r.readable}pipeTo(e,t={}){if(!Er(this))return d(kr("pipeTo"));if(void 0===e)return d("Parameter 1 is required in 'pipeTo'.");if(!gt(e))return d(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=Tr(t,"Second parameter")}catch(e){return d(e)}return Wr(this)?d(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):vt(e)?d(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ir(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!Er(this))throw kr("tee");return de(yr(this))}values(e=void 0){if(!Er(this))throw kr("values");return function(e,t){const r=H(e),o=new re(r,t),n=Object.create(oe);return n._asyncIteratorImpl=o,n}(this,function(e,t){I(e,t);const r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e,"First parameter").preventCancel)}static from(e){return Sr(e)}}function Cr(e,t,r,o=1,n=(()=>1)){const a=Object.create(ReadableStream.prototype);qr(a);return _r(a,Object.create(ReadableStreamDefaultController.prototype),e,t,r,o,n),a}function Pr(e,t,r){const o=Object.create(ReadableStream.prototype);qr(o);return Xe(o,Object.create(ReadableByteStreamController.prototype),e,t,r,0,void 0),o}function qr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Er(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof ReadableStream)}function Wr(e){return void 0!==e._reader}function Br(e,t){if(e._disturbed=!0,"closed"===e._state)return c(void 0);if("errored"===e._state)return d(e._storedError);Or(e);const o=e._reader;if(void 0!==o&&nt(o)){const e=o._readIntoRequests;o._readIntoRequests=new v,e.forEach((e=>{e._closeSteps(void 0)}))}return _(e._readableStreamController[T](t),r)}function Or(e){e._state="closed";const t=e._reader;if(void 0!==t&&(A(t),J(t))){const e=t._readRequests;t._readRequests=new v,e.forEach((e=>{e._closeSteps()}))}}function jr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(k(r,t),J(r)?Z(r,t):it(r,t))}function kr(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Ar(e,t){I(e,t);const r=null==e?void 0:e.highWaterMark;return M(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Y(r)}}Object.defineProperties(ReadableStream,{from:{enumerable:!0}}),Object.defineProperties(ReadableStream.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),a(ReadableStream.from,"from"),a(ReadableStream.prototype.cancel,"cancel"),a(ReadableStream.prototype.getReader,"getReader"),a(ReadableStream.prototype.pipeThrough,"pipeThrough"),a(ReadableStream.prototype.pipeTo,"pipeTo"),a(ReadableStream.prototype.tee,"tee"),a(ReadableStream.prototype.values,"values"),"symbol"==typeof t.toStringTag&&Object.defineProperty(ReadableStream.prototype,t.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof t.asyncIterator&&Object.defineProperty(ReadableStream.prototype,t.asyncIterator,{value:ReadableStream.prototype.values,writable:!0,configurable:!0});const Dr=e=>e.byteLength;a(Dr,"size");class ByteLengthQueuingStrategy{constructor(e){$(e,1,"ByteLengthQueuingStrategy"),e=Ar(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Ir(this))throw zr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Ir(this))throw zr("size");return Dr}}function zr(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Ir(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof ByteLengthQueuingStrategy)}Object.defineProperties(ByteLengthQueuingStrategy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(ByteLengthQueuingStrategy.prototype,t.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Lr=()=>1;a(Lr,"size");class CountQueuingStrategy{constructor(e){$(e,1,"CountQueuingStrategy"),e=Ar(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!$r(this))throw Fr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!$r(this))throw Fr("size");return Lr}}function Fr(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function $r(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof CountQueuingStrategy)}function Mr(e,t,r){return L(e,r),r=>g(e,t,[r])}function Yr(e,t,r){return L(e,r),r=>S(e,t,[r])}function xr(e,t,r){return L(e,r),(r,o)=>g(e,t,[r,o])}function Qr(e,t,r){return L(e,r),r=>g(e,t,[r])}Object.defineProperties(CountQueuingStrategy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(CountQueuingStrategy.prototype,t.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class TransformStream{constructor(e={},t={},r={}){void 0===e&&(e=null);const o=ct(t,"Second parameter"),n=ct(r,"Third parameter"),a=function(e,t){I(e,t);const r=null==e?void 0:e.cancel,o=null==e?void 0:e.flush,n=null==e?void 0:e.readableType,a=null==e?void 0:e.start,i=null==e?void 0:e.transform,l=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:Qr(r,e,`${t} has member 'cancel' that`),flush:void 0===o?void 0:Mr(o,e,`${t} has member 'flush' that`),readableType:n,start:void 0===a?void 0:Yr(a,e,`${t} has member 'start' that`),transform:void 0===i?void 0:xr(i,e,`${t} has member 'transform' that`),writableType:l}}(e,"First parameter");if(void 0!==a.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==a.writableType)throw new RangeError("Invalid writableType specified");const i=st(n,0),l=ut(n),s=st(o,1),f=ut(o);let h;!function(e,t,r,o,n,a){function i(){return t}function l(t){return function(e,t){const r=e._transformStreamController;if(e._backpressure){return _(e._backpressureChangePromise,(()=>{const o=e._writable;if("erroring"===o._state)throw o._storedError;return Zr(r,t)}))}return Zr(r,t)}(e,t)}function s(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const o=e._readable;r._finishPromise=u(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const n=r._cancelAlgorithm(t);return Jr(r),b(n,(()=>("errored"===o._state?ro(r,o._storedError):(br(o._readableStreamController,t),to(r)),null)),(e=>(br(o._readableStreamController,e),ro(r,e),null))),r._finishPromise}(e,t)}function c(){return function(e){const t=e._transformStreamController;if(void 0!==t._finishPromise)return t._finishPromise;const r=e._readable;t._finishPromise=u(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const o=t._flushAlgorithm();return Jr(t),b(o,(()=>("errored"===r._state?ro(t,r._storedError):(dr(r._readableStreamController),to(t)),null)),(e=>(br(r._readableStreamController,e),ro(t,e),null))),t._finishPromise}(e)}function d(){return function(e){return Gr(e,!1),e._backpressureChangePromise}(e)}function f(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const o=e._writable;r._finishPromise=u(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const n=r._cancelAlgorithm(t);return Jr(r),b(n,(()=>("errored"===o._state?ro(r,o._storedError):(Yt(o._writableStreamController,t),Ur(e),to(r)),null)),(t=>(Yt(o._writableStreamController,t),Ur(e),ro(r,t),null))),r._finishPromise}(e,t)}e._writable=function(e,t,r,o,n=1,a=(()=>1)){const i=Object.create(WritableStream.prototype);return St(i),Lt(i,Object.create(WritableStreamDefaultController.prototype),e,t,r,o,n,a),i}(i,l,c,s,r,o),e._readable=Cr(i,d,f,n,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Gr(e,!0),e._transformStreamController=void 0}(this,u((e=>{h=e})),s,f,i,l),function(e,t){const r=Object.create(TransformStreamDefaultController.prototype);let o,n,a;o=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return Kr(r,e),c(void 0)}catch(e){return d(e)}};n=void 0!==t.flush?()=>t.flush(r):()=>c(void 0);a=void 0!==t.cancel?e=>t.cancel(e):()=>c(void 0);!function(e,t,r,o,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=o,t._cancelAlgorithm=n,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,o,n,a)}(this,a),void 0!==a.start?h(a.start(this._transformStreamController)):h(void 0)}get readable(){if(!Nr(this))throw oo("readable");return this._readable}get writable(){if(!Nr(this))throw oo("writable");return this._writable}}function Nr(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof TransformStream)}function Hr(e,t){br(e._readable._readableStreamController,t),Vr(e,t)}function Vr(e,t){Jr(e._transformStreamController),Yt(e._writable._writableStreamController,t),Ur(e)}function Ur(e){e._backpressure&&Gr(e,!1)}function Gr(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=u((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(TransformStream.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(TransformStream.prototype,t.toStringTag,{value:"TransformStream",configurable:!0});class TransformStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Xr(this))throw eo("desiredSize");return hr(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Xr(this))throw eo("enqueue");Kr(this,e)}error(e=void 0){if(!Xr(this))throw eo("error");var t;t=e,Hr(this._controlledTransformStream,t)}terminate(){if(!Xr(this))throw eo("terminate");!function(e){const t=e._controlledTransformStream;dr(t._readable._readableStreamController);const r=new TypeError("TransformStream terminated");Vr(t,r)}(this)}}function Xr(e){return!!o(e)&&(!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof TransformStreamDefaultController)}function Jr(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Kr(e,t){const r=e._controlledTransformStream,o=r._readable._readableStreamController;if(!mr(o))throw new TypeError("Readable side is not in a state that permits enqueue");try{fr(o,t)}catch(e){throw Vr(r,e),r._readable._storedError}const n=function(e){return!ur(e)}(o);n!==r._backpressure&&Gr(r,!0)}function Zr(e,t){return _(e._transformAlgorithm(t),void 0,(t=>{throw Hr(e._controlledTransformStream,t),t}))}function eo(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function to(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function ro(e,t){void 0!==e._finishPromise_reject&&(p(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function oo(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(TransformStreamDefaultController.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),a(TransformStreamDefaultController.prototype.enqueue,"enqueue"),a(TransformStreamDefaultController.prototype.error,"error"),a(TransformStreamDefaultController.prototype.terminate,"terminate"),"symbol"==typeof t.toStringTag&&Object.defineProperty(TransformStreamDefaultController.prototype,t.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});const no={ReadableStream:ReadableStream,ReadableStreamDefaultController:ReadableStreamDefaultController,ReadableByteStreamController:ReadableByteStreamController,ReadableStreamBYOBRequest:ReadableStreamBYOBRequest,ReadableStreamDefaultReader:ReadableStreamDefaultReader,ReadableStreamBYOBReader:ReadableStreamBYOBReader,WritableStream:WritableStream,WritableStreamDefaultController:WritableStreamDefaultController,WritableStreamDefaultWriter:WritableStreamDefaultWriter,ByteLengthQueuingStrategy:ByteLengthQueuingStrategy,CountQueuingStrategy:CountQueuingStrategy,TransformStream:TransformStream,TransformStreamDefaultController:TransformStreamDefaultController};if(void 0!==nr)for(const e in no)Object.prototype.hasOwnProperty.call(no,e)&&Object.defineProperty(nr,e,{value:no[e],writable:!0,configurable:!0});e.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy,e.CountQueuingStrategy=CountQueuingStrategy,e.ReadableByteStreamController=ReadableByteStreamController,e.ReadableStream=ReadableStream,e.ReadableStreamBYOBReader=ReadableStreamBYOBReader,e.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest,e.ReadableStreamDefaultController=ReadableStreamDefaultController,e.ReadableStreamDefaultReader=ReadableStreamDefaultReader,e.TransformStream=TransformStream,e.TransformStreamDefaultController=TransformStreamDefaultController,e.WritableStream=WritableStream,e.WritableStreamDefaultController=WritableStreamDefaultController,e.WritableStreamDefaultWriter=WritableStreamDefaultWriter})); //# sourceMappingURL=polyfill.es6.min.js.map