pi2dsh 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +41 -60
  2. package/README.zh.md +34 -54
  3. package/dist/{analyzer-C5FQXB7R.mjs → analyzer-dRAMYI3l.mjs} +2 -2
  4. package/dist/{analyzer-C5FQXB7R.mjs.map → analyzer-dRAMYI3l.mjs.map} +1 -1
  5. package/dist/cli.mjs +2 -3
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/compat/pi-ai.d.mts +1 -1
  8. package/dist/compat/pi-ai.mjs +1 -2
  9. package/dist/compat/pi-coding-agent.mjs +1 -1
  10. package/dist/credentials-oauth.d.mts +8 -2
  11. package/dist/credentials-oauth.d.mts.map +1 -1
  12. package/dist/credentials-oauth.mjs +134 -1
  13. package/dist/credentials-oauth.mjs.map +1 -0
  14. package/dist/{google-generative-ai-2gCFYp-t.mjs → google-generative-ai-Dpb_X-Kt.mjs} +2 -2
  15. package/dist/{google-generative-ai-2gCFYp-t.mjs.map → google-generative-ai-Dpb_X-Kt.mjs.map} +1 -1
  16. package/dist/{google-shared-75IdVyrx.mjs → google-shared-CL1Za-ev.mjs} +12 -12
  17. package/dist/{google-shared-75IdVyrx.mjs.map → google-shared-CL1Za-ev.mjs.map} +1 -1
  18. package/dist/{google-vertex-Bhyo4z2i.mjs → google-vertex-BXRKa49Y.mjs} +2 -2
  19. package/dist/{google-vertex-Bhyo4z2i.mjs.map → google-vertex-BXRKa49Y.mjs.map} +1 -1
  20. package/dist/host.mjs +1 -1
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +3 -4
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{compatibility-DVMqXJux.mjs → mcp-config-2s_i_H3R.mjs} +180 -3
  25. package/dist/mcp-config-2s_i_H3R.mjs.map +1 -0
  26. package/dist/{mistral-conversations-DJyeTo8C.mjs → mistral-conversations-D-Kf38nj.mjs} +5491 -407
  27. package/dist/mistral-conversations-D-Kf38nj.mjs.map +1 -0
  28. package/dist/{multipart-parser-SRcGkVuX.mjs → multipart-parser-CBAi6PxA.mjs} +2 -2
  29. package/dist/{multipart-parser-SRcGkVuX.mjs.map → multipart-parser-CBAi6PxA.mjs.map} +1 -1
  30. package/dist/{credentials-oauth-Didpkkjx.mjs → oauth-bridge-C_MAPMGA.mjs} +11 -88
  31. package/dist/oauth-bridge-C_MAPMGA.mjs.map +1 -0
  32. package/dist/oauth-bridge-hOnT3acY.d.mts +34 -0
  33. package/dist/oauth-bridge-hOnT3acY.d.mts.map +1 -0
  34. package/dist/{otel-CBhmS-NR.mjs → otel-EL651-JR.mjs} +2 -2
  35. package/dist/{otel-CBhmS-NR.mjs.map → otel-EL651-JR.mjs.map} +1 -1
  36. package/dist/{pi-ai-DpqiLdPA.mjs → pi-ai-DQPHUR9S.mjs} +252 -7
  37. package/dist/pi-ai-DQPHUR9S.mjs.map +1 -0
  38. package/dist/{pi-ai-ZU5MelXy.d.mts → pi-ai-hGbYES_v.d.mts} +2 -2
  39. package/dist/{pi-ai-ZU5MelXy.d.mts.map → pi-ai-hGbYES_v.d.mts.map} +1 -1
  40. package/dist/{pi-coding-agent-DK8hbJP5.mjs → pi-coding-agent-f3_hNCpd.mjs} +0 -0
  41. package/dist/{pi-coding-agent-DK8hbJP5.mjs.map → pi-coding-agent-f3_hNCpd.mjs.map} +1 -1
  42. package/dist/{runtime-BlbKWw7W.mjs → runtime-C6_pOPmL.mjs} +198 -47
  43. package/dist/runtime-C6_pOPmL.mjs.map +1 -0
  44. package/dist/runtime.d.mts +29 -47
  45. package/dist/runtime.d.mts.map +1 -1
  46. package/dist/runtime.mjs +1 -1
  47. package/dist/{from-BCscBQ9P.mjs → src-85HOaW5W.mjs} +1185 -10
  48. package/dist/src-85HOaW5W.mjs.map +1 -0
  49. package/package.json +28 -21
  50. package/dist/compatibility-DVMqXJux.mjs.map +0 -1
  51. package/dist/completionchunk-Dhk56lZl.mjs +0 -5212
  52. package/dist/completionchunk-Dhk56lZl.mjs.map +0 -1
  53. package/dist/credentials-oauth-Didpkkjx.mjs.map +0 -1
  54. package/dist/from-BCscBQ9P.mjs.map +0 -1
  55. package/dist/mcp-config-jmzbgdHa.mjs +0 -181
  56. package/dist/mcp-config-jmzbgdHa.mjs.map +0 -1
  57. package/dist/mistral-conversations-DJyeTo8C.mjs.map +0 -1
  58. package/dist/openai-responses-BRdGpBX6.mjs +0 -251
  59. package/dist/openai-responses-BRdGpBX6.mjs.map +0 -1
  60. package/dist/pi-ai-DpqiLdPA.mjs.map +0 -1
  61. package/dist/runtime-BlbKWw7W.mjs.map +0 -1
  62. package/dist/src-DlTagfW5.mjs +0 -1186
  63. package/dist/src-DlTagfW5.mjs.map +0 -1
@@ -2,6 +2,51 @@
2
2
  import { i as __require, n as __esmMin, t as __commonJSMin } from "./rolldown-runtime-CTfmNlz1.mjs";
3
3
  import { promises } from "node:fs";
4
4
  import "node:path";
5
+ import { format } from "node:url";
6
+ import { deprecate, promisify, types } from "node:util";
7
+ import Stream, { PassThrough, pipeline } from "node:stream";
8
+ import http from "node:http";
9
+ import https from "node:https";
10
+ import zlib from "node:zlib";
11
+ import { Buffer as Buffer$1 } from "node:buffer";
12
+ import { isIP } from "node:net";
13
+ //#region node_modules/.pnpm/data-uri-to-buffer@4.0.1/node_modules/data-uri-to-buffer/dist/index.js
14
+ /**
15
+ * Returns a `Buffer` instance from the given data URI `uri`.
16
+ *
17
+ * @param {String} uri Data URI to turn into a Buffer instance
18
+ * @returns {Buffer} Buffer instance from Data URI
19
+ * @api public
20
+ */
21
+ function dataUriToBuffer(uri) {
22
+ if (!/^data:/i.test(uri)) throw new TypeError("`uri` does not appear to be a Data URI (must begin with \"data:\")");
23
+ uri = uri.replace(/\r?\n/g, "");
24
+ const firstComma = uri.indexOf(",");
25
+ if (firstComma === -1 || firstComma <= 4) throw new TypeError("malformed data: URI");
26
+ const meta = uri.substring(5, firstComma).split(";");
27
+ let charset = "";
28
+ let base64 = false;
29
+ const type = meta[0] || "text/plain";
30
+ let typeFull = type;
31
+ for (let i = 1; i < meta.length; i++) if (meta[i] === "base64") base64 = true;
32
+ else if (meta[i]) {
33
+ typeFull += `;${meta[i]}`;
34
+ if (meta[i].indexOf("charset=") === 0) charset = meta[i].substring(8);
35
+ }
36
+ if (!meta[0] && !charset.length) {
37
+ typeFull += ";charset=US-ASCII";
38
+ charset = "US-ASCII";
39
+ }
40
+ const encoding = base64 ? "base64" : "ascii";
41
+ const data = unescape(uri.substring(firstComma + 1));
42
+ const buffer = Buffer.from(data, encoding);
43
+ buffer.type = type;
44
+ buffer.typeFull = typeFull;
45
+ buffer.charset = charset;
46
+ return buffer;
47
+ }
48
+ var init_dist = __esmMin((() => {}));
49
+ //#endregion
5
50
  //#region node_modules/.pnpm/web-streams-polyfill@3.3.3/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js
