@prisma/internals 6.6.0-integration-mcp.2 → 6.6.0-integration-push-xmzqvqxpztks.12

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 (102) hide show
  1. package/dist/Generator.d.ts +23 -5
  2. package/dist/Generator.js +4 -2
  3. package/dist/{chunk-2LDG4PID.js → chunk-2QTAK7KO.js} +5 -5
  4. package/dist/{chunk-SAAMENIS.js → chunk-3DQANJMY.js} +7 -7
  5. package/dist/{chunk-MEOOYUIZ.js → chunk-5AI4FIZ3.js} +10 -10
  6. package/dist/{chunk-WOIJKMTZ.js → chunk-62LU4TVK.js} +8 -8
  7. package/dist/{chunk-4KCLNFE4.js → chunk-62PNTFVL.js} +5 -5
  8. package/dist/{chunk-URRVX2VQ.js → chunk-67I7CEQJ.js} +6 -6
  9. package/dist/{chunk-GV244NDE.js → chunk-72C2UHFB.js} +7 -7
  10. package/dist/{chunk-UB2X7DGZ.js → chunk-75BIJ5PX.js} +9 -9
  11. package/dist/{chunk-R45GQNKO.js → chunk-BD2NGNRL.js} +85 -200
  12. package/dist/{chunk-DYVL6P7F.js → chunk-BPDMLM32.js} +46 -13
  13. package/dist/{chunk-ORPBIAE5.js → chunk-BTAROFR3.js} +8 -8
  14. package/dist/{chunk-PING5S2U.js → chunk-BWPH7QBV.js} +8 -8
  15. package/dist/{chunk-IRWX4FCC.js → chunk-D4VDA2TZ.js} +6 -6
  16. package/dist/{chunk-EKESIUIK.js → chunk-DKSUHQGA.js} +7 -7
  17. package/dist/{chunk-2I3VYCA7.js → chunk-EPXBOIA5.js} +5 -5
  18. package/dist/{chunk-WF5LZFJS.js → chunk-ETYWYJBX.js} +12 -12
  19. package/dist/{chunk-AXD7KB4D.js → chunk-HG3YOAAE.js} +5 -5
  20. package/dist/{chunk-IWTEX7EE.js → chunk-IDINCQMN.js} +780 -9
  21. package/dist/{chunk-2LOGW45F.js → chunk-JOIIWB3U.js} +33 -68
  22. package/dist/{chunk-3GYXMWBM.js → chunk-KB5DKCI4.js} +7 -7
  23. package/dist/{chunk-VTJOX6HO.js → chunk-LVXOY25I.js} +5 -5
  24. package/dist/{chunk-R4ZFFYJA.js → chunk-MJIP3FY5.js} +2502 -238
  25. package/dist/{chunk-XRBOJLES.js → chunk-MM2LGTOC.js} +5 -6
  26. package/dist/{chunk-FAPPXX7W.js → chunk-MVXDMOUP.js} +8 -8
  27. package/dist/{chunk-KNNTV7IN.js → chunk-NVNI2SRU.js} +213 -687
  28. package/dist/{chunk-VYJSNZF3.js → chunk-P3WMSDK6.js} +4 -5
  29. package/dist/{chunk-SNSJWJTA.js → chunk-R3ZRLDO2.js} +5 -5
  30. package/dist/{chunk-XMVJRTN5.js → chunk-RTT3E5AL.js} +5 -5
  31. package/dist/{chunk-PWGQKUJW.js → chunk-SDEBGULW.js} +85 -200
  32. package/dist/{chunk-MXAUURHG.js → chunk-TQFONRJP.js} +5 -5
  33. package/dist/{chunk-RABVZXRU.js → chunk-TURIBUFP.js} +7 -7
  34. package/dist/{chunk-5CBAXTAF.js → chunk-UKGGGBT7.js} +5 -5
  35. package/dist/{chunk-LWBLVV7Y.js → chunk-VEXYKK6K.js} +8 -8
  36. package/dist/{chunk-Q2IBLC6D.js → chunk-VXSXRDY2.js} +5 -5
  37. package/dist/{chunk-AP52B62F.js → chunk-XAAXHLR3.js} +5 -5
  38. package/dist/{chunk-OUQPIJFQ.js → chunk-XARFXSI5.js} +5 -5
  39. package/dist/{chunk-SUOMIRLO.js → chunk-YR5KNFKN.js} +6 -6
  40. package/dist/{chunk-UFYFNNCN.js → chunk-Z5PI6LVB.js} +8 -8
  41. package/dist/cli/checkUnsupportedDataProxy.js +37 -44
  42. package/dist/cli/getSchema.js +40 -47
  43. package/dist/cli/hashes.js +37 -44
  44. package/dist/cli/schemaContext.js +37 -44
  45. package/dist/engine-commands/errorHelpers.js +4 -4
  46. package/dist/engine-commands/formatSchema.js +36 -43
  47. package/dist/engine-commands/getConfig.js +10 -10
  48. package/dist/engine-commands/getDmmf.js +7 -7
  49. package/dist/engine-commands/getEngineVersion.js +6 -7
  50. package/dist/engine-commands/getEnginesMetaInfo.js +8 -9
  51. package/dist/engine-commands/index.js +47 -54
  52. package/dist/engine-commands/lintSchema.js +8 -8
  53. package/dist/engine-commands/mergeSchemas.js +7 -7
  54. package/dist/engine-commands/validate.js +7 -7
  55. package/dist/errorReporting.js +6 -6
  56. package/dist/get-generators/getGenerators.d.ts +18 -9
  57. package/dist/get-generators/getGenerators.js +39 -46
  58. package/dist/get-generators/utils/getBinaryPathsByVersion.js +3 -4
  59. package/dist/getPackedPackage.js +4 -5
  60. package/dist/index.d.ts +2 -4
  61. package/dist/index.js +80 -87
  62. package/dist/{multipart-parser-UV3WZSWW.js → multipart-parser-3AFJFP6K.js} +6 -6
  63. package/dist/resolveBinary.js +7 -8
  64. package/dist/resolvePkg.d.ts +7 -0
  65. package/dist/{get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.js → resolvePkg.js} +6 -6
  66. package/dist/schemaEngineCommands.js +9 -10
  67. package/dist/sendPanic.js +4 -4
  68. package/dist/utils/cloudflareD1.js +3 -3
  69. package/dist/utils/fs-functional.js +10 -10
  70. package/dist/utils/fs-utils.js +8 -8
  71. package/dist/utils/getEnvPaths.js +36 -43
  72. package/dist/utils/getVersionFromPackageJson.js +3 -3
  73. package/dist/utils/handlePanic.js +5 -5
  74. package/dist/utils/loadEnvFile.js +36 -43
  75. package/dist/wasm.js +4 -4
  76. package/package.json +11 -12
  77. package/dist/chunk-72UZXEBG.js +0 -28
  78. package/dist/chunk-BWGDP6B5.js +0 -4948
  79. package/dist/chunk-DYV47NUW.js +0 -796
  80. package/dist/chunk-EUTJYQDW.js +0 -46
  81. package/dist/chunk-GHHABGYW.js +0 -28
  82. package/dist/chunk-OQ2NRV2Y.js +0 -35
  83. package/dist/chunk-PE6DXWOX.js +0 -52
  84. package/dist/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
  85. package/dist/get-generators/generatorResolvers/generatorResolvers.js +0 -139
  86. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
  87. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.js +0 -26
  88. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
  89. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.js +0 -26
  90. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
  91. package/dist/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.js +0 -29
  92. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
  93. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +0 -139
  94. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
  95. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.js +0 -26
  96. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
  97. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.js +0 -26
  98. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
  99. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.d.ts +0 -1
  100. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.test.js +0 -17
  101. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
  102. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +0 -140
