@applitools/eyes-browser 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/dist/index.js +85 -3851
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -80358,15 +80358,15 @@ var require_captureDomPollCjs = __commonJS({
80358
80358
  const o2 = [];
80359
80359
  let r2 = 0;
80360
80360
  for (let s2 = 0; s2 < e4.length; ++s2) {
80361
- const a2 = n2(e4, s2);
80362
- let c2 = 0;
80363
- a2 > 0 && (c2 = a2 < 128 ? 1 : a2 < 2048 ? 2 : a2 < 65536 ? 3 : a2 < 2097152 ? 4 : a2 < 67108864 ? 5 : 6), r2 + c2 > t4 ? (o2.push(s2), r2 = c2) : r2 += c2;
80361
+ const c2 = n2(e4, s2);
80362
+ let a2 = 0;
80363
+ c2 > 0 && (a2 = c2 < 128 ? 1 : c2 < 2048 ? 2 : c2 < 65536 ? 3 : c2 < 2097152 ? 4 : c2 < 67108864 ? 5 : 6), r2 + a2 > t4 ? (o2.push(s2), r2 = a2) : r2 += a2;
80364
80364
  }
80365
80365
  return o2;
80366
80366
  };
80367
80367
  const r = function(e4) {
80368
80368
  return e4 && e4.__esModule ? e4 : { default: e4 };
80369
- }(o), s = "WIP", a = "SUCCESS", c = "SUCCESS_CHUNKED", u = "ERROR";
80369
+ }(o), s = "WIP", c = "SUCCESS", a = "SUCCESS_CHUNKED", u = "ERROR";
80370
80370
  var i = function(e4, t4, n3 = {}) {
80371
80371
  const o2 = function(e5, { chunkByteLength: t5 = 0 } = {}) {
80372
80372
  if (e5) {
@@ -80380,15 +80380,15 @@ var require_captureDomPollCjs = __commonJS({
80380
80380
  return { status: u, error: e6.message };
80381
80381
  }
80382
80382
  if (e5.from >= 0)
80383
- return { status: c, value: e5.value.substring(e5.from, e5.from = e5.chunks.shift()), done: !e5.from };
80383
+ return { status: a, value: e5.value.substring(e5.from, e5.from = e5.chunks.shift()), done: !e5.from };
80384
80384
  }
80385
- return { status: a, value: e5.value };
80385
+ return { status: c, value: e5.value };
80386
80386
  }
80387
80387
  return e5.error ? { status: u, error: e5.error } : { status: s };
80388
80388
  }
80389
80389
  return { status: u, error: "unexpected poll request received - cannot find state of current operation" };
80390
80390
  }((e4 = e4 || {})[t4], n3);
80391
- return (o2.status === a || o2.status === u || o2.status === c && o2.done) && delete e4[t4], o2;
80391
+ return (o2.status === c || o2.status === u || o2.status === a && o2.done) && delete e4[t4], o2;
80392
80392
  };
80393
80393
  const l = i;
