mphttpx 1.0.11 → 1.1.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.
package/dist/index.esm.js CHANGED
@@ -163,24 +163,24 @@ function encodeText(input, destination) {
163
163
  }
164
164
  const TextEncoderE = g["TextEncoder"] || TextEncoderP;
165
165
 
166
- var _a$a, _b$3;
166
+ var _a$b, _b$4;
167
167
  /** @internal */
168
- const state$h = Symbol( /* "TextDecoderState" */);
168
+ const state$k = Symbol( /* "TextDecoderState" */);
169
169
  class TextDecoderP {
170
170
  constructor(label = "utf-8", { fatal = false, ignoreBOM = false } = {}) {
171
171
  let _label = "" + label;
172
172
  if (["utf-8", "utf8", "unicode-1-1-utf-8"].indexOf(_label.toLowerCase()) === -1) {
173
173
  throw new RangeError(`Failed to construct 'TextDecoder': encoding ('${_label}') not implemented.`);
174
174
  }
175
- this[state$h] = new TextDecoderState();
176
- this[state$h].fatal = !!fatal;
177
- this[state$h].ignoreBOM = !!ignoreBOM;
175
+ this[state$k] = new TextDecoderState();
176
+ this[state$k].fatal = !!fatal;
177
+ this[state$k].ignoreBOM = !!ignoreBOM;
178
178
  }
179
179
  get encoding() { return "utf-8"; }
180
- get fatal() { return this[state$h].fatal; }
181
- get ignoreBOM() { return this[state$h].ignoreBOM; }
180
+ get fatal() { return this[state$k].fatal; }
181
+ get ignoreBOM() { return this[state$k].ignoreBOM; }
182
182
  decode(input, { stream = false } = {}) {
183
- const s = this[state$h];
183
+ const s = this[state$k];
184
184
  let bytes;
185
185
  if (input !== undefined) {
186
186
  if (input instanceof ArrayBuffer) {
@@ -319,11 +319,11 @@ class TextDecoderState {
319
319
  constructor() {
320
320
  this.fatal = false;
321
321
  this.ignoreBOM = false;
322
- this[_a$a] = 0;
323
- this[_b$3] = [];
322
+ this[_a$b] = 0;
323
+ this[_b$4] = [];
324
324
  }
325
325
  }
326
- _a$a = _bomDone, _b$3 = _partial;
326
+ _a$b = _bomDone, _b$4 = _partial;
327
327
  function getBytesPerSequence(byte) {
328
328
  return (byte > 0xEF) ? 4 : (byte > 0xDF) ? 3 : (byte > 0xBF) ? 2 : 1;
329
329
  }
@@ -344,7 +344,7 @@ const concatString = (res) => {
344
344
  const TextDecoderE = g["TextDecoder"] || TextDecoderP;
345
345
 
346
346
  /** @internal */
347
- const state$g = Symbol( /* "BlobState" */);
347
+ const state$j = Symbol( /* "BlobState" */);
348
348
  class BlobP {
349
349
  constructor(blobParts = [], options) {
350
350
  if (!(Array.isArray(blobParts) || (blobParts && typeof blobParts === "object" && Symbol.iterator in blobParts))) {
@@ -355,7 +355,7 @@ class BlobP {
355
355
  for (let i = 0; i < _blobParts.length; ++i) {
356
356
  let chunk = _blobParts[i];
357
357
  if (isPolyfillType("Blob", chunk)) {
358
- chunks.push(chunk[state$g][_buffer]);
358
+ chunks.push(chunk[state$j][_buffer]);
359
359
  }
360
360
  else if (chunk instanceof ArrayBuffer || ArrayBuffer.isView(chunk)) {
361
361
  chunks.push(BufferSource_toUint8Array(chunk));
@@ -364,29 +364,29 @@ class BlobP {
364
364
  chunks.push(encode$1("" + chunk));
365
365
  }
366
366
  }
367
- this[state$g] = new BlobState(concat(chunks));
368
- const s = this[state$g];
367
+ this[state$j] = new BlobState(concat(chunks));
368
+ const s = this[state$j];
369
369
  s.size = s[_buffer].length;
370
370
  let rawType = "" + ((options === null || options === void 0 ? void 0 : options.type) || "");
371
371
  s.type = /[^\u0020-\u007E]/.test(rawType) ? "" : rawType.toLowerCase();
372
372
  }
373
- get size() { return this[state$g].size; }
374
- get type() { return this[state$g].type; }
373
+ get size() { return this[state$j].size; }
374
+ get type() { return this[state$j].type; }
375
375
  arrayBuffer() {
376
- return Promise.resolve(clone(this[state$g][_buffer].buffer).buffer);
376
+ return Promise.resolve(clone(this[state$j][_buffer].buffer).buffer);
377
377
  }
378
378
  bytes() {
379
- return Promise.resolve(clone(this[state$g][_buffer].buffer));
379
+ return Promise.resolve(clone(this[state$j][_buffer].buffer));
380
380
  }
381
381
  slice(start, end, contentType) {
382
- let sliced = this[state$g][_buffer].slice(start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : this[state$g][_buffer].length); // × WeChat 2.5.0
382
+ let sliced = this[state$j][_buffer].slice(start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : this[state$j][_buffer].length); // × WeChat 2.5.0
383
383
  return new BlobP([sliced], { type: "" + (contentType !== null && contentType !== void 0 ? contentType : "") });
384
384
  }
385
385
  stream() {
386
386
  throw new TypeError("Failed to execute 'stream' on 'Blob': method not implemented.");
387
387
  }
388
388
  text() {
389
- return Promise.resolve(decode$1(this[state$g][_buffer]));
389
+ return Promise.resolve(decode$1(this[state$j][_buffer]));
390
390
  }
391
391
  /** @internal */ toString() { return "[object Blob]"; }
392
392
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["Blob"] }; }
@@ -404,7 +404,7 @@ class BlobState {
404
404
  }
405
405
  /** @internal */
406
406
  function Blob_toUint8Array(blob) {
407
- return blob[state$g][_buffer];
407
+ return blob[state$j][_buffer];
408
408
  }
409
409
  function BufferSource_toUint8Array(buf) {
410
410
  return buf instanceof ArrayBuffer
@@ -463,18 +463,18 @@ function Uint8Array_toBase64(input) {
463
463
  const BlobE = g["Blob"] || BlobP;
464
464
 
465
465
  /** @internal */
466
- const state$f = Symbol( /* "FileState" */);
466
+ const state$i = Symbol( /* "FileState" */);
467
467
  class FileP extends BlobP {
468
468
  constructor(...args) {
469
469
  const [fileBits, fileName, options] = args;
470
470
  checkArgsLength(args, 2, "File");
471
471
  super(fileBits, options);
472
- this[state$f] = new FileState();
473
- this[state$f].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date()) || 0;
474
- this[state$f].name = "" + fileName;
472
+ this[state$i] = new FileState();
473
+ this[state$i].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date()) || 0;
474
+ this[state$i].name = "" + fileName;
475
475
  }
476
- get lastModified() { return this[state$f].lastModified; }
477
- get name() { return this[state$f].name; }
476
+ get lastModified() { return this[state$i].lastModified; }
477
+ get name() { return this[state$i].name; }
478
478
  get webkitRelativePath() { return ""; }
479
479
  /** @internal */ toString() { return "[object File]"; }
480
480
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["File", "Blob"] }; }
@@ -489,39 +489,39 @@ class FileState {
489
489
  }
490
490
  const FileE = g["Blob"] ? g["File"] : FileP;
491
491
 
492
- var _a$9, _b$2, _c$1, _d$1, _e$1;
493
- /** @internal */ const state$e = Symbol( /* "EventState" */);
492
+ var _a$a, _b$3, _c$1, _d$1, _e$1;
493
+ /** @internal */ const state$h = Symbol( /* "EventState" */);
494
494
  class EventP {
495
495
  constructor(...args) {
496
496
  const [type, eventInitDict] = args;
497
497
  checkArgsLength(args, 1, new.target.name);
498
- this[state$e] = new EventState();
499
- const s = this[state$e];
498
+ this[state$h] = new EventState();
499
+ const s = this[state$h];
500
500
  s.type = "" + type;
501
501
  s.bubbles = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.bubbles);
502
502
  s.cancelable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.cancelable);
503
503
  s.composed = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.composed);
504
504
  Object.defineProperty(this, "isTrusted", {
505
505
  enumerable: true,
506
- get: (function isTrusted() { return this[state$e][_isTrusted]; }).bind(this),
506
+ get: (function isTrusted() { return this[state$h][_isTrusted]; }).bind(this),
507
507
  });
508
508
  }
509
- get type() { return this[state$e].type; }
510
- get bubbles() { return this[state$e].bubbles; }
511
- get cancelable() { return this[state$e].cancelable; }
512
- get composed() { return this[state$e].composed; }
513
- get target() { return this[state$e].target; }
514
- get currentTarget() { return this[state$e].currentTarget; }
515
- get eventPhase() { return this[state$e].eventPhase; }
516
- get srcElement() { return this[state$e].target; }
517
- get cancelBubble() { return this[state$e].cancelBubble; }
518
- set cancelBubble(value) { this[state$e].cancelBubble = !!value; }
519
- get defaultPrevented() { return this[state$e].defaultPrevented; }
520
- get returnValue() { return this[state$e].returnValue; }
509
+ get type() { return this[state$h].type; }
510
+ get bubbles() { return this[state$h].bubbles; }
511
+ get cancelable() { return this[state$h].cancelable; }
512
+ get composed() { return this[state$h].composed; }
513
+ get target() { return this[state$h].target; }
514
+ get currentTarget() { return this[state$h].currentTarget; }
515
+ get eventPhase() { return this[state$h].eventPhase; }
516
+ get srcElement() { return this[state$h].target; }
517
+ get cancelBubble() { return this[state$h].cancelBubble; }
518
+ set cancelBubble(value) { this[state$h].cancelBubble = !!value; }
519
+ get defaultPrevented() { return this[state$h].defaultPrevented; }
520
+ get returnValue() { return this[state$h].returnValue; }
521
521
  set returnValue(value) { if (!value) {
522
522
  this.preventDefault();
523
523
  } }
524
- get timeStamp() { return this[state$e].timeStamp; }
524
+ get timeStamp() { return this[state$h].timeStamp; }
525
525
  composedPath() {
526
526
  let path = !!this.target ? [this.target] : [];
527
527
  if (!!this.currentTarget && this.currentTarget !== this.target)
@@ -531,7 +531,7 @@ class EventP {
531
531
  initEvent(...args) {
532
532
  const [type, bubbles, cancelable] = args;
533
533
  checkArgsLength(args, 1, "Event", "initEvent");
534
- const s = this[state$e];
534
+ const s = this[state$h];
535
535
  if (s[_dispatched])
536
536
  return;
537
537
  s.type = "" + type;
@@ -539,7 +539,7 @@ class EventP {
539
539
  s.cancelable = !!cancelable;
540
540
  }
541
541
  preventDefault() {
542
- const s = this[state$e];
542
+ const s = this[state$h];
543
543
  if (s[_passive]) {
544
544
  console.warn(`Ignoring 'preventDefault()' call on event of type '${this.type}' from a listener registered as 'passive'.`);
545
545
  return;
@@ -551,7 +551,7 @@ class EventP {
551
551
  }
552
552
  }
553
553
  stopImmediatePropagation() {
554
- this[state$e][_stopImmediatePropagationCalled] = true;
554
+ this[state$h][_stopImmediatePropagationCalled] = true;
555
555
  this.cancelBubble = true;
556
556
  }
557
557
  stopPropagation() {
@@ -560,14 +560,14 @@ class EventP {
560
560
  /** @internal */ toString() { return "[object Event]"; }
561
561
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["Event"] }; }
562
562
  }
563
- const properties$1 = {
563
+ const properties$2 = {
564
564
  NONE: { value: 0, enumerable: true },
565
565
  CAPTURING_PHASE: { value: 1, enumerable: true },
566
566
  AT_TARGET: { value: 2, enumerable: true },
567
567
  BUBBLING_PHASE: { value: 3, enumerable: true },
568
568
  };
569
- Object.defineProperties(EventP, properties$1);
570
- Object.defineProperties(EventP.prototype, properties$1);
569
+ Object.defineProperties(EventP, properties$2);
570
+ Object.defineProperties(EventP.prototype, properties$2);
571
571
  Class_setStringTag(EventP, "Event");
572
572
  /** @internal */ const _timeStamp = (new Date()).getTime();
573
573
  /** @internal */ const _isTrusted = Symbol();
@@ -589,17 +589,17 @@ class EventState {
589
589
  this.defaultPrevented = false;
590
590
  this.returnValue = true;
591
591
  this.timeStamp = (new Date()).getTime() - _timeStamp;
592
- this[_a$9] = false;
593
- this[_b$2] = false;
592
+ this[_a$a] = false;
593
+ this[_b$3] = false;
594
594
  this[_c$1] = false;
595
595
  this[_d$1] = false;
596
596
  this[_e$1] = false;
597
597
  }
598
598
  }
599
- _a$9 = _isTrusted, _b$2 = _passive, _c$1 = _dispatched, _d$1 = _preventDefaultCalled, _e$1 = _stopImmediatePropagationCalled;
599
+ _a$a = _isTrusted, _b$3 = _passive, _c$1 = _dispatched, _d$1 = _preventDefaultCalled, _e$1 = _stopImmediatePropagationCalled;
600
600
  /** @internal */
601
601
  function Event_setTrusted(event, isTrusted) {
602
- Object.defineProperty(event[state$e], _isTrusted, {
602
+ Object.defineProperty(event[state$h], _isTrusted, {
603
603
  value: isTrusted,
604
604
  writable: true,
605
605
  enumerable: true,
@@ -607,16 +607,16 @@ function Event_setTrusted(event, isTrusted) {
607
607
  });
608
608
  }
609
609
  const passive$1 = 0;
610
- const dispatched$2 = 1;
610
+ const dispatched$3 = 1;
611
611
  const preventDefaultCalled$1 = 2;
612
612
  const stopImmediatePropagationCalled$1 = 3;
613
613
  /** @internal */
614
614
  function Event_getEtField(event, field) {
615
- const s = event[state$e];
615
+ const s = event[state$h];
616
616
  switch (field) {
617
617
  case passive$1:
618
618
  return s[_passive];
619
- case dispatched$2:
619
+ case dispatched$3:
620
620
  return s[_dispatched];
621
621
  case preventDefaultCalled$1:
622
622
  return s[_preventDefaultCalled];
@@ -626,12 +626,12 @@ function Event_getEtField(event, field) {
626
626
  }
627
627
  /** @internal */
628
628
  function Event_setEtField(event, field, value) {
629
- const s = event[state$e];
629
+ const s = event[state$h];
630
630
  switch (field) {
631
631
  case passive$1:
632
632
  s[_passive] = value;
633
633
  break;
634
- case dispatched$2:
634
+ case dispatched$3:
635
635
  s[_dispatched] = value;
636
636
  break;
637
637
  case preventDefaultCalled$1:
@@ -645,30 +645,30 @@ function Event_setEtField(event, field, value) {
645
645
  /** @internal */
646
646
  function createInnerEvent(target, type, eventInitDict, isTrusted = true) {
647
647
  let event = new EventP(type, eventInitDict);
648
- event[state$e].target = target;
649
- event[state$e][_isTrusted] = isTrusted;
648
+ event[state$h].target = target;
649
+ event[state$h][_isTrusted] = isTrusted;
650
650
  return event;
651
651
  }
652
652
  const EventE = g["EventTarget"] ? g["Event"] : EventP;
653
653
 
654
- var _a$8;
654
+ var _a$9;
655
655
  const passive = 0;
656
- const dispatched$1 = 1;
656
+ const dispatched$2 = 1;
657
657
  const preventDefaultCalled = 2;
658
658
  const stopImmediatePropagationCalled = 3;
659
- /** @internal */ const state$d = Symbol( /* "EventTargetState" */);
659
+ /** @internal */ const state$g = Symbol( /* "EventTargetState" */);
660
660
  class EventTargetP {
661
661
  constructor() {
662
- this[state$d] = new EventTargetState(this);
663
- this[state$d].name = new.target.name;
662
+ this[state$g] = new EventTargetState(this);
663
+ this[state$g].name = new.target.name;
664
664
  }
665
665
  addEventListener(...args) {
666
666
  const [type, callback, options] = args;
667
- checkArgsLength(args, 2, this[state$d].name, "addEventListener");
667
+ checkArgsLength(args, 2, this[state$g].name, "addEventListener");
668
668
  if (typeof callback !== "function" && typeof callback !== "object" && typeof callback !== "undefined") {
669
- throw new TypeError(`Failed to execute 'addEventListener' on '${this[state$d].name}': parameter 2 is not of type 'Object'.`);
669
+ throw new TypeError(`Failed to execute 'addEventListener' on '${this[state$g].name}': parameter 2 is not of type 'Object'.`);
670
670
  }
671
- const s = this[state$d];
671
+ const s = this[state$g];
672
672
  const executor = new Executor(type, callback);
673
673
  executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
674
674
  if (!s[_executors].some(x => x.equals(executor))) {
@@ -676,7 +676,7 @@ class EventTargetP {
676
676
  const { once, passive, signal } = options;
677
677
  executor.options.once = !!once;
678
678
  executor.options.passive = !!passive;
679
- if (signal) {
679
+ if (signal && isPolyfillType("EventTarget", signal)) {
680
680
  executor.options.signal = signal;
681
681
  reply(this, signal, executor);
682
682
  }
@@ -688,21 +688,21 @@ class EventTargetP {
688
688
  }
689
689
  dispatchEvent(...args) {
690
690
  const [event] = args;
691
- checkArgsLength(args, 1, this[state$d].name, "dispatchEvent");
691
+ checkArgsLength(args, 1, this[state$g].name, "dispatchEvent");
692
692
  if (!(event instanceof EventP)) {
693
- throw new TypeError(`Failed to execute 'dispatchEvent' on '${this[state$d].name}': parameter 1 is not of type 'Event'.`);
693
+ throw new TypeError(`Failed to execute 'dispatchEvent' on '${this[state$g].name}': parameter 1 is not of type 'Event'.`);
694
694
  }
695
695
  Event_setTrusted(event, false);
696
- event[state$e].target = this;
696
+ event[state$h].target = this;
697
697
  return EventTarget_fire(this, event);
698
698
  }
699
699
  removeEventListener(...args) {
700
700
  const [type, callback, options] = args;
701
- checkArgsLength(args, 2, this[state$d].name, "removeEventListener");
701
+ checkArgsLength(args, 2, this[state$g].name, "removeEventListener");
702
702
  if (typeof callback !== "function" && typeof callback !== "object" && typeof callback !== "undefined") {
703
- throw new TypeError(`Failed to execute 'removeEventListener' on '${this[state$d].name}': parameter 2 is not of type 'Object'.`);
703
+ throw new TypeError(`Failed to execute 'removeEventListener' on '${this[state$g].name}': parameter 2 is not of type 'Object'.`);
704
704
  }
705
- const s = this[state$d];
705
+ const s = this[state$g];
706
706
  const executor = new Executor(type, callback);
707
707
  executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
708
708
  if (s[_executors].some(x => x.equals(executor))) {
@@ -719,20 +719,20 @@ const _executors = Symbol();
719
719
  class EventTargetState {
720
720
  constructor(target) {
721
721
  this.name = "EventTarget";
722
- this[_a$8] = [];
722
+ this[_a$9] = [];
723
723
  this.target = target;
724
724
  }
725
725
  }
726
- _a$8 = _executors;
726
+ _a$9 = _executors;
727
727
  /** @internal */
728
728
  function EventTarget_fire(target, event) {
729
- const s = target[state$d];
730
- const evs = event[state$e];
729
+ const s = target[state$g];
730
+ const evs = event[state$h];
731
731
  if (!event.target)
732
732
  evs.target = target;
733
733
  evs.currentTarget = target;
734
734
  evs.eventPhase = EventP.AT_TARGET;
735
- Event_setEtField(event, dispatched$1, true);
735
+ Event_setEtField(event, dispatched$2, true);
736
736
  let onceIndexes = [];
737
737
  for (let i = 0; i < s[_executors].length; ++i) {
738
738
  if (Event_getEtField(event, stopImmediatePropagationCalled))
@@ -762,21 +762,16 @@ function EventTarget_fire(target, event) {
762
762
  }
763
763
  evs.currentTarget = null;
764
764
  evs.eventPhase = EventP.NONE;
765
- Event_setEtField(event, dispatched$1, false);
765
+ Event_setEtField(event, dispatched$2, false);
766
766
  return !(event.cancelable && Event_getEtField(event, preventDefaultCalled));
767
767
  }
768
768
  function reply(target, signal, executor) {
769
- const s = target[state$d];
769
+ const s = target[state$g];
770
770
  const onAbort = () => {
771
771
  s[_executors] = s[_executors].filter(x => !x.equals(executor));
772
772
  signal.removeEventListener("abort", onAbort);
773
773
  };
774
- try {
775
- signal.addEventListener("abort", onAbort);
776
- }
777
- catch (e) {
778
- console.warn(e);
779
- }
774
+ signal.addEventListener("abort", onAbort);
780
775
  }
781
776
  /** @internal */
782
777
  class Executor {
@@ -802,7 +797,7 @@ function extract(cb) {
802
797
  }
803
798
  }
804
799
  function isEventListenerObject(cb) {
805
- return !!cb && "handleEvent" in cb && typeof cb.handleEvent === "function";
800
+ return !!cb && typeof cb === "object" && "handleEvent" in cb && typeof cb.handleEvent === "function";
806
801
  }
807
802
  /** @internal */
808
803
  function attachFn(target, type, cb, listener) {
@@ -821,13 +816,13 @@ function executeFn(target, cb, ev) {
821
816
  const EventTargetE = g["EventTarget"] || EventTargetP;
822
817
 
823
818
  /** @internal */
824
- const state$c = Symbol( /* "ProgressEventState" */);
819
+ const state$f = Symbol( /* "ProgressEventState" */);
825
820
  class ProgressEventP extends EventP {
826
821
  constructor(type, eventInitDict) {
827
822
  var _a, _b;
828
823
  super(type, eventInitDict);
829
- this[state$c] = new ProgressEventState();
830
- const s = this[state$c];
824
+ this[state$f] = new ProgressEventState();
825
+ const s = this[state$f];
831
826
  s.lengthComputable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lengthComputable);
832
827
  s.loaded = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.loaded) !== null && _a !== void 0 ? _a : 0);
833
828
  s.total = Number((_b = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.total) !== null && _b !== void 0 ? _b : 0);
@@ -842,9 +837,9 @@ class ProgressEventP extends EventP {
842
837
  throw new TypeError(`Failed to construct 'ProgressEvent': Failed to read the '${errField}' property from 'ProgressEventInit': The provided double value is non-finite.`);
843
838
  }
844
839
  }
845
- get lengthComputable() { return getValue(this[state$c].lengthComputable); }
846
- get loaded() { return getValue(this[state$c].loaded); }
847
- get total() { return getValue(this[state$c].total); }
840
+ get lengthComputable() { return getValue(this[state$f].lengthComputable); }
841
+ get loaded() { return getValue(this[state$f].loaded); }
842
+ get total() { return getValue(this[state$f].total); }
848
843
  /** @internal */ toString() { return "[object ProgressEvent]"; }
849
844
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["ProgressEvent", "Event"] }; }
850
845
  }
@@ -862,10 +857,10 @@ function getValue(val) {
862
857
  }
863
858
  function createInnerProgressEvent(target, type, { lengthComputable = false, loaded = 0, total = 0, } = {}) {
864
859
  let event = new ProgressEventP(type);
865
- event[state$c].lengthComputable = lengthComputable;
866
- event[state$c].loaded = loaded;
867
- event[state$c].total = total;
868
- event[state$e].target = target;
860
+ event[state$f].lengthComputable = lengthComputable;
861
+ event[state$f].loaded = loaded;
862
+ event[state$f].total = total;
863
+ event[state$h].target = target;
869
864
  Event_setTrusted(event, true);
870
865
  return event;
871
866
  }
@@ -878,22 +873,22 @@ function emitProcessEvent(target, type, loaded = 0, total = 0) {
878
873
  });
879
874
  EventTarget_fire(target, event);
880
875
  }
881
- const ProgressEventE = g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
876
+ g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
882
877
 
883
- var _a$7;
878
+ var _a$8;
884
879
  /** @internal */
885
- const state$b = Symbol( /* "FileReaderState" */);
880
+ const state$e = Symbol( /* "FileReaderState" */);
886
881
  class FileReaderP extends EventTargetP {
887
882
  constructor() {
888
883
  super();
889
- this[state$b] = new FileReaderState(this);
884
+ this[state$e] = new FileReaderState(this);
890
885
  }
891
- get readyState() { return this[state$b].readyState; }
892
- get result() { return this[state$b].result; }
893
- get error() { return this[state$b].error; }
886
+ get readyState() { return this[state$e].readyState; }
887
+ get result() { return this[state$e].result; }
888
+ get error() { return this[state$e].error; }
894
889
  abort() {
895
890
  if (this.readyState === FileReaderP.LOADING) {
896
- const s = this[state$b];
891
+ const s = this[state$e];
897
892
  s.readyState = FileReaderP.DONE;
898
893
  s.result = null;
899
894
  s.error = new MPException("An ongoing operation was aborted, typically with a call to abort().", "AbortError");
@@ -902,7 +897,7 @@ class FileReaderP extends EventTargetP {
902
897
  }
903
898
  readAsArrayBuffer(...args) {
904
899
  read$1(this, "readAsArrayBuffer", args, blob => {
905
- this[state$b].result = Blob_toUint8Array(blob).buffer.slice(0);
900
+ this[state$e].result = Blob_toUint8Array(blob).buffer.slice(0);
906
901
  });
907
902
  }
908
903
  readAsBinaryString(...args) {
@@ -913,12 +908,12 @@ class FileReaderP extends EventTargetP {
913
908
  let char = buf[i];
914
909
  str.push(String.fromCharCode(char));
915
910
  }
916
- this[state$b].result = str.join("");
911
+ this[state$e].result = str.join("");
917
912
  });
918
913
  }
919
914
  readAsDataURL(...args) {
920
915
  read$1(this, "readAsDataURL", args, blob => {
921
- this[state$b].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
916
+ this[state$e].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
922
917
  });
923
918
  }
924
919
  readAsText(...args) {
@@ -930,41 +925,41 @@ class FileReaderP extends EventTargetP {
930
925
  console.error(`TypeError: Failed to execute 'readAsText' on 'FileReader': encoding ('${_encoding}') not implemented.`);
931
926
  }
932
927
  }
933
- this[state$b].result = decode$1(Blob_toUint8Array(blob));
928
+ this[state$e].result = decode$1(Blob_toUint8Array(blob));
934
929
  });
935
930
  }
936
- get onabort() { return this[state$b].onabort; }
937
- set onabort(value) { this[state$b].onabort = value; attach$1(this, "abort"); }
938
- get onerror() { return this[state$b].onerror; }
939
- set onerror(value) { this[state$b].onerror = value; attach$1(this, "error"); }
940
- get onload() { return this[state$b].onload; }
941
- set onload(value) { this[state$b].onload = value; attach$1(this, "load"); }
942
- get onloadend() { return this[state$b].onloadend; }
943
- set onloadend(value) { this[state$b].onloadend = value; attach$1(this, "loadend"); }
944
- get onloadstart() { return this[state$b].onloadstart; }
945
- set onloadstart(value) { this[state$b].onloadstart = value; attach$1(this, "loadstart"); }
946
- get onprogress() { return this[state$b].onprogress; }
947
- set onprogress(value) { this[state$b].onprogress = value; attach$1(this, "progress"); }
931
+ get onabort() { return this[state$e].onabort; }
932
+ set onabort(value) { this[state$e].onabort = value; attach$2(this, "abort"); }
933
+ get onerror() { return this[state$e].onerror; }
934
+ set onerror(value) { this[state$e].onerror = value; attach$2(this, "error"); }
935
+ get onload() { return this[state$e].onload; }
936
+ set onload(value) { this[state$e].onload = value; attach$2(this, "load"); }
937
+ get onloadend() { return this[state$e].onloadend; }
938
+ set onloadend(value) { this[state$e].onloadend = value; attach$2(this, "loadend"); }
939
+ get onloadstart() { return this[state$e].onloadstart; }
940
+ set onloadstart(value) { this[state$e].onloadstart = value; attach$2(this, "loadstart"); }
941
+ get onprogress() { return this[state$e].onprogress; }
942
+ set onprogress(value) { this[state$e].onprogress = value; attach$2(this, "progress"); }
948
943
  /** @internal */ toString() { return "[object FileReader]"; }
949
944
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["FileReader", "EventTarget"] }; }
950
945
  }
951
- const properties = {
946
+ const properties$1 = {
952
947
  EMPTY: { value: 0, enumerable: true },
953
948
  LOADING: { value: 1, enumerable: true },
954
949
  DONE: { value: 2, enumerable: true },
955
950
  };
956
- Object.defineProperties(FileReaderP, properties);
957
- Object.defineProperties(FileReaderP.prototype, properties);
951
+ Object.defineProperties(FileReaderP, properties$1);
952
+ Object.defineProperties(FileReaderP.prototype, properties$1);
958
953
  Class_setStringTag(FileReaderP, "FileReader");
959
954
  /** @internal */
960
- const _handlers$3 = Symbol();
955
+ const _handlers$4 = Symbol();
961
956
  /** @internal */
962
957
  class FileReaderState {
963
958
  constructor(target) {
964
959
  this.readyState = FileReaderP.EMPTY;
965
960
  this.result = null;
966
961
  this.error = null;
967
- this[_a$7] = getHandlers$3(this);
962
+ this[_a$8] = getHandlers$4(this);
968
963
  this.onabort = null;
969
964
  this.onerror = null;
970
965
  this.onload = null;
@@ -974,14 +969,14 @@ class FileReaderState {
974
969
  this.target = target;
975
970
  }
976
971
  }
977
- _a$7 = _handlers$3;
972
+ _a$8 = _handlers$4;
978
973
  function read$1(reader, kind, args, setResult) {
979
974
  const [blob] = args;
980
975
  checkArgsLength(args, 1, "FileReader", kind);
981
976
  if (!isPolyfillType("Blob", blob)) {
982
977
  throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.");
983
978
  }
984
- const s = reader[state$b];
979
+ const s = reader[state$e];
985
980
  s.error = null;
986
981
  s.readyState = FileReaderP.LOADING;
987
982
  emitProcessEvent(s.target, "loadstart", 0, blob.size);
@@ -1001,14 +996,14 @@ function read$1(reader, kind, args, setResult) {
1001
996
  emitProcessEvent(s.target, "loadend", !!s.result ? blob.size : 0, blob.size);
1002
997
  });
1003
998
  }
1004
- function attach$1(reader, type) {
1005
- const s = reader[state$b];
999
+ function attach$2(reader, type) {
1000
+ const s = reader[state$e];
1006
1001
  const fnName = ("on" + type);
1007
1002
  const cb = s[fnName];
1008
- const listener = s[_handlers$3][fnName];
1003
+ const listener = s[_handlers$4][fnName];
1009
1004
  attachFn(reader, type, cb, listener);
1010
1005
  }
1011
- function getHandlers$3(s) {
1006
+ function getHandlers$4(s) {
1012
1007
  return {
1013
1008
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
1014
1009
  onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
@@ -1020,12 +1015,12 @@ function getHandlers$3(s) {
1020
1015
  }
1021
1016
  const FileReaderE = g["Blob"] ? g["FileReader"] : FileReaderP;
1022
1017
 
1023
- var _a$6;
1024
- /** @internal */ const state$a = Symbol( /* "URLSearchParamsState" */);
1018
+ var _a$7;
1019
+ /** @internal */ const state$d = Symbol( /* "URLSearchParamsState" */);
1025
1020
  const checkArgsFn$2 = (args, required, funcName) => { checkArgsLength(args, required, "URLSearchParams", funcName); };
1026
1021
  class URLSearchParamsP {
1027
1022
  constructor(init) {
1028
- this[state$a] = new URLSearchParamsState();
1023
+ this[state$d] = new URLSearchParamsState();
1029
1024
  if (init !== undefined) {
1030
1025
  if (isObjectType("URLSearchParams", init)) {
1031
1026
  init.forEach((value, name) => { this.append(name, value); }, this);
@@ -1073,18 +1068,18 @@ class URLSearchParamsP {
1073
1068
  }
1074
1069
  }
1075
1070
  }
1076
- get size() { return this[state$a][_urlspArray].length; }
1071
+ get size() { return this[state$d][_urlspArray].length; }
1077
1072
  append(...args) {
1078
1073
  const [name, value] = args;
1079
1074
  checkArgsFn$2(args, 2, "append");
1080
- this[state$a][_urlspArray].push(["" + name, normalizeValue$1(value)]);
1075
+ this[state$d][_urlspArray].push(["" + name, normalizeValue$1(value)]);
1081
1076
  }
1082
1077
  delete(...args) {
1083
1078
  const [name, value] = args;
1084
1079
  checkArgsFn$2(args, 1, "delete");
1085
1080
  let _name = "" + name;
1086
1081
  let index = -1;
1087
- let array = this[state$a][_urlspArray];
1082
+ let array = this[state$d][_urlspArray];
1088
1083
  let result = [];
1089
1084
  for (let i = 0; i < array.length; ++i) {
1090
1085
  let item = array[i];
@@ -1098,14 +1093,14 @@ class URLSearchParamsP {
1098
1093
  result.push(item);
1099
1094
  }
1100
1095
  if (index > -1) {
1101
- this[state$a][_urlspArray] = result;
1096
+ this[state$d][_urlspArray] = result;
1102
1097
  }
1103
1098
  }
1104
1099
  get(...args) {
1105
1100
  const [name] = args;
1106
1101
  checkArgsFn$2(args, 1, "get");
1107
1102
  let _name = "" + name;
1108
- let array = this[state$a][_urlspArray];
1103
+ let array = this[state$d][_urlspArray];
1109
1104
  for (let i = 0; i < array.length; ++i) {
1110
1105
  let item = array[i];
1111
1106
  if (item[0] === _name) {
@@ -1118,7 +1113,7 @@ class URLSearchParamsP {
1118
1113
  const [name] = args;
1119
1114
  checkArgsFn$2(args, 1, "getAll");
1120
1115
  let _name = "" + name;
1121
- let array = this[state$a][_urlspArray];
1116
+ let array = this[state$d][_urlspArray];
1122
1117
  let result = [];
1123
1118
  for (let i = 0; i < array.length; ++i) {
1124
1119
  let item = array[i];
@@ -1132,7 +1127,7 @@ class URLSearchParamsP {
1132
1127
  const [name, value] = args;
1133
1128
  checkArgsFn$2(args, 1, "has");
1134
1129
  let _name = "" + name;
1135
- let array = this[state$a][_urlspArray];
1130
+ let array = this[state$d][_urlspArray];
1136
1131
  for (let i = 0; i < array.length; ++i) {
1137
1132
  let item = array[i];
1138
1133
  if (item[0] === _name) {
@@ -1154,7 +1149,7 @@ class URLSearchParamsP {
1154
1149
  let _name = "" + name;
1155
1150
  let _value = normalizeValue$1(value);
1156
1151
  let index = -1;
1157
- let array = this[state$a][_urlspArray];
1152
+ let array = this[state$d][_urlspArray];
1158
1153
  let result = [];
1159
1154
  for (let i = 0; i < array.length; ++i) {
1160
1155
  let item = array[i];
@@ -1170,10 +1165,10 @@ class URLSearchParamsP {
1170
1165
  if (index === -1) {
1171
1166
  result.push([_name, _value]);
1172
1167
  }
1173
- this[state$a][_urlspArray] = result;
1168
+ this[state$d][_urlspArray] = result;
1174
1169
  }
1175
1170
  sort() {
1176
- this[state$a][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1171
+ this[state$d][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1177
1172
  }
1178
1173
  forEach(...args) {
1179
1174
  const [callbackfn, thisArg] = args;
@@ -1181,26 +1176,26 @@ class URLSearchParamsP {
1181
1176
  if (typeof callbackfn !== "function") {
1182
1177
  throw new TypeError("Failed to execute 'forEach' on 'URLSearchParams': parameter 1 is not of type 'Function'.");
1183
1178
  }
1184
- let array = this[state$a][_urlspArray];
1179
+ let array = this[state$d][_urlspArray];
1185
1180
  for (let i = 0; i < array.length; ++i) {
1186
1181
  let item = array[i];
1187
1182
  callbackfn.call(thisArg, item[1], item[0], this);
1188
1183
  }
1189
1184
  }
1190
1185
  entries() {
1191
- return this[state$a][_urlspArray].map(x => [x[0], x[1]]).values();
1186
+ return this[state$d][_urlspArray].map(x => [x[0], x[1]]).values();
1192
1187
  }
1193
1188
  keys() {
1194
- return this[state$a][_urlspArray].map(x => x[0]).values();
1189
+ return this[state$d][_urlspArray].map(x => x[0]).values();
1195
1190
  }
1196
1191
  values() {
1197
- return this[state$a][_urlspArray].map(x => x[1]).values();
1192
+ return this[state$d][_urlspArray].map(x => x[1]).values();
1198
1193
  }
1199
1194
  [Symbol.iterator]() {
1200
1195
  return this.entries();
1201
1196
  }
1202
1197
  toString() {
1203
- let array = this[state$a][_urlspArray];
1198
+ let array = this[state$d][_urlspArray];
1204
1199
  let result = [];
1205
1200
  for (let i = 0; i < array.length; ++i) {
1206
1201
  let item = array[i];
@@ -1217,10 +1212,10 @@ const _urlspArray = Symbol();
1217
1212
  /** @internal */
1218
1213
  class URLSearchParamsState {
1219
1214
  constructor() {
1220
- this[_a$6] = [];
1215
+ this[_a$7] = [];
1221
1216
  }
1222
1217
  }
1223
- _a$6 = _urlspArray;
1218
+ _a$7 = _urlspArray;
1224
1219
  function normalizeValue$1(value) {
1225
1220
  return typeof value === "string" ? value : (value !== null && value !== undefined && typeof value.toString === "function"
1226
1221
  ? value.toString()
@@ -1245,8 +1240,8 @@ function decode(str) {
1245
1240
  }
1246
1241
  const URLSearchParamsE = g["URLSearchParams"] || URLSearchParamsP;
1247
1242
 
1248
- var _a$5;
1249
- /** @internal */ const state$9 = Symbol( /* "FormDataState" */);
1243
+ var _a$6;
1244
+ /** @internal */ const state$c = Symbol( /* "FormDataState" */);
1250
1245
  const checkArgsFn$1 = (args, required, funcName) => { checkArgsLength(args, required, "FormData", funcName); };
1251
1246
  class FormDataP {
1252
1247
  constructor(form, submitter) {
@@ -1260,19 +1255,19 @@ class FormDataP {
1260
1255
  console.error("TypeError: Failed to construct 'FormData': parameter 1 and parameter 2 not implemented.");
1261
1256
  }
1262
1257
  }
1263
- this[state$9] = new FormDataState();
1258
+ this[state$c] = new FormDataState();
1264
1259
  }
1265
1260
  append(...args) {
1266
1261
  const [name, value, filename] = args;
1267
1262
  checkArgsFn$1(args, 2, "append");
1268
- this[state$9][_formData].push(normalizeArgs(name, value, filename));
1263
+ this[state$c][_formData].push(normalizeArgs(name, value, filename));
1269
1264
  }
1270
1265
  delete(...args) {
1271
1266
  const [name] = args;
1272
1267
  checkArgsFn$1(args, 1, "delete");
1273
1268
  let _name = "" + name;
1274
1269
  let index = -1;
1275
- let array = this[state$9][_formData];
1270
+ let array = this[state$c][_formData];
1276
1271
  let result = [];
1277
1272
  for (let i = 0; i < array.length; ++i) {
1278
1273
  let item = array[i];
@@ -1283,14 +1278,14 @@ class FormDataP {
1283
1278
  result.push(item);
1284
1279
  }
1285
1280
  if (index > -1) {
1286
- this[state$9][_formData] = result;
1281
+ this[state$c][_formData] = result;
1287
1282
  }
1288
1283
  }
1289
1284
  get(...args) {
1290
1285
  const [name] = args;
1291
1286
  checkArgsFn$1(args, 1, "get");
1292
1287
  let _name = "" + name;
1293
- let array = this[state$9][_formData];
1288
+ let array = this[state$c][_formData];
1294
1289
  for (let i = 0; i < array.length; ++i) {
1295
1290
  let item = array[i];
1296
1291
  if (item[0] === _name) {
@@ -1303,7 +1298,7 @@ class FormDataP {
1303
1298
  const [name] = args;
1304
1299
  checkArgsFn$1(args, 1, "getAll");
1305
1300
  let _name = "" + name;
1306
- let array = this[state$9][_formData];
1301
+ let array = this[state$c][_formData];
1307
1302
  let result = [];
1308
1303
  for (let i = 0; i < array.length; ++i) {
1309
1304
  let item = array[i];
@@ -1317,7 +1312,7 @@ class FormDataP {
1317
1312
  const [name] = args;
1318
1313
  checkArgsFn$1(args, 1, "has");
1319
1314
  let _name = "" + name;
1320
- let array = this[state$9][_formData];
1315
+ let array = this[state$c][_formData];
1321
1316
  for (let i = 0; i < array.length; ++i) {
1322
1317
  let item = array[i];
1323
1318
  if (item[0] === _name) {
@@ -1332,7 +1327,7 @@ class FormDataP {
1332
1327
  let _name = "" + name;
1333
1328
  let _args = normalizeArgs(name, value, filename);
1334
1329
  let index = -1;
1335
- let array = this[state$9][_formData];
1330
+ let array = this[state$c][_formData];
1336
1331
  let result = [];
1337
1332
  for (let i = 0; i < array.length; ++i) {
1338
1333
  let item = array[i];
@@ -1348,7 +1343,7 @@ class FormDataP {
1348
1343
  if (index === -1) {
1349
1344
  result.push(_args);
1350
1345
  }
1351
- this[state$9][_formData] = result;
1346
+ this[state$c][_formData] = result;
1352
1347
  }
1353
1348
  forEach(...args) {
1354
1349
  const [callbackfn, thisArg] = args;
@@ -1356,20 +1351,20 @@ class FormDataP {
1356
1351
  if (typeof callbackfn !== "function") {
1357
1352
  throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");
1358
1353
  }
1359
- let array = this[state$9][_formData];
1354
+ let array = this[state$c][_formData];
1360
1355
  for (let i = 0; i < array.length; ++i) {
1361
1356
  let item = array[i];
1362
1357
  callbackfn.call(thisArg, item[1], item[0], thisArg);
1363
1358
  }
1364
1359
  }
1365
1360
  entries() {
1366
- return this[state$9][_formData].map(x => [x[0], x[1]]).values();
1361
+ return this[state$c][_formData].map(x => [x[0], x[1]]).values();
1367
1362
  }
1368
1363
  keys() {
1369
- return this[state$9][_formData].map(x => x[0]).values();
1364
+ return this[state$c][_formData].map(x => x[0]).values();
1370
1365
  }
1371
1366
  values() {
1372
- return this[state$9][_formData].map(x => x[1]).values();
1367
+ return this[state$c][_formData].map(x => x[1]).values();
1373
1368
  }
1374
1369
  [Symbol.iterator]() {
1375
1370
  return this.entries();
@@ -1383,17 +1378,17 @@ const _formData = Symbol();
1383
1378
  /** @internal */
1384
1379
  class FormDataState {
1385
1380
  constructor() {
1386
- this[_a$5] = [];
1381
+ this[_a$6] = [];
1387
1382
  }
1388
1383
  }
1389
- _a$5 = _formData;
1384
+ _a$6 = _formData;
1390
1385
  /** @internal */
1391
1386
  function FormData_toBlob(formData) {
1392
1387
  const boundary = "----formdata-mphttpx-" + Math.random();
1393
1388
  const p = `--${boundary}\r\nContent-Disposition: form-data; name="`;
1394
1389
  let chunks = [];
1395
- for (let i = 0; i < formData[state$9][_formData].length; ++i) {
1396
- let pair = formData[state$9][_formData][i];
1390
+ for (let i = 0; i < formData[state$c][_formData].length; ++i) {
1391
+ let pair = formData[state$c][_formData][i];
1397
1392
  let name = pair[0];
1398
1393
  let value = pair[1];
1399
1394
  if (typeof value === "string") {
@@ -1483,12 +1478,12 @@ function createFormDataFromBinaryText(text, boundary) {
1483
1478
  }
1484
1479
  const FormDataE = g["FormData"] || FormDataP;
1485
1480
 
1486
- var _a$4, _b$1;
1487
- /** @internal */ const state$8 = Symbol( /* "HeadersState" */);
1481
+ var _a$5, _b$2;
1482
+ /** @internal */ const state$b = Symbol( /* "HeadersState" */);
1488
1483
  const checkArgsFn = (args, required, funcName) => { checkArgsLength(args, required, "Headers", funcName); };
1489
1484
  class HeadersP {
1490
1485
  constructor(init) {
1491
- this[state$8] = new HeadersState();
1486
+ this[state$b] = new HeadersState();
1492
1487
  if (init !== undefined) {
1493
1488
  if (isObjectType("Headers", init)) {
1494
1489
  init.forEach((value, name) => { this.append(name, value); }, this);
@@ -1519,15 +1514,15 @@ class HeadersP {
1519
1514
  }
1520
1515
  }
1521
1516
  }
1522
- this[state$8][_initialized] = true;
1517
+ this[state$b][_initialized] = true;
1523
1518
  }
1524
1519
  append(...args) {
1525
1520
  const [name, value] = args;
1526
1521
  checkArgsFn(args, 2, "append");
1527
- let _name = normalizeName(name, throwsFn(this[state$8][_initialized] ? "append" : ""));
1522
+ let _name = normalizeName(name, throwsFn(this[state$b][_initialized] ? "append" : ""));
1528
1523
  let _value = normalizeValue(value);
1529
1524
  let index = -1;
1530
- let array = this[state$8][_headersArray];
1525
+ let array = this[state$b][_headersArray];
1531
1526
  for (let i = 0; i < array.length; ++i) {
1532
1527
  let item = array[i];
1533
1528
  if (item[0] === _name) {
@@ -1545,7 +1540,7 @@ class HeadersP {
1545
1540
  checkArgsFn(args, 1, "delete");
1546
1541
  let _name = normalizeName(name, throwsFn("delete"));
1547
1542
  let index = -1;
1548
- let array = this[state$8][_headersArray];
1543
+ let array = this[state$b][_headersArray];
1549
1544
  let result = [];
1550
1545
  for (let i = 0; i < array.length; ++i) {
1551
1546
  let item = array[i];
@@ -1556,14 +1551,14 @@ class HeadersP {
1556
1551
  result.push(item);
1557
1552
  }
1558
1553
  if (index > -1) {
1559
- this[state$8][_headersArray] = result;
1554
+ this[state$b][_headersArray] = result;
1560
1555
  }
1561
1556
  }
1562
1557
  get(...args) {
1563
1558
  const [name] = args;
1564
1559
  checkArgsFn(args, 1, "get");
1565
1560
  let _name = normalizeName(name, throwsFn("get"));
1566
- let array = this[state$8][_headersArray];
1561
+ let array = this[state$b][_headersArray];
1567
1562
  for (let i = 0; i < array.length; ++i) {
1568
1563
  let item = array[i];
1569
1564
  if (item[0] === _name) {
@@ -1580,7 +1575,7 @@ class HeadersP {
1580
1575
  const [name] = args;
1581
1576
  checkArgsFn(args, 1, "has");
1582
1577
  let _name = normalizeName(name, throwsFn("has"));
1583
- let array = this[state$8][_headersArray];
1578
+ let array = this[state$b][_headersArray];
1584
1579
  for (let i = 0; i < array.length; ++i) {
1585
1580
  let item = array[i];
1586
1581
  if (item[0] === _name) {
@@ -1595,7 +1590,7 @@ class HeadersP {
1595
1590
  let _name = normalizeName(name, throwsFn("set"));
1596
1591
  let _value = normalizeValue(value);
1597
1592
  let index = -1;
1598
- let array = this[state$8][_headersArray];
1593
+ let array = this[state$b][_headersArray];
1599
1594
  for (let i = 0; i < array.length; ++i) {
1600
1595
  let item = array[i];
1601
1596
  if (item[0] === _name) {
@@ -1614,20 +1609,20 @@ class HeadersP {
1614
1609
  if (typeof callbackfn !== "function") {
1615
1610
  throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");
1616
1611
  }
1617
- let array = this[state$8][_headersArray];
1612
+ let array = this[state$b][_headersArray];
1618
1613
  for (let i = 0; i < array.length; ++i) {
1619
1614
  let item = array[i];
1620
1615
  callbackfn.call(thisArg, item[1], item[0], this);
1621
1616
  }
1622
1617
  }
1623
1618
  entries() {
1624
- return this[state$8][_headersArray].map(x => [x[0], x[1]]).values();
1619
+ return this[state$b][_headersArray].map(x => [x[0], x[1]]).values();
1625
1620
  }
1626
1621
  keys() {
1627
- return this[state$8][_headersArray].map(x => x[0]).values();
1622
+ return this[state$b][_headersArray].map(x => x[0]).values();
1628
1623
  }
1629
1624
  values() {
1630
- return this[state$8][_headersArray].map(x => x[1]).values();
1625
+ return this[state$b][_headersArray].map(x => x[1]).values();
1631
1626
  }
1632
1627
  [Symbol.iterator]() {
1633
1628
  return this.entries();
@@ -1641,11 +1636,11 @@ Class_setStringTag(HeadersP, "Headers");
1641
1636
  /** @internal */
1642
1637
  class HeadersState {
1643
1638
  constructor() {
1644
- this[_a$4] = false;
1645
- this[_b$1] = [];
1639
+ this[_a$5] = false;
1640
+ this[_b$2] = [];
1646
1641
  }
1647
1642
  }
1648
- _a$4 = _initialized, _b$1 = _headersArray;
1643
+ _a$5 = _initialized, _b$2 = _headersArray;
1649
1644
  function throwsFn(kind) {
1650
1645
  return () => {
1651
1646
  throw new TypeError(`Failed to ${kind ? ("execute '" + kind + "' on") : "construct"} 'Headers': Invalid name`);
@@ -1689,23 +1684,23 @@ function parseHeaders(rawHeaders) {
1689
1684
  }
1690
1685
  const HeadersE = g["Headers"] || HeadersP;
1691
1686
 
1692
- var _a$3;
1693
- /** @internal */ const state$7 = Symbol( /* "BodyState" */);
1687
+ var _a$4;
1688
+ /** @internal */ const state$a = Symbol( /* "BodyState" */);
1694
1689
  class BodyImpl {
1695
1690
  /** @internal */
1696
1691
  constructor() {
1697
1692
  if (new.target === BodyImpl) {
1698
1693
  throw new TypeError("Failed to construct 'Body': Illegal constructor");
1699
1694
  }
1700
- this[state$7] = new BodyState();
1695
+ this[state$a] = new BodyState();
1701
1696
  }
1702
1697
  get body() {
1703
- if (!this[state$7][_body]) {
1698
+ if (!this[state$a][_body]) {
1704
1699
  return null;
1705
1700
  }
1706
- throw new TypeError(`Failed to access 'body' on '${this[state$7].name}': property not implemented.`);
1701
+ throw new TypeError(`Failed to access 'body' on '${this[state$a].name}': property not implemented.`);
1707
1702
  }
1708
- get bodyUsed() { return this[state$7].bodyUsed; }
1703
+ get bodyUsed() { return this[state$a].bodyUsed; }
1709
1704
  ;
1710
1705
  arrayBuffer() {
1711
1706
  const kind = "arrayBuffer";
@@ -1742,23 +1737,23 @@ class BodyState {
1742
1737
  constructor() {
1743
1738
  this.name = "Body";
1744
1739
  this.bodyUsed = false;
1745
- this[_a$3] = "";
1740
+ this[_a$4] = "";
1746
1741
  }
1747
1742
  }
1748
- _a$3 = _body;
1743
+ _a$4 = _body;
1749
1744
  /** @internal */
1750
1745
  function Body_init(body, payload) {
1751
1746
  const b = body;
1752
1747
  if (isObjectType("ReadableStream", payload)) {
1753
- throw new TypeError(`Failed to construct '${b[state$7].name}': ReadableStream not implemented.`);
1748
+ throw new TypeError(`Failed to construct '${b[state$a].name}': ReadableStream not implemented.`);
1754
1749
  }
1755
- b[state$7][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
1750
+ b[state$a][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
1756
1751
  b.headers.set("Content-Type", type);
1757
1752
  } });
1758
1753
  }
1759
1754
  /** @internal */
1760
1755
  function Body_toPayload(body) {
1761
- return body[state$7][_body];
1756
+ return body[state$a][_body];
1762
1757
  }
1763
1758
  function read(body, kind) {
1764
1759
  return new Promise((resolve, reject) => {
@@ -1771,7 +1766,7 @@ function read(body, kind) {
1771
1766
  });
1772
1767
  }
1773
1768
  function readSync(body, kind) {
1774
- const payload = body[state$7][_body];
1769
+ const payload = body[state$a][_body];
1775
1770
  if (kind === "arrayBuffer") {
1776
1771
  return convertBack("arraybuffer", payload);
1777
1772
  }
@@ -1808,7 +1803,7 @@ function readSync(body, kind) {
1808
1803
  }
1809
1804
  }
1810
1805
  function consumed(body, kind) {
1811
- const s = body[state$7];
1806
+ const s = body[state$a];
1812
1807
  if (!s[_body])
1813
1808
  return;
1814
1809
  if (s.bodyUsed) {
@@ -1888,9 +1883,9 @@ function convertBack(type, data) {
1888
1883
  }
1889
1884
  }
1890
1885
 
1891
- var _a$2;
1886
+ var _a$3;
1892
1887
  /** @internal */
1893
- const state$6 = Symbol( /* "AbortSignalState" */);
1888
+ const state$9 = Symbol( /* "AbortSignalState" */);
1894
1889
  class AbortSignalP extends EventTargetP {
1895
1890
  static abort(reason) {
1896
1891
  let signal = createAbortSignal();
@@ -1947,40 +1942,40 @@ class AbortSignalP extends EventTargetP {
1947
1942
  throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");
1948
1943
  }
1949
1944
  super();
1950
- this[state$6] = new AbortSignalState(this);
1945
+ this[state$9] = new AbortSignalState(this);
1951
1946
  }
1952
- get aborted() { return this[state$6].aborted; }
1953
- get reason() { return this[state$6].reason; }
1947
+ get aborted() { return this[state$9].aborted; }
1948
+ get reason() { return this[state$9].reason; }
1954
1949
  throwIfAborted() {
1955
1950
  if (this.aborted) {
1956
1951
  throw this.reason;
1957
1952
  }
1958
1953
  }
1959
- get onabort() { return this[state$6].onabort; }
1954
+ get onabort() { return this[state$9].onabort; }
1960
1955
  set onabort(value) {
1961
- this[state$6].onabort = value;
1962
- attachFn(this, "abort", value, this[state$6][_handlers$2].onabort);
1956
+ this[state$9].onabort = value;
1957
+ attachFn(this, "abort", value, this[state$9][_handlers$3].onabort);
1963
1958
  }
1964
1959
  /** @internal */ toString() { return "[object AbortSignal]"; }
1965
1960
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortSignal", "EventTarget"] }; }
1966
1961
  }
1967
1962
  Class_setStringTag(AbortSignalP, "AbortSignal");
1968
1963
  /** @internal */
1969
- const _handlers$2 = Symbol();
1964
+ const _handlers$3 = Symbol();
1970
1965
  /** @internal */
1971
1966
  class AbortSignalState {
1972
1967
  constructor(target) {
1973
1968
  this.aborted = false;
1974
1969
  this.reason = undefined;
1975
- this[_a$2] = getHandlers$2(this);
1970
+ this[_a$3] = getHandlers$3(this);
1976
1971
  this.onabort = null;
1977
1972
  this.target = target;
1978
1973
  }
1979
1974
  }
1980
- _a$2 = _handlers$2;
1975
+ _a$3 = _handlers$3;
1981
1976
  /** @internal */
1982
1977
  function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
1983
- const s = signal[state$6];
1978
+ const s = signal[state$9];
1984
1979
  if (!s.aborted) {
1985
1980
  s.aborted = true;
1986
1981
  s.reason = reason !== null && reason !== void 0 ? reason : (new MPException("signal is aborted without reason", "AbortError"));
@@ -1990,7 +1985,7 @@ function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
1990
1985
  }
1991
1986
  }
1992
1987
  }
1993
- function getHandlers$2(s) {
1988
+ function getHandlers$3(s) {
1994
1989
  return {
1995
1990
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
1996
1991
  };
@@ -1998,21 +1993,21 @@ function getHandlers$2(s) {
1998
1993
  /** @internal */
1999
1994
  function createAbortSignal() {
2000
1995
  let signal = Object.create(AbortSignalP.prototype);
2001
- signal[state$d] = new EventTargetState(signal);
2002
- signal[state$6] = new AbortSignalState(signal);
1996
+ signal[state$g] = new EventTargetState(signal);
1997
+ signal[state$9] = new AbortSignalState(signal);
2003
1998
  return signal;
2004
1999
  }
2005
2000
  const AbortSignalE = g["AbortSignal"] || AbortSignalP;
2006
2001
 
2007
2002
  /** @internal */
2008
- const state$5 = Symbol( /* "AbortControllerState" */);
2003
+ const state$8 = Symbol( /* "AbortControllerState" */);
2009
2004
  class AbortControllerP {
2010
2005
  constructor() {
2011
- this[state$5] = new AbortControllerState();
2006
+ this[state$8] = new AbortControllerState();
2012
2007
  }
2013
- get signal() { return this[state$5].signal; }
2008
+ get signal() { return this[state$8].signal; }
2014
2009
  abort(reason) {
2015
- AbortSignal_abort(this[state$5].signal, reason);
2010
+ AbortSignal_abort(this[state$8].signal, reason);
2016
2011
  }
2017
2012
  /** @internal */ toString() { return "[object AbortController]"; }
2018
2013
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortController"] }; }
@@ -2026,15 +2021,15 @@ class AbortControllerState {
2026
2021
  }
2027
2022
  const AbortControllerE = g["AbortController"] || AbortControllerP;
2028
2023
 
2029
- /** @internal */ const state$4 = Symbol( /* "RequestState" */);
2024
+ /** @internal */ const state$7 = Symbol( /* "RequestState" */);
2030
2025
  class RequestP extends BodyImpl {
2031
2026
  constructor(...args) {
2032
2027
  const [input, init] = args;
2033
2028
  checkArgsLength(args, 1, "Request");
2034
2029
  super();
2035
- this[state$7].name = "Request";
2036
- this[state$4] = new RequestState();
2037
- const s = this[state$4];
2030
+ this[state$a].name = "Request";
2031
+ this[state$7] = new RequestState();
2032
+ const s = this[state$7];
2038
2033
  let _init = init !== null && init !== void 0 ? init : {};
2039
2034
  if (typeof _init !== "object") {
2040
2035
  throw new TypeError("Failed to construct 'Request': The provided value is not of type 'RequestInit'.");
@@ -2051,7 +2046,7 @@ class RequestP extends BodyImpl {
2051
2046
  }
2052
2047
  s.method = input.method;
2053
2048
  s.mode = input.mode;
2054
- let inputSignal = input[state$4].signal;
2049
+ let inputSignal = input[state$7].signal;
2055
2050
  if (inputSignal) {
2056
2051
  s.signal = inputSignal;
2057
2052
  }
@@ -2059,7 +2054,7 @@ class RequestP extends BodyImpl {
2059
2054
  let payload = Body_toPayload(input);
2060
2055
  if (!body && payload !== "") {
2061
2056
  body = payload;
2062
- input[state$7].bodyUsed = true;
2057
+ input[state$a].bodyUsed = true;
2063
2058
  }
2064
2059
  }
2065
2060
  else {
@@ -2103,31 +2098,31 @@ class RequestP extends BodyImpl {
2103
2098
  }
2104
2099
  }
2105
2100
  }
2106
- get cache() { return this[state$4].cache; }
2107
- get credentials() { return this[state$4].credentials; }
2108
- get destination() { return this[state$4].destination; }
2101
+ get cache() { return this[state$7].cache; }
2102
+ get credentials() { return this[state$7].credentials; }
2103
+ get destination() { return this[state$7].destination; }
2109
2104
  get headers() {
2110
- const s = this[state$4];
2105
+ const s = this[state$7];
2111
2106
  if (!s.headers) {
2112
2107
  s.headers = new HeadersP();
2113
2108
  }
2114
2109
  return s.headers;
2115
2110
  }
2116
- get integrity() { return this[state$4].integrity; }
2117
- get keepalive() { return this[state$4].keepalive; }
2118
- get method() { return this[state$4].method; }
2119
- get mode() { return this[state$4].mode; }
2120
- get redirect() { return this[state$4].redirect; }
2121
- get referrer() { return this[state$4].referrer; }
2122
- get referrerPolicy() { return this[state$4].referrerPolicy; }
2111
+ get integrity() { return this[state$7].integrity; }
2112
+ get keepalive() { return this[state$7].keepalive; }
2113
+ get method() { return this[state$7].method; }
2114
+ get mode() { return this[state$7].mode; }
2115
+ get redirect() { return this[state$7].redirect; }
2116
+ get referrer() { return this[state$7].referrer; }
2117
+ get referrerPolicy() { return this[state$7].referrerPolicy; }
2123
2118
  get signal() {
2124
- const s = this[state$4];
2119
+ const s = this[state$7];
2125
2120
  if (!s.signal) {
2126
2121
  s.signal = (new AbortControllerP()).signal;
2127
2122
  }
2128
2123
  return s.signal;
2129
2124
  }
2130
- get url() { return this[state$4].url; }
2125
+ get url() { return this[state$7].url; }
2131
2126
  clone() {
2132
2127
  var _a;
2133
2128
  if (this.bodyUsed) {
@@ -2166,7 +2161,7 @@ const RequestE = g["Request"] || RequestP;
2166
2161
 
2167
2162
  // @ts-nocheck
2168
2163
  /** @internal */
2169
- const mp$2 = (() => {
2164
+ const mp$3 = (() => {
2170
2165
  let u = "undefined", r = "request", f = "function";
2171
2166
  let mp;
2172
2167
  mp =
@@ -2191,7 +2186,7 @@ const mp$2 = (() => {
2191
2186
  return mp;
2192
2187
  })();
2193
2188
 
2194
- const request = mp$2 ? mp$2.request : function errorRequest(options) {
2189
+ const request = mp$3 ? mp$3.request : function errorRequest(options) {
2195
2190
  const errMsg = "NOT_SUPPORTED_ERR";
2196
2191
  const errno = 9;
2197
2192
  const err = {
@@ -2218,8 +2213,8 @@ const request = mp$2 ? mp$2.request : function errorRequest(options) {
2218
2213
  throw new ReferenceError("request is not defined");
2219
2214
  };
2220
2215
 
2221
- var _a$1;
2222
- /** @internal */ const state$3 = Symbol( /* "XMLHttpRequestEventTargetState" */);
2216
+ var _a$2;
2217
+ /** @internal */ const state$6 = Symbol( /* "XMLHttpRequestEventTargetState" */);
2223
2218
  class XMLHttpRequestEventTargetP extends EventTargetP {
2224
2219
  /** @internal */
2225
2220
  constructor() {
@@ -2227,35 +2222,35 @@ class XMLHttpRequestEventTargetP extends EventTargetP {
2227
2222
  throw new TypeError("Failed to construct 'XMLHttpRequestEventTarget': Illegal constructor");
2228
2223
  }
2229
2224
  super();
2230
- this[state$3] = new XMLHttpRequestEventTargetState(this);
2231
- }
2232
- get onabort() { return this[state$3].onabort; }
2233
- set onabort(value) { this[state$3].onabort = value; attach(this, "abort"); }
2234
- get onerror() { return this[state$3].onerror; }
2235
- set onerror(value) { this[state$3].onerror = value; attach(this, "error"); }
2236
- get onload() { return this[state$3].onload; }
2237
- set onload(value) { this[state$3].onload = value; attach(this, "load"); }
2238
- get onloadend() { return this[state$3].onloadend; }
2239
- set onloadend(value) { this[state$3].onloadend = value; attach(this, "loadend"); }
2240
- get onloadstart() { return this[state$3].onloadstart; }
2241
- set onloadstart(value) { this[state$3].onloadstart = value; attach(this, "loadstart"); }
2242
- get onprogress() { return this[state$3].onprogress; }
2243
- set onprogress(value) { this[state$3].onprogress = value; attach(this, "progress"); }
2244
- get ontimeout() { return this[state$3].ontimeout; }
2245
- set ontimeout(value) { this[state$3].ontimeout = value; attach(this, "timeout"); }
2225
+ this[state$6] = new XMLHttpRequestEventTargetState(this);
2226
+ }
2227
+ get onabort() { return this[state$6].onabort; }
2228
+ set onabort(value) { this[state$6].onabort = value; attach$1(this, "abort"); }
2229
+ get onerror() { return this[state$6].onerror; }
2230
+ set onerror(value) { this[state$6].onerror = value; attach$1(this, "error"); }
2231
+ get onload() { return this[state$6].onload; }
2232
+ set onload(value) { this[state$6].onload = value; attach$1(this, "load"); }
2233
+ get onloadend() { return this[state$6].onloadend; }
2234
+ set onloadend(value) { this[state$6].onloadend = value; attach$1(this, "loadend"); }
2235
+ get onloadstart() { return this[state$6].onloadstart; }
2236
+ set onloadstart(value) { this[state$6].onloadstart = value; attach$1(this, "loadstart"); }
2237
+ get onprogress() { return this[state$6].onprogress; }
2238
+ set onprogress(value) { this[state$6].onprogress = value; attach$1(this, "progress"); }
2239
+ get ontimeout() { return this[state$6].ontimeout; }
2240
+ set ontimeout(value) { this[state$6].ontimeout = value; attach$1(this, "timeout"); }
2246
2241
  /** @internal */ toString() { return "[object XMLHttpRequestEventTarget]"; }
2247
2242
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequestEventTarget", "EventTarget"] }; }
2248
2243
  }
2249
2244
  Class_setStringTag(XMLHttpRequestEventTargetP, "XMLHttpRequestEventTarget");
2250
2245
  /** @internal */
2251
- const _handlers$1 = Symbol();
2246
+ const _handlers$2 = Symbol();
2252
2247
  /** @internal */
2253
2248
  class XMLHttpRequestEventTargetState {
2254
2249
  /**
2255
2250
  * @param _target XMLHttpRequestEventTarget
2256
2251
  */
2257
2252
  constructor(_target) {
2258
- this[_a$1] = getHandlers$1(this);
2253
+ this[_a$2] = getHandlers$2(this);
2259
2254
  this.onabort = null;
2260
2255
  this.onerror = null;
2261
2256
  this.onload = null;
@@ -2266,15 +2261,15 @@ class XMLHttpRequestEventTargetState {
2266
2261
  this.target = _target;
2267
2262
  }
2268
2263
  }
2269
- _a$1 = _handlers$1;
2270
- function attach(target, type) {
2271
- const s = target[state$3];
2264
+ _a$2 = _handlers$2;
2265
+ function attach$1(target, type) {
2266
+ const s = target[state$6];
2272
2267
  const fnName = ("on" + type);
2273
2268
  const cb = s[fnName];
2274
- const listener = s[_handlers$1][fnName];
2269
+ const listener = s[_handlers$2][fnName];
2275
2270
  attachFn(target, type, cb, listener);
2276
2271
  }
2277
- function getHandlers$1(s) {
2272
+ function getHandlers$2(s) {
2278
2273
  return {
2279
2274
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
2280
2275
  onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
@@ -2381,59 +2376,62 @@ Class_setStringTag(XMLHttpRequestUploadP, "XMLHttpRequestUpload");
2381
2376
  /** @internal */
2382
2377
  function createXMLHttpRequestUpload() {
2383
2378
  let upload = Object.create(XMLHttpRequestUploadP.prototype);
2384
- upload[state$d] = new EventTargetState(upload);
2385
- upload[state$3] = new XMLHttpRequestEventTargetState(upload);
2379
+ upload[state$g] = new EventTargetState(upload);
2380
+ upload[state$6] = new XMLHttpRequestEventTargetState(upload);
2386
2381
  return upload;
2387
2382
  }
2388
2383
 
2389
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2390
- const mp$1 = { request: request };
2391
- const setRequest = (request) => { mp$1.request = request; };
2384
+ var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k;
2385
+ const mp$2 = { request: request };
2386
+ const setRequest = (request) => { mp$2.request = request; };
2392
2387
  /** @internal */
2393
- const state$2 = Symbol( /* "XMLHttpRequestState" */);
2388
+ const state$5 = Symbol( /* "XMLHttpRequestState" */);
2394
2389
  class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2395
2390
  constructor() {
2396
2391
  super();
2397
- this[state$2] = new XMLHttpRequestState(this);
2392
+ this[state$5] = new XMLHttpRequestState(this);
2398
2393
  }
2399
- get readyState() { return this[state$2].readyState; }
2400
- get response() { return this[state$2].response; }
2394
+ get readyState() { return this[state$5].readyState; }
2395
+ get response() { return this[state$5].response; }
2401
2396
  get responseText() { return (!this.responseType || this.responseType === "text") ? this.response : ""; }
2402
- get responseType() { return this[state$2].responseType; }
2403
- set responseType(value) { this[state$2].responseType = normalizeResponseType(value); }
2404
- get responseURL() { return this[state$2].responseURL; }
2397
+ get responseType() { return this[state$5].responseType; }
2398
+ set responseType(value) { this[state$5].responseType = normalizeResponseType(value); }
2399
+ get responseURL() { return this[state$5].responseURL; }
2405
2400
  get responseXML() { return null; }
2406
- get status() { return this[state$2].status; }
2401
+ get status() { return this[state$5].status; }
2407
2402
  get statusText() {
2408
2403
  if (this.readyState === XMLHttpRequestImpl.UNSENT || this.readyState === XMLHttpRequestImpl.OPENED)
2409
2404
  return "";
2410
- return this[state$2].statusText || statusTextMap(this.status);
2405
+ return this[state$5].statusText || statusTextMap(this.status);
2411
2406
  }
2412
- get timeout() { return this[state$2].timeout; }
2413
- set timeout(value) { this[state$2].timeout = value > 0 ? value : 0; }
2407
+ get timeout() { return this[state$5].timeout; }
2408
+ set timeout(value) { this[state$5].timeout = value > 0 ? value : 0; }
2414
2409
  get upload() {
2415
- const s = this[state$2];
2410
+ const s = this[state$5];
2416
2411
  if (!s.upload) {
2417
2412
  s.upload = createXMLHttpRequestUpload();
2418
2413
  }
2419
2414
  return s.upload;
2420
2415
  }
2421
- get withCredentials() { return this[state$2].withCredentials; }
2422
- set withCredentials(value) { this[state$2].withCredentials = !!value; }
2416
+ get withCredentials() { return this[state$5].withCredentials; }
2417
+ set withCredentials(value) { this[state$5].withCredentials = !!value; }
2423
2418
  abort() {
2424
2419
  clearRequest(this);
2425
2420
  }
2426
2421
  getAllResponseHeaders() {
2427
- if (!this[state$2][_responseHeaders])
2422
+ const headers = this[state$5][_responseHeaders];
2423
+ if (!headers)
2428
2424
  return "";
2429
- return Array.from(this[state$2][_responseHeaders].entries()).map(([k, v]) => `${k}: ${v}\r\n`).join("");
2425
+ let result = [];
2426
+ headers.forEach((value, name) => { result.push(`${name}: ${value}\r\n`); });
2427
+ return result.join("");
2430
2428
  }
2431
2429
  getResponseHeader(...args) {
2432
2430
  const [name] = args;
2433
2431
  checkArgsLength(args, 1, "XMLHttpRequest", "getResponseHeader");
2434
- if (!this[state$2][_responseHeaders])
2432
+ if (!this[state$5][_responseHeaders])
2435
2433
  return null;
2436
- return this[state$2][_responseHeaders].get(name);
2434
+ return this[state$5][_responseHeaders].get(name);
2437
2435
  }
2438
2436
  open(...args) {
2439
2437
  const [method, url, async = true, username = null, password = null] = args;
@@ -2441,7 +2439,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2441
2439
  if (!async) {
2442
2440
  console.warn("Synchronous XMLHttpRequest is not supported because of its detrimental effects to the end user's experience.");
2443
2441
  }
2444
- const s = this[state$2];
2442
+ const s = this[state$5];
2445
2443
  clearRequest(this, false);
2446
2444
  s[_method] = normalizeMethod(method);
2447
2445
  s[_requestURL] = "" + url;
@@ -2459,12 +2457,12 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2459
2457
  overrideMimeType(...args) {
2460
2458
  const [mime] = args;
2461
2459
  checkArgsLength(args, 1, "XMLHttpRequest", "overrideMimeType");
2462
- if (this[state$2][_inAfterOpenBeforeSend]) {
2460
+ if (this[state$5][_inAfterOpenBeforeSend]) {
2463
2461
  console.error(`TypeError: Failed to execute 'overrideMimeType' on 'XMLHttpRequest': mimeType ('${mime}') not implemented.`);
2464
2462
  }
2465
2463
  }
2466
2464
  send(body) {
2467
- const s = this[state$2];
2465
+ const s = this[state$5];
2468
2466
  if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
2469
2467
  throw new MPException("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
2470
2468
  }
@@ -2497,7 +2495,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2497
2495
  };
2498
2496
  // Alipay Mini Program
2499
2497
  options.headers = options.header;
2500
- s[_requestTask] = mp$1.request(options);
2498
+ s[_requestTask] = mp$2.request(options);
2501
2499
  emitProcessEvent(this, "loadstart");
2502
2500
  if (processContentLength && s.upload) {
2503
2501
  emitProcessEvent(this.upload, "loadstart", 0, contentLength);
@@ -2524,7 +2522,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2524
2522
  setRequestHeader(...args) {
2525
2523
  const [name, value] = args;
2526
2524
  checkArgsLength(args, 2, "XMLHttpRequest", "setRequestHeader");
2527
- const s = this[state$2];
2525
+ const s = this[state$5];
2528
2526
  if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
2529
2527
  throw new MPException("Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
2530
2528
  }
@@ -2533,10 +2531,10 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2533
2531
  });
2534
2532
  s[_requestHeaders].append(_name, value);
2535
2533
  }
2536
- get onreadystatechange() { return this[state$2].onreadystatechange; }
2534
+ get onreadystatechange() { return this[state$5].onreadystatechange; }
2537
2535
  set onreadystatechange(value) {
2538
- this[state$2].onreadystatechange = value;
2539
- attachFn(this, "readystatechange", value, this[state$2][_handlers].onreadystatechange);
2536
+ this[state$5].onreadystatechange = value;
2537
+ attachFn(this, "readystatechange", value, this[state$5][_handlers$1].onreadystatechange);
2540
2538
  }
2541
2539
  /** @internal */ toString() { return "[object XMLHttpRequest]"; }
2542
2540
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequest", "XMLHttpRequestEventTarget", "EventTarget"] }; }
@@ -2544,7 +2542,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2544
2542
  Object.defineProperties(XMLHttpRequestImpl, XHR_properties);
2545
2543
  Object.defineProperties(XMLHttpRequestImpl.prototype, XHR_properties);
2546
2544
  Class_setStringTag(XMLHttpRequestImpl, "XMLHttpRequest");
2547
- /** @internal */ const _handlers = Symbol();
2545
+ /** @internal */ const _handlers$1 = Symbol();
2548
2546
  /** @internal */ const _inAfterOpenBeforeSend = Symbol();
2549
2547
  /** @internal */ const _resetPending = Symbol();
2550
2548
  /** @internal */ const _timeoutId = Symbol();
@@ -2565,9 +2563,9 @@ class XMLHttpRequestState {
2565
2563
  this.statusText = "";
2566
2564
  this.timeout = 0;
2567
2565
  this.withCredentials = false;
2568
- this[_a] = getHandlers(this);
2566
+ this[_a$1] = getHandlers$1(this);
2569
2567
  this.onreadystatechange = null;
2570
- this[_b] = false;
2568
+ this[_b$1] = false;
2571
2569
  this[_c] = false;
2572
2570
  this[_d] = 0;
2573
2571
  this[_e] = "";
@@ -2579,8 +2577,8 @@ class XMLHttpRequestState {
2579
2577
  this.target = target;
2580
2578
  }
2581
2579
  }
2582
- _a = _handlers, _b = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
2583
- function getHandlers(s) {
2580
+ _a$1 = _handlers$1, _b$1 = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
2581
+ function getHandlers$1(s) {
2584
2582
  return {
2585
2583
  onreadystatechange: (ev) => { executeFn(s.target, s.onreadystatechange, ev); },
2586
2584
  };
@@ -2589,7 +2587,7 @@ function normalizeDataType(responseType) {
2589
2587
  return (responseType === "blob" || responseType === "arraybuffer") ? "arraybuffer" : "text";
2590
2588
  }
2591
2589
  function requestSuccess(res) {
2592
- const s = this[state$2];
2590
+ const s = this[state$5];
2593
2591
  s.responseURL = s[_requestURL];
2594
2592
  s.status = "statusCode" in res ? res.statusCode : "status" in res ? res.status : 200;
2595
2593
  s[_responseHeaders] = new HeadersP(("header" in res ? res.header : "headers" in res ? res.headers : undefined));
@@ -2630,7 +2628,7 @@ function requestFail(err) {
2630
2628
  });
2631
2629
  return;
2632
2630
  }
2633
- const s = this[state$2];
2631
+ const s = this[state$5];
2634
2632
  s.status = 0;
2635
2633
  s.statusText = "errMsg" in err ? err.errMsg : "errorMessage" in err ? err.errorMessage : "";
2636
2634
  if (!s[_inAfterOpenBeforeSend] && s.readyState !== XMLHttpRequestImpl.UNSENT && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2639,7 +2637,7 @@ function requestFail(err) {
2639
2637
  }
2640
2638
  }
2641
2639
  function requestComplete() {
2642
- const s = this[state$2];
2640
+ const s = this[state$5];
2643
2641
  s[_requestTask] = null;
2644
2642
  if (!s[_inAfterOpenBeforeSend] && (s.readyState === XMLHttpRequestImpl.OPENED || s.readyState === XMLHttpRequestImpl.LOADING)) {
2645
2643
  setReadyStateAndNotify(this, XMLHttpRequestImpl.DONE);
@@ -2658,7 +2656,7 @@ function safeAbort(task) {
2658
2656
  }
2659
2657
  }
2660
2658
  function clearRequest(xhr, delay = true) {
2661
- const s = xhr[state$2];
2659
+ const s = xhr[state$5];
2662
2660
  const timerFn = delay ? setTimeout : (f) => { f(); };
2663
2661
  s[_resetPending] = true;
2664
2662
  if (s[_requestTask] && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2688,7 +2686,7 @@ function clearRequest(xhr, delay = true) {
2688
2686
  });
2689
2687
  }
2690
2688
  function checkRequestTimeout(xhr) {
2691
- const s = xhr[state$2];
2689
+ const s = xhr[state$5];
2692
2690
  if (s.timeout) {
2693
2691
  s[_timeoutId] = setTimeout(() => {
2694
2692
  if (!s.status && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2701,7 +2699,7 @@ function checkRequestTimeout(xhr) {
2701
2699
  }
2702
2700
  }
2703
2701
  function resetXHR(xhr) {
2704
- const s = xhr[state$2];
2702
+ const s = xhr[state$5];
2705
2703
  s[_resetPending] = false;
2706
2704
  resetRequestTimeout(xhr);
2707
2705
  s.response = "";
@@ -2713,14 +2711,14 @@ function resetXHR(xhr) {
2713
2711
  s[_responseContentLength] = () => 0;
2714
2712
  }
2715
2713
  function resetRequestTimeout(xhr) {
2716
- const s = xhr[state$2];
2714
+ const s = xhr[state$5];
2717
2715
  if (s[_timeoutId]) {
2718
2716
  clearTimeout(s[_timeoutId]);
2719
2717
  s[_timeoutId] = 0;
2720
2718
  }
2721
2719
  }
2722
2720
  function setReadyStateAndNotify(xhr, value) {
2723
- const s = xhr[state$2];
2721
+ const s = xhr[state$5];
2724
2722
  let hasChanged = value !== s.readyState;
2725
2723
  s.readyState = value;
2726
2724
  if (hasChanged) {
@@ -2732,13 +2730,13 @@ function setReadyStateAndNotify(xhr, value) {
2732
2730
  const XMLHttpRequestP = XMLHttpRequestImpl;
2733
2731
  const XMLHttpRequestE = (typeof XMLHttpRequest !== "undefined" && XMLHttpRequest) || XMLHttpRequestP;
2734
2732
 
2735
- /** @internal */ const state$1 = Symbol( /* "ResponseState" */);
2733
+ /** @internal */ const state$4 = Symbol( /* "ResponseState" */);
2736
2734
  class ResponseP extends BodyImpl {
2737
2735
  constructor(body, init) {
2738
2736
  super();
2739
- this[state$7].name = "Response";
2740
- this[state$1] = new ResponseState();
2741
- const s = this[state$1];
2737
+ this[state$a].name = "Response";
2738
+ this[state$4] = new ResponseState();
2739
+ const s = this[state$4];
2742
2740
  let _init = init !== null && init !== void 0 ? init : {};
2743
2741
  if (typeof _init !== "object") {
2744
2742
  throw new TypeError("Failed to construct 'Response': The provided value is not of type 'ResponseInit'.");
@@ -2756,18 +2754,18 @@ class ResponseP extends BodyImpl {
2756
2754
  Body_init(this, body);
2757
2755
  }
2758
2756
  get headers() {
2759
- const s = this[state$1];
2757
+ const s = this[state$4];
2760
2758
  if (!s.headers) {
2761
2759
  s.headers = new HeadersP();
2762
2760
  }
2763
2761
  return s.headers;
2764
2762
  }
2765
- get ok() { return this[state$1].ok; }
2766
- get redirected() { return this[state$1].redirected; }
2767
- get status() { return this[state$1].status; }
2768
- get statusText() { return this[state$1].statusText; }
2769
- get type() { return this[state$1].type; }
2770
- get url() { return this[state$1].url; }
2763
+ get ok() { return this[state$4].ok; }
2764
+ get redirected() { return this[state$4].redirected; }
2765
+ get status() { return this[state$4].status; }
2766
+ get statusText() { return this[state$4].statusText; }
2767
+ get type() { return this[state$4].type; }
2768
+ get url() { return this[state$4].url; }
2771
2769
  clone() {
2772
2770
  if (this.bodyUsed) {
2773
2771
  throw new TypeError("Failed to execute 'clone' on 'Response': Response body is already used");
@@ -2777,7 +2775,7 @@ class ResponseP extends BodyImpl {
2777
2775
  status: this.status,
2778
2776
  statusText: this.statusText,
2779
2777
  });
2780
- response[state$1].url = this.url;
2778
+ response[state$4].url = this.url;
2781
2779
  return response;
2782
2780
  }
2783
2781
  static json(...args) {
@@ -2789,9 +2787,9 @@ class ResponseP extends BodyImpl {
2789
2787
  }
2790
2788
  static error() {
2791
2789
  let response = new ResponseP(null, { status: 200, statusText: "" });
2792
- response[state$1].ok = false;
2793
- response[state$1].status = 0;
2794
- response[state$1].type = "error";
2790
+ response[state$4].ok = false;
2791
+ response[state$4].status = 0;
2792
+ response[state$4].type = "error";
2795
2793
  return response;
2796
2794
  }
2797
2795
  static redirect(...args) {
@@ -2819,8 +2817,8 @@ class ResponseState {
2819
2817
  }
2820
2818
  const ResponseE = g["Response"] || ResponseP;
2821
2819
 
2822
- const mp = { XMLHttpRequest: XMLHttpRequestE };
2823
- const setXMLHttpRequest = (XHR) => { mp.XMLHttpRequest = XHR; };
2820
+ const mp$1 = { XMLHttpRequest: XMLHttpRequestE };
2821
+ const setXMLHttpRequest = (XHR) => { mp$1.XMLHttpRequest = XHR; };
2824
2822
  function fetchP(...args) {
2825
2823
  if (new.target === fetchP) {
2826
2824
  throw new TypeError("fetch is not a constructor");
@@ -2829,11 +2827,11 @@ function fetchP(...args) {
2829
2827
  checkArgsLength(args, 1, "Window", "fetch");
2830
2828
  return new Promise((resolve, reject) => {
2831
2829
  const request = new RequestP(input, init);
2832
- const signal = request[state$4].signal;
2830
+ const signal = request[state$7].signal;
2833
2831
  if (signal && signal.aborted) {
2834
2832
  return reject(signal.reason);
2835
2833
  }
2836
- let xhr = new mp.XMLHttpRequest();
2834
+ let xhr = new mp$1.XMLHttpRequest();
2837
2835
  xhr.onload = function () {
2838
2836
  let options = {
2839
2837
  headers: parseHeaders(xhr.getAllResponseHeaders() || ""),
@@ -2847,7 +2845,7 @@ function fetchP(...args) {
2847
2845
  }
2848
2846
  setTimeout(() => {
2849
2847
  let response = new ResponseP("response" in xhr ? xhr.response : xhr.responseText, options);
2850
- response[state$1].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
2848
+ response[state$4].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
2851
2849
  resolve(response);
2852
2850
  });
2853
2851
  };
@@ -2910,24 +2908,24 @@ function fetchP(...args) {
2910
2908
  }
2911
2909
  const fetchE = g["fetch"] || fetchP;
2912
2910
 
2913
- const dispatched = 1;
2911
+ const dispatched$1 = 1;
2914
2912
  /** @internal */
2915
- const state = Symbol( /* "CustomEventState" */);
2913
+ const state$3 = Symbol( /* "CustomEventState" */);
2916
2914
  class CustomEventP extends EventP {
2917
2915
  constructor(type, eventInitDict) {
2918
2916
  var _a;
2919
2917
  super(type, eventInitDict);
2920
- this[state] = new CustomEventState();
2921
- this[state].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
2918
+ this[state$3] = new CustomEventState();
2919
+ this[state$3].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
2922
2920
  }
2923
- get detail() { return this[state].detail; }
2921
+ get detail() { return this[state$3].detail; }
2924
2922
  initCustomEvent(...args) {
2925
2923
  const [type, bubbles, cancelable, detail] = args;
2926
2924
  checkArgsLength(args, 1, "CustomEvent", "initCustomEvent");
2927
- if (Event_getEtField(this, dispatched))
2925
+ if (Event_getEtField(this, dispatched$1))
2928
2926
  return;
2929
2927
  this.initEvent(type, bubbles, cancelable);
2930
- this[state].detail = detail !== null && detail !== void 0 ? detail : null;
2928
+ this[state$3].detail = detail !== null && detail !== void 0 ? detail : null;
2931
2929
  }
2932
2930
  /** @internal */ toString() { return "[object CustomEvent]"; }
2933
2931
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CustomEvent", "Event"] }; }
@@ -2938,4 +2936,316 @@ class CustomEventState {
2938
2936
  }
2939
2937
  const CustomEventE = g["EventTarget"] ? g["CustomEvent"] : CustomEventP;
2940
2938
 
2941
- export { AbortControllerE as AbortController, AbortControllerP, AbortSignalE as AbortSignal, AbortSignalP, BlobE as Blob, BlobP, CustomEventE as CustomEvent, CustomEventP, EventE as Event, EventP, EventTargetE as EventTarget, EventTargetP, FileE as File, FileP, FileReaderE as FileReader, FileReaderP, FormDataE as FormData, FormDataP, HeadersE as Headers, HeadersP, ProgressEventE as ProgressEvent, ProgressEventP, RequestE as Request, RequestP, ResponseE as Response, ResponseP, TextDecoderE as TextDecoder, TextDecoderP, TextEncoderE as TextEncoder, TextEncoderP, URLSearchParamsE as URLSearchParams, URLSearchParamsP, XMLHttpRequestE as XMLHttpRequest, XMLHttpRequestP, fetchE as fetch, fetchP, setRequest, setXMLHttpRequest };
2939
+ /** @internal */
2940
+ const state$2 = Symbol( /* "CloseEventState" */);
2941
+ class CloseEventP extends EventP {
2942
+ constructor(type, eventInitDict) {
2943
+ var _a;
2944
+ super(type, eventInitDict);
2945
+ this[state$2] = new CloseEventState();
2946
+ const s = this[state$2];
2947
+ let _code = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.code) !== null && _a !== void 0 ? _a : 0);
2948
+ s.code = isNaN(_code) ? 0 : _code;
2949
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.reason) !== undefined)
2950
+ s.reason = "" + eventInitDict.reason;
2951
+ s.wasClean = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.wasClean);
2952
+ }
2953
+ get code() { return this[state$2].code; }
2954
+ get reason() { return this[state$2].reason; }
2955
+ get wasClean() { return this[state$2].wasClean; }
2956
+ /** @internal */ toString() { return "[object CloseEvent]"; }
2957
+ /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CloseEvent", "Event"] }; }
2958
+ }
2959
+ Class_setStringTag(CloseEventP, "CloseEvent");
2960
+ /** @internal */
2961
+ class CloseEventState {
2962
+ constructor() {
2963
+ this.code = 0;
2964
+ this.reason = "";
2965
+ this.wasClean = false;
2966
+ }
2967
+ }
2968
+ g["EventTarget"] ? g["CloseEvent"] : CloseEventP;
2969
+
2970
+ const dispatched = 1;
2971
+ /** @internal */
2972
+ const state$1 = Symbol( /* "MessageEventState" */);
2973
+ class MessageEventP extends EventP {
2974
+ constructor(type, eventInitDict) {
2975
+ var _a;
2976
+ super(type, eventInitDict);
2977
+ this[state$1] = new MessageEventState();
2978
+ const s = this[state$1];
2979
+ s.data = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.data) !== null && _a !== void 0 ? _a : null;
2980
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.origin) !== undefined)
2981
+ s.origin = "" + eventInitDict.origin;
2982
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lastEventId) !== undefined)
2983
+ s.lastEventId = "" + eventInitDict.lastEventId;
2984
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.source) !== undefined)
2985
+ s.source = eventInitDict.source;
2986
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.ports) !== undefined)
2987
+ s.ports = eventInitDict.ports;
2988
+ }
2989
+ get data() { return this[state$1].data; }
2990
+ get lastEventId() { return this[state$1].lastEventId; }
2991
+ get origin() { return this[state$1].origin; }
2992
+ get ports() { return this[state$1].ports; }
2993
+ get source() { return this[state$1].source; }
2994
+ initMessageEvent(...args) {
2995
+ const [type, bubbles, cancelable, data, origin, lastEventId, source, ports] = args;
2996
+ checkArgsLength(args, 1, "MessageEvent", "initMessageEvent");
2997
+ if (Event_getEtField(this, dispatched))
2998
+ return;
2999
+ this.initEvent(type, bubbles, cancelable);
3000
+ const s = this[state$1];
3001
+ s.data = data !== null && data !== void 0 ? data : null;
3002
+ if (origin !== undefined)
3003
+ s.origin = "" + origin;
3004
+ if (lastEventId !== undefined)
3005
+ s.lastEventId = "" + lastEventId;
3006
+ if (source !== undefined)
3007
+ s.source = source;
3008
+ if (ports !== undefined)
3009
+ s.ports = ports;
3010
+ }
3011
+ /** @internal */ toString() { return "[object MessageEvent]"; }
3012
+ /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["MessageEvent", "Event"] }; }
3013
+ }
3014
+ Class_setStringTag(MessageEventP, "MessageEvent");
3015
+ /** @internal */
3016
+ class MessageEventState {
3017
+ constructor() {
3018
+ this.data = null;
3019
+ this.lastEventId = "";
3020
+ this.origin = "";
3021
+ this.ports = [];
3022
+ this.source = null;
3023
+ }
3024
+ }
3025
+ g["EventTarget"] ? g["MessageEvent"] : MessageEventP;
3026
+
3027
+ const connectSocket = mp$3 ? mp$3.connectSocket : function errorConnectSocket(options) {
3028
+ return {
3029
+ send(obj) { },
3030
+ close(obj) { },
3031
+ onOpen(listener) { },
3032
+ onMessage(listener) { },
3033
+ onError(listener) {
3034
+ if (typeof listener === "function") {
3035
+ listener({ errMsg: "NOT_SUPPORTED_ERR" });
3036
+ }
3037
+ },
3038
+ onClose(listener) {
3039
+ if (typeof listener === "function") {
3040
+ setTimeout(() => { listener({ code: 3009, reason: "NOT_SUPPORTED_ERR" }); });
3041
+ }
3042
+ },
3043
+ };
3044
+ };
3045
+
3046
+ var _a, _b;
3047
+ const mp = { connectSocket: connectSocket };
3048
+ const setConnectSocket = (connectSocket) => { mp.connectSocket = connectSocket; };
3049
+ /** @internal */
3050
+ const state = Symbol( /* "WebSocketState" */);
3051
+ class WebSocketImpl extends EventTargetP {
3052
+ constructor(...args) {
3053
+ const [url, protocols] = args;
3054
+ checkArgsLength(args, 1, "WebSocket");
3055
+ super();
3056
+ this[state] = new WebSocketState(this, {
3057
+ url: "" + url,
3058
+ protocols: protocols !== undefined
3059
+ ? (Array.isArray(protocols) || (protocols && typeof protocols === "object" && Symbol.iterator in protocols))
3060
+ ? Array.isArray(protocols) ? protocols : Array.from(protocols)
3061
+ : ["" + protocols]
3062
+ : [],
3063
+ multiple: true, // Alipay Mini Program
3064
+ fail(err) { console.error(err); },
3065
+ });
3066
+ let socketTask = this[state][_socketTask];
3067
+ if (socketTask && typeof socketTask === "object") {
3068
+ onOpen(this);
3069
+ onClose(this);
3070
+ onError(this);
3071
+ onMessage(this);
3072
+ }
3073
+ else {
3074
+ throw new Error(`connectSocket can't establish a connection to the server at ${"" + url}.`);
3075
+ }
3076
+ }
3077
+ get binaryType() { return this[state].binaryType; }
3078
+ set binaryType(value) { if (value === "blob" || value === "arraybuffer") {
3079
+ this[state].binaryType = value;
3080
+ } }
3081
+ get bufferedAmount() { return this[state].bufferedAmount; }
3082
+ get extensions() { return this[state].extensions; }
3083
+ get protocol() { return this[state].protocol; }
3084
+ get readyState() { return this[state].readyState; }
3085
+ get url() { return this[state].url; }
3086
+ close(code, reason) {
3087
+ if (this.readyState === WebSocketImpl.CLOSING || this.readyState === WebSocketImpl.CLOSED)
3088
+ return;
3089
+ this[state].readyState = WebSocketImpl.CLOSING;
3090
+ this[state][_socketTask].close({
3091
+ code: code,
3092
+ reason: reason,
3093
+ fail(err) { console.error(err); },
3094
+ complete: (function () {
3095
+ this[state].readyState = WebSocketImpl.CLOSED;
3096
+ }).bind(this),
3097
+ });
3098
+ }
3099
+ send(...args) {
3100
+ const [data] = args;
3101
+ checkArgsLength(args, 1, "WebSocket", "send");
3102
+ if (this.readyState === WebSocketImpl.CONNECTING) {
3103
+ throw new MPException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
3104
+ }
3105
+ if (this.readyState === WebSocketImpl.CLOSING || this.readyState === WebSocketImpl.CLOSED) {
3106
+ return console.error("WebSocket is already in CLOSING or CLOSED state.");
3107
+ }
3108
+ let _data;
3109
+ if (data instanceof ArrayBuffer) {
3110
+ _data = data;
3111
+ }
3112
+ else if (ArrayBuffer.isView(data)) {
3113
+ _data = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
3114
+ }
3115
+ else if (isPolyfillType("Blob", data)) {
3116
+ _data = Blob_toUint8Array(data).buffer.slice(0);
3117
+ }
3118
+ else {
3119
+ _data = "" + data;
3120
+ }
3121
+ this[state][_socketTask].send({
3122
+ data: _data,
3123
+ fail(err) { console.error(err); },
3124
+ });
3125
+ }
3126
+ get onclose() { return this[state].onclose; }
3127
+ set onclose(value) { this[state].onclose = value; attach(this, "close"); }
3128
+ get onerror() { return this[state].onerror; }
3129
+ set onerror(value) { this[state].onerror = value; attach(this, "error"); }
3130
+ get onmessage() { return this[state].onmessage; }
3131
+ set onmessage(value) { this[state].onmessage = value; attach(this, "message"); }
3132
+ get onopen() { return this[state].onopen; }
3133
+ set onopen(value) { this[state].onopen = value; attach(this, "open"); }
3134
+ /** @internal */ toString() { return "[object WebSocket]"; }
3135
+ /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["WebSocket", "EventTarget"] }; }
3136
+ }
3137
+ const properties = {
3138
+ CONNECTING: { value: 0, enumerable: true },
3139
+ OPEN: { value: 1, enumerable: true },
3140
+ CLOSING: { value: 2, enumerable: true },
3141
+ CLOSED: { value: 3, enumerable: true },
3142
+ };
3143
+ Object.defineProperties(WebSocketImpl, properties);
3144
+ Object.defineProperties(WebSocketImpl.prototype, properties);
3145
+ Class_setStringTag(WebSocketImpl, "WebSocket");
3146
+ /** @internal */ const _socketTask = Symbol();
3147
+ /** @internal */ const _error = Symbol();
3148
+ /** @internal */ const _handlers = Symbol();
3149
+ /** @internal */
3150
+ class WebSocketState {
3151
+ constructor(target, opts) {
3152
+ this.binaryType = "blob";
3153
+ this.bufferedAmount = 0;
3154
+ this.extensions = "";
3155
+ this.protocol = "";
3156
+ this.readyState = 0;
3157
+ this[_a] = null;
3158
+ this[_b] = getHandlers(this);
3159
+ this.onclose = null;
3160
+ this.onerror = null;
3161
+ this.onmessage = null;
3162
+ this.onopen = null;
3163
+ this.target = target;
3164
+ this.url = opts.url;
3165
+ this[_socketTask] = mp.connectSocket(opts);
3166
+ }
3167
+ }
3168
+ _a = _error, _b = _handlers;
3169
+ function attach(target, type) {
3170
+ const s = target[state];
3171
+ const fnName = ("on" + type);
3172
+ const cb = s[fnName];
3173
+ const listener = s[_handlers][fnName];
3174
+ attachFn(target, type, cb, listener);
3175
+ }
3176
+ function getHandlers(s) {
3177
+ return {
3178
+ onclose: (ev) => { executeFn(s.target, s.onclose, ev); },
3179
+ onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
3180
+ onmessage: (ev) => { executeFn(s.target, s.onmessage, ev); },
3181
+ onopen: (ev) => { executeFn(s.target, s.onopen, ev); },
3182
+ };
3183
+ }
3184
+ function onOpen(ws) {
3185
+ let _ws = ws;
3186
+ _ws[state][_socketTask].onOpen(res => {
3187
+ if ("header" in res && res.header && typeof res.header === "object") {
3188
+ let headers = new HeadersP(res.header);
3189
+ _ws[state].protocol = headers.get("Sec-WebSocket-Protocol") || "";
3190
+ }
3191
+ _ws[state].readyState = WebSocketImpl.OPEN;
3192
+ EventTarget_fire(_ws, createInnerEvent(_ws, "open"));
3193
+ });
3194
+ }
3195
+ function onClose(ws) {
3196
+ let _ws = ws;
3197
+ _ws[state][_socketTask].onClose(res => {
3198
+ _ws[state].readyState = WebSocketImpl.CLOSED;
3199
+ let event = new CloseEventP("close", {
3200
+ wasClean: !_ws[state][_error],
3201
+ code: res.code,
3202
+ reason: res.reason,
3203
+ });
3204
+ Event_setTrusted(event, true);
3205
+ EventTarget_fire(_ws, event);
3206
+ });
3207
+ }
3208
+ function onError(ws) {
3209
+ let _ws = ws;
3210
+ _ws[state][_socketTask].onError(res => {
3211
+ console.error(res);
3212
+ _ws[state][_error] = res;
3213
+ _ws[state].readyState = WebSocketImpl.CLOSED;
3214
+ EventTarget_fire(_ws, createInnerEvent(_ws, "error"));
3215
+ });
3216
+ }
3217
+ function onMessage(ws) {
3218
+ let _ws = ws;
3219
+ _ws[state][_socketTask].onMessage(res => {
3220
+ let data = res.data;
3221
+ let _data;
3222
+ // Alipay Mini Program
3223
+ if (data && typeof data === "object" && "data" in data) {
3224
+ _data = data.data;
3225
+ if ("isBuffer" in data && data.isBuffer && typeof _data === "string") {
3226
+ // @ts-ignore
3227
+ try {
3228
+ _data = my.base64ToArrayBuffer(_data);
3229
+ }
3230
+ catch (e) { }
3231
+ }
3232
+ }
3233
+ else {
3234
+ _data = data;
3235
+ }
3236
+ if (_data instanceof ArrayBuffer && _ws.binaryType === "blob") {
3237
+ _data = new BlobP([_data]);
3238
+ }
3239
+ let event = new MessageEventP("message", {
3240
+ data: _data,
3241
+ origin: _ws.url,
3242
+ });
3243
+ Event_setTrusted(event, true);
3244
+ EventTarget_fire(_ws, event);
3245
+ });
3246
+ }
3247
+
3248
+ const WebSocketP = WebSocketImpl;
3249
+ const WebSocketE = (typeof WebSocket !== "undefined" && WebSocket) || WebSocketP;
3250
+
3251
+ export { AbortControllerE as AbortController, AbortControllerP, AbortSignalE as AbortSignal, AbortSignalP, BlobE as Blob, BlobP, CustomEventE as CustomEvent, CustomEventP, EventE as Event, EventP, EventTargetE as EventTarget, EventTargetP, FileE as File, FileP, FileReaderE as FileReader, FileReaderP, FormDataE as FormData, FormDataP, HeadersE as Headers, HeadersP, RequestE as Request, RequestP, ResponseE as Response, ResponseP, TextDecoderE as TextDecoder, TextDecoderP, TextEncoderE as TextEncoder, TextEncoderP, URLSearchParamsE as URLSearchParams, URLSearchParamsP, WebSocketE as WebSocket, WebSocketP, XMLHttpRequestE as XMLHttpRequest, XMLHttpRequestP, fetchE as fetch, fetchP, setConnectSocket, setRequest, setXMLHttpRequest };