@@ -16,47 +16,51 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_KNNTV7IN_exports = {};
20
- __export(chunk_KNNTV7IN_exports, {
19
+ var chunk_NVNI2SRU_exports = {};
20
+ __export(chunk_NVNI2SRU_exports, {
21
21
  FormData: () => FormData,
22
22
  fetch_blob_default: () => fetch_blob_default,
23
23
  file_default: () => file_default,
24
24
  formDataToBlob: () => formDataToBlob
25
25
  });
26
- module.exports = __toCommonJS(chunk_KNNTV7IN_exports);
26
+ module.exports = __toCommonJS(chunk_NVNI2SRU_exports);
27
27
  var import_chunk_4VNS5WPM = require("./chunk-4VNS5WPM.js");
28
28
  var import_node_fs = require("node:fs");
29
29
  var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
30
- "../../node_modules/.pnpm/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(exports, module2) {
30
+ "../../node_modules/.pnpm/web-streams-polyfill@3.2.1/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(exports, module2) {
31
31
  "use strict";
32
32
  (function(global2, factory) {
33
33
  typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.WebStreamsPolyfill = {}));
34
34
  })(exports, function(exports2) {
35
35
  "use strict";
36
+ const SymbolPolyfill = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol : (description) => `Symbol(${description})`;
36
37
  function noop() {
37
38
  return void 0;
38
39
  }
40
+ function getGlobals() {
41
+ if (typeof self !== "undefined") {
42
+ return self;
43
+ } else if (typeof window !== "undefined") {
44
+ return window;
45
+ } else if (typeof global !== "undefined") {
46
+ return global;
47
+ }
48
+ return void 0;
49
+ }
50
+ const globals = getGlobals();
39
51
  function typeIsObject(x2) {
40
52
  return typeof x2 === "object" && x2 !== null || typeof x2 === "function";
41
53
  }
42
54
  const rethrowAssertionErrorRejection = noop;
43
- function setFunctionName(fn, name) {
44
- try {
45
- Object.defineProperty(fn, "name", {
46
- value: name,
47
- configurable: true
48
- });
49
- } catch (_a2) {
50
- }
51
- }
52
55
  const originalPromise = Promise;
53
56
  const originalPromiseThen = Promise.prototype.then;
57
+ const originalPromiseResolve = Promise.resolve.bind(originalPromise);
54
58
  const originalPromiseReject = Promise.reject.bind(originalPromise);
55
59
  function newPromise(executor) {
56
60
  return new originalPromise(executor);
57
61
  }
58
62
  function promiseResolvedWith(value) {
59
- return newPromise((resolve) => resolve(value));
63
+ return originalPromiseResolve(value);
60
64
  }
61
65
  function promiseRejectedWith(reason) {
62
66
  return originalPromiseReject(reason);
@@ -79,15 +83,14 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
79
83
  function setPromiseIsHandledToTrue(promise) {
80
84
  PerformPromiseThen(promise, void 0, rethrowAssertionErrorRejection);
81
85
  }
82
- let _queueMicrotask = (callback) => {
83
- if (typeof queueMicrotask === "function") {
84
- _queueMicrotask = queueMicrotask;
85
- } else {
86
- const resolvedPromise = promiseResolvedWith(void 0);
87
- _queueMicrotask = (cb) => PerformPromiseThen(resolvedPromise, cb);
86
+ const queueMicrotask = (() => {
87
+ const globalQueueMicrotask = globals && globals.queueMicrotask;
88
+ if (typeof globalQueueMicrotask === "function") {
89
+ return globalQueueMicrotask;
88
90
  }
89
- return _queueMicrotask(callback);
90
- };
91
+ const resolvedPromise = promiseResolvedWith(void 0);
92
+ return (fn) => PerformPromiseThen(resolvedPromise, fn);
93
+ })();
91
94
  function reflectCall(F, V, args) {
92
95
  if (typeof F !== "function") {
93
96
  throw new TypeError("Argument is not a function");
@@ -191,11 +194,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
191
194
  return front._elements[cursor];
192
195
  }
193
196
  }
194
- const AbortSteps = Symbol("[[AbortSteps]]");
195
- const ErrorSteps = Symbol("[[ErrorSteps]]");
196
- const CancelSteps = Symbol("[[CancelSteps]]");
197
- const PullSteps = Symbol("[[PullSteps]]");
198
- const ReleaseSteps = Symbol("[[ReleaseSteps]]");
199
197
  function ReadableStreamReaderGenericInitialize(reader, stream) {
200
198
  reader._ownerReadableStream = stream;
201
199
  stream._reader = reader;
@@ -212,14 +210,12 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
212
210
  return ReadableStreamCancel(stream, reason);
213
211
  }
214
212
  function ReadableStreamReaderGenericRelease(reader) {
215
- const stream = reader._ownerReadableStream;
216
- if (stream._state === "readable") {
213
+ if (reader._ownerReadableStream._state === "readable") {
217
214
  defaultReaderClosedPromiseReject(reader, new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));
218
215
  } else {
219
216
  defaultReaderClosedPromiseResetToRejected(reader, new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));
220
217
  }
221
- stream._readableStreamController[ReleaseSteps]();
222
- stream._reader = void 0;
218
+ reader._ownerReadableStream._reader = void 0;
223
219
  reader._ownerReadableStream = void 0;
224
220
  }
225
221
  function readerLockException(name) {
@@ -259,6 +255,10 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
259
255
  reader._closedPromise_resolve = void 0;
260
256
  reader._closedPromise_reject = void 0;
261
257
  }
258
+ const AbortSteps = SymbolPolyfill("[[AbortSteps]]");
259
+ const ErrorSteps = SymbolPolyfill("[[ErrorSteps]]");
260
+ const CancelSteps = SymbolPolyfill("[[CancelSteps]]");
261
+ const PullSteps = SymbolPolyfill("[[PullSteps]]");
262
262
  const NumberIsFinite = Number.isFinite || function(x2) {
263
263
  return typeof x2 === "number" && isFinite(x2);
264
264
  };
@@ -429,7 +429,10 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
429
429
  if (this._ownerReadableStream === void 0) {
430
430
  return;
431
431
  }
432
- ReadableStreamDefaultReaderRelease(this);
432
+ if (this._readRequests.length > 0) {
433
+ throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");
434
+ }
435
+ ReadableStreamReaderGenericRelease(this);
433
436
  }
434
437
  }
435
438
  Object.defineProperties(ReadableStreamDefaultReader.prototype, {
@@ -438,11 +441,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
438
441
  releaseLock: { enumerable: true },
439
442
  closed: { enumerable: true }
440
443
  });
441
- setFunctionName(ReadableStreamDefaultReader.prototype.cancel, "cancel");
442
- setFunctionName(ReadableStreamDefaultReader.prototype.read, "read");
443
- setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, "releaseLock");
444
- if (typeof Symbol.toStringTag === "symbol") {
445
- Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {
444
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
445
+ Object.defineProperty(ReadableStreamDefaultReader.prototype, SymbolPolyfill.toStringTag, {
446
446
  value: "ReadableStreamDefaultReader",
447
447
  configurable: true
448
448
  });
@@ -467,18 +467,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
467
467
  stream._readableStreamController[PullSteps](readRequest);
468
468
  }
469
469
  }
470
- function ReadableStreamDefaultReaderRelease(reader) {
471
- ReadableStreamReaderGenericRelease(reader);
472
- const e2 = new TypeError("Reader was released");
473
- ReadableStreamDefaultReaderErrorReadRequests(reader, e2);
474
- }
475
- function ReadableStreamDefaultReaderErrorReadRequests(reader, e2) {
476
- const readRequests = reader._readRequests;
477
- reader._readRequests = new SimpleQueue();
478
- readRequests.forEach((readRequest) => {
479
- readRequest._errorSteps(e2);
480
- });
481
- }
482
470
  function defaultReaderBrandCheckException(name) {
483
471
  return new TypeError(`ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`);
484
472
  }
@@ -505,6 +493,9 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
505
493
  return Promise.resolve({ value: void 0, done: true });
506
494
  }
507
495
  const reader = this._reader;
496
+ if (reader._ownerReadableStream === void 0) {
497
+ return promiseRejectedWith(readerLockException("iterate"));
498
+ }
508
499
  let resolvePromise;
509
500
  let rejectPromise;
510
501
  const promise = newPromise((resolve, reject) => {
@@ -514,7 +505,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
514
505
  const readRequest = {
515
506
  _chunkSteps: (chunk) => {
516
507
  this._ongoingPromise = void 0;
517
- _queueMicrotask(() => resolvePromise({ value: chunk, done: false }));
508
+ queueMicrotask(() => resolvePromise({ value: chunk, done: false }));
518
509
  },
519
510
  _closeSteps: () => {
520
511
  this._ongoingPromise = void 0;
@@ -538,6 +529,9 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
538
529
  }
539
530
  this._isFinished = true;
540
531
  const reader = this._reader;
532
+ if (reader._ownerReadableStream === void 0) {
533
+ return promiseRejectedWith(readerLockException("finish iterating"));
534
+ }
541
535
  if (!this._preventCancel) {
542
536
  const result = ReadableStreamReaderGenericCancel(reader, value);
543
537
  ReadableStreamReaderGenericRelease(reader);
@@ -561,7 +555,9 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
561
555
  return this._asyncIteratorImpl.return(value);
562
556
  }
563
557
  };
564
- Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
558
+ if (AsyncIteratorPrototype !== void 0) {
559
+ Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
560
+ }
565
561
  function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
566
562
  const reader = AcquireReadableStreamDefaultReader(stream);
567
563
  const impl = new ReadableStreamAsyncIteratorImpl(reader, preventCancel);
@@ -578,7 +574,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
578
574
  }
579
575
  try {
580
576
  return x2._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl;
581
- } catch (_a2) {
577
+ } catch (_a) {
582
578
  return false;
583
579
  }
584
580
  }
@@ -588,31 +584,18 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
588
584
  const NumberIsNaN = Number.isNaN || function(x2) {
589
585
  return x2 !== x2;
590
586
  };
591
- var _a, _b, _c;
592
587
  function CreateArrayFromList(elements) {
593
588
  return elements.slice();
594
589
  }
595
590
  function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
596
591
  new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
597
592
  }
598
- let TransferArrayBuffer = (O) => {
599
- if (typeof O.transfer === "function") {
600
- TransferArrayBuffer = (buffer) => buffer.transfer();
601
- } else if (typeof structuredClone === "function") {
602
- TransferArrayBuffer = (buffer) => structuredClone(buffer, { transfer: [buffer] });
603
- } else {
604
- TransferArrayBuffer = (buffer) => buffer;
605
- }
606
- return TransferArrayBuffer(O);
607
- };
608
- let IsDetachedBuffer = (O) => {
609
- if (typeof O.detached === "boolean") {
610
- IsDetachedBuffer = (buffer) => buffer.detached;
611
- } else {
612
- IsDetachedBuffer = (buffer) => buffer.byteLength === 0;
613
- }
614
- return IsDetachedBuffer(O);
615
- };
593
+ function TransferArrayBuffer(O) {
594
+ return O;
595
+ }
596
+ function IsDetachedBuffer(O) {
597
+ return false;
598
+ }
616
599
  function ArrayBufferSlice(buffer, begin, end) {
617
600
  if (buffer.slice) {
618
601
  return buffer.slice(begin, end);
@@ -622,63 +605,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
622
605
  CopyDataBlockBytes(slice, 0, buffer, begin, length);
623
606
  return slice;
624
607
  }
625
- function GetMethod(receiver, prop) {
626
- const func = receiver[prop];
627
- if (func === void 0 || func === null) {
628
- return void 0;
629
- }
630
- if (typeof func !== "function") {
631
- throw new TypeError(`${String(prop)} is not a function`);
632
- }
633
- return func;
634
- }
635
- function CreateAsyncFromSyncIterator(syncIteratorRecord) {
636
- const syncIterable = {
637
- [Symbol.iterator]: () => syncIteratorRecord.iterator
638
- };
639
- const asyncIterator = async function* () {
640
- return yield* syncIterable;
641
- }();
642
- const nextMethod = asyncIterator.next;
643
- return { iterator: asyncIterator, nextMethod, done: false };
644
- }
645
- 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";
646
- function GetIterator(obj, hint = "sync", method) {
647
- if (method === void 0) {
648
- if (hint === "async") {
649
- method = GetMethod(obj, SymbolAsyncIterator);
650
- if (method === void 0) {
651
- const syncMethod = GetMethod(obj, Symbol.iterator);
652
- const syncIteratorRecord = GetIterator(obj, "sync", syncMethod);
653
- return CreateAsyncFromSyncIterator(syncIteratorRecord);
654
- }
655
- } else {
656
- method = GetMethod(obj, Symbol.iterator);
657
- }
658
- }
659
- if (method === void 0) {
660
- throw new TypeError("The object is not iterable");
661
- }
662
- const iterator = reflectCall(method, obj, []);
663
- if (!typeIsObject(iterator)) {
664
- throw new TypeError("The iterator method must return an object");
665
- }
666
- const nextMethod = iterator.next;
667
- return { iterator, nextMethod, done: false };
668
- }
669
- function IteratorNext(iteratorRecord) {
670
- const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);
671
- if (!typeIsObject(result)) {
672
- throw new TypeError("The iterator.next() method must return an object");
673
- }
674
- return result;
675
- }
676
- function IteratorComplete(iterResult) {
677
- return Boolean(iterResult.done);
678
- }
679
- function IteratorValue(iterResult) {
680
- return iterResult.value;
681
- }
682
608
  function IsNonNegativeNumber(v) {
683
609
  if (typeof v !== "number") {
684
610
  return false;
@@ -718,18 +644,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
718
644
  container._queue = new SimpleQueue();
719
645
  container._queueTotalSize = 0;
720
646
  }
721
- function isDataViewConstructor(ctor) {
722
- return ctor === DataView;
723
- }
724
- function isDataView(view) {
725
- return isDataViewConstructor(view.constructor);
726
- }
727
- function arrayBufferViewElementSize(ctor) {
728
- if (isDataViewConstructor(ctor)) {
729
- return 1;
730
- }
731
- return ctor.BYTES_PER_ELEMENT;
732
- }
733
647
  class ReadableStreamBYOBRequest {
734
648
  constructor() {
735
649
  throw new TypeError("Illegal constructor");
@@ -752,9 +666,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
752
666
  if (this._associatedReadableByteStreamController === void 0) {
753
667
  throw new TypeError("This BYOB request has been invalidated");
754
668
  }
755
- if (IsDetachedBuffer(this._view.buffer)) {
756
- throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);
757
- }
669
+ if (IsDetachedBuffer(this._view.buffer)) ;
758
670
  ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
759
671
  }
760
672
  respondWithNewView(view) {
@@ -768,9 +680,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
768
680
  if (this._associatedReadableByteStreamController === void 0) {
769
681
  throw new TypeError("This BYOB request has been invalidated");
770
682
  }
771
- if (IsDetachedBuffer(view.buffer)) {
772
- throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");
773
- }
683
+ if (IsDetachedBuffer(view.buffer)) ;
774
684
  ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
775
685
  }
776
686
  }
@@ -779,10 +689,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
779
689
  respondWithNewView: { enumerable: true },
780
690
  view: { enumerable: true }
781
691
  });
782
- setFunctionName(ReadableStreamBYOBRequest.prototype.respond, "respond");
783
- setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, "respondWithNewView");
784
- if (typeof Symbol.toStringTag === "symbol") {
785
- Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {
692
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
693
+ Object.defineProperty(ReadableStreamBYOBRequest.prototype, SymbolPolyfill.toStringTag, {
786
694
  value: "ReadableStreamBYOBRequest",
787
695
  configurable: true
788
696
  });
@@ -871,7 +779,11 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
871
779
  [PullSteps](readRequest) {
872
780
  const stream = this._controlledReadableByteStream;
873
781
  if (this._queueTotalSize > 0) {
874
- ReadableByteStreamControllerFillReadRequestFromQueue(this, readRequest);
782
+ const entry = this._queue.shift();
783
+ this._queueTotalSize -= entry.byteLength;
784
+ ReadableByteStreamControllerHandleQueueDrain(this);
785
+ const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
786
+ readRequest._chunkSteps(view);
875
787
  return;
876
788
  }
877
789
  const autoAllocateChunkSize = this._autoAllocateChunkSize;
@@ -889,7 +801,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
889
801
  byteOffset: 0,
890
802
  byteLength: autoAllocateChunkSize,
891
803
  bytesFilled: 0,
892
- minimumFill: 1,
893
804
  elementSize: 1,
894
805
  viewConstructor: Uint8Array,
895
806
  readerType: "default"
@@ -899,15 +810,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
899
810
  ReadableStreamAddReadRequest(stream, readRequest);
900
811
  ReadableByteStreamControllerCallPullIfNeeded(this);
901
812
  }
902
- /** @internal */
903
- [ReleaseSteps]() {
904
- if (this._pendingPullIntos.length > 0) {
905
- const firstPullInto = this._pendingPullIntos.peek();
906
- firstPullInto.readerType = "none";
907
- this._pendingPullIntos = new SimpleQueue();
908
- this._pendingPullIntos.push(firstPullInto);
909
- }
910
- }
911
813
  }
912
814
  Object.defineProperties(ReadableByteStreamController.prototype, {
913
815
  close: { enumerable: true },
@@ -916,11 +818,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
916
818
  byobRequest: { enumerable: true },
917
819
  desiredSize: { enumerable: true }
918
820
  });
919
- setFunctionName(ReadableByteStreamController.prototype.close, "close");
920
- setFunctionName(ReadableByteStreamController.prototype.enqueue, "enqueue");
921
- setFunctionName(ReadableByteStreamController.prototype.error, "error");
922
- if (typeof Symbol.toStringTag === "symbol") {
923
- Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {
821
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
822
+ Object.defineProperty(ReadableByteStreamController.prototype, SymbolPolyfill.toStringTag, {
924
823
  value: "ReadableByteStreamController",
925
824
  configurable: true
926
825
  });
@@ -960,10 +859,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
960
859
  controller._pullAgain = false;
961
860
  ReadableByteStreamControllerCallPullIfNeeded(controller);
962
861
  }
963
- return null;
964
862
  }, (e2) => {
965
863
  ReadableByteStreamControllerError(controller, e2);
966
- return null;
967
864
  });
968
865
  }
969
866
  function ReadableByteStreamControllerClearPendingPullIntos(controller) {
@@ -991,30 +888,15 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
991
888
  controller._queue.push({ buffer, byteOffset, byteLength });
992
889
  controller._queueTotalSize += byteLength;
993
890
  }
994
- function ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, buffer, byteOffset, byteLength) {
995
- let clonedChunk;
996
- try {
997
- clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);
998
- } catch (cloneE) {
999
- ReadableByteStreamControllerError(controller, cloneE);
1000
- throw cloneE;
1001
- }
1002
- ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);
1003
- }
1004
- function ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstDescriptor) {
1005
- if (firstDescriptor.bytesFilled > 0) {
1006
- ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, firstDescriptor.buffer, firstDescriptor.byteOffset, firstDescriptor.bytesFilled);
1007
- }
1008
- ReadableByteStreamControllerShiftPendingPullInto(controller);
1009
- }
1010
891
  function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
892
+ const elementSize = pullIntoDescriptor.elementSize;
893
+ const currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
1011
894
  const maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
1012
895
  const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
896
+ const maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
1013
897
  let totalBytesToCopyRemaining = maxBytesToCopy;
1014
898
  let ready = false;
1015
- const remainderBytes = maxBytesFilled % pullIntoDescriptor.elementSize;
1016
- const maxAlignedBytes = maxBytesFilled - remainderBytes;
1017
- if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {
899
+ if (maxAlignedBytes > currentAlignedBytes) {
1018
900
  totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
1019
901
  ready = true;
1020
902
  }
@@ -1067,36 +949,20 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1067
949
  }
1068
950
  }
1069
951
  }
1070
- function ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller) {
1071
- const reader = controller._controlledReadableByteStream._reader;
1072
- while (reader._readRequests.length > 0) {
1073
- if (controller._queueTotalSize === 0) {
1074
- return;
1075
- }
1076
- const readRequest = reader._readRequests.shift();
1077
- ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);
1078
- }
1079
- }
1080
- function ReadableByteStreamControllerPullInto(controller, view, min, readIntoRequest) {
952
+ function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest) {
1081
953
  const stream = controller._controlledReadableByteStream;
1082
- const ctor = view.constructor;
1083
- const elementSize = arrayBufferViewElementSize(ctor);
1084
- const { byteOffset, byteLength } = view;
1085
- const minimumFill = min * elementSize;
1086
- let buffer;
1087
- try {
1088
- buffer = TransferArrayBuffer(view.buffer);
1089
- } catch (e2) {
1090
- readIntoRequest._errorSteps(e2);
1091
- return;
954
+ let elementSize = 1;
955
+ if (view.constructor !== DataView) {
956
+ elementSize = view.constructor.BYTES_PER_ELEMENT;
1092
957
  }
958
+ const ctor = view.constructor;
959
+ const buffer = TransferArrayBuffer(view.buffer);
1093
960
  const pullIntoDescriptor = {
1094
961
  buffer,
1095
962
  bufferByteLength: buffer.byteLength,
1096
- byteOffset,
1097
- byteLength,
963
+ byteOffset: view.byteOffset,
964
+ byteLength: view.byteLength,
1098
965
  bytesFilled: 0,
1099
- minimumFill,
1100
966
  elementSize,
1101
967
  viewConstructor: ctor,
1102
968
  readerType: "byob"
@@ -1130,9 +996,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1130
996
  ReadableByteStreamControllerCallPullIfNeeded(controller);
1131
997
  }
1132
998
  function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
1133
- if (firstDescriptor.readerType === "none") {
1134
- ReadableByteStreamControllerShiftPendingPullInto(controller);
1135
- }
1136
999
  const stream = controller._controlledReadableByteStream;
1137
1000
  if (ReadableStreamHasBYOBReader(stream)) {
1138
1001
  while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
@@ -1143,19 +1006,15 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1143
1006
  }
1144
1007
  function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
1145
1008
  ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
1146
- if (pullIntoDescriptor.readerType === "none") {
1147
- ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);
1148
- ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
1149
- return;
1150
- }
1151
- if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {
1009
+ if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
1152
1010
  return;
1153
1011
  }
1154
1012
  ReadableByteStreamControllerShiftPendingPullInto(controller);
1155
1013
  const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
1156
1014
  if (remainderSize > 0) {
1157
1015
  const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
1158
- ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller, pullIntoDescriptor.buffer, end - remainderSize, remainderSize);
1016
+ const remainder = ArrayBufferSlice(pullIntoDescriptor.buffer, end - remainderSize, end);
1017
+ ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
1159
1018
  }
1160
1019
  pullIntoDescriptor.bytesFilled -= remainderSize;
1161
1020
  ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
@@ -1166,7 +1025,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1166
1025
  ReadableByteStreamControllerInvalidateBYOBRequest(controller);
1167
1026
  const state = controller._controlledReadableByteStream._state;
1168
1027
  if (state === "closed") {
1169
- ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
1028
+ ReadableByteStreamControllerRespondInClosedState(controller);
1170
1029
  } else {
1171
1030
  ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
1172
1031
  }
@@ -1214,7 +1073,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1214
1073
  }
1215
1074
  if (controller._pendingPullIntos.length > 0) {
1216
1075
  const firstPendingPullInto = controller._pendingPullIntos.peek();
1217
- if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {
1076
+ if (firstPendingPullInto.bytesFilled > 0) {
1218
1077
  const e2 = new TypeError("Insufficient bytes to fill elements in the given buffer");
1219
1078
  ReadableByteStreamControllerError(controller, e2);
1220
1079
  throw e2;
@@ -1228,24 +1087,17 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1228
1087
  if (controller._closeRequested || stream._state !== "readable") {
1229
1088
  return;
1230
1089
  }
1231
- const { buffer, byteOffset, byteLength } = chunk;
1232
- if (IsDetachedBuffer(buffer)) {
1233
- throw new TypeError("chunk's buffer is detached and so cannot be enqueued");
1234
- }
1090
+ const buffer = chunk.buffer;
1091
+ const byteOffset = chunk.byteOffset;
1092
+ const byteLength = chunk.byteLength;
1235
1093
  const transferredBuffer = TransferArrayBuffer(buffer);
1236
1094
  if (controller._pendingPullIntos.length > 0) {
1237
1095
  const firstPendingPullInto = controller._pendingPullIntos.peek();
1238
- if (IsDetachedBuffer(firstPendingPullInto.buffer)) {
1239
- throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");
1240
- }
1241
- ReadableByteStreamControllerInvalidateBYOBRequest(controller);
1096
+ if (IsDetachedBuffer(firstPendingPullInto.buffer)) ;
1242
1097
  firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);
1243
- if (firstPendingPullInto.readerType === "none") {
1244
- ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);
1245
- }
1246
1098
  }
1099
+ ReadableByteStreamControllerInvalidateBYOBRequest(controller);
1247
1100
  if (ReadableStreamHasDefaultReader(stream)) {
1248
- ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);
1249
1101
  if (ReadableStreamGetNumReadRequests(stream) === 0) {
1250
1102
  ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
1251
1103
  } else {
@@ -1273,13 +1125,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1273
1125
  ReadableByteStreamControllerClearAlgorithms(controller);
1274
1126
  ReadableStreamError(stream, e2);
1275
1127
  }
1276
- function ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest) {
1277
- const entry = controller._queue.shift();
1278
- controller._queueTotalSize -= entry.byteLength;
1279
- ReadableByteStreamControllerHandleQueueDrain(controller);
1280
- const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
1281
- readRequest._chunkSteps(view);
1282
- }
1283
1128
  function ReadableByteStreamControllerGetBYOBRequest(controller) {
1284
1129
  if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
1285
1130
  const firstDescriptor = controller._pendingPullIntos.peek();
@@ -1362,31 +1207,23 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1362
1207
  uponPromise(promiseResolvedWith(startResult), () => {
1363
1208
  controller._started = true;
1364
1209
  ReadableByteStreamControllerCallPullIfNeeded(controller);
1365
- return null;
1366
1210
  }, (r2) => {
1367
1211
  ReadableByteStreamControllerError(controller, r2);
1368
- return null;
1369
1212
  });
1370
1213
  }
1371
1214
  function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
1372
1215
  const controller = Object.create(ReadableByteStreamController.prototype);
1373
- let startAlgorithm;
1374
- let pullAlgorithm;
1375
- let cancelAlgorithm;
1216
+ let startAlgorithm = () => void 0;
1217
+ let pullAlgorithm = () => promiseResolvedWith(void 0);
1218
+ let cancelAlgorithm = () => promiseResolvedWith(void 0);
1376
1219
  if (underlyingByteSource.start !== void 0) {
1377
1220
  startAlgorithm = () => underlyingByteSource.start(controller);
1378
- } else {
1379
- startAlgorithm = () => void 0;
1380
1221
  }
1381
1222
  if (underlyingByteSource.pull !== void 0) {
1382
1223
  pullAlgorithm = () => underlyingByteSource.pull(controller);
1383
- } else {
1384
- pullAlgorithm = () => promiseResolvedWith(void 0);
1385
1224
  }
1386
1225
  if (underlyingByteSource.cancel !== void 0) {
1387
1226
  cancelAlgorithm = (reason) => underlyingByteSource.cancel(reason);
1388
- } else {
1389
- cancelAlgorithm = () => promiseResolvedWith(void 0);
1390
1227
  }
1391
1228
  const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
1392
1229
  if (autoAllocateChunkSize === 0) {
@@ -1404,28 +1241,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1404
1241
  function byteStreamControllerBrandCheckException(name) {
1405
1242
  return new TypeError(`ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`);
1406
1243
  }
1407
- function convertReaderOptions(options, context) {
1408
- assertDictionary(options, context);
1409
- const mode = options === null || options === void 0 ? void 0 : options.mode;
1410
- return {
1411
- mode: mode === void 0 ? void 0 : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)
1412
- };
1413
- }
1414
- function convertReadableStreamReaderMode(mode, context) {
1415
- mode = `${mode}`;
1416
- if (mode !== "byob") {
1417
- throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);
1418
- }
1419
- return mode;
1420
- }
1421
- function convertByobReadOptions(options, context) {
1422
- var _a2;
1423
- assertDictionary(options, context);
1424
- const min = (_a2 = options === null || options === void 0 ? void 0 : options.min) !== null && _a2 !== void 0 ? _a2 : 1;
1425
- return {
1426
- min: convertUnsignedLongLongWithEnforceRange(min, `${context} has member 'min' that`)
1427
- };
1428
- }
1429
1244
  function AcquireReadableStreamBYOBReader(stream) {
1430
1245
  return new ReadableStreamBYOBReader(stream);
1431
1246
  }
@@ -1489,7 +1304,12 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1489
1304
  }
1490
1305
  return ReadableStreamReaderGenericCancel(this, reason);
1491
1306
  }
1492
- read(view, rawOptions = {}) {
1307
+ /**
1308
+ * Attempts to reads bytes into view, and returns a promise resolved with the result.
1309
+ *
1310
+ * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
1311
+ */
1312
+ read(view) {
1493
1313
  if (!IsReadableStreamBYOBReader(this)) {
1494
1314
  return promiseRejectedWith(byobReaderBrandCheckException("read"));
1495
1315
  }
@@ -1502,26 +1322,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1502
1322
  if (view.buffer.byteLength === 0) {
1503
1323
  return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));
1504
1324
  }
1505
- if (IsDetachedBuffer(view.buffer)) {
1506
- return promiseRejectedWith(new TypeError("view's buffer has been detached"));
1507
- }
1508
- let options;
1509
- try {
1510
- options = convertByobReadOptions(rawOptions, "options");
1511
- } catch (e2) {
1512
- return promiseRejectedWith(e2);
1513
- }
1514
- const min = options.min;
1515
- if (min === 0) {
1516
- return promiseRejectedWith(new TypeError("options.min must be greater than 0"));
1517
- }
1518
- if (!isDataView(view)) {
1519
- if (min > view.length) {
1520
- return promiseRejectedWith(new RangeError("options.min must be less than or equal to view's length"));
1521
- }
1522
- } else if (min > view.byteLength) {
1523
- return promiseRejectedWith(new RangeError("options.min must be less than or equal to view's byteLength"));
1524
- }
1325
+ if (IsDetachedBuffer(view.buffer)) ;
1525
1326
  if (this._ownerReadableStream === void 0) {
1526
1327
  return promiseRejectedWith(readerLockException("read from"));
1527
1328
  }
@@ -1536,7 +1337,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1536
1337
  _closeSteps: (chunk) => resolvePromise({ value: chunk, done: true }),
1537
1338
  _errorSteps: (e2) => rejectPromise(e2)
1538
1339
  };
1539
- ReadableStreamBYOBReaderRead(this, view, min, readIntoRequest);
1340
+ ReadableStreamBYOBReaderRead(this, view, readIntoRequest);
1540
1341
  return promise;
1541
1342
  }