80394
80394
  var d = function(e4) {
@@ -80483,25 +80483,25 @@ var require_captureDomPollCjs = __commonJS({
80483
80483
  n3 = `${o2.tagName}[${T(o2)}]/${n3}`, o2 = o2.parentNode;
80484
80484
  return s2 && (n3 = `${e4(s2)},${n3}`), n3.replace(/\/$/, "");
80485
80485
  }, x = function({ parseCss: e4, CSSImportRule: t4, absolutizeUrl: n3, getCssFromCache: o2, unfetchedToken: r2 }) {
80486
- return function s2(a2, c2) {
80486
+ return function s2(c2, a2) {
80487
80487
  let u2, i2 = "";
80488
80488
  try {
80489
- const l3 = e4(a2);
80489
+ const l3 = e4(c2);
80490
80490
  for (const e5 of Array.from(l3.cssRules))
80491
80491
  if (e5 instanceof t4) {
80492
- const t5 = n3(e5.href, c2), a3 = o2(t5);
80493
- if (void 0 !== a3) {
80494
- const { bundledCss: e6, unfetchedResources: n4 } = s2(a3, t5);
80492
+ const t5 = n3(e5.href, a2), c3 = o2(t5);
80493
+ if (void 0 !== c3) {
80494
+ const { bundledCss: e6, unfetchedResources: n4 } = s2(c3, t5);
80495
80495
  n4 && (u2 = new Set(n4)), i2 = `${i2}${e6}`;
80496
80496
  } else
80497
80497
  u2 = /* @__PURE__ */ new Set([t5]), i2 = `
80498
80498
  ${r2}${t5}${r2}`;
80499
80499
  }
80500
80500
  } catch (e5) {
80501
- console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c2}`, e5);
80501
+ console.log(`error during getBundledCssFromCssText, styleBaseUrl=${a2}`, e5);
80502
80502
  }
80503
80503
  var l2, d2;
80504
- return i2 = `${i2}${l2 = a2, d2 = c2, `
80504
+ return i2 = `${i2}${l2 = c2, d2 = a2, `
80505
80505
  /** ${d2} **/
80506
80506
  ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80507
80507
  };
@@ -80532,43 +80532,52 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80532
80532
  };
80533
80533
  }, B = function({ getCssFromCache: e4, absolutizeUrl: t4 }) {
80534
80534
  return function(n3, o2) {
80535
- let r2, s2, a2;
80535
+ let r2, s2, c2;
80536
80536
  if (n3 && function(e5) {
80537
80537
  return e5.nodeName && "STYLE" === e5.nodeName.toUpperCase();
80538
80538
  }(n3))
80539
80539
  r2 = Array.from(n3.childNodes).map((e5) => e5.nodeValue).join(""), s2 = o2;
80540
80540
  else if (n3 && _(n3)) {
80541
- const c2 = A(n3);
80542
- c2 ? function(e5) {
80543
- return e5 && e5.startsWith("data:");
80544
- }(c2) ? (s2 = o2, r2 = c2.match(/,(.+)/)[1]) : (s2 = t4(c2, o2), r2 = e4(s2)) : r2 = "", a2 = void 0 === r2;
80541
+ const a2 = A(n3);
80542
+ if (a2)
80543
+ if (function(e5) {
80544
+ return e5 && e5.startsWith("data:");
80545
+ }(a2)) {
80546
+ s2 = o2;
80547
+ const e5 = a2.match(/,(.*)/);
80548
+ r2 = e5 ? e5[1] : "";
80549
+ } else
80550
+ s2 = t4(a2, o2), r2 = e4(s2);
80551
+ else
80552
+ r2 = "";
80553
+ c2 = void 0 === r2;
80545
80554
  }
80546
- return { cssText: r2, styleBaseUrl: s2, isUnfetched: a2 };
80555
+ return { cssText: r2, styleBaseUrl: s2, isUnfetched: c2 };
80547
80556
  };
80548
80557
  }, Y = function({ extractCssFromNode: e4, getBundledCssFromCssText: t4, unfetchedToken: n3 }) {
80549
80558
  return function(o2, r2) {
80550
- const { styleBaseUrl: s2, cssText: a2, isUnfetched: c2 } = e4(o2, r2);
80559
+ const { styleBaseUrl: s2, cssText: c2, isUnfetched: a2 } = e4(o2, r2);
80551
80560
  let u2, i2 = "";
80552
- if (a2) {
80553
- const { bundledCss: e5, unfetchedResources: n4 } = t4(a2, s2);
80561
+ if (c2) {
80562
+ const { bundledCss: e5, unfetchedResources: n4 } = t4(c2, s2);
80554
80563
  i2 += e5, u2 = new Set(n4);
80555
80564
  } else
80556
- c2 && (i2 += `${n3}${s2}${n3}`, u2 = /* @__PURE__ */ new Set([s2]));
80565
+ a2 && (i2 += `${n3}${s2}${n3}`, u2 = /* @__PURE__ */ new Set([s2]));
80557
80566
  return { bundledCss: i2, unfetchedResources: u2 };
80558
80567
  };
80559
80568
  }, j = function(t4) {
80560
80569
  return async function(n3 = e3) {
80561
80570
  const o2 = {}, r2 = Date.now(), s2 = [];
80562
80571
  return function e4(n4, o3, r3, s3) {
80563
- function c2(e5) {
80572
+ function a2(e5) {
80564
80573
  if (s3.push(async function(e6, n5, o4) {
80565
80574
  let r4, s4;
80566
- e6 && U(e6) && (s4 = v($(e6), n5), r4 = await t4(s4), void 0 !== r4 && (o4[s4] = r4)), r4 && await a2(r4, s4, o4);
80575
+ e6 && U(e6) && (s4 = v($(e6), n5), r4 = await t4(s4), void 0 !== r4 && (o4[s4] = r4)), r4 && await c2(r4, s4, o4);
80567
80576
  }(e5, o3, r3)), e5.nodeType === D.ELEMENT)
80568
80577
  return "IFRAME" === e5.tagName.toUpperCase() ? i2(e5) : u2(e5);
80569
80578
  }
80570
80579
  function u2(e5) {
80571
- Array.prototype.map.call(e5.childNodes, c2);
80580
+ Array.prototype.map.call(e5.childNodes, a2);
80572
80581
  }
80573
80582
  function i2(t5) {
80574
80583
  if (u2(t5), t5.contentDocument)
@@ -80579,17 +80588,17 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80579
80588
  console.log(t6);
80580
80589
  }
80581
80590
  }
80582
- c2(n4.documentElement);
80591
+ a2(n4.documentElement);
80583
80592
  }(n3, n3.location.href, o2, s2), await Promise.all(s2), console.log("[prefetchAllCss]", Date.now() - r2), function(e4) {
80584
80593
  return o2[e4];
80585
80594
  };
80586
- async function a2(e4, n4, o3) {
80595
+ async function c2(e4, n4, o3) {
80587
80596
  try {
80588
80597
  const r3 = R(e4), s3 = [];
80589
80598
  for (const e5 of Array.from(r3.cssRules))
80590
80599
  e5 instanceof CSSImportRule && s3.push((async () => {
80591
80600
  const r4 = v(e5.href, n4), s4 = await t4(r4);
80592
- o3[r4] = s4, void 0 !== s4 && await a2(s4, r4, o3);
80601
+ o3[r4] = s4, void 0 !== s4 && await c2(s4, r4, o3);
80593
80602
  })());
80594
80603
  await Promise.all(s3);
80595
80604
  } catch (e5) {
@@ -80598,8 +80607,8 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80598
80607
  }
80599
80608
  };
80600
80609
  }, { NODE_TYPES: G, DEFAULT_STYLE_PROPS: J, DEFAULT_RECT_PROPS: K, DEFAULT_IGNORED_TAG_NAMES: H } = w;
80601
- const { pollify: W } = t3, { EYES_NAMESPACE: X, DOM_CAPTURE_KEY: q } = w, Q = async function({ doc: t4 = e3, styleProps: n3 = J, rectProps: o2 = K, elementProps: r2 = [], ignoredTagNames: s2 = H, capturePseudo: a2 = false, addStats: c2 = false, fetchTimeLimit: u2 = 3e4 } = {}) {
80602
- arguments[1] && (t4 = arguments[1]), arguments[2] && (c2 = arguments[2]), arguments[3] && (u2 = arguments[3]), true === n3 && (n3 = [...getComputedStyle(t4.body)]);
80610
+ const { pollify: W } = t3, { EYES_NAMESPACE: X, DOM_CAPTURE_KEY: q } = w, Q = async function({ doc: t4 = e3, styleProps: n3 = J, rectProps: o2 = K, elementProps: r2 = [], ignoredTagNames: s2 = H, capturePseudo: c2 = false, addStats: a2 = false, fetchTimeLimit: u2 = 3e4 } = {}) {
80611
+ arguments[1] && (t4 = arguments[1]), arguments[2] && (a2 = arguments[2]), arguments[3] && (u2 = arguments[3]), true === n3 && (n3 = [...getComputedStyle(t4.body)]);
80603
80612
  const i2 = { total: {}, prefetchCss: {}, doCaptureDoc: {}, waitForImages: {} };
80604
80613
  function l2(e4) {
80605
80614
  e4.startTime = Date.now();
@@ -80615,7 +80624,7 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80615
80624
  d2(i2.prefetchCss);
80616
80625
  const C2 = x({ parseCss: M, CSSImportRule, getCssFromCache: E2, absolutizeUrl: O, unfetchedToken: g2 }), T2 = B({ getCssFromCache: E2, absolutizeUrl: O }), b2 = Y({ extractCssFromNode: T2, getBundledCssFromCssText: C2, unfetchedToken: g2 });
80617
80626
  l2(i2.doCaptureDoc);
80618
- const N2 = function c3(u3, i3 = u3.location && u3.location.href) {
80627
+ const N2 = function a3(u3, i3 = u3.location && u3.location.href) {
80619
80628
  const l3 = /* @__PURE__ */ new Set();
80620
80629
  let d3 = "";
80621
80630
  const g3 = y3(u3.documentElement || u3);
@@ -80650,7 +80659,7 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80650
80659
  return o3(), t6;
80651
80660
  }
80652
80661
  try {
80653
- n5 ? t6.childNodes = [c3(n5, k(e4) ? e4.baseURI : n5.location.href)] : o3();
80662
+ n5 ? t6.childNodes = [a3(n5, k(e4) ? e4.baseURI : n5.location.href)] : o3();
80654
80663
  } catch (e5) {
80655
80664
  console.log("error in iframeToJSON", e5);
80656
80665
  }
@@ -80667,7 +80676,7 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80667
80676
  }
80668
80677
  }
80669
80678
  function w3(e4) {
80670
- const u4 = Array.prototype.map.call(e4.childNodes, y3).filter(Boolean), d4 = e4.shadowRoot && c3(e4.shadowRoot, i3), f3 = e4.tagName.toUpperCase();
80679
+ const u4 = Array.prototype.map.call(e4.childNodes, y3).filter(Boolean), d4 = e4.shadowRoot && a3(e4.shadowRoot, i3), f3 = e4.tagName.toUpperCase();
80671
80680
  if (s2.indexOf(f3) > -1)
80672
80681
  return null;
80673
80682
  const m3 = t4.defaultView.getComputedStyle(e4), h3 = e4.getBoundingClientRect(), p3 = {};
@@ -80681,7 +80690,7 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80681
80690
  "INPUT" !== f3 && "TEXTAREA" !== f3 || !e4.value || (w4.value && console.log(`[captureFrame] Overriding element attributes value from ${w4.value} to ${e4.value}`), w4.value = e4.value);
80682
80691
  const E3 = F(m3.getPropertyValue("background-image"));
80683
80692
  E3 && l3.add(E3);
80684
- const C3 = V(e4, n3), T3 = a2 ? C3 : void 0;
80693
+ const C3 = V(e4, n3), T3 = c2 ? C3 : void 0;
80685
80694
  C3 && (w4["data-applitools-has-pseudo"] = Object.keys(C3).join("_and_"));
80686
80695
  const b3 = {};
80687
80696
  for (const t5 of r2)
@@ -80691,7 +80700,7 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80691
80700
  return d4 && (N3.shadowRoot = d4), N3;
80692
80701
  }
80693
80702
  }(t4);
80694
- d2(i2.doCaptureDoc), l2(i2.waitForImages), await Promise.all(f2), d2(i2.waitForImages), N2.version = "1.3.0", N2.scriptVersion = "11.6.9";
80703
+ d2(i2.doCaptureDoc), l2(i2.waitForImages), await Promise.all(f2), d2(i2.waitForImages), N2.version = "1.3.0", N2.scriptVersion = "11.6.11";
80695
80704
  const S2 = h2.length ? `${h2.join("\n")}
80696
80705
  ` : "", A2 = m2.size ? `${Array.from(m2).join("\n")}
80697
80706
  ` : "", _2 = JSON.stringify({ separator: y2, cssStartToken: g2, cssEndToken: g2, iframeStartToken: `"${p2}`, iframeEndToken: `${p2}"` });
@@ -80699,7 +80708,7 @@ ${l2}`}`, { bundledCss: i2, unfetchedResources: u2 };
80699
80708
  const v2 = `${_2}
80700
80709
  ${A2}${y2}
80701
80710
  ${S2}${y2}
80702
- ${JSON.stringify(N2)}${c2 ? `
80711
+ ${JSON.stringify(N2)}${a2 ? `
80703
80712
  ${y2}
80704
80713
  ${JSON.stringify(i2)}` : ""}`;
80705
80714
  return console.log("[captureFrame]", JSON.stringify(i2)), v2;
@@ -87319,9 +87328,18 @@ var require_captureDomPollForIE = __commonJS({
87319
87328
  }).join(""), i3 = n3;
87320
87329
  else if (t5 && O0(t5)) {
87321
87330
  var u2 = S0(t5);
87322
- u2 ? function(t6) {
87323
- return t6 && t6.startsWith("data:");
87324
- }(u2) ? (i3 = n3, o3 = u2.match(/,(.+)/)[1]) : (i3 = r3(u2, n3), o3 = e4(i3)) : o3 = "", a2 = void 0 === o3;
87331
+ if (u2)
87332
+ if (function(t6) {
87333
+ return t6 && t6.startsWith("data:");
87334
+ }(u2)) {
87335
+ i3 = n3;
87336
+ var c2 = u2.match(/,(.*)/);
87337
+ o3 = c2 ? c2[1] : "";
87338
+ } else
87339
+ i3 = r3(u2, n3), o3 = e4(i3);
87340
+ else
87341
+ o3 = "";
87342
+ a2 = void 0 === o3;
87325
87343
  }
87326
87344
  return { cssText: o3, styleBaseUrl: i3, isUnfetched: a2 };
87327
87345
  };
@@ -87574,7 +87592,7 @@ var require_captureDomPollForIE = __commonJS({
87574
87592
  case 23:
87575
87593
  return I2 = e5.sent, A2(w2.prefetchCss), L2 = N0({ parseCss: U0, CSSImportRule, getCssFromCache: I2, absolutizeUrl: L0, unfetchedToken: R2 }), j2 = B0({ getCssFromCache: I2, absolutizeUrl: L0 }), k2 = z0({ extractCssFromNode: j2, getBundledCssFromCssText: L2, unfetchedToken: R2 }), E2(w2.doCaptureDoc), C2 = V2(i3), A2(w2.doCaptureDoc), E2(w2.waitForImages), e5.next = 34, Promise.all(S2);
87576
87594
  case 34:
87577
- return A2(w2.waitForImages), C2.version = "1.3.0", C2.scriptVersion = "11.6.9", M2 = x2.length ? x2.join("\n") + "\n" : "", N2 = O2.size ? Array.from(O2).join("\n") + "\n" : "", U2 = JSON.stringify({ separator: _2, cssStartToken: R2, cssEndToken: R2, iframeStartToken: '"' + T2, iframeEndToken: T2 + '"' }), A2(w2.total), F2 = U2 + "\n" + N2 + _2 + "\n" + M2 + _2 + "\n" + JSON.stringify(C2) + D2(), console.log("[captureFrame]", JSON.stringify(w2)), e5.abrupt("return", F2);
87595
+ return A2(w2.waitForImages), C2.version = "1.3.0", C2.scriptVersion = "11.6.11", M2 = x2.length ? x2.join("\n") + "\n" : "", N2 = O2.size ? Array.from(O2).join("\n") + "\n" : "", U2 = JSON.stringify({ separator: _2, cssStartToken: R2, cssEndToken: R2, iframeStartToken: '"' + T2, iframeEndToken: T2 + '"' }), A2(w2.total), F2 = U2 + "\n" + N2 + _2 + "\n" + M2 + _2 + "\n" + JSON.stringify(C2) + D2(), console.log("[captureFrame]", JSON.stringify(w2)), e5.abrupt("return", F2);
87578
87596
  case 44:
87579
87597
  case "end":
87580
87598
  return e5.stop();
@@ -102388,7 +102406,7 @@ creating temp style for access.`), r3 = Hh(e3);
102388
102406
  function P2(e3) {
102389
102407
  return n4.defaultView && n4.defaultView.frameElement && n4.defaultView.frameElement.getAttribute(e3);
102390
102408
  }
102391
- }(t3).then((e3) => (d2.log("processPage end"), e3.scriptVersion = "4.15.10", e3));
102409
+ }(t3).then((e3) => (d2.log("processPage end"), e3.scriptVersion = "4.15.11", e3));
102392
102410
  }, window[x], "domSnapshotResult");
102393
102411
  return function(e3) {
102394
102412
  try {
@@ -128028,7 +128046,7 @@ var require_package3 = __commonJS({
128028
128046
  "../core/package.json"(exports, module) {
128029
128047
  module.exports = {
128030
128048
  name: "@applitools/core",
128031
- version: "4.57.0",
128049
+ version: "4.57.2",
128032
128050
  homepage: "https://applitools.com",
128033
128051
  bugs: {
128034
128052
  url: "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -129504,3814 +129522,34 @@ var require_logs = __commonJS({
129504
129522
  }
129505
129523
  });
129506
129524
 
129507
- // ../../node_modules/stream-http/lib/capability.js
129508
- var require_capability = __commonJS({
129509
- "../../node_modules/stream-http/lib/capability.js"(exports) {
129510
- init_global();
129511
- init_process();
129512
- init_setImmediate();
129513
- init_buffer();
129514
- init_setInterval();
129515
- exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream);
129516
- exports.writableStream = isFunction(global.WritableStream);
129517
- exports.abortController = isFunction(global.AbortController);
129518
- var xhr;
129519
- function getXHR() {
129520
- if (xhr !== void 0)
129521
- return xhr;
129522
- if (global.XMLHttpRequest) {
129523
- xhr = new global.XMLHttpRequest();
129524
- try {
129525
- xhr.open("GET", global.XDomainRequest ? "/" : "https://example.com");
129526
- } catch (e) {
129527
- xhr = null;
129528
- }
129529
- } else {
129530
- xhr = null;
129531
- }
129532
- return xhr;
129533
- }
129534
- function checkTypeSupport(type) {
129535
- var xhr2 = getXHR();
129536
- if (!xhr2)
129537
- return false;
129538
- try {
129539
- xhr2.responseType = type;
129540
- return xhr2.responseType === type;
129541
- } catch (e) {
129542
- }
129543
- return false;
129544
- }
129545
- exports.arraybuffer = exports.fetch || checkTypeSupport("arraybuffer");
129546
- exports.msstream = !exports.fetch && checkTypeSupport("ms-stream");
129547
- exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport("moz-chunked-arraybuffer");
129548
- exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false);
129549
- function isFunction(value) {
129550
- return typeof value === "function";
129551
- }
129552
- xhr = null;
129553
- }
129554
- });
129555
-
129556
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/stream-browser.js
129557
- var require_stream_browser5 = __commonJS({
129558
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/stream-browser.js"(exports, module) {
129559
- init_global();
129560
- init_process();
129561
- init_setImmediate();
129562
- init_buffer();
129563
- init_setInterval();
129564
- module.exports = require_events().EventEmitter;
129565
- }
129566
- });
129567
-
129568
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/buffer_list.js
129569
- var require_buffer_list4 = __commonJS({
129570
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module) {
129571
- "use strict";
129572
- init_global();
129573
- init_process();
129574
- init_setImmediate();
129575
- init_buffer();
129576
- init_setInterval();
129577
- function ownKeys(object, enumerableOnly) {
129578
- var keys = Object.keys(object);
129579
- if (Object.getOwnPropertySymbols) {
129580
- var symbols = Object.getOwnPropertySymbols(object);
129581
- enumerableOnly && (symbols = symbols.filter(function(sym) {
129582
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
129583
- })), keys.push.apply(keys, symbols);
129584
- }
129585
- return keys;
129586
- }
129587
- function _objectSpread(target) {
129588
- for (var i = 1; i < arguments.length; i++) {
129589
- var source = null != arguments[i] ? arguments[i] : {};
129590
- i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
129591
- _defineProperty(target, key, source[key]);
129592
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
129593
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
129594
- });
129595
- }
129596
- return target;
129597
- }
129598
- function _defineProperty(obj, key, value) {
129599
- key = _toPropertyKey(key);
129600
- if (key in obj) {
129601
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
129602
- } else {
129603
- obj[key] = value;
129604
- }
129605
- return obj;
129606
- }
129607
- function _classCallCheck(instance, Constructor) {
129608
- if (!(instance instanceof Constructor)) {
129609
- throw new TypeError("Cannot call a class as a function");
129610
- }
129611
- }
129612
- function _defineProperties(target, props) {
129613
- for (var i = 0; i < props.length; i++) {
129614
- var descriptor = props[i];
129615
- descriptor.enumerable = descriptor.enumerable || false;
129616
- descriptor.configurable = true;
129617
- if ("value" in descriptor)
129618
- descriptor.writable = true;
129619
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
129620
- }
129621
- }
129622
- function _createClass(Constructor, protoProps, staticProps) {
129623
- if (protoProps)
129624
- _defineProperties(Constructor.prototype, protoProps);
129625
- if (staticProps)
129626
- _defineProperties(Constructor, staticProps);
129627
- Object.defineProperty(Constructor, "prototype", { writable: false });
129628
- return Constructor;
129629
- }
129630
- function _toPropertyKey(arg) {
129631
- var key = _toPrimitive(arg, "string");
129632
- return typeof key === "symbol" ? key : String(key);
129633
- }
129634
- function _toPrimitive(input, hint) {
129635
- if (typeof input !== "object" || input === null)
129636
- return input;
129637
- var prim = input[Symbol.toPrimitive];
129638
- if (prim !== void 0) {
129639
- var res = prim.call(input, hint || "default");
129640
- if (typeof res !== "object")
129641
- return res;
129642
- throw new TypeError("@@toPrimitive must return a primitive value.");
129643
- }
129644
- return (hint === "string" ? String : Number)(input);
129645
- }
129646
- var _require = require_buffer();
129647
- var Buffer4 = _require.Buffer;
129648
- var _require2 = require_util();
129649
- var inspect = _require2.inspect;
129650
- var custom = inspect && inspect.custom || "inspect";
129651
- function copyBuffer(src, target, offset) {
129652
- Buffer4.prototype.copy.call(src, target, offset);
129653
- }
129654
- module.exports = /* @__PURE__ */ function() {
129655
- function BufferList() {
129656
- _classCallCheck(this, BufferList);
129657
- this.head = null;
129658
- this.tail = null;
129659
- this.length = 0;
129660
- }
129661
- _createClass(BufferList, [{
129662
- key: "push",
129663
- value: function push(v) {
129664
- var entry = {
129665
- data: v,
129666
- next: null
129667
- };
129668
- if (this.length > 0)
129669
- this.tail.next = entry;
129670
- else
129671
- this.head = entry;
129672
- this.tail = entry;
129673
- ++this.length;
129674
- }
129675
- }, {
129676
- key: "unshift",
129677
- value: function unshift(v) {
129678
- var entry = {
129679
- data: v,
129680
- next: this.head
129681
- };
129682
- if (this.length === 0)
129683
- this.tail = entry;
129684
- this.head = entry;
129685
- ++this.length;
129686
- }
129687
- }, {
129688
- key: "shift",
129689
- value: function shift() {
129690
- if (this.length === 0)
129691
- return;
129692
- var ret = this.head.data;
129693
- if (this.length === 1)
129694
- this.head = this.tail = null;
129695
- else
129696
- this.head = this.head.next;
129697
- --this.length;
129698
- return ret;
129699
- }
129700
- }, {
129701
- key: "clear",
129702
- value: function clear() {
129703
- this.head = this.tail = null;
129704
- this.length = 0;
129705
- }
129706
- }, {
129707
- key: "join",
129708
- value: function join(s) {
129709
- if (this.length === 0)
129710
- return "";
129711
- var p = this.head;
129712
- var ret = "" + p.data;
129713
- while (p = p.next)
129714
- ret += s + p.data;
129715
- return ret;
129716
- }
129717
- }, {
129718
- key: "concat",
129719
- value: function concat(n) {
129720
- if (this.length === 0)
129721
- return Buffer4.alloc(0);
129722
- var ret = Buffer4.allocUnsafe(n >>> 0);
129723
- var p = this.head;
129724
- var i = 0;
129725
- while (p) {
129726
- copyBuffer(p.data, ret, i);
129727
- i += p.data.length;
129728
- p = p.next;
129729
- }
129730
- return ret;
129731
- }
129732
- // Consumes a specified amount of bytes or characters from the buffered data.
129733
- }, {
129734
- key: "consume",
129735
- value: function consume(n, hasStrings) {
129736
- var ret;
129737
- if (n < this.head.data.length) {
129738
- ret = this.head.data.slice(0, n);
129739
- this.head.data = this.head.data.slice(n);
129740
- } else if (n === this.head.data.length) {
129741
- ret = this.shift();
129742
- } else {
129743
- ret = hasStrings ? this._getString(n) : this._getBuffer(n);
129744
- }
129745
- return ret;
129746
- }
129747
- }, {
129748
- key: "first",
129749
- value: function first() {
129750
- return this.head.data;
129751
- }
129752
- // Consumes a specified amount of characters from the buffered data.
129753
- }, {
129754
- key: "_getString",
129755
- value: function _getString(n) {
129756
- var p = this.head;
129757
- var c = 1;
129758
- var ret = p.data;
129759
- n -= ret.length;
129760
- while (p = p.next) {
129761
- var str = p.data;
129762
- var nb = n > str.length ? str.length : n;
129763
- if (nb === str.length)
129764
- ret += str;
129765
- else
129766
- ret += str.slice(0, n);
129767
- n -= nb;
129768
- if (n === 0) {
129769
- if (nb === str.length) {
129770
- ++c;
129771
- if (p.next)
129772
- this.head = p.next;
129773
- else
129774
- this.head = this.tail = null;
129775
- } else {
129776
- this.head = p;
129777
- p.data = str.slice(nb);
129778
- }
129779
- break;
129780
- }
129781
- ++c;
129782
- }
129783
- this.length -= c;
129784
- return ret;
129785
- }
129786
- // Consumes a specified amount of bytes from the buffered data.
129787
- }, {
129788
- key: "_getBuffer",
129789
- value: function _getBuffer(n) {
129790
- var ret = Buffer4.allocUnsafe(n);
129791
- var p = this.head;
129792
- var c = 1;
129793
- p.data.copy(ret);
129794
- n -= p.data.length;
129795
- while (p = p.next) {
129796
- var buf = p.data;
129797
- var nb = n > buf.length ? buf.length : n;
129798
- buf.copy(ret, ret.length - n, 0, nb);
129799
- n -= nb;
129800
- if (n === 0) {
129801
- if (nb === buf.length) {
129802
- ++c;
129803
- if (p.next)
129804
- this.head = p.next;
129805
- else
129806
- this.head = this.tail = null;
129807
- } else {
129808
- this.head = p;
129809
- p.data = buf.slice(nb);
129810
- }
129811
- break;
129812
- }
129813
- ++c;
129814
- }
129815
- this.length -= c;
129816
- return ret;
129817
- }
129818
- // Make sure the linked list only shows the minimal necessary information.
129819
- }, {
129820
- key: custom,
129821
- value: function value(_, options) {
129822
- return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
129823
- // Only inspect one level.
129824
- depth: 0,
129825
- // It should not recurse.
129826
- customInspect: false
129827
- }));
129828
- }
129829
- }]);
129830
- return BufferList;
129831
- }();
129832
- }
129833
- });
129834
-
129835
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/destroy.js
129836
- var require_destroy5 = __commonJS({
129837
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {
129838
- "use strict";
129839
- init_global();
129840
- init_process();
129841
- init_setImmediate();
129842
- init_buffer();
129843
- init_setInterval();
129844
- function destroy(err, cb) {
129845
- var _this = this;
129846
- var readableDestroyed = this._readableState && this._readableState.destroyed;
129847
- var writableDestroyed = this._writableState && this._writableState.destroyed;
129848
- if (readableDestroyed || writableDestroyed) {
129849
- if (cb) {
129850
- cb(err);
129851
- } else if (err) {
129852
- if (!this._writableState) {
129853
- process.nextTick(emitErrorNT, this, err);
129854
- } else if (!this._writableState.errorEmitted) {
129855
- this._writableState.errorEmitted = true;
129856
- process.nextTick(emitErrorNT, this, err);
129857
- }
129858
- }
129859
- return this;
129860
- }
129861
- if (this._readableState) {
129862
- this._readableState.destroyed = true;
129863
- }
129864
- if (this._writableState) {
129865
- this._writableState.destroyed = true;
129866
- }
129867
- this._destroy(err || null, function(err2) {
129868
- if (!cb && err2) {
129869
- if (!_this._writableState) {
129870
- process.nextTick(emitErrorAndCloseNT, _this, err2);
129871
- } else if (!_this._writableState.errorEmitted) {
129872
- _this._writableState.errorEmitted = true;
129873
- process.nextTick(emitErrorAndCloseNT, _this, err2);
129874
- } else {
129875
- process.nextTick(emitCloseNT, _this);
129876
- }
129877
- } else if (cb) {
129878
- process.nextTick(emitCloseNT, _this);
129879
- cb(err2);
129880
- } else {
129881
- process.nextTick(emitCloseNT, _this);
129882
- }
129883
- });
129884
- return this;
129885
- }
129886
- function emitErrorAndCloseNT(self2, err) {
129887
- emitErrorNT(self2, err);
129888
- emitCloseNT(self2);
129889
- }
129890
- function emitCloseNT(self2) {
129891
- if (self2._writableState && !self2._writableState.emitClose)
129892
- return;
129893
- if (self2._readableState && !self2._readableState.emitClose)
129894
- return;
129895
- self2.emit("close");
129896
- }
129897
- function undestroy() {
129898
- if (this._readableState) {
129899
- this._readableState.destroyed = false;
129900
- this._readableState.reading = false;
129901
- this._readableState.ended = false;
129902
- this._readableState.endEmitted = false;
129903
- }
129904
- if (this._writableState) {
129905
- this._writableState.destroyed = false;
129906
- this._writableState.ended = false;
129907
- this._writableState.ending = false;
129908
- this._writableState.finalCalled = false;
129909
- this._writableState.prefinished = false;
129910
- this._writableState.finished = false;
129911
- this._writableState.errorEmitted = false;
129912
- }
129913
- }
129914
- function emitErrorNT(self2, err) {
129915
- self2.emit("error", err);
129916
- }
129917
- function errorOrDestroy(stream, err) {
129918
- var rState = stream._readableState;
129919
- var wState = stream._writableState;
129920
- if (rState && rState.autoDestroy || wState && wState.autoDestroy)
129921
- stream.destroy(err);
129922
- else
129923
- stream.emit("error", err);
129924
- }
129925
- module.exports = {
129926
- destroy,
129927
- undestroy,
129928
- errorOrDestroy
129929
- };
129930
- }
129931
- });
129932
-
129933
- // ../../node_modules/stream-http/node_modules/readable-stream/errors-browser.js
129934
- var require_errors_browser4 = __commonJS({
129935
- "../../node_modules/stream-http/node_modules/readable-stream/errors-browser.js"(exports, module) {
129525
+ // ../core/dist/index.js
129526
+ var require_dist8 = __commonJS({
129527
+ "../core/dist/index.js"(exports) {
129936
129528
  "use strict";
129937
129529
  init_global();
129938
129530
  init_process();
129939
129531
  init_setImmediate();
129940
129532
  init_buffer();
129941
129533
  init_setInterval();
129942
- function _inheritsLoose(subClass, superClass) {
129943
- subClass.prototype = Object.create(superClass.prototype);
129944
- subClass.prototype.constructor = subClass;
129945
- subClass.__proto__ = superClass;
129946
- }
129947
- var codes = {};
129948
- function createErrorType(code, message, Base) {
129949
- if (!Base) {
129950
- Base = Error;
129951
- }
129952
- function getMessage(arg1, arg2, arg3) {
129953
- if (typeof message === "string") {
129954
- return message;
129955
- } else {
129956
- return message(arg1, arg2, arg3);
129957
- }
129958
- }
129959
- var NodeError = /* @__PURE__ */ function(_Base) {
129960
- _inheritsLoose(NodeError2, _Base);
129961
- function NodeError2(arg1, arg2, arg3) {
129962
- return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
129963
- }
129964
- return NodeError2;
129965
- }(Base);
129966
- NodeError.prototype.name = Base.name;
129967
- NodeError.prototype.code = code;
129968
- codes[code] = NodeError;
129969
- }
129970
- function oneOf(expected, thing) {
129971
- if (Array.isArray(expected)) {
129972
- var len = expected.length;
129973
- expected = expected.map(function(i) {
129974
- return String(i);
129975
- });
129976
- if (len > 2) {
129977
- return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];
129978
- } else if (len === 2) {
129979
- return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
129980
- } else {
129981
- return "of ".concat(thing, " ").concat(expected[0]);
129982
- }
129983
- } else {
129984
- return "of ".concat(thing, " ").concat(String(expected));
129985
- }
129986
- }
129987
- function startsWith(str, search, pos) {
129988
- return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
129989
- }
129990
- function endsWith(str, search, this_len) {
129991
- if (this_len === void 0 || this_len > str.length) {
129992
- this_len = str.length;
129993
- }
129994
- return str.substring(this_len - search.length, this_len) === search;
129995
- }
129996
- function includes(str, search, start) {
129997
- if (typeof start !== "number") {
129998
- start = 0;
129999
- }
130000
- if (start + search.length > str.length) {
130001
- return false;
130002
- } else {
130003
- return str.indexOf(search, start) !== -1;
130004
- }
130005
- }
130006
- createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
130007
- return 'The value "' + value + '" is invalid for option "' + name + '"';
130008
- }, TypeError);
130009
- createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
130010
- var determiner;
130011
- if (typeof expected === "string" && startsWith(expected, "not ")) {
130012
- determiner = "must not be";
130013
- expected = expected.replace(/^not /, "");
130014
- } else {
130015
- determiner = "must be";
130016
- }
130017
- var msg;
130018
- if (endsWith(name, " argument")) {
130019
- msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
130020
- } else {
130021
- var type = includes(name, ".") ? "property" : "argument";
130022
- msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
129534
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
129535
+ if (k2 === void 0)
129536
+ k2 = k;
129537
+ var desc = Object.getOwnPropertyDescriptor(m, k);
129538
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
129539
+ desc = { enumerable: true, get: function() {
129540
+ return m[k];
129541
+ } };
130023
129542
  }
130024
- msg += ". Received type ".concat(typeof actual);
130025
- return msg;
130026
- }, TypeError);
130027
- createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
130028
- createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
130029
- return "The " + name + " method is not implemented";
129543
+ Object.defineProperty(o, k2, desc);
129544
+ } : function(o, m, k, k2) {
129545
+ if (k2 === void 0)
129546
+ k2 = k;
129547
+ o[k2] = m[k];
130030
129548
  });
130031
- createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
130032
- createErrorType("ERR_STREAM_DESTROYED", function(name) {
130033
- return "Cannot call " + name + " after a stream was destroyed";
130034
- });
130035
- createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
130036
- createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
130037
- createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
130038
- createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
130039
- createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
130040
- return "Unknown encoding: " + arg;
130041
- }, TypeError);
130042
- createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
130043
- module.exports.codes = codes;
130044
- }
130045
- });
130046
-
130047
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/state.js
130048
- var require_state4 = __commonJS({
130049
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) {
130050
- "use strict";
130051
- init_global();
130052
- init_process();
130053
- init_setImmediate();
130054
- init_buffer();
130055
- init_setInterval();
130056
- var ERR_INVALID_OPT_VALUE = require_errors_browser4().codes.ERR_INVALID_OPT_VALUE;
130057
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
130058
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
130059
- }
130060
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
130061
- var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
130062
- if (hwm != null) {
130063
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
130064
- var name = isDuplex ? duplexKey : "highWaterMark";
130065
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
130066
- }
130067
- return Math.floor(hwm);
130068
- }
130069
- return state.objectMode ? 16 : 16 * 1024;
130070
- }
130071
- module.exports = {
130072
- getHighWaterMark
130073
- };
130074
- }
130075
- });
130076
-
130077
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_writable.js
130078
- var require_stream_writable5 = __commonJS({
130079
- "../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_writable.js"(exports, module) {
130080
- "use strict";
130081
- init_global();
130082
- init_process();
130083
- init_setImmediate();
130084
- init_buffer();
130085
- init_setInterval();
130086
- module.exports = Writable;
130087
- function CorkedRequest(state) {
130088
- var _this = this;
130089
- this.next = null;
130090
- this.entry = null;
130091
- this.finish = function() {
130092
- onCorkedFinish(_this, state);
130093
- };
130094
- }
130095
- var Duplex;
130096
- Writable.WritableState = WritableState;
130097
- var internalUtil = {
130098
- deprecate: require_browser2()
130099
- };
130100
- var Stream = require_stream_browser5();
130101
- var Buffer4 = require_buffer().Buffer;
130102
- var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
130103
- };
130104
- function _uint8ArrayToBuffer(chunk) {
130105
- return Buffer4.from(chunk);
130106
- }
130107
- function _isUint8Array(obj) {
130108
- return Buffer4.isBuffer(obj) || obj instanceof OurUint8Array;
130109
- }
130110
- var destroyImpl = require_destroy5();
130111
- var _require = require_state4();
130112
- var getHighWaterMark = _require.getHighWaterMark;
130113
- var _require$codes = require_errors_browser4().codes;
130114
- var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
130115
- var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
130116
- var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
130117
- var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
130118
- var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
130119
- var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
130120
- var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
130121
- var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
130122
- var errorOrDestroy = destroyImpl.errorOrDestroy;
130123
- require_inherits_browser()(Writable, Stream);
130124
- function nop() {
130125
- }
130126
- function WritableState(options, stream, isDuplex) {
130127
- Duplex = Duplex || require_stream_duplex5();
130128
- options = options || {};
130129
- if (typeof isDuplex !== "boolean")
130130
- isDuplex = stream instanceof Duplex;
130131
- this.objectMode = !!options.objectMode;
130132
- if (isDuplex)
130133
- this.objectMode = this.objectMode || !!options.writableObjectMode;
130134
- this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
130135
- this.finalCalled = false;
130136
- this.needDrain = false;
130137
- this.ending = false;
130138
- this.ended = false;
130139
- this.finished = false;
130140
- this.destroyed = false;
130141
- var noDecode = options.decodeStrings === false;
130142
- this.decodeStrings = !noDecode;
130143
- this.defaultEncoding = options.defaultEncoding || "utf8";
130144
- this.length = 0;
130145
- this.writing = false;
130146
- this.corked = 0;
130147
- this.sync = true;
130148
- this.bufferProcessing = false;
130149
- this.onwrite = function(er) {
130150
- onwrite(stream, er);
130151
- };
130152
- this.writecb = null;
130153
- this.writelen = 0;
130154
- this.bufferedRequest = null;
130155
- this.lastBufferedRequest = null;
130156
- this.pendingcb = 0;
130157
- this.prefinished = false;
130158
- this.errorEmitted = false;
130159
- this.emitClose = options.emitClose !== false;
130160
- this.autoDestroy = !!options.autoDestroy;
130161
- this.bufferedRequestCount = 0;
130162
- this.corkedRequestsFree = new CorkedRequest(this);
130163
- }
130164
- WritableState.prototype.getBuffer = function getBuffer() {
130165
- var current = this.bufferedRequest;
130166
- var out = [];
130167
- while (current) {
130168
- out.push(current);
130169
- current = current.next;
130170
- }
130171
- return out;
130172
- };
130173
- (function() {
130174
- try {
130175
- Object.defineProperty(WritableState.prototype, "buffer", {
130176
- get: internalUtil.deprecate(function writableStateBufferGetter() {
130177
- return this.getBuffer();
130178
- }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
130179
- });
130180
- } catch (_) {
130181
- }
130182
- })();
130183
- var realHasInstance;
130184
- if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
130185
- realHasInstance = Function.prototype[Symbol.hasInstance];
130186
- Object.defineProperty(Writable, Symbol.hasInstance, {
130187
- value: function value(object) {
130188
- if (realHasInstance.call(this, object))
130189
- return true;
130190
- if (this !== Writable)
130191
- return false;
130192
- return object && object._writableState instanceof WritableState;
130193
- }
130194
- });
130195
- } else {
130196
- realHasInstance = function realHasInstance2(object) {
130197
- return object instanceof this;
130198
- };
130199
- }
130200
- function Writable(options) {
130201
- Duplex = Duplex || require_stream_duplex5();
130202
- var isDuplex = this instanceof Duplex;
130203
- if (!isDuplex && !realHasInstance.call(Writable, this))
130204
- return new Writable(options);
130205
- this._writableState = new WritableState(options, this, isDuplex);
130206
- this.writable = true;
130207
- if (options) {
130208
- if (typeof options.write === "function")
130209
- this._write = options.write;
130210
- if (typeof options.writev === "function")
130211
- this._writev = options.writev;
130212
- if (typeof options.destroy === "function")
130213
- this._destroy = options.destroy;
130214
- if (typeof options.final === "function")
130215
- this._final = options.final;
130216
- }
130217
- Stream.call(this);
130218
- }
130219
- Writable.prototype.pipe = function() {
130220
- errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
130221
- };
130222
- function writeAfterEnd(stream, cb) {
130223
- var er = new ERR_STREAM_WRITE_AFTER_END();
130224
- errorOrDestroy(stream, er);
130225
- process.nextTick(cb, er);
130226
- }
130227
- function validChunk(stream, state, chunk, cb) {
130228
- var er;
130229
- if (chunk === null) {
130230
- er = new ERR_STREAM_NULL_VALUES();
130231
- } else if (typeof chunk !== "string" && !state.objectMode) {
130232
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
130233
- }
130234
- if (er) {
130235
- errorOrDestroy(stream, er);
130236
- process.nextTick(cb, er);
130237
- return false;
130238
- }
130239
- return true;
130240
- }
130241
- Writable.prototype.write = function(chunk, encoding, cb) {
130242
- var state = this._writableState;
130243
- var ret = false;
130244
- var isBuf = !state.objectMode && _isUint8Array(chunk);
130245
- if (isBuf && !Buffer4.isBuffer(chunk)) {
130246
- chunk = _uint8ArrayToBuffer(chunk);
130247
- }
130248
- if (typeof encoding === "function") {
130249
- cb = encoding;
130250
- encoding = null;
130251
- }
130252
- if (isBuf)
130253
- encoding = "buffer";
130254
- else if (!encoding)
130255
- encoding = state.defaultEncoding;
130256
- if (typeof cb !== "function")
130257
- cb = nop;
130258
- if (state.ending)
130259
- writeAfterEnd(this, cb);
130260
- else if (isBuf || validChunk(this, state, chunk, cb)) {
130261
- state.pendingcb++;
130262
- ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
130263
- }
130264
- return ret;
130265
- };
130266
- Writable.prototype.cork = function() {
130267
- this._writableState.corked++;
130268
- };
130269
- Writable.prototype.uncork = function() {
130270
- var state = this._writableState;
130271
- if (state.corked) {
130272
- state.corked--;
130273
- if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)
130274
- clearBuffer(this, state);
130275
- }
130276
- };
130277
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
130278
- if (typeof encoding === "string")
130279
- encoding = encoding.toLowerCase();
130280
- if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
130281
- throw new ERR_UNKNOWN_ENCODING(encoding);
130282
- this._writableState.defaultEncoding = encoding;
130283
- return this;
130284
- };
130285
- Object.defineProperty(Writable.prototype, "writableBuffer", {
130286
- // making it explicit this property is not enumerable
130287
- // because otherwise some prototype manipulation in
130288
- // userland will fail
130289
- enumerable: false,
130290
- get: function get() {
130291
- return this._writableState && this._writableState.getBuffer();
130292
- }
130293
- });
130294
- function decodeChunk(state, chunk, encoding) {
130295
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
130296
- chunk = Buffer4.from(chunk, encoding);
130297
- }
130298
- return chunk;
130299
- }
130300
- Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
130301
- // making it explicit this property is not enumerable
130302
- // because otherwise some prototype manipulation in
130303
- // userland will fail
130304
- enumerable: false,
130305
- get: function get() {
130306
- return this._writableState.highWaterMark;
130307
- }
130308
- });
130309
- function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
130310
- if (!isBuf) {
130311
- var newChunk = decodeChunk(state, chunk, encoding);
130312
- if (chunk !== newChunk) {
130313
- isBuf = true;
130314
- encoding = "buffer";
130315
- chunk = newChunk;
130316
- }
130317
- }
130318
- var len = state.objectMode ? 1 : chunk.length;
130319
- state.length += len;
130320
- var ret = state.length < state.highWaterMark;
130321
- if (!ret)
130322
- state.needDrain = true;
130323
- if (state.writing || state.corked) {
130324
- var last = state.lastBufferedRequest;
130325
- state.lastBufferedRequest = {
130326
- chunk,
130327
- encoding,
130328
- isBuf,
130329
- callback: cb,
130330
- next: null
130331
- };
130332
- if (last) {
130333
- last.next = state.lastBufferedRequest;
130334
- } else {
130335
- state.bufferedRequest = state.lastBufferedRequest;
130336
- }
130337
- state.bufferedRequestCount += 1;
130338
- } else {
130339
- doWrite(stream, state, false, len, chunk, encoding, cb);
130340
- }
130341
- return ret;
130342
- }
130343
- function doWrite(stream, state, writev, len, chunk, encoding, cb) {
130344
- state.writelen = len;
130345
- state.writecb = cb;
130346
- state.writing = true;
130347
- state.sync = true;
130348
- if (state.destroyed)
130349
- state.onwrite(new ERR_STREAM_DESTROYED("write"));
130350
- else if (writev)
130351
- stream._writev(chunk, state.onwrite);
130352
- else
130353
- stream._write(chunk, encoding, state.onwrite);
130354
- state.sync = false;
130355
- }
130356
- function onwriteError(stream, state, sync, er, cb) {
130357
- --state.pendingcb;
130358
- if (sync) {
130359
- process.nextTick(cb, er);
130360
- process.nextTick(finishMaybe, stream, state);
130361
- stream._writableState.errorEmitted = true;
130362
- errorOrDestroy(stream, er);
130363
- } else {
130364
- cb(er);
130365
- stream._writableState.errorEmitted = true;
130366
- errorOrDestroy(stream, er);
130367
- finishMaybe(stream, state);
130368
- }
130369
- }
130370
- function onwriteStateUpdate(state) {
130371
- state.writing = false;
130372
- state.writecb = null;
130373
- state.length -= state.writelen;
130374
- state.writelen = 0;
130375
- }
130376
- function onwrite(stream, er) {
130377
- var state = stream._writableState;
130378
- var sync = state.sync;
130379
- var cb = state.writecb;
130380
- if (typeof cb !== "function")
130381
- throw new ERR_MULTIPLE_CALLBACK();
130382
- onwriteStateUpdate(state);
130383
- if (er)
130384
- onwriteError(stream, state, sync, er, cb);
130385
- else {
130386
- var finished = needFinish(state) || stream.destroyed;
130387
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
130388
- clearBuffer(stream, state);
130389
- }
130390
- if (sync) {
130391
- process.nextTick(afterWrite, stream, state, finished, cb);
130392
- } else {
130393
- afterWrite(stream, state, finished, cb);
130394
- }
130395
- }
130396
- }
130397
- function afterWrite(stream, state, finished, cb) {
130398
- if (!finished)
130399
- onwriteDrain(stream, state);
130400
- state.pendingcb--;
130401
- cb();
130402
- finishMaybe(stream, state);
130403
- }
130404
- function onwriteDrain(stream, state) {
130405
- if (state.length === 0 && state.needDrain) {
130406
- state.needDrain = false;
130407
- stream.emit("drain");
130408
- }
130409
- }
130410
- function clearBuffer(stream, state) {
130411
- state.bufferProcessing = true;
130412
- var entry = state.bufferedRequest;
130413
- if (stream._writev && entry && entry.next) {
130414
- var l = state.bufferedRequestCount;
130415
- var buffer = new Array(l);
130416
- var holder = state.corkedRequestsFree;
130417
- holder.entry = entry;
130418
- var count = 0;
130419
- var allBuffers = true;
130420
- while (entry) {
130421
- buffer[count] = entry;
130422
- if (!entry.isBuf)
130423
- allBuffers = false;
130424
- entry = entry.next;
130425
- count += 1;
130426
- }
130427
- buffer.allBuffers = allBuffers;
130428
- doWrite(stream, state, true, state.length, buffer, "", holder.finish);
130429
- state.pendingcb++;
130430
- state.lastBufferedRequest = null;
130431
- if (holder.next) {
130432
- state.corkedRequestsFree = holder.next;
130433
- holder.next = null;
130434
- } else {
130435
- state.corkedRequestsFree = new CorkedRequest(state);
130436
- }
130437
- state.bufferedRequestCount = 0;
130438
- } else {
130439
- while (entry) {
130440
- var chunk = entry.chunk;
130441
- var encoding = entry.encoding;
130442
- var cb = entry.callback;
130443
- var len = state.objectMode ? 1 : chunk.length;
130444
- doWrite(stream, state, false, len, chunk, encoding, cb);
130445
- entry = entry.next;
130446
- state.bufferedRequestCount--;
130447
- if (state.writing) {
130448
- break;
130449
- }
130450
- }
130451
- if (entry === null)
130452
- state.lastBufferedRequest = null;
130453
- }
130454
- state.bufferedRequest = entry;
130455
- state.bufferProcessing = false;
130456
- }
130457
- Writable.prototype._write = function(chunk, encoding, cb) {
130458
- cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
130459
- };
130460
- Writable.prototype._writev = null;
130461
- Writable.prototype.end = function(chunk, encoding, cb) {
130462
- var state = this._writableState;
130463
- if (typeof chunk === "function") {
130464
- cb = chunk;
130465
- chunk = null;
130466
- encoding = null;
130467
- } else if (typeof encoding === "function") {
130468
- cb = encoding;
130469
- encoding = null;
130470
- }
130471
- if (chunk !== null && chunk !== void 0)
130472
- this.write(chunk, encoding);
130473
- if (state.corked) {
130474
- state.corked = 1;
130475
- this.uncork();
130476
- }
130477
- if (!state.ending)
130478
- endWritable(this, state, cb);
130479
- return this;
130480
- };
130481
- Object.defineProperty(Writable.prototype, "writableLength", {
130482
- // making it explicit this property is not enumerable
130483
- // because otherwise some prototype manipulation in
130484
- // userland will fail
130485
- enumerable: false,
130486
- get: function get() {
130487
- return this._writableState.length;
130488
- }
130489
- });
130490
- function needFinish(state) {
130491
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
130492
- }
130493
- function callFinal(stream, state) {
130494
- stream._final(function(err) {
130495
- state.pendingcb--;
130496
- if (err) {
130497
- errorOrDestroy(stream, err);
130498
- }
130499
- state.prefinished = true;
130500
- stream.emit("prefinish");
130501
- finishMaybe(stream, state);
130502
- });
130503
- }
130504
- function prefinish(stream, state) {
130505
- if (!state.prefinished && !state.finalCalled) {
130506
- if (typeof stream._final === "function" && !state.destroyed) {
130507
- state.pendingcb++;
130508
- state.finalCalled = true;
130509
- process.nextTick(callFinal, stream, state);
130510
- } else {
130511
- state.prefinished = true;
130512
- stream.emit("prefinish");
130513
- }
130514
- }
130515
- }
130516
- function finishMaybe(stream, state) {
130517
- var need = needFinish(state);
130518
- if (need) {
130519
- prefinish(stream, state);
130520
- if (state.pendingcb === 0) {
130521
- state.finished = true;
130522
- stream.emit("finish");
130523
- if (state.autoDestroy) {
130524
- var rState = stream._readableState;
130525
- if (!rState || rState.autoDestroy && rState.endEmitted) {
130526
- stream.destroy();
130527
- }
130528
- }
130529
- }
130530
- }
130531
- return need;
130532
- }
130533
- function endWritable(stream, state, cb) {
130534
- state.ending = true;
130535
- finishMaybe(stream, state);
130536
- if (cb) {
130537
- if (state.finished)
130538
- process.nextTick(cb);
130539
- else
130540
- stream.once("finish", cb);
130541
- }
130542
- state.ended = true;
130543
- stream.writable = false;
130544
- }
130545
- function onCorkedFinish(corkReq, state, err) {
130546
- var entry = corkReq.entry;
130547
- corkReq.entry = null;
130548
- while (entry) {
130549
- var cb = entry.callback;
130550
- state.pendingcb--;
130551
- cb(err);
130552
- entry = entry.next;
130553
- }
130554
- state.corkedRequestsFree.next = corkReq;
130555
- }
130556
- Object.defineProperty(Writable.prototype, "destroyed", {
130557
- // making it explicit this property is not enumerable
130558
- // because otherwise some prototype manipulation in
130559
- // userland will fail
130560
- enumerable: false,
130561
- get: function get() {
130562
- if (this._writableState === void 0) {
130563
- return false;
130564
- }
130565
- return this._writableState.destroyed;
130566
- },
130567
- set: function set(value) {
130568
- if (!this._writableState) {
130569
- return;
130570
- }
130571
- this._writableState.destroyed = value;
130572
- }
130573
- });
130574
- Writable.prototype.destroy = destroyImpl.destroy;
130575
- Writable.prototype._undestroy = destroyImpl.undestroy;
130576
- Writable.prototype._destroy = function(err, cb) {
130577
- cb(err);
130578
- };
130579
- }
130580
- });
130581
-
130582
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_duplex.js
130583
- var require_stream_duplex5 = __commonJS({
130584
- "../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_duplex.js"(exports, module) {
130585
- "use strict";
130586
- init_global();
130587
- init_process();
130588
- init_setImmediate();
130589
- init_buffer();
130590
- init_setInterval();
130591
- var objectKeys = Object.keys || function(obj) {
130592
- var keys2 = [];
130593
- for (var key in obj)
130594
- keys2.push(key);
130595
- return keys2;
130596
- };
130597
- module.exports = Duplex;
130598
- var Readable = require_stream_readable5();
130599
- var Writable = require_stream_writable5();
130600
- require_inherits_browser()(Duplex, Readable);
130601
- {
130602
- keys = objectKeys(Writable.prototype);
130603
- for (v = 0; v < keys.length; v++) {
130604
- method = keys[v];
130605
- if (!Duplex.prototype[method])
130606
- Duplex.prototype[method] = Writable.prototype[method];
130607
- }
130608
- }
130609
- var keys;
130610
- var method;
130611
- var v;
130612
- function Duplex(options) {
130613
- if (!(this instanceof Duplex))
130614
- return new Duplex(options);
130615
- Readable.call(this, options);
130616
- Writable.call(this, options);
130617
- this.allowHalfOpen = true;
130618
- if (options) {
130619
- if (options.readable === false)
130620
- this.readable = false;
130621
- if (options.writable === false)
130622
- this.writable = false;
130623
- if (options.allowHalfOpen === false) {
130624
- this.allowHalfOpen = false;
130625
- this.once("end", onend);
130626
- }
130627
- }
130628
- }
130629
- Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
130630
- // making it explicit this property is not enumerable
130631
- // because otherwise some prototype manipulation in
130632
- // userland will fail
130633
- enumerable: false,
130634
- get: function get() {
130635
- return this._writableState.highWaterMark;
130636
- }
130637
- });
130638
- Object.defineProperty(Duplex.prototype, "writableBuffer", {
130639
- // making it explicit this property is not enumerable
130640
- // because otherwise some prototype manipulation in
130641
- // userland will fail
130642
- enumerable: false,
130643
- get: function get() {
130644
- return this._writableState && this._writableState.getBuffer();
130645
- }
130646
- });
130647
- Object.defineProperty(Duplex.prototype, "writableLength", {
130648
- // making it explicit this property is not enumerable
130649
- // because otherwise some prototype manipulation in
130650
- // userland will fail
130651
- enumerable: false,
130652
- get: function get() {
130653
- return this._writableState.length;
130654
- }
130655
- });
130656
- function onend() {
130657
- if (this._writableState.ended)
130658
- return;
130659
- process.nextTick(onEndNT, this);
130660
- }
130661
- function onEndNT(self2) {
130662
- self2.end();
130663
- }
130664
- Object.defineProperty(Duplex.prototype, "destroyed", {
130665
- // making it explicit this property is not enumerable
130666
- // because otherwise some prototype manipulation in
130667
- // userland will fail
130668
- enumerable: false,
130669
- get: function get() {
130670
- if (this._readableState === void 0 || this._writableState === void 0) {
130671
- return false;
130672
- }
130673
- return this._readableState.destroyed && this._writableState.destroyed;
130674
- },
130675
- set: function set(value) {
130676
- if (this._readableState === void 0 || this._writableState === void 0) {
130677
- return;
130678
- }
130679
- this._readableState.destroyed = value;
130680
- this._writableState.destroyed = value;
130681
- }
130682
- });
130683
- }
130684
- });
130685
-
130686
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
130687
- var require_end_of_stream4 = __commonJS({
130688
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) {
130689
- "use strict";
130690
- init_global();
130691
- init_process();
130692
- init_setImmediate();
130693
- init_buffer();
130694
- init_setInterval();
130695
- var ERR_STREAM_PREMATURE_CLOSE = require_errors_browser4().codes.ERR_STREAM_PREMATURE_CLOSE;
130696
- function once(callback) {
130697
- var called = false;
130698
- return function() {
130699
- if (called)
130700
- return;
130701
- called = true;
130702
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
130703
- args[_key] = arguments[_key];
130704
- }
130705
- callback.apply(this, args);
130706
- };
130707
- }
130708
- function noop() {
130709
- }
130710
- function isRequest(stream) {
130711
- return stream.setHeader && typeof stream.abort === "function";
130712
- }
130713
- function eos(stream, opts, callback) {
130714
- if (typeof opts === "function")
130715
- return eos(stream, null, opts);
130716
- if (!opts)
130717
- opts = {};
130718
- callback = once(callback || noop);
130719
- var readable = opts.readable || opts.readable !== false && stream.readable;
130720
- var writable = opts.writable || opts.writable !== false && stream.writable;
130721
- var onlegacyfinish = function onlegacyfinish2() {
130722
- if (!stream.writable)
130723
- onfinish();
130724
- };
130725
- var writableEnded = stream._writableState && stream._writableState.finished;
130726
- var onfinish = function onfinish2() {
130727
- writable = false;
130728
- writableEnded = true;
130729
- if (!readable)
130730
- callback.call(stream);
130731
- };
130732
- var readableEnded = stream._readableState && stream._readableState.endEmitted;
130733
- var onend = function onend2() {
130734
- readable = false;
130735
- readableEnded = true;
130736
- if (!writable)
130737
- callback.call(stream);
130738
- };
130739
- var onerror = function onerror2(err) {
130740
- callback.call(stream, err);
130741
- };
130742
- var onclose = function onclose2() {
130743
- var err;
130744
- if (readable && !readableEnded) {
130745
- if (!stream._readableState || !stream._readableState.ended)
130746
- err = new ERR_STREAM_PREMATURE_CLOSE();
130747
- return callback.call(stream, err);
130748
- }
130749
- if (writable && !writableEnded) {
130750
- if (!stream._writableState || !stream._writableState.ended)
130751
- err = new ERR_STREAM_PREMATURE_CLOSE();
130752
- return callback.call(stream, err);
130753
- }
130754
- };
130755
- var onrequest = function onrequest2() {
130756
- stream.req.on("finish", onfinish);
130757
- };
130758
- if (isRequest(stream)) {
130759
- stream.on("complete", onfinish);
130760
- stream.on("abort", onclose);
130761
- if (stream.req)
130762
- onrequest();
130763
- else
130764
- stream.on("request", onrequest);
130765
- } else if (writable && !stream._writableState) {
130766
- stream.on("end", onlegacyfinish);
130767
- stream.on("close", onlegacyfinish);
130768
- }
130769
- stream.on("end", onend);
130770
- stream.on("finish", onfinish);
130771
- if (opts.error !== false)
130772
- stream.on("error", onerror);
130773
- stream.on("close", onclose);
130774
- return function() {
130775
- stream.removeListener("complete", onfinish);
130776
- stream.removeListener("abort", onclose);
130777
- stream.removeListener("request", onrequest);
130778
- if (stream.req)
130779
- stream.req.removeListener("finish", onfinish);
130780
- stream.removeListener("end", onlegacyfinish);
130781
- stream.removeListener("close", onlegacyfinish);
130782
- stream.removeListener("finish", onfinish);
130783
- stream.removeListener("end", onend);
130784
- stream.removeListener("error", onerror);
130785
- stream.removeListener("close", onclose);
130786
- };
130787
- }
130788
- module.exports = eos;
130789
- }
130790
- });
130791
-
130792
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/async_iterator.js
130793
- var require_async_iterator4 = __commonJS({
130794
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module) {
130795
- "use strict";
130796
- init_global();
130797
- init_process();
130798
- init_setImmediate();
130799
- init_buffer();
130800
- init_setInterval();
130801
- var _Object$setPrototypeO;
130802
- function _defineProperty(obj, key, value) {
130803
- key = _toPropertyKey(key);
130804
- if (key in obj) {
130805
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
130806
- } else {
130807
- obj[key] = value;
130808
- }
130809
- return obj;
130810
- }
130811
- function _toPropertyKey(arg) {
130812
- var key = _toPrimitive(arg, "string");
130813
- return typeof key === "symbol" ? key : String(key);
130814
- }
130815
- function _toPrimitive(input, hint) {
130816
- if (typeof input !== "object" || input === null)
130817
- return input;
130818
- var prim = input[Symbol.toPrimitive];
130819
- if (prim !== void 0) {
130820
- var res = prim.call(input, hint || "default");
130821
- if (typeof res !== "object")
130822
- return res;
130823
- throw new TypeError("@@toPrimitive must return a primitive value.");
130824
- }
130825
- return (hint === "string" ? String : Number)(input);
130826
- }
130827
- var finished = require_end_of_stream4();
130828
- var kLastResolve = Symbol("lastResolve");
130829
- var kLastReject = Symbol("lastReject");
130830
- var kError = Symbol("error");
130831
- var kEnded = Symbol("ended");
130832
- var kLastPromise = Symbol("lastPromise");
130833
- var kHandlePromise = Symbol("handlePromise");
130834
- var kStream = Symbol("stream");
130835
- function createIterResult(value, done) {
130836
- return {
130837
- value,
130838
- done
130839
- };
130840
- }
130841
- function readAndResolve(iter) {
130842
- var resolve = iter[kLastResolve];
130843
- if (resolve !== null) {
130844
- var data = iter[kStream].read();
130845
- if (data !== null) {
130846
- iter[kLastPromise] = null;
130847
- iter[kLastResolve] = null;
130848
- iter[kLastReject] = null;
130849
- resolve(createIterResult(data, false));
130850
- }
130851
- }
130852
- }
130853
- function onReadable(iter) {
130854
- process.nextTick(readAndResolve, iter);
130855
- }
130856
- function wrapForNext(lastPromise, iter) {
130857
- return function(resolve, reject) {
130858
- lastPromise.then(function() {
130859
- if (iter[kEnded]) {
130860
- resolve(createIterResult(void 0, true));
130861
- return;
130862
- }
130863
- iter[kHandlePromise](resolve, reject);
130864
- }, reject);
130865
- };
130866
- }
130867
- var AsyncIteratorPrototype = Object.getPrototypeOf(function() {
130868
- });
130869
- var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
130870
- get stream() {
130871
- return this[kStream];
130872
- },
130873
- next: function next() {
130874
- var _this = this;
130875
- var error = this[kError];
130876
- if (error !== null) {
130877
- return Promise.reject(error);
130878
- }
130879
- if (this[kEnded]) {
130880
- return Promise.resolve(createIterResult(void 0, true));
130881
- }
130882
- if (this[kStream].destroyed) {
130883
- return new Promise(function(resolve, reject) {
130884
- process.nextTick(function() {
130885
- if (_this[kError]) {
130886
- reject(_this[kError]);
130887
- } else {
130888
- resolve(createIterResult(void 0, true));
130889
- }
130890
- });
130891
- });
130892
- }
130893
- var lastPromise = this[kLastPromise];
130894
- var promise;
130895
- if (lastPromise) {
130896
- promise = new Promise(wrapForNext(lastPromise, this));
130897
- } else {
130898
- var data = this[kStream].read();
130899
- if (data !== null) {
130900
- return Promise.resolve(createIterResult(data, false));
130901
- }
130902
- promise = new Promise(this[kHandlePromise]);
130903
- }
130904
- this[kLastPromise] = promise;
130905
- return promise;
130906
- }
130907
- }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {
130908
- return this;
130909
- }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
130910
- var _this2 = this;
130911
- return new Promise(function(resolve, reject) {
130912
- _this2[kStream].destroy(null, function(err) {
130913
- if (err) {
130914
- reject(err);
130915
- return;
130916
- }
130917
- resolve(createIterResult(void 0, true));
130918
- });
130919
- });
130920
- }), _Object$setPrototypeO), AsyncIteratorPrototype);
130921
- var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {
130922
- var _Object$create;
130923
- var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
130924
- value: stream,
130925
- writable: true
130926
- }), _defineProperty(_Object$create, kLastResolve, {
130927
- value: null,
130928
- writable: true
130929
- }), _defineProperty(_Object$create, kLastReject, {
130930
- value: null,
130931
- writable: true
130932
- }), _defineProperty(_Object$create, kError, {
130933
- value: null,
130934
- writable: true
130935
- }), _defineProperty(_Object$create, kEnded, {
130936
- value: stream._readableState.endEmitted,
130937
- writable: true
130938
- }), _defineProperty(_Object$create, kHandlePromise, {
130939
- value: function value(resolve, reject) {
130940
- var data = iterator[kStream].read();
130941
- if (data) {
130942
- iterator[kLastPromise] = null;
130943
- iterator[kLastResolve] = null;
130944
- iterator[kLastReject] = null;
130945
- resolve(createIterResult(data, false));
130946
- } else {
130947
- iterator[kLastResolve] = resolve;
130948
- iterator[kLastReject] = reject;
130949
- }
130950
- },
130951
- writable: true
130952
- }), _Object$create));
130953
- iterator[kLastPromise] = null;
130954
- finished(stream, function(err) {
130955
- if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
130956
- var reject = iterator[kLastReject];
130957
- if (reject !== null) {
130958
- iterator[kLastPromise] = null;
130959
- iterator[kLastResolve] = null;
130960
- iterator[kLastReject] = null;
130961
- reject(err);
130962
- }
130963
- iterator[kError] = err;
130964
- return;
130965
- }
130966
- var resolve = iterator[kLastResolve];
130967
- if (resolve !== null) {
130968
- iterator[kLastPromise] = null;
130969
- iterator[kLastResolve] = null;
130970
- iterator[kLastReject] = null;
130971
- resolve(createIterResult(void 0, true));
130972
- }
130973
- iterator[kEnded] = true;
130974
- });
130975
- stream.on("readable", onReadable.bind(null, iterator));
130976
- return iterator;
130977
- };
130978
- module.exports = createReadableStreamAsyncIterator;
130979
- }
130980
- });
130981
-
130982
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/from-browser.js
130983
- var require_from_browser4 = __commonJS({
130984
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/from-browser.js"(exports, module) {
130985
- init_global();
130986
- init_process();
130987
- init_setImmediate();
130988
- init_buffer();
130989
- init_setInterval();
130990
- module.exports = function() {
130991
- throw new Error("Readable.from is not available in the browser");
130992
- };
130993
- }
130994
- });
130995
-
130996
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_readable.js
130997
- var require_stream_readable5 = __commonJS({
130998
- "../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_readable.js"(exports, module) {
130999
- "use strict";
131000
- init_global();
131001
- init_process();
131002
- init_setImmediate();
131003
- init_buffer();
131004
- init_setInterval();
131005
- module.exports = Readable;
131006
- var Duplex;
131007
- Readable.ReadableState = ReadableState;
131008
- var EE = require_events().EventEmitter;
131009
- var EElistenerCount = function EElistenerCount2(emitter, type) {
131010
- return emitter.listeners(type).length;
131011
- };
131012
- var Stream = require_stream_browser5();
131013
- var Buffer4 = require_buffer().Buffer;
131014
- var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
131015
- };
131016
- function _uint8ArrayToBuffer(chunk) {
131017
- return Buffer4.from(chunk);
131018
- }
131019
- function _isUint8Array(obj) {
131020
- return Buffer4.isBuffer(obj) || obj instanceof OurUint8Array;
131021
- }
131022
- var debugUtil = require_util();
131023
- var debug;
131024
- if (debugUtil && debugUtil.debuglog) {
131025
- debug = debugUtil.debuglog("stream");
131026
- } else {
131027
- debug = function debug2() {
131028
- };
131029
- }
131030
- var BufferList = require_buffer_list4();
131031
- var destroyImpl = require_destroy5();
131032
- var _require = require_state4();
131033
- var getHighWaterMark = _require.getHighWaterMark;
131034
- var _require$codes = require_errors_browser4().codes;
131035
- var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
131036
- var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
131037
- var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
131038
- var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
131039
- var StringDecoder;
131040
- var createReadableStreamAsyncIterator;
131041
- var from;
131042
- require_inherits_browser()(Readable, Stream);
131043
- var errorOrDestroy = destroyImpl.errorOrDestroy;
131044
- var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
131045
- function prependListener(emitter, event, fn) {
131046
- if (typeof emitter.prependListener === "function")
131047
- return emitter.prependListener(event, fn);
131048
- if (!emitter._events || !emitter._events[event])
131049
- emitter.on(event, fn);
131050
- else if (Array.isArray(emitter._events[event]))
131051
- emitter._events[event].unshift(fn);
131052
- else
131053
- emitter._events[event] = [fn, emitter._events[event]];
131054
- }
131055
- function ReadableState(options, stream, isDuplex) {
131056
- Duplex = Duplex || require_stream_duplex5();
131057
- options = options || {};
131058
- if (typeof isDuplex !== "boolean")
131059
- isDuplex = stream instanceof Duplex;
131060
- this.objectMode = !!options.objectMode;
131061
- if (isDuplex)
131062
- this.objectMode = this.objectMode || !!options.readableObjectMode;
131063
- this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
131064
- this.buffer = new BufferList();
131065
- this.length = 0;
131066
- this.pipes = null;
131067
- this.pipesCount = 0;
131068
- this.flowing = null;
131069
- this.ended = false;
131070
- this.endEmitted = false;
131071
- this.reading = false;
131072
- this.sync = true;
131073
- this.needReadable = false;
131074
- this.emittedReadable = false;
131075
- this.readableListening = false;
131076
- this.resumeScheduled = false;
131077
- this.paused = true;
131078
- this.emitClose = options.emitClose !== false;
131079
- this.autoDestroy = !!options.autoDestroy;
131080
- this.destroyed = false;
131081
- this.defaultEncoding = options.defaultEncoding || "utf8";
131082
- this.awaitDrain = 0;
131083
- this.readingMore = false;
131084
- this.decoder = null;
131085
- this.encoding = null;
131086
- if (options.encoding) {
131087
- if (!StringDecoder)
131088
- StringDecoder = require_string_decoder().StringDecoder;
131089
- this.decoder = new StringDecoder(options.encoding);
131090
- this.encoding = options.encoding;
131091
- }
131092
- }
131093
- function Readable(options) {
131094
- Duplex = Duplex || require_stream_duplex5();
131095
- if (!(this instanceof Readable))
131096
- return new Readable(options);
131097
- var isDuplex = this instanceof Duplex;
131098
- this._readableState = new ReadableState(options, this, isDuplex);
131099
- this.readable = true;
131100
- if (options) {
131101
- if (typeof options.read === "function")
131102
- this._read = options.read;
131103
- if (typeof options.destroy === "function")
131104
- this._destroy = options.destroy;
131105
- }
131106
- Stream.call(this);
131107
- }
131108
- Object.defineProperty(Readable.prototype, "destroyed", {
131109
- // making it explicit this property is not enumerable
131110
- // because otherwise some prototype manipulation in
131111
- // userland will fail
131112
- enumerable: false,
131113
- get: function get() {
131114
- if (this._readableState === void 0) {
131115
- return false;
131116
- }
131117
- return this._readableState.destroyed;
131118
- },
131119
- set: function set(value) {
131120
- if (!this._readableState) {
131121
- return;
131122
- }
131123
- this._readableState.destroyed = value;
131124
- }
131125
- });
131126
- Readable.prototype.destroy = destroyImpl.destroy;
131127
- Readable.prototype._undestroy = destroyImpl.undestroy;
131128
- Readable.prototype._destroy = function(err, cb) {
131129
- cb(err);
131130
- };
131131
- Readable.prototype.push = function(chunk, encoding) {
131132
- var state = this._readableState;
131133
- var skipChunkCheck;
131134
- if (!state.objectMode) {
131135
- if (typeof chunk === "string") {
131136
- encoding = encoding || state.defaultEncoding;
131137
- if (encoding !== state.encoding) {
131138
- chunk = Buffer4.from(chunk, encoding);
131139
- encoding = "";
131140
- }
131141
- skipChunkCheck = true;
131142
- }
131143
- } else {
131144
- skipChunkCheck = true;
131145
- }
131146
- return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
131147
- };
131148
- Readable.prototype.unshift = function(chunk) {
131149
- return readableAddChunk(this, chunk, null, true, false);
131150
- };
131151
- function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
131152
- debug("readableAddChunk", chunk);
131153
- var state = stream._readableState;
131154
- if (chunk === null) {
131155
- state.reading = false;
131156
- onEofChunk(stream, state);
131157
- } else {
131158
- var er;
131159
- if (!skipChunkCheck)
131160
- er = chunkInvalid(state, chunk);
131161
- if (er) {
131162
- errorOrDestroy(stream, er);
131163
- } else if (state.objectMode || chunk && chunk.length > 0) {
131164
- if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer4.prototype) {
131165
- chunk = _uint8ArrayToBuffer(chunk);
131166
- }
131167
- if (addToFront) {
131168
- if (state.endEmitted)
131169
- errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
131170
- else
131171
- addChunk(stream, state, chunk, true);
131172
- } else if (state.ended) {
131173
- errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
131174
- } else if (state.destroyed) {
131175
- return false;
131176
- } else {
131177
- state.reading = false;
131178
- if (state.decoder && !encoding) {
131179
- chunk = state.decoder.write(chunk);
131180
- if (state.objectMode || chunk.length !== 0)
131181
- addChunk(stream, state, chunk, false);
131182
- else
131183
- maybeReadMore(stream, state);
131184
- } else {
131185
- addChunk(stream, state, chunk, false);
131186
- }
131187
- }
131188
- } else if (!addToFront) {
131189
- state.reading = false;
131190
- maybeReadMore(stream, state);
131191
- }
131192
- }
131193
- return !state.ended && (state.length < state.highWaterMark || state.length === 0);
131194
- }
131195
- function addChunk(stream, state, chunk, addToFront) {
131196
- if (state.flowing && state.length === 0 && !state.sync) {
131197
- state.awaitDrain = 0;
131198
- stream.emit("data", chunk);
131199
- } else {
131200
- state.length += state.objectMode ? 1 : chunk.length;
131201
- if (addToFront)
131202
- state.buffer.unshift(chunk);
131203
- else
131204
- state.buffer.push(chunk);
131205
- if (state.needReadable)
131206
- emitReadable(stream);
131207
- }
131208
- maybeReadMore(stream, state);
131209
- }
131210
- function chunkInvalid(state, chunk) {
131211
- var er;
131212
- if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
131213
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
131214
- }
131215
- return er;
131216
- }
131217
- Readable.prototype.isPaused = function() {
131218
- return this._readableState.flowing === false;
131219
- };
131220
- Readable.prototype.setEncoding = function(enc) {
131221
- if (!StringDecoder)
131222
- StringDecoder = require_string_decoder().StringDecoder;
131223
- var decoder = new StringDecoder(enc);
131224
- this._readableState.decoder = decoder;
131225
- this._readableState.encoding = this._readableState.decoder.encoding;
131226
- var p = this._readableState.buffer.head;
131227
- var content = "";
131228
- while (p !== null) {
131229
- content += decoder.write(p.data);
131230
- p = p.next;
131231
- }
131232
- this._readableState.buffer.clear();
131233
- if (content !== "")
131234
- this._readableState.buffer.push(content);
131235
- this._readableState.length = content.length;
131236
- return this;
131237
- };
131238
- var MAX_HWM = 1073741824;
131239
- function computeNewHighWaterMark(n) {
131240
- if (n >= MAX_HWM) {
131241
- n = MAX_HWM;
131242
- } else {
131243
- n--;
131244
- n |= n >>> 1;
131245
- n |= n >>> 2;
131246
- n |= n >>> 4;
131247
- n |= n >>> 8;
131248
- n |= n >>> 16;
131249
- n++;
131250
- }
131251
- return n;
131252
- }
131253
- function howMuchToRead(n, state) {
131254
- if (n <= 0 || state.length === 0 && state.ended)
131255
- return 0;
131256
- if (state.objectMode)
131257
- return 1;
131258
- if (n !== n) {
131259
- if (state.flowing && state.length)
131260
- return state.buffer.head.data.length;
131261
- else
131262
- return state.length;
131263
- }
131264
- if (n > state.highWaterMark)
131265
- state.highWaterMark = computeNewHighWaterMark(n);
131266
- if (n <= state.length)
131267
- return n;
131268
- if (!state.ended) {
131269
- state.needReadable = true;
131270
- return 0;
131271
- }
131272
- return state.length;
131273
- }
131274
- Readable.prototype.read = function(n) {
131275
- debug("read", n);
131276
- n = parseInt(n, 10);
131277
- var state = this._readableState;
131278
- var nOrig = n;
131279
- if (n !== 0)
131280
- state.emittedReadable = false;
131281
- if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
131282
- debug("read: emitReadable", state.length, state.ended);
131283
- if (state.length === 0 && state.ended)
131284
- endReadable(this);
131285
- else
131286
- emitReadable(this);
131287
- return null;
131288
- }
131289
- n = howMuchToRead(n, state);
131290
- if (n === 0 && state.ended) {
131291
- if (state.length === 0)
131292
- endReadable(this);
131293
- return null;
131294
- }
131295
- var doRead = state.needReadable;
131296
- debug("need readable", doRead);
131297
- if (state.length === 0 || state.length - n < state.highWaterMark) {
131298
- doRead = true;
131299
- debug("length less than watermark", doRead);
131300
- }
131301
- if (state.ended || state.reading) {
131302
- doRead = false;
131303
- debug("reading or ended", doRead);
131304
- } else if (doRead) {
131305
- debug("do read");
131306
- state.reading = true;
131307
- state.sync = true;
131308
- if (state.length === 0)
131309
- state.needReadable = true;
131310
- this._read(state.highWaterMark);
131311
- state.sync = false;
131312
- if (!state.reading)
131313
- n = howMuchToRead(nOrig, state);
131314
- }
131315
- var ret;
131316
- if (n > 0)
131317
- ret = fromList(n, state);
131318
- else
131319
- ret = null;
131320
- if (ret === null) {
131321
- state.needReadable = state.length <= state.highWaterMark;
131322
- n = 0;
131323
- } else {
131324
- state.length -= n;
131325
- state.awaitDrain = 0;
131326
- }
131327
- if (state.length === 0) {
131328
- if (!state.ended)
131329
- state.needReadable = true;
131330
- if (nOrig !== n && state.ended)
131331
- endReadable(this);
131332
- }
131333
- if (ret !== null)
131334
- this.emit("data", ret);
131335
- return ret;
131336
- };
131337
- function onEofChunk(stream, state) {
131338
- debug("onEofChunk");
131339
- if (state.ended)
131340
- return;
131341
- if (state.decoder) {
131342
- var chunk = state.decoder.end();
131343
- if (chunk && chunk.length) {
131344
- state.buffer.push(chunk);
131345
- state.length += state.objectMode ? 1 : chunk.length;
131346
- }
131347
- }
131348
- state.ended = true;
131349
- if (state.sync) {
131350
- emitReadable(stream);
131351
- } else {
131352
- state.needReadable = false;
131353
- if (!state.emittedReadable) {
131354
- state.emittedReadable = true;
131355
- emitReadable_(stream);
131356
- }
131357
- }
131358
- }
131359
- function emitReadable(stream) {
131360
- var state = stream._readableState;
131361
- debug("emitReadable", state.needReadable, state.emittedReadable);
131362
- state.needReadable = false;
131363
- if (!state.emittedReadable) {
131364
- debug("emitReadable", state.flowing);
131365
- state.emittedReadable = true;
131366
- process.nextTick(emitReadable_, stream);
131367
- }
131368
- }
131369
- function emitReadable_(stream) {
131370
- var state = stream._readableState;
131371
- debug("emitReadable_", state.destroyed, state.length, state.ended);
131372
- if (!state.destroyed && (state.length || state.ended)) {
131373
- stream.emit("readable");
131374
- state.emittedReadable = false;
131375
- }
131376
- state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
131377
- flow(stream);
131378
- }
131379
- function maybeReadMore(stream, state) {
131380
- if (!state.readingMore) {
131381
- state.readingMore = true;
131382
- process.nextTick(maybeReadMore_, stream, state);
131383
- }
131384
- }
131385
- function maybeReadMore_(stream, state) {
131386
- while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
131387
- var len = state.length;
131388
- debug("maybeReadMore read 0");
131389
- stream.read(0);
131390
- if (len === state.length)
131391
- break;
131392
- }
131393
- state.readingMore = false;
131394
- }
131395
- Readable.prototype._read = function(n) {
131396
- errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
131397
- };
131398
- Readable.prototype.pipe = function(dest, pipeOpts) {
131399
- var src = this;
131400
- var state = this._readableState;
131401
- switch (state.pipesCount) {
131402
- case 0:
131403
- state.pipes = dest;
131404
- break;
131405
- case 1:
131406
- state.pipes = [state.pipes, dest];
131407
- break;
131408
- default:
131409
- state.pipes.push(dest);
131410
- break;
131411
- }
131412
- state.pipesCount += 1;
131413
- debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
131414
- var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
131415
- var endFn = doEnd ? onend : unpipe;
131416
- if (state.endEmitted)
131417
- process.nextTick(endFn);
131418
- else
131419
- src.once("end", endFn);
131420
- dest.on("unpipe", onunpipe);
131421
- function onunpipe(readable, unpipeInfo) {
131422
- debug("onunpipe");
131423
- if (readable === src) {
131424
- if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
131425
- unpipeInfo.hasUnpiped = true;
131426
- cleanup();
131427
- }
131428
- }
131429
- }
131430
- function onend() {
131431
- debug("onend");
131432
- dest.end();
131433
- }
131434
- var ondrain = pipeOnDrain(src);
131435
- dest.on("drain", ondrain);
131436
- var cleanedUp = false;
131437
- function cleanup() {
131438
- debug("cleanup");
131439
- dest.removeListener("close", onclose);
131440
- dest.removeListener("finish", onfinish);
131441
- dest.removeListener("drain", ondrain);
131442
- dest.removeListener("error", onerror);
131443
- dest.removeListener("unpipe", onunpipe);
131444
- src.removeListener("end", onend);
131445
- src.removeListener("end", unpipe);
131446
- src.removeListener("data", ondata);
131447
- cleanedUp = true;
131448
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
131449
- ondrain();
131450
- }
131451
- src.on("data", ondata);
131452
- function ondata(chunk) {
131453
- debug("ondata");
131454
- var ret = dest.write(chunk);
131455
- debug("dest.write", ret);
131456
- if (ret === false) {
131457
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
131458
- debug("false write response, pause", state.awaitDrain);
131459
- state.awaitDrain++;
131460
- }
131461
- src.pause();
131462
- }
131463
- }
131464
- function onerror(er) {
131465
- debug("onerror", er);
131466
- unpipe();
131467
- dest.removeListener("error", onerror);
131468
- if (EElistenerCount(dest, "error") === 0)
131469
- errorOrDestroy(dest, er);
131470
- }
131471
- prependListener(dest, "error", onerror);
131472
- function onclose() {
131473
- dest.removeListener("finish", onfinish);
131474
- unpipe();
131475
- }
131476
- dest.once("close", onclose);
131477
- function onfinish() {
131478
- debug("onfinish");
131479
- dest.removeListener("close", onclose);
131480
- unpipe();
131481
- }
131482
- dest.once("finish", onfinish);
131483
- function unpipe() {
131484
- debug("unpipe");
131485
- src.unpipe(dest);
131486
- }
131487
- dest.emit("pipe", src);
131488
- if (!state.flowing) {
131489
- debug("pipe resume");
131490
- src.resume();
131491
- }
131492
- return dest;
131493
- };
131494
- function pipeOnDrain(src) {
131495
- return function pipeOnDrainFunctionResult() {
131496
- var state = src._readableState;
131497
- debug("pipeOnDrain", state.awaitDrain);
131498
- if (state.awaitDrain)
131499
- state.awaitDrain--;
131500
- if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
131501
- state.flowing = true;
131502
- flow(src);
131503
- }
131504
- };
131505
- }
131506
- Readable.prototype.unpipe = function(dest) {
131507
- var state = this._readableState;
131508
- var unpipeInfo = {
131509
- hasUnpiped: false
131510
- };
131511
- if (state.pipesCount === 0)
131512
- return this;
131513
- if (state.pipesCount === 1) {
131514
- if (dest && dest !== state.pipes)
131515
- return this;
131516
- if (!dest)
131517
- dest = state.pipes;
131518
- state.pipes = null;
131519
- state.pipesCount = 0;
131520
- state.flowing = false;
131521
- if (dest)
131522
- dest.emit("unpipe", this, unpipeInfo);
131523
- return this;
131524
- }
131525
- if (!dest) {
131526
- var dests = state.pipes;
131527
- var len = state.pipesCount;
131528
- state.pipes = null;
131529
- state.pipesCount = 0;
131530
- state.flowing = false;
131531
- for (var i = 0; i < len; i++)
131532
- dests[i].emit("unpipe", this, {
131533
- hasUnpiped: false
131534
- });
131535
- return this;
131536
- }
131537
- var index = indexOf(state.pipes, dest);
131538
- if (index === -1)
131539
- return this;
131540
- state.pipes.splice(index, 1);
131541
- state.pipesCount -= 1;
131542
- if (state.pipesCount === 1)
131543
- state.pipes = state.pipes[0];
131544
- dest.emit("unpipe", this, unpipeInfo);
131545
- return this;
131546
- };
131547
- Readable.prototype.on = function(ev, fn) {
131548
- var res = Stream.prototype.on.call(this, ev, fn);
131549
- var state = this._readableState;
131550
- if (ev === "data") {
131551
- state.readableListening = this.listenerCount("readable") > 0;
131552
- if (state.flowing !== false)
131553
- this.resume();
131554
- } else if (ev === "readable") {
131555
- if (!state.endEmitted && !state.readableListening) {
131556
- state.readableListening = state.needReadable = true;
131557
- state.flowing = false;
131558
- state.emittedReadable = false;
131559
- debug("on readable", state.length, state.reading);
131560
- if (state.length) {
131561
- emitReadable(this);
131562
- } else if (!state.reading) {
131563
- process.nextTick(nReadingNextTick, this);
131564
- }
131565
- }
131566
- }
131567
- return res;
131568
- };
131569
- Readable.prototype.addListener = Readable.prototype.on;
131570
- Readable.prototype.removeListener = function(ev, fn) {
131571
- var res = Stream.prototype.removeListener.call(this, ev, fn);
131572
- if (ev === "readable") {
131573
- process.nextTick(updateReadableListening, this);
131574
- }
131575
- return res;
131576
- };
131577
- Readable.prototype.removeAllListeners = function(ev) {
131578
- var res = Stream.prototype.removeAllListeners.apply(this, arguments);
131579
- if (ev === "readable" || ev === void 0) {
131580
- process.nextTick(updateReadableListening, this);
131581
- }
131582
- return res;
131583
- };
131584
- function updateReadableListening(self2) {
131585
- var state = self2._readableState;
131586
- state.readableListening = self2.listenerCount("readable") > 0;
131587
- if (state.resumeScheduled && !state.paused) {
131588
- state.flowing = true;
131589
- } else if (self2.listenerCount("data") > 0) {
131590
- self2.resume();
131591
- }
131592
- }
131593
- function nReadingNextTick(self2) {
131594
- debug("readable nexttick read 0");
131595
- self2.read(0);
131596
- }
131597
- Readable.prototype.resume = function() {
131598
- var state = this._readableState;
131599
- if (!state.flowing) {
131600
- debug("resume");
131601
- state.flowing = !state.readableListening;
131602
- resume(this, state);
131603
- }
131604
- state.paused = false;
131605
- return this;
131606
- };
131607
- function resume(stream, state) {
131608
- if (!state.resumeScheduled) {
131609
- state.resumeScheduled = true;
131610
- process.nextTick(resume_, stream, state);
131611
- }
131612
- }
131613
- function resume_(stream, state) {
131614
- debug("resume", state.reading);
131615
- if (!state.reading) {
131616
- stream.read(0);
131617
- }
131618
- state.resumeScheduled = false;
131619
- stream.emit("resume");
131620
- flow(stream);
131621
- if (state.flowing && !state.reading)
131622
- stream.read(0);
131623
- }
131624
- Readable.prototype.pause = function() {
131625
- debug("call pause flowing=%j", this._readableState.flowing);
131626
- if (this._readableState.flowing !== false) {
131627
- debug("pause");
131628
- this._readableState.flowing = false;
131629
- this.emit("pause");
131630
- }
131631
- this._readableState.paused = true;
131632
- return this;
131633
- };
131634
- function flow(stream) {
131635
- var state = stream._readableState;
131636
- debug("flow", state.flowing);
131637
- while (state.flowing && stream.read() !== null)
131638
- ;
131639
- }
131640
- Readable.prototype.wrap = function(stream) {
131641
- var _this = this;
131642
- var state = this._readableState;
131643
- var paused = false;
131644
- stream.on("end", function() {
131645
- debug("wrapped end");
131646
- if (state.decoder && !state.ended) {
131647
- var chunk = state.decoder.end();
131648
- if (chunk && chunk.length)
131649
- _this.push(chunk);
131650
- }
131651
- _this.push(null);
131652
- });
131653
- stream.on("data", function(chunk) {
131654
- debug("wrapped data");
131655
- if (state.decoder)
131656
- chunk = state.decoder.write(chunk);
131657
- if (state.objectMode && (chunk === null || chunk === void 0))
131658
- return;
131659
- else if (!state.objectMode && (!chunk || !chunk.length))
131660
- return;
131661
- var ret = _this.push(chunk);
131662
- if (!ret) {
131663
- paused = true;
131664
- stream.pause();
131665
- }
131666
- });
131667
- for (var i in stream) {
131668
- if (this[i] === void 0 && typeof stream[i] === "function") {
131669
- this[i] = function methodWrap(method) {
131670
- return function methodWrapReturnFunction() {
131671
- return stream[method].apply(stream, arguments);
131672
- };
131673
- }(i);
131674
- }
131675
- }
131676
- for (var n = 0; n < kProxyEvents.length; n++) {
131677
- stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
131678
- }
131679
- this._read = function(n2) {
131680
- debug("wrapped _read", n2);
131681
- if (paused) {
131682
- paused = false;
131683
- stream.resume();
131684
- }
131685
- };
131686
- return this;
131687
- };
131688
- if (typeof Symbol === "function") {
131689
- Readable.prototype[Symbol.asyncIterator] = function() {
131690
- if (createReadableStreamAsyncIterator === void 0) {
131691
- createReadableStreamAsyncIterator = require_async_iterator4();
131692
- }
131693
- return createReadableStreamAsyncIterator(this);
131694
- };
131695
- }
131696
- Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
131697
- // making it explicit this property is not enumerable
131698
- // because otherwise some prototype manipulation in
131699
- // userland will fail
131700
- enumerable: false,
131701
- get: function get() {
131702
- return this._readableState.highWaterMark;
131703
- }
131704
- });
131705
- Object.defineProperty(Readable.prototype, "readableBuffer", {
131706
- // making it explicit this property is not enumerable
131707
- // because otherwise some prototype manipulation in
131708
- // userland will fail
131709
- enumerable: false,
131710
- get: function get() {
131711
- return this._readableState && this._readableState.buffer;
131712
- }
131713
- });
131714
- Object.defineProperty(Readable.prototype, "readableFlowing", {
131715
- // making it explicit this property is not enumerable
131716
- // because otherwise some prototype manipulation in
131717
- // userland will fail
131718
- enumerable: false,
131719
- get: function get() {
131720
- return this._readableState.flowing;
131721
- },
131722
- set: function set(state) {
131723
- if (this._readableState) {
131724
- this._readableState.flowing = state;
131725
- }
131726
- }
131727
- });
131728
- Readable._fromList = fromList;
131729
- Object.defineProperty(Readable.prototype, "readableLength", {
131730
- // making it explicit this property is not enumerable
131731
- // because otherwise some prototype manipulation in
131732
- // userland will fail
131733
- enumerable: false,
131734
- get: function get() {
131735
- return this._readableState.length;
131736
- }
131737
- });
131738
- function fromList(n, state) {
131739
- if (state.length === 0)
131740
- return null;
131741
- var ret;
131742
- if (state.objectMode)
131743
- ret = state.buffer.shift();
131744
- else if (!n || n >= state.length) {
131745
- if (state.decoder)
131746
- ret = state.buffer.join("");
131747
- else if (state.buffer.length === 1)
131748
- ret = state.buffer.first();
131749
- else
131750
- ret = state.buffer.concat(state.length);
131751
- state.buffer.clear();
131752
- } else {
131753
- ret = state.buffer.consume(n, state.decoder);
131754
- }
131755
- return ret;
131756
- }
131757
- function endReadable(stream) {
131758
- var state = stream._readableState;
131759
- debug("endReadable", state.endEmitted);
131760
- if (!state.endEmitted) {
131761
- state.ended = true;
131762
- process.nextTick(endReadableNT, state, stream);
131763
- }
131764
- }
131765
- function endReadableNT(state, stream) {
131766
- debug("endReadableNT", state.endEmitted, state.length);
131767
- if (!state.endEmitted && state.length === 0) {
131768
- state.endEmitted = true;
131769
- stream.readable = false;
131770
- stream.emit("end");
131771
- if (state.autoDestroy) {
131772
- var wState = stream._writableState;
131773
- if (!wState || wState.autoDestroy && wState.finished) {
131774
- stream.destroy();
131775
- }
131776
- }
131777
- }
131778
- }
131779
- if (typeof Symbol === "function") {
131780
- Readable.from = function(iterable, opts) {
131781
- if (from === void 0) {
131782
- from = require_from_browser4();
131783
- }
131784
- return from(Readable, iterable, opts);
131785
- };
131786
- }
131787
- function indexOf(xs, x) {
131788
- for (var i = 0, l = xs.length; i < l; i++) {
131789
- if (xs[i] === x)
131790
- return i;
131791
- }
131792
- return -1;
131793
- }
131794
- }
131795
- });
131796
-
131797
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_transform.js
131798
- var require_stream_transform5 = __commonJS({
131799
- "../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_transform.js"(exports, module) {
131800
- "use strict";
131801
- init_global();
131802
- init_process();
131803
- init_setImmediate();
131804
- init_buffer();
131805
- init_setInterval();
131806
- module.exports = Transform;
131807
- var _require$codes = require_errors_browser4().codes;
131808
- var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
131809
- var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
131810
- var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;
131811
- var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
131812
- var Duplex = require_stream_duplex5();
131813
- require_inherits_browser()(Transform, Duplex);
131814
- function afterTransform(er, data) {
131815
- var ts = this._transformState;
131816
- ts.transforming = false;
131817
- var cb = ts.writecb;
131818
- if (cb === null) {
131819
- return this.emit("error", new ERR_MULTIPLE_CALLBACK());
131820
- }
131821
- ts.writechunk = null;
131822
- ts.writecb = null;
131823
- if (data != null)
131824
- this.push(data);
131825
- cb(er);
131826
- var rs = this._readableState;
131827
- rs.reading = false;
131828
- if (rs.needReadable || rs.length < rs.highWaterMark) {
131829
- this._read(rs.highWaterMark);
131830
- }
131831
- }
131832
- function Transform(options) {
131833
- if (!(this instanceof Transform))
131834
- return new Transform(options);
131835
- Duplex.call(this, options);
131836
- this._transformState = {
131837
- afterTransform: afterTransform.bind(this),
131838
- needTransform: false,
131839
- transforming: false,
131840
- writecb: null,
131841
- writechunk: null,
131842
- writeencoding: null
131843
- };
131844
- this._readableState.needReadable = true;
131845
- this._readableState.sync = false;
131846
- if (options) {
131847
- if (typeof options.transform === "function")
131848
- this._transform = options.transform;
131849
- if (typeof options.flush === "function")
131850
- this._flush = options.flush;
131851
- }
131852
- this.on("prefinish", prefinish);
131853
- }
131854
- function prefinish() {
131855
- var _this = this;
131856
- if (typeof this._flush === "function" && !this._readableState.destroyed) {
131857
- this._flush(function(er, data) {
131858
- done(_this, er, data);
131859
- });
131860
- } else {
131861
- done(this, null, null);
131862
- }
131863
- }
131864
- Transform.prototype.push = function(chunk, encoding) {
131865
- this._transformState.needTransform = false;
131866
- return Duplex.prototype.push.call(this, chunk, encoding);
131867
- };
131868
- Transform.prototype._transform = function(chunk, encoding, cb) {
131869
- cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
131870
- };
131871
- Transform.prototype._write = function(chunk, encoding, cb) {
131872
- var ts = this._transformState;
131873
- ts.writecb = cb;
131874
- ts.writechunk = chunk;
131875
- ts.writeencoding = encoding;
131876
- if (!ts.transforming) {
131877
- var rs = this._readableState;
131878
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
131879
- this._read(rs.highWaterMark);
131880
- }
131881
- };
131882
- Transform.prototype._read = function(n) {
131883
- var ts = this._transformState;
131884
- if (ts.writechunk !== null && !ts.transforming) {
131885
- ts.transforming = true;
131886
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
131887
- } else {
131888
- ts.needTransform = true;
131889
- }
131890
- };
131891
- Transform.prototype._destroy = function(err, cb) {
131892
- Duplex.prototype._destroy.call(this, err, function(err2) {
131893
- cb(err2);
131894
- });
131895
- };
131896
- function done(stream, er, data) {
131897
- if (er)
131898
- return stream.emit("error", er);
131899
- if (data != null)
131900
- stream.push(data);
131901
- if (stream._writableState.length)
131902
- throw new ERR_TRANSFORM_WITH_LENGTH_0();
131903
- if (stream._transformState.transforming)
131904
- throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
131905
- return stream.push(null);
131906
- }
131907
- }
131908
- });
131909
-
131910
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_passthrough.js
131911
- var require_stream_passthrough5 = __commonJS({
131912
- "../../node_modules/stream-http/node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module) {
131913
- "use strict";
131914
- init_global();
131915
- init_process();
131916
- init_setImmediate();
131917
- init_buffer();
131918
- init_setInterval();
131919
- module.exports = PassThrough;
131920
- var Transform = require_stream_transform5();
131921
- require_inherits_browser()(PassThrough, Transform);
131922
- function PassThrough(options) {
131923
- if (!(this instanceof PassThrough))
131924
- return new PassThrough(options);
131925
- Transform.call(this, options);
131926
- }
131927
- PassThrough.prototype._transform = function(chunk, encoding, cb) {
131928
- cb(null, chunk);
131929
- };
131930
- }
131931
- });
131932
-
131933
- // ../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/pipeline.js
131934
- var require_pipeline4 = __commonJS({
131935
- "../../node_modules/stream-http/node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) {
131936
- "use strict";
131937
- init_global();
131938
- init_process();
131939
- init_setImmediate();
131940
- init_buffer();
131941
- init_setInterval();
131942
- var eos;
131943
- function once(callback) {
131944
- var called = false;
131945
- return function() {
131946
- if (called)
131947
- return;
131948
- called = true;
131949
- callback.apply(void 0, arguments);
131950
- };
131951
- }
131952
- var _require$codes = require_errors_browser4().codes;
131953
- var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
131954
- var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
131955
- function noop(err) {
131956
- if (err)
131957
- throw err;
131958
- }
131959
- function isRequest(stream) {
131960
- return stream.setHeader && typeof stream.abort === "function";
131961
- }
131962
- function destroyer(stream, reading, writing, callback) {
131963
- callback = once(callback);
131964
- var closed = false;
131965
- stream.on("close", function() {
131966
- closed = true;
131967
- });
131968
- if (eos === void 0)
131969
- eos = require_end_of_stream4();
131970
- eos(stream, {
131971
- readable: reading,
131972
- writable: writing
131973
- }, function(err) {
131974
- if (err)
131975
- return callback(err);
131976
- closed = true;
131977
- callback();
131978
- });
131979
- var destroyed = false;
131980
- return function(err) {
131981
- if (closed)
131982
- return;
131983
- if (destroyed)
131984
- return;
131985
- destroyed = true;
131986
- if (isRequest(stream))
131987
- return stream.abort();
131988
- if (typeof stream.destroy === "function")
131989
- return stream.destroy();
131990
- callback(err || new ERR_STREAM_DESTROYED("pipe"));
131991
- };
131992
- }
131993
- function call(fn) {
131994
- fn();
131995
- }
131996
- function pipe(from, to) {
131997
- return from.pipe(to);
131998
- }
131999
- function popCallback(streams) {
132000
- if (!streams.length)
132001
- return noop;
132002
- if (typeof streams[streams.length - 1] !== "function")
132003
- return noop;
132004
- return streams.pop();
132005
- }
132006
- function pipeline() {
132007
- for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
132008
- streams[_key] = arguments[_key];
132009
- }
132010
- var callback = popCallback(streams);
132011
- if (Array.isArray(streams[0]))
132012
- streams = streams[0];
132013
- if (streams.length < 2) {
132014
- throw new ERR_MISSING_ARGS("streams");
132015
- }
132016
- var error;
132017
- var destroys = streams.map(function(stream, i) {
132018
- var reading = i < streams.length - 1;
132019
- var writing = i > 0;
132020
- return destroyer(stream, reading, writing, function(err) {
132021
- if (!error)
132022
- error = err;
132023
- if (err)
132024
- destroys.forEach(call);
132025
- if (reading)
132026
- return;
132027
- destroys.forEach(call);
132028
- callback(error);
132029
- });
132030
- });
132031
- return streams.reduce(pipe);
132032
- }
132033
- module.exports = pipeline;
132034
- }
132035
- });
132036
-
132037
- // ../../node_modules/stream-http/node_modules/readable-stream/readable-browser.js
132038
- var require_readable_browser4 = __commonJS({
132039
- "../../node_modules/stream-http/node_modules/readable-stream/readable-browser.js"(exports, module) {
132040
- init_global();
132041
- init_process();
132042
- init_setImmediate();
132043
- init_buffer();
132044
- init_setInterval();
132045
- exports = module.exports = require_stream_readable5();
132046
- exports.Stream = exports;
132047
- exports.Readable = exports;
132048
- exports.Writable = require_stream_writable5();
132049
- exports.Duplex = require_stream_duplex5();
132050
- exports.Transform = require_stream_transform5();
132051
- exports.PassThrough = require_stream_passthrough5();
132052
- exports.finished = require_end_of_stream4();
132053
- exports.pipeline = require_pipeline4();
132054
- }
132055
- });
132056
-
132057
- // ../../node_modules/stream-http/lib/response.js
132058
- var require_response = __commonJS({
132059
- "../../node_modules/stream-http/lib/response.js"(exports) {
132060
- init_global();
132061
- init_process();
132062
- init_setImmediate();
132063
- init_buffer();
132064
- init_setInterval();
132065
- var capability = require_capability();
132066
- var inherits = require_inherits_browser();
132067
- var stream = require_readable_browser4();
132068
- var rStates = exports.readyStates = {
132069
- UNSENT: 0,
132070
- OPENED: 1,
132071
- HEADERS_RECEIVED: 2,
132072
- LOADING: 3,
132073
- DONE: 4
132074
- };
132075
- var IncomingMessage = exports.IncomingMessage = function(xhr, response, mode, resetTimers) {
132076
- var self2 = this;
132077
- stream.Readable.call(self2);
132078
- self2._mode = mode;
132079
- self2.headers = {};
132080
- self2.rawHeaders = [];
132081
- self2.trailers = {};
132082
- self2.rawTrailers = [];
132083
- self2.on("end", function() {
132084
- process.nextTick(function() {
132085
- self2.emit("close");
132086
- });
132087
- });
132088
- if (mode === "fetch") {
132089
- let read2 = function() {
132090
- reader.read().then(function(result) {
132091
- if (self2._destroyed)
132092
- return;
132093
- resetTimers(result.done);
132094
- if (result.done) {
132095
- self2.push(null);
132096
- return;
132097
- }
132098
- self2.push(import_buffer.Buffer.from(result.value));
132099
- read2();
132100
- }).catch(function(err) {
132101
- resetTimers(true);
132102
- if (!self2._destroyed)
132103
- self2.emit("error", err);
132104
- });
132105
- };
132106
- var read = read2;
132107
- self2._fetchResponse = response;
132108
- self2.url = response.url;
132109
- self2.statusCode = response.status;
132110
- self2.statusMessage = response.statusText;
132111
- response.headers.forEach(function(header, key) {
132112
- self2.headers[key.toLowerCase()] = header;
132113
- self2.rawHeaders.push(key, header);
132114
- });
132115
- if (capability.writableStream) {
132116
- var writable = new WritableStream({
132117
- write: function(chunk) {
132118
- resetTimers(false);
132119
- return new Promise(function(resolve, reject) {
132120
- if (self2._destroyed) {
132121
- reject();
132122
- } else if (self2.push(import_buffer.Buffer.from(chunk))) {
132123
- resolve();
132124
- } else {
132125
- self2._resumeFetch = resolve;
132126
- }
132127
- });
132128
- },
132129
- close: function() {
132130
- resetTimers(true);
132131
- if (!self2._destroyed)
132132
- self2.push(null);
132133
- },
132134
- abort: function(err) {
132135
- resetTimers(true);
132136
- if (!self2._destroyed)
132137
- self2.emit("error", err);
132138
- }
132139
- });
132140
- try {
132141
- response.body.pipeTo(writable).catch(function(err) {
132142
- resetTimers(true);
132143
- if (!self2._destroyed)
132144
- self2.emit("error", err);
132145
- });
132146
- return;
132147
- } catch (e) {
132148
- }
132149
- }
132150
- var reader = response.body.getReader();
132151
- read2();
132152
- } else {
132153
- self2._xhr = xhr;
132154
- self2._pos = 0;
132155
- self2.url = xhr.responseURL;
132156
- self2.statusCode = xhr.status;
132157
- self2.statusMessage = xhr.statusText;
132158
- var headers = xhr.getAllResponseHeaders().split(/\r?\n/);
132159
- headers.forEach(function(header) {
132160
- var matches = header.match(/^([^:]+):\s*(.*)/);
132161
- if (matches) {
132162
- var key = matches[1].toLowerCase();
132163
- if (key === "set-cookie") {
132164
- if (self2.headers[key] === void 0) {
132165
- self2.headers[key] = [];
132166
- }
132167
- self2.headers[key].push(matches[2]);
132168
- } else if (self2.headers[key] !== void 0) {
132169
- self2.headers[key] += ", " + matches[2];
132170
- } else {
132171
- self2.headers[key] = matches[2];
132172
- }
132173
- self2.rawHeaders.push(matches[1], matches[2]);
132174
- }
132175
- });
132176
- self2._charset = "x-user-defined";
132177
- if (!capability.overrideMimeType) {
132178
- var mimeType = self2.rawHeaders["mime-type"];
132179
- if (mimeType) {
132180
- var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/);
132181
- if (charsetMatch) {
132182
- self2._charset = charsetMatch[1].toLowerCase();
132183
- }
132184
- }
132185
- if (!self2._charset)
132186
- self2._charset = "utf-8";
132187
- }
132188
- }
132189
- };
132190
- inherits(IncomingMessage, stream.Readable);
132191
- IncomingMessage.prototype._read = function() {
132192
- var self2 = this;
132193
- var resolve = self2._resumeFetch;
132194
- if (resolve) {
132195
- self2._resumeFetch = null;
132196
- resolve();
132197
- }
132198
- };
132199
- IncomingMessage.prototype._onXHRProgress = function(resetTimers) {
132200
- var self2 = this;
132201
- var xhr = self2._xhr;
132202
- var response = null;
132203
- switch (self2._mode) {
132204
- case "text":
132205
- response = xhr.responseText;
132206
- if (response.length > self2._pos) {
132207
- var newData = response.substr(self2._pos);
132208
- if (self2._charset === "x-user-defined") {
132209
- var buffer = import_buffer.Buffer.alloc(newData.length);
132210
- for (var i = 0; i < newData.length; i++)
132211
- buffer[i] = newData.charCodeAt(i) & 255;
132212
- self2.push(buffer);
132213
- } else {
132214
- self2.push(newData, self2._charset);
132215
- }
132216
- self2._pos = response.length;
132217
- }
132218
- break;
132219
- case "arraybuffer":
132220
- if (xhr.readyState !== rStates.DONE || !xhr.response)
132221
- break;
132222
- response = xhr.response;
132223
- self2.push(import_buffer.Buffer.from(new Uint8Array(response)));
132224
- break;
132225
- case "moz-chunked-arraybuffer":
132226
- response = xhr.response;
132227
- if (xhr.readyState !== rStates.LOADING || !response)
132228
- break;
132229
- self2.push(import_buffer.Buffer.from(new Uint8Array(response)));
132230
- break;
132231
- case "ms-stream":
132232
- response = xhr.response;
132233
- if (xhr.readyState !== rStates.LOADING)
132234
- break;
132235
- var reader = new global.MSStreamReader();
132236
- reader.onprogress = function() {
132237
- if (reader.result.byteLength > self2._pos) {
132238
- self2.push(import_buffer.Buffer.from(new Uint8Array(reader.result.slice(self2._pos))));
132239
- self2._pos = reader.result.byteLength;
132240
- }
132241
- };
132242
- reader.onload = function() {
132243
- resetTimers(true);
132244
- self2.push(null);
132245
- };
132246
- reader.readAsArrayBuffer(response);
132247
- break;
132248
- }
132249
- if (self2._xhr.readyState === rStates.DONE && self2._mode !== "ms-stream") {
132250
- resetTimers(true);
132251
- self2.push(null);
132252
- }
132253
- };
132254
- }
132255
- });
132256
-
132257
- // ../../node_modules/stream-http/lib/request.js
132258
- var require_request = __commonJS({
132259
- "../../node_modules/stream-http/lib/request.js"(exports, module) {
132260
- init_global();
132261
- init_process();
132262
- init_setImmediate();
132263
- init_buffer();
132264
- init_setInterval();
132265
- var capability = require_capability();
132266
- var inherits = require_inherits_browser();
132267
- var response = require_response();
132268
- var stream = require_readable_browser4();
132269
- var IncomingMessage = response.IncomingMessage;
132270
- var rStates = response.readyStates;
132271
- function decideMode(preferBinary, useFetch) {
132272
- if (capability.fetch && useFetch) {
132273
- return "fetch";
132274
- } else if (capability.mozchunkedarraybuffer) {
132275
- return "moz-chunked-arraybuffer";
132276
- } else if (capability.msstream) {
132277
- return "ms-stream";
132278
- } else if (capability.arraybuffer && preferBinary) {
132279
- return "arraybuffer";
132280
- } else {
132281
- return "text";
132282
- }
132283
- }
132284
- var ClientRequest = module.exports = function(opts) {
132285
- var self2 = this;
132286
- stream.Writable.call(self2);
132287
- self2._opts = opts;
132288
- self2._body = [];
132289
- self2._headers = {};
132290
- if (opts.auth)
132291
- self2.setHeader("Authorization", "Basic " + import_buffer.Buffer.from(opts.auth).toString("base64"));
132292
- Object.keys(opts.headers).forEach(function(name) {
132293
- self2.setHeader(name, opts.headers[name]);
132294
- });
132295
- var preferBinary;
132296
- var useFetch = true;
132297
- if (opts.mode === "disable-fetch" || "requestTimeout" in opts && !capability.abortController) {
132298
- useFetch = false;
132299
- preferBinary = true;
132300
- } else if (opts.mode === "prefer-streaming") {
132301
- preferBinary = false;
132302
- } else if (opts.mode === "allow-wrong-content-type") {
132303
- preferBinary = !capability.overrideMimeType;
132304
- } else if (!opts.mode || opts.mode === "default" || opts.mode === "prefer-fast") {
132305
- preferBinary = true;
132306
- } else {
132307
- throw new Error("Invalid value for opts.mode");
132308
- }
132309
- self2._mode = decideMode(preferBinary, useFetch);
132310
- self2._fetchTimer = null;
132311
- self2._socketTimeout = null;
132312
- self2._socketTimer = null;
132313
- self2.on("finish", function() {
132314
- self2._onFinish();
132315
- });
132316
- };
132317
- inherits(ClientRequest, stream.Writable);
132318
- ClientRequest.prototype.setHeader = function(name, value) {
132319
- var self2 = this;
132320
- var lowerName = name.toLowerCase();
132321
- if (unsafeHeaders.indexOf(lowerName) !== -1)
132322
- return;
132323
- self2._headers[lowerName] = {
132324
- name,
132325
- value
132326
- };
132327
- };
132328
- ClientRequest.prototype.getHeader = function(name) {
132329
- var header = this._headers[name.toLowerCase()];
132330
- if (header)
132331
- return header.value;
132332
- return null;
132333
- };
132334
- ClientRequest.prototype.removeHeader = function(name) {
132335
- var self2 = this;
132336
- delete self2._headers[name.toLowerCase()];
132337
- };
132338
- ClientRequest.prototype._onFinish = function() {
132339
- var self2 = this;
132340
- if (self2._destroyed)
132341
- return;
132342
- var opts = self2._opts;
132343
- if ("timeout" in opts && opts.timeout !== 0) {
132344
- self2.setTimeout(opts.timeout);
132345
- }
132346
- var headersObj = self2._headers;
132347
- var body = null;
132348
- if (opts.method !== "GET" && opts.method !== "HEAD") {
132349
- body = new Blob(self2._body, {
132350
- type: (headersObj["content-type"] || {}).value || ""
132351
- });
132352
- }
132353
- var headersList = [];
132354
- Object.keys(headersObj).forEach(function(keyName) {
132355
- var name = headersObj[keyName].name;
132356
- var value = headersObj[keyName].value;
132357
- if (Array.isArray(value)) {
132358
- value.forEach(function(v) {
132359
- headersList.push([name, v]);
132360
- });
132361
- } else {
132362
- headersList.push([name, value]);
132363
- }
132364
- });
132365
- if (self2._mode === "fetch") {
132366
- var signal = null;
132367
- if (capability.abortController) {
132368
- var controller = new AbortController();
132369
- signal = controller.signal;
132370
- self2._fetchAbortController = controller;
132371
- if ("requestTimeout" in opts && opts.requestTimeout !== 0) {
132372
- self2._fetchTimer = global.setTimeout(function() {
132373
- self2.emit("requestTimeout");
132374
- if (self2._fetchAbortController)
132375
- self2._fetchAbortController.abort();
132376
- }, opts.requestTimeout);
132377
- }
132378
- }
132379
- global.fetch(self2._opts.url, {
132380
- method: self2._opts.method,
132381
- headers: headersList,
132382
- body: body || void 0,
132383
- mode: "cors",
132384
- credentials: opts.withCredentials ? "include" : "same-origin",
132385
- signal
132386
- }).then(function(response2) {
132387
- self2._fetchResponse = response2;
132388
- self2._resetTimers(false);
132389
- self2._connect();
132390
- }, function(reason) {
132391
- self2._resetTimers(true);
132392
- if (!self2._destroyed)
132393
- self2.emit("error", reason);
132394
- });
132395
- } else {
132396
- var xhr = self2._xhr = new global.XMLHttpRequest();
132397
- try {
132398
- xhr.open(self2._opts.method, self2._opts.url, true);
132399
- } catch (err) {
132400
- process.nextTick(function() {
132401
- self2.emit("error", err);
132402
- });
132403
- return;
132404
- }
132405
- if ("responseType" in xhr)
132406
- xhr.responseType = self2._mode;
132407
- if ("withCredentials" in xhr)
132408
- xhr.withCredentials = !!opts.withCredentials;
132409
- if (self2._mode === "text" && "overrideMimeType" in xhr)
132410
- xhr.overrideMimeType("text/plain; charset=x-user-defined");
132411
- if ("requestTimeout" in opts) {
132412
- xhr.timeout = opts.requestTimeout;
132413
- xhr.ontimeout = function() {
132414
- self2.emit("requestTimeout");
132415
- };
132416
- }
132417
- headersList.forEach(function(header) {
132418
- xhr.setRequestHeader(header[0], header[1]);
132419
- });
132420
- self2._response = null;
132421
- xhr.onreadystatechange = function() {
132422
- switch (xhr.readyState) {
132423
- case rStates.LOADING:
132424
- case rStates.DONE:
132425
- self2._onXHRProgress();
132426
- break;
132427
- }
132428
- };
132429
- if (self2._mode === "moz-chunked-arraybuffer") {
132430
- xhr.onprogress = function() {
132431
- self2._onXHRProgress();
132432
- };
132433
- }
132434
- xhr.onerror = function() {
132435
- if (self2._destroyed)
132436
- return;
132437
- self2._resetTimers(true);
132438
- self2.emit("error", new Error("XHR error"));
132439
- };
132440
- try {
132441
- xhr.send(body);
132442
- } catch (err) {
132443
- process.nextTick(function() {
132444
- self2.emit("error", err);
132445
- });
132446
- return;
132447
- }
132448
- }
132449
- };
132450
- function statusValid(xhr) {
132451
- try {
132452
- var status = xhr.status;
132453
- return status !== null && status !== 0;
132454
- } catch (e) {
132455
- return false;
132456
- }
132457
- }
132458
- ClientRequest.prototype._onXHRProgress = function() {
132459
- var self2 = this;
132460
- self2._resetTimers(false);
132461
- if (!statusValid(self2._xhr) || self2._destroyed)
132462
- return;
132463
- if (!self2._response)
132464
- self2._connect();
132465
- self2._response._onXHRProgress(self2._resetTimers.bind(self2));
132466
- };
132467
- ClientRequest.prototype._connect = function() {
132468
- var self2 = this;
132469
- if (self2._destroyed)
132470
- return;
132471
- self2._response = new IncomingMessage(self2._xhr, self2._fetchResponse, self2._mode, self2._resetTimers.bind(self2));
132472
- self2._response.on("error", function(err) {
132473
- self2.emit("error", err);
132474
- });
132475
- self2.emit("response", self2._response);
132476
- };
132477
- ClientRequest.prototype._write = function(chunk, encoding, cb) {
132478
- var self2 = this;
132479
- self2._body.push(chunk);
132480
- cb();
132481
- };
132482
- ClientRequest.prototype._resetTimers = function(done) {
132483
- var self2 = this;
132484
- global.clearTimeout(self2._socketTimer);
132485
- self2._socketTimer = null;
132486
- if (done) {
132487
- global.clearTimeout(self2._fetchTimer);
132488
- self2._fetchTimer = null;
132489
- } else if (self2._socketTimeout) {
132490
- self2._socketTimer = global.setTimeout(function() {
132491
- self2.emit("timeout");
132492
- }, self2._socketTimeout);
132493
- }
132494
- };
132495
- ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function(err) {
132496
- var self2 = this;
132497
- self2._destroyed = true;
132498
- self2._resetTimers(true);
132499
- if (self2._response)
132500
- self2._response._destroyed = true;
132501
- if (self2._xhr)
132502
- self2._xhr.abort();
132503
- else if (self2._fetchAbortController)
132504
- self2._fetchAbortController.abort();
132505
- if (err)
132506
- self2.emit("error", err);
132507
- };
132508
- ClientRequest.prototype.end = function(data, encoding, cb) {
132509
- var self2 = this;
132510
- if (typeof data === "function") {
132511
- cb = data;
132512
- data = void 0;
132513
- }
132514
- stream.Writable.prototype.end.call(self2, data, encoding, cb);
132515
- };
132516
- ClientRequest.prototype.setTimeout = function(timeout, cb) {
132517
- var self2 = this;
132518
- if (cb)
132519
- self2.once("timeout", cb);
132520
- self2._socketTimeout = timeout;
132521
- self2._resetTimers(false);
132522
- };
132523
- ClientRequest.prototype.flushHeaders = function() {
132524
- };
132525
- ClientRequest.prototype.setNoDelay = function() {
132526
- };
132527
- ClientRequest.prototype.setSocketKeepAlive = function() {
132528
- };
132529
- var unsafeHeaders = [
132530
- "accept-charset",
132531
- "accept-encoding",
132532
- "access-control-request-headers",
132533
- "access-control-request-method",
132534
- "connection",
132535
- "content-length",
132536
- "cookie",
132537
- "cookie2",
132538
- "date",
132539
- "dnt",
132540
- "expect",
132541
- "host",
132542
- "keep-alive",
132543
- "origin",
132544
- "referer",
132545
- "te",
132546
- "trailer",
132547
- "transfer-encoding",
132548
- "upgrade",
132549
- "via"
132550
- ];
132551
- }
132552
- });
132553
-
132554
- // ../../node_modules/xtend/immutable.js
132555
- var require_immutable = __commonJS({
132556
- "../../node_modules/xtend/immutable.js"(exports, module) {
132557
- init_global();
132558
- init_process();
132559
- init_setImmediate();
132560
- init_buffer();
132561
- init_setInterval();
132562
- module.exports = extend;
132563
- var hasOwnProperty2 = Object.prototype.hasOwnProperty;
132564
- function extend() {
132565
- var target = {};
132566
- for (var i = 0; i < arguments.length; i++) {
132567
- var source = arguments[i];
132568
- for (var key in source) {
132569
- if (hasOwnProperty2.call(source, key)) {
132570
- target[key] = source[key];
132571
- }
132572
- }
132573
- }
132574
- return target;
132575
- }
132576
- }
132577
- });
132578
-
132579
- // ../../node_modules/builtin-status-codes/browser.js
132580
- var require_browser20 = __commonJS({
132581
- "../../node_modules/builtin-status-codes/browser.js"(exports, module) {
132582
- init_global();
132583
- init_process();
132584
- init_setImmediate();
132585
- init_buffer();
132586
- init_setInterval();
132587
- module.exports = {
132588
- "100": "Continue",
132589
- "101": "Switching Protocols",
132590
- "102": "Processing",
132591
- "200": "OK",
132592
- "201": "Created",
132593
- "202": "Accepted",
132594
- "203": "Non-Authoritative Information",
132595
- "204": "No Content",
132596
- "205": "Reset Content",
132597
- "206": "Partial Content",
132598
- "207": "Multi-Status",
132599
- "208": "Already Reported",
132600
- "226": "IM Used",
132601
- "300": "Multiple Choices",
132602
- "301": "Moved Permanently",
132603
- "302": "Found",
132604
- "303": "See Other",
132605
- "304": "Not Modified",
132606
- "305": "Use Proxy",
132607
- "307": "Temporary Redirect",
132608
- "308": "Permanent Redirect",
132609
- "400": "Bad Request",
132610
- "401": "Unauthorized",
132611
- "402": "Payment Required",
132612
- "403": "Forbidden",
132613
- "404": "Not Found",
132614
- "405": "Method Not Allowed",
132615
- "406": "Not Acceptable",
132616
- "407": "Proxy Authentication Required",
132617
- "408": "Request Timeout",
132618
- "409": "Conflict",
132619
- "410": "Gone",
132620
- "411": "Length Required",
132621
- "412": "Precondition Failed",
132622
- "413": "Payload Too Large",
132623
- "414": "URI Too Long",
132624
- "415": "Unsupported Media Type",
132625
- "416": "Range Not Satisfiable",
132626
- "417": "Expectation Failed",
132627
- "418": "I'm a teapot",
132628
- "421": "Misdirected Request",
132629
- "422": "Unprocessable Entity",
132630
- "423": "Locked",
132631
- "424": "Failed Dependency",
132632
- "425": "Unordered Collection",
132633
- "426": "Upgrade Required",
132634
- "428": "Precondition Required",
132635
- "429": "Too Many Requests",
132636
- "431": "Request Header Fields Too Large",
132637
- "451": "Unavailable For Legal Reasons",
132638
- "500": "Internal Server Error",
132639
- "501": "Not Implemented",
132640
- "502": "Bad Gateway",
132641
- "503": "Service Unavailable",
132642
- "504": "Gateway Timeout",
132643
- "505": "HTTP Version Not Supported",
132644
- "506": "Variant Also Negotiates",
132645
- "507": "Insufficient Storage",
132646
- "508": "Loop Detected",
132647
- "509": "Bandwidth Limit Exceeded",
132648
- "510": "Not Extended",
132649
- "511": "Network Authentication Required"
132650
- };
132651
- }
132652
- });
132653
-
132654
- // esbuild/builtins/url.ts
132655
- var url_exports = {};
132656
- __export(url_exports, {
132657
- URL: () => URL2
132658
- });
132659
- var URL2;
132660
- var init_url = __esm({
132661
- "esbuild/builtins/url.ts"() {
132662
- "use strict";
132663
- init_global();
132664
- init_process();
132665
- init_setImmediate();
132666
- init_buffer();
132667
- init_setInterval();
132668
- URL2 = globalThis.URL;
132669
- }
132670
- });
132671
-
132672
- // ../../node_modules/stream-http/index.js
132673
- var require_stream_http = __commonJS({
132674
- "../../node_modules/stream-http/index.js"(exports) {
132675
- init_global();
132676
- init_process();
132677
- init_setImmediate();
132678
- init_buffer();
132679
- init_setInterval();
132680
- var ClientRequest = require_request();
132681
- var response = require_response();
132682
- var extend = require_immutable();
132683
- var statusCodes = require_browser20();
132684
- var url = (init_url(), __toCommonJS(url_exports));
132685
- var http = exports;
132686
- http.request = function(opts, cb) {
132687
- if (typeof opts === "string")
132688
- opts = url.parse(opts);
132689
- else
132690
- opts = extend(opts);
132691
- var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? "http:" : "";
132692
- var protocol = opts.protocol || defaultProtocol;
132693
- var host = opts.hostname || opts.host;
132694
- var port = opts.port;
132695
- var path = opts.path || "/";
132696
- if (host && host.indexOf(":") !== -1)
132697
- host = "[" + host + "]";
132698
- opts.url = (host ? protocol + "//" + host : "") + (port ? ":" + port : "") + path;
132699
- opts.method = (opts.method || "GET").toUpperCase();
132700
- opts.headers = opts.headers || {};
132701
- var req2 = new ClientRequest(opts);
132702
- if (cb)
132703
- req2.on("response", cb);
132704
- return req2;
132705
- };
132706
- http.get = function get(opts, cb) {
132707
- var req2 = http.request(opts, cb);
132708
- req2.end();
132709
- return req2;
132710
- };
132711
- http.ClientRequest = ClientRequest;
132712
- http.IncomingMessage = response.IncomingMessage;
132713
- http.Agent = function() {
132714
- };
132715
- http.Agent.defaultMaxSockets = 4;
132716
- http.globalAgent = new http.Agent();
132717
- http.STATUS_CODES = statusCodes;
132718
- http.METHODS = [
132719
- "CHECKOUT",
132720
- "CONNECT",
132721
- "COPY",
132722
- "DELETE",
132723
- "GET",
132724
- "HEAD",
132725
- "LOCK",
132726
- "M-SEARCH",
132727
- "MERGE",
132728
- "MKACTIVITY",
132729
- "MKCOL",
132730
- "MOVE",
132731
- "NOTIFY",
132732
- "OPTIONS",
132733
- "PATCH",
132734
- "POST",
132735
- "PROPFIND",
132736
- "PROPPATCH",
132737
- "PURGE",
132738
- "PUT",
132739
- "REPORT",
132740
- "SEARCH",
132741
- "SUBSCRIBE",
132742
- "TRACE",
132743
- "UNLOCK",
132744
- "UNSUBSCRIBE"
132745
- ];
132746
- }
132747
- });
132748
-
132749
- // ../../node_modules/https-browserify/index.js
132750
- var require_https_browserify = __commonJS({
132751
- "../../node_modules/https-browserify/index.js"(exports, module) {
132752
- init_global();
132753
- init_process();
132754
- init_setImmediate();
132755
- init_buffer();
132756
- init_setInterval();
132757
- var http = require_stream_http();
132758
- var url = (init_url(), __toCommonJS(url_exports));
132759
- var https = module.exports;
132760
- for (key in http) {
132761
- if (http.hasOwnProperty(key))
132762
- https[key] = http[key];
132763
- }
132764
- var key;
132765
- https.request = function(params, cb) {
132766
- params = validateParams(params);
132767
- return http.request.call(this, params, cb);
132768
- };
132769
- https.get = function(params, cb) {
132770
- params = validateParams(params);
132771
- return http.get.call(this, params, cb);
132772
- };
132773
- function validateParams(params) {
132774
- if (typeof params === "string") {
132775
- params = url.parse(params);
132776
- }
132777
- if (!params.protocol) {
132778
- params.protocol = "https:";
132779
- }
132780
- if (params.protocol !== "https:") {
132781
- throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"');
132782
- }
132783
- return params;
132784
- }
132785
- }
132786
- });
132787
-
132788
- // ../core/dist/troubleshoot/utils.js
132789
- var require_utils7 = __commonJS({
132790
- "../core/dist/troubleshoot/utils.js"(exports) {
132791
- "use strict";
132792
- init_global();
132793
- init_process();
132794
- init_setImmediate();
132795
- init_buffer();
132796
- init_setInterval();
132797
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
132798
- if (k2 === void 0)
132799
- k2 = k;
132800
- var desc = Object.getOwnPropertyDescriptor(m, k);
132801
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
132802
- desc = { enumerable: true, get: function() {
132803
- return m[k];
132804
- } };
132805
- }
132806
- Object.defineProperty(o, k2, desc);
132807
- } : function(o, m, k, k2) {
132808
- if (k2 === void 0)
132809
- k2 = k;
132810
- o[k2] = m[k];
132811
- });
132812
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
132813
- Object.defineProperty(o, "default", { enumerable: true, value: v });
132814
- } : function(o, v) {
132815
- o["default"] = v;
132816
- });
132817
- var __importStar = exports && exports.__importStar || function(mod) {
132818
- if (mod && mod.__esModule)
132819
- return mod;
132820
- var result = {};
132821
- if (mod != null) {
132822
- for (var k in mod)
132823
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
132824
- __createBinding(result, mod, k);
132825
- }
132826
- __setModuleDefault(result, mod);
132827
- return result;
132828
- };
132829
- Object.defineProperty(exports, "__esModule", { value: true });
132830
- exports.getProxyCurlArg = exports.config = void 0;
132831
- var utils2 = __importStar(require_browser3());
132832
- exports.config = {
132833
- serverUrl: "https://eyesapi.applitools.com",
132834
- ...utils2.config.getConfig({ params: ["apiKey", "serverUrl", "proxy"] })
132835
- };
132836
- function getProxyCurlArg() {
132837
- let proxyUrl;
132838
- if (exports.config.proxy) {
132839
- proxyUrl = new URL(utils2.types.isString(exports.config.proxy) ? exports.config.proxy : exports.config.proxy.url);
132840
- if (exports.config.proxy.username)
132841
- proxyUrl.username = exports.config.proxy.username;
132842
- if (exports.config.proxy.password)
132843
- proxyUrl.password = exports.config.proxy.password;
132844
- }
132845
- return proxyUrl ? `-x ${proxyUrl.href}` : "";
132846
- }
132847
- exports.getProxyCurlArg = getProxyCurlArg;
132848
- }
132849
- });
132850
-
132851
- // ../core/node_modules/node-fetch/browser.js
132852
- var require_browser21 = __commonJS({
132853
- "../core/node_modules/node-fetch/browser.js"(exports, module) {
132854
- "use strict";
132855
- init_global();
132856
- init_process();
132857
- init_setImmediate();
132858
- init_buffer();
132859
- init_setInterval();
132860
- var getGlobal = function() {
132861
- if (typeof self !== "undefined") {
132862
- return self;
132863
- }
132864
- if (typeof window !== "undefined") {
132865
- return window;
132866
- }
132867
- if (typeof global2 !== "undefined") {
132868
- return global2;
132869
- }
132870
- throw new Error("unable to locate global object");
132871
- };
132872
- var global2 = getGlobal();
132873
- module.exports = exports = global2.fetch;
132874
- if (global2.fetch) {
132875
- exports.default = global2.fetch.bind(global2);
132876
- }
132877
- exports.Headers = global2.Headers;
132878
- exports.Request = global2.Request;
132879
- exports.Response = global2.Response;
132880
- }
132881
- });
132882
-
132883
- // ../core/dist/troubleshoot/eyes.js
132884
- var require_eyes2 = __commonJS({
132885
- "../core/dist/troubleshoot/eyes.js"(exports) {
132886
- "use strict";
132887
- init_global();
132888
- init_process();
132889
- init_setImmediate();
132890
- init_buffer();
132891
- init_setInterval();
132892
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
132893
- if (k2 === void 0)
132894
- k2 = k;
132895
- var desc = Object.getOwnPropertyDescriptor(m, k);
132896
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
132897
- desc = { enumerable: true, get: function() {
132898
- return m[k];
132899
- } };
132900
- }
132901
- Object.defineProperty(o, k2, desc);
132902
- } : function(o, m, k, k2) {
132903
- if (k2 === void 0)
132904
- k2 = k;
132905
- o[k2] = m[k];
132906
- });
132907
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
132908
- Object.defineProperty(o, "default", { enumerable: true, value: v });
132909
- } : function(o, v) {
132910
- o["default"] = v;
132911
- });
132912
- var __importStar = exports && exports.__importStar || function(mod) {
132913
- if (mod && mod.__esModule)
132914
- return mod;
132915
- var result = {};
132916
- if (mod != null) {
132917
- for (var k in mod)
132918
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
132919
- __createBinding(result, mod, k);
132920
- }
132921
- __setModuleDefault(result, mod);
132922
- return result;
132923
- };
132924
- var __importDefault = exports && exports.__importDefault || function(mod) {
132925
- return mod && mod.__esModule ? mod : { "default": mod };
132926
- };
132927
- Object.defineProperty(exports, "__esModule", { value: true });
132928
- exports.CURL_CMD = exports.RENDER_INFO_URL = void 0;
132929
- var https_1 = require_https_browserify();
132930
- var core_base_1 = require_dist2();
132931
- var utils_1 = require_utils7();
132932
- var utils2 = __importStar(require_browser3());
132933
- var node_fetch_1 = __importDefault(require_browser21());
132934
- exports.RENDER_INFO_URL = `${utils_1.config.serverUrl}/api/sessions/renderinfo?apiKey=${utils_1.config.apiKey}`;
132935
- exports.CURL_CMD = `curl ${exports.RENDER_INFO_URL} ${(0, utils_1.getProxyCurlArg)()}`;
132936
- var validateRawAccountInfo = (res) => {
132937
- if (!res || !res.accessToken || !res.resultsUrl) {
132938
- throw new Error(`bad render info result ${JSON.stringify(res)}`);
132939
- }
132940
- };
132941
- var validateAccountInfo = (res) => {
132942
- if (!res || !res.ufgServer || !res.ufgServer.accessToken || !res.uploadUrl) {
132943
- throw new Error(`bad render info result ${JSON.stringify(res)}`);
132944
- }
132945
- };
132946
- exports.default = {
132947
- async testFetch() {
132948
- const response = await (0, node_fetch_1.default)(exports.RENDER_INFO_URL);
132949
- const data = await response.json();
132950
- validateRawAccountInfo(data);
132951
- },
132952
- async testCurl() {
132953
- const { stdout } = await utils2.process.execute(exports.CURL_CMD, {
132954
- maxBuffer: 1e7
132955
- });
132956
- const data = JSON.parse(stdout);
132957
- validateRawAccountInfo(data);
132958
- },
132959
- async testServer() {
132960
- const server = (0, core_base_1.makeCoreRequestsWithCache)();
132961
- const result = await server.getAccountInfo({ settings: { eyesServerUrl: utils_1.config.serverUrl, ...utils_1.config } });
132962
- validateAccountInfo(result);
132963
- },
132964
- testHttps: async () => {
132965
- return new Promise((resolve, reject) => {
132966
- const request = (0, https_1.get)(exports.RENDER_INFO_URL, (response) => {
132967
- let data = "";
132968
- response.on("data", (chunk) => data += chunk);
132969
- response.on("end", () => {
132970
- try {
132971
- validateRawAccountInfo(JSON.parse(data));
132972
- resolve();
132973
- } catch (err) {
132974
- reject(err);
132975
- }
132976
- });
132977
- });
132978
- request.on("error", reject);
132979
- });
132980
- },
132981
- url: new URL(exports.RENDER_INFO_URL),
132982
- cmd: exports.CURL_CMD
132983
- };
132984
- }
132985
- });
132986
-
132987
- // ../core/dist/troubleshoot/ufg.js
132988
- var require_ufg = __commonJS({
132989
- "../core/dist/troubleshoot/ufg.js"(exports) {
132990
- "use strict";
132991
- init_global();
132992
- init_process();
132993
- init_setImmediate();
132994
- init_buffer();
132995
- init_setInterval();
132996
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
132997
- if (k2 === void 0)
132998
- k2 = k;
132999
- var desc = Object.getOwnPropertyDescriptor(m, k);
133000
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
133001
- desc = { enumerable: true, get: function() {
133002
- return m[k];
133003
- } };
133004
- }
133005
- Object.defineProperty(o, k2, desc);
133006
- } : function(o, m, k, k2) {
133007
- if (k2 === void 0)
133008
- k2 = k;
133009
- o[k2] = m[k];
133010
- });
133011
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
133012
- Object.defineProperty(o, "default", { enumerable: true, value: v });
133013
- } : function(o, v) {
133014
- o["default"] = v;
133015
- });
133016
- var __importStar = exports && exports.__importStar || function(mod) {
133017
- if (mod && mod.__esModule)
133018
- return mod;
133019
- var result = {};
133020
- if (mod != null) {
133021
- for (var k in mod)
133022
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
133023
- __createBinding(result, mod, k);
133024
- }
133025
- __setModuleDefault(result, mod);
133026
- return result;
133027
- };
133028
- var __importDefault = exports && exports.__importDefault || function(mod) {
133029
- return mod && mod.__esModule ? mod : { "default": mod };
133030
- };
133031
- Object.defineProperty(exports, "__esModule", { value: true });
133032
- exports.getCmd = void 0;
133033
- var https_1 = require_https_browserify();
133034
- var crypto_1 = require_crypto_browserify();
133035
- var logger_1 = require_browser6();
133036
- var ufg_client_1 = require_dist6();
133037
- var utils_1 = require_utils7();
133038
- var eyes_1 = require_eyes2();
133039
- var utils2 = __importStar(require_browser3());
133040
- var node_fetch_1 = __importDefault(require_browser21());
133041
- var rawValue = JSON.stringify({ resources: {}, domNodes: [] });
133042
- var encodedValue = new TextEncoder().encode(rawValue);
133043
- var hash = (0, crypto_1.createHash)("sha256").update(encodedValue).digest("hex");
133044
- var contentType = "x-applitools-html/cdt";
133045
- var resource = {
133046
- id: "id",
133047
- url: "https://localhost:2107",
133048
- value: encodedValue,
133049
- rawValue,
133050
- hash: { hashFormat: "sha256", hash, contentType },
133051
- contentType
133052
- };
133053
- var UFG_PUT_RESOURCE_URL = `https://render-wus.applitools.com/sha256/${resource.hash.hash}?render-id=fake`;
133054
- var getAccessToken = (() => {
133055
- let accessToken;
133056
- return async () => {
133057
- if (!accessToken) {
133058
- const { stdout } = await utils2.process.execute(`curl -s ${eyes_1.RENDER_INFO_URL} ${(0, utils_1.getProxyCurlArg)()}`, {
133059
- maxBuffer: 1e7
133060
- });
133061
- accessToken = JSON.parse(stdout).accessToken;
133062
- if (!accessToken)
133063
- throw new Error("could not receive auth token since cURL command to get it failed.");
133064
- }
133065
- return accessToken;
133066
- };
133067
- })();
133068
- var getCmd = async () => `curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: ${await getAccessToken()}" -d '${resource.rawValue}' ${UFG_PUT_RESOURCE_URL} ${(0, utils_1.getProxyCurlArg)()}`;
133069
- exports.getCmd = getCmd;
133070
- var validateVgResult = (res, sha) => {
133071
- if (!res || res.hash !== sha) {
133072
- throw new Error(`bad VG result ${res}`);
133073
- }
133074
- };
133075
- exports.default = {
133076
- async testFetch() {
133077
- const response = await (0, node_fetch_1.default)(UFG_PUT_RESOURCE_URL, {
133078
- method: "PUT",
133079
- headers: {
133080
- "Content-Type": "x-applitools-html/cdt",
133081
- "X-Auth-Token": await getAccessToken()
133082
- },
133083
- body: resource.value
133084
- });
133085
- const data = await response.json();
133086
- validateVgResult(data, resource.hash.hash);
133087
- },
133088
- async testCurl() {
133089
- let proxyUrl;
133090
- if (utils_1.config.proxy) {
133091
- proxyUrl = new URL(utils2.types.isString(utils_1.config.proxy) ? utils_1.config.proxy : utils_1.config.proxy.url);
133092
- if (utils_1.config.proxy.username)
133093
- proxyUrl.username = utils_1.config.proxy.username;
133094
- if (utils_1.config.proxy.password)
133095
- proxyUrl.password = utils_1.config.proxy.password;
133096
- }
133097
- const { stdout } = await utils2.process.execute(await (0, exports.getCmd)(), { maxBuffer: 1e7 });
133098
- validateVgResult(JSON.parse(stdout), resource.hash.hash);
133099
- },
133100
- testServer: async () => {
133101
- const url = new URL(UFG_PUT_RESOURCE_URL);
133102
- const requests = (0, ufg_client_1.makeUFGRequests)({
133103
- settings: { ufgServerUrl: url.origin, accessToken: await getAccessToken() },
133104
- logger: (0, logger_1.makeLogger)()
133105
- });
133106
- await requests.uploadResource({ resource });
133107
- },
133108
- async testHttps() {
133109
- return new Promise(async (resolve, reject) => {
133110
- const url = new URL(UFG_PUT_RESOURCE_URL);
133111
- const request = (0, https_1.request)({
133112
- host: url.host,
133113
- path: `${url.pathname}${url.search}`,
133114
- method: "PUT",
133115
- headers: {
133116
- "Content-Type": "x-applitools-html/cdt",
133117
- "X-Auth-Token": await getAccessToken()
133118
- }
133119
- });
133120
- request.on("response", (response) => {
133121
- let data = "";
133122
- response.on("data", (chunk) => data += chunk);
133123
- response.on("end", () => {
133124
- try {
133125
- validateVgResult(JSON.parse(data), resource.hash.hash);
133126
- resolve();
133127
- } catch (e) {
133128
- reject(e);
133129
- }
133130
- });
133131
- });
133132
- request.on("error", reject);
133133
- request.write(resource.value);
133134
- request.end();
133135
- });
133136
- },
133137
- url: new URL(UFG_PUT_RESOURCE_URL),
133138
- getCmd: exports.getCmd
133139
- };
133140
- }
133141
- });
133142
-
133143
- // ../core/dist/troubleshoot/check-network.js
133144
- var require_check_network = __commonJS({
133145
- "../core/dist/troubleshoot/check-network.js"(exports, module) {
133146
- "use strict";
133147
- init_global();
133148
- init_process();
133149
- init_setImmediate();
133150
- init_buffer();
133151
- init_setInterval();
133152
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
133153
- if (k2 === void 0)
133154
- k2 = k;
133155
- var desc = Object.getOwnPropertyDescriptor(m, k);
133156
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
133157
- desc = { enumerable: true, get: function() {
133158
- return m[k];
133159
- } };
133160
- }
133161
- Object.defineProperty(o, k2, desc);
133162
- } : function(o, m, k, k2) {
133163
- if (k2 === void 0)
133164
- k2 = k;
133165
- o[k2] = m[k];
133166
- });
133167
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
133168
- Object.defineProperty(o, "default", { enumerable: true, value: v });
133169
- } : function(o, v) {
133170
- o["default"] = v;
133171
- });
133172
- var __importStar = exports && exports.__importStar || function(mod) {
133173
- if (mod && mod.__esModule)
133174
- return mod;
133175
- var result = {};
133176
- if (mod != null) {
133177
- for (var k in mod)
133178
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
133179
- __createBinding(result, mod, k);
133180
- }
133181
- __setModuleDefault(result, mod);
133182
- return result;
133183
- };
133184
- var __importDefault = exports && exports.__importDefault || function(mod) {
133185
- return mod && mod.__esModule ? mod : { "default": mod };
133186
- };
133187
- Object.defineProperty(exports, "__esModule", { value: true });
133188
- exports.checkNetwork = void 0;
133189
- var chalk_1 = __importDefault(require_source());
133190
- var eyes_1 = __importDefault(require_eyes2());
133191
- var ufg_1 = __importDefault(require_ufg());
133192
- var utils2 = __importStar(require_browser3());
133193
- var TIMEOUT = 15e3;
133194
- var config = utils2.config.getConfig({ params: ["apiKey", "serverUrl", "proxy"] });
133195
- async function checkNetwork({ stream = process.stdout, eyes: eyes2 = eyes_1.default, ufg = ufg_1.default } = {}) {
133196
- const hasClearLine = !!stream.clearLine && !!stream.cursorTo;
133197
- if (!config.apiKey) {
133198
- printErr('Missing "apiKey". Add APPLITOOLS_API_KEY as an env variable or add "apiKey" in applitools.config.js\n');
133199
- return;
133200
- }
133201
- const proxyEnvMsg = `HTTP_PROXY="${process.env.HTTP_PROXY || ""}"
133202
- HTTPS_PROXY="${process.env.HTTPS_PROXY || ""}"`;
133203
- const configMsg = `User config: ${JSON.stringify(config, null, 2)}
133204
- ${proxyEnvMsg}`;
133205
- print(`Eyes Check Network. Running with:
133206
-
133207
- ---
133208
-
133209
- ${chalk_1.default.cyan(configMsg)}
133210
-
133211
- ---
133212
-
133213
- `);
133214
- let hasErr = false;
133215
- let curlRenderErr = true;
133216
- let curlVgErr = true;
133217
- print("[1] Checking eyes API", eyes2.url.origin, "\n");
133218
- curlRenderErr = await doTest(eyes2.testCurl, "[eyes] cURL");
133219
- hasErr = curlRenderErr;
133220
- hasErr = await doTest(eyes2.testHttps, "[eyes] https") || hasErr;
133221
- hasErr = await doTest(eyes2.testFetch, "[eyes] node-fetch") || hasErr;
133222
- hasErr = await doTest(eyes2.testServer, "[eyes] server connector");
133223
- print("[2] Checking Ultrafast grid API", ufg.url.origin, "\n");
133224
- curlVgErr = await doTest(ufg.testCurl, "[UFG] cURL");
133225
- hasErr = curlVgErr || hasErr;
133226
- hasErr = await doTest(ufg.testHttps, "[UFG] https") || hasErr;
133227
- hasErr = await doTest(ufg.testFetch, "[UFG] node-fetch") || hasErr;
133228
- hasErr = await doTest(ufg.testServer, "[UFG] server connector") || hasErr;
133229
- if (!hasErr) {
133230
- printSuccess("\nSuccess!\n");
133231
- }
133232
- const proxyMsg = "\nYour proxy seems to be blocking requests to Applitools. Please make sure the following command succeeds:";
133233
- if (curlRenderErr) {
133234
- printErr(proxyMsg, "\n", eyes2.cmd, "\n");
133235
- throw new Error("Your proxy seems to be blocking requests to Applitools.");
133236
- } else if (curlVgErr) {
133237
- printErr(proxyMsg, "\n", await ufg.getCmd());
133238
- throw new Error("Your proxy seems to be blocking requests to Applitools.");
133239
- }
133240
- async function doTest(func, name) {
133241
- const delimiterLength = 30 - name.length;
133242
- const delimiter = new Array(delimiterLength).join(" ");
133243
- hasClearLine && printSuccess(name, delimiter, "[ ? ]");
133244
- const start = Date.now();
133245
- const [err] = await ptimeoutWithError(func(), TIMEOUT, new Error("request timeout!"));
133246
- const end = (Date.now() - start) / 1e3;
133247
- clearLine();
133248
- if (err) {
133249
- printErr(name, delimiter, `[ X ] +${end}`, err.message, err.message[err.message.length - 1] !== "\n" ? "\n" : "");
133250
- } else {
133251
- printSuccess(name, delimiter, `[ OK ] +${end}`, "\n");
133252
- }
133253
- return !!err;
133254
- }
133255
- function print(...msg) {
133256
- stream.write((0, chalk_1.default)(...msg));
133257
- }
133258
- function printErr(...msg) {
133259
- stream.write(chalk_1.default.red(...msg));
133260
- }
133261
- function printSuccess(...msg) {
133262
- stream.write(chalk_1.default.green(...msg));
133263
- }
133264
- function clearLine() {
133265
- if (hasClearLine) {
133266
- stream.clearLine(0);
133267
- stream.cursorTo(0);
133268
- }
133269
- }
133270
- async function ptimeoutWithError(promise, timeout, err) {
133271
- let timer;
133272
- return Promise.race([
133273
- promise.then((v) => (timer && clearTimeout(timer), [void 0, v]), (err2) => (timer && clearTimeout(timer), [err2])),
133274
- new Promise((res) => {
133275
- timer = setTimeout(() => res([err]), timeout);
133276
- })
133277
- ]);
133278
- }
133279
- }
133280
- exports.checkNetwork = checkNetwork;
133281
- if (__require.main === module) {
133282
- void checkNetwork();
133283
- }
133284
- }
133285
- });
133286
-
133287
- // ../core/dist/index.js
133288
- var require_dist8 = __commonJS({
133289
- "../core/dist/index.js"(exports) {
133290
- "use strict";
133291
- init_global();
133292
- init_process();
133293
- init_setImmediate();
133294
- init_buffer();
133295
- init_setInterval();
133296
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
133297
- if (k2 === void 0)
133298
- k2 = k;
133299
- var desc = Object.getOwnPropertyDescriptor(m, k);
133300
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
133301
- desc = { enumerable: true, get: function() {
133302
- return m[k];
133303
- } };
133304
- }
133305
- Object.defineProperty(o, k2, desc);
133306
- } : function(o, m, k, k2) {
133307
- if (k2 === void 0)
133308
- k2 = k;
133309
- o[k2] = m[k];
133310
- });
133311
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
133312
- Object.defineProperty(o, "default", { enumerable: true, value: v });
133313
- } : function(o, v) {
133314
- o["default"] = v;
129549
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
129550
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
129551
+ } : function(o, v) {
129552
+ o["default"] = v;
133315
129553
  });