6
51
  var require_ponyfill_es2018 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7
52
  /**
@@ -3565,7 +3610,7 @@ async function* toIterator(parts, clone = true) {
3565
3610
  }
3566
3611
  }
3567
3612
  }
3568
- var POOL_SIZE, _Blob, Blob;
3613
+ var POOL_SIZE, _Blob, Blob$1;
3569
3614
  var init_fetch_blob = __esmMin((() => {
3570
3615
  require_streams();
3571
3616
  POOL_SIZE = 65536;
@@ -3712,14 +3757,14 @@ var init_fetch_blob = __esmMin((() => {
3712
3757
  type: { enumerable: true },
3713
3758
  slice: { enumerable: true }
3714
3759
  });
3715
- Blob = _Blob;
3760
+ Blob$1 = _Blob;
3716
3761
  }));
3717
3762
  //#endregion
3718
3763
  //#region node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/file.js
3719
- var _File, File;
3764
+ var _File, File$1;
3720
3765
  var init_file = __esmMin((() => {
3721
3766
  init_fetch_blob();
3722
- _File = class File extends Blob {
3767
+ _File = class File extends Blob$1 {
3723
3768
  #lastModified = 0;
3724
3769
  #name = "";
3725
3770
  /**
@@ -3744,16 +3789,16 @@ var init_file = __esmMin((() => {
3744
3789
  return "File";
3745
3790
  }
3746
3791
  static [Symbol.hasInstance](object) {
3747
- return !!object && object instanceof Blob && /^(File)$/.test(object[Symbol.toStringTag]);
3792
+ return !!object && object instanceof Blob$1 && /^(File)$/.test(object[Symbol.toStringTag]);
3748
3793
  }
3749
3794
  };
3750
- File = _File;
3795
+ File$1 = _File;
3751
3796
  }));
3752
3797
  //#endregion
3753
3798
  //#region node_modules/.pnpm/formdata-polyfill@4.0.10/node_modules/formdata-polyfill/esm.min.js
3754
3799
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
3755
3800
  /** @param {FormData} F */
