@shopify/create-app 3.60.1 → 3.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{chunk-UQNUIOTG.js → chunk-5NBS5LAW.js} +1 -1
  2. package/dist/{chunk-XHBFBPB6.js → chunk-7F4FS2WD.js} +7 -7
  3. package/dist/{chunk-JOHH6AAC.js → chunk-GQNJWQKC.js} +22 -17
  4. package/dist/{chunk-XUFDGROC.js → chunk-H3UBEY47.js} +3 -3
  5. package/dist/{chunk-QREVPZ7Q.js → chunk-H4N7DG5X.js} +23 -19
  6. package/dist/{chunk-TMGCRPEZ.js → chunk-HTYJDJRZ.js} +685 -215
  7. package/dist/{chunk-PNYJF4EH.js → chunk-I3IYXB26.js} +23 -6
  8. package/dist/{chunk-OXJ5MQHM.js → chunk-J3QAMMY2.js} +1 -1
  9. package/dist/{chunk-ZPB26OWQ.js → chunk-K5EEGEVV.js} +34 -14
  10. package/dist/{chunk-TKY6QESY.js → chunk-LLFZPH5K.js} +12 -9
  11. package/dist/{chunk-LDECNC3Y.js → chunk-LR725A3N.js} +3 -3
  12. package/dist/{chunk-P4TVG45N.js → chunk-LUP5VDI4.js} +10 -3
  13. package/dist/{chunk-O6M5TKNA.js → chunk-PGYGWMK7.js} +5 -5
  14. package/dist/{chunk-ZBKHJE3N.js → chunk-PKFDUXG6.js} +1 -1
  15. package/dist/{chunk-JOQ4LR3M.js → chunk-R5KQZMEG.js} +1 -1
  16. package/dist/{chunk-YLEF4RUH.js → chunk-RAFFEFML.js} +4 -0
  17. package/dist/{chunk-3JNB3A7C.js → chunk-U4YACXEW.js} +567 -357
  18. package/dist/{chunk-GOKYAXOZ.js → chunk-X2I3FAVD.js} +3 -3
  19. package/dist/{chunk-ZZNPAHP2.js → chunk-XKDB3ST7.js} +3603 -4080
  20. package/dist/{chunk-M64BQPYS.js → chunk-YI3MHBSD.js} +1 -1
  21. package/dist/commands/init.js +19 -19
  22. package/dist/commands/init.js.map +1 -1
  23. package/dist/commands/init.test.js +20 -20
  24. package/dist/{constants-K3R4N3N3.js → constants-NNLQHFRJ.js} +3 -1
  25. package/dist/{custom-oclif-loader-KRA6A5M7.js → custom-oclif-loader-KLTAWG4B.js} +7 -6
  26. package/dist/{del-A5YM6R3Y.js → del-ICEHOC6W.js} +2 -2
  27. package/dist/{devtools-KQM4GF6J.js → devtools-6HZ2IPFU.js} +154 -252
  28. package/dist/{error-handler-B3H5KJQO.js → error-handler-ND7WBMC3.js} +13 -13
  29. package/dist/hooks/postrun.js +12 -12
  30. package/dist/hooks/prerun.js +8 -8
  31. package/dist/index.js +4 -4
  32. package/dist/{lib-TQDGEQFC.js → lib-76RCE6WZ.js} +3 -3
  33. package/dist/{local-ZW3HRQCH.js → local-3LWDOA7J.js} +5 -5
  34. package/dist/{magic-string.es-6WMSFIAX.js → magic-string.es-6DE547FE.js} +79 -18
  35. package/dist/{multipart-parser-O2BQODS2.js → multipart-parser-ENLY4BKU.js} +1 -1
  36. package/dist/{node-package-manager-4W6NW7NV.js → node-package-manager-TFY2ROCP.js} +6 -6
  37. package/dist/{out-JZ52TJE3.js → out-M5MRQZP5.js} +1 -1
  38. package/dist/prompts/init.js +6 -6
  39. package/dist/prompts/init.test.js +7 -7
  40. package/dist/services/init.d.ts +3 -0
  41. package/dist/services/init.js +13 -13
  42. package/dist/services/init.js.map +1 -1
  43. package/dist/services/init.test.js +1 -1
  44. package/dist/{system-RKPPFGSA.js → system-FTT76GKS.js} +5 -5
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/dist/{ui-MNEY4ULE.js → ui-MUGCNPLG.js} +5 -5
  47. package/dist/utils/template/cleanup.js +6 -6
  48. package/dist/utils/template/cleanup.test.js +7 -7
  49. package/dist/utils/template/npm.js +8 -8
  50. package/dist/utils/template/npm.test.js +9 -9
  51. package/oclif.manifest.json +1 -1
  52. package/package.json +1 -1
@@ -5,42 +5,38 @@ import {
5
5
  init_cjs_shims
6
6
  } from "./chunk-M63RTPGR.js";
7
7
 