1542
1343
  /**
@@ -1555,7 +1356,10 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1555
1356
  if (this._ownerReadableStream === void 0) {
1556
1357
  return;
1557
1358
  }
1558
- ReadableStreamBYOBReaderRelease(this);
1359
+ if (this._readIntoRequests.length > 0) {
1360
+ throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");
1361
+ }
1362
+ ReadableStreamReaderGenericRelease(this);
1559
1363
  }
1560
1364
  }
1561
1365
  Object.defineProperties(ReadableStreamBYOBReader.prototype, {
@@ -1564,11 +1368,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1564
1368
  releaseLock: { enumerable: true },
1565
1369
  closed: { enumerable: true }
1566
1370
  });
1567
- setFunctionName(ReadableStreamBYOBReader.prototype.cancel, "cancel");
1568
- setFunctionName(ReadableStreamBYOBReader.prototype.read, "read");
1569
- setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, "releaseLock");
1570
- if (typeof Symbol.toStringTag === "symbol") {
1571
- Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {
1371
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
1372
+ Object.defineProperty(ReadableStreamBYOBReader.prototype, SymbolPolyfill.toStringTag, {
1572
1373
  value: "ReadableStreamBYOBReader",
1573
1374
  configurable: true
1574
1375
  });
@@ -1582,27 +1383,15 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1582
1383
  }
1583
1384
  return x2 instanceof ReadableStreamBYOBReader;
1584
1385
  }
1585
- function ReadableStreamBYOBReaderRead(reader, view, min, readIntoRequest) {
1386
+ function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
1586
1387
  const stream = reader._ownerReadableStream;
1587
1388
  stream._disturbed = true;
1588
1389
  if (stream._state === "errored") {
1589
1390
  readIntoRequest._errorSteps(stream._storedError);
1590
1391
  } else {
1591
- ReadableByteStreamControllerPullInto(stream._readableStreamController, view, min, readIntoRequest);
1392
+ ReadableByteStreamControllerPullInto(stream._readableStreamController, view, readIntoRequest);
1592
1393
  }
1593
1394
  }
1594
- function ReadableStreamBYOBReaderRelease(reader) {
1595
- ReadableStreamReaderGenericRelease(reader);
1596
- const e2 = new TypeError("Reader was released");
1597
- ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2);
1598
- }
1599
- function ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2) {
1600
- const readIntoRequests = reader._readIntoRequests;
1601
- reader._readIntoRequests = new SimpleQueue();
1602
- readIntoRequests.forEach((readIntoRequest) => {
1603
- readIntoRequest._errorSteps(e2);
1604
- });
1605
- }
1606
1395
  function byobReaderBrandCheckException(name) {
1607
1396
  return new TypeError(`ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`);
1608
1397
  }
@@ -1678,7 +1467,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1678
1467
  }
1679
1468
  try {
1680
1469
  return typeof value.aborted === "boolean";
1681
- } catch (_a2) {
1470
+ } catch (_a) {
1682
1471
  return false;
1683
1472
  }
1684
1473
  }
@@ -1775,11 +1564,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1775
1564
  getWriter: { enumerable: true },
1776
1565
  locked: { enumerable: true }
1777
1566
  });
1778
- setFunctionName(WritableStream.prototype.abort, "abort");
1779
- setFunctionName(WritableStream.prototype.close, "close");
1780
- setFunctionName(WritableStream.prototype.getWriter, "getWriter");
1781
- if (typeof Symbol.toStringTag === "symbol") {
1782
- Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {
1567
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
1568
+ Object.defineProperty(WritableStream.prototype, SymbolPolyfill.toStringTag, {
1783
1569
  value: "WritableStream",
1784
1570
  configurable: true
1785
1571
  });
@@ -1822,12 +1608,12 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1822
1608
  return true;
1823
1609
  }
1824
1610
  function WritableStreamAbort(stream, reason) {
1825
- var _a2;
1611
+ var _a;
1826
1612
  if (stream._state === "closed" || stream._state === "errored") {
1827
1613
  return promiseResolvedWith(void 0);
1828
1614
  }
1829
1615
  stream._writableStreamController._abortReason = reason;
1830
- (_a2 = stream._writableStreamController._abortController) === null || _a2 === void 0 ? void 0 : _a2.abort(reason);
1616
+ (_a = stream._writableStreamController._abortController) === null || _a === void 0 ? void 0 : _a.abort();
1831
1617
  const state = stream._state;
1832
1618
  if (state === "closed" || state === "errored") {
1833
1619
  return promiseResolvedWith(void 0);
@@ -1927,11 +1713,9 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
1927
1713
  uponPromise(promise, () => {
1928
1714
  abortRequest._resolve();
1929
1715
  WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
1930
- return null;
1931
1716
  }, (reason) => {
1932
1717
  abortRequest._reject(reason);
1933
1718
  WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
1934
- return null;
1935
1719
  });
1936
1720
  }
1937
1721
  function WritableStreamFinishInFlightWrite(stream) {
@@ -2146,12 +1930,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2146
1930
  desiredSize: { enumerable: true },
2147
1931
  ready: { enumerable: true }
2148
1932
  });
2149
- setFunctionName(WritableStreamDefaultWriter.prototype.abort, "abort");
2150
- setFunctionName(WritableStreamDefaultWriter.prototype.close, "close");
2151
- setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, "releaseLock");
2152
- setFunctionName(WritableStreamDefaultWriter.prototype.write, "write");
2153
- if (typeof Symbol.toStringTag === "symbol") {
2154
- Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {
1933
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
1934
+ Object.defineProperty(WritableStreamDefaultWriter.prototype, SymbolPolyfill.toStringTag, {
2155
1935
  value: "WritableStreamDefaultWriter",
2156
1936
  configurable: true
2157
1937
  });
@@ -2301,8 +2081,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2301
2081
  signal: { enumerable: true },
2302
2082
  error: { enumerable: true }
2303
2083
  });
2304
- if (typeof Symbol.toStringTag === "symbol") {
2305
- Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {
2084
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
2085
+ Object.defineProperty(WritableStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
2306
2086
  value: "WritableStreamDefaultController",
2307
2087
  configurable: true
2308
2088
  });
@@ -2337,38 +2117,28 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2337
2117
  uponPromise(startPromise, () => {
2338
2118
  controller._started = true;
2339
2119
  WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
2340
- return null;
2341
2120
  }, (r2) => {
2342
2121
  controller._started = true;
2343
2122
  WritableStreamDealWithRejection(stream, r2);
2344
- return null;
2345
2123
  });
2346
2124
  }
2347
2125
  function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
2348
2126
  const controller = Object.create(WritableStreamDefaultController.prototype);
2349
- let startAlgorithm;
2350
- let writeAlgorithm;
2351
- let closeAlgorithm;
2352
- let abortAlgorithm;
2127
+ let startAlgorithm = () => void 0;
2128
+ let writeAlgorithm = () => promiseResolvedWith(void 0);
2129
+ let closeAlgorithm = () => promiseResolvedWith(void 0);
2130
+ let abortAlgorithm = () => promiseResolvedWith(void 0);
2353
2131
  if (underlyingSink.start !== void 0) {
2354
2132
  startAlgorithm = () => underlyingSink.start(controller);
2355
- } else {
2356
- startAlgorithm = () => void 0;
2357
2133
  }
2358
2134
  if (underlyingSink.write !== void 0) {
2359
2135
  writeAlgorithm = (chunk) => underlyingSink.write(chunk, controller);
2360
- } else {
2361
- writeAlgorithm = () => promiseResolvedWith(void 0);
2362
2136
  }
2363
2137
  if (underlyingSink.close !== void 0) {
2364
2138
  closeAlgorithm = () => underlyingSink.close();
2365
- } else {
2366
- closeAlgorithm = () => promiseResolvedWith(void 0);
2367
2139
  }
2368
2140
  if (underlyingSink.abort !== void 0) {
2369
2141
  abortAlgorithm = (reason) => underlyingSink.abort(reason);
2370
- } else {
2371
- abortAlgorithm = () => promiseResolvedWith(void 0);
2372
2142
  }
2373
2143
  SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
2374
2144
  }
@@ -2443,10 +2213,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2443
2213
  WritableStreamDefaultControllerClearAlgorithms(controller);
2444
2214
  uponPromise(sinkClosePromise, () => {
2445
2215
  WritableStreamFinishInFlightClose(stream);
2446
- return null;
2447
2216
  }, (reason) => {
2448
2217
  WritableStreamFinishInFlightCloseWithError(stream, reason);
2449
- return null;
2450
2218
  });
2451
2219
  }
2452
2220
  function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
@@ -2462,13 +2230,11 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2462
2230
  WritableStreamUpdateBackpressure(stream, backpressure);
2463
2231
  }
2464
2232
  WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
2465
- return null;
2466
2233
  }, (reason) => {
2467
2234
  if (stream._state === "writable") {
2468
2235
  WritableStreamDefaultControllerClearAlgorithms(controller);
2469
2236
  }
2470
2237
  WritableStreamFinishInFlightWriteWithError(stream, reason);
2471
- return null;
2472
2238
  });
2473
2239
  }
2474
2240
  function WritableStreamDefaultControllerGetBackpressure(controller) {
@@ -2569,36 +2335,19 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2569
2335
  writer._readyPromise_reject = void 0;
2570
2336
  writer._readyPromiseState = "fulfilled";
2571
2337
  }
2572
- function getGlobals() {
2573
- if (typeof globalThis !== "undefined") {
2574
- return globalThis;
2575
- } else if (typeof self !== "undefined") {
2576
- return self;
2577
- } else if (typeof global !== "undefined") {
2578
- return global;
2579
- }
2580
- return void 0;
2581
- }
2582
- const globals = getGlobals();
2338
+ const NativeDOMException = typeof DOMException !== "undefined" ? DOMException : void 0;
2583
2339
  function isDOMExceptionConstructor(ctor) {
2584
2340
  if (!(typeof ctor === "function" || typeof ctor === "object")) {
2585
2341
  return false;
2586
2342
  }
2587
- if (ctor.name !== "DOMException") {
2588
- return false;
2589
- }
2590
2343
  try {
2591
2344
  new ctor();
2592
2345
  return true;
2593
- } catch (_a2) {
2346
+ } catch (_a) {
2594
2347
  return false;
2595
2348
  }
2596
2349
  }
2597
- function getFromGlobal() {
2598
- const ctor = globals === null || globals === void 0 ? void 0 : globals.DOMException;
2599
- return isDOMExceptionConstructor(ctor) ? ctor : void 0;
2600
- }
2601
- function createPolyfill() {
2350
+ function createDOMExceptionPolyfill() {
2602
2351
  const ctor = function DOMException3(message, name) {
2603
2352
  this.message = message || "";
2604
2353
  this.name = name || "Error";
@@ -2606,12 +2355,11 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2606
2355
  Error.captureStackTrace(this, this.constructor);
2607
2356
  }
2608
2357
  };
2609
- setFunctionName(ctor, "DOMException");
2610
2358
  ctor.prototype = Object.create(Error.prototype);
2611
2359
  Object.defineProperty(ctor.prototype, "constructor", { value: ctor, writable: true, configurable: true });
2612
2360
  return ctor;
2613
2361
  }
2614
- const DOMException2 = getFromGlobal() || createPolyfill();
2362
+ const DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
2615
2363
  function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
2616
2364
  const reader = AcquireReadableStreamDefaultReader(source);
2617
2365
  const writer = AcquireWritableStreamDefaultWriter(dest);
@@ -2622,7 +2370,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2622
2370
  let abortAlgorithm;
2623
2371
  if (signal !== void 0) {
2624
2372
  abortAlgorithm = () => {
2625
- const error = signal.reason !== void 0 ? signal.reason : new DOMException2("Aborted", "AbortError");
2373
+ const error = new DOMException$1("Aborted", "AbortError");
2626
2374
  const actions = [];
2627
2375
  if (!preventAbort) {
2628
2376
  actions.push(() => {
@@ -2683,7 +2431,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2683
2431
  } else {
2684
2432
  shutdown(true, storedError);
2685
2433
  }
2686
- return null;
2687
2434
  });
2688
2435
  isOrBecomesErrored(dest, writer._closedPromise, (storedError) => {
2689
2436
  if (!preventCancel) {
@@ -2691,7 +2438,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2691
2438
  } else {
2692
2439
  shutdown(true, storedError);
2693
2440
  }
2694
- return null;
2695
2441
  });
2696
2442
  isOrBecomesClosed(source, reader._closedPromise, () => {
2697
2443
  if (!preventClose) {
@@ -2699,7 +2445,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2699
2445
  } else {
2700
2446
  shutdown();
2701
2447
  }
2702
- return null;
2703
2448
  });
2704
2449
  if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === "closed") {
2705
2450
  const destClosed = new TypeError("the destination writable stream closed before all data could be piped to it");
@@ -2740,7 +2485,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2740
2485
  }
2741
2486
  function doTheRest() {
2742
2487
  uponPromise(action(), () => finalize(originalIsError, originalError), (newError) => finalize(true, newError));
2743
- return null;
2744
2488
  }
2745
2489
  }
2746
2490
  function shutdown(isError, error) {
@@ -2765,7 +2509,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2765
2509
  } else {
2766
2510
  resolve(void 0);
2767
2511
  }
2768
- return null;
2769
2512
  }
2770
2513
  });
2771
2514
  }
@@ -2838,9 +2581,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2838
2581
  ReadableStreamDefaultControllerCallPullIfNeeded(this);
2839
2582
  }
2840
2583
  }
2841
- /** @internal */
2842
- [ReleaseSteps]() {
2843
- }
2844
2584
  }