3756
- function formDataToBlob(F, B = Blob) {
3801
+ function formDataToBlob(F, B = Blob$1) {
3757
3802
  var b = `${r()}${r()}`.replace(/\./g, "").slice(-28).padStart(32, "-"), c = [], p = `--${b}\r\nContent-Disposition: form-data; name="`;
3758
3803
  F.forEach((v, n) => typeof v == "string" ? c.push(p + e(n) + `"\r\n\r\n${v.replace(/\r(?!\n)|(?<!\r)\n/g, "\r\n")}\r\n`) : c.push(p + e(n) + `"; filename="${e(v.name, 1)}"\r\nContent-Type: ${v.type || "application/octet-stream"}\r\n\r\n`, v, "\r\n"));
3759
3804
  c.push(`--${b}--`);
@@ -3763,7 +3808,7 @@ var t, i, h, r, m, f, e, x, FormData;
3763
3808
  var init_esm_min = __esmMin((() => {
3764
3809
  init_fetch_blob();
3765
3810
  init_file();
3766
- ({toStringTag: t, iterator: i, hasInstance: h} = Symbol), r = Math.random, m = "append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","), f = (a, b, c) => (a += "", /^(Blob|File)$/.test(b && b[t]) ? [(c = c !== void 0 ? c + "" : b[t] == "File" ? b.name : "blob", a), b.name !== c || b[t] == "blob" ? new File([b], c, b) : b] : [a, b + ""]), e = (c, f) => (f ? c : c.replace(/\r?\n|\r/g, "\r\n")).replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), x = (n, a, e) => {
3811
+ ({toStringTag: t, iterator: i, hasInstance: h} = Symbol), r = Math.random, m = "append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","), f = (a, b, c) => (a += "", /^(Blob|File)$/.test(b && b[t]) ? [(c = c !== void 0 ? c + "" : b[t] == "File" ? b.name : "blob", a), b.name !== c || b[t] == "blob" ? new File$1([b], c, b) : b] : [a, b + ""]), e = (c, f) => (f ? c : c.replace(/\r?\n|\r/g, "\r\n")).replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), x = (n, a, e) => {
3767
3812
  if (a.length < e) throw new TypeError(`Failed to execute '${n}' on 'FormData': ${e} arguments required, but only ${a.length} present.`);
3768
3813
  };
3769
3814
  FormData = class FormData {
@@ -3833,6 +3878,878 @@ var init_esm_min = __esmMin((() => {
3833
3878
  };
3834
3879
  }));
3835
3880
  //#endregion
3881
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/errors/base.js
3882
+ var FetchBaseError;
3883
+ var init_base = __esmMin((() => {
3884
+ FetchBaseError = class extends Error {
3885
+ constructor(message, type) {
3886
+ super(message);
3887
+ Error.captureStackTrace(this, this.constructor);
3888
+ this.type = type;
3889
+ }
3890
+ get name() {
3891
+ return this.constructor.name;
3892
+ }
3893
+ get [Symbol.toStringTag]() {
3894
+ return this.constructor.name;
3895
+ }
3896
+ };
3897
+ }));
3898
+ //#endregion
3899
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/errors/fetch-error.js
3900
+ var FetchError;
3901
+ var init_fetch_error = __esmMin((() => {
3902
+ init_base();
3903
+ FetchError = class extends FetchBaseError {
3904
+ /**
3905
+ * @param {string} message - Error message for human
3906
+ * @param {string} [type] - Error type for machine
3907
+ * @param {SystemError} [systemError] - For Node.js system error
3908
+ */
3909
+ constructor(message, type, systemError) {
3910
+ super(message, type);
3911
+ if (systemError) {
3912
+ this.code = this.errno = systemError.code;
3913
+ this.erroredSysCall = systemError.syscall;
3914
+ }
3915
+ }
3916
+ };
3917
+ }));
3918
+ //#endregion
3919
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is.js
3920
+ var NAME, isURLSearchParameters, isBlob, isAbortSignal, isDomainOrSubdomain, isSameProtocol;
3921
+ var init_is = __esmMin((() => {
3922
+ NAME = Symbol.toStringTag;
3923
+ isURLSearchParameters = (object) => {
3924
+ return typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && typeof object.sort === "function" && object[NAME] === "URLSearchParams";
3925
+ };
3926
+ isBlob = (object) => {
3927
+ return object && typeof object === "object" && typeof object.arrayBuffer === "function" && typeof object.type === "string" && typeof object.stream === "function" && typeof object.constructor === "function" && /^(Blob|File)$/.test(object[NAME]);
3928
+ };
3929
+ isAbortSignal = (object) => {
3930
+ return typeof object === "object" && (object[NAME] === "AbortSignal" || object[NAME] === "EventTarget");
3931
+ };
3932
+ isDomainOrSubdomain = (destination, original) => {
3933
+ const orig = new URL(original).hostname;
3934
+ const dest = new URL(destination).hostname;
3935
+ return orig === dest || orig.endsWith(`.${dest}`);
3936
+ };
3937
+ isSameProtocol = (destination, original) => {
3938
+ return new URL(original).protocol === new URL(destination).protocol;
3939
+ };
3940
+ }));
3941
+ //#endregion
3942
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/body.js
3943
+ /**
3944
+ * Body.js
3945
+ *
3946
+ * Body interface provides common methods for Request and Response
3947
+ */
3948
+ /**
3949
+ * Consume and convert an entire Body to a Buffer.
3950
+ *
3951
+ * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body
3952
+ *
3953
+ * @return Promise
3954
+ */
3955
+ async function consumeBody(data) {
3956
+ if (data[INTERNALS$2].disturbed) throw new TypeError(`body used already for: ${data.url}`);
3957
+ data[INTERNALS$2].disturbed = true;
3958
+ if (data[INTERNALS$2].error) throw data[INTERNALS$2].error;
3959
+ const { body } = data;
3960
+ if (body === null) return Buffer$1.alloc(0);
3961
+ /* c8 ignore next 3 */
3962
+ if (!(body instanceof Stream)) return Buffer$1.alloc(0);
3963
+ const accum = [];
3964
+ let accumBytes = 0;
3965
+ try {
3966
+ for await (const chunk of body) {
3967
+ if (data.size > 0 && accumBytes + chunk.length > data.size) {
3968
+ const error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size");
3969
+ body.destroy(error);
3970
+ throw error;
3971
+ }
3972
+ accumBytes += chunk.length;
3973
+ accum.push(chunk);
3974
+ }
3975
+ } catch (error) {
3976
+ throw error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, "system", error);
3977
+ }
3978
+ if (body.readableEnded === true || body._readableState.ended === true) try {
3979
+ if (accum.every((c) => typeof c === "string")) return Buffer$1.from(accum.join(""));
3980
+ return Buffer$1.concat(accum, accumBytes);
3981
+ } catch (error) {
3982
+ throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, "system", error);
3983
+ }
3984
+ else throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`);
3985
+ }
3986
+ var pipeline$1, INTERNALS$2, Body, clone, getNonSpecFormDataBoundary, extractContentType, getTotalBytes, writeToStream;
3987
+ var init_body = __esmMin((() => {
3988
+ init_fetch_blob();
3989
+ init_esm_min();
3990
+ init_fetch_error();
3991
+ init_base();
3992
+ init_is();
3993
+ pipeline$1 = promisify(Stream.pipeline);
3994
+ INTERNALS$2 = Symbol("Body internals");
3995
+ Body = class {
3996
+ constructor(body, { size = 0 } = {}) {
3997
+ let boundary = null;
3998
+ if (body === null) body = null;
3999
+ else if (isURLSearchParameters(body)) body = Buffer$1.from(body.toString());
4000
+ else if (isBlob(body)) {} else if (Buffer$1.isBuffer(body)) {} else if (types.isAnyArrayBuffer(body)) body = Buffer$1.from(body);
4001
+ else if (ArrayBuffer.isView(body)) body = Buffer$1.from(body.buffer, body.byteOffset, body.byteLength);
4002
+ else if (body instanceof Stream) {} else if (body instanceof FormData) {
4003
+ body = formDataToBlob(body);
4004
+ boundary = body.type.split("=")[1];
4005
+ } else body = Buffer$1.from(String(body));
4006
+ let stream = body;
4007
+ if (Buffer$1.isBuffer(body)) stream = Stream.Readable.from(body);
4008
+ else if (isBlob(body)) stream = Stream.Readable.from(body.stream());
4009
+ this[INTERNALS$2] = {
4010
+ body,
4011
+ stream,
4012
+ boundary,
4013
+ disturbed: false,
4014
+ error: null
4015
+ };
4016
+ this.size = size;
4017
+ if (body instanceof Stream) body.on("error", (error_) => {
4018
+ const error = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
4019
+ this[INTERNALS$2].error = error;
4020
+ });
4021
+ }
4022
+ get body() {
4023
+ return this[INTERNALS$2].stream;
4024
+ }
4025
+ get bodyUsed() {
4026
+ return this[INTERNALS$2].disturbed;
4027
+ }
4028
+ /**
4029
+ * Decode response as ArrayBuffer
4030
+ *
4031
+ * @return Promise
4032
+ */
4033
+ async arrayBuffer() {
4034
+ const { buffer, byteOffset, byteLength } = await consumeBody(this);
4035
+ return buffer.slice(byteOffset, byteOffset + byteLength);
4036
+ }
4037
+ async formData() {
4038
+ const ct = this.headers.get("content-type");
4039
+ if (ct.startsWith("application/x-www-form-urlencoded")) {
4040
+ const formData = new FormData();
4041
+ const parameters = new URLSearchParams(await this.text());
4042
+ for (const [name, value] of parameters) formData.append(name, value);
4043
+ return formData;
4044
+ }
4045
+ const { toFormData } = await import("./multipart-parser-CBAi6PxA.mjs");
4046
+ return toFormData(this.body, ct);
4047
+ }
4048
+ /**
4049
+ * Return raw response as Blob
4050
+ *
4051
+ * @return Promise
4052
+ */
4053
+ async blob() {
4054
+ const ct = this.headers && this.headers.get("content-type") || this[INTERNALS$2].body && this[INTERNALS$2].body.type || "";
4055
+ const buf = await this.arrayBuffer();
4056
+ return new Blob$1([buf], { type: ct });
4057
+ }
4058
+ /**
4059
+ * Decode response as json
4060
+ *
4061
+ * @return Promise
4062
+ */
4063
+ async json() {
4064
+ const text = await this.text();
4065
+ return JSON.parse(text);
4066
+ }
4067
+ /**
4068
+ * Decode response as text
4069
+ *
4070
+ * @return Promise
4071
+ */
4072
+ async text() {
4073
+ const buffer = await consumeBody(this);
4074
+ return new TextDecoder().decode(buffer);
4075
+ }
4076
+ /**
4077
+ * Decode response as buffer (non-spec api)
4078
+ *
4079
+ * @return Promise
4080
+ */
4081
+ buffer() {
4082
+ return consumeBody(this);
4083
+ }
4084
+ };
4085
+ Body.prototype.buffer = deprecate(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
4086
+ Object.defineProperties(Body.prototype, {
4087
+ body: { enumerable: true },
4088
+ bodyUsed: { enumerable: true },
4089
+ arrayBuffer: { enumerable: true },
4090
+ blob: { enumerable: true },
4091
+ json: { enumerable: true },
4092
+ text: { enumerable: true },
4093
+ data: { get: deprecate(() => {}, "data doesn't exist, use json(), text(), arrayBuffer(), or body instead", "https://github.com/node-fetch/node-fetch/issues/1000 (response)") }
4094
+ });
4095
+ clone = (instance, highWaterMark) => {
4096
+ let p1;
4097
+ let p2;
4098
+ let { body } = instance[INTERNALS$2];
4099
+ if (instance.bodyUsed) throw new Error("cannot clone body after it is used");
4100
+ if (body instanceof Stream && typeof body.getBoundary !== "function") {
4101
+ p1 = new PassThrough({ highWaterMark });
4102
+ p2 = new PassThrough({ highWaterMark });
4103
+ body.pipe(p1);
4104
+ body.pipe(p2);
4105
+ instance[INTERNALS$2].stream = p1;
4106
+ body = p2;
4107
+ }
4108
+ return body;
4109
+ };
4110
+ getNonSpecFormDataBoundary = deprecate((body) => body.getBoundary(), "form-data doesn't follow the spec and requires special treatment. Use alternative package", "https://github.com/node-fetch/node-fetch/issues/1167");
4111
+ extractContentType = (body, request) => {
4112
+ if (body === null) return null;
4113
+ if (typeof body === "string") return "text/plain;charset=UTF-8";
4114
+ if (isURLSearchParameters(body)) return "application/x-www-form-urlencoded;charset=UTF-8";
4115
+ if (isBlob(body)) return body.type || null;
4116
+ if (Buffer$1.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) return null;
4117
+ if (body instanceof FormData) return `multipart/form-data; boundary=${request[INTERNALS$2].boundary}`;
4118
+ if (body && typeof body.getBoundary === "function") return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;
4119
+ if (body instanceof Stream) return null;
4120
+ return "text/plain;charset=UTF-8";
4121
+ };
4122
+ getTotalBytes = (request) => {
4123
+ const { body } = request[INTERNALS$2];
4124
+ if (body === null) return 0;
4125
+ if (isBlob(body)) return body.size;
4126
+ if (Buffer$1.isBuffer(body)) return body.length;
4127
+ if (body && typeof body.getLengthSync === "function") return body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;
4128
+ return null;
4129
+ };
4130
+ writeToStream = async (dest, { body }) => {
4131
+ if (body === null) dest.end();
4132
+ else await pipeline$1(body, dest);
4133
+ };
4134
+ }));
4135
+ //#endregion
4136
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/headers.js
4137
+ /**
4138
+ * Headers.js
4139
+ *
4140
+ * Headers class offers convenient helpers
4141
+ */
4142
+ /**
4143
+ * Create a Headers object from an http.IncomingMessage.rawHeaders, ignoring those that do
4144
+ * not conform to HTTP grammar productions.
4145
+ * @param {import('http').IncomingMessage['rawHeaders']} headers
4146
+ */
4147
+ function fromRawHeaders(headers = []) {
4148
+ return new Headers(headers.reduce((result, value, index, array) => {
4149
+ if (index % 2 === 0) result.push(array.slice(index, index + 2));
4150
+ return result;
4151
+ }, []).filter(([name, value]) => {
4152
+ try {
4153
+ validateHeaderName(name);
4154
+ validateHeaderValue(name, String(value));
4155
+ return true;
4156
+ } catch {
4157
+ return false;
4158
+ }
4159
+ }));
4160
+ }
4161
+ var validateHeaderName, validateHeaderValue, Headers;
4162
+ var init_headers = __esmMin((() => {
4163
+ validateHeaderName = typeof http.validateHeaderName === "function" ? http.validateHeaderName : (name) => {
4164
+ if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
4165
+ const error = /* @__PURE__ */ new TypeError(`Header name must be a valid HTTP token [${name}]`);
4166
+ Object.defineProperty(error, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
4167
+ throw error;
4168
+ }
4169
+ };
4170
+ validateHeaderValue = typeof http.validateHeaderValue === "function" ? http.validateHeaderValue : (name, value) => {
4171
+ if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
4172
+ const error = /* @__PURE__ */ new TypeError(`Invalid character in header content ["${name}"]`);
4173
+ Object.defineProperty(error, "code", { value: "ERR_INVALID_CHAR" });
4174
+ throw error;
4175
+ }
4176
+ };
4177
+ Headers = class Headers extends URLSearchParams {
4178
+ /**
4179
+ * Headers class
4180
+ *
4181
+ * @constructor
4182
+ * @param {HeadersInit} [init] - Response headers
4183
+ */
4184
+ constructor(init) {
4185
+ /** @type {string[][]} */
4186
+ let result = [];
4187
+ if (init instanceof Headers) {
4188
+ const raw = init.raw();
4189
+ for (const [name, values] of Object.entries(raw)) result.push(...values.map((value) => [name, value]));
4190
+ } else if (init == null) {} else if (typeof init === "object" && !types.isBoxedPrimitive(init)) {
4191
+ const method = init[Symbol.iterator];
4192
+ if (method == null) result.push(...Object.entries(init));
4193
+ else {
4194
+ if (typeof method !== "function") throw new TypeError("Header pairs must be iterable");
4195
+ result = [...init].map((pair) => {
4196
+ if (typeof pair !== "object" || types.isBoxedPrimitive(pair)) throw new TypeError("Each header pair must be an iterable object");
4197
+ return [...pair];
4198
+ }).map((pair) => {
4199
+ if (pair.length !== 2) throw new TypeError("Each header pair must be a name/value tuple");
4200
+ return [...pair];
4201
+ });
4202
+ }
4203
+ } else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");
4204
+ result = result.length > 0 ? result.map(([name, value]) => {
4205
+ validateHeaderName(name);
4206
+ validateHeaderValue(name, String(value));
4207
+ return [String(name).toLowerCase(), String(value)];
4208
+ }) : void 0;
4209
+ super(result);
4210
+ return new Proxy(this, { get(target, p, receiver) {
4211
+ switch (p) {
4212
+ case "append":
4213
+ case "set": return (name, value) => {
4214
+ validateHeaderName(name);
4215
+ validateHeaderValue(name, String(value));
4216
+ return URLSearchParams.prototype[p].call(target, String(name).toLowerCase(), String(value));
4217
+ };
4218
+ case "delete":
4219
+ case "has":
4220
+ case "getAll": return (name) => {
4221
+ validateHeaderName(name);
4222
+ return URLSearchParams.prototype[p].call(target, String(name).toLowerCase());
4223
+ };
4224
+ case "keys": return () => {
4225
+ target.sort();
4226
+ return new Set(URLSearchParams.prototype.keys.call(target)).keys();
4227
+ };
4228
+ default: return Reflect.get(target, p, receiver);
4229
+ }
4230
+ } });
4231
+ /* c8 ignore next */
4232
+ }
4233
+ get [Symbol.toStringTag]() {
4234
+ return this.constructor.name;
4235
+ }
4236
+ toString() {
4237
+ return Object.prototype.toString.call(this);
4238
+ }
4239
+ get(name) {
4240
+ const values = this.getAll(name);
4241
+ if (values.length === 0) return null;
4242
+ let value = values.join(", ");
4243
+ if (/^content-encoding$/i.test(name)) value = value.toLowerCase();
4244
+ return value;
4245
+ }
4246
+ forEach(callback, thisArg = void 0) {
4247
+ for (const name of this.keys()) Reflect.apply(callback, thisArg, [
4248
+ this.get(name),
4249
+ name,
4250
+ this
4251
+ ]);
4252
+ }
4253
+ *values() {
4254
+ for (const name of this.keys()) yield this.get(name);
4255
+ }
4256
+ /**
4257
+ * @type {() => IterableIterator<[string, string]>}
4258
+ */
4259
+ *entries() {
4260
+ for (const name of this.keys()) yield [name, this.get(name)];
4261
+ }
4262
+ [Symbol.iterator]() {
4263
+ return this.entries();
4264
+ }
4265
+ /**
4266
+ * Node-fetch non-spec method
4267
+ * returning all headers and their values as array
4268
+ * @returns {Record<string, string[]>}
4269
+ */
4270
+ raw() {
4271
+ return [...this.keys()].reduce((result, key) => {
4272
+ result[key] = this.getAll(key);
4273
+ return result;
4274
+ }, {});
4275
+ }
4276
+ /**
4277
+ * For better console.log(headers) and also to convert Headers into Node.js Request compatible format
4278
+ */
4279
+ [Symbol.for("nodejs.util.inspect.custom")]() {
4280
+ return [...this.keys()].reduce((result, key) => {
4281
+ const values = this.getAll(key);
4282
+ if (key === "host") result[key] = values[0];
4283
+ else result[key] = values.length > 1 ? values : values[0];
4284
+ return result;
4285
+ }, {});
4286
+ }
4287
+ };
4288
+ /**
4289
+ * Re-shaping object for Web IDL tests
4290
+ * Only need to do it for overridden methods
4291
+ */
4292
+ Object.defineProperties(Headers.prototype, [
4293
+ "get",
4294
+ "entries",
4295
+ "forEach",
4296
+ "values"
4297
+ ].reduce((result, property) => {
4298
+ result[property] = { enumerable: true };
4299
+ return result;
4300
+ }, {}));
4301
+ }));
4302
+ //#endregion
4303
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is-redirect.js
4304
+ var redirectStatus, isRedirect;
4305
+ var init_is_redirect = __esmMin((() => {
4306
+ redirectStatus = /* @__PURE__ */ new Set([
4307
+ 301,
4308
+ 302,
4309
+ 303,
4310
+ 307,
4311
+ 308
4312
+ ]);
4313
+ isRedirect = (code) => {
4314
+ return redirectStatus.has(code);
4315
+ };
4316
+ }));
4317
+ //#endregion
4318
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/response.js
4319
+ var INTERNALS$1, Response;
4320
+ var init_response = __esmMin((() => {
4321
+ init_headers();
4322
+ init_body();
4323
+ init_is_redirect();
4324
+ INTERNALS$1 = Symbol("Response internals");
4325
+ Response = class Response extends Body {
4326
+ constructor(body = null, options = {}) {
4327
+ super(body, options);
4328
+ const status = options.status != null ? options.status : 200;
4329
+ const headers = new Headers(options.headers);
4330
+ if (body !== null && !headers.has("Content-Type")) {
4331
+ const contentType = extractContentType(body, this);
4332
+ if (contentType) headers.append("Content-Type", contentType);
4333
+ }
4334
+ this[INTERNALS$1] = {
4335
+ type: "default",
4336
+ url: options.url,
4337
+ status,
4338
+ statusText: options.statusText || "",
4339
+ headers,
4340
+ counter: options.counter,
4341
+ highWaterMark: options.highWaterMark
4342
+ };
4343
+ }
4344
+ get type() {
4345
+ return this[INTERNALS$1].type;
4346
+ }
4347
+ get url() {
4348
+ return this[INTERNALS$1].url || "";
4349
+ }
4350
+ get status() {
4351
+ return this[INTERNALS$1].status;
4352
+ }
4353
+ /**
4354
+ * Convenience property representing if the request ended normally
4355
+ */
4356
+ get ok() {
4357
+ return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
4358
+ }
4359
+ get redirected() {
4360
+ return this[INTERNALS$1].counter > 0;
4361
+ }
4362
+ get statusText() {
4363
+ return this[INTERNALS$1].statusText;
4364
+ }
4365
+ get headers() {
4366
+ return this[INTERNALS$1].headers;
4367
+ }
4368
+ get highWaterMark() {
4369
+ return this[INTERNALS$1].highWaterMark;
4370
+ }
4371
+ /**
4372
+ * Clone this response
4373
+ *
4374
+ * @return Response
4375
+ */
4376
+ clone() {
4377
+ return new Response(clone(this, this.highWaterMark), {
4378
+ type: this.type,
4379
+ url: this.url,
4380
+ status: this.status,
4381
+ statusText: this.statusText,
4382
+ headers: this.headers,
4383
+ ok: this.ok,
4384
+ redirected: this.redirected,
4385
+ size: this.size,
4386
+ highWaterMark: this.highWaterMark
4387
+ });
4388
+ }
4389
+ /**
4390
+ * @param {string} url The URL that the new response is to originate from.
4391
+ * @param {number} status An optional status code for the response (e.g., 302.)
4392
+ * @returns {Response} A Response object.
4393
+ */
4394
+ static redirect(url, status = 302) {
4395
+ if (!isRedirect(status)) throw new RangeError("Failed to execute \"redirect\" on \"response\": Invalid status code");
4396
+ return new Response(null, {
4397
+ headers: { location: new URL(url).toString() },
4398
+ status
4399
+ });
4400
+ }
4401
+ static error() {
4402
+ const response = new Response(null, {
4403
+ status: 0,
4404
+ statusText: ""
4405
+ });
4406
+ response[INTERNALS$1].type = "error";
4407
+ return response;
4408
+ }
4409
+ static json(data = void 0, init = {}) {
4410
+ const body = JSON.stringify(data);
4411
+ if (body === void 0) throw new TypeError("data is not JSON serializable");
4412
+ const headers = new Headers(init && init.headers);
4413
+ if (!headers.has("content-type")) headers.set("content-type", "application/json");
4414
+ return new Response(body, {
4415
+ ...init,
4416
+ headers
4417
+ });
4418
+ }
4419
+ get [Symbol.toStringTag]() {
4420
+ return "Response";
4421
+ }
4422
+ };
4423
+ Object.defineProperties(Response.prototype, {
4424
+ type: { enumerable: true },
4425
+ url: { enumerable: true },
4426
+ status: { enumerable: true },
4427
+ ok: { enumerable: true },
4428
+ redirected: { enumerable: true },
4429
+ statusText: { enumerable: true },
4430
+ headers: { enumerable: true },
4431
+ clone: { enumerable: true }
4432
+ });
4433
+ }));
4434
+ //#endregion
4435
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/get-search.js
4436
+ var getSearch;
4437
+ var init_get_search = __esmMin((() => {
4438
+ getSearch = (parsedURL) => {
4439
+ if (parsedURL.search) return parsedURL.search;
4440
+ const lastOffset = parsedURL.href.length - 1;
4441
+ const hash = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
4442
+ return parsedURL.href[lastOffset - hash.length] === "?" ? "?" : "";
4443
+ };
4444
+ }));
4445
+ //#endregion
4446
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/referrer.js
4447
+ /**
4448
+ * @external URL
4449
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URL|URL}
4450
+ */
4451
+ /**
4452
+ * @module utils/referrer
4453
+ * @private
4454
+ */
4455
+ /**
4456
+ * @see {@link https://w3c.github.io/webappsec-referrer-policy/#strip-url|Referrer Policy §8.4. Strip url for use as a referrer}
4457
+ * @param {string} URL
4458
+ * @param {boolean} [originOnly=false]
4459
+ */
4460
+ function stripURLForUseAsAReferrer(url, originOnly = false) {
4461
+ if (url == null) return "no-referrer";
4462
+ url = new URL(url);
4463
+ if (/^(about|blob|data):$/.test(url.protocol)) return "no-referrer";
4464
+ url.username = "";
4465
+ url.password = "";
4466
+ url.hash = "";
4467
+ if (originOnly) {
4468
+ url.pathname = "";
4469
+ url.search = "";
4470
+ }
4471
+ return url;
4472
+ }
4473
+ /**
4474
+ * @see {@link https://w3c.github.io/webappsec-referrer-policy/#referrer-policies|Referrer Policy §3. Referrer Policies}
4475
+ * @param {string} referrerPolicy
4476
+ * @returns {string} referrerPolicy
4477
+ */
4478
+ function validateReferrerPolicy(referrerPolicy) {
4479
+ if (!ReferrerPolicy.has(referrerPolicy)) throw new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);
4480
+ return referrerPolicy;
4481
+ }
4482
+ /**
4483
+ * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy|Referrer Policy §3.2. Is origin potentially trustworthy?}
4484
+ * @param {external:URL} url
4485
+ * @returns `true`: "Potentially Trustworthy", `false`: "Not Trustworthy"
4486
+ */
4487
+ function isOriginPotentiallyTrustworthy(url) {
4488
+ if (/^(http|ws)s:$/.test(url.protocol)) return true;
4489
+ const hostIp = url.host.replace(/(^\[)|(]$)/g, "");
4490
+ const hostIPVersion = isIP(hostIp);
4491
+ if (hostIPVersion === 4 && /^127\./.test(hostIp)) return true;
4492
+ if (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) return true;
4493
+ if (url.host === "localhost" || url.host.endsWith(".localhost")) return false;
4494
+ if (url.protocol === "file:") return true;
4495
+ return false;
4496
+ }
4497
+ /**
4498
+ * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy|Referrer Policy §3.3. Is url potentially trustworthy?}
4499
+ * @param {external:URL} url
4500
+ * @returns `true`: "Potentially Trustworthy", `false`: "Not Trustworthy"
4501
+ */
4502
+ function isUrlPotentiallyTrustworthy(url) {
4503
+ if (/^about:(blank|srcdoc)$/.test(url)) return true;
4504
+ if (url.protocol === "data:") return true;
4505
+ if (/^(blob|filesystem):$/.test(url.protocol)) return true;
4506
+ return isOriginPotentiallyTrustworthy(url);
4507
+ }
4508
+ /**
4509
+ * Modifies the referrerURL to enforce any extra security policy considerations.
4510
+ * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7
4511
+ * @callback module:utils/referrer~referrerURLCallback
4512
+ * @param {external:URL} referrerURL
4513
+ * @returns {external:URL} modified referrerURL
4514
+ */
4515
+ /**
4516
+ * Modifies the referrerOrigin to enforce any extra security policy considerations.
4517
+ * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7
4518
+ * @callback module:utils/referrer~referrerOriginCallback
4519
+ * @param {external:URL} referrerOrigin
4520
+ * @returns {external:URL} modified referrerOrigin
4521
+ */
4522
+ /**
4523
+ * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}
4524
+ * @param {Request} request
4525
+ * @param {object} o
4526
+ * @param {module:utils/referrer~referrerURLCallback} o.referrerURLCallback
4527
+ * @param {module:utils/referrer~referrerOriginCallback} o.referrerOriginCallback
4528
+ * @returns {external:URL} Request's referrer
4529
+ */
4530
+ function determineRequestsReferrer(request, { referrerURLCallback, referrerOriginCallback } = {}) {
4531
+ if (request.referrer === "no-referrer" || request.referrerPolicy === "") return null;
4532
+ const policy = request.referrerPolicy;
4533
+ if (request.referrer === "about:client") return "no-referrer";
4534
+ const referrerSource = request.referrer;
4535
+ let referrerURL = stripURLForUseAsAReferrer(referrerSource);
4536
+ let referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);
4537
+ if (referrerURL.toString().length > 4096) referrerURL = referrerOrigin;
4538
+ if (referrerURLCallback) referrerURL = referrerURLCallback(referrerURL);
4539
+ if (referrerOriginCallback) referrerOrigin = referrerOriginCallback(referrerOrigin);
4540
+ const currentURL = new URL(request.url);
4541
+ switch (policy) {
4542
+ case "no-referrer": return "no-referrer";
4543
+ case "origin": return referrerOrigin;
4544
+ case "unsafe-url": return referrerURL;
4545
+ case "strict-origin":
4546
+ if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) return "no-referrer";
4547
+ return referrerOrigin.toString();
4548
+ case "strict-origin-when-cross-origin":
4549
+ if (referrerURL.origin === currentURL.origin) return referrerURL;
4550
+ if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) return "no-referrer";
4551
+ return referrerOrigin;
4552
+ case "same-origin":
4553
+ if (referrerURL.origin === currentURL.origin) return referrerURL;
4554
+ return "no-referrer";
4555
+ case "origin-when-cross-origin":
4556
+ if (referrerURL.origin === currentURL.origin) return referrerURL;
4557
+ return referrerOrigin;
4558
+ case "no-referrer-when-downgrade":
4559
+ if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) return "no-referrer";
4560
+ return referrerURL;
4561
+ default: throw new TypeError(`Invalid referrerPolicy: ${policy}`);
4562
+ }
4563
+ }
4564
+ /**
4565
+ * @see {@link https://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header|Referrer Policy §8.1. Parse a referrer policy from a Referrer-Policy header}
4566
+ * @param {Headers} headers Response headers
4567
+ * @returns {string} policy
4568
+ */
4569
+ function parseReferrerPolicyFromHeader(headers) {
4570
+ const policyTokens = (headers.get("referrer-policy") || "").split(/[,\s]+/);
4571
+ let policy = "";
4572
+ for (const token of policyTokens) if (token && ReferrerPolicy.has(token)) policy = token;
4573
+ return policy;
4574
+ }
4575
+ var ReferrerPolicy, DEFAULT_REFERRER_POLICY;
4576
+ var init_referrer = __esmMin((() => {
4577
+ ReferrerPolicy = /* @__PURE__ */ new Set([
4578
+ "",
4579
+ "no-referrer",
4580
+ "no-referrer-when-downgrade",
4581
+ "same-origin",
4582
+ "origin",
4583
+ "strict-origin",
4584
+ "origin-when-cross-origin",
4585
+ "strict-origin-when-cross-origin",
4586
+ "unsafe-url"
4587
+ ]);
4588
+ DEFAULT_REFERRER_POLICY = "strict-origin-when-cross-origin";
4589
+ }));
4590
+ //#endregion
4591
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/request.js
4592
+ /**
4593
+ * Request.js
4594
+ *
4595
+ * Request class contains server only options
4596
+ *
4597
+ * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
4598
+ */
4599
+ var INTERNALS, isRequest, doBadDataWarn, Request, getNodeRequestOptions;
4600
+ var init_request = __esmMin((() => {
4601
+ init_headers();
4602
+ init_body();
4603
+ init_is();
4604
+ init_get_search();
4605
+ init_referrer();
4606
+ INTERNALS = Symbol("Request internals");
4607
+ isRequest = (object) => {
4608
+ return typeof object === "object" && typeof object[INTERNALS] === "object";
4609
+ };
4610
+ doBadDataWarn = deprecate(() => {}, ".data is not a valid RequestInit property, use .body instead", "https://github.com/node-fetch/node-fetch/issues/1000 (request)");
4611
+ Request = class Request extends Body {
4612
+ constructor(input, init = {}) {
4613
+ let parsedURL;
4614
+ if (isRequest(input)) parsedURL = new URL(input.url);
4615
+ else {
4616
+ parsedURL = new URL(input);
4617
+ input = {};
4618
+ }
4619
+ if (parsedURL.username !== "" || parsedURL.password !== "") throw new TypeError(`${parsedURL} is an url with embedded credentials.`);
4620
+ let method = init.method || input.method || "GET";
4621
+ if (/^(delete|get|head|options|post|put)$/i.test(method)) method = method.toUpperCase();
4622
+ if (!isRequest(init) && "data" in init) doBadDataWarn();
4623
+ if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) throw new TypeError("Request with GET/HEAD method cannot have body");
4624
+ const inputBody = init.body ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
4625
+ super(inputBody, { size: init.size || input.size || 0 });
4626
+ const headers = new Headers(init.headers || input.headers || {});
4627
+ if (inputBody !== null && !headers.has("Content-Type")) {
4628
+ const contentType = extractContentType(inputBody, this);
4629
+ if (contentType) headers.set("Content-Type", contentType);
4630
+ }
4631
+ let signal = isRequest(input) ? input.signal : null;
4632
+ if ("signal" in init) signal = init.signal;
4633
+ if (signal != null && !isAbortSignal(signal)) throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
4634
+ let referrer = init.referrer == null ? input.referrer : init.referrer;
4635
+ if (referrer === "") referrer = "no-referrer";
4636
+ else if (referrer) {
4637
+ const parsedReferrer = new URL(referrer);
4638
+ referrer = /^about:(\/\/)?client$/.test(parsedReferrer) ? "client" : parsedReferrer;
4639
+ } else referrer = void 0;
4640
+ this[INTERNALS] = {
4641
+ method,
4642
+ redirect: init.redirect || input.redirect || "follow",
4643
+ headers,
4644
+ parsedURL,
4645
+ signal,
4646
+ referrer
4647
+ };
4648
+ this.follow = init.follow === void 0 ? input.follow === void 0 ? 20 : input.follow : init.follow;
4649
+ this.compress = init.compress === void 0 ? input.compress === void 0 ? true : input.compress : init.compress;
4650
+ this.counter = init.counter || input.counter || 0;
4651
+ this.agent = init.agent || input.agent;
4652
+ this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
4653
+ this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
4654
+ this.referrerPolicy = init.referrerPolicy || input.referrerPolicy || "";
4655
+ }
4656
+ /** @returns {string} */
4657
+ get method() {
4658
+ return this[INTERNALS].method;
4659
+ }
4660
+ /** @returns {string} */
4661
+ get url() {
4662
+ return format(this[INTERNALS].parsedURL);
4663
+ }
4664
+ /** @returns {Headers} */
4665
+ get headers() {
4666
+ return this[INTERNALS].headers;
4667
+ }
4668
+ get redirect() {
4669
+ return this[INTERNALS].redirect;
4670
+ }
4671
+ /** @returns {AbortSignal} */
4672
+ get signal() {
4673
+ return this[INTERNALS].signal;
4674
+ }
4675
+ get referrer() {
4676
+ if (this[INTERNALS].referrer === "no-referrer") return "";
4677
+ if (this[INTERNALS].referrer === "client") return "about:client";
4678
+ if (this[INTERNALS].referrer) return this[INTERNALS].referrer.toString();
4679
+ }
4680
+ get referrerPolicy() {
4681
+ return this[INTERNALS].referrerPolicy;
4682
+ }
4683
+ set referrerPolicy(referrerPolicy) {
4684
+ this[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);
4685
+ }
4686
+ /**
4687
+ * Clone this request
4688
+ *
4689
+ * @return Request
4690
+ */
4691
+ clone() {
4692
+ return new Request(this);
4693
+ }
4694
+ get [Symbol.toStringTag]() {
4695
+ return "Request";
4696
+ }
4697
+ };
4698
+ Object.defineProperties(Request.prototype, {
4699
+ method: { enumerable: true },
4700
+ url: { enumerable: true },
4701
+ headers: { enumerable: true },
4702
+ redirect: { enumerable: true },
4703
+ clone: { enumerable: true },
4704
+ signal: { enumerable: true },
4705
+ referrer: { enumerable: true },
4706
+ referrerPolicy: { enumerable: true }
4707
+ });
4708
+ getNodeRequestOptions = (request) => {
4709
+ const { parsedURL } = request[INTERNALS];
4710
+ const headers = new Headers(request[INTERNALS].headers);
4711
+ if (!headers.has("Accept")) headers.set("Accept", "*/*");
4712
+ let contentLengthValue = null;
4713
+ if (request.body === null && /^(post|put)$/i.test(request.method)) contentLengthValue = "0";
4714
+ if (request.body !== null) {
4715
+ const totalBytes = getTotalBytes(request);
4716
+ if (typeof totalBytes === "number" && !Number.isNaN(totalBytes)) contentLengthValue = String(totalBytes);
4717
+ }
4718
+ if (contentLengthValue) headers.set("Content-Length", contentLengthValue);
4719
+ if (request.referrerPolicy === "") request.referrerPolicy = DEFAULT_REFERRER_POLICY;
4720
+ if (request.referrer && request.referrer !== "no-referrer") request[INTERNALS].referrer = determineRequestsReferrer(request);
4721
+ else request[INTERNALS].referrer = "no-referrer";
4722
+ if (request[INTERNALS].referrer instanceof URL) headers.set("Referer", request.referrer);
4723
+ if (!headers.has("User-Agent")) headers.set("User-Agent", "node-fetch");
4724
+ if (request.compress && !headers.has("Accept-Encoding")) headers.set("Accept-Encoding", "gzip, deflate, br");
4725
+ let { agent } = request;
4726
+ if (typeof agent === "function") agent = agent(parsedURL);
4727
+ const search = getSearch(parsedURL);
4728
+ return {
4729
+ /** @type {URL} */
4730
+ parsedURL,
4731
+ options: {
4732
+ path: parsedURL.pathname + search,
4733
+ method: request.method,
4734
+ headers: headers[Symbol.for("nodejs.util.inspect.custom")](),
4735
+ insecureHTTPParser: request.insecureHTTPParser,
4736
+ agent
4737
+ }
4738
+ };
4739
+ };
4740
+ }));
4741
+ //#endregion
4742
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/errors/abort-error.js
4743
+ var AbortError;
4744
+ var init_abort_error = __esmMin((() => {
4745
+ init_base();
4746
+ AbortError = class extends FetchBaseError {
4747
+ constructor(message, type = "aborted") {
4748
+ super(message, type);
4749
+ }
4750
+ };
4751
+ }));
4752
+ //#endregion
3836
4753
  //#region node_modules/.pnpm/node-domexception@1.0.0/node_modules/node-domexception/index.js
3837
4754
  var require_node_domexception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3838
4755
  /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
@@ -3851,6 +4768,264 @@ var init_from = __esmMin((() => {
3851
4768
  ({stat} = promises);
3852
4769
  }));
3853
4770
  //#endregion
3854
- export { File as a, init_fetch_blob as c, init_esm_min as i, FormData as n, init_file as o, formDataToBlob as r, Blob as s, init_from as t };
4771
+ //#region node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js
4772
+ /**
4773
+ * Index.js
4774
+ *
4775
+ * a request API compatible with window.fetch
4776
+ *
4777
+ * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
4778
+ */
4779
+ /**
4780
+ * Fetch function
4781
+ *
4782
+ * @param {string | URL | import('./request').default} url - Absolute url or Request instance
4783
+ * @param {*} [options_] - Fetch options
4784
+ * @return {Promise<import('./response').default>}
4785
+ */
4786
+ async function fetch(url, options_) {
4787
+ return new Promise((resolve, reject) => {
4788
+ const request = new Request(url, options_);
4789
+ const { parsedURL, options } = getNodeRequestOptions(request);
4790
+ if (!supportedSchemas.has(parsedURL.protocol)) throw new TypeError(`node-fetch cannot load ${url}. URL scheme "${parsedURL.protocol.replace(/:$/, "")}" is not supported.`);
4791
+ if (parsedURL.protocol === "data:") {
4792
+ const data = dataUriToBuffer(request.url);
4793
+ resolve(new Response(data, { headers: { "Content-Type": data.typeFull } }));
4794
+ return;
4795
+ }
4796
+ const send = (parsedURL.protocol === "https:" ? https : http).request;
4797
+ const { signal } = request;
4798
+ let response = null;
4799
+ const abort = () => {
4800
+ const error = new AbortError("The operation was aborted.");
4801
+ reject(error);
4802
+ if (request.body && request.body instanceof Stream.Readable) request.body.destroy(error);
4803
+ if (!response || !response.body) return;
4804
+ response.body.emit("error", error);
4805
+ };
4806
+ if (signal && signal.aborted) {
4807
+ abort();
4808
+ return;
4809
+ }
4810
+ const abortAndFinalize = () => {
4811
+ abort();
4812
+ finalize();
4813
+ };
4814
+ const request_ = send(parsedURL.toString(), options);
4815
+ if (signal) signal.addEventListener("abort", abortAndFinalize);
4816
+ const finalize = () => {
4817
+ request_.abort();
4818
+ if (signal) signal.removeEventListener("abort", abortAndFinalize);
4819
+ };
4820
+ request_.on("error", (error) => {
4821
+ reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, "system", error));
4822
+ finalize();
4823
+ });
4824
+ fixResponseChunkedTransferBadEnding(request_, (error) => {
4825
+ if (response && response.body) response.body.destroy(error);
4826
+ });
4827
+ /* c8 ignore next 18 */
4828
+ if (process.version < "v14") request_.on("socket", (s) => {
4829
+ let endedWithEventsCount;
4830
+ s.prependListener("end", () => {
4831
+ endedWithEventsCount = s._eventsCount;
4832
+ });
4833
+ s.prependListener("close", (hadError) => {
4834
+ if (response && endedWithEventsCount < s._eventsCount && !hadError) {
4835
+ const error = /* @__PURE__ */ new Error("Premature close");
4836
+ error.code = "ERR_STREAM_PREMATURE_CLOSE";
4837
+ response.body.emit("error", error);
4838
+ }
4839
+ });
4840
+ });
4841
+ request_.on("response", (response_) => {
4842
+ request_.setTimeout(0);
4843
+ const headers = fromRawHeaders(response_.rawHeaders);
4844
+ if (isRedirect(response_.statusCode)) {
4845
+ const location = headers.get("Location");
4846
+ let locationURL = null;
4847
+ try {
4848
+ locationURL = location === null ? null : new URL(location, request.url);
4849
+ } catch {
4850
+ if (request.redirect !== "manual") {
4851
+ reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
4852
+ finalize();
4853
+ return;
4854
+ }
4855
+ }
4856
+ switch (request.redirect) {
4857
+ case "error":
4858
+ reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
4859
+ finalize();
4860
+ return;
4861
+ case "manual": break;
4862
+ case "follow": {
4863
+ if (locationURL === null) break;
4864
+ if (request.counter >= request.follow) {
4865
+ reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
4866
+ finalize();
4867
+ return;
4868
+ }
4869
+ const requestOptions = {
4870
+ headers: new Headers(request.headers),
4871
+ follow: request.follow,
4872
+ counter: request.counter + 1,
4873
+ agent: request.agent,
4874
+ compress: request.compress,
4875
+ method: request.method,
4876
+ body: clone(request),
4877
+ signal: request.signal,
4878
+ size: request.size,
4879
+ referrer: request.referrer,
4880
+ referrerPolicy: request.referrerPolicy
4881
+ };
4882
+ if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) for (const name of [
4883
+ "authorization",
4884
+ "www-authenticate",
4885
+ "cookie",
4886
+ "cookie2"
4887
+ ]) requestOptions.headers.delete(name);
4888
+ if (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {
4889
+ reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
4890
+ finalize();
4891
+ return;
4892
+ }
4893
+ if (response_.statusCode === 303 || (response_.statusCode === 301 || response_.statusCode === 302) && request.method === "POST") {
4894
+ requestOptions.method = "GET";
4895
+ requestOptions.body = void 0;
4896
+ requestOptions.headers.delete("content-length");
4897
+ }
4898
+ const responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);
4899
+ if (responseReferrerPolicy) requestOptions.referrerPolicy = responseReferrerPolicy;
4900
+ resolve(fetch(new Request(locationURL, requestOptions)));
4901
+ finalize();
4902
+ return;
4903
+ }
4904
+ default: return reject(/* @__PURE__ */ new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
4905
+ }
4906
+ }
4907
+ if (signal) response_.once("end", () => {
4908
+ signal.removeEventListener("abort", abortAndFinalize);
4909
+ });
4910
+ let body = pipeline(response_, new PassThrough(), (error) => {
4911
+ if (error) reject(error);
4912
+ });
4913
+ /* c8 ignore next 3 */
4914
+ if (process.version < "v12.10") response_.on("aborted", abortAndFinalize);
4915
+ const responseOptions = {
4916
+ url: request.url,
4917
+ status: response_.statusCode,
4918
+ statusText: response_.statusMessage,
4919
+ headers,
4920
+ size: request.size,
4921
+ counter: request.counter,
4922
+ highWaterMark: request.highWaterMark
4923
+ };
4924
+ const codings = headers.get("Content-Encoding");
4925
+ if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
4926
+ response = new Response(body, responseOptions);
4927
+ resolve(response);
4928
+ return;
4929
+ }
4930
+ const zlibOptions = {
4931
+ flush: zlib.Z_SYNC_FLUSH,
4932
+ finishFlush: zlib.Z_SYNC_FLUSH
4933
+ };
4934
+ if (codings === "gzip" || codings === "x-gzip") {
4935
+ body = pipeline(body, zlib.createGunzip(zlibOptions), (error) => {
4936
+ if (error) reject(error);
4937
+ });
4938
+ response = new Response(body, responseOptions);
4939
+ resolve(response);
4940
+ return;
4941
+ }
4942
+ if (codings === "deflate" || codings === "x-deflate") {
4943
+ const raw = pipeline(response_, new PassThrough(), (error) => {
4944
+ if (error) reject(error);
4945
+ });
4946
+ raw.once("data", (chunk) => {
4947
+ if ((chunk[0] & 15) === 8) body = pipeline(body, zlib.createInflate(), (error) => {
4948
+ if (error) reject(error);
4949
+ });
4950
+ else body = pipeline(body, zlib.createInflateRaw(), (error) => {
4951
+ if (error) reject(error);
4952
+ });
4953
+ response = new Response(body, responseOptions);
4954
+ resolve(response);
4955
+ });
4956
+ raw.once("end", () => {
4957
+ if (!response) {
4958
+ response = new Response(body, responseOptions);
4959
+ resolve(response);
4960
+ }
4961
+ });
4962
+ return;
4963
+ }
4964
+ if (codings === "br") {
4965
+ body = pipeline(body, zlib.createBrotliDecompress(), (error) => {
4966
+ if (error) reject(error);
4967
+ });
4968
+ response = new Response(body, responseOptions);
4969
+ resolve(response);
4970
+ return;
4971
+ }
4972
+ response = new Response(body, responseOptions);
4973
+ resolve(response);
4974
+ });
4975
+ writeToStream(request_, request).catch(reject);
4976
+ });
4977
+ }
4978
+ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
4979
+ const LAST_CHUNK = Buffer$1.from("0\r\n\r\n");
4980
+ let isChunkedTransfer = false;
4981
+ let properLastChunkReceived = false;
4982
+ let previousChunk;
4983
+ request.on("response", (response) => {
4984
+ const { headers } = response;
4985
+ isChunkedTransfer = headers["transfer-encoding"] === "chunked" && !headers["content-length"];
4986
+ });
4987
+ request.on("socket", (socket) => {
4988
+ const onSocketClose = () => {
4989
+ if (isChunkedTransfer && !properLastChunkReceived) {
4990
+ const error = /* @__PURE__ */ new Error("Premature close");
4991
+ error.code = "ERR_STREAM_PREMATURE_CLOSE";
4992
+ errorCallback(error);
4993
+ }
4994
+ };
4995
+ const onData = (buf) => {
4996
+ properLastChunkReceived = Buffer$1.compare(buf.slice(-5), LAST_CHUNK) === 0;
4997
+ if (!properLastChunkReceived && previousChunk) properLastChunkReceived = Buffer$1.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 && Buffer$1.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0;
4998
+ previousChunk = buf;
4999
+ };
5000
+ socket.prependListener("close", onSocketClose);
5001
+ socket.on("data", onData);
5002
+ request.on("close", () => {
5003
+ socket.removeListener("close", onSocketClose);
5004
+ socket.removeListener("data", onData);
5005
+ });
5006
+ });
5007
+ }
5008
+ var supportedSchemas;
5009
+ //#endregion
5010
+ __esmMin((() => {
5011
+ init_dist();
5012
+ init_body();
5013
+ init_response();
5014
+ init_headers();
5015
+ init_request();
5016
+ init_fetch_error();
5017
+ init_abort_error();
5018
+ init_is_redirect();
5019
+ init_esm_min();
5020
+ init_is();
5021
+ init_referrer();
5022
+ init_from();
5023
+ supportedSchemas = /* @__PURE__ */ new Set([
5024
+ "data:",
5025
+ "http:",
5026
+ "https:"
5027
+ ]);
5028
+ }))();
5029
+ export { init_file as a, fetch as default, File$1 as i, FormData as n, init_esm_min as r, init_from as t };
3855
5030
 
3856
- //# sourceMappingURL=from-BCscBQ9P.mjs.map
5031
+ //# sourceMappingURL=src-85HOaW5W.mjs.map