zudoku 0.3.0-dev.79 → 0.3.0-dev.80

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 (45) hide show
  1. package/dist/lib/plugins/openapi/Sidecar.d.ts +4 -0
  2. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  3. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  4. package/dist/lib/plugins/openapi/index.js +25 -5
  5. package/dist/lib/plugins/openapi/index.js.map +1 -1
  6. package/lib/{AuthenticationPlugin-CngUn5DP.js → AuthenticationPlugin-XS0DoAhE.js} +2 -2
  7. package/lib/{AuthenticationPlugin-CngUn5DP.js.map → AuthenticationPlugin-XS0DoAhE.js.map} +1 -1
  8. package/lib/{Combination-CS4rK8IJ.js → Combination-C442XfGG.js} +368 -347
  9. package/lib/Combination-C442XfGG.js.map +1 -0
  10. package/lib/{DevPortalProvider-BTFqdAEL.js → DevPortalProvider-BWeAysxF.js} +6 -5
  11. package/lib/{DevPortalProvider-BTFqdAEL.js.map → DevPortalProvider-BWeAysxF.js.map} +1 -1
  12. package/lib/{Input-GFpPXs5b.js → Input-3IEt27jb.js} +3 -3
  13. package/lib/{Input-GFpPXs5b.js.map → Input-3IEt27jb.js.map} +1 -1
  14. package/lib/{MdxPage-V4FCB0C_.js → MdxPage-CA1WmW14.js} +2 -2
  15. package/lib/{MdxPage-V4FCB0C_.js.map → MdxPage-CA1WmW14.js.map} +1 -1
  16. package/lib/OperationList-rv6Z3wD3.js +431 -0
  17. package/lib/OperationList-rv6Z3wD3.js.map +1 -0
  18. package/lib/{Route-CogU1ofM.js → Route-Clw81GSR.js} +2 -2
  19. package/lib/{Route-CogU1ofM.js.map → Route-Clw81GSR.js.map} +1 -1
  20. package/lib/{SlotletProvider-D_Vz-7c_.js → SlotletProvider-B71hNEUL.js} +24 -45
  21. package/lib/SlotletProvider-B71hNEUL.js.map +1 -0
  22. package/lib/{Spinner-oNQQyp-I.js → Spinner-Coi7ORUV.js} +2 -2
  23. package/lib/{Spinner-oNQQyp-I.js.map → Spinner-Coi7ORUV.js.map} +1 -1
  24. package/lib/{index-D4bOMg7f.js → index-BH-Ub36F.js} +5 -5
  25. package/lib/{index-D4bOMg7f.js.map → index-BH-Ub36F.js.map} +1 -1
  26. package/lib/index-CLkuJSxj.js +5950 -0
  27. package/lib/index-CLkuJSxj.js.map +1 -0
  28. package/lib/zudoku.auth-clerk.js +1 -1
  29. package/lib/zudoku.auth-openid.js +1 -1
  30. package/lib/zudoku.components.js +25 -25
  31. package/lib/zudoku.plugin-api-keys.js +12 -12
  32. package/lib/zudoku.plugin-markdown.js +2 -2
  33. package/lib/zudoku.plugin-openapi.js +4 -3
  34. package/lib/zudoku.plugin-openapi.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  37. package/src/lib/plugins/openapi/index.tsx +52 -16
  38. package/lib/Combination-CS4rK8IJ.js.map +0 -1
  39. package/lib/OperationList-C-M33Hxu.js +0 -4368
  40. package/lib/OperationList-C-M33Hxu.js.map +0 -1
  41. package/lib/SlotletProvider-D_Vz-7c_.js.map +0 -1
  42. package/lib/context-_fYfJFgk.js +0 -14
  43. package/lib/context-_fYfJFgk.js.map +0 -1
  44. package/lib/index-Uqja2h2M.js +0 -1960
  45. package/lib/index-Uqja2h2M.js.map +0 -1
