1
0
mirror of https://github.com/c9fe/22120.git synced 2024-11-15 07:22:28 +01:00
22120/514.22120.js
2021-11-03 08:38:55 +00:00

2 lines
71 KiB
JavaScript

#!/usr/bin/env node
exports.id=514,exports.ids=[514],exports.modules={5175:e=>{"use strict";e.exports=function(e){if(!/^data:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');const t=(e=e.replace(/\r?\n/g,"")).indexOf(",");if(-1===t||t<=4)throw new TypeError("malformed data: URI");const r=e.substring(5,t).split(";");let o="",n=!1;const i=r[0]||"text/plain";let a=i;for(let e=1;e<r.length;e++)"base64"===r[e]?n=!0:(a+=`;${r[e]}`,0===r[e].indexOf("charset=")&&(o=r[e].substring(8)));r[0]||o.length||(a+=";charset=US-ASCII",o="US-ASCII");const s=n?"base64":"ascii",l=unescape(e.substring(t+1)),u=Buffer.from(l,s);return u.type=i,u.typeFull=a,u.charset=o,u}},2660:function(e,t){var r;r=function(e){"use strict";const t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:e=>`Symbol(${e})`;function r(){}const o="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function n(e){return"object"==typeof e&&null!==e||"function"==typeof e}const i=r,a=Promise,s=Promise.prototype.then,l=Promise.resolve.bind(a),u=Promise.reject.bind(a);function c(e){return new a(e)}function d(e){return l(e)}function f(e){return u(e)}function h(e,t,r){return s.call(e,t,r)}function b(e,t,r){h(h(e,t,r),void 0,i)}function p(e,t){b(e,t)}function y(e,t){b(e,void 0,t)}function m(e,t,r){return h(e,t,r)}function _(e){h(e,void 0,i)}const g=(()=>{const e=o&&o.queueMicrotask;if("function"==typeof e)return e;const t=d(void 0);return e=>h(t,e)})();function w(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function v(e,t,r){try{return d(w(e,t,r))}catch(e){return f(e)}}class S{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,i=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,i}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]}}function T(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?C(e):"closed"===t._state?function(e){C(e),B(e)}(e):q(e,t._storedError)}function R(e,t){return wr(e._ownerReadableStream,t)}function E(e){"readable"===e._ownerReadableStream._state?A(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){q(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function P(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function C(e){e._closedPromise=c(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function q(e,t){C(e),A(e,t)}function A(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function B(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const k=t("[[AbortSteps]]"),O=t("[[ErrorSteps]]"),j=t("[[CancelSteps]]"),z=t("[[PullSteps]]"),W=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},L=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function $(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function F(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function I(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function M(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function x(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function U(e){return Number(e)}function D(e){return 0===e?0:e}function H(e,t){const r=Number.MAX_SAFE_INTEGER;let o=Number(e);if(o=D(o),!W(o))throw new TypeError(`${t} is not a finite number`);if(o=function(e){return D(L(e))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return W(o)&&0!==o?o:0}function N(e,t){if(!_r(e))throw new TypeError(`${t} is not a ReadableStream.`)}function V(e){return new Z(e)}function Q(e,t){e._reader._readRequests.push(t)}function Y(e,t,r){const o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function G(e){return e._reader._readRequests.length}function K(e){const t=e._reader;return void 0!==t&&!!J(t)}class Z{constructor(e){if(M(e,1,"ReadableStreamDefaultReader"),N(e,"First parameter"),gr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");T(this,e),this._readRequests=new S}get closed(){return J(this)?this._closedPromise:f(ee("closed"))}cancel(e){return J(this)?void 0===this._ownerReadableStream?f(P("cancel")):R(this,e):f(ee("cancel"))}read(){if(!J(this))return f(ee("read"));if(void 0===this._ownerReadableStream)return f(P("read from"));let e,t;const r=c(((r,o)=>{e=r,t=o}));return X(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");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");E(this)}}}function J(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof Z}function X(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[z](t)}function ee(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}Object.defineProperties(Z.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Z.prototype,t.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});const te=Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})).prototype);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?m(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?m(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;if(void 0===e._ownerReadableStream)return f(P("iterate"));let t,r;const o=c(((e,o)=>{t=e,r=o}));return X(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,g((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,E(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,E(e),r(t)}}),o}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(void 0===t._ownerReadableStream)return f(P("finish iterating"));if(!this._preventCancel){const r=R(t,e);return E(t),m(r,(()=>({value:e,done:!0})))}return E(t),d({value:e,done:!0})}}const oe={next(){return ne(this)?this._asyncIteratorImpl.next():f(ie("next"))},return(e){return ne(this)?this._asyncIteratorImpl.return(e):f(ie("return"))}};function ne(e){if(!n(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof re}catch(e){return!1}}function ie(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}void 0!==te&&Object.setPrototypeOf(oe,te);const ae=Number.isNaN||function(e){return e!=e};function se(e){return e.slice()}function le(e,t,r,o,n){new Uint8Array(e).set(new Uint8Array(r,o,n),t)}function ue(e,t,r){if(e.slice)return e.slice(t,r);const o=r-t,n=new ArrayBuffer(o);return le(n,0,e,t,o),n}function ce(e){const t=ue(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function de(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function fe(e,t,r){if("number"!=typeof(o=r)||ae(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 he(e){e._queue=new S,e._queueTotalSize=0}class be{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!me(this))throw Ie("view");return this._view}respond(e){if(!me(this))throw Ie("respond");if(M(e,1,"respond"),e=H(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,Le(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!me(this))throw Ie("respondWithNewView");if(M(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");e.buffer,$e(this._associatedReadableByteStreamController,e)}}Object.defineProperties(be.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(be.prototype,t.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class pe{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ye(this))throw Me("byobRequest");return ze(this)}get desiredSize(){if(!ye(this))throw Me("desiredSize");return We(this)}close(){if(!ye(this))throw Me("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`);ke(this)}enqueue(e){if(!ye(this))throw Me("enqueue");if(M(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`);Oe(this,e)}error(e){if(!ye(this))throw Me("error");je(this,e)}[j](e){ge(this),he(this);const t=this._cancelAlgorithm(e);return Be(this),t}[z](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0){const t=this._queue.shift();this._queueTotalSize-=t.byteLength,Ee(this);const r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return void e._chunkSteps(r)}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,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}Q(t,e),_e(this)}}function ye(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof pe}function me(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof be}function _e(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&!e._closeRequested&&!!e._started&&(!!(K(t)&&G(t)>0)||!!(He(t)&&De(t)>0)||We(e)>0)}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,b(e._pullAlgorithm(),(()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,_e(e))}),(t=>{je(e,t)}))))}function ge(e){Pe(e),e._pendingPullIntos=new S}function we(e,t){let r=!1;"closed"===e._state&&(r=!0);const o=ve(t);"default"===t.readerType?Y(e,o,r):function(e,t,r){const o=e._reader._readIntoRequests.shift();r?o._closeSteps(t):o._chunkSteps(t)}(e,o,r)}function ve(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Se(e,t,r,o){e._queue.push({buffer:t,byteOffset:r,byteLength:o}),e._queueTotalSize+=o}function Te(e,t){const r=t.elementSize,o=t.bytesFilled-t.bytesFilled%r,n=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),i=t.bytesFilled+n,a=i-i%r;let s=n,l=!1;a>o&&(s=a-t.bytesFilled,l=!0);const u=e._queue;for(;s>0;){const r=u.peek(),o=Math.min(s,r.byteLength),n=t.byteOffset+t.bytesFilled;le(t.buffer,n,r.buffer,r.byteOffset,o),r.byteLength===o?u.shift():(r.byteOffset+=o,r.byteLength-=o),e._queueTotalSize-=o,Re(0,o,t),s-=o}return l}function Re(e,t,r){r.bytesFilled+=t}function Ee(e){0===e._queueTotalSize&&e._closeRequested?(Be(e),vr(e._controlledReadableByteStream)):_e(e)}function Pe(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Ce(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Te(e,t)&&(Ae(e),we(e._controlledReadableByteStream,t))}}function qe(e,t){const r=e._pendingPullIntos.peek();Pe(e),"closed"===e._controlledReadableByteStream._state?function(e,t){const r=e._controlledReadableByteStream;if(He(r))for(;De(r)>0;)we(r,Ae(e))}(e):function(e,t,r){if(Re(0,t,r),r.bytesFilled<r.elementSize)return;Ae(e);const o=r.bytesFilled%r.elementSize;if(o>0){const t=r.byteOffset+r.bytesFilled,n=ue(r.buffer,t-o,t);Se(e,n,0,n.byteLength)}r.bytesFilled-=o,we(e._controlledReadableByteStream,r),Ce(e)}(e,t,r),_e(e)}function Ae(e){return e._pendingPullIntos.shift()}function Be(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function ke(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0&&e._pendingPullIntos.peek().bytesFilled>0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw je(e,t),t}Be(e),vr(t)}}function Oe(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const o=t.buffer,n=t.byteOffset,i=t.byteLength,a=o;if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();t.buffer,t.buffer=t.buffer}Pe(e),K(r)?0===G(r)?Se(e,a,n,i):Y(r,new Uint8Array(a,n,i),!1):He(r)?(Se(e,a,n,i),Ce(e)):Se(e,a,n,i),_e(e)}function je(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(ge(e),he(e),Be(e),Sr(r,t))}function ze(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(be.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(o,e,r),e._byobRequest=o}return e._byobRequest}function We(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Le(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=r.buffer,qe(e,t)}function $e(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");r.buffer=t.buffer,qe(e,t.byteLength)}function Fe(e,t,r,o,n,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,he(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=o,t._cancelAlgorithm=n,t._autoAllocateChunkSize=a,t._pendingPullIntos=new S,e._readableStreamController=t,b(d(r()),(()=>{t._started=!0,_e(t)}),(e=>{je(t,e)}))}function Ie(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Me(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function xe(e){return new Ne(e)}function Ue(e,t){e._reader._readIntoRequests.push(t)}function De(e){return e._reader._readIntoRequests.length}function He(e){const t=e._reader;return void 0!==t&&!!Ve(t)}Object.defineProperties(pe.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(pe.prototype,t.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Ne{constructor(e){if(M(e,1,"ReadableStreamBYOBReader"),N(e,"First parameter"),gr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ye(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");T(this,e),this._readIntoRequests=new S}get closed(){return Ve(this)?this._closedPromise:f(Ye("closed"))}cancel(e){return Ve(this)?void 0===this._ownerReadableStream?f(P("cancel")):R(this,e):f(Ye("cancel"))}read(e){if(!Ve(this))return f(Ye("read"));if(!ArrayBuffer.isView(e))return f(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return f(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return f(new TypeError("view's buffer must have non-zero byteLength"));if(e.buffer,void 0===this._ownerReadableStream)return f(P("read from"));let t,r;const o=c(((e,o)=>{t=e,r=o}));return Qe(this,e,{_chunkSteps:e=>t({value:e,done:!1}),_closeSteps:e=>t({value:e,done:!0}),_errorSteps:e=>r(e)}),o}releaseLock(){if(!Ve(this))throw Ye("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");E(this)}}}function Ve(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Ne}function Qe(e,t,r){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?r._errorSteps(o._storedError):function(e,t,r){const o=e._controlledReadableByteStream;let n=1;t.constructor!==DataView&&(n=t.constructor.BYTES_PER_ELEMENT);const i=t.constructor,a=t.buffer,s={buffer:a,bufferByteLength:a.byteLength,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:n,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(s),void Ue(o,r);if("closed"!==o._state){if(e._queueTotalSize>0){if(Te(e,s)){const t=ve(s);return Ee(e),void r._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return je(e,t),void r._errorSteps(t)}}e._pendingPullIntos.push(s),Ue(o,r),_e(e)}else{const e=new i(s.buffer,s.byteOffset,0);r._closeSteps(e)}}(o._readableStreamController,t,r)}function Ye(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Ge(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(ae(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Ke(e){const{size:t}=e;return t||(()=>1)}function Ze(e,t){$(e,t);const r=null==e?void 0:e.highWaterMark,o=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:U(r),size:void 0===o?void 0:Je(o,`${t} has member 'size' that`)}}function Je(e,t){return F(e,t),t=>U(e(t))}function Xe(e,t,r){return F(e,r),r=>v(e,t,[r])}function et(e,t,r){return F(e,r),()=>v(e,t,[])}function tt(e,t,r){return F(e,r),r=>w(e,t,[r])}function rt(e,t,r){return F(e,r),(r,o)=>v(e,t,[r,o])}function ot(e,t){if(!lt(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Ne.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Ne.prototype,t.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const nt="function"==typeof AbortController;class it{constructor(e={},t={}){void 0===e?e=null:I(e,"First parameter");const r=Ze(t,"Second parameter"),o=function(e,t){$(e,t);const r=null==e?void 0:e.abort,o=null==e?void 0:e.close,n=null==e?void 0:e.start,i=null==e?void 0:e.type,a=null==e?void 0:e.write;return{abort:void 0===r?void 0:Xe(r,e,`${t} has member 'abort' that`),close:void 0===o?void 0:et(o,e,`${t} has member 'close' that`),start:void 0===n?void 0:tt(n,e,`${t} has member 'start' that`),write:void 0===a?void 0:rt(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(st(this),void 0!==o.type)throw new RangeError("Invalid type is specified");const n=Ke(r);!function(e,t,r,o){const n=Object.create(Et.prototype);let i=()=>{},a=()=>d(void 0),s=()=>d(void 0),l=()=>d(void 0);void 0!==t.start&&(i=()=>t.start(n)),void 0!==t.write&&(a=e=>t.write(e,n)),void 0!==t.close&&(s=()=>t.close()),void 0!==t.abort&&(l=e=>t.abort(e)),Ct(e,n,i,a,s,l,r,o)}(this,o,Ge(r,1),n)}get locked(){if(!lt(this))throw zt("locked");return ut(this)}abort(e){return lt(this)?ut(this)?f(new TypeError("Cannot abort a stream that already has a writer")):ct(this,e):f(zt("abort"))}close(){return lt(this)?ut(this)?f(new TypeError("Cannot close a stream that already has a writer")):pt(this)?f(new TypeError("Cannot close an already-closing stream")):dt(this):f(zt("close"))}getWriter(){if(!lt(this))throw zt("getWriter");return at(this)}}function at(e){return new _t(e)}function st(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new S,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function lt(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof it}function ut(e){return void 0!==e._writer}function ct(e,t){var r;if("closed"===e._state||"errored"===e._state)return d(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort();const o=e._state;if("closed"===o||"errored"===o)return d(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let n=!1;"erroring"===o&&(n=!0,t=void 0);const i=c(((r,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:o,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||ht(e,t),i}function dt(e){const t=e._state;if("closed"===t||"errored"===t)return f(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=c(((t,r)=>{const o={_resolve:t,_reject:r};e._closeRequest=o})),o=e._writer;var n;return void 0!==o&&e._backpressure&&"writable"===t&&Vt(o),fe(n=e._writableStreamController,Rt,0),Bt(n),r}function ft(e,t){"writable"!==e._state?bt(e):ht(e,t)}function ht(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const o=e._writer;void 0!==o&&vt(o,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&bt(e)}function bt(e){e._state="errored",e._writableStreamController[O]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new S,void 0===e._pendingAbortRequest)return void yt(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void yt(e);b(e._writableStreamController[k](r._reason),(()=>{r._resolve(),yt(e)}),(t=>{r._reject(t),yt(e)}))}function pt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function yt(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Mt(t,e._storedError)}function mt(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Ut(e)}(r):Vt(r)),e._backpressure=t}Object.defineProperties(it.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(it.prototype,t.toStringTag,{value:"WritableStream",configurable:!0});class _t{constructor(e){if(M(e,1,"WritableStreamDefaultWriter"),ot(e,"First parameter"),ut(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)!pt(e)&&e._backpressure?Ut(this):Ht(this),Ft(this);else if("erroring"===t)Dt(this,e._storedError),Ft(this);else if("closed"===t)Ht(this),Ft(this),xt(this);else{const t=e._storedError;Dt(this,t),It(this,t)}}get closed(){return gt(this)?this._closedPromise:f(Lt("closed"))}get desiredSize(){if(!gt(this))throw Lt("desiredSize");if(void 0===this._ownerWritableStream)throw $t("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:At(t._writableStreamController)}(this)}get ready(){return gt(this)?this._readyPromise:f(Lt("ready"))}abort(e){return gt(this)?void 0===this._ownerWritableStream?f($t("abort")):function(e,t){return ct(e._ownerWritableStream,t)}(this,e):f(Lt("abort"))}close(){if(!gt(this))return f(Lt("close"));const e=this._ownerWritableStream;return void 0===e?f($t("close")):pt(e)?f(new TypeError("Cannot close an already-closing stream")):wt(this)}releaseLock(){if(!gt(this))throw Lt("releaseLock");void 0!==this._ownerWritableStream&&St(this)}write(e){return gt(this)?void 0===this._ownerWritableStream?f($t("write to")):Tt(this,e):f(Lt("write"))}}function gt(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof _t}function wt(e){return dt(e._ownerWritableStream)}function vt(e,t){"pending"===e._readyPromiseState?Nt(e,t):function(e,t){Dt(e,t)}(e,t)}function St(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");vt(e,r),function(e,t){"pending"===e._closedPromiseState?Mt(e,t):function(e,t){It(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Tt(e,t){const r=e._ownerWritableStream,o=r._writableStreamController,n=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return kt(e,t),1}}(o,t);if(r!==e._ownerWritableStream)return f($t("write to"));const i=r._state;if("errored"===i)return f(r._storedError);if(pt(r)||"closed"===i)return f(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return f(r._storedError);const a=function(e){return c(((t,r)=>{const o={_resolve:t,_reject:r};e._writeRequests.push(o)}))}(r);return function(e,t,r){try{fe(e,t,r)}catch(t){return void kt(e,t)}const o=e._controlledWritableStream;pt(o)||"writable"!==o._state||mt(o,Ot(e)),Bt(e)}(o,t,n),a}Object.defineProperties(_t.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(_t.prototype,t.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Rt={};class Et{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Pt(this))throw Wt("abortReason");return this._abortReason}get signal(){if(!Pt(this))throw Wt("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e){if(!Pt(this))throw Wt("error");"writable"===this._controlledWritableStream._state&&jt(this,e)}[k](e){const t=this._abortAlgorithm(e);return qt(this),t}[O](){he(this)}}function Pt(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Et}function Ct(e,t,r,o,n,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,he(t),t._abortReason=void 0,t._abortController=function(){if(nt)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=o,t._closeAlgorithm=n,t._abortAlgorithm=i;const l=Ot(t);mt(e,l),b(d(r()),(()=>{t._started=!0,Bt(t)}),(r=>{t._started=!0,ft(e,r)}))}function qt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function At(e){return e._strategyHWM-e._queueTotalSize}function Bt(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void bt(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Rt?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),de(e);const r=e._closeAlgorithm();qt(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&&xt(t)}(t)}),(e=>{!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),ft(e,t)}(t,e)}))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),b(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(de(e),!pt(r)&&"writable"===t){const t=Ot(e);mt(r,t)}Bt(e)}),(t=>{"writable"===r._state&&qt(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,ft(e,t)}(r,t)}))}(e,r)}function kt(e,t){"writable"===e._controlledWritableStream._state&&jt(e,t)}function Ot(e){return At(e)<=0}function jt(e,t){const r=e._controlledWritableStream;qt(e),ht(r,t)}function zt(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Wt(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function Lt(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function $t(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Ft(e){e._closedPromise=c(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function It(e,t){Ft(e),Mt(e,t)}function Mt(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function xt(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 Ut(e){e._readyPromise=c(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function Dt(e,t){Ut(e),Nt(e,t)}function Ht(e){Ut(e),Vt(e)}function Nt(e,t){void 0!==e._readyPromise_reject&&(_(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Vt(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(Et.prototype,{error:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Et.prototype,t.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const Qt="undefined"!=typeof DOMException?DOMException:void 0,Yt=function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;try{return new e,!0}catch(e){return!1}}(Qt)?Qt:function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Gt(e,t,o,n,i,a){const s=V(e),l=at(t);e._disturbed=!0;let u=!1,m=d(void 0);return c(((g,w)=>{let v;if(void 0!==a){if(v=()=>{const r=new Yt("Aborted","AbortError"),o=[];n||o.push((()=>"writable"===t._state?ct(t,r):d(void 0))),i||o.push((()=>"readable"===e._state?wr(e,r):d(void 0))),q((()=>Promise.all(o.map((e=>e())))),!0,r)},a.aborted)return void v();a.addEventListener("abort",v)}var S,T,R;if(C(e,s._closedPromise,(e=>{n?A(!0,e):q((()=>ct(t,e)),!0,e)})),C(t,l._closedPromise,(t=>{i?A(!0,t):q((()=>wr(e,t)),!0,t)})),S=e,T=s._closedPromise,R=()=>{o?A():q((()=>function(e){const t=e._ownerWritableStream,r=t._state;return pt(t)||"closed"===r?d(void 0):"errored"===r?f(t._storedError):wt(e)}(l)))},"closed"===S._state?R():p(T,R),pt(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");i?A(!0,t):q((()=>wr(e,t)),!0,t)}function P(){const e=m;return h(m,(()=>e!==m?P():void 0))}function C(e,t,r){"errored"===e._state?r(e._storedError):y(t,r)}function q(e,r,o){function n(){b(e(),(()=>B(r,o)),(e=>B(!0,e)))}u||(u=!0,"writable"!==t._state||pt(t)?n():p(P(),n))}function A(e,r){u||(u=!0,"writable"!==t._state||pt(t)?B(e,r):p(P(),(()=>B(e,r))))}function B(e,t){St(l),E(s),void 0!==a&&a.removeEventListener("abort",v),e?w(t):g(void 0)}_(c(((e,t)=>{!function o(n){n?e():h(u?d(!0):h(l._readyPromise,(()=>c(((e,t)=>{X(s,{_chunkSteps:t=>{m=h(Tt(l,t),void 0,r),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),o,t)}(!1)})))}))}class Kt{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Zt(this))throw sr("desiredSize");return nr(this)}close(){if(!Zt(this))throw sr("close");if(!ir(this))throw new TypeError("The stream is not in a state that permits close");tr(this)}enqueue(e){if(!Zt(this))throw sr("enqueue");if(!ir(this))throw new TypeError("The stream is not in a state that permits enqueue");return rr(this,e)}error(e){if(!Zt(this))throw sr("error");or(this,e)}[j](e){he(this);const t=this._cancelAlgorithm(e);return er(this),t}[z](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=de(this);this._closeRequested&&0===this._queue.length?(er(this),vr(t)):Jt(this),e._chunkSteps(r)}else Q(t,e),Jt(this)}}function Zt(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Kt}function Jt(e){Xt(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,b(e._pullAlgorithm(),(()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Jt(e))}),(t=>{or(e,t)}))))}function Xt(e){const t=e._controlledReadableStream;return!!ir(e)&&!!e._started&&(!!(gr(t)&&G(t)>0)||nr(e)>0)}function er(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function tr(e){if(!ir(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(er(e),vr(t))}function rr(e,t){if(!ir(e))return;const r=e._controlledReadableStream;if(gr(r)&&G(r)>0)Y(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw or(e,t),t}try{fe(e,t,r)}catch(t){throw or(e,t),t}}Jt(e)}function or(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(he(e),er(e),Sr(r,t))}function nr(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function ir(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function ar(e,t,r,o,n,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,he(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=o,t._cancelAlgorithm=n,e._readableStreamController=t,b(d(r()),(()=>{t._started=!0,Jt(t)}),(e=>{or(t,e)}))}function sr(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function lr(e,t,r){return F(e,r),r=>v(e,t,[r])}function ur(e,t,r){return F(e,r),r=>v(e,t,[r])}function cr(e,t,r){return F(e,r),r=>w(e,t,[r])}function dr(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function fr(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function hr(e,t){$(e,t);const r=null==e?void 0:e.preventAbort,o=null==e?void 0:e.preventCancel,n=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&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.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(o),preventClose:Boolean(n),signal:i}}Object.defineProperties(Kt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Kt.prototype,t.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class br{constructor(e={},t={}){void 0===e?e=null:I(e,"First parameter");const r=Ze(t,"Second parameter"),o=function(e,t){$(e,t);const r=e,o=null==r?void 0:r.autoAllocateChunkSize,n=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,a=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===o?void 0:H(o,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===n?void 0:lr(n,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:ur(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:cr(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:dr(s,`${t} has member 'type' that`)}}(e,"First parameter");if(mr(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(pe.prototype);let n=()=>{},i=()=>d(void 0),a=()=>d(void 0);void 0!==t.start&&(n=()=>t.start(o)),void 0!==t.pull&&(i=()=>t.pull(o)),void 0!==t.cancel&&(a=e=>t.cancel(e));const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");Fe(e,o,n,i,a,r,s)}(this,o,Ge(r,0))}else{const e=Ke(r);!function(e,t,r,o){const n=Object.create(Kt.prototype);let i=()=>{},a=()=>d(void 0),s=()=>d(void 0);void 0!==t.start&&(i=()=>t.start(n)),void 0!==t.pull&&(a=()=>t.pull(n)),void 0!==t.cancel&&(s=e=>t.cancel(e)),ar(e,n,i,a,s,r,o)}(this,o,Ge(r,1),e)}}get locked(){if(!_r(this))throw Tr("locked");return gr(this)}cancel(e){return _r(this)?gr(this)?f(new TypeError("Cannot cancel a stream that already has a reader")):wr(this,e):f(Tr("cancel"))}getReader(e){if(!_r(this))throw Tr("getReader");return void 0===function(e,t){$(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:fr(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?V(this):xe(this)}pipeThrough(e,t={}){if(!_r(this))throw Tr("pipeThrough");M(e,1,"pipeThrough");const r=function(e,t){$(e,t);const r=null==e?void 0:e.readable;x(r,"readable","ReadableWritablePair"),N(r,`${t} has member 'readable' that`);const o=null==e?void 0:e.writable;return x(o,"writable","ReadableWritablePair"),ot(o,`${t} has member 'writable' that`),{readable:r,writable:o}}(e,"First parameter"),o=hr(t,"Second parameter");if(gr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(ut(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return _(Gt(this,r.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal)),r.readable}pipeTo(e,t={}){if(!_r(this))return f(Tr("pipeTo"));if(void 0===e)return f("Parameter 1 is required in 'pipeTo'.");if(!lt(e))return f(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=hr(t,"Second parameter")}catch(e){return f(e)}return gr(this)?f(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):ut(e)?f(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Gt(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!_r(this))throw Tr("tee");return se(ye((e=this)._readableStreamController)?function(e){let t,r,o,n,i,a=V(e),s=!1,l=!1,u=!1;const f=c((e=>{i=e}));function h(e){y(e._closedPromise,(t=>{e===a&&(je(o._readableStreamController,t),je(n._readableStreamController,t),l&&u||i(void 0))}))}function b(){Ve(a)&&(E(a),a=V(e),h(a)),X(a,{_chunkSteps:t=>{g((()=>{s=!1;const r=t;let a=t;if(!l&&!u)try{a=ce(t)}catch(t){return je(o._readableStreamController,t),je(n._readableStreamController,t),void i(wr(e,t))}l||Oe(o._readableStreamController,r),u||Oe(n._readableStreamController,a)}))},_closeSteps:()=>{s=!1,l||ke(o._readableStreamController),u||ke(n._readableStreamController),o._readableStreamController._pendingPullIntos.length>0&&Le(o._readableStreamController,0),n._readableStreamController._pendingPullIntos.length>0&&Le(n._readableStreamController,0),l&&u||i(void 0)},_errorSteps:()=>{s=!1}})}function p(t,r){J(a)&&(E(a),a=xe(e),h(a));const c=r?n:o,d=r?o:n;Qe(a,t,{_chunkSteps:t=>{g((()=>{s=!1;const o=r?u:l;if(r?l:u)o||$e(c._readableStreamController,t);else{let r;try{r=ce(t)}catch(t){return je(c._readableStreamController,t),je(d._readableStreamController,t),void i(wr(e,t))}o||$e(c._readableStreamController,t),Oe(d._readableStreamController,r)}}))},_closeSteps:e=>{s=!1;const t=r?u:l,o=r?l:u;t||ke(c._readableStreamController),o||ke(d._readableStreamController),void 0!==e&&(t||$e(c._readableStreamController,e),!o&&d._readableStreamController._pendingPullIntos.length>0&&Le(d._readableStreamController,0)),t&&o||i(void 0)},_errorSteps:()=>{s=!1}})}function m(){}return o=yr(m,(function(){if(s)return d(void 0);s=!0;const e=ze(o._readableStreamController);return null===e?b():p(e._view,!1),d(void 0)}),(function(o){if(l=!0,t=o,u){const o=se([t,r]),n=wr(e,o);i(n)}return f})),n=yr(m,(function(){if(s)return d(void 0);s=!0;const e=ze(n._readableStreamController);return null===e?b():p(e._view,!0),d(void 0)}),(function(o){if(u=!0,r=o,l){const o=se([t,r]),n=wr(e,o);i(n)}return f})),h(a),[o,n]}(e):function(e,t){const r=V(e);let o,n,i,a,s,l=!1,u=!1,f=!1;const h=c((e=>{s=e}));function b(){return l||(l=!0,X(r,{_chunkSteps:e=>{g((()=>{l=!1;const t=e,r=e;u||rr(i._readableStreamController,t),f||rr(a._readableStreamController,r)}))},_closeSteps:()=>{l=!1,u||tr(i._readableStreamController),f||tr(a._readableStreamController),u&&f||s(void 0)},_errorSteps:()=>{l=!1}})),d(void 0)}function p(){}return i=pr(p,b,(function(t){if(u=!0,o=t,f){const t=se([o,n]),r=wr(e,t);s(r)}return h})),a=pr(p,b,(function(t){if(f=!0,n=t,u){const t=se([o,n]),r=wr(e,t);s(r)}return h})),y(r._closedPromise,(e=>{or(i._readableStreamController,e),or(a._readableStreamController,e),u&&f||s(void 0)})),[i,a]}(e));var e}values(e){if(!_r(this))throw Tr("values");return function(e,t){const r=V(e),o=new re(r,t),n=Object.create(oe);return n._asyncIteratorImpl=o,n}(this,function(e,t){$(e,"First parameter");const r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e).preventCancel)}}function pr(e,t,r,o=1,n=(()=>1)){const i=Object.create(br.prototype);return mr(i),ar(i,Object.create(Kt.prototype),e,t,r,o,n),i}function yr(e,t,r){const o=Object.create(br.prototype);return mr(o),Fe(o,Object.create(pe.prototype),e,t,r,0,void 0),o}function mr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function _r(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof br}function gr(e){return void 0!==e._reader}function wr(e,t){if(e._disturbed=!0,"closed"===e._state)return d(void 0);if("errored"===e._state)return f(e._storedError);vr(e);const o=e._reader;return void 0!==o&&Ve(o)&&(o._readIntoRequests.forEach((e=>{e._closeSteps(void 0)})),o._readIntoRequests=new S),m(e._readableStreamController[j](t),r)}function vr(e){e._state="closed";const t=e._reader;void 0!==t&&(B(t),J(t)&&(t._readRequests.forEach((e=>{e._closeSteps()})),t._readRequests=new S))}function Sr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(A(r,t),J(r)?(r._readRequests.forEach((e=>{e._errorSteps(t)})),r._readRequests=new S):(r._readIntoRequests.forEach((e=>{e._errorSteps(t)})),r._readIntoRequests=new S))}function Tr(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Rr(e,t){$(e,t);const r=null==e?void 0:e.highWaterMark;return x(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:U(r)}}Object.defineProperties(br.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(br.prototype,t.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof t.asyncIterator&&Object.defineProperty(br.prototype,t.asyncIterator,{value:br.prototype.values,writable:!0,configurable:!0});const Er=e=>e.byteLength;Object.defineProperty(Er,"name",{value:"size",configurable:!0});class Pr{constructor(e){M(e,1,"ByteLengthQueuingStrategy"),e=Rr(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!qr(this))throw Cr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!qr(this))throw Cr("size");return Er}}function Cr(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function qr(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Pr}Object.defineProperties(Pr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Pr.prototype,t.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Ar=()=>1;Object.defineProperty(Ar,"name",{value:"size",configurable:!0});class Br{constructor(e){M(e,1,"CountQueuingStrategy"),e=Rr(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Or(this))throw kr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Or(this))throw kr("size");return Ar}}function kr(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Or(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Br}function jr(e,t,r){return F(e,r),r=>v(e,t,[r])}function zr(e,t,r){return F(e,r),r=>w(e,t,[r])}function Wr(e,t,r){return F(e,r),(r,o)=>v(e,t,[r,o])}Object.defineProperties(Br.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Br.prototype,t.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Lr{constructor(e={},t={},r={}){void 0===e&&(e=null);const o=Ze(t,"Second parameter"),n=Ze(r,"Third parameter"),i=function(e,t){$(e,t);const r=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,n=null==e?void 0:e.start,i=null==e?void 0:e.transform,a=null==e?void 0:e.writableType;return{flush:void 0===r?void 0:jr(r,e,`${t} has member 'flush' that`),readableType:o,start:void 0===n?void 0:zr(n,e,`${t} has member 'start' that`),transform:void 0===i?void 0:Wr(i,e,`${t} has member 'transform' that`),writableType:a}}(e,"First parameter");if(void 0!==i.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==i.writableType)throw new RangeError("Invalid writableType specified");const a=Ge(n,0),s=Ke(n),l=Ge(o,1),u=Ke(o);let h;!function(e,t,r,o,n,i){function a(){return t}e._writable=function(e,t,r,o,n=1,i=(()=>1)){const a=Object.create(it.prototype);return st(a),Ct(a,Object.create(Et.prototype),e,t,r,o,n,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?m(e._backpressureChangePromise,(()=>{const o=e._writable;if("erroring"===o._state)throw o._storedError;return Nr(r,t)})):Nr(r,t)}(e,t)}),(function(){return function(e){const t=e._readable,r=e._transformStreamController,o=r._flushAlgorithm();return Dr(r),m(o,(()=>{if("errored"===t._state)throw t._storedError;tr(t._readableStreamController)}),(r=>{throw Fr(e,r),t._storedError}))}(e)}),(function(t){return function(e,t){return Fr(e,t),d(void 0)}(e,t)}),r,o),e._readable=pr(a,(function(){return function(e){return Mr(e,!1),e._backpressureChangePromise}(e)}),(function(t){return Ir(e,t),d(void 0)}),n,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Mr(e,!0),e._transformStreamController=void 0}(this,c((e=>{h=e})),l,u,a,s),function(e,t){const r=Object.create(xr.prototype);let o=e=>{try{return Hr(r,e),d(void 0)}catch(e){return f(e)}},n=()=>d(void 0);void 0!==t.transform&&(o=e=>t.transform(e,r)),void 0!==t.flush&&(n=()=>t.flush(r)),function(e,t,r,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=o}(e,r,o,n)}(this,i),void 0!==i.start?h(i.start(this._transformStreamController)):h(void 0)}get readable(){if(!$r(this))throw Qr("readable");return this._readable}get writable(){if(!$r(this))throw Qr("writable");return this._writable}}function $r(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof Lr}function Fr(e,t){or(e._readable._readableStreamController,t),Ir(e,t)}function Ir(e,t){Dr(e._transformStreamController),kt(e._writable._writableStreamController,t),e._backpressure&&Mr(e,!1)}function Mr(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=c((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(Lr.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(Lr.prototype,t.toStringTag,{value:"TransformStream",configurable:!0});class xr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ur(this))throw Vr("desiredSize");return nr(this._controlledTransformStream._readable._readableStreamController)}enqueue(e){if(!Ur(this))throw Vr("enqueue");Hr(this,e)}error(e){if(!Ur(this))throw Vr("error");var t;t=e,Fr(this._controlledTransformStream,t)}terminate(){if(!Ur(this))throw Vr("terminate");!function(e){const t=e._controlledTransformStream;tr(t._readable._readableStreamController);Ir(t,new TypeError("TransformStream terminated"))}(this)}}function Ur(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof xr}function Dr(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function Hr(e,t){const r=e._controlledTransformStream,o=r._readable._readableStreamController;if(!ir(o))throw new TypeError("Readable side is not in a state that permits enqueue");try{rr(o,t)}catch(e){throw Ir(r,e),r._readable._storedError}const n=function(e){return!Xt(e)}(o);n!==r._backpressure&&Mr(r,!0)}function Nr(e,t){return m(e._transformAlgorithm(t),void 0,(t=>{throw Fr(e._controlledTransformStream,t),t}))}function Vr(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Qr(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(xr.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof t.toStringTag&&Object.defineProperty(xr.prototype,t.toStringTag,{value:"TransformStreamDefaultController",configurable:!0}),e.ByteLengthQueuingStrategy=Pr,e.CountQueuingStrategy=Br,e.ReadableByteStreamController=pe,e.ReadableStream=br,e.ReadableStreamBYOBReader=Ne,e.ReadableStreamBYOBRequest=be,e.ReadableStreamDefaultController=Kt,e.ReadableStreamDefaultReader=Z,e.TransformStream=Lr,e.TransformStreamDefaultController=xr,e.WritableStream=it,e.WritableStreamDefaultController=Et,e.WritableStreamDefaultWriter=_t,Object.defineProperty(e,"__esModule",{value:!0})},r(t)},7135:(e,t,r)=>{if(!globalThis.ReadableStream)try{const e=r(7742),{emitWarning:t}=e;try{e.emitWarning=()=>{},Object.assign(globalThis,r(2477)),e.emitWarning=t}catch(r){throw e.emitWarning=t,r}}catch(e){Object.assign(globalThis,r(2660))}try{const{Blob:e}=r(4300);e&&!e.prototype.stream&&(e.prototype.stream=function(e){let t=0;const r=this;return new ReadableStream({type:"bytes",async pull(e){const o=r.slice(t,Math.min(r.size,t+65536)),n=await o.arrayBuffer();t+=n.byteLength,e.enqueue(new Uint8Array(n)),t===r.size&&e.close()}})})}catch(e){}},7514:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AbortError:()=>M,FetchError:()=>h,Headers:()=>k,Request:()=>I,Response:()=>W,default:()=>U,isRedirect:()=>j});var o=r(3685),n=r(5687),i=r(9796),a=r(2781),s=r(5175),l=r(3837);async function*u(e,t=!0){for(const r of e)if("stream"in r)yield*r.stream();else if(ArrayBuffer.isView(r))if(t){let e=r.byteOffset;const t=r.byteOffset+r.byteLength;for(;e!==t;){const o=Math.min(t-e,65536),n=r.buffer.slice(e,e+o);e+=n.byteLength,yield new Uint8Array(n)}}else yield r;else{let e=0;for(;e!==r.size;){const t=r.slice(e,Math.min(r.size,e+65536)),o=await t.arrayBuffer();e+=o.byteLength,yield new Uint8Array(o)}}}r(7135);const c=class e{#e=[];#t="";#r=0;constructor(t=[],r={}){if("object"!=typeof t||null===t)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if("function"!=typeof t[Symbol.iterator])throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if("object"!=typeof r&&"function"!=typeof r)throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");null===r&&(r={});const o=new TextEncoder;for(const r of t){let t;t=ArrayBuffer.isView(r)?new Uint8Array(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)):r instanceof ArrayBuffer?new Uint8Array(r.slice(0)):r instanceof e?r:o.encode(r),this.#r+=ArrayBuffer.isView(t)?t.byteLength:t.size,this.#e.push(t)}const n=void 0===r.type?"":String(r.type);this.#t=/^[\x20-\x7E]*$/.test(n)?n:""}get size(){return this.#r}get type(){return this.#t}async text(){const e=new TextDecoder;let t="";for await(const r of u(this.#e,!1))t+=e.decode(r,{stream:!0});return t+=e.decode(),t}async arrayBuffer(){const e=new Uint8Array(this.size);let t=0;for await(const r of u(this.#e,!1))e.set(r,t),t+=r.length;return e.buffer}stream(){const e=u(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(t){const r=await e.next();r.done?t.close():t.enqueue(r.value)},async cancel(){await e.return()}})}slice(t=0,r=this.size,o=""){const{size:n}=this;let i=t<0?Math.max(n+t,0):Math.min(t,n),a=r<0?Math.max(n+r,0):Math.min(r,n);const s=Math.max(a-i,0),l=this.#e,u=[];let c=0;for(const e of l){if(c>=s)break;const t=ArrayBuffer.isView(e)?e.byteLength:e.size;if(i&&t<=i)i-=t,a-=t;else{let r;ArrayBuffer.isView(e)?(r=e.subarray(i,Math.min(t,a)),c+=r.byteLength):(r=e.slice(i,Math.min(t,a)),c+=r.size),a-=t,u.push(r),i=0}}const d=new e([],{type:String(o).toLowerCase()});return d.#r=s,d.#e=u,d}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](e){return e&&"object"==typeof e&&"function"==typeof e.constructor&&("function"==typeof e.stream||"function"==typeof e.arrayBuffer)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}};Object.defineProperties(c.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});const d=c;class f extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class h extends f{constructor(e,t,r){super(e,t),r&&(this.code=this.errno=r.code,this.erroredSysCall=r.syscall)}}var b=r(6113);const p=Symbol.toStringTag,y=e=>"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&"function"==typeof e.sort&&"URLSearchParams"===e[p],m=e=>"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&/^(Blob|File)$/.test(e[p]);function _(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.delete&&"function"==typeof e.keys&&"function"==typeof e.values&&"function"==typeof e.entries&&"function"==typeof e.constructor&&"FormData"===e[p]}const g="\r\n",w="-".repeat(2),v=Buffer.byteLength(g),S=e=>`${w}${e}${w}${g.repeat(2)}`;function T(e,t,r){let o="";return o+=`${w}${e}\r\n`,o+=`Content-Disposition: form-data; name="${t}"`,m(r)&&(o+=`; filename="${r.name}"\r\n`,o+=`Content-Type: ${r.type||"application/octet-stream"}`),`${o}${g.repeat(2)}`}const R=Symbol("Body internals");class E{constructor(e,{size:t=0}={}){let r=null;null===e?e=null:y(e)?e=Buffer.from(e.toString()):m(e)||Buffer.isBuffer(e)||(l.types.isAnyArrayBuffer(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof a||(_(e)?(r=`NodeFetchFormDataBoundary${(0,b.randomBytes)(8).toString("hex")}`,e=a.Readable.from(async function*(e,t){for(const[r,o]of e)yield T(t,r,o),m(o)?yield*o.stream():yield o,yield g;yield S(t)}(e,r))):e=Buffer.from(String(e)))),this[R]={body:e,boundary:r,disturbed:!1,error:null},this.size=t,e instanceof a&&e.on("error",(e=>{const t=e instanceof f?e:new h(`Invalid response body while trying to fetch ${this.url}: ${e.message}`,"system",e);this[R].error=t}))}get body(){return this[R].body}get bodyUsed(){return this[R].disturbed}async arrayBuffer(){const{buffer:e,byteOffset:t,byteLength:r}=await P(this);return e.slice(t,t+r)}async blob(){const e=this.headers&&this.headers.get("content-type")||this[R].body&&this[R].body.type||"",t=await this.buffer();return new d([t],{type:e})}async json(){const e=await P(this);return JSON.parse(e.toString())}async text(){return(await P(this)).toString()}buffer(){return P(this)}}async function P(e){if(e[R].disturbed)throw new TypeError(`body used already for: ${e.url}`);if(e[R].disturbed=!0,e[R].error)throw e[R].error;let{body:t}=e;if(null===t)return Buffer.alloc(0);if(m(t)&&(t=a.Readable.from(t.stream())),Buffer.isBuffer(t))return t;if(!(t instanceof a))return Buffer.alloc(0);const r=[];let o=0;try{for await(const n of t){if(e.size>0&&o+n.length>e.size){const r=new h(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw t.destroy(r),r}o+=n.length,r.push(n)}}catch(t){throw t instanceof f?t:new h(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t)}if(!0!==t.readableEnded&&!0!==t._readableState.ended)throw new h(`Premature close of server response while trying to fetch ${e.url}`);try{return r.every((e=>"string"==typeof e))?Buffer.from(r.join("")):Buffer.concat(r,o)}catch(t){throw new h(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t)}}Object.defineProperties(E.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}});const C=(e,t)=>{let r,o,{body:n}=e;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof a&&"function"!=typeof n.getBoundary&&(r=new a.PassThrough({highWaterMark:t}),o=new a.PassThrough({highWaterMark:t}),n.pipe(r),n.pipe(o),e[R].body=r,n=o),n},q=(e,t)=>null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":y(e)?"application/x-www-form-urlencoded;charset=UTF-8":m(e)?e.type||null:Buffer.isBuffer(e)||l.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e&&"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:_(e)?`multipart/form-data; boundary=${t[R].boundary}`:e instanceof a?null:"text/plain;charset=UTF-8",A="function"==typeof o.validateHeaderName?o.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){const t=new TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},B="function"==typeof o.validateHeaderValue?o.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){const t=new TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_CHAR"}),t}};class k extends URLSearchParams{constructor(e){let t=[];if(e instanceof k){const r=e.raw();for(const[e,o]of Object.entries(r))t.push(...o.map((t=>[e,t])))}else if(null==e);else{if("object"!=typeof e||l.types.isBoxedPrimitive(e))throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");{const r=e[Symbol.iterator];if(null==r)t.push(...Object.entries(e));else{if("function"!=typeof r)throw new TypeError("Header pairs must be iterable");t=[...e].map((e=>{if("object"!=typeof e||l.types.isBoxedPrimitive(e))throw new TypeError("Each header pair must be an iterable object");return[...e]})).map((e=>{if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");return[...e]}))}}}return t=t.length>0?t.map((([e,t])=>(A(e),B(e,String(t)),[String(e).toLowerCase(),String(t)]))):void 0,super(t),new Proxy(this,{get(e,t,r){switch(t){case"append":case"set":return(r,o)=>(A(r),B(r,String(o)),URLSearchParams.prototype[t].call(e,String(r).toLowerCase(),String(o)));case"delete":case"has":case"getAll":return r=>(A(r),URLSearchParams.prototype[t].call(e,String(r).toLowerCase()));case"keys":return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,r)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){const t=this.getAll(e);if(0===t.length)return null;let r=t.join(", ");return/^content-encoding$/i.test(e)&&(r=r.toLowerCase()),r}forEach(e,t){for(const r of this.keys())Reflect.apply(e,t,[this.get(r),r,this])}*values(){for(const e of this.keys())yield this.get(e)}*entries(){for(const e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((e,t)=>(e[t]=this.getAll(t),e)),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((e,t)=>{const r=this.getAll(t);return e[t]="host"===t?r[0]:r.length>1?r:r[0],e}),{})}}Object.defineProperties(k.prototype,["get","entries","forEach","values"].reduce(((e,t)=>(e[t]={enumerable:!0},e)),{}));const O=new Set([301,302,303,307,308]),j=e=>O.has(e),z=Symbol("Response internals");class W extends E{constructor(e=null,t={}){super(e,t);const r=null!=t.status?t.status:200,o=new k(t.headers);if(null!==e&&!o.has("Content-Type")){const t=q(e);t&&o.append("Content-Type",t)}this[z]={type:"default",url:t.url,status:r,statusText:t.statusText||"",headers:o,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[z].type}get url(){return this[z].url||""}get status(){return this[z].status}get ok(){return this[z].status>=200&&this[z].status<300}get redirected(){return this[z].counter>0}get statusText(){return this[z].statusText}get headers(){return this[z].headers}get highWaterMark(){return this[z].highWaterMark}clone(){return new W(C(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size})}static redirect(e,t=302){if(!j(t))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new W(null,{headers:{location:new URL(e).toString()},status:t})}static error(){const e=new W(null,{status:0,statusText:""});return e[z].type="error",e}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(W.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var L=r(7310);const $=Symbol("Request internals"),F=e=>"object"==typeof e&&"object"==typeof e[$];class I extends E{constructor(e,t={}){let r;F(e)?r=new URL(e.url):(r=new URL(e),e={});let o=t.method||e.method||"GET";if(o=o.toUpperCase(),(null!=t.body||F(e))&&null!==e.body&&("GET"===o||"HEAD"===o))throw new TypeError("Request with GET/HEAD method cannot have body");const n=t.body?t.body:F(e)&&null!==e.body?C(e):null;super(n,{size:t.size||e.size||0});const i=new k(t.headers||e.headers||{});if(null!==n&&!i.has("Content-Type")){const e=q(n,this);e&&i.append("Content-Type",e)}let a=F(e)?e.signal:null;if("signal"in t&&(a=t.signal),null!=a&&("object"!=typeof(s=a)||"AbortSignal"!==s[p]&&"EventTarget"!==s[p]))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");var s;this[$]={method:o,redirect:t.redirect||e.redirect||"follow",headers:i,parsedURL:r,signal:a},this.follow=void 0===t.follow?void 0===e.follow?20:e.follow:t.follow,this.compress=void 0===t.compress?void 0===e.compress||e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1}get method(){return this[$].method}get url(){return(0,L.format)(this[$].parsedURL)}get headers(){return this[$].headers}get redirect(){return this[$].redirect}get signal(){return this[$].signal}clone(){return new I(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(I.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});class M extends f{constructor(e,t="aborted"){super(e,t)}}const x=new Set(["data:","http:","https:"]);async function U(e,t){return new Promise(((r,l)=>{const u=new I(e,t),c=(e=>{const{parsedURL:t}=e[$],r=new k(e[$].headers);r.has("Accept")||r.set("Accept","*/*");let o=null;if(null===e.body&&/^(post|put)$/i.test(e.method)&&(o="0"),null!==e.body){const t=(e=>{const{body:t}=e;return null===t?0:m(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync?t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null:_(t)?function(e,t){let r=0;for(const[o,n]of e)r+=Buffer.byteLength(T(t,o,n)),r+=m(n)?n.size:Buffer.byteLength(String(n)),r+=v;return r+=Buffer.byteLength(S(t)),r}(e[R].boundary):null})(e);"number"!=typeof t||Number.isNaN(t)||(o=String(t))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate,br");let{agent:n}=e;"function"==typeof n&&(n=n(t)),r.has("Connection")||n||r.set("Connection","close");const i=(e=>{if(e.search)return e.search;const t=e.href.length-1,r=e.hash||("#"===e.href[t]?"#":"");return"?"===e.href[t-r.length]?"?":""})(t);return{path:t.pathname+i,pathname:t.pathname,hostname:t.hostname,protocol:t.protocol,port:t.port,hash:t.hash,search:t.search,query:t.query,href:t.href,method:e.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n}})(u);if(!x.has(c.protocol))throw new TypeError(`node-fetch cannot load ${e}. URL scheme "${c.protocol.replace(/:$/,"")}" is not supported.`);if("data:"===c.protocol){const e=s(u.url),t=new W(e,{headers:{"Content-Type":e.typeFull}});return void r(t)}const d=("https:"===c.protocol?n:o).request,{signal:f}=u;let b=null;const p=()=>{const e=new M("The operation was aborted.");l(e),u.body&&u.body instanceof a.Readable&&u.body.destroy(e),b&&b.body&&b.body.emit("error",e)};if(f&&f.aborted)return void p();const y=()=>{p(),w()},g=d(c);f&&f.addEventListener("abort",y);const w=()=>{g.abort(),f&&f.removeEventListener("abort",y)};g.on("error",(e=>{l(new h(`request to ${u.url} failed, reason: ${e.message}`,"system",e)),w()})),function(e,t){const r=Buffer.from("0\r\n\r\n");let o,n=!1,i=!1;e.on("response",(e=>{const{headers:t}=e;n="chunked"===t["transfer-encoding"]&&!t["content-length"]})),e.on("socket",(t=>{const a=()=>{if(n&&!i){const e=new Error("Premature close");e.code="ERR_STREAM_PREMATURE_CLOSE",(e=>{b.body.destroy(e)})(e)}};t.prependListener("close",a),e.on("abort",(()=>{t.removeListener("close",a)})),t.on("data",(e=>{i=0===Buffer.compare(e.slice(-5),r),!i&&o&&(i=0===Buffer.compare(o.slice(-3),r.slice(0,3))&&0===Buffer.compare(e.slice(-2),r.slice(3))),o=e}))}))}(g),process.version<"v14"&&g.on("socket",(e=>{let t;e.prependListener("end",(()=>{t=e._eventsCount})),e.prependListener("close",(r=>{if(b&&t<e._eventsCount&&!r){const e=new Error("Premature close");e.code="ERR_STREAM_PREMATURE_CLOSE",b.body.emit("error",e)}}))})),g.on("response",(e=>{g.setTimeout(0);const o=function(e=[]){return new k(e.reduce(((e,t,r,o)=>(r%2==0&&e.push(o.slice(r,r+2)),e)),[]).filter((([e,t])=>{try{return A(e),B(e,String(t)),!0}catch{return!1}})))}(e.rawHeaders);if(j(e.statusCode)){const n=o.get("Location"),i=null===n?null:new URL(n,u.url);switch(u.redirect){case"error":return l(new h(`uri requested responds with a redirect, redirect mode is set to error: ${u.url}`,"no-redirect")),void w();case"manual":null!==i&&o.set("Location",i);break;case"follow":{if(null===i)break;if(u.counter>=u.follow)return l(new h(`maximum redirect reached at: ${u.url}`,"max-redirect")),void w();const o={headers:new k(u.headers),follow:u.follow,counter:u.counter+1,agent:u.agent,compress:u.compress,method:u.method,body:u.body,signal:u.signal,size:u.size};return 303!==e.statusCode&&u.body&&t.body instanceof a.Readable?(l(new h("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void w()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==u.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(U(new I(i,o))),void w())}default:return l(new TypeError(`Redirect option '${u.redirect}' is not a valid value of RequestRedirect`))}}f&&e.once("end",(()=>{f.removeEventListener("abort",y)}));let n=(0,a.pipeline)(e,new a.PassThrough,l);process.version<"v12.10"&&e.on("aborted",y);const s={url:u.url,status:e.statusCode,statusText:e.statusMessage,headers:o,size:u.size,counter:u.counter,highWaterMark:u.highWaterMark},c=o.get("Content-Encoding");if(!u.compress||"HEAD"===u.method||null===c||204===e.statusCode||304===e.statusCode)return b=new W(n,s),void r(b);const d={flush:i.Z_SYNC_FLUSH,finishFlush:i.Z_SYNC_FLUSH};if("gzip"===c||"x-gzip"===c)return n=(0,a.pipeline)(n,i.createGunzip(d),l),b=new W(n,s),void r(b);if("deflate"!==c&&"x-deflate"!==c){if("br"===c)return n=(0,a.pipeline)(n,i.createBrotliDecompress(),l),b=new W(n,s),void r(b);b=new W(n,s),r(b)}else(0,a.pipeline)(e,new a.PassThrough,l).once("data",(e=>{n=8==(15&e[0])?(0,a.pipeline)(n,i.createInflate(),l):(0,a.pipeline)(n,i.createInflateRaw(),l),b=new W(n,s),r(b)}))})),((e,{body:t})=>{null===t?e.end():m(t)?a.Readable.from(t.stream()).pipe(e):Buffer.isBuffer(t)?(e.write(t),e.end()):t.pipe(e)})(g,u)}))}}};