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