133316
129554
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
133317
129555
  for (var p in m)
@@ -133331,17 +129569,13 @@ var require_dist8 = __commonJS({
133331
129569
  return result;
133332
129570
  };
133333
129571
  Object.defineProperty(exports, "__esModule", { value: true });
133334
- exports.MissingApiKeyError = exports.checkNetwork = exports.logs = exports.formatters = void 0;
129572
+ exports.MissingApiKeyError = exports.logs = exports.formatters = void 0;
133335
129573
  __exportStar(require_types5(), exports);
133336
129574
  __exportStar(require_core4(), exports);
133337
129575
  __exportStar(require_core5(), exports);
133338
129576
  __exportStar(require_debug2(), exports);
133339
129577
  exports.formatters = __importStar(require_format_results());
133340
129578
  exports.logs = __importStar(require_logs());
133341
- var check_network_1 = require_check_network();
133342
- Object.defineProperty(exports, "checkNetwork", { enumerable: true, get: function() {
133343
- return check_network_1.checkNetwork;
133344
- } });
133345
129579
  var core_base_1 = require_dist2();
133346
129580
  Object.defineProperty(exports, "MissingApiKeyError", { enumerable: true, get: function() {
133347
129581
  return core_base_1.MissingApiKeyError;
@@ -133354,7 +129588,7 @@ var require_package4 = __commonJS({
133354
129588
  "../eyes/package.json"(exports, module) {
133355
129589
  module.exports = {
133356
129590
  name: "@applitools/eyes",
133357
- version: "1.38.6",
129591
+ version: "1.38.8",
133358
129592
  keywords: [
133359
129593
  "applitools",
133360
129594
  "eyes",
@@ -134974,7 +131208,7 @@ var require_package5 = __commonJS({
134974
131208
  "package.json"(exports, module) {
134975
131209
  module.exports = {
134976
131210
  name: "@applitools/eyes-browser",
134977
- version: "1.6.3",
131211
+ version: "1.6.5",
134978
131212
  type: "module",
134979
131213
  keywords: [
134980
131214
  "applitools",