Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stardazed/streams-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stardazed/streams-polyfill - npm Package Compare versions

Comparing version 1.0.7 to 2.0.0

9

CHANGELOG.md
# @stardazed/streams-polyfill changelog
## 2.0.0
_2019-01-16_
* BREAKING: no longer provides full types for stream types, now requires TS 3.2 or newer.
* Supports the AbortSignal `signal` field in the PipeOptions for ReadableStream's pipeTo and pipeThrough methods to manually
abort pipe operations.
* Incorporate changes to streams spec up to 2019-01-16
## 1.0.7

@@ -8,3 +15,3 @@ _2018-10-01_

## 1.0.6
_2018_09_19_
_2018-09-19_
* Add combined TypeScript types to this package so they will be accessible when using polyfill only

@@ -11,0 +18,0 @@

130

dist/sd-streams-polyfill.d.ts
/**
* @stardazed/streams-polyfill - drop-in polyfill for Web Streams with fetch and encoding integration
* Part of Stardazed
* (c) 2018 by Arthur Langereis - @zenmumbler
* (c) 2018-Present by Arthur Langereis - @zenmumbler
* https://github.com/stardazed/sd-streams
*/
/* Types from @stardazed/streams */
interface ReadableStreamController {
close(): void;
error(e?: any): void;
readonly desiredSize: number | null;
// extend PipeOptions interface with signal
declare global {
interface PipeOptions {
signal?: AbortSignal;
}
}
interface ReadableStreamDefaultController extends ReadableStreamController {
enqueue(chunk: any): void;
}
interface ReadableByteStreamController extends ReadableStreamController {
enqueue(chunk: any): void;
readonly byobRequest: ReadableStreamBYOBRequest | undefined;
}
interface ReadableStreamBYOBRequest {
respond(bytesWritten: number): void;
respondWithNewView(view: ArrayBufferView): void;
readonly view: ArrayBufferView;
}
interface ReadableStreamReaderSD {
cancel(reason: any): Promise<void>;
releaseLock(): void;
readonly closed: Promise<void>;
}
interface ReadableStreamDefaultReader extends ReadableStreamReaderSD {
read(): Promise<IteratorResult<any>>;
}
interface ReadableStreamBYOBReader extends ReadableStreamReaderSD {
read(view: ArrayBufferView): Promise<IteratorResult<ArrayBufferView>>;
}
interface ReadableStreamSource<Controller extends ReadableStreamController = ReadableStreamDefaultController> {
start?(controller: Controller): void | Promise<void>;
pull?(controller: Controller): void | Promise<void>;
cancel?(reason?: any): void;
type?: "bytes" | undefined;
autoAllocateChunkSize?: number; // only for "bytes" type sources
}
interface PipeToOptions {
preventClose?: boolean;
preventAbort?: boolean;
preventCancel?: boolean;
}
interface StreamTransform {
readable: ReadableStream;
writable: WritableStream;
}
interface ReadableStream {
cancel(reason?: any): Promise<void>;
getReader(): ReadableStreamDefaultReader;
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
tee(): ReadableStream[];
pipeThrough(transform: StreamTransform, options?: PipeToOptions): ReadableStream;
pipeTo(dest: WritableStream, options?: PipeToOptions): Promise<void>;
readonly locked: boolean;
}
/*
[AL] Cannot override declared var with a differently shaped object. This will have to be fixed in the TS default lib.
declare var ReadableStream: {
prototype: ReadableStream;
new(source?: ReadableStreamSource, strategy?: QueuingStrategy): ReadableStream;
}
*/
// ---- TransformStream
interface TransformStreamDefaultController {
enqueue(chunk: any): void;
error(reason: any): void;
terminate(): void;
readonly desiredSize: number | null;
}
interface Transformer {
start?(controller: TransformStreamDefaultController): void | Promise<void>;
transform?(chunk: any, controller: TransformStreamDefaultController): void | Promise<void>;
flush?(controller: TransformStreamDefaultController): void | Promise<void>;
readableType?: undefined; // for future spec changes
writableType?: undefined; // for future spec changes
}
declare class TransformStream {
constructor(transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy);
readonly readable: ReadableStream;
readonly writable: WritableStream;
}
/* Types from @stardazed/streams-text-encoding */
declare class TextDecoderStream {
constructor(label?: string, options?: TextDecoderOptions);
readonly encoding: string;
readonly fatal: boolean;
readonly ignoreBOM: boolean;
readonly readable: ReadableStream;
readonly writable: WritableStream;
}
declare class TextEncoderStream {
constructor();
readonly encoding: string;
readonly readable: ReadableStream;
readonly writable: WritableStream;
}
/**
* @stardazed/streams-polyfill - drop-in polyfill for Web Streams with fetch and encoding integration
* Part of Stardazed
* (c) 2018 by Arthur Langereis - @zenmumbler
* (c) 2018-Present by Arthur Langereis - @zenmumbler
* https://github.com/stardazed/sd-streams
*/
!function(){"use strict";const state_=Symbol("state_"),storedError_=Symbol("storedError_");function isInteger(e){if(!isFinite(e))return!1;const r=Math.abs(e);return Math.floor(r)===r}function isFiniteNonNegativeNumber(e){return!("number"!=typeof e||!isFinite(e))&&e>=0}function invokeOrNoop(e,r,t){const a=e[r];if(void 0!==a)return Function.prototype.apply.call(a,e,t)}function cloneArrayBuffer(e,r,t,a){return e.slice(r,r+t)}function transferArrayBuffer(e){return e.slice(0)}function copyDataBlockBytes(e,r,t,a,o){new Uint8Array(e,r,o).set(new Uint8Array(t,a,o))}const objectCloneMemo=new WeakMap;let sharedArrayBufferSupported_;function supportsSharedArrayBuffer(){if(void 0===sharedArrayBufferSupported_)try{new SharedArrayBuffer(16),sharedArrayBufferSupported_=!0}catch(e){sharedArrayBufferSupported_=!1}return sharedArrayBufferSupported_}function cloneValue(e){switch(typeof e){case"number":case"string":case"boolean":case"undefined":case"bigint":return e;case"object":{if(objectCloneMemo.has(e))return objectCloneMemo.get(e);if(null===e)return e;if(e instanceof Date)return new Date(e.valueOf());if(e instanceof RegExp)return new RegExp(e);if(supportsSharedArrayBuffer()&&e instanceof SharedArrayBuffer)return e;if(e instanceof ArrayBuffer){const r=cloneArrayBuffer(e,0,e.byteLength,ArrayBuffer);return objectCloneMemo.set(e,r),r}if(ArrayBuffer.isView(e)){const r=cloneValue(e.buffer);let t;return t=e instanceof DataView?e.byteLength:e.length,new e.constructor(r,e.byteOffset,t)}if(e instanceof Map){const r=new Map;return objectCloneMemo.set(e,r),e.forEach((e,t)=>r.set(t,cloneValue(e))),r}if(e instanceof Set){const r=new Map;return objectCloneMemo.set(e,r),e.forEach((e,t)=>r.set(t,cloneValue(e))),r}const r={};objectCloneMemo.set(e,r);const t=Object.getOwnPropertyNames(e);for(const a of t)r[a]=cloneValue(e[a]);return r}case"symbol":case"function":default:throw new DOMException("Uncloneable value in stream","DataCloneError")}}function promiseCall(e,r,t){try{const a=Function.prototype.apply.call(e,r,t);return Promise.resolve(a)}catch(e){return Promise.reject(e)}}function createAlgorithmFromUnderlyingMethod(e,r,t){const a=e[r];if(void 0===a)return()=>Promise.resolve(void 0);if("function"!=typeof a)throw new TypeError(`Field "${r}" is not a function.`);return function(...r){return promiseCall(a,e,r.concat(t))}}function validateAndNormalizeHighWaterMark(e){const r=Number(e);if(isNaN(r)||r<0)throw new RangeError("highWaterMark must be a valid, non-negative integer.");return r}function makeSizeAlgorithmFromSizeFunction(e){if("function"!=typeof e&&void 0!==e)throw new TypeError("size function must be undefined or a function");return function(r){return"function"==typeof e?e(r):1}}var ControlledPromiseState;function createControlledPromise(){const e={state:ControlledPromiseState.Pending};return e.promise=new Promise(function(r,t){e.resolve=function(t){e.state=ControlledPromiseState.Resolved,r(t)},e.reject=function(r){e.state=ControlledPromiseState.Rejected,t(r)}}),e}!function(e){e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected"}(ControlledPromiseState||(ControlledPromiseState={}));const CHUNK_SIZE=16384;class QueueImpl{constructor(){this.chunks_=[[]],this.readChunk_=this.writeChunk_=this.chunks_[0],this.length_=0}push(e){this.writeChunk_.push(e),this.length_+=1,this.writeChunk_.length===CHUNK_SIZE&&(this.writeChunk_=[],this.chunks_.push(this.writeChunk_))}front(){if(0!==this.length_)return this.readChunk_[0]}shift(){if(0===this.length_)return;const e=this.readChunk_.shift();return this.length_-=1,0===this.readChunk_.length&&this.readChunk_!==this.writeChunk_&&(this.chunks_.shift(),this.readChunk_=this.chunks_[0]),e}get length(){return this.length_}}const queue_=Symbol("queue_"),queueTotalSize_=Symbol("queueTotalSize_");function dequeueValue(e){const r=e[queue_].shift(),t=e[queueTotalSize_]-r.size;return e[queueTotalSize_]=Math.max(0,t),r.value}function enqueueValueWithSize(e,r,t){if(!isFiniteNonNegativeNumber(t))throw new RangeError("Chunk size must be a non-negative, finite numbers");e[queue_].push({value:r,size:t}),e[queueTotalSize_]+=t}function peekQueueValue(e){return e[queue_].front().value}function resetQueue(e){e[queue_]=new QueueImpl,e[queueTotalSize_]=0}const controlledReadableStream_=Symbol("controlledReadableStream_"),pullAlgorithm_=Symbol("pullAlgorithm_"),cancelAlgorithm_=Symbol("cancelAlgorithm_"),strategySizeAlgorithm_=Symbol("strategySizeAlgorithm_"),strategyHWM_=Symbol("strategyHWM_"),started_=Symbol("started_"),closeRequested_=Symbol("closeRequested_"),pullAgain_=Symbol("pullAgain_"),pulling_=Symbol("pulling_"),cancelSteps_=Symbol("cancelSteps_"),pullSteps_=Symbol("pullSteps_"),autoAllocateChunkSize_=Symbol("autoAllocateChunkSize_"),byobRequest_=Symbol("byobRequest_"),controlledReadableByteStream_=Symbol("controlledReadableByteStream_"),pendingPullIntos_=Symbol("pendingPullIntos_"),closedPromise_=Symbol("closedPromise_"),ownerReadableStream_=Symbol("ownerReadableStream_"),readRequests_=Symbol("readRequests_"),readIntoRequests_=Symbol("readIntoRequests_"),associatedReadableByteStreamController_=Symbol("associatedReadableByteStreamController_"),view_=Symbol("view_"),reader_=Symbol("reader_"),readableStreamController_=Symbol("readableStreamController_");function initializeReadableStream(e){e[state_]="readable",e[reader_]=void 0,e[storedError_]=void 0,e[readableStreamController_]=void 0}function isReadableStream(e){return null!=e&&"object"==typeof e&&readableStreamController_ in e}function isReadableStreamLocked(e){return void 0!==e[reader_]}function readableStreamGetNumReadIntoRequests(e){const r=e[reader_];return void 0===r?0:r[readIntoRequests_].length}function readableStreamGetNumReadRequests(e){const r=e[reader_];return void 0===r?0:r[readRequests_].length}function readableStreamCreateReadResult(e,r,t){const a=t?Object.prototype:null,o=Object.create(a);return o.value=e,o.done=r,o}function readableStreamAddReadIntoRequest(e,r){const t=e[reader_],a=createControlledPromise();return a.forAuthorCode=r,t[readIntoRequests_].push(a),a.promise}function readableStreamAddReadRequest(e,r){const t=e[reader_],a=createControlledPromise();return a.forAuthorCode=r,t[readRequests_].push(a),a.promise}function readableStreamHasBYOBReader(e){return isReadableStreamBYOBReader(e[reader_])}function readableStreamHasDefaultReader(e){return isReadableStreamDefaultReader(e[reader_])}function readableStreamCancel(e,r){if("closed"===e[state_])return Promise.resolve(void 0);if("errored"===e[state_])return Promise.reject(e[storedError_]);return readableStreamClose(e),e[readableStreamController_][cancelSteps_](r).then(e=>void 0)}function readableStreamClose(e){e[state_]="closed";const r=e[reader_];if(void 0!==r){if(isReadableStreamDefaultReader(r)){for(const e of r[readRequests_])e.resolve(readableStreamCreateReadResult(void 0,!0,e.forAuthorCode));r[readRequests_]=[]}r[closedPromise_].resolve(),r[closedPromise_].promise.catch(()=>{})}}function readableStreamError(e,r){if("readable"!==e[state_])throw new RangeError("Stream is in an invalid state");e[state_]="errored",e[storedError_]=r;const t=e[reader_];if(void 0!==t){if(isReadableStreamDefaultReader(t)){for(const e of t[readRequests_])e.reject(r);t[readRequests_]=[]}else{const e=t[readIntoRequests_];for(const t of e)t.reject(r);t[readIntoRequests_]=[]}t[closedPromise_].reject(r)}}function isReadableStreamDefaultReader(e){return null!=e&&"object"==typeof e&&readRequests_ in e}function isReadableStreamBYOBReader(e){return null!=e&&"object"==typeof e&&readIntoRequests_ in e}function readableStreamReaderGenericInitialize(e,r){e[ownerReadableStream_]=r,r[reader_]=e;const t=r[state_];e[closedPromise_]=createControlledPromise(),"readable"===t||("closed"===t?e[closedPromise_].resolve(void 0):(e[closedPromise_].reject(r[storedError_]),e[closedPromise_].promise.catch(()=>{})))}function readableStreamReaderGenericRelease(e){const r=e[ownerReadableStream_];if(void 0===r)throw new TypeError("Reader is in an inconsistent state");"readable"===r[state_]||(e[closedPromise_]=createControlledPromise()),e[closedPromise_].reject(new TypeError),e[closedPromise_].promise.catch(()=>{}),r[reader_]=void 0,e[ownerReadableStream_]=void 0}function readableStreamBYOBReaderRead(e,r,t=!1){const a=e[ownerReadableStream_];return"errored"===a[state_]?Promise.reject(a[storedError_]):readableByteStreamControllerPullInto(a[readableStreamController_],r,t)}function readableStreamDefaultReaderRead(e,r=!1){const t=e[ownerReadableStream_];return"closed"===t[state_]?Promise.resolve(readableStreamCreateReadResult(void 0,!0,r)):"errored"===t[state_]?Promise.reject(t[storedError_]):t[readableStreamController_][pullSteps_](r)}function readableStreamFulfillReadIntoRequest(e,r,t){const a=e[reader_][readIntoRequests_].shift();a.resolve(readableStreamCreateReadResult(r,t,a.forAuthorCode))}function readableStreamFulfillReadRequest(e,r,t){const a=e[reader_][readRequests_].shift();a.resolve(readableStreamCreateReadResult(r,t,a.forAuthorCode))}function setUpReadableStreamDefaultController(e,r,t,a,o,l,n){r[controlledReadableStream_]=e,resetQueue(r),r[started_]=!1,r[closeRequested_]=!1,r[pullAgain_]=!1,r[pulling_]=!1,r[strategySizeAlgorithm_]=n,r[strategyHWM_]=l,r[pullAlgorithm_]=a,r[cancelAlgorithm_]=o,e[readableStreamController_]=r;const i=t();Promise.resolve(i).then(e=>{r[started_]=!0,readableStreamDefaultControllerCallPullIfNeeded(r)},e=>{readableStreamDefaultControllerError(r,e)})}function isReadableStreamDefaultController(e){return null!=e&&"object"==typeof e&&controlledReadableStream_ in e}function readableStreamDefaultControllerHasBackpressure(e){return!readableStreamDefaultControllerShouldCallPull(e)}function readableStreamDefaultControllerCanCloseOrEnqueue(e){const r=e[controlledReadableStream_][state_];return!1===e[closeRequested_]&&"readable"===r}function readableStreamDefaultControllerGetDesiredSize(e){const r=e[controlledReadableStream_][state_];return"errored"===r?null:"closed"===r?0:e[strategyHWM_]-e[queueTotalSize_]}function readableStreamDefaultControllerClose(e){e[closeRequested_]=!0;const r=e[controlledReadableStream_];0===e[queue_].length&&(readableStreamDefaultControllerClearAlgorithms(e),readableStreamClose(r))}function readableStreamDefaultControllerEnqueue(e,r){const t=e[controlledReadableStream_];if(isReadableStreamLocked(t)&&readableStreamGetNumReadRequests(t)>0)readableStreamFulfillReadRequest(t,r,!1);else{let t;try{t=e[strategySizeAlgorithm_](r)}catch(r){throw readableStreamDefaultControllerError(e,r),r}try{enqueueValueWithSize(e,r,t)}catch(r){throw readableStreamDefaultControllerError(e,r),r}}readableStreamDefaultControllerCallPullIfNeeded(e)}function readableStreamDefaultControllerError(e,r){const t=e[controlledReadableStream_];"readable"===t[state_]&&(resetQueue(e),readableStreamDefaultControllerClearAlgorithms(e),readableStreamError(t,r))}function readableStreamDefaultControllerCallPullIfNeeded(e){if(readableStreamDefaultControllerShouldCallPull(e))if(e[pulling_])e[pullAgain_]=!0;else{if(e[pullAgain_])throw new RangeError("Stream controller is in an invalid state.");e[pulling_]=!0,e[pullAlgorithm_](e).then(r=>{e[pulling_]=!1,e[pullAgain_]&&(e[pullAgain_]=!1,readableStreamDefaultControllerCallPullIfNeeded(e))},r=>{readableStreamDefaultControllerError(e,r)})}}function readableStreamDefaultControllerShouldCallPull(e){const r=e[controlledReadableStream_];if(!readableStreamDefaultControllerCanCloseOrEnqueue(e))return!1;if(!1===e[started_])return!1;if(isReadableStreamLocked(r)&&readableStreamGetNumReadRequests(r)>0)return!0;const t=readableStreamDefaultControllerGetDesiredSize(e);if(null===t)throw new RangeError("Stream is in an invalid state.");return t>0}function readableStreamDefaultControllerClearAlgorithms(e){e[pullAlgorithm_]=void 0,e[cancelAlgorithm_]=void 0,e[strategySizeAlgorithm_]=void 0}function setUpReadableByteStreamController(e,r,t,a,o,l,n){if(void 0!==e[readableStreamController_])throw new TypeError("Cannot reuse streams");if(void 0!==n&&(!isInteger(n)||n<=0))throw new RangeError("autoAllocateChunkSize must be a positive, finite integer");r[controlledReadableByteStream_]=e,r[pullAgain_]=!1,r[pulling_]=!1,readableByteStreamControllerClearPendingPullIntos(r),resetQueue(r),r[closeRequested_]=!1,r[started_]=!1,r[strategyHWM_]=validateAndNormalizeHighWaterMark(l),r[pullAlgorithm_]=a,r[cancelAlgorithm_]=o,r[autoAllocateChunkSize_]=n,r[pendingPullIntos_]=[],e[readableStreamController_]=r;const i=t();Promise.resolve(i).then(e=>{r[started_]=!0,readableByteStreamControllerCallPullIfNeeded(r)},e=>{readableByteStreamControllerError(r,e)})}function isReadableStreamBYOBRequest(e){return null!=e&&"object"==typeof e&&associatedReadableByteStreamController_ in e}function isReadableByteStreamController(e){return null!=e&&"object"==typeof e&&controlledReadableByteStream_ in e}function readableByteStreamControllerCallPullIfNeeded(e){readableByteStreamControllerShouldCallPull(e)&&(e[pulling_]?e[pullAgain_]=!0:(e[pulling_]=!0,e[pullAlgorithm_](e).then(r=>{e[pulling_]=!1,e[pullAgain_]&&(e[pullAgain_]=!1,readableByteStreamControllerCallPullIfNeeded(e))},r=>{readableByteStreamControllerError(e,r)})))}function readableByteStreamControllerClearAlgorithms(e){e[pullAlgorithm_]=void 0,e[cancelAlgorithm_]=void 0}function readableByteStreamControllerClearPendingPullIntos(e){readableByteStreamControllerInvalidateBYOBRequest(e),e[pendingPullIntos_]=[]}function readableByteStreamControllerClose(e){const r=e[controlledReadableByteStream_];if(e[queueTotalSize_]>0)e[closeRequested_]=!0;else{if(e[pendingPullIntos_].length>0){if(e[pendingPullIntos_][0].bytesFilled>0){const r=new TypeError;throw readableByteStreamControllerError(e,r),r}}readableByteStreamControllerClearAlgorithms(e),readableStreamClose(r)}}function readableByteStreamControllerCommitPullIntoDescriptor(e,r){let t=!1;"closed"===e[state_]&&(t=!0);const a=readableByteStreamControllerConvertPullIntoDescriptor(r);"default"===r.readerType?readableStreamFulfillReadRequest(e,a,t):readableStreamFulfillReadIntoRequest(e,a,t)}function readableByteStreamControllerConvertPullIntoDescriptor(e){const{bytesFilled:r,elementSize:t}=e;return new e.ctor(e.buffer,e.byteOffset,r/t)}function readableByteStreamControllerEnqueue(e,r){const t=e[controlledReadableByteStream_],{buffer:a,byteOffset:o,byteLength:l}=r,n=transferArrayBuffer(a);if(readableStreamHasDefaultReader(t))if(0===readableStreamGetNumReadRequests(t))readableByteStreamControllerEnqueueChunkToQueue(e,n,o,l);else{readableStreamFulfillReadRequest(t,new Uint8Array(n,o,l),!1)}else readableStreamHasBYOBReader(t)?(readableByteStreamControllerEnqueueChunkToQueue(e,n,o,l),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)):readableByteStreamControllerEnqueueChunkToQueue(e,n,o,l);readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerEnqueueChunkToQueue(e,r,t,a){e[queue_].push({buffer:r,byteOffset:t,byteLength:a}),e[queueTotalSize_]+=a}function readableByteStreamControllerError(e,r){const t=e[controlledReadableByteStream_];"readable"===t[state_]&&(readableByteStreamControllerClearPendingPullIntos(e),resetQueue(e),readableByteStreamControllerClearAlgorithms(e),readableStreamError(t,r))}function readableByteStreamControllerFillHeadPullIntoDescriptor(e,r,t){readableByteStreamControllerInvalidateBYOBRequest(e),t.bytesFilled+=r}function readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,r){const t=r.elementSize,a=r.bytesFilled-r.bytesFilled%t,o=Math.min(e[queueTotalSize_],r.byteLength-r.bytesFilled),l=r.bytesFilled+o,n=l-l%t;let i=o,s=!1;n>a&&(i=n-r.bytesFilled,s=!0);const u=e[queue_];for(;i>0;){const t=u.front(),a=Math.min(i,t.byteLength),o=r.byteOffset+r.bytesFilled;copyDataBlockBytes(r.buffer,o,t.buffer,t.byteOffset,a),t.byteLength===a?u.shift():(t.byteOffset+=a,t.byteLength-=a),e[queueTotalSize_]-=a,readableByteStreamControllerFillHeadPullIntoDescriptor(e,a,r),i-=a}return s}function readableByteStreamControllerGetDesiredSize(e){const r=e[controlledReadableByteStream_][state_];return"errored"===r?null:"closed"===r?0:e[strategyHWM_]-e[queueTotalSize_]}function readableByteStreamControllerHandleQueueDrain(e){0===e[queueTotalSize_]&&e[closeRequested_]?(readableByteStreamControllerClearAlgorithms(e),readableStreamClose(e[controlledReadableByteStream_])):readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerInvalidateBYOBRequest(e){const r=e[byobRequest_];void 0!==r&&(r[associatedReadableByteStreamController_]=void 0,r[view_]=void 0,e[byobRequest_]=void 0)}function readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e){const r=e[pendingPullIntos_];for(;r.length>0;){if(0===e[queueTotalSize_])return;const t=r[0];readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,t)&&(readableByteStreamControllerShiftPendingPullInto(e),readableByteStreamControllerCommitPullIntoDescriptor(e[controlledReadableByteStream_],t))}}function readableByteStreamControllerPullInto(e,r,t){const a=e[controlledReadableByteStream_],o=r.BYTES_PER_ELEMENT||1,l=r.constructor,n=r.byteOffset,i=r.byteLength,s={buffer:transferArrayBuffer(r.buffer),byteOffset:n,byteLength:i,bytesFilled:0,elementSize:o,ctor:l,readerType:"byob"};if(e[pendingPullIntos_].length>0)return e[pendingPullIntos_].push(s),readableStreamAddReadIntoRequest(a,t);if("closed"===a[state_]){const e=new l(s.buffer,s.byteOffset,0);return Promise.resolve(readableStreamCreateReadResult(e,!0,t))}if(e[queueTotalSize_]>0){if(readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,s)){const r=readableByteStreamControllerConvertPullIntoDescriptor(s);return readableByteStreamControllerHandleQueueDrain(e),Promise.resolve(readableStreamCreateReadResult(r,!1,t))}if(e[closeRequested_]){const r=new TypeError;return readableByteStreamControllerError(e,r),Promise.reject(r)}}e[pendingPullIntos_].push(s);const u=readableStreamAddReadIntoRequest(a,t);return readableByteStreamControllerCallPullIfNeeded(e),u}function readableByteStreamControllerRespond(e,r){if(!isFiniteNonNegativeNumber(r=Number(r)))throw new RangeError("bytesWritten must be a finite, non-negative number");readableByteStreamControllerRespondInternal(e,r)}function readableByteStreamControllerRespondInClosedState(e,r){r.buffer=transferArrayBuffer(r.buffer);const t=e[controlledReadableByteStream_];if(readableStreamHasBYOBReader(t))for(;readableStreamGetNumReadIntoRequests(t)>0;){readableByteStreamControllerCommitPullIntoDescriptor(t,readableByteStreamControllerShiftPendingPullInto(e))}}function readableByteStreamControllerRespondInReadableState(e,r,t){if(t.bytesFilled+r>t.byteLength)throw new RangeError;if(readableByteStreamControllerFillHeadPullIntoDescriptor(e,r,t),t.bytesFilled<t.elementSize)return;readableByteStreamControllerShiftPendingPullInto(e);const a=t.bytesFilled%t.elementSize;if(a>0){const r=t.byteOffset+t.bytesFilled,o=cloneArrayBuffer(t.buffer,r-a,a,ArrayBuffer);readableByteStreamControllerEnqueueChunkToQueue(e,o,0,o.byteLength)}t.buffer=transferArrayBuffer(t.buffer),t.bytesFilled=t.bytesFilled-a,readableByteStreamControllerCommitPullIntoDescriptor(e[controlledReadableByteStream_],t),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)}function readableByteStreamControllerRespondInternal(e,r){const t=e[pendingPullIntos_][0];if("closed"===e[controlledReadableByteStream_][state_]){if(0!==r)throw new TypeError;readableByteStreamControllerRespondInClosedState(e,t)}else readableByteStreamControllerRespondInReadableState(e,r,t);readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerRespondWithNewView(e,r){const t=e[pendingPullIntos_][0];if(t.byteOffset+t.bytesFilled!==r.byteOffset)throw new RangeError;if(t.byteLength!==r.byteLength)throw new RangeError;t.buffer=r.buffer,readableByteStreamControllerRespondInternal(e,r.byteLength)}function readableByteStreamControllerShiftPendingPullInto(e){const r=e[pendingPullIntos_].shift();return readableByteStreamControllerInvalidateBYOBRequest(e),r}function readableByteStreamControllerShouldCallPull(e){const r=e[controlledReadableByteStream_];return"readable"===r[state_]&&(!e[closeRequested_]&&(!!e[started_]&&(!!(readableStreamHasDefaultReader(r)&&readableStreamGetNumReadRequests(r)>0)||(!!(readableStreamHasBYOBReader(r)&&readableStreamGetNumReadIntoRequests(r)>0)||readableByteStreamControllerGetDesiredSize(e)>0))))}function setUpReadableStreamBYOBRequest(e,r,t){if(!isReadableByteStreamController(r))throw new TypeError;if(!ArrayBuffer.isView(t))throw new TypeError;e[associatedReadableByteStreamController_]=r,e[view_]=t}const backpressure_=Symbol("backpressure_"),closeRequest_=Symbol("closeRequest_"),inFlightWriteRequest_=Symbol("inFlightWriteRequest_"),inFlightCloseRequest_=Symbol("inFlightCloseRequest_"),pendingAbortRequest_=Symbol("pendingAbortRequest_"),writableStreamController_=Symbol("writableStreamController_"),writer_=Symbol("writer_"),writeRequests_=Symbol("writeRequests_"),abortAlgorithm_=Symbol("abortAlgorithm_"),closeAlgorithm_=Symbol("closeAlgorithm_"),controlledWritableStream_=Symbol("controlledWritableStream_"),started_$1=Symbol("started_"),strategyHWM_$1=Symbol("strategyHWM_"),strategySizeAlgorithm_$1=Symbol("strategySizeAlgorithm_"),writeAlgorithm_=Symbol("writeAlgorithm_"),ownerWritableStream_=Symbol("ownerWritableStream_"),closedPromise_$1=Symbol("closedPromise_"),readyPromise_=Symbol("readyPromise_"),errorSteps_=Symbol("errorSteps_"),abortSteps_=Symbol("abortSteps_");function initializeWritableStream(e){e[state_]="writable",e[storedError_]=void 0,e[writer_]=void 0,e[writableStreamController_]=void 0,e[inFlightWriteRequest_]=void 0,e[closeRequest_]=void 0,e[inFlightCloseRequest_]=void 0,e[pendingAbortRequest_]=void 0,e[writeRequests_]=[],e[backpressure_]=!1}function isWritableStream(e){return null!=e&&"object"==typeof e&&writableStreamController_ in e}function isWritableStreamLocked(e){return void 0!==e[writer_]}function writableStreamAbort(e,r){const t=e[state_];if("closed"===t||"errored"===t)return Promise.resolve(void 0);let a=e[pendingAbortRequest_];if(void 0!==a)return a.promise;let o=!1;"erroring"===t&&(o=!0,r=void 0),a={reason:r,wasAlreadyErroring:o};const l=new Promise((e,r)=>{a.resolve=e,a.reject=r});return a.promise=l,e[pendingAbortRequest_]=a,o||writableStreamStartErroring(e,r),l}function writableStreamAddWriteRequest(e){const r=createControlledPromise();return e[writeRequests_].push(r),r.promise}function writableStreamDealWithRejection(e,r){"writable"!==e[state_]?writableStreamFinishErroring(e):writableStreamStartErroring(e,r)}function writableStreamStartErroring(e,r){const t=e[writableStreamController_];e[state_]="erroring",e[storedError_]=r;const a=e[writer_];void 0!==a&&writableStreamDefaultWriterEnsureReadyPromiseRejected(a,r),!writableStreamHasOperationMarkedInFlight(e)&&t[started_$1]&&writableStreamFinishErroring(e)}function writableStreamFinishErroring(e){e[state_]="errored";const r=e[writableStreamController_];r[errorSteps_]();const t=e[storedError_];for(const o of e[writeRequests_])o.reject(t);e[writeRequests_]=[];const a=e[pendingAbortRequest_];if(void 0!==a)return e[pendingAbortRequest_]=void 0,a.wasAlreadyErroring?(a.reject(t),void writableStreamRejectCloseAndClosedPromiseIfNeeded(e)):void r[abortSteps_](a.reason).then(r=>{a.resolve(),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)},r=>{a.reject(r),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)});writableStreamRejectCloseAndClosedPromiseIfNeeded(e)}function writableStreamFinishInFlightWrite(e){e[inFlightWriteRequest_].resolve(void 0),e[inFlightWriteRequest_]=void 0}function writableStreamFinishInFlightWriteWithError(e,r){e[inFlightWriteRequest_].reject(r),e[inFlightWriteRequest_]=void 0,writableStreamDealWithRejection(e,r)}function writableStreamFinishInFlightClose(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 r=e[writer_];void 0!==r&&r[closedPromise_$1].resolve(void 0)}function writableStreamFinishInFlightCloseWithError(e,r){e[inFlightCloseRequest_].reject(r),e[inFlightCloseRequest_]=void 0,void 0!==e[pendingAbortRequest_]&&(e[pendingAbortRequest_].reject(r),e[pendingAbortRequest_]=void 0),writableStreamDealWithRejection(e,r)}function writableStreamCloseQueuedOrInFlight(e){return void 0!==e[closeRequest_]||void 0!==e[inFlightCloseRequest_]}function writableStreamHasOperationMarkedInFlight(e){return void 0!==e[inFlightWriteRequest_]||void 0!==e[inFlightCloseRequest_]}function writableStreamMarkCloseRequestInFlight(e){e[inFlightCloseRequest_]=e[closeRequest_],e[closeRequest_]=void 0}function writableStreamMarkFirstWriteRequestInFlight(e){const r=e[writeRequests_].shift();e[inFlightWriteRequest_]=r}function writableStreamRejectCloseAndClosedPromiseIfNeeded(e){const r=e[closeRequest_];void 0!==r&&(r.reject(e[storedError_]),e[closeRequest_]=void 0);const t=e[writer_];void 0!==t&&(t[closedPromise_$1].reject(e[storedError_]),t[closedPromise_$1].promise.catch(()=>{}))}function writableStreamUpdateBackpressure(e,r){const t=e[writer_];void 0!==t&&r!==e[backpressure_]&&(r?t[readyPromise_]=createControlledPromise():t[readyPromise_].resolve(void 0)),e[backpressure_]=r}function isWritableStreamDefaultWriter(e){return null!=e&&"object"==typeof e&&ownerWritableStream_ in e}function writableStreamDefaultWriterAbort(e,r){return writableStreamAbort(e[ownerWritableStream_],r)}function writableStreamDefaultWriterClose(e){const r=e[ownerWritableStream_],t=r[state_];if("closed"===t||"errored"===t)return Promise.reject(new TypeError("Writer stream is already closed or errored"));const a=createControlledPromise();return r[closeRequest_]=a,r[backpressure_]&&"writable"===t&&e[readyPromise_].resolve(void 0),writableStreamDefaultControllerClose(r[writableStreamController_]),a.promise}function writableStreamDefaultWriterCloseWithErrorPropagation(e){const r=e[ownerWritableStream_],t=r[state_];return writableStreamCloseQueuedOrInFlight(r)||"closed"===t?Promise.resolve(void 0):"errored"===t?Promise.reject(r[storedError_]):writableStreamDefaultWriterClose(e)}function writableStreamDefaultWriterEnsureClosedPromiseRejected(e,r){const t=e[closedPromise_$1];t.state===ControlledPromiseState.Pending?t.reject(r):(e[closedPromise_$1]=createControlledPromise(),e[closedPromise_$1].reject(r)),e[closedPromise_$1].promise.catch(()=>{})}function writableStreamDefaultWriterEnsureReadyPromiseRejected(e,r){const t=e[readyPromise_];t.state===ControlledPromiseState.Pending?t.reject(r):(e[readyPromise_]=createControlledPromise(),e[readyPromise_].reject(r)),e[readyPromise_].promise.catch(()=>{})}function writableStreamDefaultWriterGetDesiredSize(e){const r=e[ownerWritableStream_],t=r[state_];return"errored"===t||"erroring"===t?null:"closed"===t?0:writableStreamDefaultControllerGetDesiredSize(r[writableStreamController_])}function writableStreamDefaultWriterRelease(e){const r=e[ownerWritableStream_],t=new TypeError;writableStreamDefaultWriterEnsureReadyPromiseRejected(e,t),writableStreamDefaultWriterEnsureClosedPromiseRejected(e,t),r[writer_]=void 0,e[ownerWritableStream_]=void 0}function writableStreamDefaultWriterWrite(e,r){const t=e[ownerWritableStream_],a=t[writableStreamController_],o=writableStreamDefaultControllerGetChunkSize(a,r);if(e[ownerWritableStream_]!==t)return Promise.reject(new TypeError);const l=t[state_];if("errored"===l)return Promise.reject(t[storedError_]);if(writableStreamCloseQueuedOrInFlight(t)||"closed"===l)return Promise.reject(new TypeError("Cannot write to a closing or closed stream"));if("erroring"===l)return Promise.reject(t[storedError_]);const n=writableStreamAddWriteRequest(t);return writableStreamDefaultControllerWrite(a,r,o),n}function setUpWritableStreamDefaultController(e,r,t,a,o,l,n,i){if(!isWritableStream(e))throw new TypeError;if(void 0!==e[writableStreamController_])throw new TypeError;r[controlledWritableStream_]=e,e[writableStreamController_]=r,resetQueue(r),r[started_$1]=!1,r[strategySizeAlgorithm_$1]=i,r[strategyHWM_$1]=n,r[writeAlgorithm_]=a,r[closeAlgorithm_]=o,r[abortAlgorithm_]=l;const s=writableStreamDefaultControllerGetBackpressure(r);writableStreamUpdateBackpressure(e,s);const u=t();Promise.resolve(u).then(e=>{r[started_$1]=!0,writableStreamDefaultControllerAdvanceQueueIfNeeded(r)},t=>{r[started_$1]=!0,writableStreamDealWithRejection(e,t)})}function isWritableStreamDefaultController(e){return null!=e&&"object"==typeof e&&controlledWritableStream_ in e}function writableStreamDefaultControllerClearAlgorithms(e){e[writeAlgorithm_]=void 0,e[closeAlgorithm_]=void 0,e[abortAlgorithm_]=void 0,e[strategySizeAlgorithm_$1]=void 0}function writableStreamDefaultControllerClose(e){enqueueValueWithSize(e,"close",0),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerGetChunkSize(e,r){let t;try{t=e[strategySizeAlgorithm_$1](r)}catch(r){writableStreamDefaultControllerErrorIfNeeded(e,r),t=1}return t}function writableStreamDefaultControllerGetDesiredSize(e){return e[strategyHWM_$1]-e[queueTotalSize_]}function writableStreamDefaultControllerWrite(e,r,t){try{enqueueValueWithSize(e,{chunk:r},t)}catch(r){return void writableStreamDefaultControllerErrorIfNeeded(e,r)}const a=e[controlledWritableStream_];if(!writableStreamCloseQueuedOrInFlight(a)&&"writable"===a[state_]){writableStreamUpdateBackpressure(a,writableStreamDefaultControllerGetBackpressure(e))}writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerAdvanceQueueIfNeeded(e){if(!e[started_$1])return;const r=e[controlledWritableStream_];if(void 0!==r[inFlightWriteRequest_])return;const t=r[state_];if("closed"===t||"errored"===t)return;if("erroring"===t)return void writableStreamFinishErroring(r);if(0===e[queue_].length)return;const a=peekQueueValue(e);"close"===a?writableStreamDefaultControllerProcessClose(e):writableStreamDefaultControllerProcessWrite(e,a.chunk)}function writableStreamDefaultControllerErrorIfNeeded(e,r){"writable"===e[controlledWritableStream_][state_]&&writableStreamDefaultControllerError(e,r)}function writableStreamDefaultControllerProcessClose(e){const r=e[controlledWritableStream_];writableStreamMarkCloseRequestInFlight(r),dequeueValue(e);const t=e[closeAlgorithm_]();writableStreamDefaultControllerClearAlgorithms(e),t.then(e=>{writableStreamFinishInFlightClose(r)},e=>{writableStreamFinishInFlightCloseWithError(r,e)})}function writableStreamDefaultControllerProcessWrite(e,r){const t=e[controlledWritableStream_];writableStreamMarkFirstWriteRequestInFlight(t),e[writeAlgorithm_](r).then(r=>{writableStreamFinishInFlightWrite(t);const a=t[state_];if(dequeueValue(e),!writableStreamCloseQueuedOrInFlight(t)&&"writable"===a){const r=writableStreamDefaultControllerGetBackpressure(e);writableStreamUpdateBackpressure(t,r)}writableStreamDefaultControllerAdvanceQueueIfNeeded(e)},r=>{"writable"===t[state_]&&writableStreamDefaultControllerClearAlgorithms(e),writableStreamFinishInFlightWriteWithError(t,r)})}function writableStreamDefaultControllerGetBackpressure(e){return writableStreamDefaultControllerGetDesiredSize(e)<=0}function writableStreamDefaultControllerError(e,r){const t=e[controlledWritableStream_];writableStreamDefaultControllerClearAlgorithms(e),writableStreamStartErroring(t,r)}class ReadableStreamDefaultReader{constructor(e){if(!isReadableStream(e))throw new TypeError;if(isReadableStreamLocked(e))throw new TypeError("The stream is locked.");readableStreamReaderGenericInitialize(this,e),this[readRequests_]=[]}get closed(){return isReadableStreamDefaultReader(this)?this[closedPromise_].promise:Promise.reject(new TypeError)}cancel(e){if(!isReadableStreamDefaultReader(this))return Promise.reject(new TypeError);const r=this[ownerReadableStream_];return void 0===r?Promise.reject(new TypeError("Reader is not associated with a stream")):readableStreamCancel(r,e)}read(){return isReadableStreamDefaultReader(this)?void 0===this[ownerReadableStream_]?Promise.reject(new TypeError("Reader is not associated with a stream")):readableStreamDefaultReaderRead(this,!0):Promise.reject(new TypeError)}releaseLock(){if(!isReadableStreamDefaultReader(this))throw new TypeError;if(void 0!==this[ownerReadableStream_]){if(0!==this[readRequests_].length)throw new TypeError("Cannot release a stream with pending read requests");readableStreamReaderGenericRelease(this)}}}class WritableStreamDefaultWriter{constructor(e){if(!isWritableStream(e))throw new TypeError;if(isWritableStreamLocked(e))throw new TypeError("Stream is already locked");this[ownerWritableStream_]=e,e[writer_]=this;const r=createControlledPromise(),t=createControlledPromise();this[readyPromise_]=r,this[closedPromise_$1]=t;const a=e[state_];if("writable"===a)!writableStreamCloseQueuedOrInFlight(e)&&e[backpressure_]||r.resolve(void 0);else if("erroring"===a)r.reject(e[storedError_]),r.promise.catch(()=>{});else if("closed"===a)r.resolve(void 0),t.resolve(void 0);else{const a=e[storedError_];r.reject(a),r.promise.catch(()=>{}),t.reject(a),t.promise.catch(()=>{})}}abort(e){return isWritableStreamDefaultWriter(this)?void 0===this[ownerWritableStream_]?Promise.reject(new TypeError("Writer is not connected to a stream")):writableStreamDefaultWriterAbort(this,e):Promise.reject(new TypeError)}close(){if(!isWritableStreamDefaultWriter(this))return Promise.reject(new TypeError);const e=this[ownerWritableStream_];return void 0===e?Promise.reject(new TypeError("Writer is not connected to a stream")):writableStreamCloseQueuedOrInFlight(e)?Promise.reject(new TypeError):writableStreamDefaultWriterClose(this)}releaseLock(){void 0!==this[ownerWritableStream_]&&writableStreamDefaultWriterRelease(this)}write(e){return isWritableStreamDefaultWriter(this)?void 0===this[ownerWritableStream_]?Promise.reject(new TypeError("Writer is not connected to a stream")):writableStreamDefaultWriterWrite(this,e):Promise.reject(new TypeError)}get closed(){return isWritableStreamDefaultWriter(this)?this[closedPromise_$1].promise:Promise.reject(new TypeError)}get desiredSize(){if(!isWritableStreamDefaultWriter(this))throw new TypeError;if(void 0===this[ownerWritableStream_])throw new TypeError("Writer is not connected to stream");return writableStreamDefaultWriterGetDesiredSize(this)}get ready(){return isWritableStreamDefaultWriter(this)?this[readyPromise_].promise:Promise.reject(new TypeError)}}function pipeTo(e,r,t){const a=!!t.preventClose,o=!!t.preventAbort,l=!!t.preventCancel;let n=!1,i=Promise.resolve();const s=createControlledPromise(),u=new ReadableStreamDefaultReader(e),d=new WritableStreamDefaultWriter(r);function m(e,r,t){"errored"===e[state_]?t(e[storedError_]):r.catch(t)}if(m(e,u[closedPromise_].promise,e=>{f(o?void 0:()=>writableStreamAbort(r,e),{actualError:e})}),m(r,d[closedPromise_$1].promise,r=>{f(l?void 0:()=>readableStreamCancel(e,r),{actualError:r})}),function(e,r,t){"closed"===e[state_]?t():r.then(t)}(e,u[closedPromise_].promise,()=>{a?f():f(()=>writableStreamDefaultWriterCloseWithErrorPropagation(d))}),writableStreamCloseQueuedOrInFlight(r)||"closed"===r[state_]){const r=new TypeError;f(l?void 0:()=>readableStreamCancel(e,r),{actualError:r})}function c(){return"writable"!==r[state_]||writableStreamCloseQueuedOrInFlight(r)?void 0:function e(){const r=i;return i.then(()=>r===i?void 0:e())}()}function f(e,r){if(n)return;function t(){e().then(e=>b(r),e=>b({actualError:e}))}n=!0,void 0===e&&(e=(()=>Promise.resolve()));const a=c();a?a.then(t):t()}function b(e){writableStreamDefaultWriterRelease(d),readableStreamReaderGenericRelease(u),e?s.reject(e.actualError):s.resolve(void 0)}return function e(){n||d[readyPromise_].promise.then(()=>{readableStreamDefaultReaderRead(u).then(({value:r,done:t})=>{t||(i=writableStreamDefaultWriterWrite(d,r).catch(()=>{}),e())},e=>{i=Promise.resolve()})})}(),s.promise}class ReadableStreamDefaultController{constructor(){throw new TypeError}get desiredSize(){return readableStreamDefaultControllerGetDesiredSize(this)}close(){if(!isReadableStreamDefaultController(this))throw new TypeError;if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("Cannot close, the stream is already closing or not readable");readableStreamDefaultControllerClose(this)}enqueue(e){if(!isReadableStreamDefaultController(this))throw new TypeError;if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("Cannot enqueue, the stream is closing or not readable");readableStreamDefaultControllerEnqueue(this,e)}error(e){if(!isReadableStreamDefaultController(this))throw new TypeError;readableStreamDefaultControllerError(this,e)}[cancelSteps_](e){resetQueue(this);const r=this[cancelAlgorithm_](e);return readableStreamDefaultControllerClearAlgorithms(this),r}[pullSteps_](e){const r=this[controlledReadableStream_];if(this[queue_].length>0){const t=dequeueValue(this);return this[closeRequested_]&&0===this[queue_].length?(readableStreamDefaultControllerClearAlgorithms(this),readableStreamClose(r)):readableStreamDefaultControllerCallPullIfNeeded(this),Promise.resolve(readableStreamCreateReadResult(t,!1,e))}const t=readableStreamAddReadRequest(r,e);return readableStreamDefaultControllerCallPullIfNeeded(this),t}}function setUpReadableStreamDefaultControllerFromUnderlyingSource(e,r,t,a){const o=Object.create(ReadableStreamDefaultController.prototype),l=createAlgorithmFromUnderlyingMethod(r,"pull",[o]),n=createAlgorithmFromUnderlyingMethod(r,"cancel",[]);setUpReadableStreamDefaultController(e,o,()=>invokeOrNoop(r,"start",[o]),l,n,t,a)}class ReadableStreamBYOBRequest{constructor(){throw new TypeError}get view(){if(!isReadableStreamBYOBRequest(this))throw new TypeError;return this[view_]}respond(e){if(!isReadableStreamBYOBRequest(this))throw new TypeError;if(void 0===this[associatedReadableByteStreamController_])throw new TypeError;return readableByteStreamControllerRespond(this[associatedReadableByteStreamController_],e)}respondWithNewView(e){if(!isReadableStreamBYOBRequest(this))throw new TypeError;if(void 0===this[associatedReadableByteStreamController_])throw new TypeError;if(!ArrayBuffer.isView(e))throw new TypeError("view parameter must be a TypedArray");return readableByteStreamControllerRespondWithNewView(this[associatedReadableByteStreamController_],e)}}class ReadableByteStreamController{constructor(){throw new TypeError}get byobRequest(){if(!isReadableByteStreamController(this))throw new TypeError;if(void 0===this[byobRequest_]&&this[pendingPullIntos_].length>0){const e=this[pendingPullIntos_][0],r=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),t=Object.create(ReadableStreamBYOBRequest.prototype);setUpReadableStreamBYOBRequest(t,this,r),this[byobRequest_]=t}return this[byobRequest_]}get desiredSize(){if(!isReadableByteStreamController(this))throw new TypeError;return readableByteStreamControllerGetDesiredSize(this)}close(){if(!isReadableByteStreamController(this))throw new TypeError;if(this[closeRequested_])throw new TypeError("Stream is already closing");if("readable"!==this[controlledReadableByteStream_][state_])throw new TypeError("Stream is closed or errored");readableByteStreamControllerClose(this)}enqueue(e){if(!isReadableByteStreamController(this))throw new TypeError;if(this[closeRequested_])throw new TypeError("Stream is already closing");if("readable"!==this[controlledReadableByteStream_][state_])throw new TypeError("Stream is closed or errored");if(!ArrayBuffer.isView(e))throw new TypeError("chunk must be a valid ArrayBufferView");return readableByteStreamControllerEnqueue(this,e)}error(e){if(!isReadableByteStreamController(this))throw new TypeError;readableByteStreamControllerError(this,e)}[cancelSteps_](e){if(this[pendingPullIntos_].length>0){this[pendingPullIntos_][0].bytesFilled=0}resetQueue(this);const r=this[cancelAlgorithm_](e);return readableByteStreamControllerClearAlgorithms(this),r}[pullSteps_](e){const r=this[controlledReadableByteStream_];if(this[queueTotalSize_]>0){const r=this[queue_].shift();this[queueTotalSize_]-=r.byteLength,readableByteStreamControllerHandleQueueDrain(this);const t=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);return Promise.resolve(readableStreamCreateReadResult(t,!1,e))}const t=this[autoAllocateChunkSize_];if(void 0!==t){let e;try{e=new ArrayBuffer(t)}catch(e){return Promise.reject(e)}const r={buffer:e,byteOffset:0,byteLength:t,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this[pendingPullIntos_].push(r)}const a=readableStreamAddReadRequest(r,e);return readableByteStreamControllerCallPullIfNeeded(this),a}}function setUpReadableByteStreamControllerFromUnderlyingSource(e,r,t){const a=Object.create(ReadableByteStreamController.prototype),o=createAlgorithmFromUnderlyingMethod(r,"pull",[a]),l=createAlgorithmFromUnderlyingMethod(r,"cancel",[]);let n=r.autoAllocateChunkSize;if(void 0!==n&&(!isInteger(n=Number(n))||n<=0))throw new RangeError("autoAllocateChunkSize must be a positive, finite integer");setUpReadableByteStreamController(e,a,()=>invokeOrNoop(r,"start",[a]),o,l,t,n)}class ReadableStreamBYOBReader{constructor(e){if(!isReadableStream(e))throw new TypeError;if(!isReadableByteStreamController(e[readableStreamController_]))throw new TypeError;if(isReadableStreamLocked(e))throw new TypeError("The stream is locked.");readableStreamReaderGenericInitialize(this,e),this[readIntoRequests_]=[]}get closed(){return isReadableStreamBYOBReader(this)?this[closedPromise_].promise:Promise.reject(new TypeError)}cancel(e){if(!isReadableStreamBYOBReader(this))return Promise.reject(new TypeError);const r=this[ownerReadableStream_];return void 0===r?Promise.reject(new TypeError("Reader is not associated with a stream")):readableStreamCancel(r,e)}read(e){return isReadableStreamBYOBReader(this)?void 0===this[ownerReadableStream_]?Promise.reject(new TypeError("Reader is not associated with a stream")):ArrayBuffer.isView(e)?0===e.byteLength?Promise.reject(new TypeError("supplied buffer view must be > 0 bytes")):readableStreamBYOBReaderRead(this,e,!0):Promise.reject(new TypeError("view argument must be a valid ArrayBufferView")):Promise.reject(new TypeError)}releaseLock(){if(!isReadableStreamBYOBReader(this))throw new TypeError;if(void 0===this[ownerReadableStream_])throw new TypeError("Reader is not associated with a stream");if(this[readIntoRequests_].length>0)throw new TypeError;readableStreamReaderGenericRelease(this)}}class ReadableStream{constructor(e={},r={}){initializeReadableStream(this);const t=r.size,a=r.highWaterMark,o=e.type;if(void 0===o){const r=makeSizeAlgorithmFromSizeFunction(t);setUpReadableStreamDefaultControllerFromUnderlyingSource(this,e,validateAndNormalizeHighWaterMark(void 0===a?1:a),r)}else{if("bytes"!==String(o))throw new RangeError("The underlying source's `type` field must be undefined or 'bytes'");if(void 0!==t)throw new RangeError("bytes streams cannot have a strategy with a `size` field");setUpReadableByteStreamControllerFromUnderlyingSource(this,e,validateAndNormalizeHighWaterMark(void 0===a?0:a))}}get locked(){return isReadableStreamLocked(this)}getReader(e={}){if(!isReadableStream(this))throw new TypeError;const{mode:r}=e;if(void 0===r)return new ReadableStreamDefaultReader(this);if("byob"===String(r))return new ReadableStreamBYOBReader(this);throw RangeError("mode option must be undefined or `byob`")}cancel(e){return isReadableStream(this)?isReadableStreamLocked(this)?Promise.reject(new TypeError("Cannot cancel a locked stream")):readableStreamCancel(this,e):Promise.reject(new TypeError)}tee(){return readableStreamTee(this,!1)}pipeThrough(e,r){const{readable:t,writable:a}=e;if(void 0===t||void 0===a)throw new TypeError("Both a readable and writable stream must be provided");const o=this.pipeTo(a,r);try{Promise.prototype.then.call(o,void 0,()=>{})}catch(e){}return t}pipeTo(e,r={}){return isReadableStream(this)&&isWritableStream(e)?isReadableStreamLocked(this)?Promise.reject(new TypeError("Cannot pipe from a locked stream")):isWritableStreamLocked(e)?Promise.reject(new TypeError("Cannot pipe to a locked stream")):pipeTo(this,e,r):Promise.reject(new TypeError)}}function createReadableStream(e,r,t,a,o){void 0===a&&(a=1),void 0===o&&(o=(()=>1));const l=Object.create(ReadableStream.prototype);return initializeReadableStream(l),setUpReadableStreamDefaultController(l,Object.create(ReadableStreamDefaultController.prototype),e,r,t,a,o),l}function readableStreamTee(e,r){if(!isReadableStream(e))throw new TypeError;const t=new ReadableStreamDefaultReader(e);let a,o,l,n,i,s=!1,u=!1,d=!1;const m=new Promise(e=>i=e),c=()=>readableStreamDefaultReaderRead(t).then(({value:e,done:t})=>{if(t&&!s&&(u||readableStreamDefaultControllerClose(l[readableStreamController_]),d||readableStreamDefaultControllerClose(n[readableStreamController_]),s=!0),s)return;const a=e;let o=e;u||readableStreamDefaultControllerEnqueue(l[readableStreamController_],a),d||(r&&(o=cloneValue(o)),readableStreamDefaultControllerEnqueue(n[readableStreamController_],o))}),f=()=>void 0;return l=createReadableStream(f,c,r=>{if(u=!0,a=r,d){const r=readableStreamCancel(e,[a,o]);i(r)}return m}),n=createReadableStream(f,c,r=>{if(d=!0,o=r,u){const r=readableStreamCancel(e,[a,o]);i(r)}return m}),t[closedPromise_].promise.catch(e=>{s||(readableStreamDefaultControllerError(l[readableStreamController_],e),readableStreamDefaultControllerError(n[readableStreamController_],e),s=!0)}),[l,n]}class WritableStreamDefaultController{constructor(){throw new TypeError}error(e){if(!isWritableStreamDefaultController(this))throw new TypeError;"writable"===this[controlledWritableStream_][state_]&&writableStreamDefaultControllerError(this,e)}[abortSteps_](e){const r=this[abortAlgorithm_](e);return writableStreamDefaultControllerClearAlgorithms(this),r}[errorSteps_](){resetQueue(this)}}function setUpWritableStreamDefaultControllerFromUnderlyingSink(e,r,t,a){const o=Object.create(WritableStreamDefaultController.prototype),l=createAlgorithmFromUnderlyingMethod(r,"write",[o]),n=createAlgorithmFromUnderlyingMethod(r,"close",[]),i=createAlgorithmFromUnderlyingMethod(r,"abort",[]);setUpWritableStreamDefaultController(e,o,function(){return invokeOrNoop(r,"start",[o])},l,n,i,t,a)}class WritableStream{constructor(e={},r={}){initializeWritableStream(this);const t=r.size,a=r.highWaterMark;if(void 0!==e.type)throw new RangeError("The type of an underlying sink must be undefined");const o=makeSizeAlgorithmFromSizeFunction(t);setUpWritableStreamDefaultControllerFromUnderlyingSink(this,e,validateAndNormalizeHighWaterMark(void 0===a?1:a),o)}get locked(){if(!isWritableStream(this))throw new TypeError;return isWritableStreamLocked(this)}abort(e){return isWritableStream(this)?isWritableStreamLocked(this)?Promise.reject(new TypeError("Cannot abort a locked stream")):writableStreamAbort(this,e):Promise.reject(new TypeError)}getWriter(){if(!isWritableStream(this))throw new TypeError;return new WritableStreamDefaultWriter(this)}}function createWritableStream(e,r,t,a,o,l){void 0===o&&(o=1),void 0===l&&(l=(()=>1));const n=Object.create(WritableStream.prototype);return initializeWritableStream(n),setUpWritableStreamDefaultController(n,Object.create(WritableStreamDefaultController.prototype),e,r,t,a,o,l),n}const backpressure_$1=Symbol("backpressure_"),backpressureChangePromise_=Symbol("backpressureChangePromise_"),readable_=Symbol("readable_"),transformStreamController_=Symbol("transformStreamController_"),writable_=Symbol("writable_"),controlledTransformStream_=Symbol("controlledTransformStream_"),flushAlgorithm_=Symbol("flushAlgorithm_"),transformAlgorithm_=Symbol("transformAlgorithm_");function isTransformStream(e){return null!=e&&"object"==typeof e&&transformStreamController_ in e}function initializeTransformStream(e,r,t,a,o,l){const n=function(){return r};e[writable_]=createWritableStream(n,function(r){return transformStreamDefaultSinkWriteAlgorithm(e,r)},function(){return transformStreamDefaultSinkCloseAlgorithm(e)},function(r){return transformStreamDefaultSinkAbortAlgorithm(e,r)},t,a);e[readable_]=createReadableStream(n,function(){return transformStreamDefaultSourcePullAlgorithm(e)},function(r){return transformStreamErrorWritableAndUnblockWrite(e,r),Promise.resolve(void 0)},o,l),e[backpressure_$1]=void 0,e[backpressureChangePromise_]=void 0,transformStreamSetBackpressure(e,!0),e[transformStreamController_]=void 0}function transformStreamError(e,r){readableStreamDefaultControllerError(e[readable_][readableStreamController_],r),transformStreamErrorWritableAndUnblockWrite(e,r)}function transformStreamErrorWritableAndUnblockWrite(e,r){transformStreamDefaultControllerClearAlgorithms(e[transformStreamController_]),writableStreamDefaultControllerErrorIfNeeded(e[writable_][writableStreamController_],r),e[backpressure_$1]&&transformStreamSetBackpressure(e,!1)}function transformStreamSetBackpressure(e,r){void 0!==e[backpressure_$1]&&e[backpressureChangePromise_].resolve(void 0),e[backpressureChangePromise_]=createControlledPromise(),e[backpressure_$1]=r}function isTransformStreamDefaultController(e){return null!=e&&"object"==typeof e&&controlledTransformStream_ in e}function setUpTransformStreamDefaultController(e,r,t,a){r[controlledTransformStream_]=e,e[transformStreamController_]=r,r[transformAlgorithm_]=t,r[flushAlgorithm_]=a}function transformStreamDefaultControllerClearAlgorithms(e){e[transformAlgorithm_]=void 0,e[flushAlgorithm_]=void 0}function transformStreamDefaultControllerEnqueue(e,r){const t=e[controlledTransformStream_],a=t[readable_][readableStreamController_];if(!readableStreamDefaultControllerCanCloseOrEnqueue(a))throw new TypeError;try{readableStreamDefaultControllerEnqueue(a,r)}catch(e){throw transformStreamErrorWritableAndUnblockWrite(t,e),t[readable_][storedError_]}readableStreamDefaultControllerHasBackpressure(a)!==t[backpressure_$1]&&transformStreamSetBackpressure(t,!0)}function transformStreamDefaultControllerError(e,r){transformStreamError(e[controlledTransformStream_],r)}function transformStreamDefaultControllerPerformTransform(e,r){return e[transformAlgorithm_](r).catch(r=>{throw transformStreamError(e[controlledTransformStream_],r),r})}function transformStreamDefaultControllerTerminate(e){const r=e[controlledTransformStream_],t=r[readable_][readableStreamController_];readableStreamDefaultControllerCanCloseOrEnqueue(t)&&readableStreamDefaultControllerClose(t),transformStreamErrorWritableAndUnblockWrite(r,new TypeError("The transform stream has been terminated"))}function transformStreamDefaultSinkWriteAlgorithm(e,r){const t=e[transformStreamController_];if(e[backpressure_$1]){return e[backpressureChangePromise_].promise.then(a=>{const o=e[writable_];if("erroring"===o[state_])throw o[storedError_];return transformStreamDefaultControllerPerformTransform(t,r)})}return transformStreamDefaultControllerPerformTransform(t,r)}function transformStreamDefaultSinkAbortAlgorithm(e,r){return transformStreamError(e,r),Promise.resolve(void 0)}function transformStreamDefaultSinkCloseAlgorithm(e){const r=e[readable_],t=e[transformStreamController_],a=t[flushAlgorithm_]();return transformStreamDefaultControllerClearAlgorithms(t),a.then(e=>{if("errored"===r[state_])throw r[storedError_];const t=r[readableStreamController_];readableStreamDefaultControllerCanCloseOrEnqueue(t)&&readableStreamDefaultControllerClose(t)},t=>{throw transformStreamError(e,t),r[storedError_]})}function transformStreamDefaultSourcePullAlgorithm(e){return transformStreamSetBackpressure(e,!1),e[backpressureChangePromise_].promise}class TransformStreamDefaultController{constructor(){throw new TypeError}get desiredSize(){if(!isTransformStreamDefaultController(this))throw new TypeError;return readableStreamDefaultControllerGetDesiredSize(this[controlledTransformStream_][readable_][readableStreamController_])}enqueue(e){if(!isTransformStreamDefaultController(this))throw new TypeError;transformStreamDefaultControllerEnqueue(this,e)}error(e){if(!isTransformStreamDefaultController(this))throw new TypeError;transformStreamDefaultControllerError(this,e)}terminate(){if(!isTransformStreamDefaultController(this))throw new TypeError;transformStreamDefaultControllerTerminate(this)}}class TransformStream$1{constructor(e={},r={},t={}){const a=r.size,o=r.highWaterMark,l=t.size,n=t.highWaterMark;if(void 0!==e.writableType)throw new RangeError("The transformer's `writableType` field must be undefined");const i=makeSizeAlgorithmFromSizeFunction(a),s=validateAndNormalizeHighWaterMark(void 0===o?1:o);if(void 0!==e.readableType)throw new RangeError("The transformer's `readableType` field must be undefined");const u=makeSizeAlgorithmFromSizeFunction(l),d=validateAndNormalizeHighWaterMark(void 0===n?0:n),m=createControlledPromise();initializeTransformStream(this,m.promise,s,i,d,u),setUpTransformStreamDefaultControllerFromTransformer(this,e);const c=invokeOrNoop(e,"start",[this[transformStreamController_]]);m.resolve(c)}get readable(){if(!isTransformStream(this))throw new TypeError;return this[readable_]}get writable(){if(!isTransformStream(this))throw new TypeError;return this[writable_]}}function setUpTransformStreamDefaultControllerFromTransformer(e,r){const t=Object.create(TransformStreamDefaultController.prototype);let a;const o=r.transform;if(void 0!==o){if("function"!=typeof o)throw new TypeError("`transform` field of the transformer must be a function");a=(e=>promiseCall(o,r,[e,t]))}else a=function(e){try{transformStreamDefaultControllerEnqueue(t,e)}catch(e){return Promise.reject(e)}return Promise.resolve(void 0)};const l=createAlgorithmFromUnderlyingMethod(r,"flush",[t]);setUpTransformStreamDefaultController(e,t,a,l)}class ByteLengthQueuingStrategy{constructor(e){this.highWaterMark=e.highWaterMark}size(e){return e.byteLength}}class CountQueuingStrategy{constructor(e){this.highWaterMark=e.highWaterMark}size(){return 1}}function wrapReadableStream(e,r){let t;return new r({start(r){(t=e.getReader()).closed.catch(e=>{r.error(e)})},pull:e=>t.read().then(({value:r,done:t})=>{t?e.close():e.enqueue(r)},r=>{e.error(r)}),cancel(e){t.cancel(e)}})}function getMIMETypeFromHeadersInit(e){if(void 0===e)return"";if(e instanceof Headers)return e.get("Content-Type")||"";if(Array.isArray(e)){const r=e.find(e=>Array.isArray(e)&&2===e.length&&"Content-Type"===e[0]);return r?r[1]:""}return e["Content-Type"]||""}function resolveRequestInitStream(e,r,t){if(void 0===e)return Promise.resolve(e);const a=e.body;let o;if(a&&"object"==typeof a&&(r&&a instanceof r?o=a:a instanceof t&&(o=a)),!o)return Promise.resolve(e);const l=getMIMETypeFromHeadersInit(e.headers);return readAllBytesFromStream(o.getReader(),l).then(r=>(e.body=r,e))}function createAdaptedFetch(e,r,t,a,o){return function(l,n){return resolveRequestInitStream(n,t,a).then(t=>e.call(void 0,l,t).then(e=>{if("body"in e){const t=e;let l,i;e=new Proxy(t,{get(s,u,d){let m;return"body"===u?(void 0===l&&(l=wrapReadableStream(t.body,a)),m=l):"clone"===u?(void 0===i&&(i=function(){const[t,a]=o(e.body,!0);return l=t,createResponseProxyWithStreamBody(r,o,a,n)}),m=i):m=s[u],"function"==typeof m?function(...e){return m.apply(s,e)}:m}})}else e.body=new a({pull:r=>e.arrayBuffer().then(e=>{r.enqueue(new Uint8Array(e)),r.close()},e=>{r.error(e)})}),e.clone=function(){const[t,a]=o(e.body,!0);return e.body=t,createResponseProxyWithStreamBody(r,o,a,n)};return e}))}}function readAllBytesFromStream(e,r){return new Promise((t,a)=>{const o=[];!function l(){e.read().then(({value:e,done:n})=>{n?function(){0===o.length&&o.push(new Uint8Array(0));const e=new Blob(o,{type:r});t(e)}():e instanceof Uint8Array?(o.push(e),l()):a(new TypeError("A ReadableStream body must only yield Uint8Array values"))},e=>{a(e)})}()})}function createResponseProxyWithStreamBody(e,r,t,a){const o=new e("fake",a),l=getMIMETypeFromHeadersInit(o.headers);let n,i=!1;function s(){return void 0===n&&(n=new Promise((r,o)=>{if(i=!0,t.locked)return o(new TypeError("The ReadableStream is locked"));readAllBytesFromStream(t.getReader(),l).then(t=>{r(new e(t,a))}).catch(e=>{o(e)})})),n}return new class{get type(){return o.type}get url(){return o.url}get redirected(){return o.redirected}get status(){return o.status}get ok(){return o.ok}get statusText(){return o.statusText}get headers(){return o.headers}clone(){const[o,l]=r(t,!0);return t=o,createResponseProxyWithStreamBody(e,r,l,a)}get body(){return t}get bodyUsed(){return i}arrayBuffer(){return s().then(e=>e.arrayBuffer())}blob(){return s().then(e=>e.blob())}formData(){return s().then(e=>e.formData())}json(){return s().then(e=>e.json())}text(){return s().then(e=>e.text())}}}function createAdaptedResponse(e,r,t,a){const o=function(o,l){if(o instanceof t){if(void 0===r||!("body"in e))return createResponseProxyWithStreamBody(e,a,o,l);o=wrapReadableStream(o,r)}return new e(o,l)};return o.prototype=e.prototype,o}const decDecoder=Symbol("decDecoder"),decTransform=Symbol("decTransform");class TextDecodeTransformer{constructor(e){this.decoder_=e}transform(e,r){if(!(e instanceof ArrayBuffer||ArrayBuffer.isView(e)))throw new TypeError("Input data must be a BufferSource");const t=this.decoder_.decode(e,{stream:!0});0!==t.length&&r.enqueue(t)}flush(e){const r=this.decoder_.decode();0!==r.length&&e.enqueue(r)}}class TextDecoderStream{constructor(e,r){this[decDecoder]=new TextDecoder(e,r),this[decTransform]=new TransformStream(new TextDecodeTransformer(this[decDecoder]))}get encoding(){return this[decDecoder].encoding}get fatal(){return this[decDecoder].fatal}get ignoreBOM(){return this[decDecoder].ignoreBOM}get readable(){return this[decTransform].readable}get writable(){return this[decTransform].writable}}const encEncoder=Symbol("encEncoder"),encTransform=Symbol("encTransform");class TextEncodeTransformer{constructor(e){this.encoder_=e,this.partial_=void 0}transform(e,r){let t=String(e);void 0!==this.partial_&&(t=this.partial_+t,this.partial_=void 0);const a=t.length-1,o=t.charCodeAt(a);o>=55296&&o<56320&&(this.partial_=String.fromCharCode(o),t=t.substring(0,a));const l=this.encoder_.encode(t);0!==l.length&&r.enqueue(l)}flush(e){this.partial_&&(e.enqueue(this.encoder_.encode(this.partial_)),this.partial_=void 0)}}class TextEncoderStream{constructor(){this[encEncoder]=new TextEncoder,this[encTransform]=new TransformStream(new TextEncodeTransformer(this[encEncoder]))}get encoding(){return this[encEncoder].encoding}get readable(){return this[encTransform].readable}get writable(){return this[encTransform].writable}}function getGlobal(){let e;if(void 0===e){try{e=window}catch(e){}if(void 0===e)try{e=global}catch(e){}}return e}function getGlobalValue(e){const r=getGlobal();let t;return void 0!==r&&(t=r[e]),t}function getGlobalOrContextualValue(name){const global=getGlobal();let value;if(void 0!==global&&(value=global[name]),void 0===value)try{value=eval(name)}catch(e){}return value}function hasCompleteStreamsImplementation(){const e=getGlobalValue("ReadableStream"),r=getGlobalValue("WritableStream"),t=getGlobalValue("TransformStream"),a=getGlobalValue("ByteLengthQueuingStrategy"),o=getGlobalValue("CountQueuingStrategy"),l=e=>"function"==typeof e;if(!(l(e)&&l(r)&&l(t)&&l(a)&&l(o)))return!1;try{const r=new e({type:"bytes"}).getReader({mode:"byob"});if(null==r||"object"!=typeof r)return!1}catch(e){return!1}return!0}function installStardazedStreams(){const e=getGlobal();if(!e)return;if(hasCompleteStreamsImplementation())return;const r=getGlobalOrContextualValue("fetch"),t=getGlobalOrContextualValue("Response"),a=getGlobalValue("ReadableStream");if(r&&t){const o=createAdaptedFetch(r,t,a,ReadableStream,readableStreamTee),l=createAdaptedResponse(t,a,ReadableStream,readableStreamTee);e.fetch=o,e.Response=l}e.ReadableStream=ReadableStream,e.WritableStream=WritableStream,e.TransformStream=TransformStream$1,e.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy,e.CountQueuingStrategy=CountQueuingStrategy}function installEncodingStreams(){const e=getGlobal();e&&("function"!=typeof getGlobalValue("TextDecoderStream")&&(e.TextDecoderStream=TextDecoderStream),"function"!=typeof getGlobalValue("TextEncoderStream")&&(e.TextEncoderStream=TextEncoderStream))}installStardazedStreams(),installEncodingStreams()}();
!function(){"use strict";const state_=Symbol("state_"),storedError_=Symbol("storedError_");function isInteger(e){if(!isFinite(e))return!1;const r=Math.abs(e);return Math.floor(r)===r}function isFiniteNonNegativeNumber(e){return!("number"!=typeof e||!isFinite(e))&&e>=0}function isAbortSignal(e){if("object"!=typeof e||null===e)return!1;try{return Object.getOwnPropertyDescriptor(AbortSignal.prototype,"aborted").get.call(e),!0}catch(r){return!1}}function invokeOrNoop(e,r,t){const a=e[r];if(void 0!==a)return Function.prototype.apply.call(a,e,t)}function cloneArrayBuffer(e,r,t,a){return e.slice(r,r+t)}function transferArrayBuffer(e){return e.slice(0)}function copyDataBlockBytes(e,r,t,a,o){new Uint8Array(e,r,o).set(new Uint8Array(t,a,o))}const objectCloneMemo=new WeakMap;let sharedArrayBufferSupported_;function supportsSharedArrayBuffer(){if(void 0===sharedArrayBufferSupported_)try{new SharedArrayBuffer(16),sharedArrayBufferSupported_=!0}catch(e){sharedArrayBufferSupported_=!1}return sharedArrayBufferSupported_}function cloneValue(e){switch(typeof e){case"number":case"string":case"boolean":case"undefined":case"bigint":return e;case"object":{if(objectCloneMemo.has(e))return objectCloneMemo.get(e);if(null===e)return e;if(e instanceof Date)return new Date(e.valueOf());if(e instanceof RegExp)return new RegExp(e);if(supportsSharedArrayBuffer()&&e instanceof SharedArrayBuffer)return e;if(e instanceof ArrayBuffer){const r=cloneArrayBuffer(e,0,e.byteLength,ArrayBuffer);return objectCloneMemo.set(e,r),r}if(ArrayBuffer.isView(e)){const r=cloneValue(e.buffer);let t;return t=e instanceof DataView?e.byteLength:e.length,new e.constructor(r,e.byteOffset,t)}if(e instanceof Map){const r=new Map;return objectCloneMemo.set(e,r),e.forEach((e,t)=>r.set(t,cloneValue(e))),r}if(e instanceof Set){const r=new Map;return objectCloneMemo.set(e,r),e.forEach((e,t)=>r.set(t,cloneValue(e))),r}const r={};objectCloneMemo.set(e,r);const t=Object.getOwnPropertyNames(e);for(const a of t)r[a]=cloneValue(e[a]);return r}case"symbol":case"function":default:throw new DOMException("Uncloneable value in stream","DataCloneError")}}function promiseCall(e,r,t){try{const o=Function.prototype.apply.call(e,r,t);return Promise.resolve(o)}catch(a){return Promise.reject(a)}}function createAlgorithmFromUnderlyingMethod(e,r,t){const a=e[r];if(void 0===a)return()=>Promise.resolve(void 0);if("function"!=typeof a)throw new TypeError(`Field "${r}" is not a function.`);return function(...r){return promiseCall(a,e,r.concat(t))}}function validateAndNormalizeHighWaterMark(e){const r=Number(e);if(isNaN(r)||r<0)throw new RangeError("highWaterMark must be a valid, non-negative integer.");return r}function makeSizeAlgorithmFromSizeFunction(e){if("function"!=typeof e&&void 0!==e)throw new TypeError("size function must be undefined or a function");return function(r){return"function"==typeof e?e(r):1}}var ControlledPromiseState;function createControlledPromise(){const e={state:ControlledPromiseState.Pending};return e.promise=new Promise(function(r,t){e.resolve=function(t){e.state=ControlledPromiseState.Resolved,r(t)},e.reject=function(r){e.state=ControlledPromiseState.Rejected,t(r)}}),e}!function(e){e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected"}(ControlledPromiseState||(ControlledPromiseState={}));const CHUNK_SIZE=16384;class QueueImpl{constructor(){this.chunks_=[[]],this.readChunk_=this.writeChunk_=this.chunks_[0],this.length_=0}push(e){this.writeChunk_.push(e),this.length_+=1,this.writeChunk_.length===CHUNK_SIZE&&(this.writeChunk_=[],this.chunks_.push(this.writeChunk_))}front(){if(0!==this.length_)return this.readChunk_[0]}shift(){if(0===this.length_)return;const e=this.readChunk_.shift();return this.length_-=1,0===this.readChunk_.length&&this.readChunk_!==this.writeChunk_&&(this.chunks_.shift(),this.readChunk_=this.chunks_[0]),e}get length(){return this.length_}}const queue_=Symbol("queue_"),queueTotalSize_=Symbol("queueTotalSize_");function dequeueValue(e){const r=e[queue_].shift(),t=e[queueTotalSize_]-r.size;return e[queueTotalSize_]=Math.max(0,t),r.value}function enqueueValueWithSize(e,r,t){if(!isFiniteNonNegativeNumber(t))throw new RangeError("Chunk size must be a non-negative, finite numbers");e[queue_].push({value:r,size:t}),e[queueTotalSize_]+=t}function peekQueueValue(e){return e[queue_].front().value}function resetQueue(e){e[queue_]=new QueueImpl,e[queueTotalSize_]=0}const controlledReadableStream_=Symbol("controlledReadableStream_"),pullAlgorithm_=Symbol("pullAlgorithm_"),cancelAlgorithm_=Symbol("cancelAlgorithm_"),strategySizeAlgorithm_=Symbol("strategySizeAlgorithm_"),strategyHWM_=Symbol("strategyHWM_"),started_=Symbol("started_"),closeRequested_=Symbol("closeRequested_"),pullAgain_=Symbol("pullAgain_"),pulling_=Symbol("pulling_"),cancelSteps_=Symbol("cancelSteps_"),pullSteps_=Symbol("pullSteps_"),autoAllocateChunkSize_=Symbol("autoAllocateChunkSize_"),byobRequest_=Symbol("byobRequest_"),controlledReadableByteStream_=Symbol("controlledReadableByteStream_"),pendingPullIntos_=Symbol("pendingPullIntos_"),closedPromise_=Symbol("closedPromise_"),ownerReadableStream_=Symbol("ownerReadableStream_"),readRequests_=Symbol("readRequests_"),readIntoRequests_=Symbol("readIntoRequests_"),associatedReadableByteStreamController_=Symbol("associatedReadableByteStreamController_"),view_=Symbol("view_"),reader_=Symbol("reader_"),readableStreamController_=Symbol("readableStreamController_");function initializeReadableStream(e){e[state_]="readable",e[reader_]=void 0,e[storedError_]=void 0,e[readableStreamController_]=void 0}function isReadableStream(e){return"object"==typeof e&&null!==e&&readableStreamController_ in e}function isReadableStreamLocked(e){return void 0!==e[reader_]}function readableStreamGetNumReadIntoRequests(e){const r=e[reader_];return void 0===r?0:r[readIntoRequests_].length}function readableStreamGetNumReadRequests(e){const r=e[reader_];return void 0===r?0:r[readRequests_].length}function readableStreamCreateReadResult(e,r,t){const a=t?Object.prototype:null,o=Object.create(a);return o.value=e,o.done=r,o}function readableStreamAddReadIntoRequest(e,r){const t=e[reader_],a=createControlledPromise();return a.forAuthorCode=r,t[readIntoRequests_].push(a),a.promise}function readableStreamAddReadRequest(e,r){const t=e[reader_],a=createControlledPromise();return a.forAuthorCode=r,t[readRequests_].push(a),a.promise}function readableStreamHasBYOBReader(e){return isReadableStreamBYOBReader(e[reader_])}function readableStreamHasDefaultReader(e){return isReadableStreamDefaultReader(e[reader_])}function readableStreamCancel(e,r){if("closed"===e[state_])return Promise.resolve(void 0);if("errored"===e[state_])return Promise.reject(e[storedError_]);return readableStreamClose(e),e[readableStreamController_][cancelSteps_](r).then(e=>void 0)}function readableStreamClose(e){e[state_]="closed";const r=e[reader_];if(void 0!==r){if(isReadableStreamDefaultReader(r)){for(const e of r[readRequests_])e.resolve(readableStreamCreateReadResult(void 0,!0,e.forAuthorCode));r[readRequests_]=[]}r[closedPromise_].resolve(),r[closedPromise_].promise.catch(()=>{})}}function readableStreamError(e,r){if("readable"!==e[state_])throw new RangeError("Stream is in an invalid state");e[state_]="errored",e[storedError_]=r;const t=e[reader_];if(void 0!==t){if(isReadableStreamDefaultReader(t)){for(const e of t[readRequests_])e.reject(r);t[readRequests_]=[]}else{const e=t[readIntoRequests_];for(const t of e)t.reject(r);t[readIntoRequests_]=[]}t[closedPromise_].reject(r)}}function isReadableStreamDefaultReader(e){return"object"==typeof e&&null!==e&&readRequests_ in e}function isReadableStreamBYOBReader(e){return"object"==typeof e&&null!==e&&readIntoRequests_ in e}function readableStreamReaderGenericInitialize(e,r){e[ownerReadableStream_]=r,r[reader_]=e;const t=r[state_];e[closedPromise_]=createControlledPromise(),"readable"===t||("closed"===t?e[closedPromise_].resolve(void 0):(e[closedPromise_].reject(r[storedError_]),e[closedPromise_].promise.catch(()=>{})))}function readableStreamReaderGenericRelease(e){const r=e[ownerReadableStream_];if(void 0===r)throw new TypeError("Reader is in an inconsistent state");"readable"===r[state_]||(e[closedPromise_]=createControlledPromise()),e[closedPromise_].reject(new TypeError),e[closedPromise_].promise.catch(()=>{}),r[reader_]=void 0,e[ownerReadableStream_]=void 0}function readableStreamBYOBReaderRead(e,r,t=!1){const a=e[ownerReadableStream_];return"errored"===a[state_]?Promise.reject(a[storedError_]):readableByteStreamControllerPullInto(a[readableStreamController_],r,t)}function readableStreamDefaultReaderRead(e,r=!1){const t=e[ownerReadableStream_];return"closed"===t[state_]?Promise.resolve(readableStreamCreateReadResult(void 0,!0,r)):"errored"===t[state_]?Promise.reject(t[storedError_]):t[readableStreamController_][pullSteps_](r)}function readableStreamFulfillReadIntoRequest(e,r,t){const a=e[reader_][readIntoRequests_].shift();a.resolve(readableStreamCreateReadResult(r,t,a.forAuthorCode))}function readableStreamFulfillReadRequest(e,r,t){const a=e[reader_][readRequests_].shift();a.resolve(readableStreamCreateReadResult(r,t,a.forAuthorCode))}function setUpReadableStreamDefaultController(e,r,t,a,o,l,n){r[controlledReadableStream_]=e,resetQueue(r),r[started_]=!1,r[closeRequested_]=!1,r[pullAgain_]=!1,r[pulling_]=!1,r[strategySizeAlgorithm_]=n,r[strategyHWM_]=l,r[pullAlgorithm_]=a,r[cancelAlgorithm_]=o,e[readableStreamController_]=r;const i=t();Promise.resolve(i).then(e=>{r[started_]=!0,readableStreamDefaultControllerCallPullIfNeeded(r)},e=>{readableStreamDefaultControllerError(r,e)})}function isReadableStreamDefaultController(e){return"object"==typeof e&&null!==e&&controlledReadableStream_ in e}function readableStreamDefaultControllerHasBackpressure(e){return!readableStreamDefaultControllerShouldCallPull(e)}function readableStreamDefaultControllerCanCloseOrEnqueue(e){const r=e[controlledReadableStream_][state_];return!1===e[closeRequested_]&&"readable"===r}function readableStreamDefaultControllerGetDesiredSize(e){const r=e[controlledReadableStream_][state_];return"errored"===r?null:"closed"===r?0:e[strategyHWM_]-e[queueTotalSize_]}function readableStreamDefaultControllerClose(e){e[closeRequested_]=!0;const r=e[controlledReadableStream_];0===e[queue_].length&&(readableStreamDefaultControllerClearAlgorithms(e),readableStreamClose(r))}function readableStreamDefaultControllerEnqueue(e,r){const t=e[controlledReadableStream_];if(isReadableStreamLocked(t)&&readableStreamGetNumReadRequests(t)>0)readableStreamFulfillReadRequest(t,r,!1);else{let t;try{t=e[strategySizeAlgorithm_](r)}catch(a){throw readableStreamDefaultControllerError(e,a),a}try{enqueueValueWithSize(e,r,t)}catch(a){throw readableStreamDefaultControllerError(e,a),a}}readableStreamDefaultControllerCallPullIfNeeded(e)}function readableStreamDefaultControllerError(e,r){const t=e[controlledReadableStream_];"readable"===t[state_]&&(resetQueue(e),readableStreamDefaultControllerClearAlgorithms(e),readableStreamError(t,r))}function readableStreamDefaultControllerCallPullIfNeeded(e){if(readableStreamDefaultControllerShouldCallPull(e))if(e[pulling_])e[pullAgain_]=!0;else{if(e[pullAgain_])throw new RangeError("Stream controller is in an invalid state.");e[pulling_]=!0,e[pullAlgorithm_](e).then(r=>{e[pulling_]=!1,e[pullAgain_]&&(e[pullAgain_]=!1,readableStreamDefaultControllerCallPullIfNeeded(e))},r=>{readableStreamDefaultControllerError(e,r)})}}function readableStreamDefaultControllerShouldCallPull(e){const r=e[controlledReadableStream_];if(!readableStreamDefaultControllerCanCloseOrEnqueue(e))return!1;if(!1===e[started_])return!1;if(isReadableStreamLocked(r)&&readableStreamGetNumReadRequests(r)>0)return!0;const t=readableStreamDefaultControllerGetDesiredSize(e);if(null===t)throw new RangeError("Stream is in an invalid state.");return t>0}function readableStreamDefaultControllerClearAlgorithms(e){e[pullAlgorithm_]=void 0,e[cancelAlgorithm_]=void 0,e[strategySizeAlgorithm_]=void 0}function setUpReadableByteStreamController(e,r,t,a,o,l,n){if(void 0!==e[readableStreamController_])throw new TypeError("Cannot reuse streams");if(void 0!==n&&(!isInteger(n)||n<=0))throw new RangeError("autoAllocateChunkSize must be a positive, finite integer");r[controlledReadableByteStream_]=e,r[pullAgain_]=!1,r[pulling_]=!1,readableByteStreamControllerClearPendingPullIntos(r),resetQueue(r),r[closeRequested_]=!1,r[started_]=!1,r[strategyHWM_]=validateAndNormalizeHighWaterMark(l),r[pullAlgorithm_]=a,r[cancelAlgorithm_]=o,r[autoAllocateChunkSize_]=n,r[pendingPullIntos_]=[],e[readableStreamController_]=r;const i=t();Promise.resolve(i).then(e=>{r[started_]=!0,readableByteStreamControllerCallPullIfNeeded(r)},e=>{readableByteStreamControllerError(r,e)})}function isReadableStreamBYOBRequest(e){return"object"==typeof e&&null!==e&&associatedReadableByteStreamController_ in e}function isReadableByteStreamController(e){return"object"==typeof e&&null!==e&&controlledReadableByteStream_ in e}function readableByteStreamControllerCallPullIfNeeded(e){readableByteStreamControllerShouldCallPull(e)&&(e[pulling_]?e[pullAgain_]=!0:(e[pulling_]=!0,e[pullAlgorithm_](e).then(r=>{e[pulling_]=!1,e[pullAgain_]&&(e[pullAgain_]=!1,readableByteStreamControllerCallPullIfNeeded(e))},r=>{readableByteStreamControllerError(e,r)})))}function readableByteStreamControllerClearAlgorithms(e){e[pullAlgorithm_]=void 0,e[cancelAlgorithm_]=void 0}function readableByteStreamControllerClearPendingPullIntos(e){readableByteStreamControllerInvalidateBYOBRequest(e),e[pendingPullIntos_]=[]}function readableByteStreamControllerClose(e){const r=e[controlledReadableByteStream_];if(e[queueTotalSize_]>0)e[closeRequested_]=!0;else{if(e[pendingPullIntos_].length>0){if(e[pendingPullIntos_][0].bytesFilled>0){const r=new TypeError;throw readableByteStreamControllerError(e,r),r}}readableByteStreamControllerClearAlgorithms(e),readableStreamClose(r)}}function readableByteStreamControllerCommitPullIntoDescriptor(e,r){let t=!1;"closed"===e[state_]&&(t=!0);const a=readableByteStreamControllerConvertPullIntoDescriptor(r);"default"===r.readerType?readableStreamFulfillReadRequest(e,a,t):readableStreamFulfillReadIntoRequest(e,a,t)}function readableByteStreamControllerConvertPullIntoDescriptor(e){const{bytesFilled:r,elementSize:t}=e;return new e.ctor(e.buffer,e.byteOffset,r/t)}function readableByteStreamControllerEnqueue(e,r){const t=e[controlledReadableByteStream_],{buffer:a,byteOffset:o,byteLength:l}=r,n=transferArrayBuffer(a);if(readableStreamHasDefaultReader(t))if(0===readableStreamGetNumReadRequests(t))readableByteStreamControllerEnqueueChunkToQueue(e,n,o,l);else{readableStreamFulfillReadRequest(t,new Uint8Array(n,o,l),!1)}else readableStreamHasBYOBReader(t)?(readableByteStreamControllerEnqueueChunkToQueue(e,n,o,l),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)):readableByteStreamControllerEnqueueChunkToQueue(e,n,o,l);readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerEnqueueChunkToQueue(e,r,t,a){e[queue_].push({buffer:r,byteOffset:t,byteLength:a}),e[queueTotalSize_]+=a}function readableByteStreamControllerError(e,r){const t=e[controlledReadableByteStream_];"readable"===t[state_]&&(readableByteStreamControllerClearPendingPullIntos(e),resetQueue(e),readableByteStreamControllerClearAlgorithms(e),readableStreamError(t,r))}function readableByteStreamControllerFillHeadPullIntoDescriptor(e,r,t){readableByteStreamControllerInvalidateBYOBRequest(e),t.bytesFilled+=r}function readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,r){const t=r.elementSize,a=r.bytesFilled-r.bytesFilled%t,o=Math.min(e[queueTotalSize_],r.byteLength-r.bytesFilled),l=r.bytesFilled+o,n=l-l%t;let i=o,s=!1;n>a&&(i=n-r.bytesFilled,s=!0);const u=e[queue_];for(;i>0;){const t=u.front(),a=Math.min(i,t.byteLength),o=r.byteOffset+r.bytesFilled;copyDataBlockBytes(r.buffer,o,t.buffer,t.byteOffset,a),t.byteLength===a?u.shift():(t.byteOffset+=a,t.byteLength-=a),e[queueTotalSize_]-=a,readableByteStreamControllerFillHeadPullIntoDescriptor(e,a,r),i-=a}return s}function readableByteStreamControllerGetDesiredSize(e){const r=e[controlledReadableByteStream_][state_];return"errored"===r?null:"closed"===r?0:e[strategyHWM_]-e[queueTotalSize_]}function readableByteStreamControllerHandleQueueDrain(e){0===e[queueTotalSize_]&&e[closeRequested_]?(readableByteStreamControllerClearAlgorithms(e),readableStreamClose(e[controlledReadableByteStream_])):readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerInvalidateBYOBRequest(e){const r=e[byobRequest_];void 0!==r&&(r[associatedReadableByteStreamController_]=void 0,r[view_]=void 0,e[byobRequest_]=void 0)}function readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e){const r=e[pendingPullIntos_];for(;r.length>0;){if(0===e[queueTotalSize_])return;const t=r[0];readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,t)&&(readableByteStreamControllerShiftPendingPullInto(e),readableByteStreamControllerCommitPullIntoDescriptor(e[controlledReadableByteStream_],t))}}function readableByteStreamControllerPullInto(e,r,t){const a=e[controlledReadableByteStream_],o=r.BYTES_PER_ELEMENT||1,l=r.constructor,n=r.byteOffset,i=r.byteLength,s={buffer:transferArrayBuffer(r.buffer),byteOffset:n,byteLength:i,bytesFilled:0,elementSize:o,ctor:l,readerType:"byob"};if(e[pendingPullIntos_].length>0)return e[pendingPullIntos_].push(s),readableStreamAddReadIntoRequest(a,t);if("closed"===a[state_]){const e=new l(s.buffer,s.byteOffset,0);return Promise.resolve(readableStreamCreateReadResult(e,!0,t))}if(e[queueTotalSize_]>0){if(readableByteStreamControllerFillPullIntoDescriptorFromQueue(e,s)){const r=readableByteStreamControllerConvertPullIntoDescriptor(s);return readableByteStreamControllerHandleQueueDrain(e),Promise.resolve(readableStreamCreateReadResult(r,!1,t))}if(e[closeRequested_]){const r=new TypeError;return readableByteStreamControllerError(e,r),Promise.reject(r)}}e[pendingPullIntos_].push(s);const u=readableStreamAddReadIntoRequest(a,t);return readableByteStreamControllerCallPullIfNeeded(e),u}function readableByteStreamControllerRespond(e,r){if(!isFiniteNonNegativeNumber(r=Number(r)))throw new RangeError("bytesWritten must be a finite, non-negative number");readableByteStreamControllerRespondInternal(e,r)}function readableByteStreamControllerRespondInClosedState(e,r){r.buffer=transferArrayBuffer(r.buffer);const t=e[controlledReadableByteStream_];if(readableStreamHasBYOBReader(t))for(;readableStreamGetNumReadIntoRequests(t)>0;){readableByteStreamControllerCommitPullIntoDescriptor(t,readableByteStreamControllerShiftPendingPullInto(e))}}function readableByteStreamControllerRespondInReadableState(e,r,t){if(t.bytesFilled+r>t.byteLength)throw new RangeError;if(readableByteStreamControllerFillHeadPullIntoDescriptor(e,r,t),t.bytesFilled<t.elementSize)return;readableByteStreamControllerShiftPendingPullInto(e);const a=t.bytesFilled%t.elementSize;if(a>0){const r=t.byteOffset+t.bytesFilled,o=cloneArrayBuffer(t.buffer,r-a,a,ArrayBuffer);readableByteStreamControllerEnqueueChunkToQueue(e,o,0,o.byteLength)}t.buffer=transferArrayBuffer(t.buffer),t.bytesFilled=t.bytesFilled-a,readableByteStreamControllerCommitPullIntoDescriptor(e[controlledReadableByteStream_],t),readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(e)}function readableByteStreamControllerRespondInternal(e,r){const t=e[pendingPullIntos_][0];if("closed"===e[controlledReadableByteStream_][state_]){if(0!==r)throw new TypeError;readableByteStreamControllerRespondInClosedState(e,t)}else readableByteStreamControllerRespondInReadableState(e,r,t);readableByteStreamControllerCallPullIfNeeded(e)}function readableByteStreamControllerRespondWithNewView(e,r){const t=e[pendingPullIntos_][0];if(t.byteOffset+t.bytesFilled!==r.byteOffset)throw new RangeError;if(t.byteLength!==r.byteLength)throw new RangeError;t.buffer=r.buffer,readableByteStreamControllerRespondInternal(e,r.byteLength)}function readableByteStreamControllerShiftPendingPullInto(e){const r=e[pendingPullIntos_].shift();return readableByteStreamControllerInvalidateBYOBRequest(e),r}function readableByteStreamControllerShouldCallPull(e){const r=e[controlledReadableByteStream_];return"readable"===r[state_]&&(!e[closeRequested_]&&(!!e[started_]&&(!!(readableStreamHasDefaultReader(r)&&readableStreamGetNumReadRequests(r)>0)||(!!(readableStreamHasBYOBReader(r)&&readableStreamGetNumReadIntoRequests(r)>0)||readableByteStreamControllerGetDesiredSize(e)>0))))}function setUpReadableStreamBYOBRequest(e,r,t){if(!isReadableByteStreamController(r))throw new TypeError;if(!ArrayBuffer.isView(t))throw new TypeError;e[associatedReadableByteStreamController_]=r,e[view_]=t}const backpressure_=Symbol("backpressure_"),closeRequest_=Symbol("closeRequest_"),inFlightWriteRequest_=Symbol("inFlightWriteRequest_"),inFlightCloseRequest_=Symbol("inFlightCloseRequest_"),pendingAbortRequest_=Symbol("pendingAbortRequest_"),writableStreamController_=Symbol("writableStreamController_"),writer_=Symbol("writer_"),writeRequests_=Symbol("writeRequests_"),abortAlgorithm_=Symbol("abortAlgorithm_"),closeAlgorithm_=Symbol("closeAlgorithm_"),controlledWritableStream_=Symbol("controlledWritableStream_"),started_$1=Symbol("started_"),strategyHWM_$1=Symbol("strategyHWM_"),strategySizeAlgorithm_$1=Symbol("strategySizeAlgorithm_"),writeAlgorithm_=Symbol("writeAlgorithm_"),ownerWritableStream_=Symbol("ownerWritableStream_"),closedPromise_$1=Symbol("closedPromise_"),readyPromise_=Symbol("readyPromise_"),errorSteps_=Symbol("errorSteps_"),abortSteps_=Symbol("abortSteps_");function initializeWritableStream(e){e[state_]="writable",e[storedError_]=void 0,e[writer_]=void 0,e[writableStreamController_]=void 0,e[inFlightWriteRequest_]=void 0,e[closeRequest_]=void 0,e[inFlightCloseRequest_]=void 0,e[pendingAbortRequest_]=void 0,e[writeRequests_]=[],e[backpressure_]=!1}function isWritableStream(e){return"object"==typeof e&&null!==e&&writableStreamController_ in e}function isWritableStreamLocked(e){return void 0!==e[writer_]}function writableStreamAbort(e,r){const t=e[state_];if("closed"===t||"errored"===t)return Promise.resolve(void 0);let a=e[pendingAbortRequest_];if(void 0!==a)return a.promise;let o=!1;"erroring"===t&&(o=!0,r=void 0),a={reason:r,wasAlreadyErroring:o};const l=new Promise((e,r)=>{a.resolve=e,a.reject=r});return a.promise=l,e[pendingAbortRequest_]=a,o||writableStreamStartErroring(e,r),l}function writableStreamAddWriteRequest(e){const r=createControlledPromise();return e[writeRequests_].push(r),r.promise}function writableStreamDealWithRejection(e,r){"writable"!==e[state_]?writableStreamFinishErroring(e):writableStreamStartErroring(e,r)}function writableStreamStartErroring(e,r){const t=e[writableStreamController_];e[state_]="erroring",e[storedError_]=r;const a=e[writer_];void 0!==a&&writableStreamDefaultWriterEnsureReadyPromiseRejected(a,r),!writableStreamHasOperationMarkedInFlight(e)&&t[started_$1]&&writableStreamFinishErroring(e)}function writableStreamFinishErroring(e){e[state_]="errored";const r=e[writableStreamController_];r[errorSteps_]();const t=e[storedError_];for(const o of e[writeRequests_])o.reject(t);e[writeRequests_]=[];const a=e[pendingAbortRequest_];if(void 0!==a)return e[pendingAbortRequest_]=void 0,a.wasAlreadyErroring?(a.reject(t),void writableStreamRejectCloseAndClosedPromiseIfNeeded(e)):void r[abortSteps_](a.reason).then(r=>{a.resolve(),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)},r=>{a.reject(r),writableStreamRejectCloseAndClosedPromiseIfNeeded(e)});writableStreamRejectCloseAndClosedPromiseIfNeeded(e)}function writableStreamFinishInFlightWrite(e){e[inFlightWriteRequest_].resolve(void 0),e[inFlightWriteRequest_]=void 0}function writableStreamFinishInFlightWriteWithError(e,r){e[inFlightWriteRequest_].reject(r),e[inFlightWriteRequest_]=void 0,writableStreamDealWithRejection(e,r)}function writableStreamFinishInFlightClose(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 r=e[writer_];void 0!==r&&r[closedPromise_$1].resolve(void 0)}function writableStreamFinishInFlightCloseWithError(e,r){e[inFlightCloseRequest_].reject(r),e[inFlightCloseRequest_]=void 0,void 0!==e[pendingAbortRequest_]&&(e[pendingAbortRequest_].reject(r),e[pendingAbortRequest_]=void 0),writableStreamDealWithRejection(e,r)}function writableStreamCloseQueuedOrInFlight(e){return void 0!==e[closeRequest_]||void 0!==e[inFlightCloseRequest_]}function writableStreamHasOperationMarkedInFlight(e){return void 0!==e[inFlightWriteRequest_]||void 0!==e[inFlightCloseRequest_]}function writableStreamMarkCloseRequestInFlight(e){e[inFlightCloseRequest_]=e[closeRequest_],e[closeRequest_]=void 0}function writableStreamMarkFirstWriteRequestInFlight(e){const r=e[writeRequests_].shift();e[inFlightWriteRequest_]=r}function writableStreamRejectCloseAndClosedPromiseIfNeeded(e){const r=e[closeRequest_];void 0!==r&&(r.reject(e[storedError_]),e[closeRequest_]=void 0);const t=e[writer_];void 0!==t&&(t[closedPromise_$1].reject(e[storedError_]),t[closedPromise_$1].promise.catch(()=>{}))}function writableStreamUpdateBackpressure(e,r){const t=e[writer_];void 0!==t&&r!==e[backpressure_]&&(r?t[readyPromise_]=createControlledPromise():t[readyPromise_].resolve(void 0)),e[backpressure_]=r}function isWritableStreamDefaultWriter(e){return"object"==typeof e&&null!==e&&ownerWritableStream_ in e}function writableStreamDefaultWriterAbort(e,r){return writableStreamAbort(e[ownerWritableStream_],r)}function writableStreamDefaultWriterClose(e){const r=e[ownerWritableStream_],t=r[state_];if("closed"===t||"errored"===t)return Promise.reject(new TypeError("Writer stream is already closed or errored"));const a=createControlledPromise();return r[closeRequest_]=a,r[backpressure_]&&"writable"===t&&e[readyPromise_].resolve(void 0),writableStreamDefaultControllerClose(r[writableStreamController_]),a.promise}function writableStreamDefaultWriterCloseWithErrorPropagation(e){const r=e[ownerWritableStream_],t=r[state_];return writableStreamCloseQueuedOrInFlight(r)||"closed"===t?Promise.resolve(void 0):"errored"===t?Promise.reject(r[storedError_]):writableStreamDefaultWriterClose(e)}function writableStreamDefaultWriterEnsureClosedPromiseRejected(e,r){const t=e[closedPromise_$1];t.state===ControlledPromiseState.Pending?t.reject(r):(e[closedPromise_$1]=createControlledPromise(),e[closedPromise_$1].reject(r)),e[closedPromise_$1].promise.catch(()=>{})}function writableStreamDefaultWriterEnsureReadyPromiseRejected(e,r){const t=e[readyPromise_];t.state===ControlledPromiseState.Pending?t.reject(r):(e[readyPromise_]=createControlledPromise(),e[readyPromise_].reject(r)),e[readyPromise_].promise.catch(()=>{})}function writableStreamDefaultWriterGetDesiredSize(e){const r=e[ownerWritableStream_],t=r[state_];return"errored"===t||"erroring"===t?null:"closed"===t?0:writableStreamDefaultControllerGetDesiredSize(r[writableStreamController_])}function writableStreamDefaultWriterRelease(e){const r=e[ownerWritableStream_],t=new TypeError;writableStreamDefaultWriterEnsureReadyPromiseRejected(e,t),writableStreamDefaultWriterEnsureClosedPromiseRejected(e,t),r[writer_]=void 0,e[ownerWritableStream_]=void 0}function writableStreamDefaultWriterWrite(e,r){const t=e[ownerWritableStream_],a=t[writableStreamController_],o=writableStreamDefaultControllerGetChunkSize(a,r);if(e[ownerWritableStream_]!==t)return Promise.reject(new TypeError);const l=t[state_];if("errored"===l)return Promise.reject(t[storedError_]);if(writableStreamCloseQueuedOrInFlight(t)||"closed"===l)return Promise.reject(new TypeError("Cannot write to a closing or closed stream"));if("erroring"===l)return Promise.reject(t[storedError_]);const n=writableStreamAddWriteRequest(t);return writableStreamDefaultControllerWrite(a,r,o),n}function setUpWritableStreamDefaultController(e,r,t,a,o,l,n,i){if(!isWritableStream(e))throw new TypeError;if(void 0!==e[writableStreamController_])throw new TypeError;r[controlledWritableStream_]=e,e[writableStreamController_]=r,resetQueue(r),r[started_$1]=!1,r[strategySizeAlgorithm_$1]=i,r[strategyHWM_$1]=n,r[writeAlgorithm_]=a,r[closeAlgorithm_]=o,r[abortAlgorithm_]=l;const s=writableStreamDefaultControllerGetBackpressure(r);writableStreamUpdateBackpressure(e,s);const u=t();Promise.resolve(u).then(e=>{r[started_$1]=!0,writableStreamDefaultControllerAdvanceQueueIfNeeded(r)},t=>{r[started_$1]=!0,writableStreamDealWithRejection(e,t)})}function isWritableStreamDefaultController(e){return"object"==typeof e&&null!==e&&controlledWritableStream_ in e}function writableStreamDefaultControllerClearAlgorithms(e){e[writeAlgorithm_]=void 0,e[closeAlgorithm_]=void 0,e[abortAlgorithm_]=void 0,e[strategySizeAlgorithm_$1]=void 0}function writableStreamDefaultControllerClose(e){enqueueValueWithSize(e,"close",0),writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerGetChunkSize(e,r){let t;try{t=e[strategySizeAlgorithm_$1](r)}catch(a){writableStreamDefaultControllerErrorIfNeeded(e,a),t=1}return t}function writableStreamDefaultControllerGetDesiredSize(e){return e[strategyHWM_$1]-e[queueTotalSize_]}function writableStreamDefaultControllerWrite(e,r,t){try{enqueueValueWithSize(e,{chunk:r},t)}catch(o){return void writableStreamDefaultControllerErrorIfNeeded(e,o)}const a=e[controlledWritableStream_];if(!writableStreamCloseQueuedOrInFlight(a)&&"writable"===a[state_]){writableStreamUpdateBackpressure(a,writableStreamDefaultControllerGetBackpressure(e))}writableStreamDefaultControllerAdvanceQueueIfNeeded(e)}function writableStreamDefaultControllerAdvanceQueueIfNeeded(e){if(!e[started_$1])return;const r=e[controlledWritableStream_];if(void 0!==r[inFlightWriteRequest_])return;const t=r[state_];if("closed"===t||"errored"===t)return;if("erroring"===t)return void writableStreamFinishErroring(r);if(0===e[queue_].length)return;const a=peekQueueValue(e);"close"===a?writableStreamDefaultControllerProcessClose(e):writableStreamDefaultControllerProcessWrite(e,a.chunk)}function writableStreamDefaultControllerErrorIfNeeded(e,r){"writable"===e[controlledWritableStream_][state_]&&writableStreamDefaultControllerError(e,r)}function writableStreamDefaultControllerProcessClose(e){const r=e[controlledWritableStream_];writableStreamMarkCloseRequestInFlight(r),dequeueValue(e);const t=e[closeAlgorithm_]();writableStreamDefaultControllerClearAlgorithms(e),t.then(e=>{writableStreamFinishInFlightClose(r)},e=>{writableStreamFinishInFlightCloseWithError(r,e)})}function writableStreamDefaultControllerProcessWrite(e,r){const t=e[controlledWritableStream_];writableStreamMarkFirstWriteRequestInFlight(t),e[writeAlgorithm_](r).then(r=>{writableStreamFinishInFlightWrite(t);const a=t[state_];if(dequeueValue(e),!writableStreamCloseQueuedOrInFlight(t)&&"writable"===a){const r=writableStreamDefaultControllerGetBackpressure(e);writableStreamUpdateBackpressure(t,r)}writableStreamDefaultControllerAdvanceQueueIfNeeded(e)},r=>{"writable"===t[state_]&&writableStreamDefaultControllerClearAlgorithms(e),writableStreamFinishInFlightWriteWithError(t,r)})}function writableStreamDefaultControllerGetBackpressure(e){return writableStreamDefaultControllerGetDesiredSize(e)<=0}function writableStreamDefaultControllerError(e,r){const t=e[controlledWritableStream_];writableStreamDefaultControllerClearAlgorithms(e),writableStreamStartErroring(t,r)}class ReadableStreamDefaultReader{constructor(e){if(!isReadableStream(e))throw new TypeError;if(isReadableStreamLocked(e))throw new TypeError("The stream is locked.");readableStreamReaderGenericInitialize(this,e),this[readRequests_]=[]}get closed(){return isReadableStreamDefaultReader(this)?this[closedPromise_].promise:Promise.reject(new TypeError)}cancel(e){if(!isReadableStreamDefaultReader(this))return Promise.reject(new TypeError);const r=this[ownerReadableStream_];return void 0===r?Promise.reject(new TypeError("Reader is not associated with a stream")):readableStreamCancel(r,e)}read(){return isReadableStreamDefaultReader(this)?void 0===this[ownerReadableStream_]?Promise.reject(new TypeError("Reader is not associated with a stream")):readableStreamDefaultReaderRead(this,!0):Promise.reject(new TypeError)}releaseLock(){if(!isReadableStreamDefaultReader(this))throw new TypeError;if(void 0!==this[ownerReadableStream_]){if(0!==this[readRequests_].length)throw new TypeError("Cannot release a stream with pending read requests");readableStreamReaderGenericRelease(this)}}}class WritableStreamDefaultWriter{constructor(e){if(!isWritableStream(e))throw new TypeError;if(isWritableStreamLocked(e))throw new TypeError("Stream is already locked");this[ownerWritableStream_]=e,e[writer_]=this;const r=createControlledPromise(),t=createControlledPromise();this[readyPromise_]=r,this[closedPromise_$1]=t;const a=e[state_];if("writable"===a)!writableStreamCloseQueuedOrInFlight(e)&&e[backpressure_]||r.resolve(void 0);else if("erroring"===a)r.reject(e[storedError_]),r.promise.catch(()=>{});else if("closed"===a)r.resolve(void 0),t.resolve(void 0);else{const a=e[storedError_];r.reject(a),r.promise.catch(()=>{}),t.reject(a),t.promise.catch(()=>{})}}abort(e){return isWritableStreamDefaultWriter(this)?void 0===this[ownerWritableStream_]?Promise.reject(new TypeError("Writer is not connected to a stream")):writableStreamDefaultWriterAbort(this,e):Promise.reject(new TypeError)}close(){if(!isWritableStreamDefaultWriter(this))return Promise.reject(new TypeError);const e=this[ownerWritableStream_];return void 0===e?Promise.reject(new TypeError("Writer is not connected to a stream")):writableStreamCloseQueuedOrInFlight(e)?Promise.reject(new TypeError):writableStreamDefaultWriterClose(this)}releaseLock(){void 0!==this[ownerWritableStream_]&&writableStreamDefaultWriterRelease(this)}write(e){return isWritableStreamDefaultWriter(this)?void 0===this[ownerWritableStream_]?Promise.reject(new TypeError("Writer is not connected to a stream")):writableStreamDefaultWriterWrite(this,e):Promise.reject(new TypeError)}get closed(){return isWritableStreamDefaultWriter(this)?this[closedPromise_$1].promise:Promise.reject(new TypeError)}get desiredSize(){if(!isWritableStreamDefaultWriter(this))throw new TypeError;if(void 0===this[ownerWritableStream_])throw new TypeError("Writer is not connected to stream");return writableStreamDefaultWriterGetDesiredSize(this)}get ready(){return isWritableStreamDefaultWriter(this)?this[readyPromise_].promise:Promise.reject(new TypeError)}}function pipeTo(e,r,t){const a=!!t.preventClose,o=!!t.preventAbort,l=!!t.preventCancel,n=t.signal;let i=!1,s=Promise.resolve();const u=createControlledPromise(),d=new ReadableStreamDefaultReader(e),m=new WritableStreamDefaultWriter(r);let c;function b(e,r,t){"errored"===e[state_]?t(e[storedError_]):r.catch(t)}if(void 0!==n&&(c=(()=>{const t=new DOMException("Aborted","AbortError"),a=[];!1===o&&a.push(()=>"writable"===r[state_]?writableStreamAbort(r,t):Promise.resolve()),!1===l&&a.push(()=>"readable"===e[state_]?readableStreamCancel(e,t):Promise.resolve()),S(()=>Promise.all(a.map(e=>e())).then(e=>void 0),{actualError:t})}),!0===n.aborted?c():n.addEventListener("abort",c)),b(e,d[closedPromise_].promise,e=>{S(o?void 0:()=>writableStreamAbort(r,e),{actualError:e})}),b(r,m[closedPromise_$1].promise,r=>{S(l?void 0:()=>readableStreamCancel(e,r),{actualError:r})}),function(e,r,t){"closed"===e[state_]?t():r.then(t)}(e,d[closedPromise_].promise,()=>{a?S():S(()=>writableStreamDefaultWriterCloseWithErrorPropagation(m))}),writableStreamCloseQueuedOrInFlight(r)||"closed"===r[state_]){const r=new TypeError;S(l?void 0:()=>readableStreamCancel(e,r),{actualError:r})}function f(){return"writable"!==r[state_]||writableStreamCloseQueuedOrInFlight(r)?void 0:function e(){const r=s;return s.then(()=>r===s?void 0:e())}()}function S(e,r){if(i)return;function t(){e().then(e=>h(r),e=>h({actualError:e}))}i=!0,void 0===e&&(e=(()=>Promise.resolve()));const a=f();a?a.then(t):t()}function h(e){writableStreamDefaultWriterRelease(m),readableStreamReaderGenericRelease(d),n&&c&&n.removeEventListener("abort",c),e?u.reject(e.actualError):u.resolve(void 0)}return i||function e(){i||m[readyPromise_].promise.then(()=>{readableStreamDefaultReaderRead(d).then(({value:r,done:t})=>{t||(s=writableStreamDefaultWriterWrite(m,r).catch(()=>{}),e())},e=>{s=Promise.resolve()})})}(),u.promise}class ReadableStreamDefaultController{constructor(){throw new TypeError}get desiredSize(){return readableStreamDefaultControllerGetDesiredSize(this)}close(){if(!isReadableStreamDefaultController(this))throw new TypeError;if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("Cannot close, the stream is already closing or not readable");readableStreamDefaultControllerClose(this)}enqueue(e){if(!isReadableStreamDefaultController(this))throw new TypeError;if(!readableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("Cannot enqueue, the stream is closing or not readable");readableStreamDefaultControllerEnqueue(this,e)}error(e){if(!isReadableStreamDefaultController(this))throw new TypeError;readableStreamDefaultControllerError(this,e)}[cancelSteps_](e){resetQueue(this);const r=this[cancelAlgorithm_](e);return readableStreamDefaultControllerClearAlgorithms(this),r}[pullSteps_](e){const r=this[controlledReadableStream_];if(this[queue_].length>0){const t=dequeueValue(this);return this[closeRequested_]&&0===this[queue_].length?(readableStreamDefaultControllerClearAlgorithms(this),readableStreamClose(r)):readableStreamDefaultControllerCallPullIfNeeded(this),Promise.resolve(readableStreamCreateReadResult(t,!1,e))}const t=readableStreamAddReadRequest(r,e);return readableStreamDefaultControllerCallPullIfNeeded(this),t}}function setUpReadableStreamDefaultControllerFromUnderlyingSource(e,r,t,a){const o=Object.create(ReadableStreamDefaultController.prototype),l=createAlgorithmFromUnderlyingMethod(r,"pull",[o]),n=createAlgorithmFromUnderlyingMethod(r,"cancel",[]);setUpReadableStreamDefaultController(e,o,()=>invokeOrNoop(r,"start",[o]),l,n,t,a)}class ReadableStreamBYOBRequest{constructor(){throw new TypeError}get view(){if(!isReadableStreamBYOBRequest(this))throw new TypeError;return this[view_]}respond(e){if(!isReadableStreamBYOBRequest(this))throw new TypeError;if(void 0===this[associatedReadableByteStreamController_])throw new TypeError;return readableByteStreamControllerRespond(this[associatedReadableByteStreamController_],e)}respondWithNewView(e){if(!isReadableStreamBYOBRequest(this))throw new TypeError;if(void 0===this[associatedReadableByteStreamController_])throw new TypeError;if(!ArrayBuffer.isView(e))throw new TypeError("view parameter must be a TypedArray");return readableByteStreamControllerRespondWithNewView(this[associatedReadableByteStreamController_],e)}}class ReadableByteStreamController{constructor(){throw new TypeError}get byobRequest(){if(!isReadableByteStreamController(this))throw new TypeError;if(void 0===this[byobRequest_]&&this[pendingPullIntos_].length>0){const e=this[pendingPullIntos_][0],r=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),t=Object.create(ReadableStreamBYOBRequest.prototype);setUpReadableStreamBYOBRequest(t,this,r),this[byobRequest_]=t}return this[byobRequest_]}get desiredSize(){if(!isReadableByteStreamController(this))throw new TypeError;return readableByteStreamControllerGetDesiredSize(this)}close(){if(!isReadableByteStreamController(this))throw new TypeError;if(this[closeRequested_])throw new TypeError("Stream is already closing");if("readable"!==this[controlledReadableByteStream_][state_])throw new TypeError("Stream is closed or errored");readableByteStreamControllerClose(this)}enqueue(e){if(!isReadableByteStreamController(this))throw new TypeError;if(this[closeRequested_])throw new TypeError("Stream is already closing");if("readable"!==this[controlledReadableByteStream_][state_])throw new TypeError("Stream is closed or errored");if(!ArrayBuffer.isView(e))throw new TypeError("chunk must be a valid ArrayBufferView");return readableByteStreamControllerEnqueue(this,e)}error(e){if(!isReadableByteStreamController(this))throw new TypeError;readableByteStreamControllerError(this,e)}[cancelSteps_](e){if(this[pendingPullIntos_].length>0){this[pendingPullIntos_][0].bytesFilled=0}resetQueue(this);const r=this[cancelAlgorithm_](e);return readableByteStreamControllerClearAlgorithms(this),r}[pullSteps_](e){const r=this[controlledReadableByteStream_];if(this[queueTotalSize_]>0){const r=this[queue_].shift();this[queueTotalSize_]-=r.byteLength,readableByteStreamControllerHandleQueueDrain(this);const t=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);return Promise.resolve(readableStreamCreateReadResult(t,!1,e))}const t=this[autoAllocateChunkSize_];if(void 0!==t){let e;try{e=new ArrayBuffer(t)}catch(o){return Promise.reject(o)}const r={buffer:e,byteOffset:0,byteLength:t,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this[pendingPullIntos_].push(r)}const a=readableStreamAddReadRequest(r,e);return readableByteStreamControllerCallPullIfNeeded(this),a}}function setUpReadableByteStreamControllerFromUnderlyingSource(e,r,t){const a=Object.create(ReadableByteStreamController.prototype),o=createAlgorithmFromUnderlyingMethod(r,"pull",[a]),l=createAlgorithmFromUnderlyingMethod(r,"cancel",[]);let n=r.autoAllocateChunkSize;if(void 0!==n&&(!isInteger(n=Number(n))||n<=0))throw new RangeError("autoAllocateChunkSize must be a positive, finite integer");setUpReadableByteStreamController(e,a,()=>invokeOrNoop(r,"start",[a]),o,l,t,n)}class SDReadableStreamBYOBReader{constructor(e){if(!isReadableStream(e))throw new TypeError;if(!isReadableByteStreamController(e[readableStreamController_]))throw new TypeError;if(isReadableStreamLocked(e))throw new TypeError("The stream is locked.");readableStreamReaderGenericInitialize(this,e),this[readIntoRequests_]=[]}get closed(){return isReadableStreamBYOBReader(this)?this[closedPromise_].promise:Promise.reject(new TypeError)}cancel(e){if(!isReadableStreamBYOBReader(this))return Promise.reject(new TypeError);const r=this[ownerReadableStream_];return void 0===r?Promise.reject(new TypeError("Reader is not associated with a stream")):readableStreamCancel(r,e)}read(e){return isReadableStreamBYOBReader(this)?void 0===this[ownerReadableStream_]?Promise.reject(new TypeError("Reader is not associated with a stream")):ArrayBuffer.isView(e)?0===e.byteLength?Promise.reject(new TypeError("supplied buffer view must be > 0 bytes")):readableStreamBYOBReaderRead(this,e,!0):Promise.reject(new TypeError("view argument must be a valid ArrayBufferView")):Promise.reject(new TypeError)}releaseLock(){if(!isReadableStreamBYOBReader(this))throw new TypeError;if(void 0===this[ownerReadableStream_])throw new TypeError("Reader is not associated with a stream");if(this[readIntoRequests_].length>0)throw new TypeError;readableStreamReaderGenericRelease(this)}}class SDReadableStream{constructor(e={},r={}){initializeReadableStream(this);const t=r.size,a=r.highWaterMark,o=e.type;if(void 0===o){const r=makeSizeAlgorithmFromSizeFunction(t);setUpReadableStreamDefaultControllerFromUnderlyingSource(this,e,validateAndNormalizeHighWaterMark(void 0===a?1:a),r)}else{if("bytes"!==String(o))throw new RangeError("The underlying source's `type` field must be undefined or 'bytes'");if(void 0!==t)throw new RangeError("bytes streams cannot have a strategy with a `size` field");setUpReadableByteStreamControllerFromUnderlyingSource(this,e,validateAndNormalizeHighWaterMark(void 0===a?0:a))}}get locked(){return isReadableStreamLocked(this)}getReader(e){if(!isReadableStream(this))throw new TypeError;void 0===e&&(e={});const{mode:r}=e;if(void 0===r)return new ReadableStreamDefaultReader(this);if("byob"===String(r))return new SDReadableStreamBYOBReader(this);throw RangeError("mode option must be undefined or `byob`")}cancel(e){return isReadableStream(this)?isReadableStreamLocked(this)?Promise.reject(new TypeError("Cannot cancel a locked stream")):readableStreamCancel(this,e):Promise.reject(new TypeError)}tee(){return readableStreamTee(this,!1)}pipeThrough(e,r={}){const{readable:t,writable:a}=e;if(!isReadableStream(this))throw new TypeError;if(!isWritableStream(a))throw new TypeError("writable must be a WritableStream");if(!isReadableStream(t))throw new TypeError("readable must be a ReadableStream");if(void 0!==r.signal&&!isAbortSignal(r.signal))throw new TypeError("options.signal must be an AbortSignal instance");if(isReadableStreamLocked(this))throw new TypeError("Cannot pipeThrough on a locked stream");if(isWritableStreamLocked(a))throw new TypeError("Cannot pipeThrough to a locked stream");return pipeTo(this,a,r).catch(()=>{}),t}pipeTo(e,r={}){return isReadableStream(this)?isWritableStream(e)?void 0===r.signal||isAbortSignal(r.signal)?isReadableStreamLocked(this)?Promise.reject(new TypeError("Cannot pipe from a locked stream")):isWritableStreamLocked(e)?Promise.reject(new TypeError("Cannot pipe to a locked stream")):pipeTo(this,e,r):Promise.reject(new TypeError("options.signal must be an AbortSignal instance")):Promise.reject(new TypeError("destination must be a WritableStream")):Promise.reject(new TypeError)}}function createReadableStream(e,r,t,a,o){void 0===a&&(a=1),void 0===o&&(o=(()=>1));const l=Object.create(SDReadableStream.prototype);return initializeReadableStream(l),setUpReadableStreamDefaultController(l,Object.create(ReadableStreamDefaultController.prototype),e,r,t,a,o),l}function readableStreamTee(e,r){if(!isReadableStream(e))throw new TypeError;const t=new ReadableStreamDefaultReader(e);let a,o,l,n,i,s=!1,u=!1,d=!1;const m=new Promise(e=>i=e),c=()=>readableStreamDefaultReaderRead(t).then(({value:e,done:t})=>{if(t&&!s&&(u||readableStreamDefaultControllerClose(l[readableStreamController_]),d||readableStreamDefaultControllerClose(n[readableStreamController_]),s=!0),s)return;const a=e;let o=e;u||readableStreamDefaultControllerEnqueue(l[readableStreamController_],a),d||(r&&(o=cloneValue(o)),readableStreamDefaultControllerEnqueue(n[readableStreamController_],o))}),b=()=>void 0;return l=createReadableStream(b,c,r=>{if(u=!0,a=r,d){const r=readableStreamCancel(e,[a,o]);i(r)}return m}),n=createReadableStream(b,c,r=>{if(d=!0,o=r,u){const r=readableStreamCancel(e,[a,o]);i(r)}return m}),t[closedPromise_].promise.catch(e=>{s||(readableStreamDefaultControllerError(l[readableStreamController_],e),readableStreamDefaultControllerError(n[readableStreamController_],e),s=!0)}),[l,n]}class WritableStreamDefaultController{constructor(){throw new TypeError}error(e){if(!isWritableStreamDefaultController(this))throw new TypeError;"writable"===this[controlledWritableStream_][state_]&&writableStreamDefaultControllerError(this,e)}[abortSteps_](e){const r=this[abortAlgorithm_](e);return writableStreamDefaultControllerClearAlgorithms(this),r}[errorSteps_](){resetQueue(this)}}function setUpWritableStreamDefaultControllerFromUnderlyingSink(e,r,t,a){const o=Object.create(WritableStreamDefaultController.prototype),l=createAlgorithmFromUnderlyingMethod(r,"write",[o]),n=createAlgorithmFromUnderlyingMethod(r,"close",[]),i=createAlgorithmFromUnderlyingMethod(r,"abort",[]);setUpWritableStreamDefaultController(e,o,function(){return invokeOrNoop(r,"start",[o])},l,n,i,t,a)}class WritableStream{constructor(e={},r={}){initializeWritableStream(this);const t=r.size,a=r.highWaterMark;if(void 0!==e.type)throw new RangeError("The type of an underlying sink must be undefined");const o=makeSizeAlgorithmFromSizeFunction(t);setUpWritableStreamDefaultControllerFromUnderlyingSink(this,e,validateAndNormalizeHighWaterMark(void 0===a?1:a),o)}get locked(){if(!isWritableStream(this))throw new TypeError;return isWritableStreamLocked(this)}abort(e){return isWritableStream(this)?isWritableStreamLocked(this)?Promise.reject(new TypeError("Cannot abort a locked stream")):writableStreamAbort(this,e):Promise.reject(new TypeError)}getWriter(){if(!isWritableStream(this))throw new TypeError;return new WritableStreamDefaultWriter(this)}}function createWritableStream(e,r,t,a,o,l){void 0===o&&(o=1),void 0===l&&(l=(()=>1));const n=Object.create(WritableStream.prototype);return initializeWritableStream(n),setUpWritableStreamDefaultController(n,Object.create(WritableStreamDefaultController.prototype),e,r,t,a,o,l),n}const backpressure_$1=Symbol("backpressure_"),backpressureChangePromise_=Symbol("backpressureChangePromise_"),readable_=Symbol("readable_"),transformStreamController_=Symbol("transformStreamController_"),writable_=Symbol("writable_"),controlledTransformStream_=Symbol("controlledTransformStream_"),flushAlgorithm_=Symbol("flushAlgorithm_"),transformAlgorithm_=Symbol("transformAlgorithm_");function isTransformStream(e){return"object"==typeof e&&null!==e&&transformStreamController_ in e}function initializeTransformStream(e,r,t,a,o,l){const n=function(){return r};e[writable_]=createWritableStream(n,function(r){return transformStreamDefaultSinkWriteAlgorithm(e,r)},function(){return transformStreamDefaultSinkCloseAlgorithm(e)},function(r){return transformStreamDefaultSinkAbortAlgorithm(e,r)},t,a);e[readable_]=createReadableStream(n,function(){return transformStreamDefaultSourcePullAlgorithm(e)},function(r){return transformStreamErrorWritableAndUnblockWrite(e,r),Promise.resolve(void 0)},o,l),e[backpressure_$1]=void 0,e[backpressureChangePromise_]=void 0,transformStreamSetBackpressure(e,!0),e[transformStreamController_]=void 0}function transformStreamError(e,r){readableStreamDefaultControllerError(e[readable_][readableStreamController_],r),transformStreamErrorWritableAndUnblockWrite(e,r)}function transformStreamErrorWritableAndUnblockWrite(e,r){transformStreamDefaultControllerClearAlgorithms(e[transformStreamController_]),writableStreamDefaultControllerErrorIfNeeded(e[writable_][writableStreamController_],r),e[backpressure_$1]&&transformStreamSetBackpressure(e,!1)}function transformStreamSetBackpressure(e,r){void 0!==e[backpressure_$1]&&e[backpressureChangePromise_].resolve(void 0),e[backpressureChangePromise_]=createControlledPromise(),e[backpressure_$1]=r}function isTransformStreamDefaultController(e){return"object"==typeof e&&null!==e&&controlledTransformStream_ in e}function setUpTransformStreamDefaultController(e,r,t,a){r[controlledTransformStream_]=e,e[transformStreamController_]=r,r[transformAlgorithm_]=t,r[flushAlgorithm_]=a}function transformStreamDefaultControllerClearAlgorithms(e){e[transformAlgorithm_]=void 0,e[flushAlgorithm_]=void 0}function transformStreamDefaultControllerEnqueue(e,r){const t=e[controlledTransformStream_],a=t[readable_][readableStreamController_];if(!readableStreamDefaultControllerCanCloseOrEnqueue(a))throw new TypeError;try{readableStreamDefaultControllerEnqueue(a,r)}catch(o){throw transformStreamErrorWritableAndUnblockWrite(t,o),t[readable_][storedError_]}readableStreamDefaultControllerHasBackpressure(a)!==t[backpressure_$1]&&transformStreamSetBackpressure(t,!0)}function transformStreamDefaultControllerError(e,r){transformStreamError(e[controlledTransformStream_],r)}function transformStreamDefaultControllerPerformTransform(e,r){return e[transformAlgorithm_](r).catch(r=>{throw transformStreamError(e[controlledTransformStream_],r),r})}function transformStreamDefaultControllerTerminate(e){const r=e[controlledTransformStream_],t=r[readable_][readableStreamController_];readableStreamDefaultControllerCanCloseOrEnqueue(t)&&readableStreamDefaultControllerClose(t),transformStreamErrorWritableAndUnblockWrite(r,new TypeError("The transform stream has been terminated"))}function transformStreamDefaultSinkWriteAlgorithm(e,r){const t=e[transformStreamController_];if(e[backpressure_$1]){return e[backpressureChangePromise_].promise.then(a=>{const o=e[writable_];if("erroring"===o[state_])throw o[storedError_];return transformStreamDefaultControllerPerformTransform(t,r)})}return transformStreamDefaultControllerPerformTransform(t,r)}function transformStreamDefaultSinkAbortAlgorithm(e,r){return transformStreamError(e,r),Promise.resolve(void 0)}function transformStreamDefaultSinkCloseAlgorithm(e){const r=e[readable_],t=e[transformStreamController_],a=t[flushAlgorithm_]();return transformStreamDefaultControllerClearAlgorithms(t),a.then(e=>{if("errored"===r[state_])throw r[storedError_];const t=r[readableStreamController_];readableStreamDefaultControllerCanCloseOrEnqueue(t)&&readableStreamDefaultControllerClose(t)},t=>{throw transformStreamError(e,t),r[storedError_]})}function transformStreamDefaultSourcePullAlgorithm(e){return transformStreamSetBackpressure(e,!1),e[backpressureChangePromise_].promise}class TransformStreamDefaultController{constructor(){throw new TypeError}get desiredSize(){if(!isTransformStreamDefaultController(this))throw new TypeError;return readableStreamDefaultControllerGetDesiredSize(this[controlledTransformStream_][readable_][readableStreamController_])}enqueue(e){if(!isTransformStreamDefaultController(this))throw new TypeError;transformStreamDefaultControllerEnqueue(this,e)}error(e){if(!isTransformStreamDefaultController(this))throw new TypeError;transformStreamDefaultControllerError(this,e)}terminate(){if(!isTransformStreamDefaultController(this))throw new TypeError;transformStreamDefaultControllerTerminate(this)}}class TransformStream$1{constructor(e={},r={},t={}){const a=r.size,o=r.highWaterMark,l=t.size,n=t.highWaterMark;if(void 0!==e.writableType)throw new RangeError("The transformer's `writableType` field must be undefined");const i=makeSizeAlgorithmFromSizeFunction(a),s=validateAndNormalizeHighWaterMark(void 0===o?1:o);if(void 0!==e.readableType)throw new RangeError("The transformer's `readableType` field must be undefined");const u=makeSizeAlgorithmFromSizeFunction(l),d=validateAndNormalizeHighWaterMark(void 0===n?0:n),m=createControlledPromise();initializeTransformStream(this,m.promise,s,i,d,u),setUpTransformStreamDefaultControllerFromTransformer(this,e);const c=invokeOrNoop(e,"start",[this[transformStreamController_]]);m.resolve(c)}get readable(){if(!isTransformStream(this))throw new TypeError;return this[readable_]}get writable(){if(!isTransformStream(this))throw new TypeError;return this[writable_]}}function setUpTransformStreamDefaultControllerFromTransformer(e,r){const t=Object.create(TransformStreamDefaultController.prototype);let a;const o=r.transform;if(void 0!==o){if("function"!=typeof o)throw new TypeError("`transform` field of the transformer must be a function");a=(e=>promiseCall(o,r,[e,t]))}else a=function(e){try{transformStreamDefaultControllerEnqueue(t,e)}catch(r){return Promise.reject(r)}return Promise.resolve(void 0)};const l=createAlgorithmFromUnderlyingMethod(r,"flush",[t]);setUpTransformStreamDefaultController(e,t,a,l)}class ByteLengthQueuingStrategy{constructor(e){this.highWaterMark=e.highWaterMark}size(e){return e.byteLength}}class CountQueuingStrategy{constructor(e){this.highWaterMark=e.highWaterMark}size(){return 1}}function wrapReadableStream(e,r){let t;return new r({start(r){(t=e.getReader()).closed.catch(e=>{r.error(e)})},pull:e=>t.read().then(({value:r,done:t})=>{t?e.close():e.enqueue(r)},r=>{e.error(r)}),cancel(e){t.cancel(e)}})}function getMIMETypeFromHeadersInit(e){if(void 0===e)return"";if(e instanceof Headers)return e.get("Content-Type")||"";if(Array.isArray(e)){const r=e.find(e=>Array.isArray(e)&&2===e.length&&"Content-Type"===e[0]);return r?r[1]:""}return e["Content-Type"]||""}function resolveRequestInitStream(e,r,t){if(void 0===e)return Promise.resolve(e);const a=e.body;let o;if(a&&"object"==typeof a&&(r&&a instanceof r?o=a:a instanceof t&&(o=a)),!o)return Promise.resolve(e);const l=getMIMETypeFromHeadersInit(e.headers);return readAllBytesFromStream(o.getReader(),l).then(r=>(e.body=r,e))}function createAdaptedFetch(e,r,t,a,o){return function(l,n){return resolveRequestInitStream(n,t,a).then(t=>e.call(void 0,l,t).then(e=>{if("body"in e){const t=e;let l,i;e=new Proxy(t,{get(s,u,d){let m;return"body"===u?(void 0===l&&(l=wrapReadableStream(t.body,a)),m=l):"clone"===u?(void 0===i&&(i=function(){const[t,a]=o(e.body,!0);return l=t,createResponseProxyWithStreamBody(r,o,a,n)}),m=i):m=s[u],"function"==typeof m?function(...e){return m.apply(s,e)}:m}})}else e.body=new a({pull:r=>e.arrayBuffer().then(e=>{r.enqueue(new Uint8Array(e)),r.close()},e=>{r.error(e)})}),e.clone=function(){const[t,a]=o(e.body,!0);return e.body=t,createResponseProxyWithStreamBody(r,o,a,n)};return e}))}}function readAllBytesFromStream(e,r){return new Promise((t,a)=>{const o=[];!function l(){e.read().then(({value:e,done:n})=>{n?function(){0===o.length&&o.push(new Uint8Array(0));const e=new Blob(o,{type:r});t(e)}():e instanceof Uint8Array?(o.push(e),l()):a(new TypeError("A ReadableStream body must only yield Uint8Array values"))},e=>{a(e)})}()})}function createResponseProxyWithStreamBody(e,r,t,a){const o=new e("fake",a),l=getMIMETypeFromHeadersInit(o.headers);let n,i=!1;function s(){return void 0===n&&(n=new Promise((r,o)=>{if(i=!0,t.locked)return o(new TypeError("The ReadableStream is locked"));readAllBytesFromStream(t.getReader(),l).then(t=>{r(new e(t,a))}).catch(e=>{o(e)})})),n}return new class{get type(){return o.type}get url(){return o.url}get redirected(){return o.redirected}get status(){return o.status}get ok(){return o.ok}get statusText(){return o.statusText}get headers(){return o.headers}clone(){const[o,l]=r(t,!0);return t=o,createResponseProxyWithStreamBody(e,r,l,a)}get body(){return t}get bodyUsed(){return i}arrayBuffer(){return s().then(e=>e.arrayBuffer())}blob(){return s().then(e=>e.blob())}formData(){return s().then(e=>e.formData())}json(){return s().then(e=>e.json())}text(){return s().then(e=>e.text())}}}function createAdaptedResponse(e,r,t,a){const o=function(o,l){if(o instanceof t){if(void 0===r||!("body"in e))return createResponseProxyWithStreamBody(e,a,o,l);o=wrapReadableStream(o,r)}return new e(o,l)};return o.prototype=e.prototype,o}const decDecoder=Symbol("decDecoder"),decTransform=Symbol("decTransform");class TextDecodeTransformer{constructor(e){this.decoder_=e}transform(e,r){if(!(e instanceof ArrayBuffer||ArrayBuffer.isView(e)))throw new TypeError("Input data must be a BufferSource");const t=this.decoder_.decode(e,{stream:!0});0!==t.length&&r.enqueue(t)}flush(e){const r=this.decoder_.decode();0!==r.length&&e.enqueue(r)}}class TextDecoderStream{constructor(e,r){this[decDecoder]=new TextDecoder(e,r),this[decTransform]=new TransformStream(new TextDecodeTransformer(this[decDecoder]))}get encoding(){return this[decDecoder].encoding}get fatal(){return this[decDecoder].fatal}get ignoreBOM(){return this[decDecoder].ignoreBOM}get readable(){return this[decTransform].readable}get writable(){return this[decTransform].writable}}const encEncoder=Symbol("encEncoder"),encTransform=Symbol("encTransform");class TextEncodeTransformer{constructor(e){this.encoder_=e,this.partial_=void 0}transform(e,r){let t=String(e);void 0!==this.partial_&&(t=this.partial_+t,this.partial_=void 0);const a=t.length-1,o=t.charCodeAt(a);o>=55296&&o<56320&&(this.partial_=String.fromCharCode(o),t=t.substring(0,a));const l=this.encoder_.encode(t);0!==l.length&&r.enqueue(l)}flush(e){this.partial_&&(e.enqueue(this.encoder_.encode(this.partial_)),this.partial_=void 0)}}class TextEncoderStream{constructor(){this[encEncoder]=new TextEncoder,this[encTransform]=new TransformStream(new TextEncodeTransformer(this[encEncoder]))}get encoding(){return this[encEncoder].encoding}get readable(){return this[encTransform].readable}get writable(){return this[encTransform].writable}}function getGlobal(){let e;if(void 0===e){try{e=window}catch(r){}if(void 0===e)try{e=global}catch(r){}}return e}function getGlobalValue(e){const r=getGlobal();let t;return void 0!==r&&(t=r[e]),t}function getGlobalOrContextualValue(name){const global=getGlobal();let value;if(void 0!==global&&(value=global[name]),void 0===value)try{value=eval(name)}catch(e){}return value}function hasCompleteStreamsImplementation(){const e=getGlobalValue("ReadableStream"),r=getGlobalValue("WritableStream"),t=getGlobalValue("TransformStream"),a=getGlobalValue("ByteLengthQueuingStrategy"),o=getGlobalValue("CountQueuingStrategy"),l=e=>"function"==typeof e;if(!(l(e)&&l(r)&&l(t)&&l(a)&&l(o)))return!1;try{const r=new e({type:"bytes"}).getReader({mode:"byob"});if(null==r||"object"!=typeof r)return!1}catch(n){return!1}return!0}function installStardazedStreams(){const e=getGlobal();if(!e)return;if(hasCompleteStreamsImplementation())return;const r=getGlobalOrContextualValue("fetch"),t=getGlobalOrContextualValue("Response"),a=getGlobalValue("ReadableStream");if(r&&t){const o=createAdaptedFetch(r,t,a,SDReadableStream,readableStreamTee),l=createAdaptedResponse(t,a,SDReadableStream,readableStreamTee);e.fetch=o,e.Response=l}e.ReadableStream=SDReadableStream,e.WritableStream=WritableStream,e.TransformStream=TransformStream$1,e.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy,e.CountQueuingStrategy=CountQueuingStrategy}function installEncodingStreams(){const e=getGlobal();e&&("function"!=typeof getGlobalValue("TextDecoderStream")&&(e.TextDecoderStream=TextDecoderStream),"function"!=typeof getGlobalValue("TextEncoderStream")&&(e.TextEncoderStream=TextEncoderStream))}installStardazedStreams(),installEncodingStreams()}();
{
"name": "@stardazed/streams-polyfill",
"description": "Drop-in polyfill for Web Streams with fetch and encoding integration",
"version": "1.0.7",
"version": "2.0.0",
"author": {

@@ -24,11 +24,12 @@ "name": "Arthur Langereis"

"devDependencies": {
"@stardazed/streams": "^1.0.7",
"@stardazed/streams": "^3.0.0",
"@stardazed/streams-fetch-adapter": "^2.0.0",
"@stardazed/streams-text-encoding": "^1.0.2",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1",
"rollup-plugin-typescript": "^0.8.1",
"typescript": "^3.1.1"
"rollup": "^1.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-terser": "^4.0.2",
"rollup-plugin-typescript": "^1.0.0",
"tslib": "^1.9.3",
"typescript": "^3.2.2"
}
}

@@ -9,3 +9,3 @@ @stardazed/streams-polyfill

Download size: 11KiB gzipped, 58KiB uncompressed.
Download size: 12KiB gzipped, 60KiB uncompressed.

@@ -44,16 +44,6 @@ Usage

⚠️ For TypeScript users, until the TS standard lib definitions fix the type constructor for
`ReadableStream`, you will get an error when providing any params to the `ReadableStream`
constructor. You will have to add a ts ignore directive on the preceding line and also
explicitly type the source object, as follows:
⚠️ For TypeScript users, you must use TypeScript 3.2 or newer to get type checking. If you
cannot upgrade to 3.2, you can use the older v2.0.0 version of this package that provides
a custom set of types.
```ts
// @ts-ignore
const myReadable = new ReadableStream({
start(controller) {
controller.enqueue("stuff");
}
} as ReadableStreamSource);
```
API Usage

@@ -85,4 +75,9 @@ ---------

The `pipeTo` and `pipeThrough` methods of `ReadableStream` now support a `signal` field
of type `AbortSignal` to abort on ongoing pipe operation. This is fully supported but
requires a native or polyfilled implementation to be present.
Browser support: Safari 11.1+ (iOS 11.1+), Firefox 57+, Chrome 66+, Edge 16+.
### Node
Node (as of September 2018) has no built-in fetch or web streams support. I did not do extensive
Node (as of January 2019) has no built-in fetch or web streams support. I did not do extensive
tests but this polyfill, when `require()`d, will install all streams types in Node's

@@ -113,3 +108,3 @@ `global` object and they then work as expected. Like with browsers, cooperation with any

---------
© 2018 by Arthur Langereis - [@zenmumbler](https://twitter.com/zenmumbler)
© 2018-Present by Arthur Langereis - [@zenmumbler](https://twitter.com/zenmumbler)

@@ -116,0 +111,0 @@ License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc