zudoku 0.23.3 → 0.23.4

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