8
- // ../../node_modules/.pnpm/web-streams-polyfill@3.2.1/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js
8
+ // ../../node_modules/.pnpm/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js
9
9
  var require_ponyfill_es2018 = __commonJS({
10
- "../../node_modules/.pnpm/web-streams-polyfill@3.2.1/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(exports, module) {
10
+ "../../node_modules/.pnpm/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(exports, module) {
11
11
  init_cjs_shims();
12
12
  (function(global2, factory) {
13
13
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.WebStreamsPolyfill = {}));
14
14
  })(exports, function(exports2) {
15
15
  "use strict";
16
- const SymbolPolyfill = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol : (description) => `Symbol(${description})`;
17
16
  function noop() {
18
17
  return void 0;
19
18
  }
20
- function getGlobals() {
21
- if (typeof self !== "undefined") {
22
- return self;
23
- } else if (typeof window !== "undefined") {
24
- return window;
25
- } else if (typeof global !== "undefined") {
26
- return global;
27
- }
28
- return void 0;
29
- }
30
- const globals = getGlobals();
31
19
  function typeIsObject(x2) {
32
20
  return typeof x2 === "object" && x2 !== null || typeof x2 === "function";
33
21
  }
34
22
  const rethrowAssertionErrorRejection = noop;
23
+ function setFunctionName(fn, name) {
24
+ try {
25
+ Object.defineProperty(fn, "name", {
26
+ value: name,
27
+ configurable: true
28
+ });
29
+ } catch (_a2) {
30
+ }
31
+ }
35
32
  const originalPromise = Promise;
36
33
  const originalPromiseThen = Promise.prototype.then;
37
- const originalPromiseResolve = Promise.resolve.bind(originalPromise);
38
34
  const originalPromiseReject = Promise.reject.bind(originalPromise);
39
35
  function newPromise(executor) {
40
36
  return new originalPromise(executor);
41
37
  }
42
38
  function promiseResolvedWith(value) {
43
- return originalPromiseResolve(value);
39
+ return newPromise((resolve) => resolve(value));
44
40
  }
45
41
  function promiseRejectedWith(reason) {
46
42
  return originalPromiseReject(reason);
@@ -63,14 +59,15 @@ var require_ponyfill_es2018 = __commonJS({
63
59
  function setPromiseIsHandledToTrue(promise) {
64
60
  PerformPromiseThen(promise, void 0, rethrowAssertionErrorRejection);
65
61
  }
66
- const queueMicrotask = (() => {
67
- const globalQueueMicrotask = globals && globals.queueMicrotask;
68
- if (typeof globalQueueMicrotask === "function") {
69
- return globalQueueMicrotask;
62
+ let _queueMicrotask = (callback) => {
63
+ if (typeof queueMicrotask === "function") {
64
+ _queueMicrotask = queueMicrotask;
65
+ } else {
66
+ const resolvedPromise = promiseResolvedWith(void 0);
67
+ _queueMicrotask = (cb) => PerformPromiseThen(resolvedPromise, cb);
70
68
  }
71
- const resolvedPromise = promiseResolvedWith(void 0);
72
- return (fn) => PerformPromiseThen(resolvedPromise, fn);
73
- })();
69
+ return _queueMicrotask(callback);
70
+ };
74
71
  function reflectCall(F, V, args) {
75
72
  if (typeof F !== "function") {
76
73
  throw new TypeError("Argument is not a function");
@@ -174,6 +171,11 @@ var require_ponyfill_es2018 = __commonJS({
174
171
  return front._elements[cursor];
175
172
  }
176
173
  }
174
+ const AbortSteps = Symbol("[[AbortSteps]]");
175
+ const ErrorSteps = Symbol("[[ErrorSteps]]");
176
+ const CancelSteps = Symbol("[[CancelSteps]]");
177
+ const PullSteps = Symbol("[[PullSteps]]");
178
+ const ReleaseSteps = Symbol("[[ReleaseSteps]]");
177
179
  function ReadableStreamReaderGenericInitialize(reader, stream) {
178
180
  reader._ownerReadableStream = stream;
179
181
  stream._reader = reader;
@@ -190,12 +192,14 @@ var require_ponyfill_es2018 = __commonJS({
190
192
  return ReadableStreamCancel(stream, reason);
191
193
  }
192
194
  function ReadableStreamReaderGenericRelease(reader) {
193
- if (reader._ownerReadableStream._state === "readable") {
195
+ const stream = reader._ownerReadableStream;
196
+ if (stream._state === "readable") {
194
197
  defaultReaderClosedPromiseReject(reader, new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));
195
198
  } else {
196
199
  defaultReaderClosedPromiseResetToRejected(reader, new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));
197
200
  }
198
- reader._ownerReadableStream._reader = void 0;
201
+ stream._readableStreamController[ReleaseSteps]();
202
+ stream._reader = void 0;
199
203
  reader._ownerReadableStream = void 0;
200
204
  }
201
205
  function readerLockException(name) {
@@ -235,10 +239,6 @@ var require_ponyfill_es2018 = __commonJS({
235
239
  reader._closedPromise_resolve = void 0;
236
240
  reader._closedPromise_reject = void 0;
237
241
  }
238
- const AbortSteps = SymbolPolyfill("[[AbortSteps]]");
239
- const ErrorSteps = SymbolPolyfill("[[ErrorSteps]]");
240
- const CancelSteps = SymbolPolyfill("[[CancelSteps]]");
241
- const PullSteps = SymbolPolyfill("[[PullSteps]]");
242
242
  const NumberIsFinite = Number.isFinite || function(x2) {
243
243
  return typeof x2 === "number" && isFinite(x2);
244
244
  };
@@ -409,10 +409,7 @@ var require_ponyfill_es2018 = __commonJS({
409
409
  if (this._ownerReadableStream === void 0) {
410
410
  return;
411
411
  }
412
- if (this._readRequests.length > 0) {
413
- throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");
414
- }
415
- ReadableStreamReaderGenericRelease(this);
412
+ ReadableStreamDefaultReaderRelease(this);
416
413
  }
417
414
  }
418
415
  Object.defineProperties(ReadableStreamDefaultReader.prototype, {
@@ -421,8 +418,11 @@ var require_ponyfill_es2018 = __commonJS({
421
418
  releaseLock: { enumerable: true },
422
419
  closed: { enumerable: true }
423
420
  });
424
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
425
- Object.defineProperty(ReadableStreamDefaultReader.prototype, SymbolPolyfill.toStringTag, {
421
+ setFunctionName(ReadableStreamDefaultReader.prototype.cancel, "cancel");
422
+ setFunctionName(ReadableStreamDefaultReader.prototype.read, "read");
423
+ setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, "releaseLock");
424
+ if (typeof Symbol.toStringTag === "symbol") {
425
+ Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {
426
426
  value: "ReadableStreamDefaultReader",
427
427
  configurable: true
428
428
  });
@@ -447,6 +447,18 @@ var require_ponyfill_es2018 = __commonJS({
447
447
  stream._readableStreamController[PullSteps](readRequest);
448
448
  }
449
449
  }
450
+ function ReadableStreamDefaultReaderRelease(reader) {
451
+ ReadableStreamReaderGenericRelease(reader);
452
+ const e2 = new TypeError("Reader was released");
453
+ ReadableStreamDefaultReaderErrorReadRequests(reader, e2);
454
+ }
455
+ function ReadableStreamDefaultReaderErrorReadRequests(reader, e2) {
456
+ const readRequests = reader._readRequests;
457
+ reader._readRequests = new SimpleQueue();
458
+ readRequests.forEach((readRequest) => {
459
+ readRequest._errorSteps(e2);
460
+ });
461
+ }
450
462
  function defaultReaderBrandCheckException(name) {
451
463
  return new TypeError(`ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`);
452
464
  }
@@ -473,9 +485,6 @@ var require_ponyfill_es2018 = __commonJS({
473
485
  return Promise.resolve({ value: void 0, done: true });
474
486
  }
475
487
  const reader = this._reader;
476
- if (reader._ownerReadableStream === void 0) {
477
- return promiseRejectedWith(readerLockException("iterate"));
478
- }
479
488
  let resolvePromise;
480
489
  let rejectPromise;
481
490
  const promise = newPromise((resolve, reject) => {
@@ -485,7 +494,7 @@ var require_ponyfill_es2018 = __commonJS({
485
494
  const readRequest = {
486
495
  _chunkSteps: (chunk) => {
487
496
  this._ongoingPromise = void 0;
488
- queueMicrotask(() => resolvePromise({ value: chunk, done: false }));
497
+ _queueMicrotask(() => resolvePromise({ value: chunk, done: false }));
489
498
  },
490
499
  _closeSteps: () => {
491
500
  this._ongoingPromise = void 0;
@@ -509,9 +518,6 @@ var require_ponyfill_es2018 = __commonJS({
509
518
  }
510
519
  this._isFinished = true;
511
520
  const reader = this._reader;
512
- if (reader._ownerReadableStream === void 0) {
513
- return promiseRejectedWith(readerLockException("finish iterating"));
514
- }
515
521
  if (!this._preventCancel) {
516
522
  const result = ReadableStreamReaderGenericCancel(reader, value);
517
523
  ReadableStreamReaderGenericRelease(reader);
@@ -535,9 +541,7 @@ var require_ponyfill_es2018 = __commonJS({
535
541
  return this._asyncIteratorImpl.return(value);
536
542
  }
537
543
  };
538
- if (AsyncIteratorPrototype !== void 0) {
539
- Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
540
- }
544
+ Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
541
545
  function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
542
546
  const reader = AcquireReadableStreamDefaultReader(stream);
543
547
  const impl = new ReadableStreamAsyncIteratorImpl(reader, preventCancel);
@@ -554,7 +558,7 @@ var require_ponyfill_es2018 = __commonJS({
554
558
  }
555
559
  try {
556
560
  return x2._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl;
557
- } catch (_a) {
561
+ } catch (_a2) {
558
562
  return false;
559
563
  }
560
564
  }
@@ -564,18 +568,31 @@ var require_ponyfill_es2018 = __commonJS({
564
568
  const NumberIsNaN = Number.isNaN || function(x2) {
565
569
  return x2 !== x2;
566
570
  };
571
+ var _a, _b, _c;
567
572
  function CreateArrayFromList(elements) {
568
573
  return elements.slice();
569
574
  }
570
575
  function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
571
576
  new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
572
577
  }
573
- function TransferArrayBuffer(O) {
574
- return O;
575
- }
576
- function IsDetachedBuffer(O) {
577
- return false;
578
- }
578
+ let TransferArrayBuffer = (O) => {
579
+ if (typeof O.transfer === "function") {
580
+ TransferArrayBuffer = (buffer) => buffer.transfer();
581
+ } else if (typeof structuredClone === "function") {
582
+ TransferArrayBuffer = (buffer) => structuredClone(buffer, { transfer: [buffer] });
583
+ } else {
584
+ TransferArrayBuffer = (buffer) => buffer;
585
+ }
586
+ return TransferArrayBuffer(O);
587
+ };
588
+ let IsDetachedBuffer = (O) => {
589
+ if (typeof O.detached === "boolean") {
590
+ IsDetachedBuffer = (buffer) => buffer.detached;
591
+ } else {
592
+ IsDetachedBuffer = (buffer) => buffer.byteLength === 0;
593
+ }
594
+ return IsDetachedBuffer(O);
595
+ };
579
596
  function ArrayBufferSlice(buffer, begin, end) {
580
597
  if (buffer.slice) {
581
598
  return buffer.slice(begin, end);
@@ -585,6 +602,63 @@ var require_ponyfill_es2018 = __commonJS({
585
602
  CopyDataBlockBytes(slice, 0, buffer, begin, length);
586
603
  return slice;
587
604
  }
605
+ function GetMethod(receiver, prop) {
606
+ const func = receiver[prop];
607
+ if (func === void 0 || func === null) {
608
+ return void 0;
609
+ }
610
+ if (typeof func !== "function") {
611
+ throw new TypeError(`${String(prop)} is not a function`);
612
+ }
613
+ return func;
614
+ }
615
+ function CreateAsyncFromSyncIterator(syncIteratorRecord) {
616
+ const syncIterable = {
617
+ [Symbol.iterator]: () => syncIteratorRecord.iterator
618
+ };
619
+ const asyncIterator = async function* () {
620
+ return yield* syncIterable;
621
+ }();
622
+ const nextMethod = asyncIterator.next;
623
+ return { iterator: asyncIterator, nextMethod, done: false };
624
+ }
625
+ const SymbolAsyncIterator = (_c = (_a = Symbol.asyncIterator) !== null && _a !== void 0 ? _a : (_b = Symbol.for) === null || _b === void 0 ? void 0 : _b.call(Symbol, "Symbol.asyncIterator")) !== null && _c !== void 0 ? _c : "@@asyncIterator";
626
+ function GetIterator(obj, hint = "sync", method) {
627
+ if (method === void 0) {
628
+ if (hint === "async") {
629
+ method = GetMethod(obj, SymbolAsyncIterator);
630
+ if (method === void 0) {
631
+ const syncMethod = GetMethod(obj, Symbol.iterator);
632
+ const syncIteratorRecord = GetIterator(obj, "sync", syncMethod);
633
+ return CreateAsyncFromSyncIterator(syncIteratorRecord);
634
+ }
635
+ } else {
636
+ method = GetMethod(obj, Symbol.iterator);
637
+ }
638
+ }
639
+ if (method === void 0) {
640
+ throw new TypeError("The object is not iterable");
641
+ }
642
+ const iterator = reflectCall(method, obj, []);
643
+ if (!typeIsObject(iterator)) {
644
+ throw new TypeError("The iterator method must return an object");
645
+ }
646
+ const nextMethod = iterator.next;
647
+ return { iterator, nextMethod, done: false };
648
+ }
649
+ function IteratorNext(iteratorRecord) {
650
+ const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);
651
+ if (!typeIsObject(result)) {
652
+ throw new TypeError("The iterator.next() method must return an object");
653
+ }
654
+ return result;
655
+ }
656
+ function IteratorComplete(iterResult) {
657
+ return Boolean(iterResult.done);
658
+ }
659
+ function IteratorValue(iterResult) {
660
+ return iterResult.value;
661
+ }
588
662
  function IsNonNegativeNumber(v) {
589
663
  if (typeof v !== "number") {
590
664
  return false;
@@ -624,6 +698,18 @@ var require_ponyfill_es2018 = __commonJS({
624
698
  container._queue = new SimpleQueue();
625
699
  container._queueTotalSize = 0;
626
700
  }
701
+ function isDataViewConstructor(ctor) {
702
+ return ctor === DataView;
703
+ }
704
+ function isDataView(view) {
705
+ return isDataViewConstructor(view.constructor);
706
+ }
707
+ function arrayBufferViewElementSize(ctor) {
708
+ if (isDataViewConstructor(ctor)) {
709
+ return 1;
710
+ }
711
+ return ctor.BYTES_PER_ELEMENT;
712
+ }
627
713
  class ReadableStreamBYOBRequest {
628
714
  constructor() {
629
715
  throw new TypeError("Illegal constructor");
@@ -646,8 +732,9 @@ var require_ponyfill_es2018 = __commonJS({
646
732
  if (this._associatedReadableByteStreamController === void 0) {
647
733
  throw new TypeError("This BYOB request has been invalidated");
648
734
  }
649
- if (IsDetachedBuffer(this._view.buffer))
650
- ;
735
+ if (IsDetachedBuffer(this._view.buffer)) {
736
+ throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);
737
+ }
651
738
  ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
652
739
  }
653
740
  respondWithNewView(view) {
@@ -661,8 +748,9 @@ var require_ponyfill_es2018 = __commonJS({
661
748
  if (this._associatedReadableByteStreamController === void 0) {
662
749
  throw new TypeError("This BYOB request has been invalidated");
663
750
  }
664
- if (IsDetachedBuffer(view.buffer))
665
- ;
751
+ if (IsDetachedBuffer(view.buffer)) {
752
+ throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");
753
+ }
666
754
  ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
667
755
  }
668
756
  }
@@ -671,8 +759,10 @@ var require_ponyfill_es2018 = __commonJS({
671
759
  respondWithNewView: { enumerable: true },
672
760
  view: { enumerable: true }
673
761
  });
674
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
675
- Object.defineProperty(ReadableStreamBYOBRequest.prototype, SymbolPolyfill.toStringTag, {
762
+ setFunctionName(ReadableStreamBYOBRequest.prototype.respond, "respond");
763
+ setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, "respondWithNewView");
764
+ if (typeof Symbol.toStringTag === "symbol") {
765
+ Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {
676
766
  value: "ReadableStreamBYOBRequest",
677
767
  configurable: true
678
768
  });
@@ -761,11 +851,7 @@ var require_ponyfill_es2018 = __commonJS({
761
851
  [PullSteps](readRequest) {
762
852
  const stream = this._controlledReadableByteStream;
763
853
  if (this._queueTotalSize > 0) {
764
- const entry = this._queue.shift();
765
- this._queueTotalSize -= entry.byteLength;
766
- ReadableByteStreamControllerHandleQueueDrain(this);
767
- const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
768
- readRequest._chunkSteps(view);
854
+ ReadableByteStreamControllerFillReadRequestFromQueue(this, readRequest);
769
855
  return;
770
856
  }
771
857
  const autoAllocateChunkSize = this._autoAllocateChunkSize;
@@ -783,6 +869,7 @@ var require_ponyfill_es2018 = __commonJS({
783
869
  byteOffset: 0,
784
870
  byteLength: autoAllocateChunkSize,
785
871
  bytesFilled: 0,
872
+ minimumFill: 1,
786
873
  elementSize: 1,
787
874
  viewConstructor: Uint8Array,
788
875
  readerType: "default"
@@ -792,6 +879,15 @@ var require_ponyfill_es2018 = __commonJS({
792
879
  ReadableStreamAddReadRequest(stream, readRequest);
793
880
  ReadableByteStreamControllerCallPullIfNeeded(this);
794
881
  }
882
+ /** @internal */
883
+ [ReleaseSteps]() {
884
+ if (this._pendingPullIntos.length > 0) {
885
+ const firstPullInto = this._pendingPullIntos.peek();
886
+ firstPullInto.readerType = "none";
887
+ this._pendingPullIntos = new SimpleQueue();
888
+ this._pendingPullIntos.push(firstPullInto);
889
+ }
890
+ }
795
891
  }
796
892
  Object.defineProperties(ReadableByteStreamController.prototype, {
797
893
  close: { enumerable: true },
@@ -800,8 +896,11 @@ var require_ponyfill_es2018 = __commonJS({
800
896
  byobRequest: { enumerable: true },
801
897
  desiredSize: { enumerable: true }
802
898
  });
803
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
804
- Object.defineProperty(ReadableByteStreamController.prototype, SymbolPolyfill.toStringTag, {
899
+ setFunctionName(ReadableByteStreamController.prototype.close, "close");
900
+ setFunctionName(ReadableByteStreamController.prototype.enqueue, "enqueue");
901
+ setFunctionName(ReadableByteStreamController.prototype.error, "error");
902
+ if (typeof Symbol.toStringTag === "symbol") {
903
+ Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {
805
904
  value: "ReadableByteStreamController",
806
905
  configurable: true
807
906
  });
@@ -841,8 +940,10 @@ var require_ponyfill_es2018 = __commonJS({
841
940
  controller._pullAgain = false;
842
941
  ReadableByteStreamControllerCallPullIfNeeded(controller);
843
942
  }
943
+ return null;
844
944
  }, (e2) => {
845
945
  ReadableByteStreamControllerError(controller, e2);
946
+ return null;
846
947
  });
847
948
  }
848
949
  function ReadableByteStreamControllerClearPendingPullIntos(controller) {
@@ -870,15 +971,30 @@ var require_ponyfill_es2018 = __commonJS({
870
971
  controller._queue.push({ buffer, byteOffset, byteLength });
871
972
  controller._queueTotalSize += byteLength;
872
973
  }
974
+ function ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, buffer, byteOffset, byteLength) {
975
+ let clonedChunk;
976
+ try {
977
+ clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);
978
+ } catch (cloneE) {
979
+ ReadableByteStreamControllerError(controller, cloneE);
980
+ throw cloneE;
981
+ }
982
+ ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);
983
+ }
984
+ function ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstDescriptor) {
985
+ if (firstDescriptor.bytesFilled > 0) {
986
+ ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, firstDescriptor.buffer, firstDescriptor.byteOffset, firstDescriptor.bytesFilled);
987
+ }
988
+ ReadableByteStreamControllerShiftPendingPullInto(controller);
989
+ }
873
990
  function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
874
- const elementSize = pullIntoDescriptor.elementSize;
875
- const currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
876
991
  const maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
877
992
  const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
878
- const maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
879
993
  let totalBytesToCopyRemaining = maxBytesToCopy;
880
994
  let ready = false;
881
- if (maxAlignedBytes > currentAlignedBytes) {
995
+ const remainderBytes = maxBytesFilled % pullIntoDescriptor.elementSize;
996
+ const maxAlignedBytes = maxBytesFilled - remainderBytes;
997
+ if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {
882
998
  totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
883
999
  ready = true;
884
1000
  }
@@ -931,20 +1047,36 @@ var require_ponyfill_es2018 = __commonJS({
931
1047
  }
932
1048
  }
933
1049
  }
934
- function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest) {
935
- const stream = controller._controlledReadableByteStream;
936
- let elementSize = 1;
937
- if (view.constructor !== DataView) {
938
- elementSize = view.constructor.BYTES_PER_ELEMENT;
1050
+ function ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller) {
1051
+ const reader = controller._controlledReadableByteStream._reader;
1052
+ while (reader._readRequests.length > 0) {
1053
+ if (controller._queueTotalSize === 0) {
1054
+ return;
1055
+ }
1056
+ const readRequest = reader._readRequests.shift();
1057
+ ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);
939
1058
  }
1059
+ }
1060
+ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoRequest) {
1061
+ const stream = controller._controlledReadableByteStream;
940
1062
  const ctor = view.constructor;
941
- const buffer = TransferArrayBuffer(view.buffer);
1063
+ const elementSize = arrayBufferViewElementSize(ctor);
1064
+ const { byteOffset, byteLength } = view;
1065
+ const minimumFill = min * elementSize;
1066
+ let buffer;
1067
+ try {
1068
+ buffer = TransferArrayBuffer(view.buffer);
1069
+ } catch (e2) {
1070
+ readIntoRequest._errorSteps(e2);
1071
+ return;
1072
+ }
942
1073
  const pullIntoDescriptor = {
943
1074
  buffer,
944
1075
  bufferByteLength: buffer.byteLength,
945
- byteOffset: view.byteOffset,
946
- byteLength: view.byteLength,
1076
+ byteOffset,
1077
+ byteLength,
947
1078
  bytesFilled: 0,
1079
+ minimumFill,
948
1080
  elementSize,
949
1081
  viewConstructor: ctor,
950
1082
  readerType: "byob"
@@ -978,6 +1110,9 @@ var require_ponyfill_es2018 = __commonJS({
978
1110
  ReadableByteStreamControllerCallPullIfNeeded(controller);
979
1111
  }
980
1112
  function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
1113
+ if (firstDescriptor.readerType === "none") {
1114
+ ReadableByteStreamControllerShiftPendingPullInto(controller);
1115
+ }
981
1116
  const stream = controller._controlledReadableByteStream;
982
1117
  if (ReadableStreamHasBYOBReader(stream)) {
983
1118
  while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
@@ -988,15 +1123,19 @@ var require_ponyfill_es2018 = __commonJS({
988
1123
  }
989
1124
  function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
990
1125
  ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
991
- if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
1126
+ if (pullIntoDescriptor.readerType === "none") {
1127
+ ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);
1128
+ ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
1129
+ return;
1130
+ }
1131
+ if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {
992
1132
  return;
993
1133
  }
994
1134
  ReadableByteStreamControllerShiftPendingPullInto(controller);
995
1135
  const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
996
1136
  if (remainderSize > 0) {
997
1137
  const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
998
- const remainder = ArrayBufferSlice(pullIntoDescriptor.buffer, end - remainderSize, end);
999
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
1138
+ ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, pullIntoDescriptor.buffer, end - remainderSize, remainderSize);
1000
1139
  }
1001
1140
  pullIntoDescriptor.bytesFilled -= remainderSize;
1002
1141
  ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
@@ -1007,7 +1146,7 @@ var require_ponyfill_es2018 = __commonJS({
1007
1146
  ReadableByteStreamControllerInvalidateBYOBRequest(controller);
1008
1147
  const state = controller._controlledReadableByteStream._state;
1009
1148
  if (state === "closed") {
1010
- ReadableByteStreamControllerRespondInClosedState(controller);
1149
+ ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
1011
1150
  } else {
1012
1151
  ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
1013
1152
  }
@@ -1055,7 +1194,7 @@ var require_ponyfill_es2018 = __commonJS({
1055
1194
  }
1056
1195
  if (controller._pendingPullIntos.length > 0) {
1057
1196
  const firstPendingPullInto = controller._pendingPullIntos.peek();
1058
- if (firstPendingPullInto.bytesFilled > 0) {
1197
+ if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {
1059
1198
  const e2 = new TypeError("Insufficient bytes to fill elements in the given buffer");
1060
1199
  ReadableByteStreamControllerError(controller, e2);
1061
1200
  throw e2;
@@ -1069,18 +1208,24 @@ var require_ponyfill_es2018 = __commonJS({
1069
1208
  if (controller._closeRequested || stream._state !== "readable") {
1070
1209
  return;
1071
1210
  }
1072
- const buffer = chunk.buffer;
1073
- const byteOffset = chunk.byteOffset;
1074
- const byteLength = chunk.byteLength;
1211
+ const { buffer, byteOffset, byteLength } = chunk;
1212
+ if (IsDetachedBuffer(buffer)) {
1213
+ throw new TypeError("chunk's buffer is detached and so cannot be enqueued");
1214
+ }
1075
1215
  const transferredBuffer = TransferArrayBuffer(buffer);
1076
1216
  if (controller._pendingPullIntos.length > 0) {
1077
1217
  const firstPendingPullInto = controller._pendingPullIntos.peek();
1078
- if (IsDetachedBuffer(firstPendingPullInto.buffer))
1079
- ;
1218
+ if (IsDetachedBuffer(firstPendingPullInto.buffer)) {
1219
+ throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");
1220
+ }
1221
+ ReadableByteStreamControllerInvalidateBYOBRequest(controller);
1080
1222
  firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);
1223
+ if (firstPendingPullInto.readerType === "none") {
1224
+ ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);
1225
+ }
1081
1226
  }
1082
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
1083
1227
  if (ReadableStreamHasDefaultReader(stream)) {
1228
+ ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);
1084
1229
  if (ReadableStreamGetNumReadRequests(stream) === 0) {
1085
1230
  ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
1086
1231
  } else {
@@ -1108,6 +1253,13 @@ var require_ponyfill_es2018 = __commonJS({
1108
1253
  ReadableByteStreamControllerClearAlgorithms(controller);
1109
1254
  ReadableStreamError(stream, e2);
1110
1255
  }
1256
+ function ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest) {
1257
+ const entry = controller._queue.shift();
1258
+ controller._queueTotalSize -= entry.byteLength;
1259
+ ReadableByteStreamControllerHandleQueueDrain(controller);
1260
+ const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
1261
+ readRequest._chunkSteps(view);
1262
+ }
1111
1263
  function ReadableByteStreamControllerGetBYOBRequest(controller) {
1112
1264
  if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
1113
1265
  const firstDescriptor = controller._pendingPullIntos.peek();
@@ -1190,23 +1342,31 @@ var require_ponyfill_es2018 = __commonJS({
1190
1342
  uponPromise(promiseResolvedWith(startResult), () => {
1191
1343
  controller._started = true;
1192
1344
  ReadableByteStreamControllerCallPullIfNeeded(controller);
1345
+ return null;
1193
1346
  }, (r2) => {
1194
1347
  ReadableByteStreamControllerError(controller, r2);
1348
+ return null;
1195
1349
  });
1196
1350
  }
1197
1351
  function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
1198
1352
  const controller = Object.create(ReadableByteStreamController.prototype);
1199
- let startAlgorithm = () => void 0;
1200
- let pullAlgorithm = () => promiseResolvedWith(void 0);
1201
- let cancelAlgorithm = () => promiseResolvedWith(void 0);
1353
+ let startAlgorithm;
1354
+ let pullAlgorithm;
1355
+ let cancelAlgorithm;
1202
1356
  if (underlyingByteSource.start !== void 0) {
1203
1357
  startAlgorithm = () => underlyingByteSource.start(controller);
1358
+ } else {
1359
+ startAlgorithm = () => void 0;
1204
1360
  }
1205
1361
  if (underlyingByteSource.pull !== void 0) {
1206
1362
  pullAlgorithm = () => underlyingByteSource.pull(controller);
1363
+ } else {
1364
+ pullAlgorithm = () => promiseResolvedWith(void 0);
1207
1365
  }
1208
1366
  if (underlyingByteSource.cancel !== void 0) {
1209
1367
  cancelAlgorithm = (reason) => underlyingByteSource.cancel(reason);
1368
+ } else {
1369
+ cancelAlgorithm = () => promiseResolvedWith(void 0);
1210
1370
  }
1211
1371
  const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
1212
1372
  if (autoAllocateChunkSize === 0) {
@@ -1224,6 +1384,28 @@ var require_ponyfill_es2018 = __commonJS({
1224
1384
  function byteStreamControllerBrandCheckException(name) {
1225
1385
  return new TypeError(`ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`);
1226
1386
  }
1387
+ function convertReaderOptions(options, context) {
1388
+ assertDictionary(options, context);
1389
+ const mode = options === null || options === void 0 ? void 0 : options.mode;
1390
+ return {
1391
+ mode: mode === void 0 ? void 0 : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)
1392
+ };
1393
+ }
1394
+ function convertReadableStreamReaderMode(mode, context) {
1395
+ mode = `${mode}`;
1396
+ if (mode !== "byob") {
1397
+ throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);
1398
+ }
1399
+ return mode;
1400
+ }
1401
+ function convertByobReadOptions(options, context) {
1402
+ var _a2;
1403
+ assertDictionary(options, context);
1404
+ const min = (_a2 = options === null || options === void 0 ? void 0 : options.min) !== null && _a2 !== void 0 ? _a2 : 1;
1405
+ return {
1406
+ min: convertUnsignedLongLongWithEnforceRange(min, `${context} has member 'min' that`)
1407
+ };
1408
+ }
1227
1409
  function AcquireReadableStreamBYOBReader(stream) {
1228
1410
  return new ReadableStreamBYOBReader(stream);
1229
1411
  }
@@ -1287,12 +1469,7 @@ var require_ponyfill_es2018 = __commonJS({
1287
1469
  }
1288
1470
  return ReadableStreamReaderGenericCancel(this, reason);
1289
1471
  }
1290
- /**
1291
- * Attempts to reads bytes into view, and returns a promise resolved with the result.
1292
- *
1293
- * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
1294
- */
1295
- read(view) {
1472
+ read(view, rawOptions = {}) {
1296
1473
  if (!IsReadableStreamBYOBReader(this)) {
1297
1474
  return promiseRejectedWith(byobReaderBrandCheckException("read"));
1298
1475
  }
@@ -1305,8 +1482,26 @@ var require_ponyfill_es2018 = __commonJS({
1305
1482
  if (view.buffer.byteLength === 0) {
1306
1483
  return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));
1307
1484
  }
1308
- if (IsDetachedBuffer(view.buffer))
1309
- ;
1485
+ if (IsDetachedBuffer(view.buffer)) {
1486
+ return promiseRejectedWith(new TypeError("view's buffer has been detached"));
1487
+ }
1488
+ let options;
1489
+ try {
1490
+ options = convertByobReadOptions(rawOptions, "options");
1491
+ } catch (e2) {
1492
+ return promiseRejectedWith(e2);
1493
+ }
1494
+ const min = options.min;
1495
+ if (min === 0) {
1496
+ return promiseRejectedWith(new TypeError("options.min must be greater than 0"));
1497
+ }
1498
+ if (!isDataView(view)) {
1499
+ if (min > view.length) {
1500
+ return promiseRejectedWith(new RangeError("options.min must be less than or equal to view's length"));
1501
+ }
1502
+ } else if (min > view.byteLength) {
1503
+ return promiseRejectedWith(new RangeError("options.min must be less than or equal to view's byteLength"));
1504
+ }
1310
1505
  if (this._ownerReadableStream === void 0) {
1311
1506
  return promiseRejectedWith(readerLockException("read from"));
1312
1507
  }
@@ -1321,7 +1516,7 @@ var require_ponyfill_es2018 = __commonJS({
1321
1516
  _closeSteps: (chunk) => resolvePromise({ value: chunk, done: true }),
1322
1517
  _errorSteps: (e2) => rejectPromise(e2)
1323
1518
  };
1324
- ReadableStreamBYOBReaderRead(this, view, readIntoRequest);
1519
+ ReadableStreamBYOBReaderRead(this, view, min, readIntoRequest);
1325
1520
  return promise;
1326
1521
  }
1327
1522
  /**
@@ -1340,10 +1535,7 @@ var require_ponyfill_es2018 = __commonJS({
1340
1535
  if (this._ownerReadableStream === void 0) {
1341
1536
  return;
1342
1537
  }
1343
- if (this._readIntoRequests.length > 0) {
1344
- throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");
1345
- }
1346
- ReadableStreamReaderGenericRelease(this);
1538
+ ReadableStreamBYOBReaderRelease(this);
1347
1539
  }
1348
1540
  }
1349
1541
  Object.defineProperties(ReadableStreamBYOBReader.prototype, {
@@ -1352,8 +1544,11 @@ var require_ponyfill_es2018 = __commonJS({
1352
1544
  releaseLock: { enumerable: true },
1353
1545
  closed: { enumerable: true }
1354
1546
  });
1355
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
1356
- Object.defineProperty(ReadableStreamBYOBReader.prototype, SymbolPolyfill.toStringTag, {
1547
+ setFunctionName(ReadableStreamBYOBReader.prototype.cancel, "cancel");
1548
+ setFunctionName(ReadableStreamBYOBReader.prototype.read, "read");
1549
+ setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, "releaseLock");
1550
+ if (typeof Symbol.toStringTag === "symbol") {
1551
+ Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {
1357
1552
  value: "ReadableStreamBYOBReader",
1358
1553
  configurable: true
1359
1554
  });
@@ -1367,15 +1562,27 @@ var require_ponyfill_es2018 = __commonJS({
1367
1562
  }
1368
1563
  return x2 instanceof ReadableStreamBYOBReader;
1369
1564
  }
1370
- function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
1565
+ function ReadableStreamBYOBReaderRead(reader, view, min, readIntoRequest) {
1371
1566
  const stream = reader._ownerReadableStream;
1372
1567
  stream._disturbed = true;
1373
1568
  if (stream._state === "errored") {
1374
1569
  readIntoRequest._errorSteps(stream._storedError);
1375
1570
  } else {
1376
- ReadableByteStreamControllerPullInto(stream._readableStreamController, view, readIntoRequest);
1571
+ ReadableByteStreamControllerPullInto(stream._readableStreamController, view, min, readIntoRequest);
1377
1572
  }
1378
1573
  }
1574
+ function ReadableStreamBYOBReaderRelease(reader) {
1575
+ ReadableStreamReaderGenericRelease(reader);
1576
+ const e2 = new TypeError("Reader was released");
1577
+ ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2);
1578
+ }
1579
+ function ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2) {
1580
+ const readIntoRequests = reader._readIntoRequests;
1581
+ reader._readIntoRequests = new SimpleQueue();
1582
+ readIntoRequests.forEach((readIntoRequest) => {
1583
+ readIntoRequest._errorSteps(e2);
1584
+ });
1585
+ }
1379
1586
  function byobReaderBrandCheckException(name) {
1380
1587
  return new TypeError(`ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`);
1381
1588
  }
@@ -1451,7 +1658,7 @@ var require_ponyfill_es2018 = __commonJS({
1451
1658
  }
1452
1659
  try {
1453
1660
  return typeof value.aborted === "boolean";
1454
- } catch (_a) {
1661
+ } catch (_a2) {
1455
1662
  return false;
1456
1663
  }
1457
1664
  }
@@ -1548,8 +1755,11 @@ var require_ponyfill_es2018 = __commonJS({
1548
1755
  getWriter: { enumerable: true },
1549
1756
  locked: { enumerable: true }
1550
1757
  });
1551
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
1552
- Object.defineProperty(WritableStream.prototype, SymbolPolyfill.toStringTag, {
1758
+ setFunctionName(WritableStream.prototype.abort, "abort");
1759
+ setFunctionName(WritableStream.prototype.close, "close");
1760
+ setFunctionName(WritableStream.prototype.getWriter, "getWriter");
1761
+ if (typeof Symbol.toStringTag === "symbol") {
1762
+ Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {
1553
1763
  value: "WritableStream",
1554
1764
  configurable: true
1555
1765
  });
@@ -1592,12 +1802,12 @@ var require_ponyfill_es2018 = __commonJS({
1592
1802
  return true;
1593
1803
  }
1594
1804
  function WritableStreamAbort(stream, reason) {
1595
- var _a;
1805
+ var _a2;
1596
1806
  if (stream._state === "closed" || stream._state === "errored") {
1597
1807
  return promiseResolvedWith(void 0);
1598
1808
  }
1599
1809
  stream._writableStreamController._abortReason = reason;
1600
- (_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort();
1810
+ (_a2 = stream._writableStreamController._abortController) === null || _a2 === void 0 ? void 0 : _a2.abort(reason);
1601
1811
  const state = stream._state;
1602
1812
  if (state === "closed" || state === "errored") {
1603
1813
  return promiseResolvedWith(void 0);
@@ -1697,9 +1907,11 @@ var require_ponyfill_es2018 = __commonJS({
1697
1907
  uponPromise(promise, () => {
1698
1908
  abortRequest._resolve();
1699
1909
  WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
1910
+ return null;
1700
1911
  }, (reason) => {
1701
1912
  abortRequest._reject(reason);
1702
1913
  WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
1914
+ return null;
1703
1915
  });
1704
1916
  }
1705
1917
  function WritableStreamFinishInFlightWrite(stream) {
@@ -1914,8 +2126,12 @@ var require_ponyfill_es2018 = __commonJS({
1914
2126
  desiredSize: { enumerable: true },
1915
2127
  ready: { enumerable: true }
1916
2128
  });
1917
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
1918
- Object.defineProperty(WritableStreamDefaultWriter.prototype, SymbolPolyfill.toStringTag, {
2129
+ setFunctionName(WritableStreamDefaultWriter.prototype.abort, "abort");
2130
+ setFunctionName(WritableStreamDefaultWriter.prototype.close, "close");
2131
+ setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, "releaseLock");
2132
+ setFunctionName(WritableStreamDefaultWriter.prototype.write, "write");
2133
+ if (typeof Symbol.toStringTag === "symbol") {
2134
+ Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {
1919
2135
  value: "WritableStreamDefaultWriter",
1920
2136
  configurable: true
1921
2137
  });
@@ -2065,8 +2281,8 @@ var require_ponyfill_es2018 = __commonJS({
2065
2281
  signal: { enumerable: true },
2066
2282
  error: { enumerable: true }
2067
2283
  });
2068
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
2069
- Object.defineProperty(WritableStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
2284
+ if (typeof Symbol.toStringTag === "symbol") {
2285
+ Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {
2070
2286
  value: "WritableStreamDefaultController",
2071
2287
  configurable: true
2072
2288
  });
@@ -2101,28 +2317,38 @@ var require_ponyfill_es2018 = __commonJS({
2101
2317
  uponPromise(startPromise, () => {
2102
2318
  controller._started = true;
2103
2319
  WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
2320
+ return null;
2104
2321
  }, (r2) => {
2105
2322
  controller._started = true;
2106
2323
  WritableStreamDealWithRejection(stream, r2);
2324
+ return null;
2107
2325
  });
2108
2326
  }
2109
2327
  function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
2110
2328
  const controller = Object.create(WritableStreamDefaultController.prototype);
2111
- let startAlgorithm = () => void 0;
2112
- let writeAlgorithm = () => promiseResolvedWith(void 0);
2113
- let closeAlgorithm = () => promiseResolvedWith(void 0);
2114
- let abortAlgorithm = () => promiseResolvedWith(void 0);
2329
+ let startAlgorithm;
2330
+ let writeAlgorithm;
2331
+ let closeAlgorithm;
2332
+ let abortAlgorithm;
2115
2333
  if (underlyingSink.start !== void 0) {
2116
2334
  startAlgorithm = () => underlyingSink.start(controller);
2335
+ } else {
2336
+ startAlgorithm = () => void 0;
2117
2337
  }
2118
2338
  if (underlyingSink.write !== void 0) {
2119
2339
  writeAlgorithm = (chunk) => underlyingSink.write(chunk, controller);
2340
+ } else {
2341
+ writeAlgorithm = () => promiseResolvedWith(void 0);
2120
2342
  }
2121
2343
  if (underlyingSink.close !== void 0) {
2122
2344
  closeAlgorithm = () => underlyingSink.close();
2345
+ } else {
2346
+ closeAlgorithm = () => promiseResolvedWith(void 0);
2123
2347
  }
2124
2348
  if (underlyingSink.abort !== void 0) {
2125
2349
  abortAlgorithm = (reason) => underlyingSink.abort(reason);
2350
+ } else {
2351
+ abortAlgorithm = () => promiseResolvedWith(void 0);
2126
2352
  }
2127
2353
  SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
2128
2354
  }
@@ -2197,8 +2423,10 @@ var require_ponyfill_es2018 = __commonJS({
2197
2423
  WritableStreamDefaultControllerClearAlgorithms(controller);
2198
2424
  uponPromise(sinkClosePromise, () => {
2199
2425
  WritableStreamFinishInFlightClose(stream);
2426
+ return null;
2200
2427
  }, (reason) => {
2201
2428
  WritableStreamFinishInFlightCloseWithError(stream, reason);
2429
+ return null;
2202
2430
  });
2203
2431
  }
2204
2432
  function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
@@ -2214,11 +2442,13 @@ var require_ponyfill_es2018 = __commonJS({
2214
2442
  WritableStreamUpdateBackpressure(stream, backpressure);
2215
2443
  }
2216
2444
  WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
2445
+ return null;
2217
2446
  }, (reason) => {
2218
2447
  if (stream._state === "writable") {
2219
2448
  WritableStreamDefaultControllerClearAlgorithms(controller);
2220
2449
  }
2221
2450
  WritableStreamFinishInFlightWriteWithError(stream, reason);
2451
+ return null;
2222
2452
  });
2223
2453
  }
2224
2454
  function WritableStreamDefaultControllerGetBackpressure(controller) {
@@ -2319,19 +2549,36 @@ var require_ponyfill_es2018 = __commonJS({
2319
2549
  writer._readyPromise_reject = void 0;
2320
2550
  writer._readyPromiseState = "fulfilled";
2321
2551
  }
2322
- const NativeDOMException = typeof DOMException !== "undefined" ? DOMException : void 0;
2552
+ function getGlobals() {
2553
+ if (typeof globalThis !== "undefined") {
2554
+ return globalThis;
2555
+ } else if (typeof self !== "undefined") {
2556
+ return self;
2557
+ } else if (typeof global !== "undefined") {
2558
+ return global;
2559
+ }
2560
+ return void 0;
2561
+ }
2562
+ const globals = getGlobals();
2323
2563
  function isDOMExceptionConstructor(ctor) {
2324
2564
  if (!(typeof ctor === "function" || typeof ctor === "object")) {
2325
2565
  return false;
2326
2566
  }
2567
+ if (ctor.name !== "DOMException") {
2568
+ return false;
2569
+ }
2327
2570
  try {
2328
2571
  new ctor();
2329
2572
  return true;
2330
- } catch (_a) {
2573
+ } catch (_a2) {
2331
2574
  return false;
2332
2575
  }
2333
2576
  }
2334
- function createDOMExceptionPolyfill() {
2577
+ function getFromGlobal() {
2578
+ const ctor = globals === null || globals === void 0 ? void 0 : globals.DOMException;
2579
+ return isDOMExceptionConstructor(ctor) ? ctor : void 0;
2580
+ }
2581
+ function createPolyfill() {
2335
2582
  const ctor = function DOMException3(message, name) {
2336
2583
  this.message = message || "";
2337
2584
  this.name = name || "Error";
@@ -2339,11 +2586,12 @@ var require_ponyfill_es2018 = __commonJS({
2339
2586
  Error.captureStackTrace(this, this.constructor);
2340
2587
  }
2341
2588
  };
2589
+ setFunctionName(ctor, "DOMException");
2342
2590
  ctor.prototype = Object.create(Error.prototype);
2343
2591
  Object.defineProperty(ctor.prototype, "constructor", { value: ctor, writable: true, configurable: true });
2344
2592
  return ctor;
2345
2593
  }
2346
- const DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
2594
+ const DOMException2 = getFromGlobal() || createPolyfill();
2347
2595
  function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
2348
2596
  const reader = AcquireReadableStreamDefaultReader(source);
2349
2597
  const writer = AcquireWritableStreamDefaultWriter(dest);
@@ -2354,7 +2602,7 @@ var require_ponyfill_es2018 = __commonJS({
2354
2602
  let abortAlgorithm;
2355
2603
  if (signal !== void 0) {
2356
2604
  abortAlgorithm = () => {
2357
- const error = new DOMException$1("Aborted", "AbortError");
2605
+ const error = signal.reason !== void 0 ? signal.reason : new DOMException2("Aborted", "AbortError");
2358
2606
  const actions = [];
2359
2607
  if (!preventAbort) {
2360
2608
  actions.push(() => {
@@ -2415,6 +2663,7 @@ var require_ponyfill_es2018 = __commonJS({
2415
2663
  } else {
2416
2664
  shutdown(true, storedError);
2417
2665
  }
2666
+ return null;
2418
2667
  });
2419
2668
  isOrBecomesErrored(dest, writer._closedPromise, (storedError) => {
2420
2669
  if (!preventCancel) {
@@ -2422,6 +2671,7 @@ var require_ponyfill_es2018 = __commonJS({
2422
2671
  } else {
2423
2672
  shutdown(true, storedError);
2424
2673
  }
2674
+ return null;
2425
2675
  });
2426
2676
  isOrBecomesClosed(source, reader._closedPromise, () => {
2427
2677
  if (!preventClose) {
@@ -2429,6 +2679,7 @@ var require_ponyfill_es2018 = __commonJS({
2429
2679
  } else {
2430
2680
  shutdown();
2431
2681
  }
2682
+ return null;
2432
2683
  });
2433
2684
  if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === "closed") {
2434
2685
  const destClosed = new TypeError("the destination writable stream closed before all data could be piped to it");
@@ -2469,6 +2720,7 @@ var require_ponyfill_es2018 = __commonJS({
2469
2720
  }
2470
2721
  function doTheRest() {
2471
2722
  uponPromise(action(), () => finalize(originalIsError, originalError), (newError) => finalize(true, newError));
2723
+ return null;
2472
2724
  }
2473
2725
  }
2474
2726
  function shutdown(isError, error) {
@@ -2493,6 +2745,7 @@ var require_ponyfill_es2018 = __commonJS({
2493
2745
  } else {
2494
2746
  resolve(void 0);
2495
2747
  }
2748
+ return null;
2496
2749
  }
2497
2750
  });
2498
2751
  }
@@ -2565,6 +2818,9 @@ var require_ponyfill_es2018 = __commonJS({
2565
2818
  ReadableStreamDefaultControllerCallPullIfNeeded(this);
2566
2819
  }
2567
2820
  }
2821
+ /** @internal */
2822
+ [ReleaseSteps]() {
2823
+ }
2568
2824
  }
2569
2825
  Object.defineProperties(ReadableStreamDefaultController.prototype, {
2570
2826
  close: { enumerable: true },
@@ -2572,8 +2828,11 @@ var require_ponyfill_es2018 = __commonJS({
2572
2828
  error: { enumerable: true },
2573
2829
  desiredSize: { enumerable: true }
2574
2830
  });
2575
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
2576
- Object.defineProperty(ReadableStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
2831
+ setFunctionName(ReadableStreamDefaultController.prototype.close, "close");
2832
+ setFunctionName(ReadableStreamDefaultController.prototype.enqueue, "enqueue");
2833
+ setFunctionName(ReadableStreamDefaultController.prototype.error, "error");
2834
+ if (typeof Symbol.toStringTag === "symbol") {
2835
+ Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {
2577
2836
  value: "ReadableStreamDefaultController",
2578
2837
  configurable: true
2579
2838
  });
@@ -2604,8 +2863,10 @@ var require_ponyfill_es2018 = __commonJS({
2604
2863
  controller._pullAgain = false;
2605
2864
  ReadableStreamDefaultControllerCallPullIfNeeded(controller);
2606
2865
  }
2866
+ return null;
2607
2867
  }, (e2) => {
2608
2868
  ReadableStreamDefaultControllerError(controller, e2);
2869
+ return null;
2609
2870
  });
2610
2871
  }
2611
2872
  function ReadableStreamDefaultControllerShouldCallPull(controller) {
@@ -2715,23 +2976,31 @@ var require_ponyfill_es2018 = __commonJS({
2715
2976
  uponPromise(promiseResolvedWith(startResult), () => {
2716
2977
  controller._started = true;
2717
2978
  ReadableStreamDefaultControllerCallPullIfNeeded(controller);
2979
+ return null;
2718
2980
  }, (r2) => {
2719
2981
  ReadableStreamDefaultControllerError(controller, r2);
2982
+ return null;
2720
2983
  });
2721
2984
  }
2722
2985
  function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
2723
2986
  const controller = Object.create(ReadableStreamDefaultController.prototype);
2724
- let startAlgorithm = () => void 0;
2725
- let pullAlgorithm = () => promiseResolvedWith(void 0);
2726
- let cancelAlgorithm = () => promiseResolvedWith(void 0);
2987
+ let startAlgorithm;
2988
+ let pullAlgorithm;
2989
+ let cancelAlgorithm;
2727
2990
  if (underlyingSource.start !== void 0) {
2728
2991
  startAlgorithm = () => underlyingSource.start(controller);
2992
+ } else {
2993
+ startAlgorithm = () => void 0;
2729
2994
  }
2730
2995
  if (underlyingSource.pull !== void 0) {
2731
2996
  pullAlgorithm = () => underlyingSource.pull(controller);
2997
+ } else {
2998
+ pullAlgorithm = () => promiseResolvedWith(void 0);
2732
2999
  }
2733
3000
  if (underlyingSource.cancel !== void 0) {
2734
3001
  cancelAlgorithm = (reason) => underlyingSource.cancel(reason);
3002
+ } else {
3003
+ cancelAlgorithm = () => promiseResolvedWith(void 0);
2735
3004
  }
2736
3005
  SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
2737
3006
  }
@@ -2766,7 +3035,7 @@ var require_ponyfill_es2018 = __commonJS({
2766
3035
  reading = true;
2767
3036
  const readRequest = {
2768
3037
  _chunkSteps: (chunk) => {
2769
- queueMicrotask(() => {
3038
+ _queueMicrotask(() => {
2770
3039
  readAgain = false;
2771
3040
  const chunk1 = chunk;
2772
3041
  const chunk2 = chunk;
@@ -2831,6 +3100,7 @@ var require_ponyfill_es2018 = __commonJS({
2831
3100
  if (!canceled1 || !canceled2) {
2832
3101
  resolveCancelPromise(void 0);
2833
3102
  }
3103
+ return null;
2834
3104
  });
2835
3105
  return [branch1, branch2];
2836
3106
  }
@@ -2852,13 +3122,14 @@ var require_ponyfill_es2018 = __commonJS({
2852
3122
  function forwardReaderError(thisReader) {
2853
3123
  uponRejection(thisReader._closedPromise, (r2) => {
2854
3124
  if (thisReader !== reader) {
2855
- return;
3125
+ return null;
2856
3126
  }
2857
3127
  ReadableByteStreamControllerError(branch1._readableStreamController, r2);
2858
3128
  ReadableByteStreamControllerError(branch2._readableStreamController, r2);
2859
3129
  if (!canceled1 || !canceled2) {
2860
3130
  resolveCancelPromise(void 0);
2861
3131
  }
3132
+ return null;
2862
3133
  });
2863
3134
  }
2864
3135
  function pullWithDefaultReader() {
@@ -2869,7 +3140,7 @@ var require_ponyfill_es2018 = __commonJS({
2869
3140
  }
2870
3141
  const readRequest = {
2871
3142
  _chunkSteps: (chunk) => {
2872
- queueMicrotask(() => {
3143
+ _queueMicrotask(() => {
2873
3144
  readAgainForBranch1 = false;
2874
3145
  readAgainForBranch2 = false;
2875
3146
  const chunk1 = chunk;
@@ -2932,7 +3203,7 @@ var require_ponyfill_es2018 = __commonJS({
2932
3203
  const otherBranch = forBranch2 ? branch1 : branch2;
2933
3204
  const readIntoRequest = {
2934
3205
  _chunkSteps: (chunk) => {
2935
- queueMicrotask(() => {
3206
+ _queueMicrotask(() => {
2936
3207
  readAgainForBranch1 = false;
2937
3208
  readAgainForBranch2 = false;
2938
3209
  const byobCanceled = forBranch2 ? canceled2 : canceled1;
@@ -2988,7 +3259,7 @@ var require_ponyfill_es2018 = __commonJS({
2988
3259
  reading = false;
2989
3260
  }
2990
3261
  };
2991
- ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
3262
+ ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);
2992
3263
  }
2993
3264
  function pull1Algorithm() {
2994
3265
  if (reading) {
@@ -3046,6 +3317,100 @@ var require_ponyfill_es2018 = __commonJS({
3046
3317
  forwardReaderError(reader);
3047
3318
  return [branch1, branch2];
3048
3319
  }
3320
+ function isReadableStreamLike(stream) {
3321
+ return typeIsObject(stream) && typeof stream.getReader !== "undefined";
3322
+ }
3323
+ function ReadableStreamFrom(source) {
3324
+ if (isReadableStreamLike(source)) {
3325
+ return ReadableStreamFromDefaultReader(source.getReader());
3326
+ }
3327
+ return ReadableStreamFromIterable(source);
3328
+ }
3329
+ function ReadableStreamFromIterable(asyncIterable) {
3330
+ let stream;
3331
+ const iteratorRecord = GetIterator(asyncIterable, "async");
3332
+ const startAlgorithm = noop;
3333
+ function pullAlgorithm() {
3334
+ let nextResult;
3335
+ try {
3336
+ nextResult = IteratorNext(iteratorRecord);
3337
+ } catch (e2) {
3338
+ return promiseRejectedWith(e2);
3339
+ }
3340
+ const nextPromise = promiseResolvedWith(nextResult);
3341
+ return transformPromiseWith(nextPromise, (iterResult) => {
3342
+ if (!typeIsObject(iterResult)) {
3343
+ throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");
3344
+ }
3345
+ const done = IteratorComplete(iterResult);
3346
+ if (done) {
3347
+ ReadableStreamDefaultControllerClose(stream._readableStreamController);
3348
+ } else {
3349
+ const value = IteratorValue(iterResult);
3350
+ ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
3351
+ }
3352
+ });
3353
+ }
3354
+ function cancelAlgorithm(reason) {
3355
+ const iterator = iteratorRecord.iterator;
3356
+ let returnMethod;
3357
+ try {
3358
+ returnMethod = GetMethod(iterator, "return");
3359
+ } catch (e2) {
3360
+ return promiseRejectedWith(e2);
3361
+ }
3362
+ if (returnMethod === void 0) {
3363
+ return promiseResolvedWith(void 0);
3364
+ }
3365
+ let returnResult;
3366
+ try {
3367
+ returnResult = reflectCall(returnMethod, iterator, [reason]);
3368
+ } catch (e2) {
3369
+ return promiseRejectedWith(e2);
3370
+ }
3371
+ const returnPromise = promiseResolvedWith(returnResult);
3372
+ return transformPromiseWith(returnPromise, (iterResult) => {
3373
+ if (!typeIsObject(iterResult)) {
3374
+ throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object");
3375
+ }
3376
+ return void 0;
3377
+ });
3378
+ }
3379
+ stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
3380
+ return stream;
3381
+ }
3382
+ function ReadableStreamFromDefaultReader(reader) {
3383
+ let stream;
3384
+ const startAlgorithm = noop;
3385
+ function pullAlgorithm() {
3386
+ let readPromise;
3387
+ try {
3388
+ readPromise = reader.read();
3389
+ } catch (e2) {
3390
+ return promiseRejectedWith(e2);
3391
+ }
3392
+ return transformPromiseWith(readPromise, (readResult) => {
3393
+ if (!typeIsObject(readResult)) {
3394
+ throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");
3395
+ }
3396
+ if (readResult.done) {
3397
+ ReadableStreamDefaultControllerClose(stream._readableStreamController);
3398
+ } else {
3399
+ const value = readResult.value;
3400
+ ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
3401
+ }
3402
+ });
3403
+ }
3404
+ function cancelAlgorithm(reason) {
3405
+ try {
3406
+ return promiseResolvedWith(reader.cancel(reason));
3407
+ } catch (e2) {
3408
+ return promiseRejectedWith(e2);
3409
+ }
3410
+ }
3411
+ stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
3412
+ return stream;
3413
+ }
3049
3414
  function convertUnderlyingDefaultOrByteSource(source, context) {
3050
3415
  assertDictionary(source, context);
3051
3416
  const original = source;
@@ -3081,20 +3446,6 @@ var require_ponyfill_es2018 = __commonJS({
3081
3446
  }
3082
3447
  return type;
3083
3448
  }
3084
- function convertReaderOptions(options, context) {
3085
- assertDictionary(options, context);
3086
- const mode = options === null || options === void 0 ? void 0 : options.mode;
3087
- return {
3088
- mode: mode === void 0 ? void 0 : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)
3089
- };
3090
- }
3091
- function convertReadableStreamReaderMode(mode, context) {
3092
- mode = `${mode}`;
3093
- if (mode !== "byob") {
3094
- throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);
3095
- }
3096
- return mode;
3097
- }
3098
3449
  function convertIteratorOptions(options, context) {
3099
3450
  assertDictionary(options, context);
3100
3451
  const preventCancel = options === null || options === void 0 ? void 0 : options.preventCancel;
@@ -3253,7 +3604,22 @@ var require_ponyfill_es2018 = __commonJS({
3253
3604
  const options = convertIteratorOptions(rawOptions, "First parameter");
3254
3605
  return AcquireReadableStreamAsyncIterator(this, options.preventCancel);
3255
3606
  }
3607
+ [SymbolAsyncIterator](options) {
3608
+ return this.values(options);
3609
+ }
3610
+ /**
3611
+ * Creates a new ReadableStream wrapping the provided iterable or async iterable.
3612
+ *
3613
+ * This can be used to adapt various kinds of objects into a readable stream,
3614
+ * such as an array, an async generator, or a Node.js readable stream.
3615
+ */
3616
+ static from(asyncIterable) {
3617
+ return ReadableStreamFrom(asyncIterable);
3618
+ }
3256
3619
  }
3620
+ Object.defineProperties(ReadableStream2, {
3621
+ from: { enumerable: true }
3622
+ });
3257
3623
  Object.defineProperties(ReadableStream2.prototype, {
3258
3624
  cancel: { enumerable: true },
3259
3625
  getReader: { enumerable: true },
@@ -3263,19 +3629,24 @@ var require_ponyfill_es2018 = __commonJS({
3263
3629
  values: { enumerable: true },
3264
3630
  locked: { enumerable: true }
3265
3631
  });
3266
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
3267
- Object.defineProperty(ReadableStream2.prototype, SymbolPolyfill.toStringTag, {
3632
+ setFunctionName(ReadableStream2.from, "from");
3633
+ setFunctionName(ReadableStream2.prototype.cancel, "cancel");
3634
+ setFunctionName(ReadableStream2.prototype.getReader, "getReader");
3635
+ setFunctionName(ReadableStream2.prototype.pipeThrough, "pipeThrough");
3636
+ setFunctionName(ReadableStream2.prototype.pipeTo, "pipeTo");
3637
+ setFunctionName(ReadableStream2.prototype.tee, "tee");
3638
+ setFunctionName(ReadableStream2.prototype.values, "values");
3639
+ if (typeof Symbol.toStringTag === "symbol") {
3640
+ Object.defineProperty(ReadableStream2.prototype, Symbol.toStringTag, {
3268
3641
  value: "ReadableStream",
3269
3642
  configurable: true
3270
3643
  });
3271
3644
  }
3272
- if (typeof SymbolPolyfill.asyncIterator === "symbol") {
3273
- Object.defineProperty(ReadableStream2.prototype, SymbolPolyfill.asyncIterator, {
3274
- value: ReadableStream2.prototype.values,
3275
- writable: true,
3276
- configurable: true
3277
- });
3278
- }
3645
+ Object.defineProperty(ReadableStream2.prototype, SymbolAsyncIterator, {
3646
+ value: ReadableStream2.prototype.values,
3647
+ writable: true,
3648
+ configurable: true
3649
+ });
3279
3650
  function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark = 1, sizeAlgorithm = () => 1) {
3280
3651
  const stream = Object.create(ReadableStream2.prototype);
3281
3652
  InitializeReadableStream(stream);
@@ -3322,10 +3693,11 @@ var require_ponyfill_es2018 = __commonJS({
3322
3693
  ReadableStreamClose(stream);
3323
3694
  const reader = stream._reader;
3324
3695
  if (reader !== void 0 && IsReadableStreamBYOBReader(reader)) {
3325
- reader._readIntoRequests.forEach((readIntoRequest) => {
3696
+ const readIntoRequests = reader._readIntoRequests;
3697
+ reader._readIntoRequests = new SimpleQueue();
3698
+ readIntoRequests.forEach((readIntoRequest) => {
3326
3699
  readIntoRequest._closeSteps(void 0);
3327
3700
  });
3328
- reader._readIntoRequests = new SimpleQueue();
3329
3701
  }
3330
3702
  const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
3331
3703
  return transformPromiseWith(sourceCancelPromise, noop);
@@ -3338,10 +3710,11 @@ var require_ponyfill_es2018 = __commonJS({
3338
3710
  }
3339
3711
  defaultReaderClosedPromiseResolve(reader);
3340
3712
  if (IsReadableStreamDefaultReader(reader)) {
3341
- reader._readRequests.forEach((readRequest) => {
3713
+ const readRequests = reader._readRequests;
3714
+ reader._readRequests = new SimpleQueue();
3715
+ readRequests.forEach((readRequest) => {
3342
3716
  readRequest._closeSteps();
3343
3717
  });
3344
- reader._readRequests = new SimpleQueue();
3345
3718
  }
3346
3719
  }
3347
3720
  function ReadableStreamError(stream, e2) {
@@ -3353,15 +3726,9 @@ var require_ponyfill_es2018 = __commonJS({
3353
3726
  }
3354
3727
  defaultReaderClosedPromiseReject(reader, e2);
3355
3728
  if (IsReadableStreamDefaultReader(reader)) {
3356
- reader._readRequests.forEach((readRequest) => {
3357
- readRequest._errorSteps(e2);
3358
- });
3359
- reader._readRequests = new SimpleQueue();
3729
+ ReadableStreamDefaultReaderErrorReadRequests(reader, e2);
3360
3730
  } else {
3361
- reader._readIntoRequests.forEach((readIntoRequest) => {
3362
- readIntoRequest._errorSteps(e2);
3363
- });
3364
- reader._readIntoRequests = new SimpleQueue();
3731
+ ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2);
3365
3732
  }
3366
3733
  }
3367
3734
  function streamBrandCheckException$1(name) {
@@ -3378,13 +3745,7 @@ var require_ponyfill_es2018 = __commonJS({
3378
3745
  const byteLengthSizeFunction = (chunk) => {
3379
3746
  return chunk.byteLength;
3380
3747
  };
3381
- try {
3382
- Object.defineProperty(byteLengthSizeFunction, "name", {
3383
- value: "size",
3384
- configurable: true
3385
- });
3386
- } catch (_a) {
3387
- }
3748
+ setFunctionName(byteLengthSizeFunction, "size");
3388
3749
  class ByteLengthQueuingStrategy {
3389
3750
  constructor(options) {
3390
3751
  assertRequiredArgument(options, 1, "ByteLengthQueuingStrategy");
@@ -3414,8 +3775,8 @@ var require_ponyfill_es2018 = __commonJS({
3414
3775
  highWaterMark: { enumerable: true },
3415
3776
  size: { enumerable: true }
3416
3777
  });
3417
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
3418
- Object.defineProperty(ByteLengthQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
3778
+ if (typeof Symbol.toStringTag === "symbol") {
3779
+ Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {
3419
3780
  value: "ByteLengthQueuingStrategy",
3420
3781
  configurable: true
3421
3782
  });
@@ -3435,13 +3796,7 @@ var require_ponyfill_es2018 = __commonJS({
3435
3796
  const countSizeFunction = () => {
3436
3797
  return 1;
3437
3798
  };
3438
- try {
3439
- Object.defineProperty(countSizeFunction, "name", {
3440
- value: "size",
3441
- configurable: true
3442
- });
3443
- } catch (_a) {
3444
- }
3799
+ setFunctionName(countSizeFunction, "size");
3445
3800
  class CountQueuingStrategy {
3446
3801
  constructor(options) {
3447
3802
  assertRequiredArgument(options, 1, "CountQueuingStrategy");
@@ -3472,8 +3827,8 @@ var require_ponyfill_es2018 = __commonJS({
3472
3827
  highWaterMark: { enumerable: true },
3473
3828
  size: { enumerable: true }
3474
3829
  });
3475
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
3476
- Object.defineProperty(CountQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
3830
+ if (typeof Symbol.toStringTag === "symbol") {
3831
+ Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {
3477
3832
  value: "CountQueuingStrategy",
3478
3833
  configurable: true
3479
3834
  });
@@ -3492,12 +3847,14 @@ var require_ponyfill_es2018 = __commonJS({
3492
3847
  }
3493
3848
  function convertTransformer(original, context) {
3494
3849
  assertDictionary(original, context);
3850
+ const cancel = original === null || original === void 0 ? void 0 : original.cancel;
3495
3851
  const flush = original === null || original === void 0 ? void 0 : original.flush;
3496
3852
  const readableType = original === null || original === void 0 ? void 0 : original.readableType;
3497
3853
  const start = original === null || original === void 0 ? void 0 : original.start;
3498
3854
  const transform = original === null || original === void 0 ? void 0 : original.transform;
3499
3855
  const writableType = original === null || original === void 0 ? void 0 : original.writableType;
3500
3856
  return {
3857
+ cancel: cancel === void 0 ? void 0 : convertTransformerCancelCallback(cancel, original, `${context} has member 'cancel' that`),
3501
3858
  flush: flush === void 0 ? void 0 : convertTransformerFlushCallback(flush, original, `${context} has member 'flush' that`),
3502
3859
  readableType,
3503
3860
  start: start === void 0 ? void 0 : convertTransformerStartCallback(start, original, `${context} has member 'start' that`),
@@ -3517,6 +3874,10 @@ var require_ponyfill_es2018 = __commonJS({
3517
3874
  assertFunction(fn, context);
3518
3875
  return (chunk, controller) => promiseCall(fn, original, [chunk, controller]);
3519
3876
  }
3877
+ function convertTransformerCancelCallback(fn, original, context) {
3878
+ assertFunction(fn, context);
3879
+ return (reason) => promiseCall(fn, original, [reason]);
3880
+ }
3520
3881
  class TransformStream {
3521
3882
  constructor(rawTransformer = {}, rawWritableStrategy = {}, rawReadableStrategy = {}) {
3522
3883
  if (rawTransformer === void 0) {
@@ -3570,8 +3931,8 @@ var require_ponyfill_es2018 = __commonJS({
3570
3931
  readable: { enumerable: true },
3571
3932
  writable: { enumerable: true }
3572
3933
  });
3573
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
3574
- Object.defineProperty(TransformStream.prototype, SymbolPolyfill.toStringTag, {
3934
+ if (typeof Symbol.toStringTag === "symbol") {
3935
+ Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {
3575
3936
  value: "TransformStream",
3576
3937
  configurable: true
3577
3938
  });
@@ -3594,8 +3955,7 @@ var require_ponyfill_es2018 = __commonJS({
3594
3955
  return TransformStreamDefaultSourcePullAlgorithm(stream);
3595
3956
  }
3596
3957
  function cancelAlgorithm(reason) {
3597
- TransformStreamErrorWritableAndUnblockWrite(stream, reason);
3598
- return promiseResolvedWith(void 0);
3958
+ return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);
3599
3959
  }
3600
3960
  stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
3601
3961
  stream._backpressure = void 0;
@@ -3620,6 +3980,9 @@ var require_ponyfill_es2018 = __commonJS({
3620
3980
  function TransformStreamErrorWritableAndUnblockWrite(stream, e2) {
3621
3981
  TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
3622
3982
  WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e2);
3983
+ TransformStreamUnblockWrite(stream);
3984
+ }
3985
+ function TransformStreamUnblockWrite(stream) {
3623
3986
  if (stream._backpressure) {
3624
3987
  TransformStreamSetBackpressure(stream, false);
3625
3988
  }
@@ -3680,8 +4043,11 @@ var require_ponyfill_es2018 = __commonJS({
3680
4043
  terminate: { enumerable: true },
3681
4044
  desiredSize: { enumerable: true }
3682
4045
  });
3683
- if (typeof SymbolPolyfill.toStringTag === "symbol") {
3684
- Object.defineProperty(TransformStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
4046
+ setFunctionName(TransformStreamDefaultController.prototype.enqueue, "enqueue");
4047
+ setFunctionName(TransformStreamDefaultController.prototype.error, "error");
4048
+ setFunctionName(TransformStreamDefaultController.prototype.terminate, "terminate");
4049
+ if (typeof Symbol.toStringTag === "symbol") {
4050
+ Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {
3685
4051
  value: "TransformStreamDefaultController",
3686
4052
  configurable: true
3687
4053
  });
@@ -3695,34 +4061,49 @@ var require_ponyfill_es2018 = __commonJS({
3695
4061
  }
3696
4062
  return x2 instanceof TransformStreamDefaultController;
3697
4063
  }
3698
- function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
4064
+ function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm) {
3699
4065
  controller._controlledTransformStream = stream;
3700
4066
  stream._transformStreamController = controller;
3701
4067
  controller._transformAlgorithm = transformAlgorithm;
3702
4068
  controller._flushAlgorithm = flushAlgorithm;
4069
+ controller._cancelAlgorithm = cancelAlgorithm;
4070
+ controller._finishPromise = void 0;
4071
+ controller._finishPromise_resolve = void 0;
4072
+ controller._finishPromise_reject = void 0;
3703
4073
  }
3704
4074
  function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
3705
4075
  const controller = Object.create(TransformStreamDefaultController.prototype);
3706
- let transformAlgorithm = (chunk) => {
3707
- try {
3708
- TransformStreamDefaultControllerEnqueue(controller, chunk);
3709
- return promiseResolvedWith(void 0);
3710
- } catch (transformResultE) {
3711
- return promiseRejectedWith(transformResultE);
3712
- }
3713
- };
3714
- let flushAlgorithm = () => promiseResolvedWith(void 0);
4076
+ let transformAlgorithm;
4077
+ let flushAlgorithm;
4078
+ let cancelAlgorithm;
3715
4079
  if (transformer.transform !== void 0) {
3716
4080
  transformAlgorithm = (chunk) => transformer.transform(chunk, controller);
4081
+ } else {
4082
+ transformAlgorithm = (chunk) => {
4083
+ try {
4084
+ TransformStreamDefaultControllerEnqueue(controller, chunk);
4085
+ return promiseResolvedWith(void 0);
4086
+ } catch (transformResultE) {
4087
+ return promiseRejectedWith(transformResultE);
4088
+ }
4089
+ };
3717
4090
  }
3718
4091
  if (transformer.flush !== void 0) {
3719
4092
  flushAlgorithm = () => transformer.flush(controller);
4093
+ } else {
4094
+ flushAlgorithm = () => promiseResolvedWith(void 0);
4095
+ }
4096
+ if (transformer.cancel !== void 0) {
4097
+ cancelAlgorithm = (reason) => transformer.cancel(reason);
4098
+ } else {
4099
+ cancelAlgorithm = () => promiseResolvedWith(void 0);
3720
4100
  }
3721
- SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);
4101
+ SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);
3722
4102
  }
3723
4103
  function TransformStreamDefaultControllerClearAlgorithms(controller) {
3724
4104
  controller._transformAlgorithm = void 0;
3725
4105
  controller._flushAlgorithm = void 0;
4106
+ controller._cancelAlgorithm = void 0;
3726
4107
  }
3727
4108
  function TransformStreamDefaultControllerEnqueue(controller, chunk) {
3728
4109
  const stream = controller._controlledTransformStream;
@@ -3774,31 +4155,112 @@ var require_ponyfill_es2018 = __commonJS({
3774
4155
  return TransformStreamDefaultControllerPerformTransform(controller, chunk);
3775
4156
  }
3776
4157
  function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
3777
- TransformStreamError(stream, reason);
3778
- return promiseResolvedWith(void 0);
4158
+ const controller = stream._transformStreamController;
4159
+ if (controller._finishPromise !== void 0) {
4160
+ return controller._finishPromise;
4161
+ }
4162
+ const readable = stream._readable;
4163
+ controller._finishPromise = newPromise((resolve, reject) => {
4164
+ controller._finishPromise_resolve = resolve;
4165
+ controller._finishPromise_reject = reject;
4166
+ });
4167
+ const cancelPromise = controller._cancelAlgorithm(reason);
4168
+ TransformStreamDefaultControllerClearAlgorithms(controller);
4169
+ uponPromise(cancelPromise, () => {
4170
+ if (readable._state === "errored") {
4171
+ defaultControllerFinishPromiseReject(controller, readable._storedError);
4172
+ } else {
4173
+ ReadableStreamDefaultControllerError(readable._readableStreamController, reason);
4174
+ defaultControllerFinishPromiseResolve(controller);
4175
+ }
4176
+ return null;
4177
+ }, (r2) => {
4178
+ ReadableStreamDefaultControllerError(readable._readableStreamController, r2);
4179
+ defaultControllerFinishPromiseReject(controller, r2);
4180
+ return null;
4181
+ });
4182
+ return controller._finishPromise;
3779
4183
  }
3780
4184
  function TransformStreamDefaultSinkCloseAlgorithm(stream) {
3781
- const readable = stream._readable;
3782
4185
  const controller = stream._transformStreamController;
4186
+ if (controller._finishPromise !== void 0) {
4187
+ return controller._finishPromise;
4188
+ }
4189
+ const readable = stream._readable;
4190
+ controller._finishPromise = newPromise((resolve, reject) => {
4191
+ controller._finishPromise_resolve = resolve;
4192
+ controller._finishPromise_reject = reject;
4193
+ });
3783
4194
  const flushPromise = controller._flushAlgorithm();
3784
4195
  TransformStreamDefaultControllerClearAlgorithms(controller);
3785
- return transformPromiseWith(flushPromise, () => {
4196
+ uponPromise(flushPromise, () => {
3786
4197
  if (readable._state === "errored") {
3787
- throw readable._storedError;
4198
+ defaultControllerFinishPromiseReject(controller, readable._storedError);
4199
+ } else {
4200
+ ReadableStreamDefaultControllerClose(readable._readableStreamController);
4201
+ defaultControllerFinishPromiseResolve(controller);
3788
4202
  }
3789
- ReadableStreamDefaultControllerClose(readable._readableStreamController);
4203
+ return null;
3790
4204
  }, (r2) => {
3791
- TransformStreamError(stream, r2);
3792
- throw readable._storedError;
4205
+ ReadableStreamDefaultControllerError(readable._readableStreamController, r2);
4206
+ defaultControllerFinishPromiseReject(controller, r2);
4207
+ return null;
3793
4208
  });
4209
+ return controller._finishPromise;
3794
4210
  }
3795
4211
  function TransformStreamDefaultSourcePullAlgorithm(stream) {
3796
4212
  TransformStreamSetBackpressure(stream, false);
3797
4213
  return stream._backpressureChangePromise;
3798
4214
  }
4215
+ function TransformStreamDefaultSourceCancelAlgorithm(stream, reason) {
4216
+ const controller = stream._transformStreamController;
4217
+ if (controller._finishPromise !== void 0) {
4218
+ return controller._finishPromise;
4219
+ }
4220
+ const writable = stream._writable;
4221
+ controller._finishPromise = newPromise((resolve, reject) => {
4222
+ controller._finishPromise_resolve = resolve;
4223
+ controller._finishPromise_reject = reject;
4224
+ });
4225
+ const cancelPromise = controller._cancelAlgorithm(reason);
4226
+ TransformStreamDefaultControllerClearAlgorithms(controller);
4227
+ uponPromise(cancelPromise, () => {
4228
+ if (writable._state === "errored") {
4229
+ defaultControllerFinishPromiseReject(controller, writable._storedError);
4230
+ } else {
4231
+ WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);
4232
+ TransformStreamUnblockWrite(stream);
4233
+ defaultControllerFinishPromiseResolve(controller);
4234
+ }
4235
+ return null;
4236
+ }, (r2) => {
4237
+ WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r2);
4238
+ TransformStreamUnblockWrite(stream);
4239
+ defaultControllerFinishPromiseReject(controller, r2);
4240
+ return null;
4241
+ });
4242
+ return controller._finishPromise;
4243
+ }
3799
4244
  function defaultControllerBrandCheckException(name) {
3800
4245
  return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);
3801
4246
  }
4247
+ function defaultControllerFinishPromiseResolve(controller) {
4248
+ if (controller._finishPromise_resolve === void 0) {
4249
+ return;
4250
+ }
4251
+ controller._finishPromise_resolve();
4252
+ controller._finishPromise_resolve = void 0;
4253
+ controller._finishPromise_reject = void 0;
4254
+ }
4255
+ function defaultControllerFinishPromiseReject(controller, reason) {
4256
+ if (controller._finishPromise_reject === void 0) {
4257
+ return;
4258
+ }
4259
+ setPromiseIsHandledToTrue(controller._finishPromise);
4260
+ controller._finishPromise_reject(reason);
4261
+ controller._finishPromise_resolve = void 0;
4262
+ controller._finishPromise_reject = void 0;
4263
+ }
3802
4264
  function streamBrandCheckException(name) {
3803
4265
  return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`);
3804
4266
  }
@@ -3815,7 +4277,6 @@ var require_ponyfill_es2018 = __commonJS({
3815
4277
  exports2.WritableStream = WritableStream;
3816
4278
  exports2.WritableStreamDefaultController = WritableStreamDefaultController;
3817
4279
  exports2.WritableStreamDefaultWriter = WritableStreamDefaultWriter;
3818
- Object.defineProperty(exports2, "__esModule", { value: true });
3819
4280
  });
3820
4281
  }
3821
4282
  });
@@ -4272,6 +4733,15 @@ export {
4272
4733
  };
4273
4734
  /*! Bundled license information:
4274
4735
 
4736
+ web-streams-polyfill/dist/ponyfill.es2018.js:
4737
+ (**
4738
+ * @license
4739
+ * web-streams-polyfill v3.3.3
4740
+ * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
4741
+ * This code is released under the MIT license.
4742
+ * SPDX-License-Identifier: MIT
4743
+ *)
4744
+
4275
4745
  node-domexception/index.js:
4276
4746
  (*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
4277
4747