@@ -1,4368 +0,0 @@
1
- import { j as g } from "./jsx-runtime-CJBdjYYx.js";
2
- import { C as Vt } from "./CategoryHeading-DCmchnA1.js";
3
- import { D as hn } from "./DeveloperHint-DQVwIery.js";
4
- import { C as Ir, P as yn, g as qt, M as mn, S as gn, T as bn, a as vn, b as $n, c as xn, E as wn } from "./index-Uqja2h2M.js";
5
- import { c as Sn, h as Te, H as Ae, a as le, P as jn, S as at, I as Kt } from "./Markdown-QsZ-PHET.js";
6
- import { R as Lr, T as Ur, C as _r, a as On } from "./index-D4bOMg7f.js";
7
- import { u as Fr } from "./context-_fYfJFgk.js";
8
- import { u as Hr } from "./urql-DrBfkb92.js";
9
- import { useState as Br, useTransition as Tn, Fragment as Pn, useMemo as kn } from "react";
10
- import { B as En } from "./Combination-CS4rK8IJ.js";
11
- import { a as Cn, c as Ge, g as Nn } from "./_commonjsHelpers-BVfed4GL.js";
12
- import { u as Rn } from "./index-Dt-pU7Vu.js";
13
- /**
14
- * @license lucide-react v0.378.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */
19
- const An = Sn("ListPlus", [
20
- ["path", { d: "M11 12H3", key: "51ecnj" }],
21
- ["path", { d: "M16 6H3", key: "1wxfjs" }],
22
- ["path", { d: "M16 18H3", key: "12xzn7" }],
23
- ["path", { d: "M18 9v6", key: "1twb98" }],
24
- ["path", { d: "M21 12h-6", key: "bt1uis" }]
25
- ]);
26
- function qn(t, e) {
27
- return e;
28
- }
29
- const Mr = (t, e) => t.reduce(
30
- (r, o) => {
31
- const c = e(o);
32
- return r[c] || (r[c] = []), r[c].push(o), r;
33
- },
34
- {}
35
- ), Qt = (t, e) => t ? e(t) : void 0, Dt = (t) => t.schema != null && typeof t.schema == "object" ? t.schema : {
36
- type: "string"
37
- }, In = ({
38
- parameter: t,
39
- group: e,
40
- id: r
41
- }) => /* @__PURE__ */ g.jsxs("li", { className: "p-4 bg-border/20 text-sm flex flex-col gap-1", children: [
42
- /* @__PURE__ */ g.jsxs("div", { className: "flex items-center gap-2", children: [
43
- /* @__PURE__ */ g.jsx("code", { children: e === "path" ? /* @__PURE__ */ g.jsx(
44
- Ir,
45
- {
46
- name: t.name,
47
- backgroundOpacity: "15%",
48
- slug: r + "-" + t.name.toLocaleLowerCase()
49
- }
50
- ) : t.name }),
51
- t.required && /* @__PURE__ */ g.jsx("span", { className: "py-px px-1.5 font-medium bg-primary/75 text-muted rounded-lg", children: "required" }),
52
- Dt(t).type && /* @__PURE__ */ g.jsx("span", { className: "text-muted-foreground", children: Dt(t).type })
53
- ] }),
54
- t.description && /* @__PURE__ */ g.jsx(
55
- Te,
56
- {
57
- content: t.description,
58
- className: "text-sm prose-p:my-1"
59
- }
60
- )
61
- ] }), Ln = ({
62
- group: t,
63
- parameters: e,
64
- id: r
65
- }) => /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
66
- /* @__PURE__ */ g.jsx(Ae, { level: 3, id: `${r}/${t}-parameters`, className: "capitalize", children: t === "header" ? "Headers" : `${t} Parameters` }),
67
- /* @__PURE__ */ g.jsx("ul", { className: "list-none m-0 px-0 overflow-hidden border divide-y divide-border rounded", children: e.map((o) => /* @__PURE__ */ g.jsx(
68
- In,
69
- {
70
- parameter: o,
71
- id: r,
72
- group: t
73
- },
74
- `${o.name}-${o.in}`
75
- )) })
76
- ] }), Un = (t) => Object.entries(t), _n = ({
77
- propertyName: t,
78
- property: e,
79
- nestingLevel: r,
80
- isRequired: o
81
- }) => {
82
- var c;
83
- return e ? /* @__PURE__ */ g.jsxs(
84
- "div",
85
- {
86
- className: le(
87
- "p-4 bg-border/20 hover:bg-border/30 flex gap-1 flex-col text-sm",
88
- e.deprecated && "opacity-50"
89
- ),
90
- children: [
91
- /* @__PURE__ */ g.jsxs("div", { className: "flex items-center gap-2 relative", children: [
92
- /* @__PURE__ */ g.jsxs("code", { children: [
93
- t,
94
- " ",
95
- e.title
96
- ] }),
97
- e.type && /* @__PURE__ */ g.jsx("span", { className: "text-muted-foreground", children: e.type }),
98
- e.deprecated && /* @__PURE__ */ g.jsx("span", { className: "text-muted-foreground", children: "Deprecated" }),
99
- !o && /* @__PURE__ */ g.jsxs("span", { className: "py-px px-1.5 font-medium border rounded-lg", children: [
100
- "optional ",
101
- e.required
102
- ] })
103
- ] }),
104
- e.description && /* @__PURE__ */ g.jsx(
105
- Te,
106
- {
107
- content: e.description,
108
- className: "text-sm leading-normal line-clamp-4 "
109
- }
110
- ),
111
- e.enum && /* @__PURE__ */ g.jsxs("span", { className: "text-sm text-muted-foreground flex gap-1 flex-wrap items-center", children: [
112
- /* @__PURE__ */ g.jsx("span", { children: "Possible values" }),
113
- [...new Set(e.enum.filter((a) => a))].map((a) => /* @__PURE__ */ g.jsx(
114
- "span",
115
- {
116
- className: "font-mono text-xs border bg-muted rounded px-1",
117
- children: a
118
- },
119
- a
120
- )).slice(0, 4),
121
- e.enum.length > 4 && /* @__PURE__ */ g.jsx("span", { className: "font-mono text-xs border bg-muted rounded px-1", children: "..." })
122
- ] }),
123
- e.type === "object" && (((c = e.properties) == null ? void 0 : c.length) ?? Object.entries(e.additionalProperties ?? {}).length > 0) || e.type === "array" && e.items.type === "object" ? /* @__PURE__ */ g.jsxs(Lr, { className: "CollapsibleRoot", defaultOpen: !1, children: [
124
- /* @__PURE__ */ g.jsx(Ur, { asChild: !0, children: /* @__PURE__ */ g.jsxs(En, { variant: "ghost", size: "sm", children: [
125
- "Show nested fields",
126
- /* @__PURE__ */ g.jsx(An, { size: 18, className: "ml-1.5" })
127
- ] }) }),
128
- /* @__PURE__ */ g.jsxs(_r, { children: [
129
- e.type === "object" && /* @__PURE__ */ g.jsx("div", { className: "mt-2.5", children: /* @__PURE__ */ g.jsx(
130
- Xe,
131
- {
132
- schema: e,
133
- level: r + 1,
134
- defaultOpen: !0
135
- }
136
- ) }),
137
- e.type === "array" && e.items.type === "object" && /* @__PURE__ */ g.jsx("div", { className: "mt-2.5", children: /* @__PURE__ */ g.jsx(
138
- Xe,
139
- {
140
- schema: e.items,
141
- defaultOpen: !0,
142
- level: r + 1
143
- }
144
- ) })
145
- ] })
146
- ] }) : null
147
- ]
148
- },
149
- t
150
- ) : /* @__PURE__ */ g.jsx("div", { children: "no property" });
151
- }, Fn = ({
152
- group: t,
153
- properties: e,
154
- nestingLevel: r,
155
- required: o,
156
- defaultOpen: c = !1
157
- }) => {
158
- const a = c || t === "required" || e.length === 1 || r === 0, [n, i] = Br(a);
159
- if (e.length !== 0)
160
- return /* @__PURE__ */ g.jsxs(
161
- Lr,
162
- {
163
- className: "CollapsibleRoot",
164
- open: n,
165
- onOpenChange: i,
166
- children: [
167
- !n && /* @__PURE__ */ g.jsxs(
168
- Ur,
169
- {
170
- className: le(
171
- "py-2 hover:bg-muted w-full",
172
- t === "optional" && "font-semibold",
173
- t === "deprecated" && "text-muted-foreground"
174
- ),
175
- children: [
176
- e.length,
177
- " ",
178
- t,
179
- " fields"
180
- ]
181
- }
182
- ),
183
- /* @__PURE__ */ g.jsx(_r, { className: "divide-y divide-border", children: e.map(([s, l]) => /* @__PURE__ */ g.jsx(
184
- _n,
185
- {
186
- property: l,
187
- propertyName: s,
188
- nestingLevel: r,
189
- isRequired: o.includes(s)
190
- },
191
- s
192
- )) })
193
- ]
194
- }
195
- );
196
- }, Ye = le(
197
- jn,
198
- "max-w-full prose-img:max-w-prose"
199
- ), Xe = ({
200
- name: t,
201
- schema: e,
202
- level: r = 0,
203
- defaultOpen: o = !1
204
- }) => {
205
- const c = Object.entries(e.properties ?? {}), a = typeof e.additionalProperties == "object" ? Object.entries(e.additionalProperties) : [], n = c.concat(
206
- Array.isArray(a) ? a : []
207
- ), i = Mr(n, ([s, l]) => {
208
- var u;
209
- return l.deprecated ? "deprecated" : (u = e.required) != null && u.includes(s) ? "required" : "optional";
210
- });
211
- return /* @__PURE__ */ g.jsxs("div", { className: "flex flex-col gap-2.5", children: [
212
- (e.title ?? t) && /* @__PURE__ */ g.jsx("div", { className: "ml-2 my-1 font-bold", children: e.title ?? t }),
213
- r === 0 && e.description && /* @__PURE__ */ g.jsx(Te, { className: Ye, content: e.description }),
214
- /* @__PURE__ */ g.jsx("ul", { className: "border-border border rounded overflow-hidden", children: Un(i).map(([s, l]) => /* @__PURE__ */ g.jsx(
215
- Fn,
216
- {
217
- defaultOpen: o,
218
- group: s,
219
- nestingLevel: r,
220
- properties: l ?? [],
221
- required: e.required ?? []
222
- },
223
- s
224
- )) })
225
- ] });
226
- };
227
- var Yt = (t, e) => {
228
- const r = t[e.name];
229
- return r === void 0 ? (t[e.name] = e.value, t) : Array.isArray(r) ? (r.push(e.value), t) : (t[e.name] = [r, e.value], t);
230
- }, Xt = "", Zt = `
231
- `, P = class {
232
- /**
233
- * Helper object to format and aggragate lines of code.
234
- * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
235
- */
236
- constructor({ indent: t, join: e } = {}) {
237
- this.postProcessors = [], this.code = [], this.indentationCharacter = Xt, this.lineJoin = Zt, this.indentLine = (r, o = 0) => `${this.indentationCharacter.repeat(o)}${r}`, this.unshift = (r, o) => {
238
- const c = this.indentLine(r, o);
239
- this.code.unshift(c);
240
- }, this.push = (r, o) => {
241
- const c = this.indentLine(r, o);
242
- this.code.push(c);
243
- }, this.blank = () => {
244
- this.code.push("");
245
- }, this.join = () => {
246
- const r = this.code.join(this.lineJoin);
247
- return this.postProcessors.reduce((c, a) => a(c), r);
248
- }, this.addPostProcessor = (r) => {
249
- this.postProcessors = [...this.postProcessors, r];
250
- }, this.indentationCharacter = t || Xt, this.lineJoin = e ?? Zt;
251
- }
252
- }, Hn = function(t) {
253
- return Object.prototype.toString.call(t) === "[object RegExp]";
254
- }, Bn = function(t) {
255
- var e = typeof t;
256
- return t !== null && (e === "object" || e === "function");
257
- }, It = {};
258
- Object.defineProperty(It, "__esModule", { value: !0 });
259
- It.default = (t) => Object.getOwnPropertySymbols(t).filter((e) => Object.prototype.propertyIsEnumerable.call(t, e));
260
- const Mn = Hn, Wn = Bn, Jn = It.default;
261
- var zn = (t, e, r) => {
262
- const o = [];
263
- return function c(a, n, i) {
264
- n = n || {}, n.indent = n.indent || " ", i = i || "";
265
- let s;
266
- n.inlineCharacterLimit === void 0 ? s = {
267
- newLine: `
268
- `,
269
- newLineOrSpace: `
270
- `,
271
- pad: i,
272
- indent: i + n.indent
273
- } : s = {
274
- newLine: "@@__STRINGIFY_OBJECT_NEW_LINE__@@",
275
- newLineOrSpace: "@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@",
276
- pad: "@@__STRINGIFY_OBJECT_PAD__@@",
277
- indent: "@@__STRINGIFY_OBJECT_INDENT__@@"
278
- };
279
- const l = (u) => {
280
- if (n.inlineCharacterLimit === void 0)
281
- return u;
282
- const p = u.replace(new RegExp(s.newLine, "g"), "").replace(new RegExp(s.newLineOrSpace, "g"), " ").replace(new RegExp(s.pad + "|" + s.indent, "g"), "");
283
- return p.length <= n.inlineCharacterLimit ? p : u.replace(new RegExp(s.newLine + "|" + s.newLineOrSpace, "g"), `
284
- `).replace(new RegExp(s.pad, "g"), i).replace(new RegExp(s.indent, "g"), i + n.indent);
285
- };
286
- if (o.indexOf(a) !== -1)
287
- return '"[Circular]"';
288
- if (a == null || typeof a == "number" || typeof a == "boolean" || typeof a == "function" || typeof a == "symbol" || Mn(a))
289
- return String(a);
290
- if (a instanceof Date)
291
- return `new Date('${a.toISOString()}')`;
292
- if (Array.isArray(a)) {
293
- if (a.length === 0)
294
- return "[]";
295
- o.push(a);
296
- const u = "[" + s.newLine + a.map((p, f) => {
297
- const d = a.length - 1 === f ? s.newLine : "," + s.newLineOrSpace;
298
- let h = c(p, n, i + n.indent);
299
- return n.transform && (h = n.transform(a, f, h)), s.indent + h + d;
300
- }).join("") + s.pad + "]";
301
- return o.pop(), l(u);
302
- }
303
- if (Wn(a)) {
304
- let u = Object.keys(a).concat(Jn(a));
305
- if (n.filter && (u = u.filter((f) => n.filter(a, f))), u.length === 0)
306
- return "{}";
307
- o.push(a);
308
- const p = "{" + s.newLine + u.map((f, d) => {
309
- const h = u.length - 1 === d ? s.newLine : "," + s.newLineOrSpace, m = typeof f == "symbol", b = !m && /^[a-z$_][a-z$_0-9]*$/i.test(f), v = m || b ? f : c(f, n);
310
- let y = c(a[f], n, i + n.indent);
311
- return n.transform && (y = n.transform(a, f, y)), s.indent + String(v) + ": " + y + h;
312
- }).join("") + s.pad + "}";
313
- return o.pop(), l(p);
314
- }
315
- return a = String(a).replace(/[\r\n]/g, (u) => u === `
316
- ` ? "\\n" : "\\r"), n.singleQuotes === !1 ? (a = a.replace(/"/g, '\\"'), `"${a}"`) : (a = a.replace(/\\?'/g, "\\'"), `'${a}'`);
317
- }(t, e, r);
318
- };
319
- const W = /* @__PURE__ */ Cn(zn);
320
- function Ue(t, e = {}) {
321
- const { delimiter: r = '"', escapeChar: o = "\\", escapeNewlines: c = !0 } = e;
322
- return [...t.toString()].map((n) => n === "\b" ? `${o}b` : n === " " ? `${o}t` : n === `
323
- ` ? c ? `${o}n` : n : n === "\f" ? `${o}f` : n === "\r" ? c ? `${o}r` : n : n === o ? o + o : n === r ? o + r : n < " " || n > "~" ? JSON.stringify(n).slice(1, -1) : n).join("");
324
- }
325
- var _e = (t) => Ue(t, { delimiter: "'" }), H = (t) => Ue(t, { delimiter: '"' }), Gn = {
326
- info: {
327
- key: "libcurl",
328
- title: "Libcurl",
329
- link: "http://curl.haxx.se/libcurl",
330
- description: "Simple REST and HTTP API Client for C",
331
- extname: ".c"
332
- },
333
- convert: ({ method: t, fullUrl: e, headersObj: r, allHeaders: o, postData: c }) => {
334
- const { push: a, blank: n, join: i } = new P();
335
- a("CURL *hnd = curl_easy_init();"), n(), a(`curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "${t.toUpperCase()}");`), a("curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);"), a(`curl_easy_setopt(hnd, CURLOPT_URL, "${e}");`);
336
- const s = Object.keys(r);
337
- return s.length && (n(), a("struct curl_slist *headers = NULL;"), s.forEach((l) => {
338
- a(`headers = curl_slist_append(headers, "${l}: ${H(r[l])}");`);
339
- }), a("curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);")), o.cookie && (n(), a(`curl_easy_setopt(hnd, CURLOPT_COOKIE, "${o.cookie}");`)), c.text && (n(), a(`curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ${JSON.stringify(c.text)});`)), n(), a("CURLcode ret = curl_easy_perform(hnd);"), i();
340
- }
341
- }, Vn = {
342
- info: {
343
- key: "c",
344
- title: "C",
345
- default: "libcurl",
346
- cli: "c"
347
- },
348
- clientsById: {
349
- libcurl: Gn
350
- }
351
- }, z = (t, e) => Object.keys(t).find((r) => r.toLowerCase() === e.toLowerCase()), ce = (t, e) => {
352
- const r = z(t, e);
353
- if (r)
354
- return t[r];
355
- }, it = (t, e) => !!z(t, e), Kn = (t) => ["application/json", "application/x-json", "text/json", "text/x-json", "+json"].some(
356
- (e) => t.indexOf(e) > -1
357
- ), er = class {
358
- constructor(t) {
359
- this.name = "", this.toString = () => `:${this.name}`, this.name = t;
360
- }
361
- }, Qn = class {
362
- constructor(t) {
363
- this.path = "", this.toString = () => `(clojure.java.io/file "${this.path}")`, this.path = t;
364
- }
365
- }, Wr = (t) => t === void 0 ? null : t === null ? "null" : t.constructor.name.toLowerCase(), Jr = (t) => t === void 0 ? !0 : Wr(t) === "object" ? Object.keys(t).length === 0 : !1, tr = (t) => (Object.keys(t).filter((e) => Jr(t[e])).forEach((e) => {
366
- delete t[e];
367
- }), t), Ve = (t, e) => {
368
- const r = " ".repeat(t);
369
- return e.replace(/\n/g, `
370
- ${r}`);
371
- }, wt = (t) => {
372
- switch (Wr(t)) {
373
- case "string":
374
- return `"${t.replace(/"/g, '\\"')}"`;
375
- case "file":
376
- return t.toString();
377
- case "keyword":
378
- return t.toString();
379
- case "null":
380
- return "nil";
381
- case "regexp":
382
- return `#"${t.source}"`;
383
- case "object": {
384
- const e = Object.keys(t).reduce((r, o) => {
385
- const c = Ve(o.length + 2, wt(t[o]));
386
- return `${r}:${o} ${c}
387
- `;
388
- }, "").trim();
389
- return `{${Ve(1, e)}}`;
390
- }
391
- case "array": {
392
- const e = t.reduce((r, o) => `${r} ${wt(o)}`, "").trim();
393
- return `[${Ve(1, e)}]`;
394
- }
395
- default:
396
- return t.toString();
397
- }
398
- }, Dn = {
399
- info: {
400
- key: "clj_http",
401
- title: "clj-http",
402
- link: "https://github.com/dakrone/clj-http",
403
- description: "An idiomatic clojure http client wrapping the apache client.",
404
- extname: ".clj"
405
- },
406
- convert: ({ queryObj: t, method: e, postData: r, url: o, allHeaders: c }, a) => {
407
- const { push: n, join: i } = new P({ indent: a == null ? void 0 : a.indent }), s = ["get", "post", "put", "delete", "patch", "head", "options"];
408
- if (e = e.toLowerCase(), !s.includes(e))
409
- return n("Method not supported"), i();
410
- const l = {
411
- headers: c,
412
- "query-params": t
413
- };
414
- switch (r.mimeType) {
415
- case "application/json":
416
- {
417
- l["content-type"] = new er("json"), l["form-params"] = r.jsonObj;
418
- const u = z(l.headers, "content-type");
419
- u && delete l.headers[u];
420
- }
421
- break;
422
- case "application/x-www-form-urlencoded":
423
- {
424
- l["form-params"] = r.paramsObj;
425
- const u = z(l.headers, "content-type");
426
- u && delete l.headers[u];
427
- }
428
- break;
429
- case "text/plain":
430
- {
431
- l.body = r.text;
432
- const u = z(l.headers, "content-type");
433
- u && delete l.headers[u];
434
- }
435
- break;
436
- case "multipart/form-data": {
437
- if (r.params) {
438
- l.multipart = r.params.map((p) => p.fileName && !p.value ? {
439
- name: p.name,
440
- content: new Qn(p.fileName)
441
- } : {
442
- name: p.name,
443
- content: p.value
444
- });
445
- const u = z(l.headers, "content-type");
446
- u && delete l.headers[u];
447
- }
448
- break;
449
- }
450
- }
451
- switch (ce(l.headers, "accept")) {
452
- case "application/json":
453
- {
454
- l.accept = new er("json");
455
- const u = z(l.headers, "accept");
456
- u && delete l.headers[u];
457
- }
458
- break;
459
- }
460
- if (n(`(require '[clj-http.client :as client])
461
- `), Jr(tr(l)))
462
- n(`(client/${e} "${o}")`);
463
- else {
464
- const u = 11 + e.length + o.length, p = Ve(u, wt(tr(l)));
465
- n(`(client/${e} "${o}" ${p})`);
466
- }
467
- return i();
468
- }
469
- }, Yn = {
470
- info: {
471
- key: "clojure",
472
- title: "Clojure",
473
- default: "clj_http"
474
- },
475
- clientsById: {
476
- clj_http: Dn
477
- }
478
- }, Xn = (t) => {
479
- let e = ce(t, "accept-encoding");
480
- if (!e)
481
- return [];
482
- const r = {
483
- gzip: "DecompressionMethods.GZip",
484
- deflate: "DecompressionMethods.Deflate"
485
- }, o = [];
486
- return typeof e == "string" && (e = [e]), e.forEach((c) => {
487
- c.split(",").forEach((a) => {
488
- const n = /\s*([^;\s]+)/.exec(a);
489
- if (n) {
490
- const i = r[n[1]];
491
- i && o.push(i);
492
- }
493
- });
494
- }), o;
495
- }, Zn = {
496
- info: {
497
- key: "httpclient",
498
- title: "HttpClient",
499
- link: "https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",
500
- description: ".NET Standard HTTP Client",
501
- extname: ".cs"
502
- },
503
- convert: ({ allHeaders: t, postData: e, method: r, fullUrl: o }, c) => {
504
- var d, h;
505
- const a = {
506
- indent: " ",
507
- ...c
508
- }, { push: n, join: i } = new P({ indent: a.indent });
509
- n("using System.Net.Http.Headers;");
510
- let s = "";
511
- const l = !!t.cookie, u = Xn(t);
512
- (l || u.length) && (s = "clientHandler", n("var clientHandler = new HttpClientHandler"), n("{"), l && n("UseCookies = false,", 1), u.length && n(`AutomaticDecompression = ${u.join(" | ")},`, 1), n("};")), n(`var client = new HttpClient(${s});`), n("var request = new HttpRequestMessage"), n("{");
513
- const p = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE"];
514
- r = r.toUpperCase(), r && p.includes(r) ? r = `HttpMethod.${r[0]}${r.substring(1).toLowerCase()}` : r = `new HttpMethod("${r}")`, n(`Method = ${r},`, 1), n(`RequestUri = new Uri("${o}"),`, 1);
515
- const f = Object.keys(t).filter((m) => {
516
- switch (m.toLowerCase()) {
517
- case "content-type":
518
- case "content-length":
519
- case "accept-encoding":
520
- return !1;
521
- default:
522
- return !0;
523
- }
524
- });
525
- if (f.length && (n("Headers =", 1), n("{", 1), f.forEach((m) => {
526
- n(`{ "${m}", "${H(t[m])}" },`, 2);
527
- }), n("},", 1)), e.text) {
528
- const m = e.mimeType;
529
- switch (m) {
530
- case "application/x-www-form-urlencoded":
531
- n("Content = new FormUrlEncodedContent(new Dictionary<string, string>", 1), n("{", 1), (d = e.params) == null || d.forEach((b) => {
532
- n(`{ "${b.name}", "${b.value}" },`, 2);
533
- }), n("}),", 1);
534
- break;
535
- case "multipart/form-data":
536
- n("Content = new MultipartFormDataContent", 1), n("{", 1), (h = e.params) == null || h.forEach((b) => {
537
- n(`new StringContent(${JSON.stringify(b.value || "")})`, 2), n("{", 2), n("Headers =", 3), n("{", 3), b.contentType && n(`ContentType = new MediaTypeHeaderValue("${b.contentType}"),`, 4), n('ContentDisposition = new ContentDispositionHeaderValue("form-data")', 4), n("{", 4), n(`Name = "${b.name}",`, 5), b.fileName && n(`FileName = "${b.fileName}",`, 5), n("}", 4), n("}", 3), n("},", 2);
538
- }), n("},", 1);
539
- break;
540
- default:
541
- n(`Content = new StringContent(${JSON.stringify(e.text || "")})`, 1), n("{", 1), n("Headers =", 2), n("{", 2), n(`ContentType = new MediaTypeHeaderValue("${m}")`, 3), n("}", 2), n("}", 1);
542
- break;
543
- }
544
- }
545
- return n("};"), n("using (var response = await client.SendAsync(request))"), n("{"), n("response.EnsureSuccessStatusCode();", 1), n("var body = await response.Content.ReadAsStringAsync();", 1), n("Console.WriteLine(body);", 1), n("}"), i();
546
- }
547
- };
548
- function eo(t) {
549
- return t[0].toUpperCase() + t.slice(1).toLowerCase();
550
- }
551
- var to = {
552
- info: {
553
- key: "restsharp",
554
- title: "RestSharp",
555
- link: "http://restsharp.org/",
556
- description: "Simple REST and HTTP API Client for .NET",
557
- extname: ".cs",
558
- installation: "dotnet add package RestSharp"
559
- },
560
- convert: ({ method: t, fullUrl: e, headersObj: r, cookies: o, postData: c, uriObj: a }) => {
561
- const { push: n, join: i } = new P();
562
- if (!["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(
563
- t.toUpperCase()
564
- ))
565
- return "Method not supported";
566
- n(`using RestSharp;
567
-
568
- `), n(`var options = new RestClientOptions("${e}");`), n("var client = new RestClient(options);"), n('var request = new RestRequest("");');
569
- const l = c.mimeType && c.mimeType === "multipart/form-data";
570
- switch (l && n("request.AlwaysMultipartFormData = true;"), Object.keys(r).forEach((u) => {
571
- if (c.mimeType && u.toLowerCase() === "content-type" && c.text) {
572
- l && c.boundary && n(`request.FormBoundary = "${c.boundary}";`);
573
- return;
574
- }
575
- n(`request.AddHeader("${u}", "${H(r[u])}");`);
576
- }), o.forEach(({ name: u, value: p }) => {
577
- n(`request.AddCookie("${u}", "${H(p)}", "${a.pathname}", "${a.host}");`);
578
- }), c.mimeType) {
579
- case "multipart/form-data":
580
- if (!c.params) break;
581
- c.params.forEach((u) => {
582
- u.fileName ? n(`request.AddFile("${u.name}", "${u.fileName}");`) : n(`request.AddParameter("${u.name}", "${u.value}");`);
583
- });
584
- break;
585
- case "application/x-www-form-urlencoded":
586
- if (!c.params) break;
587
- c.params.forEach((u) => {
588
- n(`request.AddParameter("${u.name}", "${u.value}");`);
589
- });
590
- break;
591
- case "application/json": {
592
- if (!c.text) break;
593
- const u = JSON.stringify(c.text);
594
- n(`request.AddJsonBody(${u}, false);`);
595
- break;
596
- }
597
- default:
598
- if (!c.text) break;
599
- n(`request.AddStringBody("${c.text}", "${c.mimeType}");`);
600
- }
601
- return n(`var response = await client.${eo(t)}Async(request);
602
- `), n(`Console.WriteLine("{0}", response.Content);
603
- `), i();
604
- }
605
- }, ro = {
606
- info: {
607
- key: "csharp",
608
- title: "C#",
609
- default: "restsharp",
610
- cli: "dotnet"
611
- },
612
- clientsById: {
613
- httpclient: Zn,
614
- restsharp: to
615
- }
616
- }, no = {
617
- info: {
618
- key: "native",
619
- title: "NewRequest",
620
- link: "http://golang.org/pkg/net/http/#NewRequest",
621
- description: "Golang HTTP client request",
622
- extname: ".go"
623
- },
624
- convert: ({ postData: t, method: e, allHeaders: r, fullUrl: o }, c = {}) => {
625
- const { blank: a, push: n, join: i } = new P({ indent: " " }), { showBoilerplate: s = !0, checkErrors: l = !1, printBody: u = !0, timeout: p = -1 } = c, f = l ? "err" : "_", d = s ? 1 : 0, h = () => {
626
- l && (n("if err != nil {", d), n("panic(err)", d + 1), n("}", d));
627
- };
628
- s && (n("package main"), a(), n("import ("), n('"fmt"', d), p > 0 && n('"time"', d), t.text && n('"strings"', d), n('"net/http"', d), u && n('"io"', d), n(")"), a(), n("func main() {"), a());
629
- const m = p > 0, b = m, v = b ? "client" : "http.DefaultClient";
630
- return b && (n("client := http.Client{", d), m && n(`Timeout: time.Duration(${p} * time.Second),`, d + 1), n("}", d), a()), n(`url := "${o}"`, d), a(), t.text ? (n(`payload := strings.NewReader(${JSON.stringify(t.text)})`, d), a(), n(`req, ${f} := http.NewRequest("${e}", url, payload)`, d), a()) : (n(`req, ${f} := http.NewRequest("${e}", url, nil)`, d), a()), h(), Object.keys(r).length && (Object.keys(r).forEach((y) => {
631
- n(`req.Header.Add("${y}", "${H(r[y])}")`, d);
632
- }), a()), n(`res, ${f} := ${v}.Do(req)`, d), h(), u && (a(), n("defer res.Body.Close()", d), n(`body, ${f} := io.ReadAll(res.Body)`, d), h()), a(), u && n("fmt.Println(string(body))", d), s && (a(), n("}")), i();
633
- }
634
- }, oo = {
635
- info: {
636
- key: "go",
637
- title: "Go",
638
- default: "native",
639
- cli: "go"
640
- },
641
- clientsById: {
642
- native: no
643
- }
644
- }, rr = `\r
645
- `, ao = {
646
- info: {
647
- key: "http1.1",
648
- title: "HTTP/1.1",
649
- link: "https://tools.ietf.org/html/rfc7230",
650
- description: "HTTP/1.1 request string in accordance with RFC 7230",
651
- extname: null
652
- },
653
- convert: ({ method: t, fullUrl: e, uriObj: r, httpVersion: o, allHeaders: c, postData: a }, n) => {
654
- const i = {
655
- absoluteURI: !1,
656
- autoContentLength: !0,
657
- autoHost: !0,
658
- ...n
659
- }, { blank: s, push: l, join: u } = new P({ indent: "", join: rr }), p = i.absoluteURI ? e : r.path;
660
- l(`${t} ${p} ${o}`);
661
- const f = Object.keys(c);
662
- if (f.forEach((m) => {
663
- const b = m.toLowerCase().replace(/(^|-)(\w)/g, (v) => v.toUpperCase());
664
- l(`${b}: ${c[m]}`);
665
- }), i.autoHost && !f.includes("host") && l(`Host: ${r.host}`), i.autoContentLength && a.text && !f.includes("content-length")) {
666
- const b = new TextEncoder().encode(a.text).length.toString();
667
- l(`Content-Length: ${b}`);
668
- }
669
- s();
670
- const d = u(), h = a.text || "";
671
- return `${d}${rr}${h}`;
672
- }
673
- }, io = {
674
- info: {
675
- key: "http",
676
- title: "HTTP",
677
- default: "http1.1"
678
- },
679
- clientsById: {
680
- "http1.1": ao
681
- }
682
- }, so = {
683
- info: {
684
- key: "asynchttp",
685
- title: "AsyncHttp",
686
- link: "https://github.com/AsyncHttpClient/async-http-client",
687
- description: "Asynchronous Http and WebSocket Client library for Java",
688
- extname: ".java"
689
- },
690
- convert: ({ method: t, allHeaders: e, postData: r, fullUrl: o }, c) => {
691
- const a = {
692
- indent: " ",
693
- ...c
694
- }, { blank: n, push: i, join: s } = new P({ indent: a.indent });
695
- return i("AsyncHttpClient client = new DefaultAsyncHttpClient();"), i(`client.prepare("${t.toUpperCase()}", "${o}")`), Object.keys(e).forEach((l) => {
696
- i(`.setHeader("${l}", "${H(e[l])}")`, 1);
697
- }), r.text && i(`.setBody(${JSON.stringify(r.text)})`, 1), i(".execute()", 1), i(".toCompletableFuture()", 1), i(".thenAccept(System.out::println)", 1), i(".join();", 1), n(), i("client.close();"), s();
698
- }
699
- }, co = {
700
- info: {
701
- key: "nethttp",
702
- title: "java.net.http",
703
- link: "https://openjdk.java.net/groups/net/httpclient/intro.html",
704
- description: "Java Standardized HTTP Client API",
705
- extname: ".java"
706
- },
707
- convert: ({ allHeaders: t, fullUrl: e, method: r, postData: o }, c) => {
708
- const a = {
709
- indent: " ",
710
- ...c
711
- }, { push: n, join: i } = new P({ indent: a.indent });
712
- return n("HttpRequest request = HttpRequest.newBuilder()"), n(`.uri(URI.create("${e}"))`, 2), Object.keys(t).forEach((s) => {
713
- n(`.header("${s}", "${H(t[s])}")`, 2);
714
- }), o.text ? n(
715
- `.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.ofString(${JSON.stringify(o.text)}))`,
716
- 2
717
- ) : n(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`, 2), n(".build();", 2), n(
718
- "HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());"
719
- ), n("System.out.println(response.body());"), i();
720
- }
721
- }, lo = {
722
- info: {
723
- key: "okhttp",
724
- title: "OkHttp",
725
- link: "http://square.github.io/okhttp/",
726
- description: "An HTTP Request Client Library",
727
- extname: ".java"
728
- },
729
- convert: ({ postData: t, method: e, fullUrl: r, allHeaders: o }, c) => {
730
- const a = {
731
- indent: " ",
732
- ...c
733
- }, { push: n, blank: i, join: s } = new P({ indent: a.indent }), l = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"], u = ["POST", "PUT", "DELETE", "PATCH"];
734
- return n("OkHttpClient client = new OkHttpClient();"), i(), t.text && (t.boundary ? n(`MediaType mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}");`) : n(`MediaType mediaType = MediaType.parse("${t.mimeType}");`), n(`RequestBody body = RequestBody.create(mediaType, ${JSON.stringify(t.text)});`)), n("Request request = new Request.Builder()"), n(`.url("${r}")`, 1), l.includes(e.toUpperCase()) ? u.includes(e.toUpperCase()) ? t.text ? n(`.${e.toLowerCase()}(body)`, 1) : n(`.${e.toLowerCase()}(null)`, 1) : n(`.${e.toLowerCase()}()`, 1) : t.text ? n(`.method("${e.toUpperCase()}", body)`, 1) : n(`.method("${e.toUpperCase()}", null)`, 1), Object.keys(o).forEach((p) => {
735
- n(`.addHeader("${p}", "${H(o[p])}")`, 1);
736
- }), n(".build();", 1), i(), n("Response response = client.newCall(request).execute();"), s();
737
- }
738
- }, uo = {
739
- info: {
740
- key: "unirest",
741
- title: "Unirest",
742
- link: "http://unirest.io/java.html",
743
- description: "Lightweight HTTP Request Client Library",
744
- extname: ".java"
745
- },
746
- convert: ({ method: t, allHeaders: e, postData: r, fullUrl: o }, c) => {
747
- const a = {
748
- indent: " ",
749
- ...c
750
- }, { join: n, push: i } = new P({ indent: a.indent });
751
- return ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(t.toUpperCase()) ? i(`HttpResponse<String> response = Unirest.${t.toLowerCase()}("${o}")`) : i(`HttpResponse<String> response = Unirest.customMethod("${t.toUpperCase()}","${o}")`), Object.keys(e).forEach((l) => {
752
- i(`.header("${l}", "${H(e[l])}")`, 1);
753
- }), r.text && i(`.body(${JSON.stringify(r.text)})`, 1), i(".asString();", 1), n();
754
- }
755
- }, fo = {
756
- info: {
757
- key: "java",
758
- title: "Java",
759
- default: "unirest"
760
- },
761
- clientsById: {
762
- asynchttp: so,
763
- nethttp: co,
764
- okhttp: lo,
765
- unirest: uo
766
- }
767
- }, po = {
768
- info: {
769
- key: "axios",
770
- title: "Axios",
771
- link: "https://github.com/axios/axios",
772
- description: "Promise based HTTP client for the browser and node.js",
773
- extname: ".js",
774
- installation: "npm install axios --save"
775
- },
776
- convert: ({ allHeaders: t, method: e, url: r, queryObj: o, postData: c }, a) => {
777
- const n = {
778
- indent: " ",
779
- ...a
780
- }, { blank: i, push: s, join: l, addPostProcessor: u } = new P({ indent: n.indent });
781
- s("import axios from 'axios';"), i();
782
- const p = {
783
- method: e,
784
- url: r
785
- };
786
- switch (Object.keys(o).length && (p.params = o), Object.keys(t).length && (p.headers = t), c.mimeType) {
787
- case "application/x-www-form-urlencoded":
788
- c.params && (s("const encodedParams = new URLSearchParams();"), c.params.forEach((d) => {
789
- s(`encodedParams.set('${d.name}', '${d.value}');`);
790
- }), i(), p.data = "encodedParams,", u((d) => d.replace(/'encodedParams,'/, "encodedParams,")));
791
- break;
792
- case "application/json":
793
- c.jsonObj && (p.data = c.jsonObj);
794
- break;
795
- case "multipart/form-data":
796
- if (!c.params)
797
- break;
798
- s("const form = new FormData();"), c.params.forEach((d) => {
799
- s(`form.append('${d.name}', '${d.value || d.fileName || ""}');`);
800
- }), i(), p.data = "[form]";
801
- break;
802
- default:
803
- c.text && (p.data = c.text);
804
- }
805
- const f = W(p, {
806
- indent: " ",
807
- inlineCharacterLimit: 80
808
- }).replace('"[form]"', "form");
809
- return s(`const options = ${f};`), i(), s("axios"), s(".request(options)", 1), s(".then(function (response) {", 1), s("console.log(response.data);", 2), s("})", 1), s(".catch(function (error) {", 1), s("console.error(error);", 2), s("});", 1), l();
810
- }
811
- }, ho = {
812
- info: {
813
- key: "fetch",
814
- title: "fetch",
815
- link: "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch",
816
- description: "Perform asynchronous HTTP requests with the Fetch API",
817
- extname: ".js"
818
- },
819
- convert: ({ method: t, allHeaders: e, postData: r, fullUrl: o }, c) => {
820
- const a = {
821
- indent: " ",
822
- credentials: null,
823
- ...c
824
- }, { blank: n, join: i, push: s } = new P({ indent: a.indent }), l = {
825
- method: t
826
- };
827
- switch (Object.keys(e).length && (l.headers = e), a.credentials !== null && (l.credentials = a.credentials), r.mimeType) {
828
- case "application/x-www-form-urlencoded":
829
- l.body = r.paramsObj ? r.paramsObj : r.text;
830
- break;
831
- case "application/json":
832
- r.jsonObj && (l.body = r.jsonObj);
833
- break;
834
- case "multipart/form-data":
835
- if (!r.params)
836
- break;
837
- const u = z(e, "content-type");
838
- u && delete e[u], s("const form = new FormData();"), r.params.forEach((p) => {
839
- s(`form.append('${p.name}', '${p.value || p.fileName || ""}');`);
840
- }), n();
841
- break;
842
- default:
843
- r.text && (l.body = r.text);
844
- }
845
- return l.headers && !Object.keys(l.headers).length && delete l.headers, s(
846
- `const options = ${W(l, {
847
- indent: a.indent,
848
- inlineCharacterLimit: 80,
849
- // The Fetch API body only accepts string parameters, but stringified JSON can be difficult
850
- // to read, so we keep the object as a literal and use this transform function to wrap the
851
- // literal in a `JSON.stringify` call.
852
- transform: (u, p, f) => {
853
- if (p === "body") {
854
- if (r.mimeType === "application/x-www-form-urlencoded")
855
- return `new URLSearchParams(${f})`;
856
- if (r.mimeType === "application/json")
857
- return `JSON.stringify(${f})`;
858
- }
859
- return f;
860
- }
861
- })};`
862
- ), n(), r.params && r.mimeType === "multipart/form-data" && (s("options.body = form;"), n()), s(`fetch('${o}', options)`), s(".then(response => response.json())", 1), s(".then(response => console.log(response))", 1), s(".catch(err => console.error(err));", 1), i();
863
- }
864
- }, yo = {
865
- info: {
866
- key: "jquery",
867
- title: "jQuery",
868
- link: "http://api.jquery.com/jquery.ajax/",
869
- description: "Perform an asynchronous HTTP (Ajax) requests with jQuery",
870
- extname: ".js"
871
- },
872
- convert: ({ fullUrl: t, method: e, allHeaders: r, postData: o }, c) => {
873
- var p;
874
- const a = {
875
- indent: " ",
876
- ...c
877
- }, { blank: n, push: i, join: s } = new P({ indent: a.indent }), l = {
878
- async: !0,
879
- crossDomain: !0,
880
- url: t,
881
- method: e,
882
- headers: r
883
- };
884
- switch (o.mimeType) {
885
- case "application/x-www-form-urlencoded":
886
- l.data = o.paramsObj ? o.paramsObj : o.text;
887
- break;
888
- case "application/json":
889
- l.processData = !1, l.data = o.text;
890
- break;
891
- case "multipart/form-data":
892
- if (!o.params)
893
- break;
894
- if (i("const form = new FormData();"), o.params.forEach((f) => {
895
- i(`form.append('${f.name}', '${f.value || f.fileName || ""}');`);
896
- }), l.processData = !1, l.contentType = !1, l.mimeType = "multipart/form-data", l.data = "[form]", it(r, "content-type") && (p = ce(r, "content-type")) != null && p.includes("boundary")) {
897
- const f = z(r, "content-type");
898
- f && delete l.headers[f];
899
- }
900
- n();
901
- break;
902
- default:
903
- o.text && (l.data = o.text);
904
- }
905
- const u = W(l, { indent: a.indent }).replace("'[form]'", "form");
906
- return i(`const settings = ${u};`), n(), i("$.ajax(settings).done(function (response) {"), i("console.log(response);", 1), i("});"), s();
907
- }
908
- }, mo = {
909
- info: {
910
- key: "xhr",
911
- title: "XMLHttpRequest",
912
- link: "https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest",
913
- description: "W3C Standard API that provides scripted client functionality",
914
- extname: ".js"
915
- },
916
- convert: ({ postData: t, allHeaders: e, method: r, fullUrl: o }, c) => {
917
- var l;
918
- const a = {
919
- indent: " ",
920
- cors: !0,
921
- ...c
922
- }, { blank: n, push: i, join: s } = new P({ indent: a.indent });
923
- switch (t.mimeType) {
924
- case "application/json":
925
- i(
926
- `const data = JSON.stringify(${W(t.jsonObj, {
927
- indent: a.indent
928
- })});`
929
- ), n();
930
- break;
931
- case "multipart/form-data":
932
- if (!t.params)
933
- break;
934
- if (i("const data = new FormData();"), t.params.forEach((u) => {
935
- i(`data.append('${u.name}', '${u.value || u.fileName || ""}');`);
936
- }), it(e, "content-type") && (l = ce(e, "content-type")) != null && l.includes("boundary")) {
937
- const u = z(e, "content-type");
938
- u && delete e[u];
939
- }
940
- n();
941
- break;
942
- default:
943
- i(`const data = ${t.text ? `'${t.text}'` : "null"};`), n();
944
- }
945
- return i("const xhr = new XMLHttpRequest();"), a.cors && i("xhr.withCredentials = true;"), n(), i("xhr.addEventListener('readystatechange', function () {"), i("if (this.readyState === this.DONE) {", 1), i("console.log(this.responseText);", 2), i("}", 1), i("});"), n(), i(`xhr.open('${r}', '${o}');`), Object.keys(e).forEach((u) => {
946
- i(`xhr.setRequestHeader('${u}', '${_e(e[u])}');`);
947
- }), n(), i("xhr.send(data);"), s();
948
- }
949
- }, go = {
950
- info: {
951
- key: "javascript",
952
- title: "JavaScript",
953
- default: "xhr"
954
- },
955
- clientsById: {
956
- xhr: mo,
957
- axios: po,
958
- fetch: ho,
959
- jquery: yo
960
- }
961
- }, bo = {
962
- info: {
963
- key: "native",
964
- title: "Native JSON",
965
- link: "https://www.json.org/json-en.html",
966
- description: "A JSON represetation of any HAR payload.",
967
- extname: ".json"
968
- },
969
- convert: ({ postData: t }, e) => {
970
- const r = {
971
- indent: " ",
972
- ...e
973
- };
974
- let o = "";
975
- switch (t.mimeType) {
976
- case "application/x-www-form-urlencoded":
977
- o = t.paramsObj ? t.paramsObj : t.text;
978
- break;
979
- case "application/json":
980
- t.jsonObj && (o = t.jsonObj);
981
- break;
982
- case "multipart/form-data":
983
- if (!t.params)
984
- break;
985
- const c = {};
986
- t.params.forEach((a) => {
987
- c[a.name] = a.value;
988
- }), o = c;
989
- break;
990
- default:
991
- t.text && (o = t.text);
992
- }
993
- return typeof o > "u" || o === "" ? "No JSON body" : JSON.stringify(o, null, r.indent);
994
- }
995
- }, vo = {
996
- info: {
997
- key: "json",
998
- title: "JSON",
999
- default: "native"
1000
- },
1001
- clientsById: {
1002
- native: bo
1003
- }
1004
- }, $o = {
1005
- info: {
1006
- key: "okhttp",
1007
- title: "OkHttp",
1008
- link: "http://square.github.io/okhttp/",
1009
- description: "An HTTP Request Client Library",
1010
- extname: ".kt"
1011
- },
1012
- convert: ({ postData: t, fullUrl: e, method: r, allHeaders: o }, c) => {
1013
- const a = {
1014
- indent: " ",
1015
- ...c
1016
- }, { blank: n, join: i, push: s } = new P({ indent: a.indent }), l = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"], u = ["POST", "PUT", "DELETE", "PATCH"];
1017
- return s("val client = OkHttpClient()"), n(), t.text && (t.boundary ? s(`val mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}")`) : s(`val mediaType = MediaType.parse("${t.mimeType}")`), s(`val body = RequestBody.create(mediaType, ${JSON.stringify(t.text)})`)), s("val request = Request.Builder()"), s(`.url("${e}")`, 1), l.includes(r.toUpperCase()) ? u.includes(r.toUpperCase()) ? t.text ? s(`.${r.toLowerCase()}(body)`, 1) : s(`.${r.toLowerCase()}(null)`, 1) : s(`.${r.toLowerCase()}()`, 1) : t.text ? s(`.method("${r.toUpperCase()}", body)`, 1) : s(`.method("${r.toUpperCase()}", null)`, 1), Object.keys(o).forEach((p) => {
1018
- s(`.addHeader("${p}", "${H(o[p])}")`, 1);
1019
- }), s(".build()", 1), n(), s("val response = client.newCall(request).execute()"), i();
1020
- }
1021
- }, xo = {
1022
- info: {
1023
- key: "kotlin",
1024
- title: "Kotlin",
1025
- default: "okhttp"
1026
- },
1027
- clientsById: {
1028
- okhttp: $o
1029
- }
1030
- }, wo = {
1031
- info: {
1032
- key: "axios",
1033
- title: "Axios",
1034
- link: "https://github.com/axios/axios",
1035
- description: "Promise based HTTP client for the browser and node.js",
1036
- extname: ".cjs",
1037
- installation: "npm install axios --save"
1038
- },
1039
- convert: ({ method: t, fullUrl: e, allHeaders: r, postData: o }, c) => {
1040
- const a = {
1041
- indent: " ",
1042
- ...c
1043
- }, { blank: n, join: i, push: s, addPostProcessor: l } = new P({ indent: a.indent });
1044
- s("const axios = require('axios');");
1045
- const u = {
1046
- method: t,
1047
- url: e
1048
- };
1049
- switch (Object.keys(r).length && (u.headers = r), o.mimeType) {
1050
- case "application/x-www-form-urlencoded":
1051
- o.params && (s("const { URLSearchParams } = require('url');"), n(), s("const encodedParams = new URLSearchParams();"), o.params.forEach((f) => {
1052
- s(`encodedParams.set('${f.name}', '${f.value}');`);
1053
- }), n(), u.data = "encodedParams,", l((f) => f.replace(/'encodedParams,'/, "encodedParams,")));
1054
- break;
1055
- case "application/json":
1056
- n(), o.jsonObj && (u.data = o.jsonObj);
1057
- break;
1058
- default:
1059
- n(), o.text && (u.data = o.text);
1060
- }
1061
- const p = W(u, { indent: " ", inlineCharacterLimit: 80 });
1062
- return s(`const options = ${p};`), n(), s("axios"), s(".request(options)", 1), s(".then(function (response) {", 1), s("console.log(response.data);", 2), s("})", 1), s(".catch(function (error) {", 1), s("console.error(error);", 2), s("});", 1), i();
1063
- }
1064
- }, So = {
1065
- info: {
1066
- key: "fetch",
1067
- title: "Fetch",
1068
- link: "https://github.com/bitinn/node-fetch",
1069
- description: "Simplified HTTP node-fetch client",
1070
- extname: ".cjs",
1071
- installation: "npm install node-fetch@2 --save"
1072
- },
1073
- convert: ({ method: t, fullUrl: e, postData: r, headersObj: o, cookies: c }, a) => {
1074
- var m;
1075
- const n = {
1076
- indent: " ",
1077
- ...a
1078
- };
1079
- let i = !1;
1080
- const { blank: s, push: l, join: u, unshift: p } = new P({ indent: n.indent });
1081
- l("const fetch = require('node-fetch');");
1082
- const f = e, d = {
1083
- method: t
1084
- };
1085
- switch (Object.keys(o).length && (d.headers = o), r.mimeType) {
1086
- case "application/x-www-form-urlencoded":
1087
- p("const { URLSearchParams } = require('url');"), l("const encodedParams = new URLSearchParams();"), s(), (m = r.params) == null || m.forEach((v) => {
1088
- l(`encodedParams.set('${v.name}', '${v.value}');`);
1089
- }), d.body = "encodedParams";
1090
- break;
1091
- case "application/json":
1092
- r.jsonObj && (d.body = r.jsonObj);
1093
- break;
1094
- case "multipart/form-data":
1095
- if (!r.params)
1096
- break;
1097
- const b = z(o, "content-type");
1098
- b && delete o[b], p("const FormData = require('form-data');"), l("const formData = new FormData();"), s(), r.params.forEach((v) => {
1099
- if (!v.fileName && !v.fileName && !v.contentType) {
1100
- l(`formData.append('${v.name}', '${v.value}');`);
1101
- return;
1102
- }
1103
- v.fileName && (i = !0, l(`formData.append('${v.name}', fs.createReadStream('${v.fileName}'));`));
1104
- });
1105
- break;
1106
- default:
1107
- r.text && (d.body = r.text);
1108
- }
1109
- if (c.length) {
1110
- const b = c.map(({ name: v, value: y }) => `${encodeURIComponent(v)}=${encodeURIComponent(y)}`).join("; ");
1111
- d.headers || (d.headers = {}), d.headers.cookie = b;
1112
- }
1113
- s(), l(`const url = '${f}';`), d.headers && !Object.keys(d.headers).length && delete d.headers;
1114
- const h = W(d, {
1115
- indent: " ",
1116
- inlineCharacterLimit: 80,
1117
- // The Fetch API body only accepts string parameters, but stringified JSON can be difficult to
1118
- // read, so we keep the object as a literal and use this transform function to wrap the literal
1119
- // in a `JSON.stringify` call.
1120
- transform: (b, v, y) => v === "body" && r.mimeType === "application/json" ? `JSON.stringify(${y})` : y
1121
- });
1122
- return l(`const options = ${h};`), s(), i && p("const fs = require('fs');"), r.params && r.mimeType === "multipart/form-data" && (l("options.body = formData;"), s()), l("fetch(url, options)"), l(".then(res => res.json())", 1), l(".then(json => console.log(json))", 1), l(".catch(err => console.error('error:' + err));", 1), u().replace(/'encodedParams'/, "encodedParams").replace(/"fs\.createReadStream\(\\"(.+)\\"\)"/, 'fs.createReadStream("$1")');
1123
- }
1124
- }, jo = {
1125
- info: {
1126
- key: "native",
1127
- title: "HTTP",
1128
- link: "http://nodejs.org/api/http.html#http_http_request_options_callback",
1129
- description: "Node.js native HTTP interface",
1130
- extname: ".cjs"
1131
- },
1132
- convert: ({ uriObj: t, method: e, allHeaders: r, postData: o }, c = {}) => {
1133
- var p;
1134
- const { indent: a = " " } = c, { blank: n, join: i, push: s, unshift: l } = new P({ indent: a }), u = {
1135
- method: e,
1136
- hostname: t.hostname,
1137
- port: t.port,
1138
- path: t.path,
1139
- headers: r
1140
- };
1141
- switch (s(`const http = require('${(p = t.protocol) == null ? void 0 : p.replace(":", "")}');`), n(), s(`const options = ${W(u, { indent: a })};`), n(), s("const req = http.request(options, function (res) {"), s("const chunks = [];", 1), n(), s("res.on('data', function (chunk) {", 1), s("chunks.push(chunk);", 2), s("});", 1), n(), s("res.on('end', function () {", 1), s("const body = Buffer.concat(chunks);", 2), s("console.log(body.toString());", 2), s("});", 1), s("});"), n(), o.mimeType) {
1142
- case "application/x-www-form-urlencoded":
1143
- o.paramsObj && (l("const qs = require('querystring');"), s(
1144
- `req.write(qs.stringify(${W(o.paramsObj, {
1145
- indent: " ",
1146
- inlineCharacterLimit: 80
1147
- })}));`
1148
- ));
1149
- break;
1150
- case "application/json":
1151
- o.jsonObj && s(
1152
- `req.write(JSON.stringify(${W(o.jsonObj, {
1153
- indent: " ",
1154
- inlineCharacterLimit: 80
1155
- })}));`
1156
- );
1157
- break;
1158
- default:
1159
- o.text && s(`req.write(${W(o.text, { indent: a })});`);
1160
- }
1161
- return s("req.end();"), i();
1162
- }
1163
- }, Oo = {
1164
- info: {
1165
- key: "request",
1166
- title: "Request",
1167
- link: "https://github.com/request/request",
1168
- description: "Simplified HTTP request client",
1169
- extname: ".cjs",
1170
- installation: "npm install request --save"
1171
- },
1172
- convert: ({ method: t, url: e, fullUrl: r, postData: o, headersObj: c, cookies: a }, n) => {
1173
- const i = {
1174
- indent: " ",
1175
- ...n
1176
- };
1177
- let s = !1;
1178
- const { push: l, blank: u, join: p, unshift: f, addPostProcessor: d } = new P({ indent: i.indent });
1179
- l("const request = require('request');"), u();
1180
- const h = {
1181
- method: t,
1182
- url: r
1183
- };
1184
- switch (Object.keys(c).length && (h.headers = c), o.mimeType) {
1185
- case "application/x-www-form-urlencoded":
1186
- h.form = o.paramsObj;
1187
- break;
1188
- case "application/json":
1189
- o.jsonObj && (h.body = o.jsonObj, h.json = !0);
1190
- break;
1191
- case "multipart/form-data":
1192
- if (!o.params)
1193
- break;
1194
- h.formData = {}, o.params.forEach((m) => {
1195
- if (!m.fileName && !m.fileName && !m.contentType) {
1196
- h.formData[m.name] = m.value;
1197
- return;
1198
- }
1199
- let b = {};
1200
- m.fileName ? (s = !0, b = {
1201
- value: `fs.createReadStream(${m.fileName})`,
1202
- options: {
1203
- filename: m.fileName,
1204
- contentType: m.contentType ? m.contentType : null
1205
- }
1206
- }) : m.value && (b.value = m.value), h.formData[m.name] = b;
1207
- }), d((m) => m.replace(/'fs\.createReadStream\((.*)\)'/, "fs.createReadStream('$1')"));
1208
- break;
1209
- default:
1210
- o.text && (h.body = o.text);
1211
- }
1212
- return a.length && (h.jar = "JAR", l("const jar = request.jar();"), a.forEach(({ name: m, value: b }) => {
1213
- l(`jar.setCookie(request.cookie('${encodeURIComponent(m)}=${encodeURIComponent(b)}'), '${e}');`);
1214
- }), u(), d((m) => m.replace(/'JAR'/, "jar"))), s && f("const fs = require('fs');"), l(`const options = ${W(h, { indent: " ", inlineCharacterLimit: 80 })};`), u(), l("request(options, function (error, response, body) {"), l("if (error) throw new Error(error);", 1), u(), l("console.log(body);", 1), l("});"), p();
1215
- }
1216
- }, To = {
1217
- info: {
1218
- key: "unirest",
1219
- title: "Unirest",
1220
- link: "http://unirest.io/nodejs.html",
1221
- description: "Lightweight HTTP Request Client Library",
1222
- extname: ".cjs"
1223
- },
1224
- convert: ({ method: t, url: e, cookies: r, queryObj: o, postData: c, headersObj: a }, n) => {
1225
- const i = {
1226
- indent: " ",
1227
- ...n
1228
- };
1229
- let s = !1;
1230
- const { addPostProcessor: l, blank: u, join: p, push: f, unshift: d } = new P({
1231
- indent: i.indent
1232
- });
1233
- switch (f("const unirest = require('unirest');"), u(), f(`const req = unirest('${t}', '${e}');`), u(), r.length && (f("const CookieJar = unirest.jar();"), r.forEach((h) => {
1234
- f(`CookieJar.add('${encodeURIComponent(h.name)}=${encodeURIComponent(h.value)}', '${e}');`);
1235
- }), f("req.jar(CookieJar);"), u()), Object.keys(o).length && (f(`req.query(${W(o, { indent: i.indent })});`), u()), Object.keys(a).length && (f(`req.headers(${W(a, { indent: i.indent })});`), u()), c.mimeType) {
1236
- case "application/x-www-form-urlencoded":
1237
- c.paramsObj && (f(`req.form(${W(c.paramsObj, { indent: i.indent })});`), u());
1238
- break;
1239
- case "application/json":
1240
- c.jsonObj && (f("req.type('json');"), f(`req.send(${W(c.jsonObj, { indent: i.indent })});`), u());
1241
- break;
1242
- case "multipart/form-data": {
1243
- if (!c.params)
1244
- break;
1245
- const h = [];
1246
- c.params.forEach((m) => {
1247
- const b = {};
1248
- m.fileName && !m.value ? (s = !0, b.body = `fs.createReadStream('${m.fileName}')`, l((v) => v.replace(/'fs\.createReadStream\(\\'(.+)\\'\)'/, "fs.createReadStream('$1')"))) : m.value && (b.body = m.value), b.body && (m.contentType && (b["content-type"] = m.contentType), h.push(b));
1249
- }), f(`req.multipart(${W(h, { indent: i.indent })});`), u();
1250
- break;
1251
- }
1252
- default:
1253
- c.text && (f(`req.send(${W(c.text, { indent: i.indent })});`), u());
1254
- }
1255
- return s && d("const fs = require('fs');"), f("req.end(function (res) {"), f("if (res.error) throw new Error(res.error);", 1), u(), f("console.log(res.body);", 1), f("});"), p();
1256
- }
1257
- }, Po = {
1258
- info: {
1259
- key: "node",
1260
- title: "Node.js",
1261
- default: "native",
1262
- cli: "node %s"
1263
- },
1264
- clientsById: {
1265
- native: jo,
1266
- request: Oo,
1267
- unirest: To,
1268
- axios: wo,
1269
- fetch: So
1270
- }
1271
- }, lt = (t, e, r, o) => {
1272
- const c = `${t} *${e} = `, a = St(r, o ? c.length : void 0);
1273
- return `${c}${a};`;
1274
- }, St = (t, e) => {
1275
- const r = e === void 0 ? ", " : `,
1276
- ${" ".repeat(e)}`;
1277
- switch (Object.prototype.toString.call(t)) {
1278
- case "[object Number]":
1279
- return `@${t}`;
1280
- case "[object Array]":
1281
- return `@[ ${t.map((c) => St(c)).join(r)} ]`;
1282
- case "[object Object]": {
1283
- const o = [];
1284
- return Object.keys(t).forEach((c) => {
1285
- o.push(`@"${c}": ${St(t[c])}`);
1286
- }), `@{ ${o.join(r)} }`;
1287
- }
1288
- case "[object Boolean]":
1289
- return t ? "@YES" : "@NO";
1290
- default:
1291
- return t == null ? "" : `@"${t.toString().replace(/"/g, '\\"')}"`;
1292
- }
1293
- }, ko = {
1294
- info: {
1295
- key: "nsurlsession",
1296
- title: "NSURLSession",
1297
- link: "https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",
1298
- description: "Foundation's NSURLSession request",
1299
- extname: ".m"
1300
- },
1301
- convert: ({ allHeaders: t, postData: e, method: r, fullUrl: o }, c) => {
1302
- var u;
1303
- const a = {
1304
- indent: " ",
1305
- pretty: !0,
1306
- timeout: 10,
1307
- ...c
1308
- }, { push: n, join: i, blank: s } = new P({ indent: a.indent }), l = {
1309
- hasHeaders: !1,
1310
- hasBody: !1
1311
- };
1312
- if (n("#import <Foundation/Foundation.h>"), Object.keys(t).length && (l.hasHeaders = !0, s(), n(lt("NSDictionary", "headers", t, a.pretty))), e.text || e.jsonObj || e.params)
1313
- switch (l.hasBody = !0, e.mimeType) {
1314
- case "application/x-www-form-urlencoded":
1315
- if ((u = e.params) != null && u.length) {
1316
- s();
1317
- const [p, ...f] = e.params;
1318
- n(
1319
- `NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${p.name}=${p.value}" dataUsingEncoding:NSUTF8StringEncoding]];`
1320
- ), f.forEach(({ name: d, value: h }) => {
1321
- n(`[postData appendData:[@"&${d}=${h}" dataUsingEncoding:NSUTF8StringEncoding]];`);
1322
- });
1323
- } else
1324
- l.hasBody = !1;
1325
- break;
1326
- case "application/json":
1327
- e.jsonObj && (n(lt("NSDictionary", "parameters", e.jsonObj, a.pretty)), s(), n("NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"));
1328
- break;
1329
- case "multipart/form-data":
1330
- n(lt("NSArray", "parameters", e.params || [], a.pretty)), n(`NSString *boundary = @"${e.boundary}";`), s(), n("NSError *error;"), n("NSMutableString *body = [NSMutableString string];"), n("for (NSDictionary *param in parameters) {"), n('[body appendFormat:@"--%@\\r\\n", boundary];', 1), n('if (param[@"fileName"]) {', 1), n(
1331
- '[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',
1332
- 2
1333
- ), n('[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];', 2), n(
1334
- '[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',
1335
- 2
1336
- ), n("if (error) {", 2), n('NSLog(@"%@", error);', 3), n("}", 2), n("} else {", 1), n('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];', 2), n('[body appendFormat:@"%@", param[@"value"]];', 2), n("}", 1), n("}"), n('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];'), n("NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];");
1337
- break;
1338
- default:
1339
- s(), n(
1340
- `NSData *postData = [[NSData alloc] initWithData:[@"${e.text}" dataUsingEncoding:NSUTF8StringEncoding]];`
1341
- );
1342
- }
1343
- return s(), n(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${o}"]`), n(" cachePolicy:NSURLRequestUseProtocolCachePolicy"), n(` timeoutInterval:${a.timeout.toFixed(1)}];`), n(`[request setHTTPMethod:@"${r}"];`), l.hasHeaders && n("[request setAllHTTPHeaderFields:headers];"), l.hasBody && n("[request setHTTPBody:postData];"), s(), n("NSURLSession *session = [NSURLSession sharedSession];"), n("NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"), n(
1344
- " completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"
1345
- ), n(" if (error) {", 1), n(' NSLog(@"%@", error);', 2), n(" } else {", 1), n(
1346
- " NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;",
1347
- 2
1348
- ), n(' NSLog(@"%@", httpResponse);', 2), n(" }", 1), n(" }];"), n("[dataTask resume];"), i();
1349
- }
1350
- }, Eo = {
1351
- info: {
1352
- key: "objc",
1353
- title: "Objective-C",
1354
- default: "nsurlsession"
1355
- },
1356
- clientsById: {
1357
- nsurlsession: ko
1358
- }
1359
- }, Co = {
1360
- info: {
1361
- key: "cohttp",
1362
- title: "CoHTTP",
1363
- link: "https://github.com/mirage/ocaml-cohttp",
1364
- description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",
1365
- extname: ".ml",
1366
- installation: "opam install cohttp-lwt-unix cohttp-async"
1367
- },
1368
- convert: ({ fullUrl: t, allHeaders: e, postData: r, method: o }, c) => {
1369
- const a = {
1370
- indent: " ",
1371
- ...c
1372
- }, n = ["get", "post", "head", "delete", "patch", "put", "options"], { push: i, blank: s, join: l } = new P({ indent: a.indent });
1373
- i("open Cohttp_lwt_unix"), i("open Cohttp"), i("open Lwt"), s(), i(`let uri = Uri.of_string "${t}" in`);
1374
- const u = Object.keys(e);
1375
- u.length === 1 ? i(
1376
- `let headers = Header.add (Header.init ()) "${u[0]}" "${H(
1377
- e[u[0]]
1378
- )}" in`
1379
- ) : u.length > 1 && (i("let headers = Header.add_list (Header.init ()) ["), u.forEach((h) => {
1380
- i(`("${h}", "${H(e[h])}");`, 1);
1381
- }), i("] in")), r.text && i(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(r.text)} in`), s();
1382
- const p = u.length ? "~headers " : "", f = r.text ? "~body " : "", d = n.includes(o.toLowerCase()) ? `\`${o.toUpperCase()}` : `(Code.method_of_string "${o}")`;
1383
- return i(`Client.call ${p}${f}${d} uri`), i(">>= fun (res, body_stream) ->"), i("(* Do stuff with the result *)", 1), l();
1384
- }
1385
- }, No = {
1386
- info: {
1387
- key: "ocaml",
1388
- title: "OCaml",
1389
- default: "cohttp"
1390
- },
1391
- clientsById: {
1392
- cohttp: Co
1393
- }
1394
- }, C = (t, e, r) => {
1395
- switch (r = r || "", e = e || "", Object.prototype.toString.call(t)) {
1396
- case "[object Boolean]":
1397
- return t;
1398
- case "[object Null]":
1399
- return "null";
1400
- case "[object Undefined]":
1401
- return "null";
1402
- case "[object String]":
1403
- return `'${Ue(t, { delimiter: "'", escapeNewlines: !1 })}'`;
1404
- case "[object Number]":
1405
- return t.toString();
1406
- case "[object Array]": {
1407
- const o = t.map((c) => C(c, `${e}${e}`, e)).join(`,
1408
- ${e}`);
1409
- return `[
1410
- ${e}${o}
1411
- ${r}]`;
1412
- }
1413
- case "[object Object]": {
1414
- const o = [];
1415
- for (const c in t)
1416
- Object.prototype.hasOwnProperty.call(t, c) && o.push(`${C(c, e)} => ${C(t[c], `${e}${e}`, e)}`);
1417
- return `[
1418
- ${e}${o.join(`,
1419
- ${e}`)}
1420
- ${r}]`;
1421
- }
1422
- default:
1423
- return "null";
1424
- }
1425
- }, nr = [
1426
- "ACL",
1427
- "BASELINE_CONTROL",
1428
- "CHECKIN",
1429
- "CHECKOUT",
1430
- "CONNECT",
1431
- "COPY",
1432
- "DELETE",
1433
- "GET",
1434
- "HEAD",
1435
- "LABEL",
1436
- "LOCK",
1437
- "MERGE",
1438
- "MKACTIVITY",
1439
- "MKCOL",
1440
- "MKWORKSPACE",
1441
- "MOVE",
1442
- "OPTIONS",
1443
- "POST",
1444
- "PROPFIND",
1445
- "PROPPATCH",
1446
- "PUT",
1447
- "REPORT",
1448
- "TRACE",
1449
- "UNCHECKOUT",
1450
- "UNLOCK",
1451
- "UPDATE",
1452
- "VERSION_CONTROL"
1453
- ], Ro = {
1454
- info: {
1455
- key: "curl",
1456
- title: "cURL",
1457
- link: "http://php.net/manual/en/book.curl.php",
1458
- description: "PHP with ext-curl",
1459
- extname: ".php"
1460
- },
1461
- convert: ({ uriObj: t, postData: e, fullUrl: r, method: o, httpVersion: c, cookies: a, headersObj: n }, i = {}) => {
1462
- const {
1463
- closingTag: s = !1,
1464
- indent: l = " ",
1465
- maxRedirects: u = 10,
1466
- namedErrors: p = !1,
1467
- noTags: f = !1,
1468
- shortTags: d = !1,
1469
- timeout: h = 30
1470
- } = i, { push: m, blank: b, join: v } = new P({ indent: l });
1471
- f || (m(d ? "<?" : "<?php"), b()), m("$curl = curl_init();"), b();
1472
- const y = [
1473
- {
1474
- escape: !0,
1475
- name: "CURLOPT_PORT",
1476
- value: t.port
1477
- },
1478
- {
1479
- escape: !0,
1480
- name: "CURLOPT_URL",
1481
- value: r
1482
- },
1483
- {
1484
- escape: !1,
1485
- name: "CURLOPT_RETURNTRANSFER",
1486
- value: "true"
1487
- },
1488
- {
1489
- escape: !0,
1490
- name: "CURLOPT_ENCODING",
1491
- value: ""
1492
- },
1493
- {
1494
- escape: !1,
1495
- name: "CURLOPT_MAXREDIRS",
1496
- value: u
1497
- },
1498
- {
1499
- escape: !1,
1500
- name: "CURLOPT_TIMEOUT",
1501
- value: h
1502
- },
1503
- {
1504
- escape: !1,
1505
- name: "CURLOPT_HTTP_VERSION",
1506
- value: c === "HTTP/1.0" ? "CURL_HTTP_VERSION_1_0" : "CURL_HTTP_VERSION_1_1"
1507
- },
1508
- {
1509
- escape: !0,
1510
- name: "CURLOPT_CUSTOMREQUEST",
1511
- value: o
1512
- },
1513
- {
1514
- escape: !e.jsonObj,
1515
- name: "CURLOPT_POSTFIELDS",
1516
- value: e ? e.jsonObj ? `json_encode(${C(e.jsonObj, l.repeat(2), l)})` : e.text : void 0
1517
- }
1518
- ];
1519
- m("curl_setopt_array($curl, [");
1520
- const $ = new P({ indent: l, join: `
1521
- ${l}` });
1522
- y.forEach(({ value: j, name: N, escape: E }) => {
1523
- j != null && $.push(`${N} => ${E ? JSON.stringify(j) : j},`);
1524
- });
1525
- const S = a.map((j) => `${encodeURIComponent(j.name)}=${encodeURIComponent(j.value)}`);
1526
- S.length && $.push(`CURLOPT_COOKIE => "${S.join("; ")}",`);
1527
- const w = Object.keys(n).sort().map((j) => `"${j}: ${H(n[j])}"`);
1528
- return w.length && ($.push("CURLOPT_HTTPHEADER => ["), $.push(w.join(`,
1529
- ${l}${l}`), 1), $.push("],")), m($.join(), 1), m("]);"), b(), m("$response = curl_exec($curl);"), m("$err = curl_error($curl);"), b(), m("curl_close($curl);"), b(), m("if ($err) {"), m(p ? 'echo array_flip(get_defined_constants(true)["curl"])[$err];' : 'echo "cURL Error #:" . $err;', 1), m("} else {"), m("echo $response;", 1), m("}"), !f && s && (b(), m("?>")), v();
1530
- }
1531
- }, Ao = {
1532
- info: {
1533
- key: "guzzle",
1534
- title: "Guzzle",
1535
- link: "http://docs.guzzlephp.org/en/stable/",
1536
- description: "PHP with Guzzle",
1537
- extname: ".php",
1538
- installation: "composer require guzzlehttp/guzzle"
1539
- },
1540
- convert: ({ postData: t, fullUrl: e, method: r, cookies: o, headersObj: c }, a) => {
1541
- var m;
1542
- const n = {
1543
- closingTag: !1,
1544
- indent: " ",
1545
- noTags: !1,
1546
- shortTags: !1,
1547
- ...a
1548
- }, { push: i, blank: s, join: l } = new P({ indent: n.indent }), { code: u, push: p, join: f } = new P({ indent: n.indent });
1549
- switch (n.noTags || i(n.shortTags ? "<?" : "<?php"), i("require_once('vendor/autoload.php');"), s(), t.mimeType) {
1550
- case "application/x-www-form-urlencoded":
1551
- p(`'form_params' => ${C(t.paramsObj, n.indent + n.indent, n.indent)},`, 1);
1552
- break;
1553
- case "multipart/form-data": {
1554
- const b = [];
1555
- if (t.params && t.params.forEach((v) => {
1556
- if (v.fileName) {
1557
- const y = {
1558
- name: v.name,
1559
- filename: v.fileName,
1560
- contents: v.value
1561
- };
1562
- v.contentType && (y.headers = { "Content-Type": v.contentType }), b.push(y);
1563
- } else v.value && b.push({
1564
- name: v.name,
1565
- contents: v.value
1566
- });
1567
- }), b.length && (p(`'multipart' => ${C(b, n.indent + n.indent, n.indent)}`, 1), it(c, "content-type") && (m = ce(c, "content-type")) != null && m.indexOf("boundary"))) {
1568
- const v = z(c, "content-type");
1569
- v && delete c[v];
1570
- }
1571
- break;
1572
- }
1573
- default:
1574
- t.text && p(`'body' => ${C(t.text)},`, 1);
1575
- }
1576
- const d = Object.keys(c).sort().map(function(b) {
1577
- return `${n.indent}${n.indent}'${b}' => '${_e(c[b])}',`;
1578
- }), h = o.map((b) => `${encodeURIComponent(b.name)}=${encodeURIComponent(b.value)}`).join("; ");
1579
- return h.length && d.push(`${n.indent}${n.indent}'cookie' => '${_e(h)}',`), d.length && (p("'headers' => [", 1), p(d.join(`
1580
- `)), p("],", 1)), i("$client = new \\GuzzleHttp\\Client();"), s(), u.length ? (i(`$response = $client->request('${r}', '${e}', [`), i(f()), i("]);")) : i(`$response = $client->request('${r}', '${e}');`), s(), i("echo $response->getBody();"), !n.noTags && n.closingTag && (s(), i("?>")), l();
1581
- }
1582
- }, qo = {
1583
- info: {
1584
- key: "http1",
1585
- title: "HTTP v1",
1586
- link: "http://php.net/manual/en/book.http.php",
1587
- description: "PHP with pecl/http v1",
1588
- extname: ".php"
1589
- },
1590
- convert: ({ method: t, url: e, postData: r, queryObj: o, headersObj: c, cookiesObj: a }, n = {}) => {
1591
- const { closingTag: i = !1, indent: s = " ", noTags: l = !1, shortTags: u = !1 } = n, { push: p, blank: f, join: d } = new P({ indent: s });
1592
- switch (l || (p(u ? "<?" : "<?php"), f()), nr.includes(t.toUpperCase()) || p(`HttpRequest::methodRegister('${t}');`), p("$request = new HttpRequest();"), p(`$request->setUrl(${C(e)});`), nr.includes(t.toUpperCase()) ? p(`$request->setMethod(HTTP_METH_${t.toUpperCase()});`) : p(`$request->setMethod(HttpRequest::HTTP_METH_${t.toUpperCase()});`), f(), Object.keys(o).length && (p(`$request->setQueryData(${C(o, s)});`), f()), Object.keys(c).length && (p(`$request->setHeaders(${C(c, s)});`), f()), Object.keys(a).length && (p(`$request->setCookies(${C(a, s)});`), f()), r.mimeType) {
1593
- case "application/x-www-form-urlencoded":
1594
- p(`$request->setContentType(${C(r.mimeType)});`), p(`$request->setPostFields(${C(r.paramsObj, s)});`), f();
1595
- break;
1596
- case "application/json":
1597
- p(`$request->setContentType(${C(r.mimeType)});`), p(`$request->setBody(json_encode(${C(r.jsonObj, s)}));`), f();
1598
- break;
1599
- default:
1600
- r.text && (p(`$request->setBody(${C(r.text)});`), f());
1601
- }
1602
- return p("try {"), p("$response = $request->send();", 1), f(), p("echo $response->getBody();", 1), p("} catch (HttpException $ex) {"), p("echo $ex;", 1), p("}"), !l && i && (f(), p("?>")), d();
1603
- }
1604
- }, Io = {
1605
- info: {
1606
- key: "http2",
1607
- title: "HTTP v2",
1608
- link: "http://devel-m6w6.rhcloud.com/mdref/http",
1609
- description: "PHP with pecl/http v2",
1610
- extname: ".php"
1611
- },
1612
- convert: ({ postData: t, headersObj: e, method: r, queryObj: o, cookiesObj: c, url: a }, n = {}) => {
1613
- var m;
1614
- const { closingTag: i = !1, indent: s = " ", noTags: l = !1, shortTags: u = !1 } = n, { push: p, blank: f, join: d } = new P({ indent: s });
1615
- let h = !1;
1616
- switch (l || (p(u ? "<?" : "<?php"), f()), p("$client = new http\\Client;"), p("$request = new http\\Client\\Request;"), f(), t.mimeType) {
1617
- case "application/x-www-form-urlencoded":
1618
- p("$body = new http\\Message\\Body;"), p(`$body->append(new http\\QueryString(${C(t.paramsObj, s)}));`), f(), h = !0;
1619
- break;
1620
- case "multipart/form-data": {
1621
- if (!t.params)
1622
- break;
1623
- const b = [], v = {};
1624
- t.params.forEach(({ name: S, fileName: w, value: j, contentType: N }) => {
1625
- if (w) {
1626
- b.push({
1627
- name: S,
1628
- type: N,
1629
- file: w,
1630
- data: j
1631
- });
1632
- return;
1633
- }
1634
- j && (v[S] = j);
1635
- });
1636
- const y = Object.keys(v).length ? C(v, s) : "null", $ = b.length ? C(b, s) : "null";
1637
- if (p("$body = new http\\Message\\Body;"), p(`$body->addForm(${y}, ${$});`), it(e, "content-type") && (m = ce(e, "content-type")) != null && m.indexOf("boundary")) {
1638
- const S = z(e, "content-type");
1639
- S && delete e[S];
1640
- }
1641
- f(), h = !0;
1642
- break;
1643
- }
1644
- case "application/json":
1645
- p("$body = new http\\Message\\Body;"), p(`$body->append(json_encode(${C(t.jsonObj, s)}));`), h = !0;
1646
- break;
1647
- default:
1648
- t.text && (p("$body = new http\\Message\\Body;"), p(`$body->append(${C(t.text)});`), f(), h = !0);
1649
- }
1650
- return p(`$request->setRequestUrl(${C(a)});`), p(`$request->setRequestMethod(${C(r)});`), h && (p("$request->setBody($body);"), f()), Object.keys(o).length && (p(`$request->setQuery(new http\\QueryString(${C(o, s)}));`), f()), Object.keys(e).length && (p(`$request->setHeaders(${C(e, s)});`), f()), Object.keys(c).length && (f(), p(`$client->setCookies(${C(c, s)});`), f()), p("$client->enqueue($request)->send();"), p("$response = $client->getResponse();"), f(), p("echo $response->getBody();"), !l && i && (f(), p("?>")), d();
1651
- }
1652
- }, Lo = {
1653
- info: {
1654
- key: "php",
1655
- title: "PHP",
1656
- default: "curl",
1657
- cli: "php %s"
1658
- },
1659
- clientsById: {
1660
- curl: Ro,
1661
- guzzle: Ao,
1662
- http1: qo,
1663
- http2: Io
1664
- }
1665
- }, zr = (t) => ({ method: r, headersObj: o, cookies: c, uriObj: a, fullUrl: n, postData: i, allHeaders: s }) => {
1666
- const { push: l, join: u } = new P();
1667
- if (!["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(r.toUpperCase()))
1668
- return "Method not supported";
1669
- const f = [], d = Object.keys(o);
1670
- return d.length && (l("$headers=@{}"), d.forEach((h) => {
1671
- h !== "connection" && l(`$headers.Add("${h}", "${Ue(o[h], { escapeChar: "`" })}")`);
1672
- }), f.push("-Headers $headers")), c.length && (l("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"), c.forEach((h) => {
1673
- l("$cookie = New-Object System.Net.Cookie"), l(`$cookie.Name = '${h.name}'`), l(`$cookie.Value = '${h.value}'`), l(`$cookie.Domain = '${a.host}'`), l("$session.Cookies.Add($cookie)");
1674
- }), f.push("-WebSession $session")), i.text && (f.push(
1675
- `-ContentType '${Ue(ce(s, "content-type"), { delimiter: "'", escapeChar: "`" })}'`
1676
- ), f.push(`-Body '${i.text}'`)), l(`$response = ${t} -Uri '${n}' -Method ${r} ${f.join(" ")}`.trim()), u();
1677
- }, Uo = {
1678
- info: {
1679
- key: "restmethod",
1680
- title: "Invoke-RestMethod",
1681
- link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",
1682
- description: "Powershell Invoke-RestMethod client",
1683
- extname: ".ps1"
1684
- },
1685
- convert: zr("Invoke-RestMethod")
1686
- }, _o = {
1687
- info: {
1688
- key: "webrequest",
1689
- title: "Invoke-WebRequest",
1690
- link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",
1691
- description: "Powershell Invoke-WebRequest client",
1692
- extname: ".ps1"
1693
- },
1694
- convert: zr("Invoke-WebRequest")
1695
- }, Fo = {
1696
- info: {
1697
- key: "powershell",
1698
- title: "Powershell",
1699
- default: "webrequest"
1700
- },
1701
- clientsById: {
1702
- webrequest: _o,
1703
- restmethod: Uo
1704
- }
1705
- };
1706
- function or(t, e, r, o, c) {
1707
- const a = o.repeat(c), n = o.repeat(c - 1), i = r ? `,
1708
- ${a}` : ", ", s = t === "object" ? "{" : "[", l = t === "object" ? "}" : "]";
1709
- return r ? `${s}
1710
- ${a}${e.join(i)}
1711
- ${n}${l}` : t === "object" && e.length > 0 ? `${s} ${e.join(i)} ${l}` : `${s}${e.join(i)}${l}`;
1712
- }
1713
- var Se = (t, e, r) => {
1714
- switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(t)) {
1715
- case "[object Number]":
1716
- return t;
1717
- case "[object Array]": {
1718
- let o = !1;
1719
- const c = t.map((a) => (Object.prototype.toString.call(a) === "[object Object]" && (o = Object.keys(a).length > 1), Se(a, e, r)));
1720
- return or("array", c, o, e.indent, r);
1721
- }
1722
- case "[object Object]": {
1723
- const o = [];
1724
- for (const c in t)
1725
- o.push(`"${c}": ${Se(t[c], e, r)}`);
1726
- return or("object", o, e.pretty && o.length > 1, e.indent, r);
1727
- }
1728
- case "[object Null]":
1729
- return "None";
1730
- case "[object Boolean]":
1731
- return t ? "True" : "False";
1732
- default:
1733
- return t == null ? "" : `"${t.toString().replace(/"/g, '\\"')}"`;
1734
- }
1735
- }, Ho = ["HEAD", "GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], Bo = {
1736
- info: {
1737
- key: "requests",
1738
- title: "Requests",
1739
- link: "http://docs.python-requests.org/en/latest/api/#requests.request",
1740
- description: "Requests HTTP library",
1741
- extname: ".py",
1742
- installation: "python -m pip install requests"
1743
- },
1744
- convert: ({ fullUrl: t, postData: e, allHeaders: r, method: o }, c) => {
1745
- const a = {
1746
- indent: " ",
1747
- pretty: !0,
1748
- ...c
1749
- }, { push: n, blank: i, join: s, addPostProcessor: l } = new P({ indent: a.indent });
1750
- n("import requests"), i(), n(`url = "${t}"`), i();
1751
- const u = r;
1752
- let p = {};
1753
- const f = {};
1754
- let d = !1, h = !1, m = !1;
1755
- switch (e.mimeType) {
1756
- case "application/json":
1757
- e.jsonObj && (n(`payload = ${Se(e.jsonObj, a)}`), m = !0, h = !0);
1758
- break;
1759
- case "multipart/form-data":
1760
- if (!e.params)
1761
- break;
1762
- if (p = {}, e.params.forEach((y) => {
1763
- y.fileName ? (y.contentType ? f[y.name] = `('${y.fileName}', open('${y.fileName}', 'rb'), '${y.contentType}')` : f[y.name] = `('${y.fileName}', open('${y.fileName}', 'rb'))`, d = !0) : (p[y.name] = y.value, h = !0);
1764
- }), d) {
1765
- n(`files = ${Se(f, a)}`), h && n(`payload = ${Se(p, a)}`);
1766
- const y = z(u, "content-type");
1767
- y && delete u[y];
1768
- } else {
1769
- const y = JSON.stringify(e.text);
1770
- y && (n(`payload = ${y}`), h = !0);
1771
- }
1772
- l(
1773
- (y) => y.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g, '("$1", open("$2", "rb"))').replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g, '("$1", open("$2", "rb"), "$3")')
1774
- );
1775
- break;
1776
- default: {
1777
- if (e.mimeType === "application/x-www-form-urlencoded" && e.paramsObj) {
1778
- n(`payload = ${Se(e.paramsObj, a)}`), h = !0;
1779
- break;
1780
- }
1781
- const y = JSON.stringify(e.text);
1782
- y && (n(`payload = ${y}`), h = !0);
1783
- }
1784
- }
1785
- const b = Object.keys(u).length;
1786
- if (b === 0 && (h || d))
1787
- i();
1788
- else if (b === 1)
1789
- Object.keys(u).forEach((y) => {
1790
- n(`headers = {"${y}": "${H(u[y])}"}`), i();
1791
- });
1792
- else if (b > 1) {
1793
- let y = 1;
1794
- n("headers = {"), Object.keys(u).forEach(($) => {
1795
- n(y !== b ? `"${$}": "${H(u[$])}",` : `"${$}": "${H(u[$])}"`, 1), y += 1;
1796
- }), n("}"), i();
1797
- }
1798
- let v = Ho.includes(o) ? `response = requests.${o.toLowerCase()}(url` : `response = requests.request("${o}", url`;
1799
- return h && (m ? v += ", json=payload" : v += ", data=payload"), d && (v += ", files=files"), b > 0 && (v += ", headers=headers"), v += ")", n(v), i(), n("print(response.text)"), s();
1800
- }
1801
- }, Mo = {
1802
- info: {
1803
- key: "python",
1804
- title: "Python",
1805
- default: "requests",
1806
- cli: "python3 %s"
1807
- },
1808
- clientsById: {
1809
- requests: Bo
1810
- }
1811
- }, Wo = {
1812
- info: {
1813
- key: "httr",
1814
- title: "httr",
1815
- link: "https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",
1816
- description: "httr: Tools for Working with URLs and HTTP",
1817
- extname: ".r"
1818
- },
1819
- convert: ({ url: t, queryObj: e, queryString: r, postData: o, allHeaders: c, method: a }) => {
1820
- const { push: n, blank: i, join: s } = new P();
1821
- n("library(httr)"), i(), n(`url <- "${t}"`), i();
1822
- const l = e;
1823
- delete e.key;
1824
- const u = Object.keys(l).length;
1825
- r.length === 1 ? (n(`queryString <- list(${Object.keys(l)} = "${Object.values(l).toString()}")`), i()) : r.length > 1 && (n("queryString <- list("), Object.keys(l).forEach((w, j) => {
1826
- j !== u - 1 ? n(` ${w} = "${l[w].toString()}",`) : n(` ${w} = "${l[w].toString()}"`);
1827
- }), n(")"), i());
1828
- const p = JSON.stringify(o.text);
1829
- if (p && (n(`payload <- ${p}`), i()), o.text || o.jsonObj || o.params)
1830
- switch (o.mimeType) {
1831
- case "application/x-www-form-urlencoded":
1832
- n('encode <- "form"'), i();
1833
- break;
1834
- case "application/json":
1835
- n('encode <- "json"'), i();
1836
- break;
1837
- case "multipart/form-data":
1838
- n('encode <- "multipart"'), i();
1839
- break;
1840
- default:
1841
- n('encode <- "raw"'), i();
1842
- break;
1843
- }
1844
- const f = ce(c, "cookie"), d = ce(c, "accept"), h = f ? `set_cookies(\`${String(f).replace(/;/g, '", `').replace(/` /g, "`").replace(/[=]/g, '` = "')}")` : void 0, m = d ? `accept("${H(d)}")` : void 0, b = `content_type("${H(o.mimeType)}")`, v = Object.entries(c).filter(([w]) => !["cookie", "accept", "content-type"].includes(w.toLowerCase())).map(([w, j]) => `'${w}' = '${_e(j)}'`).join(", "), y = v ? `add_headers(${v})` : void 0;
1845
- let $ = `response <- VERB("${a}", url`;
1846
- p && ($ += ", body = payload"), r.length && ($ += ", query = queryString");
1847
- const S = [y, b, m, h].filter((w) => !!w).join(", ");
1848
- return S && ($ += `, ${S}`), (o.text || o.jsonObj || o.params) && ($ += ", encode = encode"), $ += ")", n($), i(), n('content(response, "text")'), s();
1849
- }
1850
- }, Jo = {
1851
- info: {
1852
- key: "r",
1853
- title: "R",
1854
- default: "httr"
1855
- },
1856
- clientsById: {
1857
- httr: Wo
1858
- }
1859
- }, zo = {
1860
- info: {
1861
- key: "native",
1862
- title: "net::http",
1863
- link: "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",
1864
- description: "Ruby HTTP client",
1865
- extname: ".rb"
1866
- },
1867
- convert: ({ uriObj: t, method: e, fullUrl: r, postData: o, allHeaders: c }) => {
1868
- const { push: a, blank: n, join: i } = new P();
1869
- a("require 'uri'"), a("require 'net/http'"), n();
1870
- const s = e.toUpperCase(), l = [
1871
- "GET",
1872
- "POST",
1873
- "HEAD",
1874
- "DELETE",
1875
- "PATCH",
1876
- "PUT",
1877
- "OPTIONS",
1878
- "COPY",
1879
- "LOCK",
1880
- "UNLOCK",
1881
- "MOVE",
1882
- "TRACE"
1883
- ], u = s.charAt(0) + s.substring(1).toLowerCase();
1884
- l.includes(s) || (a(`class Net::HTTP::${u} < Net::HTTPRequest`), a(` METHOD = '${s.toUpperCase()}'`), a(` REQUEST_HAS_BODY = '${o.text ? "true" : "false"}'`), a(" RESPONSE_HAS_BODY = true"), a("end"), n()), a(`url = URI("${r}")`), n(), a("http = Net::HTTP.new(url.host, url.port)"), t.protocol === "https:" && a("http.use_ssl = true"), n(), a(`request = Net::HTTP::${u}.new(url)`);
1885
- const p = Object.keys(c);
1886
- return p.length && p.forEach((f) => {
1887
- a(`request["${f}"] = '${_e(c[f])}'`);
1888
- }), o.text && a(`request.body = ${JSON.stringify(o.text)}`), n(), a("response = http.request(request)"), a("puts response.read_body"), i();
1889
- }
1890
- }, Go = {
1891
- info: {
1892
- key: "ruby",
1893
- title: "Ruby",
1894
- default: "native"
1895
- },
1896
- clientsById: {
1897
- native: zo
1898
- }
1899
- }, M = (t = "") => /^[a-z0-9-_/.@%^=:]+$/i.test(t) ? t : `'${t.replace(/'/g, "'\\''")}'`, Vo = (t) => t.replace(/\r/g, "\\r").replace(/\n/g, "\\n"), Ko = {
1900
- "http1.0": "0",
1901
- "url ": "",
1902
- cookie: "b",
1903
- data: "d",
1904
- form: "F",
1905
- globoff: "g",
1906
- header: "H",
1907
- insecure: "k",
1908
- request: "X"
1909
- }, Qo = (t) => (e) => {
1910
- if (t) {
1911
- const r = Ko[e];
1912
- return r ? `-${r}` : "";
1913
- }
1914
- return `--${e}`;
1915
- }, Do = {
1916
- info: {
1917
- key: "curl",
1918
- title: "cURL",
1919
- link: "http://curl.haxx.se/",
1920
- description: "cURL is a command line tool and library for transferring data with URL syntax",
1921
- extname: ".sh"
1922
- },
1923
- convert: ({ fullUrl: t, method: e, httpVersion: r, headersObj: o, allHeaders: c, postData: a }, n = {}) => {
1924
- var b;
1925
- const { indent: i = " ", short: s = !1, binary: l = !1, globOff: u = !1 } = n, p = " ", { push: f, join: d } = new P({
1926
- ...typeof i == "string" ? { indent: i } : {},
1927
- join: i !== !1 ? ` \\
1928
- ${i}` : " "
1929
- }), h = Qo(s);
1930
- let m = M(t);
1931
- if (f(`curl ${h("request")} ${e}`), u && (m = unescape(m), f(h("globoff"))), f(`${h("url ")}${m}`), r === "HTTP/1.0" && f(h("http1.0")), ce(c, "accept-encoding") && f("--compressed"), a.mimeType === "multipart/form-data") {
1932
- const v = z(o, "content-type");
1933
- if (v) {
1934
- const y = o[v];
1935
- if (v && y) {
1936
- const $ = String(y).replace(/; boundary.+?(?=(;|$))/, "");
1937
- o[v] = $, c[v] = $;
1938
- }
1939
- }
1940
- }
1941
- switch (Object.keys(o).sort().forEach((v) => {
1942
- const y = `${v}: ${o[v]}`;
1943
- f(`${h("header")} ${M(y)}`);
1944
- }), c.cookie && f(`${h("cookie")} ${M(c.cookie)}`), a.mimeType) {
1945
- case "multipart/form-data":
1946
- (b = a.params) == null || b.forEach((y) => {
1947
- let $ = "";
1948
- y.fileName ? $ = `${y.name}='@${y.fileName}'` : $ = M(`${y.name}=${y.value}`), f(`${h("form")} ${$}`);
1949
- });
1950
- break;
1951
- case "application/x-www-form-urlencoded":
1952
- a.params ? a.params.forEach((y) => {
1953
- const $ = y.name, S = encodeURIComponent(y.name), w = S !== $, j = w ? S : $, N = l ? "--data-binary" : w ? "--data-urlencode" : h("data");
1954
- f(`${N} ${M(`${j}=${y.value}`)}`);
1955
- }) : f(`${l ? "--data-binary" : h("data")} ${M(a.text)}`);
1956
- break;
1957
- default:
1958
- if (!a.text)
1959
- break;
1960
- let v = !1;
1961
- if (Kn(a.mimeType) && a.text.length > 20)
1962
- try {
1963
- const y = JSON.parse(a.text);
1964
- v = !0, a.text.indexOf("'") > 0 ? f(
1965
- `${l ? "--data-binary" : h("data")} @- <<EOF
1966
- ${JSON.stringify(
1967
- y,
1968
- null,
1969
- p
1970
- )}
1971
- EOF`
1972
- ) : f(
1973
- `${l ? "--data-binary" : h("data")} '
1974
- ${JSON.stringify(y, null, p)}
1975
- '`
1976
- );
1977
- } catch {
1978
- }
1979
- v || f(`${l ? "--data-binary" : h("data")} ${M(a.text)}`);
1980
- }
1981
- return d();
1982
- }
1983
- }, Yo = {
1984
- info: {
1985
- key: "httpie",
1986
- title: "HTTPie",
1987
- link: "http://httpie.org/",
1988
- description: "a CLI, cURL-like tool for humans",
1989
- extname: ".sh",
1990
- installation: "brew install httpie"
1991
- },
1992
- convert: ({ allHeaders: t, postData: e, queryObj: r, fullUrl: o, method: c, url: a }, n) => {
1993
- const i = {
1994
- body: !1,
1995
- cert: !1,
1996
- headers: !1,
1997
- indent: " ",
1998
- pretty: !1,
1999
- print: !1,
2000
- queryParams: !1,
2001
- short: !1,
2002
- style: !1,
2003
- timeout: !1,
2004
- verbose: !1,
2005
- verify: !1,
2006
- ...n
2007
- }, { push: s, join: l, unshift: u } = new P({
2008
- indent: i.indent,
2009
- // @ts-expect-error SEEMS LEGIT
2010
- join: i.indent !== !1 ? ` \\
2011
- ${i.indent}` : " "
2012
- });
2013
- let p = !1;
2014
- const f = [];
2015
- i.headers && f.push(i.short ? "-h" : "--headers"), i.body && f.push(i.short ? "-b" : "--body"), i.verbose && f.push(i.short ? "-v" : "--verbose"), i.print && f.push(`${i.short ? "-p" : "--print"}=${i.print}`), i.verify && f.push(`--verify=${i.verify}`), i.cert && f.push(`--cert=${i.cert}`), i.pretty && f.push(`--pretty=${i.pretty}`), i.style && f.push(`--style=${i.style}`), i.timeout && f.push(`--timeout=${i.timeout}`), i.queryParams && Object.keys(r).forEach((h) => {
2016
- const m = r[h];
2017
- Array.isArray(m) ? m.forEach((b) => {
2018
- s(`${h}==${M(b)}`);
2019
- }) : s(`${h}==${M(m)}`);
2020
- }), Object.keys(t).sort().forEach((h) => {
2021
- s(`${h}:${M(t[h])}`);
2022
- }), e.mimeType === "application/x-www-form-urlencoded" ? e.params && e.params.length && (f.push(i.short ? "-f" : "--form"), e.params.forEach((h) => {
2023
- s(`${h.name}=${M(h.value)}`);
2024
- })) : p = !0;
2025
- const d = f.length ? `${f.join(" ")} ` : "";
2026
- if (a = M(i.queryParams ? a : o), u(`http ${d}${c} ${a}`), p && e.text) {
2027
- const h = M(e.text);
2028
- u(`echo ${h} | `);
2029
- }
2030
- return l();
2031
- }
2032
- }, Xo = {
2033
- info: {
2034
- key: "wget",
2035
- title: "Wget",
2036
- link: "https://www.gnu.org/software/wget/",
2037
- description: "a free software package for retrieving files using HTTP, HTTPS",
2038
- extname: ".sh"
2039
- },
2040
- convert: ({ method: t, postData: e, allHeaders: r, fullUrl: o }, c) => {
2041
- const a = {
2042
- indent: " ",
2043
- short: !1,
2044
- verbose: !1,
2045
- ...c
2046
- }, { push: n, join: i } = new P({
2047
- ...typeof a.indent == "string" ? { indent: a.indent } : {},
2048
- join: a.indent !== !1 ? ` \\
2049
- ${a.indent}` : " "
2050
- });
2051
- return a.verbose ? n(`wget ${a.short ? "-v" : "--verbose"}`) : n(`wget ${a.short ? "-q" : "--quiet"}`), n(`--method ${M(t)}`), Object.keys(r).forEach((s) => {
2052
- const l = `${s}: ${r[s]}`;
2053
- n(`--header ${M(l)}`);
2054
- }), e.text && n(`--body-data ${Vo(M(e.text))}`), n(a.short ? "-O" : "--output-document"), n(`- ${M(o)}`), i();
2055
- }
2056
- }, Zo = {
2057
- info: {
2058
- key: "shell",
2059
- title: "Shell",
2060
- default: "curl",
2061
- cli: "%s"
2062
- },
2063
- clientsById: {
2064
- curl: Do,
2065
- httpie: Yo,
2066
- wget: Xo
2067
- }
2068
- }, ar = (t, e) => e.repeat(t), ir = (t, e, r, o) => {
2069
- const c = ar(o, r), a = ar(o - 1, r), n = e ? `,
2070
- ${c}` : ", ";
2071
- return e ? `[
2072
- ${c}${t.join(n)}
2073
- ${a}]` : `[${t.join(n)}]`;
2074
- }, sr = (t, e, r) => `let ${t} = ${Ze(e, r)}`, Ze = (t, e, r) => {
2075
- switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(t)) {
2076
- case "[object Number]":
2077
- return t;
2078
- case "[object Array]": {
2079
- let o = !1;
2080
- const c = t.map((a) => (Object.prototype.toString.call(a) === "[object Object]" && (o = Object.keys(a).length > 1), Ze(a, e, r)));
2081
- return ir(c, o, e.indent, r);
2082
- }
2083
- case "[object Object]": {
2084
- const o = [];
2085
- for (const c in t)
2086
- o.push(`"${c}": ${Ze(t[c], e, r)}`);
2087
- return ir(
2088
- o,
2089
- // @ts-expect-error needs better types
2090
- e.pretty && o.length > 1,
2091
- // @ts-expect-error needs better types
2092
- e.indent,
2093
- r
2094
- );
2095
- }
2096
- case "[object Boolean]":
2097
- return t.toString();
2098
- default:
2099
- return t == null ? "nil" : `"${t.toString().replace(/"/g, '\\"')}"`;
2100
- }
2101
- }, ea = {
2102
- info: {
2103
- key: "urlsession",
2104
- title: "URLSession",
2105
- link: "https://developer.apple.com/documentation/foundation/urlsession",
2106
- description: "Foundation's URLSession request",
2107
- extname: ".swift"
2108
- },
2109
- convert: ({ allHeaders: t, postData: e, uriObj: r, queryObj: o, method: c }, a) => {
2110
- var f;
2111
- const n = {
2112
- indent: " ",
2113
- pretty: !0,
2114
- timeout: 10,
2115
- ...a
2116
- }, { push: i, blank: s, join: l } = new P({ indent: n.indent });
2117
- i("import Foundation"), s();
2118
- const u = e.text || e.jsonObj || e.params;
2119
- if (u)
2120
- switch (e.mimeType) {
2121
- case "application/x-www-form-urlencoded":
2122
- if ((f = e.params) != null && f.length) {
2123
- const d = e.params.map((h) => `"${h.name}": "${h.value}"`);
2124
- n.pretty ? (i("let parameters = ["), d.forEach((h) => i(`${h},`, 1)), i("]")) : i(`let parameters = [${d.join(", ")}]`), i('let joinedParameters = parameters.map { "\\($0.key)=\\($0.value)" }.joined(separator: "&")'), i("let postData = Data(joinedParameters.utf8)"), s();
2125
- }
2126
- break;
2127
- case "application/json":
2128
- e.jsonObj && (i(`${sr("parameters", e.jsonObj, n)} as [String : Any?]`), s(), i("let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])"), s());
2129
- break;
2130
- case "multipart/form-data":
2131
- i(sr("parameters", e.params, n)), s(), i(`let boundary = "${e.boundary}"`), s(), i('var body = ""'), i("for param in parameters {"), i('let paramName = param["name"]!', 1), i('body += "--\\(boundary)\\r\\n"', 1), i('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""', 1), i('if let filename = param["fileName"] {', 1), i('let contentType = param["contentType"]!', 2), i("let fileContent = try String(contentsOfFile: filename, encoding: .utf8)", 2), i('body += "; filename=\\"\\(filename)\\"\\r\\n"', 2), i('body += "Content-Type: \\(contentType)\\r\\n\\r\\n"', 2), i("body += fileContent", 2), i('} else if let paramValue = param["value"] {', 1), i('body += "\\r\\n\\r\\n\\(paramValue)"', 2), i("}", 1), i("}"), s(), i("let postData = Data(body.utf8)"), s();
2132
- break;
2133
- default:
2134
- i(`let postData = Data("${e.text}".utf8)`), s();
2135
- }
2136
- i(`let url = URL(string: "${r.href}")!`);
2137
- const p = o ? Object.entries(o) : [];
2138
- return p.length < 1 ? i("var request = URLRequest(url: url)") : (i("var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!"), i("let queryItems: [URLQueryItem] = ["), p.forEach((d) => {
2139
- const h = d[0], m = d[1];
2140
- switch (Object.prototype.toString.call(m)) {
2141
- case "[object String]":
2142
- i(`URLQueryItem(name: "${h}", value: "${m}"),`, 1);
2143
- break;
2144
- case "[object Array]":
2145
- m.forEach((b) => {
2146
- i(`URLQueryItem(name: "${h}", value: "${b}"),`, 1);
2147
- });
2148
- break;
2149
- }
2150
- }), i("]"), i("components.queryItems = components.queryItems.map { $0 + queryItems } ?? queryItems"), s(), i("var request = URLRequest(url: components.url!)")), i(`request.httpMethod = "${c}"`), i(`request.timeoutInterval = ${n.timeout}`), Object.keys(t).length && i(`request.allHTTPHeaderFields = ${Ze(t, n)}`), u && i("request.httpBody = postData"), s(), i("let (data, _) = try await URLSession.shared.data(for: request)"), i("print(String(decoding: data, as: UTF8.self))"), l();
2151
- }
2152
- }, ta = {
2153
- info: {
2154
- key: "swift",
2155
- title: "Swift",
2156
- default: "urlsession"
2157
- },
2158
- clientsById: {
2159
- urlsession: ea
2160
- }
2161
- }, ra = {
2162
- c: Vn,
2163
- clojure: Yn,
2164
- csharp: ro,
2165
- go: oo,
2166
- http: io,
2167
- java: fo,
2168
- javascript: go,
2169
- json: vo,
2170
- kotlin: xo,
2171
- node: Po,
2172
- objc: Eo,
2173
- ocaml: No,
2174
- php: Lo,
2175
- powershell: Fo,
2176
- python: Mo,
2177
- r: Jo,
2178
- ruby: Go,
2179
- shell: Zo,
2180
- swift: ta
2181
- }, et = { exports: {} };
2182
- /*! https://mths.be/punycode v1.4.1 by @mathias */
2183
- et.exports;
2184
- (function(t, e) {
2185
- (function(r) {
2186
- var o = e && !e.nodeType && e, c = t && !t.nodeType && t, a = typeof Ge == "object" && Ge;
2187
- (a.global === a || a.window === a || a.self === a) && (r = a);
2188
- var n, i = 2147483647, s = 36, l = 1, u = 26, p = 38, f = 700, d = 72, h = 128, m = "-", b = /^xn--/, v = /[^\x20-\x7E]/, y = /[\x2E\u3002\uFF0E\uFF61]/g, $ = {
2189
- overflow: "Overflow: input needs wider integers to process",
2190
- "not-basic": "Illegal input >= 0x80 (not a basic code point)",
2191
- "invalid-input": "Invalid input"
2192
- }, S = s - l, w = Math.floor, j = String.fromCharCode, N;
2193
- function E(x) {
2194
- throw new RangeError($[x]);
2195
- }
2196
- function R(x, O) {
2197
- for (var k = x.length, A = []; k--; )
2198
- A[k] = O(x[k]);
2199
- return A;
2200
- }
2201
- function _(x, O) {
2202
- var k = x.split("@"), A = "";
2203
- k.length > 1 && (A = k[0] + "@", x = k[1]), x = x.replace(y, ".");
2204
- var q = x.split("."), Q = R(q, O).join(".");
2205
- return A + Q;
2206
- }
2207
- function Z(x) {
2208
- for (var O = [], k = 0, A = x.length, q, Q; k < A; )
2209
- q = x.charCodeAt(k++), q >= 55296 && q <= 56319 && k < A ? (Q = x.charCodeAt(k++), (Q & 64512) == 56320 ? O.push(((q & 1023) << 10) + (Q & 1023) + 65536) : (O.push(q), k--)) : O.push(q);
2210
- return O;
2211
- }
2212
- function ee(x) {
2213
- return R(x, function(O) {
2214
- var k = "";
2215
- return O > 65535 && (O -= 65536, k += j(O >>> 10 & 1023 | 55296), O = 56320 | O & 1023), k += j(O), k;
2216
- }).join("");
2217
- }
2218
- function L(x) {
2219
- return x - 48 < 10 ? x - 22 : x - 65 < 26 ? x - 65 : x - 97 < 26 ? x - 97 : s;
2220
- }
2221
- function V(x, O) {
2222
- return x + 22 + 75 * (x < 26) - ((O != 0) << 5);
2223
- }
2224
- function K(x, O, k) {
2225
- var A = 0;
2226
- for (x = k ? w(x / f) : x >> 1, x += w(x / O); x > S * u >> 1; A += s)
2227
- x = w(x / S);
2228
- return w(A + (S + 1) * x / (x + p));
2229
- }
2230
- function D(x) {
2231
- var O = [], k = x.length, A, q = 0, Q = h, B = d, Y, te, oe, ue, J, X, re, pe, me;
2232
- for (Y = x.lastIndexOf(m), Y < 0 && (Y = 0), te = 0; te < Y; ++te)
2233
- x.charCodeAt(te) >= 128 && E("not-basic"), O.push(x.charCodeAt(te));
2234
- for (oe = Y > 0 ? Y + 1 : 0; oe < k; ) {
2235
- for (ue = q, J = 1, X = s; oe >= k && E("invalid-input"), re = L(x.charCodeAt(oe++)), (re >= s || re > w((i - q) / J)) && E("overflow"), q += re * J, pe = X <= B ? l : X >= B + u ? u : X - B, !(re < pe); X += s)
2236
- me = s - pe, J > w(i / me) && E("overflow"), J *= me;
2237
- A = O.length + 1, B = K(q - ue, A, ue == 0), w(q / A) > i - Q && E("overflow"), Q += w(q / A), q %= A, O.splice(q++, 0, Q);
2238
- }
2239
- return ee(O);
2240
- }
2241
- function fe(x) {
2242
- var O, k, A, q, Q, B, Y, te, oe, ue, J, X = [], re, pe, me, ct;
2243
- for (x = Z(x), re = x.length, O = h, k = 0, Q = d, B = 0; B < re; ++B)
2244
- J = x[B], J < 128 && X.push(j(J));
2245
- for (A = q = X.length, q && X.push(m); A < re; ) {
2246
- for (Y = i, B = 0; B < re; ++B)
2247
- J = x[B], J >= O && J < Y && (Y = J);
2248
- for (pe = A + 1, Y - O > w((i - k) / pe) && E("overflow"), k += (Y - O) * pe, O = Y, B = 0; B < re; ++B)
2249
- if (J = x[B], J < O && ++k > i && E("overflow"), J == O) {
2250
- for (te = k, oe = s; ue = oe <= Q ? l : oe >= Q + u ? u : oe - Q, !(te < ue); oe += s)
2251
- ct = te - ue, me = s - ue, X.push(
2252
- j(V(ue + ct % me, 0))
2253
- ), te = w(ct / me);
2254
- X.push(j(V(te, 0))), Q = K(k, pe, A == q), k = 0, ++A;
2255
- }
2256
- ++k, ++O;
2257
- }
2258
- return X.join("");
2259
- }
2260
- function st(x) {
2261
- return _(x, function(O) {
2262
- return b.test(O) ? D(O.slice(4).toLowerCase()) : O;
2263
- });
2264
- }
2265
- function Me(x) {
2266
- return _(x, function(O) {
2267
- return v.test(O) ? "xn--" + fe(O) : O;
2268
- });
2269
- }
2270
- if (n = {
2271
- /**
2272
- * A string representing the current Punycode.js version number.
2273
- * @memberOf punycode
2274
- * @type String
2275
- */
2276
- version: "1.4.1",
2277
- /**
2278
- * An object of methods to convert from JavaScript's internal character
2279
- * representation (UCS-2) to Unicode code points, and back.
2280
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
2281
- * @memberOf punycode
2282
- * @type Object
2283
- */
2284
- ucs2: {
2285
- decode: Z,
2286
- encode: ee
2287
- },
2288
- decode: D,
2289
- encode: fe,
2290
- toASCII: Me,
2291
- toUnicode: st
2292
- }, o && c)
2293
- if (t.exports == o)
2294
- c.exports = n;
2295
- else
2296
- for (N in n)
2297
- n.hasOwnProperty(N) && (o[N] = n[N]);
2298
- else
2299
- r.punycode = n;
2300
- })(Ge);
2301
- })(et, et.exports);
2302
- var na = et.exports, oa = Error, aa = EvalError, ia = RangeError, sa = ReferenceError, Gr = SyntaxError, He = TypeError, ca = URIError, la = function() {
2303
- if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
2304
- return !1;
2305
- if (typeof Symbol.iterator == "symbol")
2306
- return !0;
2307
- var e = {}, r = Symbol("test"), o = Object(r);
2308
- if (typeof r == "string" || Object.prototype.toString.call(r) !== "[object Symbol]" || Object.prototype.toString.call(o) !== "[object Symbol]")
2309
- return !1;
2310
- var c = 42;
2311
- e[r] = c;
2312
- for (r in e)
2313
- return !1;
2314
- if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
2315
- return !1;
2316
- var a = Object.getOwnPropertySymbols(e);
2317
- if (a.length !== 1 || a[0] !== r || !Object.prototype.propertyIsEnumerable.call(e, r))
2318
- return !1;
2319
- if (typeof Object.getOwnPropertyDescriptor == "function") {
2320
- var n = Object.getOwnPropertyDescriptor(e, r);
2321
- if (n.value !== c || n.enumerable !== !0)
2322
- return !1;
2323
- }
2324
- return !0;
2325
- }, cr = typeof Symbol < "u" && Symbol, ua = la, fa = function() {
2326
- return typeof cr != "function" || typeof Symbol != "function" || typeof cr("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : ua();
2327
- }, ut = {
2328
- __proto__: null,
2329
- foo: {}
2330
- }, pa = Object, da = function() {
2331
- return { __proto__: ut }.foo === ut.foo && !(ut instanceof pa);
2332
- }, ha = "Function.prototype.bind called on incompatible ", ya = Object.prototype.toString, ma = Math.max, ga = "[object Function]", lr = function(e, r) {
2333
- for (var o = [], c = 0; c < e.length; c += 1)
2334
- o[c] = e[c];
2335
- for (var a = 0; a < r.length; a += 1)
2336
- o[a + e.length] = r[a];
2337
- return o;
2338
- }, ba = function(e, r) {
2339
- for (var o = [], c = r, a = 0; c < e.length; c += 1, a += 1)
2340
- o[a] = e[c];
2341
- return o;
2342
- }, va = function(t, e) {
2343
- for (var r = "", o = 0; o < t.length; o += 1)
2344
- r += t[o], o + 1 < t.length && (r += e);
2345
- return r;
2346
- }, $a = function(e) {
2347
- var r = this;
2348
- if (typeof r != "function" || ya.apply(r) !== ga)
2349
- throw new TypeError(ha + r);
2350
- for (var o = ba(arguments, 1), c, a = function() {
2351
- if (this instanceof c) {
2352
- var u = r.apply(
2353
- this,
2354
- lr(o, arguments)
2355
- );
2356
- return Object(u) === u ? u : this;
2357
- }
2358
- return r.apply(
2359
- e,
2360
- lr(o, arguments)
2361
- );
2362
- }, n = ma(0, r.length - o.length), i = [], s = 0; s < n; s++)
2363
- i[s] = "$" + s;
2364
- if (c = Function("binder", "return function (" + va(i, ",") + "){ return binder.apply(this,arguments); }")(a), r.prototype) {
2365
- var l = function() {
2366
- };
2367
- l.prototype = r.prototype, c.prototype = new l(), l.prototype = null;
2368
- }
2369
- return c;
2370
- }, xa = $a, Lt = Function.prototype.bind || xa, wa = Function.prototype.call, Sa = Object.prototype.hasOwnProperty, ja = Lt, Oa = ja.call(wa, Sa), T, Ta = oa, Pa = aa, ka = ia, Ea = sa, Pe = Gr, je = He, Ca = ca, Vr = Function, ft = function(t) {
2371
- try {
2372
- return Vr('"use strict"; return (' + t + ").constructor;")();
2373
- } catch {
2374
- }
2375
- }, be = Object.getOwnPropertyDescriptor;
2376
- if (be)
2377
- try {
2378
- be({}, "");
2379
- } catch {
2380
- be = null;
2381
- }
2382
- var pt = function() {
2383
- throw new je();
2384
- }, Na = be ? function() {
2385
- try {
2386
- return arguments.callee, pt;
2387
- } catch {
2388
- try {
2389
- return be(arguments, "callee").get;
2390
- } catch {
2391
- return pt;
2392
- }
2393
- }
2394
- }() : pt, $e = fa(), Ra = da(), F = Object.getPrototypeOf || (Ra ? function(t) {
2395
- return t.__proto__;
2396
- } : null), we = {}, Aa = typeof Uint8Array > "u" || !F ? T : F(Uint8Array), ve = {
2397
- __proto__: null,
2398
- "%AggregateError%": typeof AggregateError > "u" ? T : AggregateError,
2399
- "%Array%": Array,
2400
- "%ArrayBuffer%": typeof ArrayBuffer > "u" ? T : ArrayBuffer,
2401
- "%ArrayIteratorPrototype%": $e && F ? F([][Symbol.iterator]()) : T,
2402
- "%AsyncFromSyncIteratorPrototype%": T,
2403
- "%AsyncFunction%": we,
2404
- "%AsyncGenerator%": we,
2405
- "%AsyncGeneratorFunction%": we,
2406
- "%AsyncIteratorPrototype%": we,
2407
- "%Atomics%": typeof Atomics > "u" ? T : Atomics,
2408
- "%BigInt%": typeof BigInt > "u" ? T : BigInt,
2409
- "%BigInt64Array%": typeof BigInt64Array > "u" ? T : BigInt64Array,
2410
- "%BigUint64Array%": typeof BigUint64Array > "u" ? T : BigUint64Array,
2411
- "%Boolean%": Boolean,
2412
- "%DataView%": typeof DataView > "u" ? T : DataView,
2413
- "%Date%": Date,
2414
- "%decodeURI%": decodeURI,
2415
- "%decodeURIComponent%": decodeURIComponent,
2416
- "%encodeURI%": encodeURI,
2417
- "%encodeURIComponent%": encodeURIComponent,
2418
- "%Error%": Ta,
2419
- "%eval%": eval,
2420
- // eslint-disable-line no-eval
2421
- "%EvalError%": Pa,
2422
- "%Float32Array%": typeof Float32Array > "u" ? T : Float32Array,
2423
- "%Float64Array%": typeof Float64Array > "u" ? T : Float64Array,
2424
- "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? T : FinalizationRegistry,
2425
- "%Function%": Vr,
2426
- "%GeneratorFunction%": we,
2427
- "%Int8Array%": typeof Int8Array > "u" ? T : Int8Array,
2428
- "%Int16Array%": typeof Int16Array > "u" ? T : Int16Array,
2429
- "%Int32Array%": typeof Int32Array > "u" ? T : Int32Array,
2430
- "%isFinite%": isFinite,
2431
- "%isNaN%": isNaN,
2432
- "%IteratorPrototype%": $e && F ? F(F([][Symbol.iterator]())) : T,
2433
- "%JSON%": typeof JSON == "object" ? JSON : T,
2434
- "%Map%": typeof Map > "u" ? T : Map,
2435
- "%MapIteratorPrototype%": typeof Map > "u" || !$e || !F ? T : F((/* @__PURE__ */ new Map())[Symbol.iterator]()),
2436
- "%Math%": Math,
2437
- "%Number%": Number,
2438
- "%Object%": Object,
2439
- "%parseFloat%": parseFloat,
2440
- "%parseInt%": parseInt,
2441
- "%Promise%": typeof Promise > "u" ? T : Promise,
2442
- "%Proxy%": typeof Proxy > "u" ? T : Proxy,
2443
- "%RangeError%": ka,
2444
- "%ReferenceError%": Ea,
2445
- "%Reflect%": typeof Reflect > "u" ? T : Reflect,
2446
- "%RegExp%": RegExp,
2447
- "%Set%": typeof Set > "u" ? T : Set,
2448
- "%SetIteratorPrototype%": typeof Set > "u" || !$e || !F ? T : F((/* @__PURE__ */ new Set())[Symbol.iterator]()),
2449
- "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? T : SharedArrayBuffer,
2450
- "%String%": String,
2451
- "%StringIteratorPrototype%": $e && F ? F(""[Symbol.iterator]()) : T,
2452
- "%Symbol%": $e ? Symbol : T,
2453
- "%SyntaxError%": Pe,
2454
- "%ThrowTypeError%": Na,
2455
- "%TypedArray%": Aa,
2456
- "%TypeError%": je,
2457
- "%Uint8Array%": typeof Uint8Array > "u" ? T : Uint8Array,
2458
- "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? T : Uint8ClampedArray,
2459
- "%Uint16Array%": typeof Uint16Array > "u" ? T : Uint16Array,
2460
- "%Uint32Array%": typeof Uint32Array > "u" ? T : Uint32Array,
2461
- "%URIError%": Ca,
2462
- "%WeakMap%": typeof WeakMap > "u" ? T : WeakMap,
2463
- "%WeakRef%": typeof WeakRef > "u" ? T : WeakRef,
2464
- "%WeakSet%": typeof WeakSet > "u" ? T : WeakSet
2465
- };
2466
- if (F)
2467
- try {
2468
- null.error;
2469
- } catch (t) {
2470
- var qa = F(F(t));
2471
- ve["%Error.prototype%"] = qa;
2472
- }
2473
- var Ia = function t(e) {
2474
- var r;
2475
- if (e === "%AsyncFunction%")
2476
- r = ft("async function () {}");
2477
- else if (e === "%GeneratorFunction%")
2478
- r = ft("function* () {}");
2479
- else if (e === "%AsyncGeneratorFunction%")
2480
- r = ft("async function* () {}");
2481
- else if (e === "%AsyncGenerator%") {
2482
- var o = t("%AsyncGeneratorFunction%");
2483
- o && (r = o.prototype);
2484
- } else if (e === "%AsyncIteratorPrototype%") {
2485
- var c = t("%AsyncGenerator%");
2486
- c && F && (r = F(c.prototype));
2487
- }
2488
- return ve[e] = r, r;
2489
- }, ur = {
2490
- __proto__: null,
2491
- "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2492
- "%ArrayPrototype%": ["Array", "prototype"],
2493
- "%ArrayProto_entries%": ["Array", "prototype", "entries"],
2494
- "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
2495
- "%ArrayProto_keys%": ["Array", "prototype", "keys"],
2496
- "%ArrayProto_values%": ["Array", "prototype", "values"],
2497
- "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
2498
- "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
2499
- "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
2500
- "%BooleanPrototype%": ["Boolean", "prototype"],
2501
- "%DataViewPrototype%": ["DataView", "prototype"],
2502
- "%DatePrototype%": ["Date", "prototype"],
2503
- "%ErrorPrototype%": ["Error", "prototype"],
2504
- "%EvalErrorPrototype%": ["EvalError", "prototype"],
2505
- "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
2506
- "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
2507
- "%FunctionPrototype%": ["Function", "prototype"],
2508
- "%Generator%": ["GeneratorFunction", "prototype"],
2509
- "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
2510
- "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
2511
- "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
2512
- "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
2513
- "%JSONParse%": ["JSON", "parse"],
2514
- "%JSONStringify%": ["JSON", "stringify"],
2515
- "%MapPrototype%": ["Map", "prototype"],
2516
- "%NumberPrototype%": ["Number", "prototype"],
2517
- "%ObjectPrototype%": ["Object", "prototype"],
2518
- "%ObjProto_toString%": ["Object", "prototype", "toString"],
2519
- "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
2520
- "%PromisePrototype%": ["Promise", "prototype"],
2521
- "%PromiseProto_then%": ["Promise", "prototype", "then"],
2522
- "%Promise_all%": ["Promise", "all"],
2523
- "%Promise_reject%": ["Promise", "reject"],
2524
- "%Promise_resolve%": ["Promise", "resolve"],
2525
- "%RangeErrorPrototype%": ["RangeError", "prototype"],
2526
- "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
2527
- "%RegExpPrototype%": ["RegExp", "prototype"],
2528
- "%SetPrototype%": ["Set", "prototype"],
2529
- "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
2530
- "%StringPrototype%": ["String", "prototype"],
2531
- "%SymbolPrototype%": ["Symbol", "prototype"],
2532
- "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
2533
- "%TypedArrayPrototype%": ["TypedArray", "prototype"],
2534
- "%TypeErrorPrototype%": ["TypeError", "prototype"],
2535
- "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
2536
- "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
2537
- "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
2538
- "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
2539
- "%URIErrorPrototype%": ["URIError", "prototype"],
2540
- "%WeakMapPrototype%": ["WeakMap", "prototype"],
2541
- "%WeakSetPrototype%": ["WeakSet", "prototype"]
2542
- }, Be = Lt, tt = Oa, La = Be.call(Function.call, Array.prototype.concat), Ua = Be.call(Function.apply, Array.prototype.splice), fr = Be.call(Function.call, String.prototype.replace), rt = Be.call(Function.call, String.prototype.slice), _a = Be.call(Function.call, RegExp.prototype.exec), Fa = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Ha = /\\(\\)?/g, Ba = function(e) {
2543
- var r = rt(e, 0, 1), o = rt(e, -1);
2544
- if (r === "%" && o !== "%")
2545
- throw new Pe("invalid intrinsic syntax, expected closing `%`");
2546
- if (o === "%" && r !== "%")
2547
- throw new Pe("invalid intrinsic syntax, expected opening `%`");
2548
- var c = [];
2549
- return fr(e, Fa, function(a, n, i, s) {
2550
- c[c.length] = i ? fr(s, Ha, "$1") : n || a;
2551
- }), c;
2552
- }, Ma = function(e, r) {
2553
- var o = e, c;
2554
- if (tt(ur, o) && (c = ur[o], o = "%" + c[0] + "%"), tt(ve, o)) {
2555
- var a = ve[o];
2556
- if (a === we && (a = Ia(o)), typeof a > "u" && !r)
2557
- throw new je("intrinsic " + e + " exists, but is not available. Please file an issue!");
2558
- return {
2559
- alias: c,
2560
- name: o,
2561
- value: a
2562
- };
2563
- }
2564
- throw new Pe("intrinsic " + e + " does not exist!");
2565
- }, Ce = function(e, r) {
2566
- if (typeof e != "string" || e.length === 0)
2567
- throw new je("intrinsic name must be a non-empty string");
2568
- if (arguments.length > 1 && typeof r != "boolean")
2569
- throw new je('"allowMissing" argument must be a boolean');
2570
- if (_a(/^%?[^%]*%?$/, e) === null)
2571
- throw new Pe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
2572
- var o = Ba(e), c = o.length > 0 ? o[0] : "", a = Ma("%" + c + "%", r), n = a.name, i = a.value, s = !1, l = a.alias;
2573
- l && (c = l[0], Ua(o, La([0, 1], l)));
2574
- for (var u = 1, p = !0; u < o.length; u += 1) {
2575
- var f = o[u], d = rt(f, 0, 1), h = rt(f, -1);
2576
- if ((d === '"' || d === "'" || d === "`" || h === '"' || h === "'" || h === "`") && d !== h)
2577
- throw new Pe("property names with quotes must have matching quotes");
2578
- if ((f === "constructor" || !p) && (s = !0), c += "." + f, n = "%" + c + "%", tt(ve, n))
2579
- i = ve[n];
2580
- else if (i != null) {
2581
- if (!(f in i)) {
2582
- if (!r)
2583
- throw new je("base intrinsic for " + e + " exists, but the property is not available.");
2584
- return;
2585
- }
2586
- if (be && u + 1 >= o.length) {
2587
- var m = be(i, f);
2588
- p = !!m, p && "get" in m && !("originalValue" in m.get) ? i = m.get : i = i[f];
2589
- } else
2590
- p = tt(i, f), i = i[f];
2591
- p && !s && (ve[n] = i);
2592
- }
2593
- }
2594
- return i;
2595
- }, Kr = { exports: {} }, dt, pr;
2596
- function Ut() {
2597
- if (pr) return dt;
2598
- pr = 1;
2599
- var t = Ce, e = t("%Object.defineProperty%", !0) || !1;
2600
- if (e)
2601
- try {
2602
- e({}, "a", { value: 1 });
2603
- } catch {
2604
- e = !1;
2605
- }
2606
- return dt = e, dt;
2607
- }
2608
- var Wa = Ce, Ke = Wa("%Object.getOwnPropertyDescriptor%", !0);
2609
- if (Ke)
2610
- try {
2611
- Ke([], "length");
2612
- } catch {
2613
- Ke = null;
2614
- }
2615
- var Qr = Ke, dr = Ut(), Ja = Gr, xe = He, hr = Qr, za = function(e, r, o) {
2616
- if (!e || typeof e != "object" && typeof e != "function")
2617
- throw new xe("`obj` must be an object or a function`");
2618
- if (typeof r != "string" && typeof r != "symbol")
2619
- throw new xe("`property` must be a string or a symbol`");
2620
- if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
2621
- throw new xe("`nonEnumerable`, if provided, must be a boolean or null");
2622
- if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
2623
- throw new xe("`nonWritable`, if provided, must be a boolean or null");
2624
- if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
2625
- throw new xe("`nonConfigurable`, if provided, must be a boolean or null");
2626
- if (arguments.length > 6 && typeof arguments[6] != "boolean")
2627
- throw new xe("`loose`, if provided, must be a boolean");
2628
- var c = arguments.length > 3 ? arguments[3] : null, a = arguments.length > 4 ? arguments[4] : null, n = arguments.length > 5 ? arguments[5] : null, i = arguments.length > 6 ? arguments[6] : !1, s = !!hr && hr(e, r);
2629
- if (dr)
2630
- dr(e, r, {
2631
- configurable: n === null && s ? s.configurable : !n,
2632
- enumerable: c === null && s ? s.enumerable : !c,
2633
- value: o,
2634
- writable: a === null && s ? s.writable : !a
2635
- });
2636
- else if (i || !c && !a && !n)
2637
- e[r] = o;
2638
- else
2639
- throw new Ja("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
2640
- }, jt = Ut(), Dr = function() {
2641
- return !!jt;
2642
- };
2643
- Dr.hasArrayLengthDefineBug = function() {
2644
- if (!jt)
2645
- return null;
2646
- try {
2647
- return jt([], "length", { value: 1 }).length !== 1;
2648
- } catch {
2649
- return !0;
2650
- }
2651
- };
2652
- var Ga = Dr, Va = Ce, yr = za, Ka = Ga(), mr = Qr, gr = He, Qa = Va("%Math.floor%"), Da = function(e, r) {
2653
- if (typeof e != "function")
2654
- throw new gr("`fn` is not a function");
2655
- if (typeof r != "number" || r < 0 || r > 4294967295 || Qa(r) !== r)
2656
- throw new gr("`length` must be a positive 32-bit integer");
2657
- var o = arguments.length > 2 && !!arguments[2], c = !0, a = !0;
2658
- if ("length" in e && mr) {
2659
- var n = mr(e, "length");
2660
- n && !n.configurable && (c = !1), n && !n.writable && (a = !1);
2661
- }
2662
- return (c || a || !o) && (Ka ? yr(
2663
- /** @type {Parameters<define>[0]} */
2664
- e,
2665
- "length",
2666
- r,
2667
- !0,
2668
- !0
2669
- ) : yr(
2670
- /** @type {Parameters<define>[0]} */
2671
- e,
2672
- "length",
2673
- r
2674
- )), e;
2675
- };
2676
- (function(t) {
2677
- var e = Lt, r = Ce, o = Da, c = He, a = r("%Function.prototype.apply%"), n = r("%Function.prototype.call%"), i = r("%Reflect.apply%", !0) || e.call(n, a), s = Ut(), l = r("%Math.max%");
2678
- t.exports = function(f) {
2679
- if (typeof f != "function")
2680
- throw new c("a function is required");
2681
- var d = i(e, n, arguments);
2682
- return o(
2683
- d,
2684
- 1 + l(0, f.length - (arguments.length - 1)),
2685
- !0
2686
- );
2687
- };
2688
- var u = function() {
2689
- return i(e, a, arguments);
2690
- };
2691
- s ? s(t.exports, "apply", { value: u }) : t.exports.apply = u;
2692
- })(Kr);
2693
- var Ya = Kr.exports, Yr = Ce, Xr = Ya, Xa = Xr(Yr("String.prototype.indexOf")), Za = function(e, r) {
2694
- var o = Yr(e, !!r);
2695
- return typeof o == "function" && Xa(e, ".prototype.") > -1 ? Xr(o) : o;
2696
- };
2697
- const ei = {}, ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2698
- __proto__: null,
2699
- default: ei
2700
- }, Symbol.toStringTag, { value: "Module" })), ri = /* @__PURE__ */ Nn(ti);
2701
- var _t = typeof Map == "function" && Map.prototype, ht = Object.getOwnPropertyDescriptor && _t ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, nt = _t && ht && typeof ht.get == "function" ? ht.get : null, br = _t && Map.prototype.forEach, Ft = typeof Set == "function" && Set.prototype, yt = Object.getOwnPropertyDescriptor && Ft ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, ot = Ft && yt && typeof yt.get == "function" ? yt.get : null, vr = Ft && Set.prototype.forEach, ni = typeof WeakMap == "function" && WeakMap.prototype, qe = ni ? WeakMap.prototype.has : null, oi = typeof WeakSet == "function" && WeakSet.prototype, Ie = oi ? WeakSet.prototype.has : null, ai = typeof WeakRef == "function" && WeakRef.prototype, $r = ai ? WeakRef.prototype.deref : null, ii = Boolean.prototype.valueOf, si = Object.prototype.toString, ci = Function.prototype.toString, li = String.prototype.match, Ht = String.prototype.slice, he = String.prototype.replace, ui = String.prototype.toUpperCase, xr = String.prototype.toLowerCase, Zr = RegExp.prototype.test, wr = Array.prototype.concat, se = Array.prototype.join, fi = Array.prototype.slice, Sr = Math.floor, Ot = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, mt = Object.getOwnPropertySymbols, Tt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, ke = typeof Symbol == "function" && typeof Symbol.iterator == "object", G = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === ke || !0) ? Symbol.toStringTag : null, en = Object.prototype.propertyIsEnumerable, jr = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) {
2702
- return t.__proto__;
2703
- } : null);
2704
- function Or(t, e) {
2705
- if (t === 1 / 0 || t === -1 / 0 || t !== t || t && t > -1e3 && t < 1e3 || Zr.call(/e/, e))
2706
- return e;
2707
- var r = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
2708
- if (typeof t == "number") {
2709
- var o = t < 0 ? -Sr(-t) : Sr(t);
2710
- if (o !== t) {
2711
- var c = String(o), a = Ht.call(e, c.length + 1);
2712
- return he.call(c, r, "$&_") + "." + he.call(he.call(a, /([0-9]{3})/g, "$&_"), /_$/, "");
2713
- }
2714
- }
2715
- return he.call(e, r, "$&_");
2716
- }
2717
- var Pt = ri, Tr = Pt.custom, Pr = rn(Tr) ? Tr : null, pi = function t(e, r, o, c) {
2718
- var a = r || {};
2719
- if (de(a, "quoteStyle") && a.quoteStyle !== "single" && a.quoteStyle !== "double")
2720
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
2721
- if (de(a, "maxStringLength") && (typeof a.maxStringLength == "number" ? a.maxStringLength < 0 && a.maxStringLength !== 1 / 0 : a.maxStringLength !== null))
2722
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
2723
- var n = de(a, "customInspect") ? a.customInspect : !0;
2724
- if (typeof n != "boolean" && n !== "symbol")
2725
- throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
2726
- if (de(a, "indent") && a.indent !== null && a.indent !== " " && !(parseInt(a.indent, 10) === a.indent && a.indent > 0))
2727
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
2728
- if (de(a, "numericSeparator") && typeof a.numericSeparator != "boolean")
2729
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
2730
- var i = a.numericSeparator;
2731
- if (typeof e > "u")
2732
- return "undefined";
2733
- if (e === null)
2734
- return "null";
2735
- if (typeof e == "boolean")
2736
- return e ? "true" : "false";
2737
- if (typeof e == "string")
2738
- return on(e, a);
2739
- if (typeof e == "number") {
2740
- if (e === 0)
2741
- return 1 / 0 / e > 0 ? "0" : "-0";
2742
- var s = String(e);
2743
- return i ? Or(e, s) : s;
2744
- }
2745
- if (typeof e == "bigint") {
2746
- var l = String(e) + "n";
2747
- return i ? Or(e, l) : l;
2748
- }
2749
- var u = typeof a.depth > "u" ? 5 : a.depth;
2750
- if (typeof o > "u" && (o = 0), o >= u && u > 0 && typeof e == "object")
2751
- return kt(e) ? "[Array]" : "[Object]";
2752
- var p = Ci(a, o);
2753
- if (typeof c > "u")
2754
- c = [];
2755
- else if (nn(c, e) >= 0)
2756
- return "[Circular]";
2757
- function f(L, V, K) {
2758
- if (V && (c = fi.call(c), c.push(V)), K) {
2759
- var D = {
2760
- depth: a.depth
2761
- };
2762
- return de(a, "quoteStyle") && (D.quoteStyle = a.quoteStyle), t(L, D, o + 1, c);
2763
- }
2764
- return t(L, a, o + 1, c);
2765
- }
2766
- if (typeof e == "function" && !kr(e)) {
2767
- var d = xi(e), h = We(e, f);
2768
- return "[Function" + (d ? ": " + d : " (anonymous)") + "]" + (h.length > 0 ? " { " + se.call(h, ", ") + " }" : "");
2769
- }
2770
- if (rn(e)) {
2771
- var m = ke ? he.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Tt.call(e);
2772
- return typeof e == "object" && !ke ? Re(m) : m;
2773
- }
2774
- if (Pi(e)) {
2775
- for (var b = "<" + xr.call(String(e.nodeName)), v = e.attributes || [], y = 0; y < v.length; y++)
2776
- b += " " + v[y].name + "=" + tn(di(v[y].value), "double", a);
2777
- return b += ">", e.childNodes && e.childNodes.length && (b += "..."), b += "</" + xr.call(String(e.nodeName)) + ">", b;
2778
- }
2779
- if (kt(e)) {
2780
- if (e.length === 0)
2781
- return "[]";
2782
- var $ = We(e, f);
2783
- return p && !Ei($) ? "[" + Et($, p) + "]" : "[ " + se.call($, ", ") + " ]";
2784
- }
2785
- if (yi(e)) {
2786
- var S = We(e, f);
2787
- return !("cause" in Error.prototype) && "cause" in e && !en.call(e, "cause") ? "{ [" + String(e) + "] " + se.call(wr.call("[cause]: " + f(e.cause), S), ", ") + " }" : S.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + se.call(S, ", ") + " }";
2788
- }
2789
- if (typeof e == "object" && n) {
2790
- if (Pr && typeof e[Pr] == "function" && Pt)
2791
- return Pt(e, { depth: u - o });
2792
- if (n !== "symbol" && typeof e.inspect == "function")
2793
- return e.inspect();
2794
- }
2795
- if (wi(e)) {
2796
- var w = [];
2797
- return br && br.call(e, function(L, V) {
2798
- w.push(f(V, e, !0) + " => " + f(L, e));
2799
- }), Er("Map", nt.call(e), w, p);
2800
- }
2801
- if (Oi(e)) {
2802
- var j = [];
2803
- return vr && vr.call(e, function(L) {
2804
- j.push(f(L, e));
2805
- }), Er("Set", ot.call(e), j, p);
2806
- }
2807
- if (Si(e))
2808
- return gt("WeakMap");
2809
- if (Ti(e))
2810
- return gt("WeakSet");
2811
- if (ji(e))
2812
- return gt("WeakRef");
2813
- if (gi(e))
2814
- return Re(f(Number(e)));
2815
- if (vi(e))
2816
- return Re(f(Ot.call(e)));
2817
- if (bi(e))
2818
- return Re(ii.call(e));
2819
- if (mi(e))
2820
- return Re(f(String(e)));
2821
- if (typeof window < "u" && e === window)
2822
- return "{ [object Window] }";
2823
- if (e === Ge)
2824
- return "{ [object globalThis] }";
2825
- if (!hi(e) && !kr(e)) {
2826
- var N = We(e, f), E = jr ? jr(e) === Object.prototype : e instanceof Object || e.constructor === Object, R = e instanceof Object ? "" : "null prototype", _ = !E && G && Object(e) === e && G in e ? Ht.call(ye(e), 8, -1) : R ? "Object" : "", Z = E || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", ee = Z + (_ || R ? "[" + se.call(wr.call([], _ || [], R || []), ": ") + "] " : "");
2827
- return N.length === 0 ? ee + "{}" : p ? ee + "{" + Et(N, p) + "}" : ee + "{ " + se.call(N, ", ") + " }";
2828
- }
2829
- return String(e);
2830
- };
2831
- function tn(t, e, r) {
2832
- var o = (r.quoteStyle || e) === "double" ? '"' : "'";
2833
- return o + t + o;
2834
- }
2835
- function di(t) {
2836
- return he.call(String(t), /"/g, "&quot;");
2837
- }
2838
- function kt(t) {
2839
- return ye(t) === "[object Array]" && (!G || !(typeof t == "object" && G in t));
2840
- }
2841
- function hi(t) {
2842
- return ye(t) === "[object Date]" && (!G || !(typeof t == "object" && G in t));
2843
- }
2844
- function kr(t) {
2845
- return ye(t) === "[object RegExp]" && (!G || !(typeof t == "object" && G in t));
2846
- }
2847
- function yi(t) {
2848
- return ye(t) === "[object Error]" && (!G || !(typeof t == "object" && G in t));
2849
- }
2850
- function mi(t) {
2851
- return ye(t) === "[object String]" && (!G || !(typeof t == "object" && G in t));
2852
- }
2853
- function gi(t) {
2854
- return ye(t) === "[object Number]" && (!G || !(typeof t == "object" && G in t));
2855
- }
2856
- function bi(t) {
2857
- return ye(t) === "[object Boolean]" && (!G || !(typeof t == "object" && G in t));
2858
- }
2859
- function rn(t) {
2860
- if (ke)
2861
- return t && typeof t == "object" && t instanceof Symbol;
2862
- if (typeof t == "symbol")
2863
- return !0;
2864
- if (!t || typeof t != "object" || !Tt)
2865
- return !1;
2866
- try {
2867
- return Tt.call(t), !0;
2868
- } catch {
2869
- }
2870
- return !1;
2871
- }
2872
- function vi(t) {
2873
- if (!t || typeof t != "object" || !Ot)
2874
- return !1;
2875
- try {
2876
- return Ot.call(t), !0;
2877
- } catch {
2878
- }
2879
- return !1;
2880
- }
2881
- var $i = Object.prototype.hasOwnProperty || function(t) {
2882
- return t in this;
2883
- };
2884
- function de(t, e) {
2885
- return $i.call(t, e);
2886
- }
2887
- function ye(t) {
2888
- return si.call(t);
2889
- }
2890
- function xi(t) {
2891
- if (t.name)
2892
- return t.name;
2893
- var e = li.call(ci.call(t), /^function\s*([\w$]+)/);
2894
- return e ? e[1] : null;
2895
- }
2896
- function nn(t, e) {
2897
- if (t.indexOf)
2898
- return t.indexOf(e);
2899
- for (var r = 0, o = t.length; r < o; r++)
2900
- if (t[r] === e)
2901
- return r;
2902
- return -1;
2903
- }
2904
- function wi(t) {
2905
- if (!nt || !t || typeof t != "object")
2906
- return !1;
2907
- try {
2908
- nt.call(t);
2909
- try {
2910
- ot.call(t);
2911
- } catch {
2912
- return !0;
2913
- }
2914
- return t instanceof Map;
2915
- } catch {
2916
- }
2917
- return !1;
2918
- }
2919
- function Si(t) {
2920
- if (!qe || !t || typeof t != "object")
2921
- return !1;
2922
- try {
2923
- qe.call(t, qe);
2924
- try {
2925
- Ie.call(t, Ie);
2926
- } catch {
2927
- return !0;
2928
- }
2929
- return t instanceof WeakMap;
2930
- } catch {
2931
- }
2932
- return !1;
2933
- }
2934
- function ji(t) {
2935
- if (!$r || !t || typeof t != "object")
2936
- return !1;
2937
- try {
2938
- return $r.call(t), !0;
2939
- } catch {
2940
- }
2941
- return !1;
2942
- }
2943
- function Oi(t) {
2944
- if (!ot || !t || typeof t != "object")
2945
- return !1;
2946
- try {
2947
- ot.call(t);
2948
- try {
2949
- nt.call(t);
2950
- } catch {
2951
- return !0;
2952
- }
2953
- return t instanceof Set;
2954
- } catch {
2955
- }
2956
- return !1;
2957
- }
2958
- function Ti(t) {
2959
- if (!Ie || !t || typeof t != "object")
2960
- return !1;
2961
- try {
2962
- Ie.call(t, Ie);
2963
- try {
2964
- qe.call(t, qe);
2965
- } catch {
2966
- return !0;
2967
- }
2968
- return t instanceof WeakSet;
2969
- } catch {
2970
- }
2971
- return !1;
2972
- }
2973
- function Pi(t) {
2974
- return !t || typeof t != "object" ? !1 : typeof HTMLElement < "u" && t instanceof HTMLElement ? !0 : typeof t.nodeName == "string" && typeof t.getAttribute == "function";
2975
- }
2976
- function on(t, e) {
2977
- if (t.length > e.maxStringLength) {
2978
- var r = t.length - e.maxStringLength, o = "... " + r + " more character" + (r > 1 ? "s" : "");
2979
- return on(Ht.call(t, 0, e.maxStringLength), e) + o;
2980
- }
2981
- var c = he.call(he.call(t, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, ki);
2982
- return tn(c, "single", e);
2983
- }
2984
- function ki(t) {
2985
- var e = t.charCodeAt(0), r = {
2986
- 8: "b",
2987
- 9: "t",
2988
- 10: "n",
2989
- 12: "f",
2990
- 13: "r"
2991
- }[e];
2992
- return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + ui.call(e.toString(16));
2993
- }
2994
- function Re(t) {
2995
- return "Object(" + t + ")";
2996
- }
2997
- function gt(t) {
2998
- return t + " { ? }";
2999
- }
3000
- function Er(t, e, r, o) {
3001
- var c = o ? Et(r, o) : se.call(r, ", ");
3002
- return t + " (" + e + ") {" + c + "}";
3003
- }
3004
- function Ei(t) {
3005
- for (var e = 0; e < t.length; e++)
3006
- if (nn(t[e], `
3007
- `) >= 0)
3008
- return !1;
3009
- return !0;
3010
- }
3011
- function Ci(t, e) {
3012
- var r;
3013
- if (t.indent === " ")
3014
- r = " ";
3015
- else if (typeof t.indent == "number" && t.indent > 0)
3016
- r = se.call(Array(t.indent + 1), " ");
3017
- else
3018
- return null;
3019
- return {
3020
- base: r,
3021
- prev: se.call(Array(e + 1), r)
3022
- };
3023
- }
3024
- function Et(t, e) {
3025
- if (t.length === 0)
3026
- return "";
3027
- var r = `
3028
- ` + e.prev + e.base;
3029
- return r + se.call(t, "," + r) + `
3030
- ` + e.prev;
3031
- }
3032
- function We(t, e) {
3033
- var r = kt(t), o = [];
3034
- if (r) {
3035
- o.length = t.length;
3036
- for (var c = 0; c < t.length; c++)
3037
- o[c] = de(t, c) ? e(t[c], t) : "";
3038
- }
3039
- var a = typeof mt == "function" ? mt(t) : [], n;
3040
- if (ke) {
3041
- n = {};
3042
- for (var i = 0; i < a.length; i++)
3043
- n["$" + a[i]] = a[i];
3044
- }
3045
- for (var s in t)
3046
- de(t, s) && (r && String(Number(s)) === s && s < t.length || ke && n["$" + s] instanceof Symbol || (Zr.call(/[^\w$]/, s) ? o.push(e(s, t) + ": " + e(t[s], t)) : o.push(s + ": " + e(t[s], t))));
3047
- if (typeof mt == "function")
3048
- for (var l = 0; l < a.length; l++)
3049
- en.call(t, a[l]) && o.push("[" + e(a[l]) + "]: " + e(t[a[l]], t));
3050
- return o;
3051
- }
3052
- var an = Ce, Ne = Za, Ni = pi, Ri = He, Je = an("%WeakMap%", !0), ze = an("%Map%", !0), Ai = Ne("WeakMap.prototype.get", !0), qi = Ne("WeakMap.prototype.set", !0), Ii = Ne("WeakMap.prototype.has", !0), Li = Ne("Map.prototype.get", !0), Ui = Ne("Map.prototype.set", !0), _i = Ne("Map.prototype.has", !0), Bt = function(t, e) {
3053
- for (var r = t, o; (o = r.next) !== null; r = o)
3054
- if (o.key === e)
3055
- return r.next = o.next, o.next = /** @type {NonNullable<typeof list.next>} */
3056
- t.next, t.next = o, o;
3057
- }, Fi = function(t, e) {
3058
- var r = Bt(t, e);
3059
- return r && r.value;
3060
- }, Hi = function(t, e, r) {
3061
- var o = Bt(t, e);
3062
- o ? o.value = r : t.next = /** @type {import('.').ListNode<typeof value>} */
3063
- {
3064
- // eslint-disable-line no-param-reassign, no-extra-parens
3065
- key: e,
3066
- next: t.next,
3067
- value: r
3068
- };
3069
- }, Bi = function(t, e) {
3070
- return !!Bt(t, e);
3071
- }, Mi = function() {
3072
- var e, r, o, c = {
3073
- assert: function(a) {
3074
- if (!c.has(a))
3075
- throw new Ri("Side channel does not contain " + Ni(a));
3076
- },
3077
- get: function(a) {
3078
- if (Je && a && (typeof a == "object" || typeof a == "function")) {
3079
- if (e)
3080
- return Ai(e, a);
3081
- } else if (ze) {
3082
- if (r)
3083
- return Li(r, a);
3084
- } else if (o)
3085
- return Fi(o, a);
3086
- },
3087
- has: function(a) {
3088
- if (Je && a && (typeof a == "object" || typeof a == "function")) {
3089
- if (e)
3090
- return Ii(e, a);
3091
- } else if (ze) {
3092
- if (r)
3093
- return _i(r, a);
3094
- } else if (o)
3095
- return Bi(o, a);
3096
- return !1;
3097
- },
3098
- set: function(a, n) {
3099
- Je && a && (typeof a == "object" || typeof a == "function") ? (e || (e = new Je()), qi(e, a, n)) : ze ? (r || (r = new ze()), Ui(r, a, n)) : (o || (o = { key: {}, next: null }), Hi(o, a, n));
3100
- }
3101
- };
3102
- return c;
3103
- }, Wi = String.prototype.replace, Ji = /%20/g, bt = {
3104
- RFC1738: "RFC1738",
3105
- RFC3986: "RFC3986"
3106
- }, Mt = {
3107
- default: bt.RFC3986,
3108
- formatters: {
3109
- RFC1738: function(t) {
3110
- return Wi.call(t, Ji, "+");
3111
- },
3112
- RFC3986: function(t) {
3113
- return String(t);
3114
- }
3115
- },
3116
- RFC1738: bt.RFC1738,
3117
- RFC3986: bt.RFC3986
3118
- }, zi = Mt, vt = Object.prototype.hasOwnProperty, ge = Array.isArray, ae = function() {
3119
- for (var t = [], e = 0; e < 256; ++e)
3120
- t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
3121
- return t;
3122
- }(), Gi = function(e) {
3123
- for (; e.length > 1; ) {
3124
- var r = e.pop(), o = r.obj[r.prop];
3125
- if (ge(o)) {
3126
- for (var c = [], a = 0; a < o.length; ++a)
3127
- typeof o[a] < "u" && c.push(o[a]);
3128
- r.obj[r.prop] = c;
3129
- }
3130
- }
3131
- }, sn = function(e, r) {
3132
- for (var o = r && r.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, c = 0; c < e.length; ++c)
3133
- typeof e[c] < "u" && (o[c] = e[c]);
3134
- return o;
3135
- }, Vi = function t(e, r, o) {
3136
- if (!r)
3137
- return e;
3138
- if (typeof r != "object") {
3139
- if (ge(e))
3140
- e.push(r);
3141
- else if (e && typeof e == "object")
3142
- (o && (o.plainObjects || o.allowPrototypes) || !vt.call(Object.prototype, r)) && (e[r] = !0);
3143
- else
3144
- return [e, r];
3145
- return e;
3146
- }
3147
- if (!e || typeof e != "object")
3148
- return [e].concat(r);
3149
- var c = e;
3150
- return ge(e) && !ge(r) && (c = sn(e, o)), ge(e) && ge(r) ? (r.forEach(function(a, n) {
3151
- if (vt.call(e, n)) {
3152
- var i = e[n];
3153
- i && typeof i == "object" && a && typeof a == "object" ? e[n] = t(i, a, o) : e.push(a);
3154
- } else
3155
- e[n] = a;
3156
- }), e) : Object.keys(r).reduce(function(a, n) {
3157
- var i = r[n];
3158
- return vt.call(a, n) ? a[n] = t(a[n], i, o) : a[n] = i, a;
3159
- }, c);
3160
- }, Ki = function(e, r) {
3161
- return Object.keys(r).reduce(function(o, c) {
3162
- return o[c] = r[c], o;
3163
- }, e);
3164
- }, Qi = function(t, e, r) {
3165
- var o = t.replace(/\+/g, " ");
3166
- if (r === "iso-8859-1")
3167
- return o.replace(/%[0-9a-f]{2}/gi, unescape);
3168
- try {
3169
- return decodeURIComponent(o);
3170
- } catch {
3171
- return o;
3172
- }
3173
- }, $t = 1024, Di = function(e, r, o, c, a) {
3174
- if (e.length === 0)
3175
- return e;
3176
- var n = e;
3177
- if (typeof e == "symbol" ? n = Symbol.prototype.toString.call(e) : typeof e != "string" && (n = String(e)), o === "iso-8859-1")
3178
- return escape(n).replace(/%u[0-9a-f]{4}/gi, function(d) {
3179
- return "%26%23" + parseInt(d.slice(2), 16) + "%3B";
3180
- });
3181
- for (var i = "", s = 0; s < n.length; s += $t) {
3182
- for (var l = n.length >= $t ? n.slice(s, s + $t) : n, u = [], p = 0; p < l.length; ++p) {
3183
- var f = l.charCodeAt(p);
3184
- if (f === 45 || f === 46 || f === 95 || f === 126 || f >= 48 && f <= 57 || f >= 65 && f <= 90 || f >= 97 && f <= 122 || a === zi.RFC1738 && (f === 40 || f === 41)) {
3185
- u[u.length] = l.charAt(p);
3186
- continue;
3187
- }
3188
- if (f < 128) {
3189
- u[u.length] = ae[f];
3190
- continue;
3191
- }
3192
- if (f < 2048) {
3193
- u[u.length] = ae[192 | f >> 6] + ae[128 | f & 63];
3194
- continue;
3195
- }
3196
- if (f < 55296 || f >= 57344) {
3197
- u[u.length] = ae[224 | f >> 12] + ae[128 | f >> 6 & 63] + ae[128 | f & 63];
3198
- continue;
3199
- }
3200
- p += 1, f = 65536 + ((f & 1023) << 10 | l.charCodeAt(p) & 1023), u[u.length] = ae[240 | f >> 18] + ae[128 | f >> 12 & 63] + ae[128 | f >> 6 & 63] + ae[128 | f & 63];
3201
- }
3202
- i += u.join("");
3203
- }
3204
- return i;
3205
- }, Yi = function(e) {
3206
- for (var r = [{ obj: { o: e }, prop: "o" }], o = [], c = 0; c < r.length; ++c)
3207
- for (var a = r[c], n = a.obj[a.prop], i = Object.keys(n), s = 0; s < i.length; ++s) {
3208
- var l = i[s], u = n[l];
3209
- typeof u == "object" && u !== null && o.indexOf(u) === -1 && (r.push({ obj: n, prop: l }), o.push(u));
3210
- }
3211
- return Gi(r), e;
3212
- }, Xi = function(e) {
3213
- return Object.prototype.toString.call(e) === "[object RegExp]";
3214
- }, Zi = function(e) {
3215
- return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
3216
- }, es = function(e, r) {
3217
- return [].concat(e, r);
3218
- }, ts = function(e, r) {
3219
- if (ge(e)) {
3220
- for (var o = [], c = 0; c < e.length; c += 1)
3221
- o.push(r(e[c]));
3222
- return o;
3223
- }
3224
- return r(e);
3225
- }, cn = {
3226
- arrayToObject: sn,
3227
- assign: Ki,
3228
- combine: es,
3229
- compact: Yi,
3230
- decode: Qi,
3231
- encode: Di,
3232
- isBuffer: Zi,
3233
- isRegExp: Xi,
3234
- maybeMap: ts,
3235
- merge: Vi
3236
- }, ln = Mi, Qe = cn, Le = Mt, rs = Object.prototype.hasOwnProperty, un = {
3237
- brackets: function(e) {
3238
- return e + "[]";
3239
- },
3240
- comma: "comma",
3241
- indices: function(e, r) {
3242
- return e + "[" + r + "]";
3243
- },
3244
- repeat: function(e) {
3245
- return e;
3246
- }
3247
- }, ie = Array.isArray, ns = Array.prototype.push, fn = function(t, e) {
3248
- ns.apply(t, ie(e) ? e : [e]);
3249
- }, os = Date.prototype.toISOString, Cr = Le.default, U = {
3250
- addQueryPrefix: !1,
3251
- allowDots: !1,
3252
- allowEmptyArrays: !1,
3253
- arrayFormat: "indices",
3254
- charset: "utf-8",
3255
- charsetSentinel: !1,
3256
- delimiter: "&",
3257
- encode: !0,
3258
- encodeDotInKeys: !1,
3259
- encoder: Qe.encode,
3260
- encodeValuesOnly: !1,
3261
- format: Cr,
3262
- formatter: Le.formatters[Cr],
3263
- // deprecated
3264
- indices: !1,
3265
- serializeDate: function(e) {
3266
- return os.call(e);
3267
- },
3268
- skipNulls: !1,
3269
- strictNullHandling: !1
3270
- }, as = function(e) {
3271
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
3272
- }, xt = {}, is = function t(e, r, o, c, a, n, i, s, l, u, p, f, d, h, m, b, v, y) {
3273
- for (var $ = e, S = y, w = 0, j = !1; (S = S.get(xt)) !== void 0 && !j; ) {
3274
- var N = S.get(e);
3275
- if (w += 1, typeof N < "u") {
3276
- if (N === w)
3277
- throw new RangeError("Cyclic object value");
3278
- j = !0;
3279
- }
3280
- typeof S.get(xt) > "u" && (w = 0);
3281
- }
3282
- if (typeof u == "function" ? $ = u(r, $) : $ instanceof Date ? $ = d($) : o === "comma" && ie($) && ($ = Qe.maybeMap($, function(x) {
3283
- return x instanceof Date ? d(x) : x;
3284
- })), $ === null) {
3285
- if (n)
3286
- return l && !b ? l(r, U.encoder, v, "key", h) : r;
3287
- $ = "";
3288
- }
3289
- if (as($) || Qe.isBuffer($)) {
3290
- if (l) {
3291
- var E = b ? r : l(r, U.encoder, v, "key", h);
3292
- return [m(E) + "=" + m(l($, U.encoder, v, "value", h))];
3293
- }
3294
- return [m(r) + "=" + m(String($))];
3295
- }
3296
- var R = [];
3297
- if (typeof $ > "u")
3298
- return R;
3299
- var _;
3300
- if (o === "comma" && ie($))
3301
- b && l && ($ = Qe.maybeMap($, l)), _ = [{ value: $.length > 0 ? $.join(",") || null : void 0 }];
3302
- else if (ie(u))
3303
- _ = u;
3304
- else {
3305
- var Z = Object.keys($);
3306
- _ = p ? Z.sort(p) : Z;
3307
- }
3308
- var ee = s ? r.replace(/\./g, "%2E") : r, L = c && ie($) && $.length === 1 ? ee + "[]" : ee;
3309
- if (a && ie($) && $.length === 0)
3310
- return L + "[]";
3311
- for (var V = 0; V < _.length; ++V) {
3312
- var K = _[V], D = typeof K == "object" && typeof K.value < "u" ? K.value : $[K];
3313
- if (!(i && D === null)) {
3314
- var fe = f && s ? K.replace(/\./g, "%2E") : K, st = ie($) ? typeof o == "function" ? o(L, fe) : L : L + (f ? "." + fe : "[" + fe + "]");
3315
- y.set(e, w);
3316
- var Me = ln();
3317
- Me.set(xt, y), fn(R, t(
3318
- D,
3319
- st,
3320
- o,
3321
- c,
3322
- a,
3323
- n,
3324
- i,
3325
- s,
3326
- o === "comma" && b && ie($) ? null : l,
3327
- u,
3328
- p,
3329
- f,
3330
- d,
3331
- h,
3332
- m,
3333
- b,
3334
- v,
3335
- Me
3336
- ));
3337
- }
3338
- }
3339
- return R;
3340
- }, ss = function(e) {
3341
- if (!e)
3342
- return U;
3343
- if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3344
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3345
- if (typeof e.encodeDotInKeys < "u" && typeof e.encodeDotInKeys != "boolean")
3346
- throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
3347
- if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
3348
- throw new TypeError("Encoder has to be a function.");
3349
- var r = e.charset || U.charset;
3350
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3351
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3352
- var o = Le.default;
3353
- if (typeof e.format < "u") {
3354
- if (!rs.call(Le.formatters, e.format))
3355
- throw new TypeError("Unknown format option provided.");
3356
- o = e.format;
3357
- }
3358
- var c = Le.formatters[o], a = U.filter;
3359
- (typeof e.filter == "function" || ie(e.filter)) && (a = e.filter);
3360
- var n;
3361
- if (e.arrayFormat in un ? n = e.arrayFormat : "indices" in e ? n = e.indices ? "indices" : "repeat" : n = U.arrayFormat, "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
3362
- throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
3363
- var i = typeof e.allowDots > "u" ? e.encodeDotInKeys === !0 ? !0 : U.allowDots : !!e.allowDots;
3364
- return {
3365
- addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : U.addQueryPrefix,
3366
- allowDots: i,
3367
- allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : U.allowEmptyArrays,
3368
- arrayFormat: n,
3369
- charset: r,
3370
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : U.charsetSentinel,
3371
- commaRoundTrip: e.commaRoundTrip,
3372
- delimiter: typeof e.delimiter > "u" ? U.delimiter : e.delimiter,
3373
- encode: typeof e.encode == "boolean" ? e.encode : U.encode,
3374
- encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys : U.encodeDotInKeys,
3375
- encoder: typeof e.encoder == "function" ? e.encoder : U.encoder,
3376
- encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : U.encodeValuesOnly,
3377
- filter: a,
3378
- format: o,
3379
- formatter: c,
3380
- serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : U.serializeDate,
3381
- skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : U.skipNulls,
3382
- sort: typeof e.sort == "function" ? e.sort : null,
3383
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : U.strictNullHandling
3384
- };
3385
- }, cs = function(t, e) {
3386
- var r = t, o = ss(e), c, a;
3387
- typeof o.filter == "function" ? (a = o.filter, r = a("", r)) : ie(o.filter) && (a = o.filter, c = a);
3388
- var n = [];
3389
- if (typeof r != "object" || r === null)
3390
- return "";
3391
- var i = un[o.arrayFormat], s = i === "comma" && o.commaRoundTrip;
3392
- c || (c = Object.keys(r)), o.sort && c.sort(o.sort);
3393
- for (var l = ln(), u = 0; u < c.length; ++u) {
3394
- var p = c[u];
3395
- o.skipNulls && r[p] === null || fn(n, is(
3396
- r[p],
3397
- p,
3398
- i,
3399
- s,
3400
- o.allowEmptyArrays,
3401
- o.strictNullHandling,
3402
- o.skipNulls,
3403
- o.encodeDotInKeys,
3404
- o.encode ? o.encoder : null,
3405
- o.filter,
3406
- o.sort,
3407
- o.allowDots,
3408
- o.serializeDate,
3409
- o.format,
3410
- o.formatter,
3411
- o.encodeValuesOnly,
3412
- o.charset,
3413
- l
3414
- ));
3415
- }
3416
- var f = n.join(o.delimiter), d = o.addQueryPrefix === !0 ? "?" : "";
3417
- return o.charsetSentinel && (o.charset === "iso-8859-1" ? d += "utf8=%26%2310003%3B&" : d += "utf8=%E2%9C%93&"), f.length > 0 ? d + f : "";
3418
- }, Ee = cn, Ct = Object.prototype.hasOwnProperty, ls = Array.isArray, I = {
3419
- allowDots: !1,
3420
- allowEmptyArrays: !1,
3421
- allowPrototypes: !1,
3422
- allowSparse: !1,
3423
- arrayLimit: 20,
3424
- charset: "utf-8",
3425
- charsetSentinel: !1,
3426
- comma: !1,
3427
- decodeDotInKeys: !1,
3428
- decoder: Ee.decode,
3429
- delimiter: "&",
3430
- depth: 5,
3431
- duplicates: "combine",
3432
- ignoreQueryPrefix: !1,
3433
- interpretNumericEntities: !1,
3434
- parameterLimit: 1e3,
3435
- parseArrays: !0,
3436
- plainObjects: !1,
3437
- strictNullHandling: !1
3438
- }, us = function(t) {
3439
- return t.replace(/&#(\d+);/g, function(e, r) {
3440
- return String.fromCharCode(parseInt(r, 10));
3441
- });
3442
- }, pn = function(t, e) {
3443
- return t && typeof t == "string" && e.comma && t.indexOf(",") > -1 ? t.split(",") : t;
3444
- }, fs = "utf8=%26%2310003%3B", ps = "utf8=%E2%9C%93", ds = function(e, r) {
3445
- var o = { __proto__: null }, c = r.ignoreQueryPrefix ? e.replace(/^\?/, "") : e, a = r.parameterLimit === 1 / 0 ? void 0 : r.parameterLimit, n = c.split(r.delimiter, a), i = -1, s, l = r.charset;
3446
- if (r.charsetSentinel)
3447
- for (s = 0; s < n.length; ++s)
3448
- n[s].indexOf("utf8=") === 0 && (n[s] === ps ? l = "utf-8" : n[s] === fs && (l = "iso-8859-1"), i = s, s = n.length);
3449
- for (s = 0; s < n.length; ++s)
3450
- if (s !== i) {
3451
- var u = n[s], p = u.indexOf("]="), f = p === -1 ? u.indexOf("=") : p + 1, d, h;
3452
- f === -1 ? (d = r.decoder(u, I.decoder, l, "key"), h = r.strictNullHandling ? null : "") : (d = r.decoder(u.slice(0, f), I.decoder, l, "key"), h = Ee.maybeMap(
3453
- pn(u.slice(f + 1), r),
3454
- function(b) {
3455
- return r.decoder(b, I.decoder, l, "value");
3456
- }
3457
- )), h && r.interpretNumericEntities && l === "iso-8859-1" && (h = us(h)), u.indexOf("[]=") > -1 && (h = ls(h) ? [h] : h);
3458
- var m = Ct.call(o, d);
3459
- m && r.duplicates === "combine" ? o[d] = Ee.combine(o[d], h) : (!m || r.duplicates === "last") && (o[d] = h);
3460
- }
3461
- return o;
3462
- }, hs = function(t, e, r, o) {
3463
- for (var c = o ? e : pn(e, r), a = t.length - 1; a >= 0; --a) {
3464
- var n, i = t[a];
3465
- if (i === "[]" && r.parseArrays)
3466
- n = r.allowEmptyArrays && c === "" ? [] : [].concat(c);
3467
- else {
3468
- n = r.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
3469
- var s = i.charAt(0) === "[" && i.charAt(i.length - 1) === "]" ? i.slice(1, -1) : i, l = r.decodeDotInKeys ? s.replace(/%2E/g, ".") : s, u = parseInt(l, 10);
3470
- !r.parseArrays && l === "" ? n = { 0: c } : !isNaN(u) && i !== l && String(u) === l && u >= 0 && r.parseArrays && u <= r.arrayLimit ? (n = [], n[u] = c) : l !== "__proto__" && (n[l] = c);
3471
- }
3472
- c = n;
3473
- }
3474
- return c;
3475
- }, ys = function(e, r, o, c) {
3476
- if (e) {
3477
- var a = o.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, n = /(\[[^[\]]*])/, i = /(\[[^[\]]*])/g, s = o.depth > 0 && n.exec(a), l = s ? a.slice(0, s.index) : a, u = [];
3478
- if (l) {
3479
- if (!o.plainObjects && Ct.call(Object.prototype, l) && !o.allowPrototypes)
3480
- return;
3481
- u.push(l);
3482
- }
3483
- for (var p = 0; o.depth > 0 && (s = i.exec(a)) !== null && p < o.depth; ) {
3484
- if (p += 1, !o.plainObjects && Ct.call(Object.prototype, s[1].slice(1, -1)) && !o.allowPrototypes)
3485
- return;
3486
- u.push(s[1]);
3487
- }
3488
- return s && u.push("[" + a.slice(s.index) + "]"), hs(u, r, o, c);
3489
- }
3490
- }, ms = function(e) {
3491
- if (!e)
3492
- return I;
3493
- if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3494
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3495
- if (typeof e.decodeDotInKeys < "u" && typeof e.decodeDotInKeys != "boolean")
3496
- throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
3497
- if (e.decoder !== null && typeof e.decoder < "u" && typeof e.decoder != "function")
3498
- throw new TypeError("Decoder has to be a function.");
3499
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3500
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3501
- var r = typeof e.charset > "u" ? I.charset : e.charset, o = typeof e.duplicates > "u" ? I.duplicates : e.duplicates;
3502
- if (o !== "combine" && o !== "first" && o !== "last")
3503
- throw new TypeError("The duplicates option must be either combine, first, or last");
3504
- var c = typeof e.allowDots > "u" ? e.decodeDotInKeys === !0 ? !0 : I.allowDots : !!e.allowDots;
3505
- return {
3506
- allowDots: c,
3507
- allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : I.allowEmptyArrays,
3508
- allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : I.allowPrototypes,
3509
- allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : I.allowSparse,
3510
- arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : I.arrayLimit,
3511
- charset: r,
3512
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : I.charsetSentinel,
3513
- comma: typeof e.comma == "boolean" ? e.comma : I.comma,
3514
- decodeDotInKeys: typeof e.decodeDotInKeys == "boolean" ? e.decodeDotInKeys : I.decodeDotInKeys,
3515
- decoder: typeof e.decoder == "function" ? e.decoder : I.decoder,
3516
- delimiter: typeof e.delimiter == "string" || Ee.isRegExp(e.delimiter) ? e.delimiter : I.delimiter,
3517
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
3518
- depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : I.depth,
3519
- duplicates: o,
3520
- ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
3521
- interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : I.interpretNumericEntities,
3522
- parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : I.parameterLimit,
3523
- parseArrays: e.parseArrays !== !1,
3524
- plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : I.plainObjects,
3525
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : I.strictNullHandling
3526
- };
3527
- }, gs = function(t, e) {
3528
- var r = ms(e);
3529
- if (t === "" || t === null || typeof t > "u")
3530
- return r.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
3531
- for (var o = typeof t == "string" ? ds(t, r) : t, c = r.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, a = Object.keys(o), n = 0; n < a.length; ++n) {
3532
- var i = a[n], s = ys(i, o[i], r, typeof t == "string");
3533
- c = Ee.merge(c, s, r);
3534
- }
3535
- return r.allowSparse === !0 ? c : Ee.compact(c);
3536
- }, bs = cs, vs = gs, $s = Mt, De = {
3537
- formats: $s,
3538
- parse: vs,
3539
- stringify: bs
3540
- }, xs = na;
3541
- function ne() {
3542
- this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;
3543
- }
3544
- var ws = /^([a-z0-9.+-]+:)/i, Ss = /:[0-9]*$/, js = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/, Os = [
3545
- "<",
3546
- ">",
3547
- '"',
3548
- "`",
3549
- " ",
3550
- "\r",
3551
- `
3552
- `,
3553
- " "
3554
- ], Ts = [
3555
- "{",
3556
- "}",
3557
- "|",
3558
- "\\",
3559
- "^",
3560
- "`"
3561
- ].concat(Os), Nt = ["'"].concat(Ts), Nr = [
3562
- "%",
3563
- "/",
3564
- "?",
3565
- ";",
3566
- "#"
3567
- ].concat(Nt), Rr = [
3568
- "/",
3569
- "?",
3570
- "#"
3571
- ], Ps = 255, Ar = /^[+a-z0-9A-Z_-]{0,63}$/, ks = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, Es = {
3572
- javascript: !0,
3573
- "javascript:": !0
3574
- }, Rt = {
3575
- javascript: !0,
3576
- "javascript:": !0
3577
- }, Oe = {
3578
- http: !0,
3579
- https: !0,
3580
- ftp: !0,
3581
- gopher: !0,
3582
- file: !0,
3583
- "http:": !0,
3584
- "https:": !0,
3585
- "ftp:": !0,
3586
- "gopher:": !0,
3587
- "file:": !0
3588
- }, At = De;
3589
- function Wt(t, e, r) {
3590
- if (t && typeof t == "object" && t instanceof ne)
3591
- return t;
3592
- var o = new ne();
3593
- return o.parse(t, e, r), o;
3594
- }
3595
- ne.prototype.parse = function(t, e, r) {
3596
- if (typeof t != "string")
3597
- throw new TypeError("Parameter 'url' must be a string, not " + typeof t);
3598
- var o = t.indexOf("?"), c = o !== -1 && o < t.indexOf("#") ? "?" : "#", a = t.split(c), n = /\\/g;
3599
- a[0] = a[0].replace(n, "/"), t = a.join(c);
3600
- var i = t;
3601
- if (i = i.trim(), !r && t.split("#").length === 1) {
3602
- var s = js.exec(i);
3603
- if (s)
3604
- return this.path = i, this.href = i, this.pathname = s[1], s[2] ? (this.search = s[2], e ? this.query = At.parse(this.search.substr(1)) : this.query = this.search.substr(1)) : e && (this.search = "", this.query = {}), this;
3605
- }
3606
- var l = ws.exec(i);
3607
- if (l) {
3608
- l = l[0];
3609
- var u = l.toLowerCase();
3610
- this.protocol = u, i = i.substr(l.length);
3611
- }
3612
- if (r || l || i.match(/^\/\/[^@/]+@[^@/]+/)) {
3613
- var p = i.substr(0, 2) === "//";
3614
- p && !(l && Rt[l]) && (i = i.substr(2), this.slashes = !0);
3615
- }
3616
- if (!Rt[l] && (p || l && !Oe[l])) {
3617
- for (var f = -1, d = 0; d < Rr.length; d++) {
3618
- var h = i.indexOf(Rr[d]);
3619
- h !== -1 && (f === -1 || h < f) && (f = h);
3620
- }
3621
- var m, b;
3622
- f === -1 ? b = i.lastIndexOf("@") : b = i.lastIndexOf("@", f), b !== -1 && (m = i.slice(0, b), i = i.slice(b + 1), this.auth = decodeURIComponent(m)), f = -1;
3623
- for (var d = 0; d < Nr.length; d++) {
3624
- var h = i.indexOf(Nr[d]);
3625
- h !== -1 && (f === -1 || h < f) && (f = h);
3626
- }
3627
- f === -1 && (f = i.length), this.host = i.slice(0, f), i = i.slice(f), this.parseHost(), this.hostname = this.hostname || "";
3628
- var v = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
3629
- if (!v)
3630
- for (var y = this.hostname.split(/\./), d = 0, $ = y.length; d < $; d++) {
3631
- var S = y[d];
3632
- if (S && !S.match(Ar)) {
3633
- for (var w = "", j = 0, N = S.length; j < N; j++)
3634
- S.charCodeAt(j) > 127 ? w += "x" : w += S[j];
3635
- if (!w.match(Ar)) {
3636
- var E = y.slice(0, d), R = y.slice(d + 1), _ = S.match(ks);
3637
- _ && (E.push(_[1]), R.unshift(_[2])), R.length && (i = "/" + R.join(".") + i), this.hostname = E.join(".");
3638
- break;
3639
- }
3640
- }
3641
- }
3642
- this.hostname.length > Ps ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), v || (this.hostname = xs.toASCII(this.hostname));
3643
- var Z = this.port ? ":" + this.port : "", ee = this.hostname || "";
3644
- this.host = ee + Z, this.href += this.host, v && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), i[0] !== "/" && (i = "/" + i));
3645
- }
3646
- if (!Es[u])
3647
- for (var d = 0, $ = Nt.length; d < $; d++) {
3648
- var L = Nt[d];
3649
- if (i.indexOf(L) !== -1) {
3650
- var V = encodeURIComponent(L);
3651
- V === L && (V = escape(L)), i = i.split(L).join(V);
3652
- }
3653
- }
3654
- var K = i.indexOf("#");
3655
- K !== -1 && (this.hash = i.substr(K), i = i.slice(0, K));
3656
- var D = i.indexOf("?");
3657
- if (D !== -1 ? (this.search = i.substr(D), this.query = i.substr(D + 1), e && (this.query = At.parse(this.query)), i = i.slice(0, D)) : e && (this.search = "", this.query = {}), i && (this.pathname = i), Oe[u] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
3658
- var Z = this.pathname || "", fe = this.search || "";
3659
- this.path = Z + fe;
3660
- }
3661
- return this.href = this.format(), this;
3662
- };
3663
- function Cs(t) {
3664
- return typeof t == "string" && (t = Wt(t)), t instanceof ne ? t.format() : ne.prototype.format.call(t);
3665
- }
3666
- ne.prototype.format = function() {
3667
- var t = this.auth || "";
3668
- t && (t = encodeURIComponent(t), t = t.replace(/%3A/i, ":"), t += "@");
3669
- var e = this.protocol || "", r = this.pathname || "", o = this.hash || "", c = !1, a = "";
3670
- this.host ? c = t + this.host : this.hostname && (c = t + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (c += ":" + this.port)), this.query && typeof this.query == "object" && Object.keys(this.query).length && (a = At.stringify(this.query, {
3671
- arrayFormat: "repeat",
3672
- addQueryPrefix: !1
3673
- }));
3674
- var n = this.search || a && "?" + a || "";
3675
- return e && e.substr(-1) !== ":" && (e += ":"), this.slashes || (!e || Oe[e]) && c !== !1 ? (c = "//" + (c || ""), r && r.charAt(0) !== "/" && (r = "/" + r)) : c || (c = ""), o && o.charAt(0) !== "#" && (o = "#" + o), n && n.charAt(0) !== "?" && (n = "?" + n), r = r.replace(/[?#]/g, function(i) {
3676
- return encodeURIComponent(i);
3677
- }), n = n.replace("#", "%23"), e + c + r + n + o;
3678
- };
3679
- ne.prototype.resolve = function(t) {
3680
- return this.resolveObject(Wt(t, !1, !0)).format();
3681
- };
3682
- ne.prototype.resolveObject = function(t) {
3683
- if (typeof t == "string") {
3684
- var e = new ne();
3685
- e.parse(t, !1, !0), t = e;
3686
- }
3687
- for (var r = new ne(), o = Object.keys(this), c = 0; c < o.length; c++) {
3688
- var a = o[c];
3689
- r[a] = this[a];
3690
- }
3691
- if (r.hash = t.hash, t.href === "")
3692
- return r.href = r.format(), r;
3693
- if (t.slashes && !t.protocol) {
3694
- for (var n = Object.keys(t), i = 0; i < n.length; i++) {
3695
- var s = n[i];
3696
- s !== "protocol" && (r[s] = t[s]);
3697
- }
3698
- return Oe[r.protocol] && r.hostname && !r.pathname && (r.pathname = "/", r.path = r.pathname), r.href = r.format(), r;
3699
- }
3700
- if (t.protocol && t.protocol !== r.protocol) {
3701
- if (!Oe[t.protocol]) {
3702
- for (var l = Object.keys(t), u = 0; u < l.length; u++) {
3703
- var p = l[u];
3704
- r[p] = t[p];
3705
- }
3706
- return r.href = r.format(), r;
3707
- }
3708
- if (r.protocol = t.protocol, !t.host && !Rt[t.protocol]) {
3709
- for (var $ = (t.pathname || "").split("/"); $.length && !(t.host = $.shift()); )
3710
- ;
3711
- t.host || (t.host = ""), t.hostname || (t.hostname = ""), $[0] !== "" && $.unshift(""), $.length < 2 && $.unshift(""), r.pathname = $.join("/");
3712
- } else
3713
- r.pathname = t.pathname;
3714
- if (r.search = t.search, r.query = t.query, r.host = t.host || "", r.auth = t.auth, r.hostname = t.hostname || t.host, r.port = t.port, r.pathname || r.search) {
3715
- var f = r.pathname || "", d = r.search || "";
3716
- r.path = f + d;
3717
- }
3718
- return r.slashes = r.slashes || t.slashes, r.href = r.format(), r;
3719
- }
3720
- var h = r.pathname && r.pathname.charAt(0) === "/", m = t.host || t.pathname && t.pathname.charAt(0) === "/", b = m || h || r.host && t.pathname, v = b, y = r.pathname && r.pathname.split("/") || [], $ = t.pathname && t.pathname.split("/") || [], S = r.protocol && !Oe[r.protocol];
3721
- if (S && (r.hostname = "", r.port = null, r.host && (y[0] === "" ? y[0] = r.host : y.unshift(r.host)), r.host = "", t.protocol && (t.hostname = null, t.port = null, t.host && ($[0] === "" ? $[0] = t.host : $.unshift(t.host)), t.host = null), b = b && ($[0] === "" || y[0] === "")), m)
3722
- r.host = t.host || t.host === "" ? t.host : r.host, r.hostname = t.hostname || t.hostname === "" ? t.hostname : r.hostname, r.search = t.search, r.query = t.query, y = $;
3723
- else if ($.length)
3724
- y || (y = []), y.pop(), y = y.concat($), r.search = t.search, r.query = t.query;
3725
- else if (t.search != null) {
3726
- if (S) {
3727
- r.host = y.shift(), r.hostname = r.host;
3728
- var w = r.host && r.host.indexOf("@") > 0 ? r.host.split("@") : !1;
3729
- w && (r.auth = w.shift(), r.hostname = w.shift(), r.host = r.hostname);
3730
- }
3731
- return r.search = t.search, r.query = t.query, (r.pathname !== null || r.search !== null) && (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.href = r.format(), r;
3732
- }
3733
- if (!y.length)
3734
- return r.pathname = null, r.search ? r.path = "/" + r.search : r.path = null, r.href = r.format(), r;
3735
- for (var j = y.slice(-1)[0], N = (r.host || t.host || y.length > 1) && (j === "." || j === "..") || j === "", E = 0, R = y.length; R >= 0; R--)
3736
- j = y[R], j === "." ? y.splice(R, 1) : j === ".." ? (y.splice(R, 1), E++) : E && (y.splice(R, 1), E--);
3737
- if (!b && !v)
3738
- for (; E--; E)
3739
- y.unshift("..");
3740
- b && y[0] !== "" && (!y[0] || y[0].charAt(0) !== "/") && y.unshift(""), N && y.join("/").substr(-1) !== "/" && y.push("");
3741
- var _ = y[0] === "" || y[0] && y[0].charAt(0) === "/";
3742
- if (S) {
3743
- r.hostname = _ ? "" : y.length ? y.shift() : "", r.host = r.hostname;
3744
- var w = r.host && r.host.indexOf("@") > 0 ? r.host.split("@") : !1;
3745
- w && (r.auth = w.shift(), r.hostname = w.shift(), r.host = r.hostname);
3746
- }
3747
- return b = b || r.host && y.length, b && !_ && y.unshift(""), y.length > 0 ? r.pathname = y.join("/") : (r.pathname = null, r.path = null), (r.pathname !== null || r.search !== null) && (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.auth = t.auth || r.auth, r.slashes = r.slashes || t.slashes, r.href = r.format(), r;
3748
- };
3749
- ne.prototype.parseHost = function() {
3750
- var t = this.host, e = Ss.exec(t);
3751
- e && (e = e[0], e !== ":" && (this.port = e.substr(1)), t = t.substr(0, t.length - e.length)), t && (this.hostname = t);
3752
- };
3753
- var Ns = Wt, qr = Cs, Rs = (t) => typeof t == "object" && "log" in t && typeof t.log == "object" && "entries" in t.log && Array.isArray(t.log.entries), As = class {
3754
- constructor(t, e = {}) {
3755
- this.initCalled = !1, this.entries = [], this.requests = [], this.options = {}, this.options = {
3756
- harIsAlreadyEncoded: !1,
3757
- ...e
3758
- }, this.requests = [], Rs(t) ? this.entries = t.log.entries : this.entries = [
3759
- {
3760
- request: t
3761
- }
3762
- ];
3763
- }
3764
- init() {
3765
- return this.initCalled = !0, this.requests = this.entries.map(({ request: t }) => {
3766
- var r;
3767
- const e = {
3768
- bodySize: 0,
3769
- headersSize: 0,
3770
- headers: [],
3771
- cookies: [],
3772
- httpVersion: "HTTP/1.1",
3773
- queryString: [],
3774
- postData: {
3775
- mimeType: ((r = t.postData) == null ? void 0 : r.mimeType) || "application/octet-stream"
3776
- },
3777
- ...t
3778
- };
3779
- return e.postData && !e.postData.mimeType && (e.postData.mimeType = "application/octet-stream"), this.prepare(e, this.options);
3780
- }), this;
3781
- }
3782
- prepare(t, e) {
3783
- var u, p, f;
3784
- const r = {
3785
- ...t,
3786
- fullUrl: "",
3787
- uriObj: {},
3788
- queryObj: {},
3789
- headersObj: {},
3790
- cookiesObj: {},
3791
- allHeaders: {}
3792
- };
3793
- if (r.queryString && r.queryString.length && (r.queryObj = r.queryString.reduce(Yt, {})), r.headers && r.headers.length) {
3794
- const d = /^HTTP\/2/;
3795
- r.headersObj = r.headers.reduce((h, { name: m, value: b }) => {
3796
- const v = d.exec(r.httpVersion) ? m.toLocaleLowerCase() : m;
3797
- return {
3798
- ...h,
3799
- [v]: b
3800
- };
3801
- }, {});
3802
- }
3803
- r.cookies && r.cookies.length && (r.cookiesObj = r.cookies.reduceRight(
3804
- (d, { name: h, value: m }) => ({
3805
- ...d,
3806
- [h]: m
3807
- }),
3808
- {}
3809
- ));
3810
- const o = (u = r.cookies) == null ? void 0 : u.map(({ name: d, value: h }) => e.harIsAlreadyEncoded ? `${d}=${h}` : `${encodeURIComponent(d)}=${encodeURIComponent(h)}`);
3811
- switch (o != null && o.length && (r.allHeaders.cookie = o.join("; ")), r.postData.mimeType) {
3812
- case "multipart/mixed":
3813
- case "multipart/related":
3814
- case "multipart/form-data":
3815
- case "multipart/alternative":
3816
- if (r.postData.text = "", r.postData.mimeType = "multipart/form-data", (p = r.postData) != null && p.params) {
3817
- const d = "---011000010111000001101001", h = `${d}--`, m = `\r
3818
- `, b = (S) => S.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), v = (S) => S.replace(/\r?\n|\r/g, `\r
3819
- `), y = [`--${d}`];
3820
- (f = r.postData) == null || f.params.forEach((S, w) => {
3821
- const j = S.name, N = S.value || "", E = S.fileName || null, R = S.contentType || "application/octet-stream";
3822
- E ? (y.push(
3823
- `Content-Disposition: form-data; name="${b(v(j))}"; filename="${E}"`
3824
- ), y.push(`Content-Type: ${R}`)) : y.push(`Content-Disposition: form-data; name="${b(v(j))}"`), y.push(""), y.push(v(N)), w !== r.postData.params.length - 1 && y.push(`--${d}`);
3825
- }), y.push(`--${h}`), r.postData.boundary = d, r.postData.text = y.join(m);
3826
- const $ = z(r.headersObj, "content-type") || "content-type";
3827
- r.headersObj[$] = `multipart/form-data; boundary=${d}`;
3828
- }
3829
- break;
3830
- case "application/x-www-form-urlencoded":
3831
- r.postData.params ? (r.postData.paramsObj = r.postData.params.reduce(Yt, {}), r.postData.text = De.stringify(r.postData.paramsObj)) : r.postData.text = "";
3832
- break;
3833
- case "text/json":
3834
- case "text/x-json":
3835
- case "application/json":
3836
- case "application/x-json":
3837
- if (r.postData.mimeType = "application/json", r.postData.text)
3838
- try {
3839
- r.postData.jsonObj = JSON.parse(r.postData.text);
3840
- } catch {
3841
- r.postData.mimeType = "text/plain";
3842
- }
3843
- break;
3844
- }
3845
- const c = {
3846
- ...r.allHeaders,
3847
- ...r.headersObj
3848
- }, a = Ns(r.url, !0, !0);
3849
- r.queryObj = {
3850
- ...r.queryObj,
3851
- ...a.query
3852
- };
3853
- let n;
3854
- e.harIsAlreadyEncoded ? n = De.stringify(r.queryObj, {
3855
- encode: !1,
3856
- indices: !1
3857
- }) : n = De.stringify(r.queryObj, {
3858
- indices: !1
3859
- });
3860
- const i = {
3861
- ...a,
3862
- query: r.queryObj,
3863
- search: n,
3864
- path: n ? `${a.pathname}?${n}` : a.pathname
3865
- }, s = qr({
3866
- ...a,
3867
- query: null,
3868
- search: null
3869
- }), l = qr({
3870
- ...a,
3871
- ...i
3872
- });
3873
- return {
3874
- ...r,
3875
- allHeaders: c,
3876
- fullUrl: l,
3877
- url: s,
3878
- uriObj: i
3879
- };
3880
- }
3881
- convert(t, e, r) {
3882
- this.initCalled || this.init(), !r && e && (r = e);
3883
- const o = ra[t];
3884
- if (!o)
3885
- return !1;
3886
- const { convert: c } = o.clientsById[e || o.info.default];
3887
- return this.requests.map((n) => c(n, r));
3888
- }
3889
- };
3890
- const qs = ({
3891
- server: t,
3892
- operation: e
3893
- }) => {
3894
- var a, n, i;
3895
- const r = (a = e.parameters) == null ? void 0 : a.filter((s) => s.in === "header").map((s) => {
3896
- var l, u;
3897
- return {
3898
- name: s.name,
3899
- defaultValue: ((u = (l = s.examples) == null ? void 0 : l.find((p) => p.value)) == null ? void 0 : u.value) ?? ""
3900
- };
3901
- }), o = (n = e.parameters) == null ? void 0 : n.filter((s) => s.in === "query").sort((s, l) => s.required && !l.required ? -1 : 1).map((s) => ({
3902
- name: s.name,
3903
- defaultActive: s.required ?? !1,
3904
- isRequired: s.required ?? !1
3905
- })), c = (i = e.parameters) == null ? void 0 : i.filter((s) => s.in === "path").map((s) => ({ name: s.name }));
3906
- return /* @__PURE__ */ g.jsx(
3907
- yn,
3908
- {
3909
- server: t,
3910
- method: e.method,
3911
- url: e.path,
3912
- headers: r,
3913
- queryParams: o,
3914
- pathParams: c
3915
- }
3916
- );
3917
- }, Jt = ({ children: t, className: e }) => /* @__PURE__ */ g.jsx(
3918
- "div",
3919
- {
3920
- className: le(
3921
- "rounded-lg overflow-hidden border dark:border-transparent",
3922
- e
3923
- ),
3924
- children: t
3925
- }
3926
- ), zt = ({ children: t, className: e }) => /* @__PURE__ */ g.jsx(
3927
- "div",
3928
- {
3929
- className: le(
3930
- "border-b dark:border-zinc-600 bg-zinc-100 dark:bg-zinc-700 p-2",
3931
- e
3932
- ),
3933
- children: t
3934
- }
3935
- ), Gt = ({ children: t, className: e }) => /* @__PURE__ */ g.jsx(
3936
- "div",
3937
- {
3938
- className: le("bg-zinc-50 dark:bg-zinc-800 overflow-auto p-2", e),
3939
- children: t
3940
- }
3941
- ), dn = ({ children: t, className: e }) => /* @__PURE__ */ g.jsx(
3942
- "div",
3943
- {
3944
- className: le(
3945
- "border-t dark:border-zinc-600 bg-zinc-100 dark:bg-zinc-700 p-2",
3946
- e
3947
- ),
3948
- children: t
3949
- }
3950
- ), Is = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Fe = (t, e) => t.example !== void 0 ? t.example : t.default !== void 0 ? t.default : t.examples && Is(t.examples) ? Object.values(t.examples)[0] : Ls(t);
3951
- function Ls(t, e) {
3952
- const r = Object.entries(t.properties ?? {}).concat(
3953
- Object.entries(t.additionalProperties ?? {})
3954
- );
3955
- if (t.type === "object" && r.length > 0) {
3956
- const o = {};
3957
- return r.forEach(([c, a]) => {
3958
- const n = Fe(a);
3959
- n !== void 0 && (o[c] = n);
3960
- }), o;
3961
- } else if (t.type === "array" && t.items) {
3962
- const o = Fe(t.items);
3963
- return o !== void 0 ? [o] : [];
3964
- }
3965
- }
3966
- const Us = ({ content: t }) => {
3967
- var e;
3968
- return t.length ? /* @__PURE__ */ g.jsx(g.Fragment, { children: /* @__PURE__ */ g.jsxs(Jt, { children: [
3969
- /* @__PURE__ */ g.jsx(zt, { className: "text-xs flex justify-between items-center", children: /* @__PURE__ */ g.jsx("span", { className: "font-mono", children: "Request Body Example" }) }),
3970
- /* @__PURE__ */ g.jsx(Gt, { children: /* @__PURE__ */ g.jsx(
3971
- at,
3972
- {
3973
- language: "json",
3974
- noBackground: !0,
3975
- copyable: !0,
3976
- className: "text-xs",
3977
- code: JSON.stringify(
3978
- (e = t.at(0)) != null && e.schema ? Fe(t[0].schema) : "",
3979
- null,
3980
- 2
3981
- )
3982
- }
3983
- ) })
3984
- ] }) }) : null;
3985
- }, _s = ({
3986
- responses: t
3987
- }) => {
3988
- var a, n;
3989
- const [e, r] = Br(0), c = (n = (a = t[e].content) == null ? void 0 : a[0]) == null ? void 0 : n.schema;
3990
- return /* @__PURE__ */ g.jsxs(Jt, { children: [
3991
- /* @__PURE__ */ g.jsxs(zt, { className: "text-xs grid grid-rows-2 pb-0", children: [
3992
- /* @__PURE__ */ g.jsx("span", { className: "font-mono", children: "Example Responses" }),
3993
- /* @__PURE__ */ g.jsx("div", { className: "flex gap-2", children: t.map((i, s) => /* @__PURE__ */ g.jsx(
3994
- "div",
3995
- {
3996
- onClick: () => r(s),
3997
- className: le(
3998
- "text-xs font-mono px-1.5 py-1 pb-px translate-y-px border-b-2 border-transparent rounded-t cursor-pointer",
3999
- e === s ? "text-primary dark:text-inherit border-primary" : "hover:border-accent-foreground/25"
4000
- ),
4001
- children: i.statusCode
4002
- },
4003
- i.statusCode
4004
- )) })
4005
- ] }),
4006
- /* @__PURE__ */ g.jsx(Gt, { children: c ? /* @__PURE__ */ g.jsx(
4007
- at,
4008
- {
4009
- language: "json",
4010
- noBackground: !0,
4011
- className: "text-xs",
4012
- code: JSON.stringify(Fe(c), null, 2)
4013
- }
4014
- ) : /* @__PURE__ */ g.jsx("span", { className: "text-muted-foreground font-mono italic text-xs", children: "Empty Response" }) }),
4015
- /* @__PURE__ */ g.jsx(dn, { className: "flex justify-end text-xs", children: t[e].description })
4016
- ] });
4017
- }, Fs = (t, e) => {
4018
- let r;
4019
- switch (e) {
4020
- case "shell":
4021
- r = t.convert("shell", "curl");
4022
- break;
4023
- case "js":
4024
- r = t.convert("javascript", "fetch");
4025
- break;
4026
- case "python":
4027
- r = t.convert("python", "requests");
4028
- break;
4029
- case "java":
4030
- r = t.convert("java", "okhttp");
4031
- break;
4032
- case "go":
4033
- r = t.convert("go", "native");
4034
- break;
4035
- case "csharp":
4036
- r = t.convert("csharp", "httpclient");
4037
- break;
4038
- case "kotlin":
4039
- r = t.convert("kotlin", "okhttp");
4040
- break;
4041
- case "objc":
4042
- r = t.convert("objc", "nsurlsession");
4043
- break;
4044
- case "php":
4045
- r = t.convert("php", "http2");
4046
- break;
4047
- case "ruby":
4048
- r = t.convert("ruby");
4049
- break;
4050
- case "swift":
4051
- r = t.convert("swift");
4052
- break;
4053
- default:
4054
- r = t.convert("shell");
4055
- break;
4056
- }
4057
- return r ? r[0] : "";
4058
- }, Hs = qt(
4059
- /* GraphQL */
4060
- `
4061
- query getServerQuery($input: JSON!, $type: SchemaType!) {
4062
- schema(input: $input, type: $type) {
4063
- url
4064
- }
4065
- }
4066
- `
4067
- ), Bs = { suspense: !0 }, Ms = ({
4068
- operation: t
4069
- }) => {
4070
- var p, f;
4071
- const e = Fr(), [r] = Hr({
4072
- query: Hs,
4073
- variables: e,
4074
- context: Bs
4075
- }), o = mn[t.method], [c, a] = Rn(), [, n] = Tn(), i = c.get("lang") ?? "shell", s = (p = t.requestBody) == null ? void 0 : p.content, l = t.path.split("/").map((d) => /* @__PURE__ */ g.jsxs(Pn, { children: [
4076
- d.startsWith("{") && d.endsWith("}") ? /* @__PURE__ */ g.jsx(
4077
- Ir,
4078
- {
4079
- name: d.slice(1, -1),
4080
- backgroundOpacity: "0",
4081
- slug: t.slug + "-" + d.slice(1, -1).toLocaleLowerCase(),
4082
- children: d
4083
- }
4084
- ) : d,
4085
- "/",
4086
- /* @__PURE__ */ g.jsx("wbr", {})
4087
- ] }, d)), u = kn(() => {
4088
- var m;
4089
- const d = (m = s == null ? void 0 : s[0]) != null && m.schema ? Fe(s[0].schema) : void 0, h = new As(
4090
- {
4091
- method: t.method.toLocaleUpperCase(),
4092
- url: t.path.replaceAll("{", ":").replaceAll("}", ""),
4093
- headers: [{ name: "Authorization", value: "Bearer <token>" }],
4094
- postData: d ? {
4095
- text: JSON.stringify(d, null, 2),
4096
- mimeType: "application/json"
4097
- } : {}
4098
- }
4099
- // 👈 never touch this
4100
- );
4101
- return Fs(h, i);
4102
- }, [i, t.method, t.path, s]);
4103
- return /* @__PURE__ */ g.jsxs("aside", { className: "flex flex-col overflow-hidden sticky top-[--scroll-padding] gap-4", children: [
4104
- /* @__PURE__ */ g.jsxs(Jt, { children: [
4105
- /* @__PURE__ */ g.jsxs(zt, { className: "flex justify-between items-center flex-nowrap py-3 gap-2 text-xs", children: [
4106
- /* @__PURE__ */ g.jsxs("span", { className: "font-mono break-words", children: [
4107
- /* @__PURE__ */ g.jsx("span", { className: le("font-semibold", o), children: t.method.toLocaleUpperCase() }),
4108
- " ",
4109
- l
4110
- ] }),
4111
- /* @__PURE__ */ g.jsx(
4112
- qs,
4113
- {
4114
- server: ((f = r.data) == null ? void 0 : f.schema.url) ?? "",
4115
- operation: t
4116
- }
4117
- )
4118
- ] }),
4119
- /* @__PURE__ */ g.jsx(Gt, { children: /* @__PURE__ */ g.jsx(
4120
- at,
4121
- {
4122
- language: i,
4123
- noBackground: !0,
4124
- className: "text-xs",
4125
- code: u
4126
- }
4127
- ) }),
4128
- /* @__PURE__ */ g.jsxs(dn, { className: "flex items-center text-xs gap-2 justify-end py-1", children: [
4129
- /* @__PURE__ */ g.jsx("span", { children: "Show example in" }),
4130
- /* @__PURE__ */ g.jsx(
4131
- gn,
4132
- {
4133
- className: "self-start max-w-[150px]",
4134
- value: i,
4135
- onChange: (d) => {
4136
- n(() => {
4137
- a({ lang: d.target.value });
4138
- });
4139
- },
4140
- options: [
4141
- { value: "shell", label: "cURL" },
4142
- { value: "js", label: "Javascript" },
4143
- { value: "python", label: "Python" },
4144
- { value: "java", label: "Java" },
4145
- { value: "go", label: "Go" },
4146
- { value: "csharp", label: "C#" },
4147
- { value: "kotlin", label: "Kotlin" },
4148
- { value: "objc", label: "Objective C" },
4149
- { value: "php", label: "PHP" },
4150
- { value: "ruby", label: "Ruby" },
4151
- { value: "swift", label: "Swift" }
4152
- ]
4153
- }
4154
- )
4155
- ] })
4156
- ] }),
4157
- s && /* @__PURE__ */ g.jsx(Us, { content: s }),
4158
- t.responses.length > 0 && /* @__PURE__ */ g.jsx(_s, { responses: t.responses })
4159
- ] });
4160
- }, Ws = ["path", "query", "header", "cookie"], Js = ({
4161
- operationFragment: t
4162
- }) => {
4163
- var c, a, n;
4164
- const e = qn(zs, t), r = Mr(
4165
- e.parameters ?? [],
4166
- (i) => i.in
4167
- ), o = e.responses.at(0);
4168
- return /* @__PURE__ */ g.jsxs(
4169
- "div",
4170
- {
4171
- className: "grid grid-cols-1 lg:grid-cols-[4fr_3fr] gap-8 items-start border-b-2 mb-16 pb-16 border-border",
4172
- children: [
4173
- /* @__PURE__ */ g.jsxs("div", { className: "flex flex-col gap-4", children: [
4174
- /* @__PURE__ */ g.jsx(Ae, { level: 2, id: e.slug, registerSidebarAnchor: !0, children: e.summary }),
4175
- e.description && /* @__PURE__ */ g.jsx(
4176
- Te,
4177
- {
4178
- className: Ye,
4179
- content: e.description
4180
- }
4181
- ),
4182
- e.parameters && e.parameters.length > 0 && /* @__PURE__ */ g.jsx(g.Fragment, { children: Ws.flatMap(
4183
- (i) => {
4184
- var s;
4185
- return (s = r[i]) != null && s.length ? /* @__PURE__ */ g.jsx(
4186
- Ln,
4187
- {
4188
- id: e.slug,
4189
- parameters: r[i],
4190
- group: i
4191
- },
4192
- i
4193
- ) : [];
4194
- }
4195
- ) }),
4196
- Qt((n = (a = (c = e.requestBody) == null ? void 0 : c.content) == null ? void 0 : a.at(0)) == null ? void 0 : n.schema, (i) => /* @__PURE__ */ g.jsxs("div", { className: "mt-4 flex flex-col gap-4", children: [
4197
- /* @__PURE__ */ g.jsx(Ae, { level: 3, className: "capitalize", children: "Request Body" }),
4198
- /* @__PURE__ */ g.jsx(Xe, { schema: i })
4199
- ] })),
4200
- e.responses.length > 0 && /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
4201
- /* @__PURE__ */ g.jsx(Ae, { level: 3, className: "capitalize mt-8 pt-8 border-t", children: "Responses" }),
4202
- /* @__PURE__ */ g.jsxs(bn, { defaultValue: `${o == null ? void 0 : o.statusCode}${o == null ? void 0 : o.description}`, children: [
4203
- e.responses.length > 1 && /* @__PURE__ */ g.jsx(vn, { children: e.responses.map((i) => /* @__PURE__ */ g.jsx(
4204
- $n,
4205
- {
4206
- value: i.statusCode + i.description,
4207
- title: i.description,
4208
- children: i.statusCode
4209
- },
4210
- i.statusCode
4211
- )) }),
4212
- /* @__PURE__ */ g.jsx("ul", { className: "list-none m-0 px-0 overflow-hidden", children: e.responses.map((i) => {
4213
- var s;
4214
- return /* @__PURE__ */ g.jsx(
4215
- xn,
4216
- {
4217
- value: i.statusCode + i.description,
4218
- children: Qt(
4219
- (s = i.content) == null ? void 0 : s.find((l) => l.schema),
4220
- (l) => /* @__PURE__ */ g.jsx(Xe, { schema: l.schema, name: "" })
4221
- ) ?? /* @__PURE__ */ g.jsx("div", { className: "border-border font-mono text-sm border rounded p-4", children: "No response body" })
4222
- },
4223
- i.statusCode
4224
- );
4225
- }) })
4226
- ] })
4227
- ] })
4228
- ] }),
4229
- /* @__PURE__ */ g.jsx(Ms, { operation: e })
4230
- ]
4231
- },
4232
- e.operationId
4233
- );
4234
- }, zs = qt(
4235
- /* GraphQL */
4236
- `
4237
- fragment OperationsFragment on OperationItem {
4238
- slug
4239
- summary
4240
- method
4241
- description
4242
- operationId
4243
- contentTypes
4244
- path
4245
- parameters {
4246
- name
4247
- in
4248
- description
4249
- required
4250
- schema
4251
- style
4252
- examples {
4253
- name
4254
- description
4255
- externalValue
4256
- value
4257
- summary
4258
- }
4259
- }
4260
- requestBody {
4261
- content {
4262
- mediaType
4263
- encoding {
4264
- name
4265
- }
4266
- schema
4267
- }
4268
- description
4269
- required
4270
- }
4271
- responses {
4272
- statusCode
4273
- links
4274
- description
4275
- content {
4276
- mediaType
4277
- encoding {
4278
- name
4279
- }
4280
- schema
4281
- }
4282
- }
4283
- }
4284
- `
4285
- ), Gs = qt(
4286
- /* GraphQL */
4287
- `
4288
- query AllOperations($input: JSON!, $type: SchemaType!) {
4289
- schema(input: $input, type: $type) {
4290
- description
4291
- title
4292
- url
4293
- version
4294
- tags {
4295
- name
4296
- description
4297
- operations {
4298
- slug
4299
- ...OperationsFragment
4300
- }
4301
- }
4302
- }
4303
- }
4304
- `
4305
- ), Vs = { suspense: !0 }, ic = () => {
4306
- var c;
4307
- const { type: t, input: e } = Fr(), [r] = Hr({
4308
- query: Gs,
4309
- variables: { type: t, input: e },
4310
- context: Vs
4311
- }), o = (c = r.error) == null ? void 0 : c.graphQLErrors.at(0);
4312
- return o ? /* @__PURE__ */ g.jsx(
4313
- wn,
4314
- {
4315
- category: "Error",
4316
- title: "Schema cannot be displayed",
4317
- message: /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
4318
- /* @__PURE__ */ g.jsxs(hn, { className: "mb-4", children: [
4319
- "Check your configuration value ",
4320
- /* @__PURE__ */ g.jsx(Kt, { children: "apis.type" }),
4321
- " ",
4322
- "and ",
4323
- /* @__PURE__ */ g.jsx(Kt, { children: "apis.input" }),
4324
- " in the Zudoku config."
4325
- ] }),
4326
- "An error occurred while trying to fetch the API reference:",
4327
- /* @__PURE__ */ g.jsx(at, { code: o.toString(), language: "plain" })
4328
- ] })
4329
- }
4330
- ) : r.data ? /* @__PURE__ */ g.jsxs("div", { className: "pt-[--padding-content-top]", children: [
4331
- /* @__PURE__ */ g.jsxs(
4332
- "div",
4333
- {
4334
- className: le(
4335
- Ye,
4336
- "mb-16 max-w-full prose-img:max-w-prose"
4337
- ),
4338
- children: [
4339
- /* @__PURE__ */ g.jsx(Vt, { children: "Overview" }),
4340
- /* @__PURE__ */ g.jsx(Ae, { level: 1, id: "description", registerSidebarAnchor: !0, children: r.data.schema.title }),
4341
- /* @__PURE__ */ g.jsx(Te, { content: r.data.schema.description ?? "" })
4342
- ]
4343
- }
4344
- ),
4345
- r.data.schema.tags.filter((a) => a.operations.length > 0).map((a) => /* @__PURE__ */ g.jsxs("div", { children: [
4346
- a.name && /* @__PURE__ */ g.jsx(Vt, { children: a.name }),
4347
- a.description && /* @__PURE__ */ g.jsx(
4348
- Te,
4349
- {
4350
- className: `${Ye} mt-2 mb-12`,
4351
- content: a.description
4352
- }
4353
- ),
4354
- /* @__PURE__ */ g.jsx("div", { className: "operation mb-12", children: /* @__PURE__ */ g.jsx(On, { children: a.operations.map((n) => /* @__PURE__ */ g.jsx(
4355
- Js,
4356
- {
4357
- operationFragment: n
4358
- },
4359
- n.slug
4360
- )) }) })
4361
- ] }, a.name))
4362
- ] }) : null;
4363
- };
4364
- export {
4365
- ic as OperationList,
4366
- zs as OperationsFragment
4367
- };
4368
- //# sourceMappingURL=OperationList-C-M33Hxu.js.map