2845
2585
  Object.defineProperties(ReadableStreamDefaultController.prototype, {
2846
2586
  close: { enumerable: true },
@@ -2848,11 +2588,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2848
2588
  error: { enumerable: true },
2849
2589
  desiredSize: { enumerable: true }
2850
2590
  });
2851
- setFunctionName(ReadableStreamDefaultController.prototype.close, "close");
2852
- setFunctionName(ReadableStreamDefaultController.prototype.enqueue, "enqueue");
2853
- setFunctionName(ReadableStreamDefaultController.prototype.error, "error");
2854
- if (typeof Symbol.toStringTag === "symbol") {
2855
- Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {
2591
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
2592
+ Object.defineProperty(ReadableStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
2856
2593
  value: "ReadableStreamDefaultController",
2857
2594
  configurable: true
2858
2595
  });
@@ -2883,10 +2620,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2883
2620
  controller._pullAgain = false;
2884
2621
  ReadableStreamDefaultControllerCallPullIfNeeded(controller);
2885
2622
  }
2886
- return null;
2887
2623
  }, (e2) => {
2888
2624
  ReadableStreamDefaultControllerError(controller, e2);
2889
- return null;
2890
2625
  });
2891
2626
  }
2892
2627
  function ReadableStreamDefaultControllerShouldCallPull(controller) {
@@ -2996,31 +2731,23 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
2996
2731
  uponPromise(promiseResolvedWith(startResult), () => {
2997
2732
  controller._started = true;
2998
2733
  ReadableStreamDefaultControllerCallPullIfNeeded(controller);
2999
- return null;
3000
2734
  }, (r2) => {
3001
2735
  ReadableStreamDefaultControllerError(controller, r2);
3002
- return null;
3003
2736
  });
3004
2737
  }
3005
2738
  function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
3006
2739
  const controller = Object.create(ReadableStreamDefaultController.prototype);
3007
- let startAlgorithm;
3008
- let pullAlgorithm;
3009
- let cancelAlgorithm;
2740
+ let startAlgorithm = () => void 0;
2741
+ let pullAlgorithm = () => promiseResolvedWith(void 0);
2742
+ let cancelAlgorithm = () => promiseResolvedWith(void 0);
3010
2743
  if (underlyingSource.start !== void 0) {
3011
2744
  startAlgorithm = () => underlyingSource.start(controller);
3012
- } else {
3013
- startAlgorithm = () => void 0;
3014
2745
  }
3015
2746
  if (underlyingSource.pull !== void 0) {
3016
2747
  pullAlgorithm = () => underlyingSource.pull(controller);
3017
- } else {
3018
- pullAlgorithm = () => promiseResolvedWith(void 0);
3019
2748
  }
3020
2749
  if (underlyingSource.cancel !== void 0) {
3021
2750
  cancelAlgorithm = (reason) => underlyingSource.cancel(reason);
3022
- } else {
3023
- cancelAlgorithm = () => promiseResolvedWith(void 0);
3024
2751
  }
3025
2752
  SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
3026
2753
  }
@@ -3055,7 +2782,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3055
2782
  reading = true;
3056
2783
  const readRequest = {
3057
2784
  _chunkSteps: (chunk) => {
3058
- _queueMicrotask(() => {
2785
+ queueMicrotask(() => {
3059
2786
  readAgain = false;
3060
2787
  const chunk1 = chunk;
3061
2788
  const chunk2 = chunk;
@@ -3120,7 +2847,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3120
2847
  if (!canceled1 || !canceled2) {
3121
2848
  resolveCancelPromise(void 0);
3122
2849
  }
3123
- return null;
3124
2850
  });
3125
2851
  return [branch1, branch2];
3126
2852
  }
@@ -3142,14 +2868,13 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3142
2868
  function forwardReaderError(thisReader) {
3143
2869
  uponRejection(thisReader._closedPromise, (r2) => {
3144
2870
  if (thisReader !== reader) {
3145
- return null;
2871
+ return;
3146
2872
  }
3147
2873
  ReadableByteStreamControllerError(branch1._readableStreamController, r2);
3148
2874
  ReadableByteStreamControllerError(branch2._readableStreamController, r2);
3149
2875
  if (!canceled1 || !canceled2) {
3150
2876
  resolveCancelPromise(void 0);
3151
2877
  }
3152
- return null;
3153
2878
  });
3154
2879
  }
3155
2880
  function pullWithDefaultReader() {
@@ -3160,7 +2885,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3160
2885
  }
3161
2886
  const readRequest = {
3162
2887
  _chunkSteps: (chunk) => {
3163
- _queueMicrotask(() => {
2888
+ queueMicrotask(() => {
3164
2889
  readAgainForBranch1 = false;
3165
2890
  readAgainForBranch2 = false;
3166
2891
  const chunk1 = chunk;
@@ -3223,7 +2948,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3223
2948
  const otherBranch = forBranch2 ? branch1 : branch2;
3224
2949
  const readIntoRequest = {
3225
2950
  _chunkSteps: (chunk) => {
3226
- _queueMicrotask(() => {
2951
+ queueMicrotask(() => {
3227
2952
  readAgainForBranch1 = false;
3228
2953
  readAgainForBranch2 = false;
3229
2954
  const byobCanceled = forBranch2 ? canceled2 : canceled1;
@@ -3279,7 +3004,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3279
3004
  reading = false;
3280
3005
  }
3281
3006
  };
3282
- ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);
3007
+ ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
3283
3008
  }
3284
3009
  function pull1Algorithm() {
3285
3010
  if (reading) {
@@ -3337,100 +3062,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3337
3062
  forwardReaderError(reader);
3338
3063
  return [branch1, branch2];
3339
3064
  }
3340
- function isReadableStreamLike(stream) {
3341
- return typeIsObject(stream) && typeof stream.getReader !== "undefined";
3342
- }
3343
- function ReadableStreamFrom(source) {
3344
- if (isReadableStreamLike(source)) {
3345
- return ReadableStreamFromDefaultReader(source.getReader());
3346
- }
3347
- return ReadableStreamFromIterable(source);
3348
- }
3349
- function ReadableStreamFromIterable(asyncIterable) {
3350
- let stream;
3351
- const iteratorRecord = GetIterator(asyncIterable, "async");
3352
- const startAlgorithm = noop;
3353
- function pullAlgorithm() {
3354
- let nextResult;
3355
- try {
3356
- nextResult = IteratorNext(iteratorRecord);
3357
- } catch (e2) {
3358
- return promiseRejectedWith(e2);
3359
- }
3360
- const nextPromise = promiseResolvedWith(nextResult);
3361
- return transformPromiseWith(nextPromise, (iterResult) => {
3362
- if (!typeIsObject(iterResult)) {
3363
- throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");
3364
- }
3365
- const done = IteratorComplete(iterResult);
3366
- if (done) {
3367
- ReadableStreamDefaultControllerClose(stream._readableStreamController);
3368
- } else {
3369
- const value = IteratorValue(iterResult);
3370
- ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
3371
- }
3372
- });
3373
- }
3374
- function cancelAlgorithm(reason) {
3375
- const iterator = iteratorRecord.iterator;
3376
- let returnMethod;
3377
- try {
3378
- returnMethod = GetMethod(iterator, "return");
3379
- } catch (e2) {
3380
- return promiseRejectedWith(e2);
3381
- }
3382
- if (returnMethod === void 0) {
3383
- return promiseResolvedWith(void 0);
3384
- }
3385
- let returnResult;
3386
- try {
3387
- returnResult = reflectCall(returnMethod, iterator, [reason]);
3388
- } catch (e2) {
3389
- return promiseRejectedWith(e2);
3390
- }
3391
- const returnPromise = promiseResolvedWith(returnResult);
3392
- return transformPromiseWith(returnPromise, (iterResult) => {
3393
- if (!typeIsObject(iterResult)) {
3394
- throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object");
3395
- }
3396
- return void 0;
3397
- });
3398
- }
3399
- stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
3400
- return stream;
3401
- }
3402
- function ReadableStreamFromDefaultReader(reader) {
3403
- let stream;
3404
- const startAlgorithm = noop;
3405
- function pullAlgorithm() {
3406
- let readPromise;
3407
- try {
3408
- readPromise = reader.read();
3409
- } catch (e2) {
3410
- return promiseRejectedWith(e2);
3411
- }
3412
- return transformPromiseWith(readPromise, (readResult) => {
3413
- if (!typeIsObject(readResult)) {
3414
- throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");
3415
- }
3416
- if (readResult.done) {
3417
- ReadableStreamDefaultControllerClose(stream._readableStreamController);
3418
- } else {
3419
- const value = readResult.value;
3420
- ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);
3421
- }
3422
- });
3423
- }
3424
- function cancelAlgorithm(reason) {
3425
- try {
3426
- return promiseResolvedWith(reader.cancel(reason));
3427
- } catch (e2) {
3428
- return promiseRejectedWith(e2);
3429
- }
3430
- }
3431
- stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);
3432
- return stream;
3433
- }
3434
3065
  function convertUnderlyingDefaultOrByteSource(source, context) {
3435
3066
  assertDictionary(source, context);
3436
3067
  const original = source;
@@ -3466,6 +3097,20 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3466
3097
  }
3467
3098
  return type;
3468
3099
  }
3100
+ function convertReaderOptions(options, context) {
3101
+ assertDictionary(options, context);
3102
+ const mode = options === null || options === void 0 ? void 0 : options.mode;
3103
+ return {
3104
+ mode: mode === void 0 ? void 0 : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)
3105
+ };
3106
+ }
3107
+ function convertReadableStreamReaderMode(mode, context) {
3108
+ mode = `${mode}`;
3109
+ if (mode !== "byob") {
3110
+ throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);
3111
+ }
3112
+ return mode;
3113
+ }
3469
3114
  function convertIteratorOptions(options, context) {
3470
3115
  assertDictionary(options, context);
3471
3116
  const preventCancel = options === null || options === void 0 ? void 0 : options.preventCancel;
@@ -3624,22 +3269,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3624
3269
  const options = convertIteratorOptions(rawOptions, "First parameter");
3625
3270
  return AcquireReadableStreamAsyncIterator(this, options.preventCancel);
3626
3271
  }
3627
- [SymbolAsyncIterator](options) {
3628
- return this.values(options);
3629
- }
3630
- /**
3631
- * Creates a new ReadableStream wrapping the provided iterable or async iterable.
3632
- *
3633
- * This can be used to adapt various kinds of objects into a readable stream,
3634
- * such as an array, an async generator, or a Node.js readable stream.
3635
- */
3636
- static from(asyncIterable) {
3637
- return ReadableStreamFrom(asyncIterable);
3638
- }
3639
3272
  }
3640
- Object.defineProperties(ReadableStream2, {
3641
- from: { enumerable: true }
3642
- });
3643
3273
  Object.defineProperties(ReadableStream2.prototype, {
3644
3274
  cancel: { enumerable: true },
3645
3275
  getReader: { enumerable: true },
@@ -3649,24 +3279,19 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3649
3279
  values: { enumerable: true },
3650
3280
  locked: { enumerable: true }
3651
3281
  });
3652
- setFunctionName(ReadableStream2.from, "from");
3653
- setFunctionName(ReadableStream2.prototype.cancel, "cancel");
3654
- setFunctionName(ReadableStream2.prototype.getReader, "getReader");
3655
- setFunctionName(ReadableStream2.prototype.pipeThrough, "pipeThrough");
3656
- setFunctionName(ReadableStream2.prototype.pipeTo, "pipeTo");
3657
- setFunctionName(ReadableStream2.prototype.tee, "tee");
3658
- setFunctionName(ReadableStream2.prototype.values, "values");
3659
- if (typeof Symbol.toStringTag === "symbol") {
3660
- Object.defineProperty(ReadableStream2.prototype, Symbol.toStringTag, {
3282
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
3283
+ Object.defineProperty(ReadableStream2.prototype, SymbolPolyfill.toStringTag, {
3661
3284
  value: "ReadableStream",
3662
3285
  configurable: true
3663
3286
  });
3664
3287
  }
3665
- Object.defineProperty(ReadableStream2.prototype, SymbolAsyncIterator, {
3666
- value: ReadableStream2.prototype.values,
3667
- writable: true,
3668
- configurable: true
3669
- });
3288
+ if (typeof SymbolPolyfill.asyncIterator === "symbol") {
3289
+ Object.defineProperty(ReadableStream2.prototype, SymbolPolyfill.asyncIterator, {
3290
+ value: ReadableStream2.prototype.values,
3291
+ writable: true,
3292
+ configurable: true
3293
+ });
3294
+ }
3670
3295
  function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark = 1, sizeAlgorithm = () => 1) {
3671
3296
  const stream = Object.create(ReadableStream2.prototype);
3672
3297
  InitializeReadableStream(stream);
@@ -3713,11 +3338,10 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3713
3338
  ReadableStreamClose(stream);
3714
3339
  const reader = stream._reader;
3715
3340
  if (reader !== void 0 && IsReadableStreamBYOBReader(reader)) {
3716
- const readIntoRequests = reader._readIntoRequests;
3717
- reader._readIntoRequests = new SimpleQueue();
3718
- readIntoRequests.forEach((readIntoRequest) => {
3341
+ reader._readIntoRequests.forEach((readIntoRequest) => {
3719
3342
  readIntoRequest._closeSteps(void 0);
3720
3343
  });
3344
+ reader._readIntoRequests = new SimpleQueue();
3721
3345
  }
3722
3346
  const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
3723
3347
  return transformPromiseWith(sourceCancelPromise, noop);
@@ -3730,11 +3354,10 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3730
3354
  }
3731
3355
  defaultReaderClosedPromiseResolve(reader);
3732
3356
  if (IsReadableStreamDefaultReader(reader)) {
3733
- const readRequests = reader._readRequests;
3734
- reader._readRequests = new SimpleQueue();
3735
- readRequests.forEach((readRequest) => {
3357
+ reader._readRequests.forEach((readRequest) => {
3736
3358
  readRequest._closeSteps();
3737
3359
  });
3360
+ reader._readRequests = new SimpleQueue();
3738
3361
  }
3739
3362
  }
3740
3363
  function ReadableStreamError(stream, e2) {
@@ -3746,9 +3369,15 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3746
3369
  }
3747
3370
  defaultReaderClosedPromiseReject(reader, e2);
3748
3371
  if (IsReadableStreamDefaultReader(reader)) {
3749
- ReadableStreamDefaultReaderErrorReadRequests(reader, e2);
3372
+ reader._readRequests.forEach((readRequest) => {
3373
+ readRequest._errorSteps(e2);
3374
+ });
3375
+ reader._readRequests = new SimpleQueue();
3750
3376
  } else {
3751
- ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2);
3377
+ reader._readIntoRequests.forEach((readIntoRequest) => {
3378
+ readIntoRequest._errorSteps(e2);
3379
+ });
3380
+ reader._readIntoRequests = new SimpleQueue();
3752
3381
  }
3753
3382
  }
3754
3383
  function streamBrandCheckException$1(name) {
@@ -3765,7 +3394,13 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3765
3394
  const byteLengthSizeFunction = (chunk) => {
3766
3395
  return chunk.byteLength;
3767
3396
  };
3768
- setFunctionName(byteLengthSizeFunction, "size");
3397
+ try {
3398
+ Object.defineProperty(byteLengthSizeFunction, "name", {
3399
+ value: "size",
3400
+ configurable: true
3401
+ });
3402
+ } catch (_a) {
3403
+ }
3769
3404
  class ByteLengthQueuingStrategy {
3770
3405
  constructor(options) {
3771
3406
  assertRequiredArgument(options, 1, "ByteLengthQueuingStrategy");
@@ -3795,8 +3430,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3795
3430
  highWaterMark: { enumerable: true },
3796
3431
  size: { enumerable: true }
3797
3432
  });
3798
- if (typeof Symbol.toStringTag === "symbol") {
3799
- Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {
3433
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
3434
+ Object.defineProperty(ByteLengthQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
3800
3435
  value: "ByteLengthQueuingStrategy",
3801
3436
  configurable: true
3802
3437
  });
@@ -3816,7 +3451,13 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3816
3451
  const countSizeFunction = () => {
3817
3452
  return 1;
3818
3453
  };
3819
- setFunctionName(countSizeFunction, "size");
3454
+ try {
3455
+ Object.defineProperty(countSizeFunction, "name", {
3456
+ value: "size",
3457
+ configurable: true
3458
+ });
3459
+ } catch (_a) {
3460
+ }
3820
3461
  class CountQueuingStrategy {
3821
3462
  constructor(options) {
3822
3463
  assertRequiredArgument(options, 1, "CountQueuingStrategy");
@@ -3847,8 +3488,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3847
3488
  highWaterMark: { enumerable: true },
3848
3489
  size: { enumerable: true }
3849
3490
  });
3850
- if (typeof Symbol.toStringTag === "symbol") {
3851
- Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {
3491
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
3492
+ Object.defineProperty(CountQueuingStrategy.prototype, SymbolPolyfill.toStringTag, {
3852
3493
  value: "CountQueuingStrategy",
3853
3494
  configurable: true
3854
3495
  });
@@ -3867,14 +3508,12 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3867
3508
  }
3868
3509
  function convertTransformer(original, context) {
3869
3510
  assertDictionary(original, context);
3870
- const cancel = original === null || original === void 0 ? void 0 : original.cancel;
3871
3511
  const flush = original === null || original === void 0 ? void 0 : original.flush;
3872
3512
  const readableType = original === null || original === void 0 ? void 0 : original.readableType;
3873
3513
  const start = original === null || original === void 0 ? void 0 : original.start;
3874
3514
  const transform = original === null || original === void 0 ? void 0 : original.transform;
3875
3515
  const writableType = original === null || original === void 0 ? void 0 : original.writableType;
3876
3516
  return {
3877
- cancel: cancel === void 0 ? void 0 : convertTransformerCancelCallback(cancel, original, `${context} has member 'cancel' that`),
3878
3517
  flush: flush === void 0 ? void 0 : convertTransformerFlushCallback(flush, original, `${context} has member 'flush' that`),
3879
3518
  readableType,
3880
3519
  start: start === void 0 ? void 0 : convertTransformerStartCallback(start, original, `${context} has member 'start' that`),
@@ -3894,10 +3533,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3894
3533
  assertFunction(fn, context);
3895
3534
  return (chunk, controller) => promiseCall(fn, original, [chunk, controller]);
3896
3535
  }
3897
- function convertTransformerCancelCallback(fn, original, context) {
3898
- assertFunction(fn, context);
3899
- return (reason) => promiseCall(fn, original, [reason]);
3900
- }
3901
3536
  class TransformStream {
3902
3537
  constructor(rawTransformer = {}, rawWritableStrategy = {}, rawReadableStrategy = {}) {
3903
3538
  if (rawTransformer === void 0) {
@@ -3951,8 +3586,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3951
3586
  readable: { enumerable: true },
3952
3587
  writable: { enumerable: true }
3953
3588
  });
3954
- if (typeof Symbol.toStringTag === "symbol") {
3955
- Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {
3589
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
3590
+ Object.defineProperty(TransformStream.prototype, SymbolPolyfill.toStringTag, {
3956
3591
  value: "TransformStream",
3957
3592
  configurable: true
3958
3593
  });
@@ -3975,7 +3610,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
3975
3610
  return TransformStreamDefaultSourcePullAlgorithm(stream);
3976
3611
  }
3977
3612
  function cancelAlgorithm(reason) {
3978
- return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);
3613
+ TransformStreamErrorWritableAndUnblockWrite(stream, reason);
3614
+ return promiseResolvedWith(void 0);
3979
3615
  }
3980
3616
  stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
3981
3617
  stream._backpressure = void 0;
@@ -4000,9 +3636,6 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
4000
3636
  function TransformStreamErrorWritableAndUnblockWrite(stream, e2) {
4001
3637
  TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
4002
3638
  WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e2);
4003
- TransformStreamUnblockWrite(stream);
4004
- }
4005
- function TransformStreamUnblockWrite(stream) {
4006
3639
  if (stream._backpressure) {
4007
3640
  TransformStreamSetBackpressure(stream, false);
4008
3641
  }
@@ -4063,11 +3696,8 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
4063
3696
  terminate: { enumerable: true },
4064
3697
  desiredSize: { enumerable: true }
4065
3698
  });
4066
- setFunctionName(TransformStreamDefaultController.prototype.enqueue, "enqueue");
4067
- setFunctionName(TransformStreamDefaultController.prototype.error, "error");
4068
- setFunctionName(TransformStreamDefaultController.prototype.terminate, "terminate");
4069
- if (typeof Symbol.toStringTag === "symbol") {
4070
- Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {
3699
+ if (typeof SymbolPolyfill.toStringTag === "symbol") {
3700
+ Object.defineProperty(TransformStreamDefaultController.prototype, SymbolPolyfill.toStringTag, {
4071
3701
  value: "TransformStreamDefaultController",
4072
3702
  configurable: true
4073
3703
  });
@@ -4081,49 +3711,34 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
4081
3711
  }
4082
3712
  return x2 instanceof TransformStreamDefaultController;
4083
3713
  }
4084
- function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm) {
3714
+ function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
4085
3715
  controller._controlledTransformStream = stream;
4086
3716
  stream._transformStreamController = controller;
4087
3717
  controller._transformAlgorithm = transformAlgorithm;
4088
3718
  controller._flushAlgorithm = flushAlgorithm;
4089
- controller._cancelAlgorithm = cancelAlgorithm;
4090
- controller._finishPromise = void 0;
4091
- controller._finishPromise_resolve = void 0;
4092
- controller._finishPromise_reject = void 0;
4093
3719
  }
4094
3720
  function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
4095
3721
  const controller = Object.create(TransformStreamDefaultController.prototype);
4096
- let transformAlgorithm;
4097
- let flushAlgorithm;
4098
- let cancelAlgorithm;
3722
+ let transformAlgorithm = (chunk) => {
3723
+ try {
3724
+ TransformStreamDefaultControllerEnqueue(controller, chunk);
3725
+ return promiseResolvedWith(void 0);
3726
+ } catch (transformResultE) {
3727
+ return promiseRejectedWith(transformResultE);
3728
+ }
3729
+ };
3730
+ let flushAlgorithm = () => promiseResolvedWith(void 0);
4099
3731
  if (transformer.transform !== void 0) {
4100
3732
  transformAlgorithm = (chunk) => transformer.transform(chunk, controller);
4101
- } else {
4102
- transformAlgorithm = (chunk) => {
4103
- try {
4104
- TransformStreamDefaultControllerEnqueue(controller, chunk);
4105
- return promiseResolvedWith(void 0);
4106
- } catch (transformResultE) {
4107
- return promiseRejectedWith(transformResultE);
4108
- }
4109
- };
4110
3733
  }
4111
3734
  if (transformer.flush !== void 0) {
4112
3735
  flushAlgorithm = () => transformer.flush(controller);
4113
- } else {
4114
- flushAlgorithm = () => promiseResolvedWith(void 0);
4115
- }
4116
- if (transformer.cancel !== void 0) {
4117
- cancelAlgorithm = (reason) => transformer.cancel(reason);
4118
- } else {
4119
- cancelAlgorithm = () => promiseResolvedWith(void 0);
4120
3736
  }
4121
- SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);
3737
+ SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);
4122
3738
  }
4123
3739
  function TransformStreamDefaultControllerClearAlgorithms(controller) {
4124
3740
  controller._transformAlgorithm = void 0;
4125
3741
  controller._flushAlgorithm = void 0;
4126
- controller._cancelAlgorithm = void 0;
4127
3742
  }
4128
3743
  function TransformStreamDefaultControllerEnqueue(controller, chunk) {
4129
3744
  const stream = controller._controlledTransformStream;
@@ -4175,112 +3790,31 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
4175
3790
  return TransformStreamDefaultControllerPerformTransform(controller, chunk);
4176
3791
  }
4177
3792
  function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
4178
- const controller = stream._transformStreamController;
4179
- if (controller._finishPromise !== void 0) {
4180
- return controller._finishPromise;
4181
- }
4182
- const readable = stream._readable;
4183
- controller._finishPromise = newPromise((resolve, reject) => {
4184
- controller._finishPromise_resolve = resolve;
4185
- controller._finishPromise_reject = reject;
4186
- });
4187
- const cancelPromise = controller._cancelAlgorithm(reason);
4188
- TransformStreamDefaultControllerClearAlgorithms(controller);
4189
- uponPromise(cancelPromise, () => {
4190
- if (readable._state === "errored") {
4191
- defaultControllerFinishPromiseReject(controller, readable._storedError);
4192
- } else {
4193
- ReadableStreamDefaultControllerError(readable._readableStreamController, reason);
4194
- defaultControllerFinishPromiseResolve(controller);
4195
- }
4196
- return null;
4197
- }, (r2) => {
4198
- ReadableStreamDefaultControllerError(readable._readableStreamController, r2);
4199
- defaultControllerFinishPromiseReject(controller, r2);
4200
- return null;
4201
- });
4202
- return controller._finishPromise;
3793
+ TransformStreamError(stream, reason);
3794
+ return promiseResolvedWith(void 0);
4203
3795
  }
4204
3796
  function TransformStreamDefaultSinkCloseAlgorithm(stream) {
4205
- const controller = stream._transformStreamController;
4206
- if (controller._finishPromise !== void 0) {
4207
- return controller._finishPromise;
4208
- }
4209
3797
  const readable = stream._readable;
4210
- controller._finishPromise = newPromise((resolve, reject) => {
4211
- controller._finishPromise_resolve = resolve;
4212
- controller._finishPromise_reject = reject;
4213
- });
3798
+ const controller = stream._transformStreamController;
4214
3799
  const flushPromise = controller._flushAlgorithm();
4215
3800
  TransformStreamDefaultControllerClearAlgorithms(controller);
4216
- uponPromise(flushPromise, () => {
3801
+ return transformPromiseWith(flushPromise, () => {
4217
3802
  if (readable._state === "errored") {
4218
- defaultControllerFinishPromiseReject(controller, readable._storedError);
4219
- } else {
4220
- ReadableStreamDefaultControllerClose(readable._readableStreamController);
4221
- defaultControllerFinishPromiseResolve(controller);
3803
+ throw readable._storedError;
4222
3804
  }
4223
- return null;
3805
+ ReadableStreamDefaultControllerClose(readable._readableStreamController);
4224
3806
  }, (r2) => {
4225
- ReadableStreamDefaultControllerError(readable._readableStreamController, r2);
4226
- defaultControllerFinishPromiseReject(controller, r2);
4227
- return null;
3807
+ TransformStreamError(stream, r2);
3808
+ throw readable._storedError;
4228
3809
  });
4229
- return controller._finishPromise;
4230
3810
  }
4231
3811
  function TransformStreamDefaultSourcePullAlgorithm(stream) {
4232
3812
  TransformStreamSetBackpressure(stream, false);
4233
3813
  return stream._backpressureChangePromise;
4234
3814
  }
4235
- function TransformStreamDefaultSourceCancelAlgorithm(stream, reason) {
4236
- const controller = stream._transformStreamController;
4237
- if (controller._finishPromise !== void 0) {
4238
- return controller._finishPromise;
4239
- }
4240
- const writable = stream._writable;
4241
- controller._finishPromise = newPromise((resolve, reject) => {
4242
- controller._finishPromise_resolve = resolve;
4243
- controller._finishPromise_reject = reject;
4244
- });
4245
- const cancelPromise = controller._cancelAlgorithm(reason);
4246
- TransformStreamDefaultControllerClearAlgorithms(controller);
4247
- uponPromise(cancelPromise, () => {
4248
- if (writable._state === "errored") {
4249
- defaultControllerFinishPromiseReject(controller, writable._storedError);
4250
- } else {
4251
- WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);
4252
- TransformStreamUnblockWrite(stream);
4253
- defaultControllerFinishPromiseResolve(controller);
4254
- }
4255
- return null;
4256
- }, (r2) => {
4257
- WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r2);
4258
- TransformStreamUnblockWrite(stream);
4259
- defaultControllerFinishPromiseReject(controller, r2);
4260
- return null;
4261
- });
4262
- return controller._finishPromise;
4263
- }
4264
3815
  function defaultControllerBrandCheckException(name) {
4265
3816
  return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);
4266
3817
  }
4267
- function defaultControllerFinishPromiseResolve(controller) {
4268
- if (controller._finishPromise_resolve === void 0) {
4269
- return;
4270
- }
4271
- controller._finishPromise_resolve();
4272
- controller._finishPromise_resolve = void 0;
4273
- controller._finishPromise_reject = void 0;
4274
- }
4275
- function defaultControllerFinishPromiseReject(controller, reason) {
4276
- if (controller._finishPromise_reject === void 0) {
4277
- return;
4278
- }
4279
- setPromiseIsHandledToTrue(controller._finishPromise);
4280
- controller._finishPromise_reject(reason);
4281
- controller._finishPromise_resolve = void 0;
4282
- controller._finishPromise_reject = void 0;
4283
- }
4284
3818
  function streamBrandCheckException(name) {
4285
3819
  return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`);
4286
3820
  }
@@ -4297,6 +3831,7 @@ var require_ponyfill_es2018 = (0, import_chunk_4VNS5WPM.__commonJS)({
4297
3831
  exports2.WritableStream = WritableStream;
4298
3832
  exports2.WritableStreamDefaultController = WritableStreamDefaultController;
4299
3833
  exports2.WritableStreamDefaultWriter = WritableStreamDefaultWriter;
3834
+ Object.defineProperty(exports2, "__esModule", { value: true });
4300
3835
  });
4301
3836
  }
4302
3837
  });
@@ -4684,15 +4219,6 @@ var import_node_domexception = (0, import_chunk_4VNS5WPM.__toESM)(require_node_d
4684
4219
  var { stat } = import_node_fs.promises;
4685
4220
  /*! Bundled license information:
4686
4221
 
4687
- web-streams-polyfill/dist/ponyfill.es2018.js:
4688
- (**
4689
- * @license
4690
- * web-streams-polyfill v3.3.3
4691
- * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
4692
- * This code is released under the MIT license.
4693
- * SPDX-License-Identifier: MIT
4694
- *)
4695
-
4696
4222
  node-domexception/index.js:
4697
4223
  (*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
4698
4224