@ragrails/api-playground-react 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -11
- package/dist/index.js +549 -1304
- package/dist/src/lib/highlight.d.ts +1 -5
- package/package.json +4 -6
package/dist/index.js
CHANGED
|
@@ -2,25 +2,13 @@ const __RAGRAILS_API_PLAYGROUND_CSS__="/*! tailwindcss v4.3.1 | MIT License | ht
|
|
|
2
2
|
if(typeof document!=="undefined"&&!document.getElementById("ragrails-api-playground-react-styles")){const style=document.createElement("style");style.id="ragrails-api-playground-react-styles";style.textContent=__RAGRAILS_API_PLAYGROUND_CSS__;(document.head||document.documentElement).appendChild(style);}
|
|
3
3
|
import e, { useEffect as t, useId as n, useLayoutEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
4
4
|
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
-
//#region \0rolldown/runtime.js
|
|
6
|
-
var u = Object.create, d = Object.defineProperty, f = Object.getOwnPropertyDescriptor, p = Object.getOwnPropertyNames, m = Object.getPrototypeOf, h = Object.prototype.hasOwnProperty, g = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), _ = (e, t, n, r) => {
|
|
7
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i = p(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !h.call(e, s) && s !== n && d(e, s, {
|
|
8
|
-
get: ((e) => t[e]).bind(null, s),
|
|
9
|
-
enumerable: !(r = f(t, s)) || r.enumerable
|
|
10
|
-
});
|
|
11
|
-
return e;
|
|
12
|
-
}, v = (e, t, n) => (n = e == null ? {} : u(m(e)), _(t || !e || !e.__esModule ? d(n, "default", {
|
|
13
|
-
value: e,
|
|
14
|
-
enumerable: !0
|
|
15
|
-
}) : n, e));
|
|
16
|
-
//#endregion
|
|
17
5
|
//#region src/lib/cn.ts
|
|
18
|
-
function
|
|
6
|
+
function u(...e) {
|
|
19
7
|
return e.filter(Boolean).join(" ");
|
|
20
8
|
}
|
|
21
9
|
//#endregion
|
|
22
10
|
//#region src/components/ui/Icon.tsx
|
|
23
|
-
var
|
|
11
|
+
var d = {
|
|
24
12
|
copy: /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("path", {
|
|
25
13
|
fill: "currentColor",
|
|
26
14
|
d: "M15.24 2h-3.894c-1.764 0-3.162 0-4.255.148c-1.126.152-2.037.472-2.755 1.193c-.719.721-1.038 1.636-1.189 2.766C3 7.205 3 8.608 3 10.379v5.838c0 1.508.92 2.8 2.227 3.342c-.067-.91-.067-2.185-.067-3.247v-5.01c0-1.281 0-2.386.118-3.27c.127-.948.413-1.856 1.147-2.593s1.639-1.024 2.583-1.152c.88-.118 1.98-.118 3.257-.118h3.07c1.276 0 2.374 0 3.255.118A3.6 3.6 0 0 0 15.24 2"
|
|
@@ -210,61 +198,61 @@ var b = {
|
|
|
210
198
|
fill: "currentColor",
|
|
211
199
|
d: "M2.69 6.705a.75.75 0 0 0-1.38.59zm12.897 6.624l-.274-.698zm-6.546.409a.75.75 0 1 0-1.257-.818zm-2.67 1.353a.75.75 0 1 0 1.258.818zM22.69 7.295a.75.75 0 0 0-1.378-.59zM19 11.13l-.513-.547zm.97 2.03a.75.75 0 1 0 1.06-1.06zm-8.72 3.34a.75.75 0 0 0 1.5 0zm5.121-.591a.75.75 0 1 0 1.258-.818zm-10.84-4.25A.75.75 0 0 0 4.47 10.6zm-2.561.44a.75.75 0 0 0 1.06 1.06zM12 13.25c-3.224 0-5.539-1.605-7.075-3.26a13.6 13.6 0 0 1-1.702-2.28a12 12 0 0 1-.507-.946l-.022-.049l-.004-.01l-.001-.001L2 7l-.69.296h.001l.001.003l.003.006l.04.088q.039.088.117.243c.103.206.256.496.462.841c.41.69 1.035 1.61 1.891 2.533C5.54 12.855 8.224 14.75 12 14.75zm3.313-.62c-.97.383-2.071.62-3.313.62v1.5c1.438 0 2.725-.276 3.862-.723zm-7.529.29l-1.413 2.17l1.258.818l1.412-2.171zM22 7l-.69-.296h.001v.002l-.007.013l-.028.062a12 12 0 0 1-.64 1.162a13.3 13.3 0 0 1-2.15 2.639l1.027 1.094a14.8 14.8 0 0 0 3.122-4.26l.039-.085l.01-.024l.004-.007v-.003h.001v-.001zm-3.513 3.582c-.86.806-1.913 1.552-3.174 2.049l.549 1.396c1.473-.58 2.685-1.444 3.651-2.351zm-.017 1.077l1.5 1.5l1.06-1.06l-1.5-1.5zM11.25 14v2.5h1.5V14zm3.709-.262l1.412 2.171l1.258-.818l-1.413-2.171zm-10.49-3.14l-1.5 1.5L4.03 13.16l1.5-1.5z"
|
|
212
200
|
})
|
|
213
|
-
},
|
|
201
|
+
}, f = ({ name: e, size: t, className: n, ...r }) => /* @__PURE__ */ c("svg", {
|
|
214
202
|
xmlns: "http://www.w3.org/2000/svg",
|
|
215
203
|
viewBox: "0 0 24 24",
|
|
216
204
|
width: t ?? "1em",
|
|
217
205
|
height: t ?? "1em",
|
|
218
|
-
className:
|
|
206
|
+
className: u("inline-block shrink-0", n),
|
|
219
207
|
"aria-hidden": r["aria-label"] ? void 0 : !0,
|
|
220
208
|
...r,
|
|
221
|
-
children:
|
|
222
|
-
}),
|
|
209
|
+
children: d[e]
|
|
210
|
+
}), p = {
|
|
223
211
|
primary: "bg-primary text-primary-contrast hover:bg-primary-hover",
|
|
224
212
|
secondary: "bg-surface-2 text-content border border-border hover:bg-border",
|
|
225
213
|
ghost: "bg-transparent text-muted hover:text-content",
|
|
226
214
|
danger: "bg-[#EF5350] text-white hover:bg-[#e53935]"
|
|
227
|
-
},
|
|
215
|
+
}, m = {
|
|
228
216
|
sm: "text-[12px] px-3 py-1.5",
|
|
229
217
|
md: "text-[14px] px-4 py-2",
|
|
230
218
|
lg: "text-[16px] px-5 py-2.5"
|
|
231
|
-
},
|
|
219
|
+
}, h = {
|
|
232
220
|
sm: "gap-1.5",
|
|
233
221
|
md: "gap-2",
|
|
234
222
|
lg: "gap-2"
|
|
235
|
-
},
|
|
236
|
-
className:
|
|
223
|
+
}, g = ({ variant: e = "primary", size: t = "md", isLoading: n = !1, leftIcon: r, rightIcon: i, className: a, children: o, disabled: s, ...d }) => /* @__PURE__ */ l("button", {
|
|
224
|
+
className: u("group relative isolate overflow-hidden rounded-lg font-heading font-medium", "inline-flex items-center justify-center", "transition duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "active:scale-105 motion-reduce:active:scale-100", "disabled:opacity-50 disabled:cursor-not-allowed", p[e], m[t], a),
|
|
237
225
|
disabled: s || n,
|
|
238
|
-
...
|
|
226
|
+
...d,
|
|
239
227
|
children: [e !== "ghost" && /* @__PURE__ */ c("span", {
|
|
240
228
|
"aria-hidden": "true",
|
|
241
|
-
className:
|
|
229
|
+
className: u("pointer-events-none absolute inset-0 -z-10 -translate-x-full -skew-x-12", "bg-gradient-to-r from-transparent via-white/25 to-transparent", "transition-transform duration-0 ease-out", "group-hover:translate-x-full group-hover:duration-[1200ms] group-disabled:hidden")
|
|
242
230
|
}), /* @__PURE__ */ l("span", {
|
|
243
|
-
className:
|
|
231
|
+
className: u("inline-flex items-center", h[t]),
|
|
244
232
|
children: [
|
|
245
233
|
n ? /* @__PURE__ */ c("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }) : r,
|
|
246
234
|
/* @__PURE__ */ c("span", {
|
|
247
|
-
className:
|
|
235
|
+
className: u(e === "ghost" && "bg-gradient-to-r from-muted via-content to-muted bg-[length:200%_100%] bg-clip-text group-hover:text-transparent group-hover:[animation:text-shimmer_1.2s_linear_1_forwards]"),
|
|
248
236
|
children: o
|
|
249
237
|
}),
|
|
250
238
|
!n && i
|
|
251
239
|
]
|
|
252
240
|
})]
|
|
253
|
-
}),
|
|
241
|
+
}), _ = {
|
|
254
242
|
ghost: "text-muted hover:bg-surface-2 hover:text-content",
|
|
255
243
|
surface: "bg-surface-2 text-muted border border-border hover:text-content",
|
|
256
244
|
solid: "bg-primary text-primary-contrast hover:bg-primary-hover"
|
|
257
|
-
},
|
|
245
|
+
}, v = {
|
|
258
246
|
sm: "h-7 w-7",
|
|
259
247
|
md: "h-9 w-9"
|
|
260
|
-
},
|
|
261
|
-
className:
|
|
248
|
+
}, y = ({ variant: e = "ghost", size: t = "md", className: n, children: r, ...i }) => /* @__PURE__ */ c("button", {
|
|
249
|
+
className: u("inline-flex items-center justify-center rounded-lg transition-colors duration-150", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "disabled:opacity-50 disabled:cursor-not-allowed", _[e], v[t], n),
|
|
262
250
|
...i,
|
|
263
251
|
children: r
|
|
264
252
|
});
|
|
265
253
|
//#endregion
|
|
266
254
|
//#region src/lib/clipboard.ts
|
|
267
|
-
async function
|
|
255
|
+
async function b(e) {
|
|
268
256
|
try {
|
|
269
257
|
if (navigator.clipboard && window.isSecureContext) try {
|
|
270
258
|
return await navigator.clipboard.writeText(e), !0;
|
|
@@ -283,13 +271,13 @@ async function k(e) {
|
|
|
283
271
|
return console.error("Failed to copy text:", e), !1;
|
|
284
272
|
}
|
|
285
273
|
}
|
|
286
|
-
function
|
|
274
|
+
function x(t = 2e3) {
|
|
287
275
|
let [n, r] = e.useState(!1), i = e.useRef(null);
|
|
288
276
|
return e.useEffect(() => () => {
|
|
289
277
|
i.current && clearTimeout(i.current);
|
|
290
278
|
}, []), {
|
|
291
279
|
copy: async (e) => {
|
|
292
|
-
let n = await
|
|
280
|
+
let n = await b(e);
|
|
293
281
|
return n && (r(!0), i.current && clearTimeout(i.current), i.current = window.setTimeout(() => {
|
|
294
282
|
r(!1);
|
|
295
283
|
}, t)), n;
|
|
@@ -299,44 +287,44 @@ function A(t = 2e3) {
|
|
|
299
287
|
}
|
|
300
288
|
//#endregion
|
|
301
289
|
//#region src/components/ui/CopyButton.tsx
|
|
302
|
-
var
|
|
303
|
-
let { copy: a, copied: o } =
|
|
304
|
-
return /* @__PURE__ */ c(
|
|
290
|
+
var S = ({ value: e, variant: t = "surface", size: n = "md", className: r, label: i = "Copy to clipboard" }) => {
|
|
291
|
+
let { copy: a, copied: o } = x(), s = n === "sm" ? 14 : 16;
|
|
292
|
+
return /* @__PURE__ */ c(y, {
|
|
305
293
|
"aria-label": o ? "Copied" : i,
|
|
306
294
|
variant: t,
|
|
307
295
|
size: n,
|
|
308
296
|
className: r,
|
|
309
297
|
onClick: () => a(e),
|
|
310
|
-
children: o ? /* @__PURE__ */ c(
|
|
298
|
+
children: o ? /* @__PURE__ */ c(f, {
|
|
311
299
|
name: "check",
|
|
312
300
|
size: s,
|
|
313
301
|
className: "text-green-500"
|
|
314
|
-
}) : /* @__PURE__ */ c(
|
|
302
|
+
}) : /* @__PURE__ */ c(f, {
|
|
315
303
|
name: "copy",
|
|
316
304
|
size: s
|
|
317
305
|
})
|
|
318
306
|
});
|
|
319
|
-
},
|
|
307
|
+
}, C = {
|
|
320
308
|
neutral: "bg-surface-2 text-muted border border-border",
|
|
321
309
|
primary: "bg-primary-soft text-primary border border-primary/30",
|
|
322
310
|
success: "bg-[#52b788]/15 text-[#52b788] border border-[#52b788]/25",
|
|
323
311
|
error: "bg-[#4A0F0F] text-[#FC7070] border border-[#FC7070]/20",
|
|
324
312
|
warning: "bg-amber-500/15 text-amber-500 border border-amber-500/30",
|
|
325
313
|
info: "bg-sky-500/15 text-sky-400 border border-sky-500/30"
|
|
326
|
-
},
|
|
327
|
-
className:
|
|
314
|
+
}, w = ({ tone: e = "neutral", className: t, children: n }) => /* @__PURE__ */ c("span", {
|
|
315
|
+
className: u("inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-heading font-[550]", C[e], t),
|
|
328
316
|
children: n
|
|
329
|
-
}),
|
|
317
|
+
}), ee = {
|
|
330
318
|
GET: "success",
|
|
331
319
|
POST: "info",
|
|
332
320
|
PUT: "warning",
|
|
333
321
|
PATCH: "primary",
|
|
334
322
|
DELETE: "error"
|
|
335
|
-
},
|
|
336
|
-
tone:
|
|
323
|
+
}, T = ({ method: e, className: t }) => /* @__PURE__ */ c(w, {
|
|
324
|
+
tone: ee[e],
|
|
337
325
|
className: t,
|
|
338
326
|
children: e
|
|
339
|
-
}),
|
|
327
|
+
}), te = ({ status: e, statusText: t, className: n }) => /* @__PURE__ */ l(w, {
|
|
340
328
|
tone: e >= 200 && e < 300 ? "success" : e >= 300 && e < 400 ? "warning" : "error",
|
|
341
329
|
className: n,
|
|
342
330
|
children: [
|
|
@@ -344,16 +332,16 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
344
332
|
" ",
|
|
345
333
|
t
|
|
346
334
|
]
|
|
347
|
-
}),
|
|
335
|
+
}), ne = {
|
|
348
336
|
sm: "h-4 w-4 rounded",
|
|
349
337
|
md: "h-5 w-5 rounded-md"
|
|
350
|
-
},
|
|
338
|
+
}, E = {
|
|
351
339
|
sm: "h-3 w-3",
|
|
352
340
|
md: "h-3.5 w-3.5"
|
|
353
|
-
},
|
|
341
|
+
}, D = {
|
|
354
342
|
sm: "text-xs",
|
|
355
343
|
md: "text-sm"
|
|
356
|
-
},
|
|
344
|
+
}, O = ({ checked: e, onChange: t, label: n, disabled: r, size: i = "md", className: a, "aria-label": o }) => {
|
|
357
345
|
let s = /* @__PURE__ */ c("button", {
|
|
358
346
|
type: "button",
|
|
359
347
|
role: "checkbox",
|
|
@@ -361,41 +349,41 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
361
349
|
"aria-label": o ?? n,
|
|
362
350
|
disabled: r,
|
|
363
351
|
onClick: () => t(!e),
|
|
364
|
-
className:
|
|
365
|
-
children: /* @__PURE__ */ c(
|
|
352
|
+
className: u("inline-flex shrink-0 items-center justify-center border transition-colors duration-150", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "disabled:cursor-not-allowed disabled:opacity-50", ne[i], e ? "border-primary bg-primary text-primary-contrast" : "border-border bg-surface-2 text-transparent hover:border-primary/70"),
|
|
353
|
+
children: /* @__PURE__ */ c(f, {
|
|
366
354
|
name: "check",
|
|
367
|
-
className:
|
|
355
|
+
className: E[i]
|
|
368
356
|
})
|
|
369
357
|
});
|
|
370
358
|
return n ? /* @__PURE__ */ l("label", {
|
|
371
|
-
className:
|
|
359
|
+
className: u("inline-flex cursor-pointer select-none items-center gap-2", a),
|
|
372
360
|
children: [s, /* @__PURE__ */ c("span", {
|
|
373
|
-
className:
|
|
361
|
+
className: u("text-content", D[i]),
|
|
374
362
|
children: n
|
|
375
363
|
})]
|
|
376
364
|
}) : /* @__PURE__ */ c("span", {
|
|
377
365
|
className: a,
|
|
378
366
|
children: s
|
|
379
367
|
});
|
|
380
|
-
},
|
|
368
|
+
}, k = ({ label: e, flush: t, className: n, children: r }) => /* @__PURE__ */ l("div", {
|
|
381
369
|
className: "w-full",
|
|
382
370
|
children: [e && /* @__PURE__ */ c("div", {
|
|
383
371
|
className: "mb-2 text-sm text-muted",
|
|
384
372
|
children: e
|
|
385
373
|
}), /* @__PURE__ */ c("div", {
|
|
386
|
-
className:
|
|
374
|
+
className: u("rounded-xl border border-border bg-surface", !t && "p-3", n),
|
|
387
375
|
children: r
|
|
388
376
|
})]
|
|
389
|
-
}),
|
|
390
|
-
let
|
|
377
|
+
}), A = ({ items: e, activeId: n, onChange: i, variant: s = "underline", size: d = "md", className: f }) => {
|
|
378
|
+
let p = a({}), [m, h] = o({
|
|
391
379
|
left: 0,
|
|
392
380
|
top: 0,
|
|
393
381
|
width: 0,
|
|
394
382
|
height: 0
|
|
395
383
|
});
|
|
396
384
|
return r(() => {
|
|
397
|
-
let e =
|
|
398
|
-
e &&
|
|
385
|
+
let e = p.current[n];
|
|
386
|
+
e && h({
|
|
399
387
|
left: e.offsetLeft,
|
|
400
388
|
top: e.offsetTop,
|
|
401
389
|
width: e.offsetWidth,
|
|
@@ -403,8 +391,8 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
403
391
|
});
|
|
404
392
|
}, [n, e]), t(() => {
|
|
405
393
|
let e = () => {
|
|
406
|
-
let e =
|
|
407
|
-
e &&
|
|
394
|
+
let e = p.current[n];
|
|
395
|
+
e && h({
|
|
408
396
|
left: e.offsetLeft,
|
|
409
397
|
top: e.offsetTop,
|
|
410
398
|
width: e.offsetWidth,
|
|
@@ -413,25 +401,25 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
413
401
|
};
|
|
414
402
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
415
403
|
}, [n]), s === "segmented" ? /* @__PURE__ */ l("div", {
|
|
416
|
-
className:
|
|
404
|
+
className: u("relative inline-flex gap-1 rounded-lg border border-border bg-surface-2 p-1", f),
|
|
417
405
|
children: [/* @__PURE__ */ c("span", {
|
|
418
406
|
className: "pointer-events-none absolute z-0 rounded-md bg-primary transition-all duration-300 ease-out",
|
|
419
407
|
style: {
|
|
420
|
-
left:
|
|
421
|
-
top:
|
|
422
|
-
width:
|
|
423
|
-
height:
|
|
408
|
+
left: m.left,
|
|
409
|
+
top: m.top,
|
|
410
|
+
width: m.width,
|
|
411
|
+
height: m.height
|
|
424
412
|
}
|
|
425
413
|
}), e.map((e) => {
|
|
426
414
|
let t = e.id === n;
|
|
427
415
|
return /* @__PURE__ */ c("button", {
|
|
428
416
|
ref: (t) => {
|
|
429
|
-
|
|
417
|
+
p.current[e.id] = t;
|
|
430
418
|
},
|
|
431
419
|
onClick: () => i(e.id),
|
|
432
|
-
className:
|
|
420
|
+
className: u("group/seg relative z-10 cursor-pointer rounded-md font-heading transition-colors duration-150", d === "sm" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[14px]", t ? "text-primary-contrast" : "text-muted"),
|
|
433
421
|
children: /* @__PURE__ */ l("span", {
|
|
434
|
-
className:
|
|
422
|
+
className: u("relative z-10", !t && "bg-gradient-to-r from-muted via-content to-muted bg-[length:200%_100%] bg-clip-text group-hover/seg:text-transparent group-hover/seg:[animation:text-shimmer_1.2s_linear_1_forwards]"),
|
|
435
423
|
children: [e.label, e.badge !== void 0 && /* @__PURE__ */ c("span", {
|
|
436
424
|
className: "ml-1.5 opacity-70",
|
|
437
425
|
children: e.badge
|
|
@@ -440,15 +428,15 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
440
428
|
}, e.id);
|
|
441
429
|
})]
|
|
442
430
|
}) : /* @__PURE__ */ l("div", {
|
|
443
|
-
className:
|
|
431
|
+
className: u("relative flex gap-1 border-b border-border", f),
|
|
444
432
|
children: [e.map((e) => {
|
|
445
433
|
let t = e.id === n;
|
|
446
434
|
return /* @__PURE__ */ l("button", {
|
|
447
435
|
ref: (t) => {
|
|
448
|
-
|
|
436
|
+
p.current[e.id] = t;
|
|
449
437
|
},
|
|
450
438
|
onClick: () => i(e.id),
|
|
451
|
-
className:
|
|
439
|
+
className: u("inline-flex cursor-pointer items-center gap-1.5 font-heading transition-colors duration-150", d === "sm" ? "px-2 py-2 text-[12px]" : "px-3 py-2.5 text-[14px]", t ? "text-content" : "text-muted hover:text-content"),
|
|
452
440
|
children: [e.label, e.badge !== void 0 && /* @__PURE__ */ c("span", {
|
|
453
441
|
className: "text-xs text-muted",
|
|
454
442
|
children: e.badge
|
|
@@ -457,104 +445,104 @@ var j = ({ value: e, variant: t = "surface", size: n = "md", className: r, label
|
|
|
457
445
|
}), /* @__PURE__ */ c("span", {
|
|
458
446
|
className: "pointer-events-none absolute -bottom-px h-0.5 rounded-full bg-primary transition-all duration-300 ease-out",
|
|
459
447
|
style: {
|
|
460
|
-
left:
|
|
461
|
-
width:
|
|
448
|
+
left: m.left,
|
|
449
|
+
width: m.width
|
|
462
450
|
}
|
|
463
451
|
})]
|
|
464
452
|
});
|
|
465
|
-
},
|
|
453
|
+
}, j = {
|
|
466
454
|
sm: "gap-1.5 rounded-md px-2.5",
|
|
467
455
|
md: "gap-2 rounded-lg px-3",
|
|
468
456
|
lg: "gap-2.5 rounded-lg px-4"
|
|
469
|
-
},
|
|
457
|
+
}, M = {
|
|
470
458
|
sm: "py-1.5 text-[12px]",
|
|
471
459
|
md: "py-2 text-sm",
|
|
472
460
|
lg: "py-2.5 text-base"
|
|
473
|
-
},
|
|
461
|
+
}, N = {
|
|
474
462
|
sm: "mb-1 text-xs",
|
|
475
463
|
md: "mb-1.5 text-sm",
|
|
476
464
|
lg: "mb-2 text-sm"
|
|
477
|
-
},
|
|
465
|
+
}, P = {
|
|
478
466
|
sm: "mt-1 text-[11px]",
|
|
479
467
|
md: "mt-1 text-xs",
|
|
480
468
|
lg: "mt-1.5 text-xs"
|
|
481
|
-
},
|
|
482
|
-
let
|
|
469
|
+
}, F = ({ label: e, error: t, hint: r, size: i = "md", leftSlot: a, rightSlot: o, className: s, containerClassName: d, id: f, ...p }) => {
|
|
470
|
+
let m = n(), h = f ?? m;
|
|
483
471
|
return /* @__PURE__ */ l("div", {
|
|
484
|
-
className:
|
|
472
|
+
className: u("w-full", d),
|
|
485
473
|
children: [
|
|
486
474
|
e && /* @__PURE__ */ c("label", {
|
|
487
|
-
htmlFor:
|
|
488
|
-
className:
|
|
475
|
+
htmlFor: h,
|
|
476
|
+
className: u("block font-medium text-muted", N[i]),
|
|
489
477
|
children: e
|
|
490
478
|
}),
|
|
491
479
|
/* @__PURE__ */ l("div", {
|
|
492
|
-
className:
|
|
480
|
+
className: u("flex items-center border bg-surface-2", "focus-within:border-primary/70 focus-within:ring-2 focus-within:ring-primary/15", j[i], t ? "border-red-500" : "border-border"),
|
|
493
481
|
children: [
|
|
494
482
|
a,
|
|
495
483
|
/* @__PURE__ */ c("input", {
|
|
496
|
-
id:
|
|
497
|
-
className:
|
|
498
|
-
...
|
|
484
|
+
id: h,
|
|
485
|
+
className: u("w-full bg-transparent text-content placeholder:text-muted", "focus:outline-none disabled:cursor-not-allowed disabled:opacity-60", M[i], s),
|
|
486
|
+
...p
|
|
499
487
|
}),
|
|
500
488
|
o
|
|
501
489
|
]
|
|
502
490
|
}),
|
|
503
491
|
t ? /* @__PURE__ */ c("p", {
|
|
504
|
-
className:
|
|
492
|
+
className: u("text-red-500", P[i]),
|
|
505
493
|
children: t
|
|
506
494
|
}) : r ? /* @__PURE__ */ c("p", {
|
|
507
|
-
className:
|
|
495
|
+
className: u("text-muted", P[i]),
|
|
508
496
|
children: r
|
|
509
497
|
}) : null
|
|
510
498
|
]
|
|
511
499
|
});
|
|
512
|
-
},
|
|
500
|
+
}, re = {
|
|
513
501
|
sm: "gap-1.5 px-2.5 py-1.5 text-[12px]",
|
|
514
502
|
md: "gap-1 px-2 py-1.5 text-[14px]"
|
|
515
|
-
},
|
|
503
|
+
}, I = {
|
|
516
504
|
sm: "px-2.5 py-1.5 text-[12px]",
|
|
517
505
|
md: "px-3 py-1.5 text-[14px]"
|
|
518
506
|
};
|
|
519
|
-
function
|
|
520
|
-
let [
|
|
507
|
+
function ie({ items: e, value: n, onChange: r, size: i = "md", disabled: s, minWidthClassName: d = "min-w-[7rem]", className: p }) {
|
|
508
|
+
let [m, h] = o(!1), [g, _] = o(!1), v = a(null), y = e.find((e) => e.id === n) ?? e[0];
|
|
521
509
|
t(() => {
|
|
522
|
-
if (
|
|
523
|
-
|
|
510
|
+
if (m) {
|
|
511
|
+
_(!0);
|
|
524
512
|
return;
|
|
525
513
|
}
|
|
526
|
-
let e = window.setTimeout(() =>
|
|
514
|
+
let e = window.setTimeout(() => _(!1), 200);
|
|
527
515
|
return () => window.clearTimeout(e);
|
|
528
|
-
}, [
|
|
529
|
-
if (!
|
|
516
|
+
}, [m]), t(() => {
|
|
517
|
+
if (!m) return;
|
|
530
518
|
let e = (e) => {
|
|
531
|
-
|
|
519
|
+
v.current && !v.current.contains(e.target) && h(!1);
|
|
532
520
|
}, t = (e) => {
|
|
533
|
-
e.key === "Escape" &&
|
|
521
|
+
e.key === "Escape" && h(!1);
|
|
534
522
|
};
|
|
535
523
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
536
524
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
537
525
|
};
|
|
538
|
-
}, [
|
|
539
|
-
let
|
|
540
|
-
s || (r(e),
|
|
526
|
+
}, [m]);
|
|
527
|
+
let b = (e) => {
|
|
528
|
+
s || (r(e), h(!1));
|
|
541
529
|
};
|
|
542
530
|
return /* @__PURE__ */ l("div", {
|
|
543
|
-
ref:
|
|
544
|
-
className:
|
|
531
|
+
ref: v,
|
|
532
|
+
className: u("relative inline-flex", p),
|
|
545
533
|
children: [/* @__PURE__ */ l("button", {
|
|
546
534
|
type: "button",
|
|
547
535
|
"aria-haspopup": "listbox",
|
|
548
|
-
"aria-expanded":
|
|
536
|
+
"aria-expanded": m,
|
|
549
537
|
disabled: s,
|
|
550
|
-
onClick: () =>
|
|
551
|
-
className:
|
|
552
|
-
children: [
|
|
538
|
+
onClick: () => h((e) => !e),
|
|
539
|
+
className: u("inline-flex cursor-pointer items-center rounded-md font-heading transition-colors duration-150", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60", "disabled:cursor-not-allowed disabled:opacity-60", re[i], y?.className ?? "text-content hover:bg-surface-2"),
|
|
540
|
+
children: [y?.label, /* @__PURE__ */ c(f, {
|
|
553
541
|
name: "chevron-down",
|
|
554
|
-
className:
|
|
542
|
+
className: u("h-4 w-4 text-muted transition-transform duration-200", m && "rotate-180")
|
|
555
543
|
})]
|
|
556
|
-
}),
|
|
557
|
-
className:
|
|
544
|
+
}), g && /* @__PURE__ */ c("div", {
|
|
545
|
+
className: u("absolute left-0 top-full z-20 mt-1 grid overflow-hidden rounded-lg border border-border bg-surface shadow-lg [grid-template-rows:1fr]", d, m ? "motion-safe:animate-[dropdown-expand_0.2s_ease-out]" : "motion-safe:animate-[dropdown-expand_0.18s_ease-in_reverse_forwards]"),
|
|
558
546
|
children: /* @__PURE__ */ c("ul", {
|
|
559
547
|
role: "listbox",
|
|
560
548
|
className: "min-h-0 overflow-hidden p-1",
|
|
@@ -565,9 +553,9 @@ function ce({ items: e, value: n, onChange: r, size: i = "md", disabled: s, minW
|
|
|
565
553
|
"aria-selected": t,
|
|
566
554
|
children: /* @__PURE__ */ l("button", {
|
|
567
555
|
type: "button",
|
|
568
|
-
onClick: () =>
|
|
569
|
-
className:
|
|
570
|
-
children: [e.label, t && /* @__PURE__ */ c(
|
|
556
|
+
onClick: () => b(e.id),
|
|
557
|
+
className: u("flex w-full cursor-pointer items-center justify-between rounded-md font-heading transition-colors duration-150 hover:bg-surface-2", I[i], e.className ?? "text-muted hover:text-content", t && "bg-surface-2"),
|
|
558
|
+
children: [e.label, t && /* @__PURE__ */ c(f, {
|
|
571
559
|
name: "check",
|
|
572
560
|
className: "h-4 w-4"
|
|
573
561
|
})]
|
|
@@ -580,976 +568,233 @@ function ce({ items: e, value: n, onChange: r, size: i = "md", disabled: s, minW
|
|
|
580
568
|
}
|
|
581
569
|
//#endregion
|
|
582
570
|
//#region src/components/ui/MethodSelect.tsx
|
|
583
|
-
var
|
|
571
|
+
var ae = [
|
|
584
572
|
"GET",
|
|
585
573
|
"POST",
|
|
586
574
|
"PUT",
|
|
587
575
|
"PATCH",
|
|
588
576
|
"DELETE"
|
|
589
|
-
],
|
|
577
|
+
], oe = {
|
|
590
578
|
GET: "text-[#52b788]",
|
|
591
579
|
POST: "text-sky-400",
|
|
592
580
|
PUT: "text-amber-400",
|
|
593
581
|
PATCH: "text-primary",
|
|
594
582
|
DELETE: "text-red-400"
|
|
595
|
-
},
|
|
583
|
+
}, se = (e) => e.map((e) => ({
|
|
596
584
|
id: e,
|
|
597
585
|
label: e,
|
|
598
|
-
className: `${
|
|
599
|
-
})),
|
|
586
|
+
className: `${oe[e]} font-semibold`
|
|
587
|
+
})), ce = ({ value: e, onChange: t, methods: n = ae, disabled: r, className: i }) => /* @__PURE__ */ c(ie, {
|
|
600
588
|
value: e,
|
|
601
589
|
onChange: t,
|
|
602
|
-
items:
|
|
590
|
+
items: se(n),
|
|
603
591
|
disabled: r,
|
|
604
592
|
minWidthClassName: "min-w-[7rem]",
|
|
605
593
|
className: i
|
|
606
|
-
}),
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
util: {
|
|
612
|
-
encode: function e(t) {
|
|
613
|
-
return t instanceof a ? new a(t.type, e(t.content), t.alias) : Array.isArray(t) ? t.map(e) : t.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
614
|
-
},
|
|
615
|
-
type: function(e) {
|
|
616
|
-
return Object.prototype.toString.call(e).slice(8, -1);
|
|
617
|
-
},
|
|
618
|
-
objId: function(e) {
|
|
619
|
-
return e.__id || Object.defineProperty(e, "__id", { value: ++n }), e.__id;
|
|
620
|
-
},
|
|
621
|
-
clone: function e(t, n) {
|
|
622
|
-
n ||= {};
|
|
623
|
-
var r, a;
|
|
624
|
-
switch (i.util.type(t)) {
|
|
625
|
-
case "Object":
|
|
626
|
-
if (a = i.util.objId(t), n[a]) return n[a];
|
|
627
|
-
for (var o in r = {}, n[a] = r, t) t.hasOwnProperty(o) && (r[o] = e(t[o], n));
|
|
628
|
-
return r;
|
|
629
|
-
case "Array": return a = i.util.objId(t), n[a] ? n[a] : (r = [], n[a] = r, t.forEach(function(t, i) {
|
|
630
|
-
r[i] = e(t, n);
|
|
631
|
-
}), r);
|
|
632
|
-
default: return t;
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
getLanguage: function(e) {
|
|
636
|
-
for (; e;) {
|
|
637
|
-
var n = t.exec(e.className);
|
|
638
|
-
if (n) return n[1].toLowerCase();
|
|
639
|
-
e = e.parentElement;
|
|
640
|
-
}
|
|
641
|
-
return "none";
|
|
642
|
-
},
|
|
643
|
-
setLanguage: function(e, n) {
|
|
644
|
-
e.className = e.className.replace(RegExp(t, "gi"), ""), e.classList.add("language-" + n);
|
|
645
|
-
},
|
|
646
|
-
currentScript: function() {
|
|
647
|
-
if (typeof document > "u") return null;
|
|
648
|
-
if (document.currentScript && document.currentScript.tagName === "SCRIPT") return document.currentScript;
|
|
649
|
-
try {
|
|
650
|
-
throw Error();
|
|
651
|
-
} catch (r) {
|
|
652
|
-
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack) || [])[1];
|
|
653
|
-
if (e) {
|
|
654
|
-
var t = document.getElementsByTagName("script");
|
|
655
|
-
for (var n in t) if (t[n].src == e) return t[n];
|
|
656
|
-
}
|
|
657
|
-
return null;
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
|
-
isActive: function(e, t, n) {
|
|
661
|
-
for (var r = "no-" + t; e;) {
|
|
662
|
-
var i = e.classList;
|
|
663
|
-
if (i.contains(t)) return !0;
|
|
664
|
-
if (i.contains(r)) return !1;
|
|
665
|
-
e = e.parentElement;
|
|
666
|
-
}
|
|
667
|
-
return !!n;
|
|
668
|
-
}
|
|
669
|
-
},
|
|
670
|
-
languages: {
|
|
671
|
-
plain: r,
|
|
672
|
-
plaintext: r,
|
|
673
|
-
text: r,
|
|
674
|
-
txt: r,
|
|
675
|
-
extend: function(e, t) {
|
|
676
|
-
var n = i.util.clone(i.languages[e]);
|
|
677
|
-
for (var r in t) n[r] = t[r];
|
|
678
|
-
return n;
|
|
679
|
-
},
|
|
680
|
-
insertBefore: function(e, t, n, r) {
|
|
681
|
-
r ||= i.languages;
|
|
682
|
-
var a = r[e], o = {};
|
|
683
|
-
for (var s in a) if (a.hasOwnProperty(s)) {
|
|
684
|
-
if (s == t) for (var c in n) n.hasOwnProperty(c) && (o[c] = n[c]);
|
|
685
|
-
n.hasOwnProperty(s) || (o[s] = a[s]);
|
|
686
|
-
}
|
|
687
|
-
var l = r[e];
|
|
688
|
-
return r[e] = o, i.languages.DFS(i.languages, function(t, n) {
|
|
689
|
-
n === l && t != e && (this[t] = o);
|
|
690
|
-
}), o;
|
|
691
|
-
},
|
|
692
|
-
DFS: function e(t, n, r, a) {
|
|
693
|
-
a ||= {};
|
|
694
|
-
var o = i.util.objId;
|
|
695
|
-
for (var s in t) if (t.hasOwnProperty(s)) {
|
|
696
|
-
n.call(t, s, t[s], r || s);
|
|
697
|
-
var c = t[s], l = i.util.type(c);
|
|
698
|
-
l === "Object" && !a[o(c)] ? (a[o(c)] = !0, e(c, n, null, a)) : l === "Array" && !a[o(c)] && (a[o(c)] = !0, e(c, n, s, a));
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
plugins: {},
|
|
703
|
-
highlightAll: function(e, t) {
|
|
704
|
-
i.highlightAllUnder(document, e, t);
|
|
705
|
-
},
|
|
706
|
-
highlightAllUnder: function(e, t, n) {
|
|
707
|
-
var r = {
|
|
708
|
-
callback: n,
|
|
709
|
-
container: e,
|
|
710
|
-
selector: "code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code"
|
|
711
|
-
};
|
|
712
|
-
i.hooks.run("before-highlightall", r), r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)), i.hooks.run("before-all-elements-highlight", r);
|
|
713
|
-
for (var a = 0, o; o = r.elements[a++];) i.highlightElement(o, t === !0, r.callback);
|
|
714
|
-
},
|
|
715
|
-
highlightElement: function(t, n, r) {
|
|
716
|
-
var a = i.util.getLanguage(t), o = i.languages[a];
|
|
717
|
-
i.util.setLanguage(t, a);
|
|
718
|
-
var s = t.parentElement;
|
|
719
|
-
s && s.nodeName.toLowerCase() === "pre" && i.util.setLanguage(s, a);
|
|
720
|
-
var c = {
|
|
721
|
-
element: t,
|
|
722
|
-
language: a,
|
|
723
|
-
grammar: o,
|
|
724
|
-
code: t.textContent
|
|
725
|
-
};
|
|
726
|
-
function l(e) {
|
|
727
|
-
c.highlightedCode = e, i.hooks.run("before-insert", c), c.element.innerHTML = c.highlightedCode, i.hooks.run("after-highlight", c), i.hooks.run("complete", c), r && r.call(c.element);
|
|
728
|
-
}
|
|
729
|
-
if (i.hooks.run("before-sanity-check", c), s = c.element.parentElement, s && s.nodeName.toLowerCase() === "pre" && !s.hasAttribute("tabindex") && s.setAttribute("tabindex", "0"), !c.code) {
|
|
730
|
-
i.hooks.run("complete", c), r && r.call(c.element);
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
if (i.hooks.run("before-highlight", c), !c.grammar) {
|
|
734
|
-
l(i.util.encode(c.code));
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
if (n && e.Worker) {
|
|
738
|
-
var u = new Worker(i.filename);
|
|
739
|
-
u.onmessage = function(e) {
|
|
740
|
-
l(e.data);
|
|
741
|
-
}, u.postMessage(JSON.stringify({
|
|
742
|
-
language: c.language,
|
|
743
|
-
code: c.code,
|
|
744
|
-
immediateClose: !0
|
|
745
|
-
}));
|
|
746
|
-
} else l(i.highlight(c.code, c.grammar, c.language));
|
|
747
|
-
},
|
|
748
|
-
highlight: function(e, t, n) {
|
|
749
|
-
var r = {
|
|
750
|
-
code: e,
|
|
751
|
-
grammar: t,
|
|
752
|
-
language: n
|
|
753
|
-
};
|
|
754
|
-
if (i.hooks.run("before-tokenize", r), !r.grammar) throw Error("The language \"" + r.language + "\" has no grammar.");
|
|
755
|
-
return r.tokens = i.tokenize(r.code, r.grammar), i.hooks.run("after-tokenize", r), a.stringify(i.util.encode(r.tokens), r.language);
|
|
756
|
-
},
|
|
757
|
-
tokenize: function(e, t) {
|
|
758
|
-
var n = t.rest;
|
|
759
|
-
if (n) {
|
|
760
|
-
for (var r in n) t[r] = n[r];
|
|
761
|
-
delete t.rest;
|
|
762
|
-
}
|
|
763
|
-
var i = new c();
|
|
764
|
-
return l(i, i.head, e), s(e, i, t, i.head, 0), d(i);
|
|
765
|
-
},
|
|
766
|
-
hooks: {
|
|
767
|
-
all: {},
|
|
768
|
-
add: function(e, t) {
|
|
769
|
-
var n = i.hooks.all;
|
|
770
|
-
n[e] = n[e] || [], n[e].push(t);
|
|
771
|
-
},
|
|
772
|
-
run: function(e, t) {
|
|
773
|
-
var n = i.hooks.all[e];
|
|
774
|
-
if (!(!n || !n.length)) for (var r = 0, a; a = n[r++];) a(t);
|
|
775
|
-
}
|
|
776
|
-
},
|
|
777
|
-
Token: a
|
|
778
|
-
};
|
|
779
|
-
e.Prism = i;
|
|
780
|
-
function a(e, t, n, r) {
|
|
781
|
-
this.type = e, this.content = t, this.alias = n, this.length = (r || "").length | 0;
|
|
782
|
-
}
|
|
783
|
-
a.stringify = function e(t, n) {
|
|
784
|
-
if (typeof t == "string") return t;
|
|
785
|
-
if (Array.isArray(t)) {
|
|
786
|
-
var r = "";
|
|
787
|
-
return t.forEach(function(t) {
|
|
788
|
-
r += e(t, n);
|
|
789
|
-
}), r;
|
|
790
|
-
}
|
|
791
|
-
var a = {
|
|
792
|
-
type: t.type,
|
|
793
|
-
content: e(t.content, n),
|
|
794
|
-
tag: "span",
|
|
795
|
-
classes: ["token", t.type],
|
|
796
|
-
attributes: {},
|
|
797
|
-
language: n
|
|
798
|
-
}, o = t.alias;
|
|
799
|
-
o && (Array.isArray(o) ? Array.prototype.push.apply(a.classes, o) : a.classes.push(o)), i.hooks.run("wrap", a);
|
|
800
|
-
var s = "";
|
|
801
|
-
for (var c in a.attributes) s += " " + c + "=\"" + (a.attributes[c] || "").replace(/"/g, """) + "\"";
|
|
802
|
-
return "<" + a.tag + " class=\"" + a.classes.join(" ") + "\"" + s + ">" + a.content + "</" + a.tag + ">";
|
|
803
|
-
};
|
|
804
|
-
function o(e, t, n, r) {
|
|
805
|
-
e.lastIndex = t;
|
|
806
|
-
var i = e.exec(n);
|
|
807
|
-
if (i && r && i[1]) {
|
|
808
|
-
var a = i[1].length;
|
|
809
|
-
i.index += a, i[0] = i[0].slice(a);
|
|
810
|
-
}
|
|
811
|
-
return i;
|
|
812
|
-
}
|
|
813
|
-
function s(e, t, n, r, c, d) {
|
|
814
|
-
for (var f in n) if (!(!n.hasOwnProperty(f) || !n[f])) {
|
|
815
|
-
var p = n[f];
|
|
816
|
-
p = Array.isArray(p) ? p : [p];
|
|
817
|
-
for (var m = 0; m < p.length; ++m) {
|
|
818
|
-
if (d && d.cause == f + "," + m) return;
|
|
819
|
-
var h = p[m], g = h.inside, _ = !!h.lookbehind, v = !!h.greedy, y = h.alias;
|
|
820
|
-
if (v && !h.pattern.global) {
|
|
821
|
-
var b = h.pattern.toString().match(/[imsuy]*$/)[0];
|
|
822
|
-
h.pattern = RegExp(h.pattern.source, b + "g");
|
|
823
|
-
}
|
|
824
|
-
for (var x = h.pattern || h, S = r.next, C = c; S !== t.tail && !(d && C >= d.reach); C += S.value.length, S = S.next) {
|
|
825
|
-
var w = S.value;
|
|
826
|
-
if (t.length > e.length) return;
|
|
827
|
-
if (!(w instanceof a)) {
|
|
828
|
-
var T = 1, E;
|
|
829
|
-
if (v) {
|
|
830
|
-
if (E = o(x, C, e, _), !E || E.index >= e.length) break;
|
|
831
|
-
var D = E.index, O = E.index + E[0].length, k = C;
|
|
832
|
-
for (k += S.value.length; D >= k;) S = S.next, k += S.value.length;
|
|
833
|
-
if (k -= S.value.length, C = k, S.value instanceof a) continue;
|
|
834
|
-
for (var A = S; A !== t.tail && (k < O || typeof A.value == "string"); A = A.next) T++, k += A.value.length;
|
|
835
|
-
T--, w = e.slice(C, k), E.index -= C;
|
|
836
|
-
} else if (E = o(x, 0, w, _), !E) continue;
|
|
837
|
-
var D = E.index, j = E[0], M = w.slice(0, D), N = w.slice(D + j.length), P = C + w.length;
|
|
838
|
-
d && P > d.reach && (d.reach = P);
|
|
839
|
-
var F = S.prev;
|
|
840
|
-
M && (F = l(t, F, M), C += M.length), u(t, F, T);
|
|
841
|
-
var I = new a(f, g ? i.tokenize(j, g) : j, y, j);
|
|
842
|
-
if (S = l(t, F, I), N && l(t, S, N), T > 1) {
|
|
843
|
-
var L = {
|
|
844
|
-
cause: f + "," + m,
|
|
845
|
-
reach: P
|
|
846
|
-
};
|
|
847
|
-
s(e, t, n, S.prev, C, L), d && L.reach > d.reach && (d.reach = L.reach);
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
function c() {
|
|
855
|
-
var e = {
|
|
856
|
-
value: null,
|
|
857
|
-
prev: null,
|
|
858
|
-
next: null
|
|
859
|
-
}, t = {
|
|
860
|
-
value: null,
|
|
861
|
-
prev: e,
|
|
862
|
-
next: null
|
|
863
|
-
};
|
|
864
|
-
e.next = t, this.head = e, this.tail = t, this.length = 0;
|
|
865
|
-
}
|
|
866
|
-
function l(e, t, n) {
|
|
867
|
-
var r = t.next, i = {
|
|
868
|
-
value: n,
|
|
869
|
-
prev: t,
|
|
870
|
-
next: r
|
|
871
|
-
};
|
|
872
|
-
return t.next = i, r.prev = i, e.length++, i;
|
|
873
|
-
}
|
|
874
|
-
function u(e, t, n) {
|
|
875
|
-
for (var r = t.next, i = 0; i < n && r !== e.tail; i++) r = r.next;
|
|
876
|
-
t.next = r, r.prev = t, e.length -= i;
|
|
877
|
-
}
|
|
878
|
-
function d(e) {
|
|
879
|
-
for (var t = [], n = e.head.next; n !== e.tail;) t.push(n.value), n = n.next;
|
|
880
|
-
return t;
|
|
881
|
-
}
|
|
882
|
-
if (!e.document) return e.addEventListener && (i.disableWorkerMessageHandler || e.addEventListener("message", function(t) {
|
|
883
|
-
var n = JSON.parse(t.data), r = n.language, a = n.code, o = n.immediateClose;
|
|
884
|
-
e.postMessage(i.highlight(a, i.languages[r], r)), o && e.close();
|
|
885
|
-
}, !1)), i;
|
|
886
|
-
var f = i.util.currentScript();
|
|
887
|
-
f && (i.filename = f.src, f.hasAttribute("data-manual") && (i.manual = !0));
|
|
888
|
-
function p() {
|
|
889
|
-
i.manual || i.highlightAll();
|
|
890
|
-
}
|
|
891
|
-
if (!i.manual) {
|
|
892
|
-
var m = document.readyState;
|
|
893
|
-
m === "loading" || m === "interactive" && f && f.defer ? document.addEventListener("DOMContentLoaded", p) : window.requestAnimationFrame ? window.requestAnimationFrame(p) : window.setTimeout(p, 16);
|
|
894
|
-
}
|
|
895
|
-
return i;
|
|
896
|
-
}(typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {});
|
|
897
|
-
t !== void 0 && t.exports && (t.exports = n), typeof global < "u" && (global.Prism = n), n.languages.markup = {
|
|
898
|
-
comment: {
|
|
899
|
-
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
900
|
-
greedy: !0
|
|
594
|
+
}), le = {
|
|
595
|
+
json: [
|
|
596
|
+
{
|
|
597
|
+
type: "property",
|
|
598
|
+
pattern: /"(?:\\.|[^"\\])*"(?=\s*:)/y
|
|
901
599
|
},
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
600
|
+
{
|
|
601
|
+
type: "string",
|
|
602
|
+
pattern: /"(?:\\.|[^"\\])*"/y
|
|
905
603
|
},
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
inside: {
|
|
910
|
-
"internal-subset": {
|
|
911
|
-
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
912
|
-
lookbehind: !0,
|
|
913
|
-
greedy: !0,
|
|
914
|
-
inside: null
|
|
915
|
-
},
|
|
916
|
-
string: {
|
|
917
|
-
pattern: /"[^"]*"|'[^']*'/,
|
|
918
|
-
greedy: !0
|
|
919
|
-
},
|
|
920
|
-
punctuation: /^<!|>$|[[\]]/,
|
|
921
|
-
"doctype-tag": /^DOCTYPE/i,
|
|
922
|
-
name: /[^\s<>'"]+/
|
|
923
|
-
}
|
|
604
|
+
{
|
|
605
|
+
type: "number",
|
|
606
|
+
pattern: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/iy
|
|
924
607
|
},
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
608
|
+
{
|
|
609
|
+
type: "boolean",
|
|
610
|
+
pattern: /\b(?:true|false)\b/y
|
|
928
611
|
},
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
inside: {
|
|
933
|
-
tag: {
|
|
934
|
-
pattern: /^<\/?[^\s>\/]+/,
|
|
935
|
-
inside: {
|
|
936
|
-
punctuation: /^<\/?/,
|
|
937
|
-
namespace: /^[^\s>\/:]+:/
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
"special-attr": [],
|
|
941
|
-
"attr-value": {
|
|
942
|
-
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
943
|
-
inside: { punctuation: [{
|
|
944
|
-
pattern: /^=/,
|
|
945
|
-
alias: "attr-equals"
|
|
946
|
-
}, {
|
|
947
|
-
pattern: /^(\s*)["']|["']$/,
|
|
948
|
-
lookbehind: !0
|
|
949
|
-
}] }
|
|
950
|
-
},
|
|
951
|
-
punctuation: /\/?>/,
|
|
952
|
-
"attr-name": {
|
|
953
|
-
pattern: /[^\s>\/]+/,
|
|
954
|
-
inside: { namespace: /^[^\s>\/:]+:/ }
|
|
955
|
-
}
|
|
956
|
-
}
|
|
612
|
+
{
|
|
613
|
+
type: "keyword",
|
|
614
|
+
pattern: /\bnull\b/y
|
|
957
615
|
},
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
}, /&#x?[\da-f]{1,8};/i]
|
|
962
|
-
}, n.languages.markup.tag.inside["attr-value"].inside.entity = n.languages.markup.entity, n.languages.markup.doctype.inside["internal-subset"].inside = n.languages.markup, n.hooks.add("wrap", function(e) {
|
|
963
|
-
e.type === "entity" && (e.attributes.title = e.content.replace(/&/, "&"));
|
|
964
|
-
}), Object.defineProperty(n.languages.markup.tag, "addInlined", { value: function(e, t) {
|
|
965
|
-
var r = {};
|
|
966
|
-
r["language-" + t] = {
|
|
967
|
-
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
968
|
-
lookbehind: !0,
|
|
969
|
-
inside: n.languages[t]
|
|
970
|
-
}, r.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
971
|
-
var i = { "included-cdata": {
|
|
972
|
-
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
973
|
-
inside: r
|
|
974
|
-
} };
|
|
975
|
-
i["language-" + t] = {
|
|
976
|
-
pattern: /[\s\S]+/,
|
|
977
|
-
inside: n.languages[t]
|
|
978
|
-
};
|
|
979
|
-
var a = {};
|
|
980
|
-
a[e] = {
|
|
981
|
-
pattern: RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)".replace(/__/g, function() {
|
|
982
|
-
return e;
|
|
983
|
-
}), "i"),
|
|
984
|
-
lookbehind: !0,
|
|
985
|
-
greedy: !0,
|
|
986
|
-
inside: i
|
|
987
|
-
}, n.languages.insertBefore("markup", "cdata", a);
|
|
988
|
-
} }), Object.defineProperty(n.languages.markup.tag, "addAttribute", { value: function(e, t) {
|
|
989
|
-
n.languages.markup.tag.inside["special-attr"].push({
|
|
990
|
-
pattern: RegExp("(^|[\"'\\s])(?:" + e + ")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))", "i"),
|
|
991
|
-
lookbehind: !0,
|
|
992
|
-
inside: {
|
|
993
|
-
"attr-name": /^[^\s=]+/,
|
|
994
|
-
"attr-value": {
|
|
995
|
-
pattern: /=[\s\S]+/,
|
|
996
|
-
inside: {
|
|
997
|
-
value: {
|
|
998
|
-
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
999
|
-
lookbehind: !0,
|
|
1000
|
-
alias: [t, "language-" + t],
|
|
1001
|
-
inside: n.languages[t]
|
|
1002
|
-
},
|
|
1003
|
-
punctuation: [{
|
|
1004
|
-
pattern: /^=/,
|
|
1005
|
-
alias: "attr-equals"
|
|
1006
|
-
}, /"|'/]
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
1011
|
-
} }), n.languages.html = n.languages.markup, n.languages.mathml = n.languages.markup, n.languages.svg = n.languages.markup, n.languages.xml = n.languages.extend("markup", {}), n.languages.ssml = n.languages.xml, n.languages.atom = n.languages.xml, n.languages.rss = n.languages.xml, (function(e) {
|
|
1012
|
-
var t = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1013
|
-
e.languages.css = {
|
|
1014
|
-
comment: /\/\*[\s\S]*?\*\//,
|
|
1015
|
-
atrule: {
|
|
1016
|
-
pattern: RegExp("@[\\w-](?:[^;{\\s\"']|\\s+(?!\\s)|" + t.source + ")*?(?:;|(?=\\s*\\{))"),
|
|
1017
|
-
inside: {
|
|
1018
|
-
rule: /^@[\w-]+/,
|
|
1019
|
-
"selector-function-argument": {
|
|
1020
|
-
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
1021
|
-
lookbehind: !0,
|
|
1022
|
-
alias: "selector"
|
|
1023
|
-
},
|
|
1024
|
-
keyword: {
|
|
1025
|
-
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
1026
|
-
lookbehind: !0
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
},
|
|
1030
|
-
url: {
|
|
1031
|
-
pattern: RegExp("\\burl\\((?:" + t.source + "|(?:[^\\\\\\r\\n()\"']|\\\\[\\s\\S])*)\\)", "i"),
|
|
1032
|
-
greedy: !0,
|
|
1033
|
-
inside: {
|
|
1034
|
-
function: /^url/i,
|
|
1035
|
-
punctuation: /^\(|\)$/,
|
|
1036
|
-
string: {
|
|
1037
|
-
pattern: RegExp("^" + t.source + "$"),
|
|
1038
|
-
alias: "url"
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1042
|
-
selector: {
|
|
1043
|
-
pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + t.source + ")*(?=\\s*\\{)"),
|
|
1044
|
-
lookbehind: !0
|
|
1045
|
-
},
|
|
1046
|
-
string: {
|
|
1047
|
-
pattern: t,
|
|
1048
|
-
greedy: !0
|
|
1049
|
-
},
|
|
1050
|
-
property: {
|
|
1051
|
-
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
1052
|
-
lookbehind: !0
|
|
1053
|
-
},
|
|
1054
|
-
important: /!important\b/i,
|
|
1055
|
-
function: {
|
|
1056
|
-
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
1057
|
-
lookbehind: !0
|
|
1058
|
-
},
|
|
1059
|
-
punctuation: /[(){};:,]/
|
|
1060
|
-
}, e.languages.css.atrule.inside.rest = e.languages.css;
|
|
1061
|
-
var n = e.languages.markup;
|
|
1062
|
-
n && (n.tag.addInlined("style", "css"), n.tag.addAttribute("style", "css"));
|
|
1063
|
-
})(n), n.languages.clike = {
|
|
1064
|
-
comment: [{
|
|
1065
|
-
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1066
|
-
lookbehind: !0,
|
|
1067
|
-
greedy: !0
|
|
1068
|
-
}, {
|
|
1069
|
-
pattern: /(^|[^\\:])\/\/.*/,
|
|
1070
|
-
lookbehind: !0,
|
|
1071
|
-
greedy: !0
|
|
1072
|
-
}],
|
|
1073
|
-
string: {
|
|
1074
|
-
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
1075
|
-
greedy: !0
|
|
616
|
+
{
|
|
617
|
+
type: "operator",
|
|
618
|
+
pattern: /:/y
|
|
1076
619
|
},
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
620
|
+
{
|
|
621
|
+
type: "punctuation",
|
|
622
|
+
pattern: /[{}[\],]/y
|
|
623
|
+
}
|
|
624
|
+
],
|
|
625
|
+
bash: [
|
|
626
|
+
{
|
|
627
|
+
type: "comment",
|
|
628
|
+
pattern: /#.*/y
|
|
1081
629
|
},
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
1086
|
-
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
1087
|
-
punctuation: /[{}[\];(),.:]/
|
|
1088
|
-
}, n.languages.javascript = n.languages.extend("clike", {
|
|
1089
|
-
"class-name": [n.languages.clike["class-name"], {
|
|
1090
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1091
|
-
lookbehind: !0
|
|
1092
|
-
}],
|
|
1093
|
-
keyword: [{
|
|
1094
|
-
pattern: /((?:^|\})\s*)catch\b/,
|
|
1095
|
-
lookbehind: !0
|
|
1096
|
-
}, {
|
|
1097
|
-
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
1098
|
-
lookbehind: !0
|
|
1099
|
-
}],
|
|
1100
|
-
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
1101
|
-
number: {
|
|
1102
|
-
pattern: RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),
|
|
1103
|
-
lookbehind: !0
|
|
630
|
+
{
|
|
631
|
+
type: "string",
|
|
632
|
+
pattern: /'(?:[^']*)'|"(?:\\.|[^"\\])*"/y
|
|
1104
633
|
},
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
pattern: RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))"),
|
|
1109
|
-
lookbehind: !0,
|
|
1110
|
-
greedy: !0,
|
|
1111
|
-
inside: {
|
|
1112
|
-
"regex-source": {
|
|
1113
|
-
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
1114
|
-
lookbehind: !0,
|
|
1115
|
-
alias: "language-regex",
|
|
1116
|
-
inside: n.languages.regex
|
|
1117
|
-
},
|
|
1118
|
-
"regex-delimiter": /^\/|\/$/,
|
|
1119
|
-
"regex-flags": /^[a-z]+$/
|
|
1120
|
-
}
|
|
634
|
+
{
|
|
635
|
+
type: "function",
|
|
636
|
+
pattern: /\b(?:curl|wget|fetch|http|httpie)\b/y
|
|
1121
637
|
},
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
638
|
+
{
|
|
639
|
+
type: "variable",
|
|
640
|
+
pattern: /\$[A-Za-z_][\w]*|\$\{[^}]+\}/y
|
|
1125
641
|
},
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
lookbehind: !0,
|
|
1130
|
-
inside: n.languages.javascript
|
|
1131
|
-
},
|
|
1132
|
-
{
|
|
1133
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
1134
|
-
lookbehind: !0,
|
|
1135
|
-
inside: n.languages.javascript
|
|
1136
|
-
},
|
|
1137
|
-
{
|
|
1138
|
-
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1139
|
-
lookbehind: !0,
|
|
1140
|
-
inside: n.languages.javascript
|
|
1141
|
-
},
|
|
1142
|
-
{
|
|
1143
|
-
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
1144
|
-
lookbehind: !0,
|
|
1145
|
-
inside: n.languages.javascript
|
|
1146
|
-
}
|
|
1147
|
-
],
|
|
1148
|
-
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
1149
|
-
}), n.languages.insertBefore("javascript", "string", {
|
|
1150
|
-
hashbang: {
|
|
1151
|
-
pattern: /^#!.*/,
|
|
1152
|
-
greedy: !0,
|
|
1153
|
-
alias: "comment"
|
|
642
|
+
{
|
|
643
|
+
type: "keyword",
|
|
644
|
+
pattern: /\b(?:if|then|else|fi|for|do|done|while|case|esac)\b/y
|
|
1154
645
|
},
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
inside: {
|
|
1159
|
-
"template-punctuation": {
|
|
1160
|
-
pattern: /^`|`$/,
|
|
1161
|
-
alias: "string"
|
|
1162
|
-
},
|
|
1163
|
-
interpolation: {
|
|
1164
|
-
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
1165
|
-
lookbehind: !0,
|
|
1166
|
-
inside: {
|
|
1167
|
-
"interpolation-punctuation": {
|
|
1168
|
-
pattern: /^\$\{|\}$/,
|
|
1169
|
-
alias: "punctuation"
|
|
1170
|
-
},
|
|
1171
|
-
rest: n.languages.javascript
|
|
1172
|
-
}
|
|
1173
|
-
},
|
|
1174
|
-
string: /[\s\S]+/
|
|
1175
|
-
}
|
|
646
|
+
{
|
|
647
|
+
type: "number",
|
|
648
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
1176
649
|
},
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
if (n === void 0 || typeof document > "u") return;
|
|
1189
|
-
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1190
|
-
var e = "Loading…", t = function(e, t) {
|
|
1191
|
-
return "✖ Error " + e + " while fetching file: " + t;
|
|
1192
|
-
}, r = "✖ Error: File does not exist or is empty", i = {
|
|
1193
|
-
js: "javascript",
|
|
1194
|
-
py: "python",
|
|
1195
|
-
rb: "ruby",
|
|
1196
|
-
ps1: "powershell",
|
|
1197
|
-
psm1: "powershell",
|
|
1198
|
-
sh: "bash",
|
|
1199
|
-
bat: "batch",
|
|
1200
|
-
h: "c",
|
|
1201
|
-
tex: "latex"
|
|
1202
|
-
}, a = "data-src-status", o = "loading", s = "loaded", c = "failed", l = "pre[data-src]:not([" + a + "=\"" + s + "\"]):not([" + a + "=\"" + o + "\"])";
|
|
1203
|
-
function u(e, n, i) {
|
|
1204
|
-
var a = new XMLHttpRequest();
|
|
1205
|
-
a.open("GET", e, !0), a.onreadystatechange = function() {
|
|
1206
|
-
a.readyState == 4 && (a.status < 400 && a.responseText ? n(a.responseText) : a.status >= 400 ? i(t(a.status, a.statusText)) : i(r));
|
|
1207
|
-
}, a.send(null);
|
|
1208
|
-
}
|
|
1209
|
-
function d(e) {
|
|
1210
|
-
var t = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e || "");
|
|
1211
|
-
if (t) {
|
|
1212
|
-
var n = Number(t[1]), r = t[2], i = t[3];
|
|
1213
|
-
return r ? i ? [n, Number(i)] : [n, void 0] : [n, n];
|
|
1214
|
-
}
|
|
650
|
+
{
|
|
651
|
+
type: "operator",
|
|
652
|
+
pattern: /&&|\|\||[|&;=<>]/y
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
type: "punctuation",
|
|
656
|
+
pattern: /\\|[()[\]{}]/y
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
type: "builtin",
|
|
660
|
+
pattern: /-{1,2}[A-Za-z][\w-]*/y
|
|
1215
661
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
t.code = "", r.setAttribute(a, o);
|
|
1222
|
-
var f = r.appendChild(document.createElement("CODE"));
|
|
1223
|
-
f.textContent = e;
|
|
1224
|
-
var p = r.getAttribute("data-src"), m = t.language;
|
|
1225
|
-
if (m === "none") {
|
|
1226
|
-
var h = (/\.(\w+)$/.exec(p) || [, "none"])[1];
|
|
1227
|
-
m = i[h] || h;
|
|
1228
|
-
}
|
|
1229
|
-
n.util.setLanguage(f, m), n.util.setLanguage(r, m);
|
|
1230
|
-
var g = n.plugins.autoloader;
|
|
1231
|
-
g && g.loadLanguages(m), u(p, function(e) {
|
|
1232
|
-
r.setAttribute(a, s);
|
|
1233
|
-
var t = d(r.getAttribute("data-range"));
|
|
1234
|
-
if (t) {
|
|
1235
|
-
var i = e.split(/\r\n?|\n/g), o = t[0], c = t[1] == null ? i.length : t[1];
|
|
1236
|
-
o < 0 && (o += i.length), o = Math.max(0, Math.min(o - 1, i.length)), c < 0 && (c += i.length), c = Math.max(0, Math.min(c, i.length)), e = i.slice(o, c).join("\n"), r.hasAttribute("data-start") || r.setAttribute("data-start", String(o + 1));
|
|
1237
|
-
}
|
|
1238
|
-
f.textContent = e, n.highlightElement(f);
|
|
1239
|
-
}, function(e) {
|
|
1240
|
-
r.setAttribute(a, c), f.textContent = e;
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
}), n.plugins.fileHighlight = { highlight: function(e) {
|
|
1244
|
-
for (var t = (e || document).querySelectorAll(l), r = 0, i; i = t[r++];) n.highlightElement(i);
|
|
1245
|
-
} };
|
|
1246
|
-
var f = !1;
|
|
1247
|
-
n.fileHighlight = function() {
|
|
1248
|
-
f ||= (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), !0), n.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1249
|
-
};
|
|
1250
|
-
})();
|
|
1251
|
-
}));
|
|
1252
|
-
(function(e) {
|
|
1253
|
-
var t = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", n = {
|
|
1254
|
-
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
1255
|
-
lookbehind: !0,
|
|
1256
|
-
alias: "punctuation",
|
|
1257
|
-
inside: null
|
|
1258
|
-
}, r = {
|
|
1259
|
-
bash: n,
|
|
1260
|
-
environment: {
|
|
1261
|
-
pattern: RegExp("\\$" + t),
|
|
1262
|
-
alias: "constant"
|
|
662
|
+
],
|
|
663
|
+
javascript: [
|
|
664
|
+
{
|
|
665
|
+
type: "comment",
|
|
666
|
+
pattern: /\/\/.*|\/\*.*?\*\//y
|
|
1263
667
|
},
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
greedy: !0,
|
|
1268
|
-
inside: {
|
|
1269
|
-
variable: [{
|
|
1270
|
-
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
1271
|
-
lookbehind: !0
|
|
1272
|
-
}, /^\$\(\(/],
|
|
1273
|
-
number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
1274
|
-
operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
1275
|
-
punctuation: /\(\(?|\)\)?|,|;/
|
|
1276
|
-
}
|
|
1277
|
-
},
|
|
1278
|
-
{
|
|
1279
|
-
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
1280
|
-
greedy: !0,
|
|
1281
|
-
inside: { variable: /^\$\(|^`|\)$|`$/ }
|
|
1282
|
-
},
|
|
1283
|
-
{
|
|
1284
|
-
pattern: /\$\{[^}]+\}/,
|
|
1285
|
-
greedy: !0,
|
|
1286
|
-
inside: {
|
|
1287
|
-
operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
1288
|
-
punctuation: /[\[\]]/,
|
|
1289
|
-
environment: {
|
|
1290
|
-
pattern: RegExp("(\\{)" + t),
|
|
1291
|
-
lookbehind: !0,
|
|
1292
|
-
alias: "constant"
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
},
|
|
1296
|
-
/\$(?:\w+|[#?*!@$])/
|
|
1297
|
-
],
|
|
1298
|
-
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
1299
|
-
};
|
|
1300
|
-
e.languages.bash = {
|
|
1301
|
-
shebang: {
|
|
1302
|
-
pattern: /^#!\s*\/.*/,
|
|
1303
|
-
alias: "important"
|
|
668
|
+
{
|
|
669
|
+
type: "string",
|
|
670
|
+
pattern: /'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|`(?:\\.|[^`\\])*`/y
|
|
1304
671
|
},
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
672
|
+
{
|
|
673
|
+
type: "keyword",
|
|
674
|
+
pattern: /\b(?:await|async|const|let|var|return|if|else|for|while|try|catch|throw|new|import|export|from|function|class)\b/y
|
|
1308
675
|
},
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
alias: "function"
|
|
1313
|
-
}, {
|
|
1314
|
-
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
1315
|
-
alias: "function"
|
|
1316
|
-
}],
|
|
1317
|
-
"for-or-select": {
|
|
1318
|
-
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
1319
|
-
alias: "variable",
|
|
1320
|
-
lookbehind: !0
|
|
676
|
+
{
|
|
677
|
+
type: "boolean",
|
|
678
|
+
pattern: /\b(?:true|false|null|undefined)\b/y
|
|
1321
679
|
},
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + t),
|
|
1326
|
-
lookbehind: !0,
|
|
1327
|
-
alias: "constant"
|
|
1328
|
-
} },
|
|
1329
|
-
alias: "variable",
|
|
1330
|
-
lookbehind: !0
|
|
680
|
+
{
|
|
681
|
+
type: "function",
|
|
682
|
+
pattern: /\b[A-Za-z_$][\w$]*(?=\s*\()/y
|
|
1331
683
|
},
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
lookbehind: !0
|
|
684
|
+
{
|
|
685
|
+
type: "number",
|
|
686
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
1336
687
|
},
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
lookbehind: !0,
|
|
1341
|
-
greedy: !0,
|
|
1342
|
-
inside: r
|
|
1343
|
-
},
|
|
1344
|
-
{
|
|
1345
|
-
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
1346
|
-
lookbehind: !0,
|
|
1347
|
-
greedy: !0,
|
|
1348
|
-
inside: { bash: n }
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
1352
|
-
lookbehind: !0,
|
|
1353
|
-
greedy: !0,
|
|
1354
|
-
inside: r
|
|
1355
|
-
},
|
|
1356
|
-
{
|
|
1357
|
-
pattern: /(^|[^$\\])'[^']*'/,
|
|
1358
|
-
lookbehind: !0,
|
|
1359
|
-
greedy: !0
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
1363
|
-
greedy: !0,
|
|
1364
|
-
inside: { entity: r.entity }
|
|
1365
|
-
}
|
|
1366
|
-
],
|
|
1367
|
-
environment: {
|
|
1368
|
-
pattern: RegExp("\\$?" + t),
|
|
1369
|
-
alias: "constant"
|
|
688
|
+
{
|
|
689
|
+
type: "operator",
|
|
690
|
+
pattern: /=>|===|!==|==|!=|<=|>=|\+\+|--|&&|\|\||[+\-*/%=<>!?:]/y
|
|
1370
691
|
},
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
pattern: /
|
|
1374
|
-
|
|
692
|
+
{
|
|
693
|
+
type: "punctuation",
|
|
694
|
+
pattern: /[()[\]{}.,;]/y
|
|
695
|
+
}
|
|
696
|
+
],
|
|
697
|
+
python: [
|
|
698
|
+
{
|
|
699
|
+
type: "comment",
|
|
700
|
+
pattern: /#.*/y
|
|
1375
701
|
},
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
702
|
+
{
|
|
703
|
+
type: "string",
|
|
704
|
+
pattern: /'''[\s\S]*?'''|"""[\s\S]*?"""|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/y
|
|
1379
705
|
},
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
alias: "class-name"
|
|
706
|
+
{
|
|
707
|
+
type: "keyword",
|
|
708
|
+
pattern: /\b(?:import|from|as|def|class|return|if|elif|else|for|while|try|except|with|lambda|pass|None|True|False|and|or|not|in|is)\b/y
|
|
1384
709
|
},
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
710
|
+
{
|
|
711
|
+
type: "function",
|
|
712
|
+
pattern: /\b[A-Za-z_]\w*(?=\s*\()/y
|
|
1388
713
|
},
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
714
|
+
{
|
|
715
|
+
type: "number",
|
|
716
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
1392
717
|
},
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
pattern: /^\d/,
|
|
1397
|
-
alias: "important"
|
|
1398
|
-
} }
|
|
718
|
+
{
|
|
719
|
+
type: "operator",
|
|
720
|
+
pattern: /==|!=|<=|>=|:=|[+\-*/%=<>]/y
|
|
1399
721
|
},
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
pattern: /(
|
|
1403
|
-
lookbehind: !0
|
|
1404
|
-
}
|
|
1405
|
-
}, n.inside = e.languages.bash;
|
|
1406
|
-
for (var i = [
|
|
1407
|
-
"comment",
|
|
1408
|
-
"function-name",
|
|
1409
|
-
"for-or-select",
|
|
1410
|
-
"assign-left",
|
|
1411
|
-
"parameter",
|
|
1412
|
-
"string",
|
|
1413
|
-
"environment",
|
|
1414
|
-
"function",
|
|
1415
|
-
"keyword",
|
|
1416
|
-
"builtin",
|
|
1417
|
-
"boolean",
|
|
1418
|
-
"file-descriptor",
|
|
1419
|
-
"operator",
|
|
1420
|
-
"punctuation",
|
|
1421
|
-
"number"
|
|
1422
|
-
], a = r.variable[1].inside, o = 0; o < i.length; o++) a[i[o]] = e.languages.bash[i[o]];
|
|
1423
|
-
e.languages.sh = e.languages.bash, e.languages.shell = e.languages.bash;
|
|
1424
|
-
})(Prism), Prism.languages.json = {
|
|
1425
|
-
property: {
|
|
1426
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
1427
|
-
lookbehind: !0,
|
|
1428
|
-
greedy: !0
|
|
1429
|
-
},
|
|
1430
|
-
string: {
|
|
1431
|
-
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
|
1432
|
-
lookbehind: !0,
|
|
1433
|
-
greedy: !0
|
|
1434
|
-
},
|
|
1435
|
-
comment: {
|
|
1436
|
-
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1437
|
-
greedy: !0
|
|
1438
|
-
},
|
|
1439
|
-
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
1440
|
-
punctuation: /[{}[\],]/,
|
|
1441
|
-
operator: /:/,
|
|
1442
|
-
boolean: /\b(?:false|true)\b/,
|
|
1443
|
-
null: {
|
|
1444
|
-
pattern: /\bnull\b/,
|
|
1445
|
-
alias: "keyword"
|
|
1446
|
-
}
|
|
1447
|
-
}, Prism.languages.webmanifest = Prism.languages.json, Prism.languages.python = {
|
|
1448
|
-
comment: {
|
|
1449
|
-
pattern: /(^|[^\\])#.*/,
|
|
1450
|
-
lookbehind: !0,
|
|
1451
|
-
greedy: !0
|
|
1452
|
-
},
|
|
1453
|
-
"string-interpolation": {
|
|
1454
|
-
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
1455
|
-
greedy: !0,
|
|
1456
|
-
inside: {
|
|
1457
|
-
interpolation: {
|
|
1458
|
-
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
1459
|
-
lookbehind: !0,
|
|
1460
|
-
inside: {
|
|
1461
|
-
"format-spec": {
|
|
1462
|
-
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
1463
|
-
lookbehind: !0
|
|
1464
|
-
},
|
|
1465
|
-
"conversion-option": {
|
|
1466
|
-
pattern: //,
|
|
1467
|
-
alias: "punctuation"
|
|
1468
|
-
},
|
|
1469
|
-
rest: null
|
|
1470
|
-
}
|
|
1471
|
-
},
|
|
1472
|
-
string: /[\s\S]+/
|
|
722
|
+
{
|
|
723
|
+
type: "punctuation",
|
|
724
|
+
pattern: /[()[\]{}.,:;]/y
|
|
1473
725
|
}
|
|
1474
|
-
},
|
|
1475
|
-
"triple-quoted-string": {
|
|
1476
|
-
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
1477
|
-
greedy: !0,
|
|
1478
|
-
alias: "string"
|
|
1479
|
-
},
|
|
1480
|
-
string: {
|
|
1481
|
-
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
1482
|
-
greedy: !0
|
|
1483
|
-
},
|
|
1484
|
-
function: {
|
|
1485
|
-
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
1486
|
-
lookbehind: !0
|
|
1487
|
-
},
|
|
1488
|
-
"class-name": {
|
|
1489
|
-
pattern: /(\bclass\s+)\w+/i,
|
|
1490
|
-
lookbehind: !0
|
|
1491
|
-
},
|
|
1492
|
-
decorator: {
|
|
1493
|
-
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
1494
|
-
lookbehind: !0,
|
|
1495
|
-
alias: ["annotation", "punctuation"],
|
|
1496
|
-
inside: { punctuation: /\./ }
|
|
1497
|
-
},
|
|
1498
|
-
keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
1499
|
-
builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
1500
|
-
boolean: /\b(?:False|None|True)\b/,
|
|
1501
|
-
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
1502
|
-
operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
1503
|
-
punctuation: /[{}[\];(),.:]/
|
|
1504
|
-
}, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python, Prism.languages.go = Prism.languages.extend("clike", {
|
|
1505
|
-
string: {
|
|
1506
|
-
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
|
|
1507
|
-
lookbehind: !0,
|
|
1508
|
-
greedy: !0
|
|
1509
|
-
},
|
|
1510
|
-
keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
|
1511
|
-
boolean: /\b(?:_|false|iota|nil|true)\b/,
|
|
1512
|
-
number: [
|
|
1513
|
-
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
|
1514
|
-
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
|
1515
|
-
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
|
1516
726
|
],
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
727
|
+
go: [
|
|
728
|
+
{
|
|
729
|
+
type: "comment",
|
|
730
|
+
pattern: /\/\/.*|\/\*.*?\*\//y
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
type: "string",
|
|
734
|
+
pattern: /`[^`]*`|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/y
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
type: "keyword",
|
|
738
|
+
pattern: /\b(?:package|import|func|var|const|type|struct|interface|return|if|else|for|range|go|defer|select|case|switch|default|nil|true|false)\b/y
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
type: "builtin",
|
|
742
|
+
pattern: /\b(?:append|bool|byte|cap|close|complex64|complex128|copy|delete|error|float32|float64|int|int8|int16|int32|int64|len|make|new|panic|print|println|real|recover|rune|string|uint|uint8|uint16|uint32|uint64|uintptr)\b/y
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
type: "function",
|
|
746
|
+
pattern: /\b[A-Za-z_]\w*(?=\s*\()/y
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
type: "number",
|
|
750
|
+
pattern: /\b\d+(?:\.\d+)?\b/y
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
type: "operator",
|
|
754
|
+
pattern: /:=|==|!=|<=|>=|\+\+|--|&&|\|\||[+\-*/%=<>!&|]/y
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
type: "punctuation",
|
|
758
|
+
pattern: /[()[\]{}.,;:]/y
|
|
759
|
+
}
|
|
760
|
+
]
|
|
1531
761
|
};
|
|
1532
|
-
function
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
762
|
+
function ue(e, t, n) {
|
|
763
|
+
for (let r of n) {
|
|
764
|
+
r.pattern.lastIndex = t;
|
|
765
|
+
let n = r.pattern.exec(e);
|
|
766
|
+
if (n?.index === t && n[0]) return {
|
|
767
|
+
type: r.type,
|
|
768
|
+
value: n[0]
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
return null;
|
|
1539
772
|
}
|
|
1540
|
-
function
|
|
1541
|
-
|
|
1542
|
-
|
|
773
|
+
function de(e, t) {
|
|
774
|
+
if (t === "plain" || !e) return e;
|
|
775
|
+
let n = le[t], r = [], i = "", a = 0, o = 0;
|
|
776
|
+
for (; a < e.length;) {
|
|
777
|
+
let t = ue(e, a, n);
|
|
778
|
+
if (!t) {
|
|
779
|
+
i += e[a], a += 1;
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
i &&= (r.push(i), ""), r.push(/* @__PURE__ */ c("span", {
|
|
783
|
+
className: `token ${t.type}`,
|
|
784
|
+
children: t.value
|
|
785
|
+
}, o)), o += 1, a += t.value.length;
|
|
786
|
+
}
|
|
787
|
+
return i && r.push(i), r;
|
|
1543
788
|
}
|
|
1544
789
|
//#endregion
|
|
1545
790
|
//#region src/components/ui/CodeBlock.tsx
|
|
1546
|
-
var
|
|
1547
|
-
let
|
|
791
|
+
var L = ({ code: e, language: t = "plain", showLineNumbers: n = !1, copyable: r = !0, maxHeight: a, reveal: o = !1, revealStagger: s = 70, className: d }) => {
|
|
792
|
+
let f = i(() => e.replace(/\n$/, "").split("\n"), [e]), p = String(f.length).length;
|
|
1548
793
|
return /* @__PURE__ */ l("div", {
|
|
1549
|
-
className:
|
|
794
|
+
className: u("group relative w-full overflow-hidden rounded-lg border border-border bg-surface-2", d),
|
|
1550
795
|
children: [r && /* @__PURE__ */ c("div", {
|
|
1551
796
|
className: "absolute right-2 top-2 z-10",
|
|
1552
|
-
children: /* @__PURE__ */ c(
|
|
797
|
+
children: /* @__PURE__ */ c(S, {
|
|
1553
798
|
value: e,
|
|
1554
799
|
size: "sm"
|
|
1555
800
|
})
|
|
@@ -1560,23 +805,23 @@ var W = ({ code: e, language: t = "plain", showLineNumbers: n = !1, copyable: r
|
|
|
1560
805
|
className: "w-max min-w-full p-3 font-mono text-[14px] leading-relaxed text-content",
|
|
1561
806
|
children: /* @__PURE__ */ c("code", {
|
|
1562
807
|
className: "flex flex-col bg-transparent p-0 text-[14px] text-content",
|
|
1563
|
-
children:
|
|
1564
|
-
className:
|
|
808
|
+
children: f.map((e, r) => /* @__PURE__ */ l("span", {
|
|
809
|
+
className: u("flex", o && "motion-safe:animate-[fade-in_0.6s_ease-out_both]"),
|
|
1565
810
|
style: o ? { animationDelay: `${r * s}ms` } : void 0,
|
|
1566
811
|
children: [n && /* @__PURE__ */ c("span", {
|
|
1567
812
|
className: "mr-4 shrink-0 select-none text-right text-muted",
|
|
1568
|
-
style: { width: `${
|
|
813
|
+
style: { width: `${p}ch` },
|
|
1569
814
|
children: r + 1
|
|
1570
815
|
}), /* @__PURE__ */ c("span", {
|
|
1571
816
|
className: "whitespace-pre",
|
|
1572
|
-
children:
|
|
817
|
+
children: de(e, t) || " "
|
|
1573
818
|
})]
|
|
1574
819
|
}, r))
|
|
1575
820
|
})
|
|
1576
821
|
})
|
|
1577
822
|
})]
|
|
1578
823
|
});
|
|
1579
|
-
},
|
|
824
|
+
}, R = /* @__PURE__ */ new Set([
|
|
1580
825
|
"accept-charset",
|
|
1581
826
|
"accept-encoding",
|
|
1582
827
|
"access-control-request-headers",
|
|
@@ -1598,7 +843,7 @@ var W = ({ code: e, language: t = "plain", showLineNumbers: n = !1, copyable: r
|
|
|
1598
843
|
"upgrade",
|
|
1599
844
|
"via"
|
|
1600
845
|
]);
|
|
1601
|
-
function
|
|
846
|
+
function fe(e) {
|
|
1602
847
|
return !e.auth || e.auth.type === "none" ? null : e.auth.type === "bearer" ? {
|
|
1603
848
|
key: "Authorization",
|
|
1604
849
|
value: `Bearer ${e.auth.token}`
|
|
@@ -1607,23 +852,23 @@ function _e(e) {
|
|
|
1607
852
|
value: e.auth.value
|
|
1608
853
|
};
|
|
1609
854
|
}
|
|
1610
|
-
function
|
|
855
|
+
function pe(e) {
|
|
1611
856
|
let t = new Headers();
|
|
1612
|
-
for (let n of e.headers ?? []) n.key.trim() && (
|
|
1613
|
-
let n =
|
|
1614
|
-
return n && !
|
|
857
|
+
for (let n of e.headers ?? []) n.key.trim() && (R.has(n.key.trim().toLowerCase()) || t.set(n.key, n.value));
|
|
858
|
+
let n = fe(e);
|
|
859
|
+
return n && !R.has(n.key.toLowerCase()) && t.set(n.key, n.value), t;
|
|
1615
860
|
}
|
|
1616
|
-
function
|
|
861
|
+
function me(e) {
|
|
1617
862
|
return [...e.entries()].map(([e, t]) => ({
|
|
1618
863
|
key: e,
|
|
1619
864
|
value: t
|
|
1620
865
|
}));
|
|
1621
866
|
}
|
|
1622
|
-
function
|
|
867
|
+
function z(e) {
|
|
1623
868
|
let t = new TextEncoder().encode(e).length;
|
|
1624
869
|
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
|
|
1625
870
|
}
|
|
1626
|
-
function
|
|
871
|
+
function he(e, t) {
|
|
1627
872
|
if (!(t?.includes("json") || /^[\s\n]*(?:\[|\{)/.test(e))) return e;
|
|
1628
873
|
try {
|
|
1629
874
|
return JSON.stringify(JSON.parse(e), null, 2);
|
|
@@ -1631,11 +876,11 @@ function xe(e, t) {
|
|
|
1631
876
|
return e;
|
|
1632
877
|
}
|
|
1633
878
|
}
|
|
1634
|
-
function
|
|
879
|
+
function ge(e) {
|
|
1635
880
|
return e instanceof Error ? e.message : "Request failed";
|
|
1636
881
|
}
|
|
1637
|
-
function
|
|
1638
|
-
let n =
|
|
882
|
+
function B(e, t = performance.now()) {
|
|
883
|
+
let n = ge(e);
|
|
1639
884
|
return {
|
|
1640
885
|
status: 0,
|
|
1641
886
|
statusText: "Network Error",
|
|
@@ -1649,27 +894,27 @@ function G(e, t = performance.now()) {
|
|
|
1649
894
|
error: n
|
|
1650
895
|
};
|
|
1651
896
|
}
|
|
1652
|
-
async function
|
|
897
|
+
async function V(e) {
|
|
1653
898
|
let t = performance.now();
|
|
1654
899
|
try {
|
|
1655
900
|
let n = await fetch(e.url, {
|
|
1656
901
|
method: e.method,
|
|
1657
|
-
headers:
|
|
902
|
+
headers: pe(e),
|
|
1658
903
|
body: e.body && e.method !== "GET" ? e.body : void 0
|
|
1659
|
-
}), r = await n.text(), i =
|
|
904
|
+
}), r = await n.text(), i = he(r, n.headers.get("content-type"));
|
|
1660
905
|
return {
|
|
1661
906
|
status: n.status,
|
|
1662
907
|
statusText: n.statusText || (n.ok ? "OK" : "Error"),
|
|
1663
|
-
headers:
|
|
908
|
+
headers: me(n.headers),
|
|
1664
909
|
body: i,
|
|
1665
910
|
timeMs: Math.round(performance.now() - t),
|
|
1666
|
-
size:
|
|
911
|
+
size: z(r)
|
|
1667
912
|
};
|
|
1668
913
|
} catch (e) {
|
|
1669
|
-
return
|
|
914
|
+
return B(e, t);
|
|
1670
915
|
}
|
|
1671
916
|
}
|
|
1672
|
-
function
|
|
917
|
+
function H(e) {
|
|
1673
918
|
let t = e.sampleResponse ?? JSON.stringify({
|
|
1674
919
|
ok: !0,
|
|
1675
920
|
request: e.title
|
|
@@ -1686,20 +931,20 @@ function we(e) {
|
|
|
1686
931
|
}],
|
|
1687
932
|
body: t,
|
|
1688
933
|
timeMs: 142,
|
|
1689
|
-
size:
|
|
934
|
+
size: z(t)
|
|
1690
935
|
};
|
|
1691
936
|
}
|
|
1692
937
|
//#endregion
|
|
1693
938
|
//#region src/features/api-widget/request-model.ts
|
|
1694
|
-
var
|
|
939
|
+
var U = "Authorization", _e = "Bearer ", ve = [{
|
|
1695
940
|
key: "Content-Type",
|
|
1696
941
|
value: "application/json",
|
|
1697
942
|
enabled: !0
|
|
1698
943
|
}];
|
|
1699
|
-
function
|
|
944
|
+
function ye(e) {
|
|
1700
945
|
return e.type === "none" ? null : e.type === "bearer" ? {
|
|
1701
|
-
key:
|
|
1702
|
-
value: `${
|
|
946
|
+
key: U,
|
|
947
|
+
value: `${_e}${e.token}`,
|
|
1703
948
|
enabled: !0
|
|
1704
949
|
} : {
|
|
1705
950
|
key: e.key,
|
|
@@ -1707,57 +952,57 @@ function De(e) {
|
|
|
1707
952
|
enabled: !0
|
|
1708
953
|
};
|
|
1709
954
|
}
|
|
1710
|
-
function
|
|
955
|
+
function W(e, t) {
|
|
1711
956
|
return e.toLowerCase() === t.toLowerCase();
|
|
1712
957
|
}
|
|
1713
|
-
function
|
|
1714
|
-
return e.toLowerCase().startsWith(
|
|
958
|
+
function be(e) {
|
|
959
|
+
return e.toLowerCase().startsWith(_e.toLowerCase());
|
|
1715
960
|
}
|
|
1716
|
-
function
|
|
1717
|
-
return
|
|
961
|
+
function xe(e) {
|
|
962
|
+
return be(e) ? e.slice(7) : e;
|
|
1718
963
|
}
|
|
1719
|
-
function
|
|
1720
|
-
return e ?
|
|
964
|
+
function Se(e) {
|
|
965
|
+
return e ? W(e.key, U) && be(e.value) ? {
|
|
1721
966
|
type: "bearer",
|
|
1722
|
-
token:
|
|
967
|
+
token: xe(e.value)
|
|
1723
968
|
} : {
|
|
1724
969
|
type: "apiKey",
|
|
1725
|
-
key: e.key ||
|
|
970
|
+
key: e.key || U,
|
|
1726
971
|
value: e.value,
|
|
1727
972
|
in: "header"
|
|
1728
973
|
} : { type: "none" };
|
|
1729
974
|
}
|
|
1730
|
-
function
|
|
1731
|
-
return e.type === "apiKey" ? e.key :
|
|
975
|
+
function Ce(e) {
|
|
976
|
+
return e.type === "apiKey" ? e.key : U;
|
|
1732
977
|
}
|
|
1733
|
-
function
|
|
1734
|
-
return t.type === "none" ?
|
|
978
|
+
function G(e, t) {
|
|
979
|
+
return t.type === "none" ? W(e.key, U) : W(e.key, Ce(t));
|
|
1735
980
|
}
|
|
1736
|
-
function
|
|
1737
|
-
return e.auth ? e.auth :
|
|
981
|
+
function we(e) {
|
|
982
|
+
return e.auth ? e.auth : Se(e.headers?.find((e) => W(e.key, U)));
|
|
1738
983
|
}
|
|
1739
|
-
function
|
|
1740
|
-
let n = (e.headers?.length ? e.headers :
|
|
984
|
+
function Te(e, t) {
|
|
985
|
+
let n = (e.headers?.length ? e.headers : ve).filter((e) => !G(e, t)).map((e) => ({
|
|
1741
986
|
...e,
|
|
1742
987
|
enabled: !0
|
|
1743
|
-
})), r =
|
|
988
|
+
})), r = ye(t);
|
|
1744
989
|
return r ? [...n, r] : n;
|
|
1745
990
|
}
|
|
1746
|
-
function
|
|
1747
|
-
if (t.type === "none") return e.map((e) =>
|
|
991
|
+
function Ee(e, t, n) {
|
|
992
|
+
if (t.type === "none") return e.map((e) => G(e, n) || W(e.key, U) ? {
|
|
1748
993
|
...e,
|
|
1749
994
|
enabled: !1
|
|
1750
995
|
} : e);
|
|
1751
|
-
let r =
|
|
1752
|
-
return r ? [...e.filter((e) => !
|
|
996
|
+
let r = ye(t);
|
|
997
|
+
return r ? [...e.filter((e) => !G(e, n) && !G(e, t)), r] : e;
|
|
1753
998
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return e.filter((e) => e.enabled && e.key.trim() && !
|
|
999
|
+
function De(e, t) {
|
|
1000
|
+
return e.filter((e) => e.enabled && e.key.trim() && !G(e, t)).map(({ key: e, value: t }) => ({
|
|
1756
1001
|
key: e,
|
|
1757
1002
|
value: t
|
|
1758
1003
|
}));
|
|
1759
1004
|
}
|
|
1760
|
-
function
|
|
1005
|
+
function K(e) {
|
|
1761
1006
|
return JSON.stringify({
|
|
1762
1007
|
method: e.method,
|
|
1763
1008
|
url: e.url,
|
|
@@ -1766,7 +1011,7 @@ function Y(e) {
|
|
|
1766
1011
|
body: e.body ?? ""
|
|
1767
1012
|
});
|
|
1768
1013
|
}
|
|
1769
|
-
function
|
|
1014
|
+
function Oe(e, t) {
|
|
1770
1015
|
let n = t.body.trim() ? t.body : void 0;
|
|
1771
1016
|
return {
|
|
1772
1017
|
...e,
|
|
@@ -1774,18 +1019,18 @@ function Ie(e, t) {
|
|
|
1774
1019
|
url: t.url,
|
|
1775
1020
|
body: n,
|
|
1776
1021
|
auth: t.auth,
|
|
1777
|
-
headers:
|
|
1022
|
+
headers: De(t.headers, t.auth)
|
|
1778
1023
|
};
|
|
1779
1024
|
}
|
|
1780
1025
|
//#endregion
|
|
1781
1026
|
//#region src/features/api-widget/ApiConsole.tsx
|
|
1782
|
-
var
|
|
1027
|
+
var ke = "{\n \n}", q = "Authorization", Ae = [
|
|
1783
1028
|
"GET",
|
|
1784
1029
|
"POST",
|
|
1785
1030
|
"PUT",
|
|
1786
1031
|
"PATCH",
|
|
1787
1032
|
"DELETE"
|
|
1788
|
-
],
|
|
1033
|
+
], je = [
|
|
1789
1034
|
{
|
|
1790
1035
|
id: "body",
|
|
1791
1036
|
label: "Body"
|
|
@@ -1798,13 +1043,13 @@ var Le = "{\n \n}", X = "Authorization", Re = [
|
|
|
1798
1043
|
id: "auth",
|
|
1799
1044
|
label: "Auth"
|
|
1800
1045
|
}
|
|
1801
|
-
],
|
|
1046
|
+
], Me = [{
|
|
1802
1047
|
id: "response",
|
|
1803
1048
|
label: "Response"
|
|
1804
1049
|
}, {
|
|
1805
1050
|
id: "history",
|
|
1806
1051
|
label: "History"
|
|
1807
|
-
}],
|
|
1052
|
+
}], Ne = ["body", "headers"], Pe = [
|
|
1808
1053
|
{
|
|
1809
1054
|
id: "none",
|
|
1810
1055
|
label: "None",
|
|
@@ -1821,38 +1066,38 @@ var Le = "{\n \n}", X = "Authorization", Re = [
|
|
|
1821
1066
|
className: "font-semibold text-content hover:bg-surface-2"
|
|
1822
1067
|
}
|
|
1823
1068
|
];
|
|
1824
|
-
function
|
|
1069
|
+
function Fe(e) {
|
|
1825
1070
|
return Math.max(3, e.split("\n").length);
|
|
1826
1071
|
}
|
|
1827
|
-
function
|
|
1072
|
+
function Ie(e) {
|
|
1828
1073
|
return JSON.stringify(JSON.parse(e), null, 2);
|
|
1829
1074
|
}
|
|
1830
|
-
function
|
|
1075
|
+
function Le(e) {
|
|
1831
1076
|
try {
|
|
1832
|
-
return
|
|
1077
|
+
return Ie(e);
|
|
1833
1078
|
} catch {
|
|
1834
1079
|
return e;
|
|
1835
1080
|
}
|
|
1836
1081
|
}
|
|
1837
|
-
var
|
|
1838
|
-
className:
|
|
1082
|
+
var Re = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
1083
|
+
className: u("flex min-h-10 items-center rounded-md border border-transparent bg-surface-2 px-3 text-sm text-content", "focus-within:border-primary/60 focus-within:ring-2 focus-within:ring-primary/20", t),
|
|
1839
1084
|
children: e
|
|
1840
|
-
}),
|
|
1085
|
+
}), ze = ({ value: e, onChange: t }) => /* @__PURE__ */ c("div", {
|
|
1841
1086
|
className: "inline-flex items-center gap-4",
|
|
1842
|
-
children:
|
|
1087
|
+
children: Ne.map((n) => /* @__PURE__ */ c("button", {
|
|
1843
1088
|
type: "button",
|
|
1844
1089
|
onClick: () => t(n),
|
|
1845
|
-
className:
|
|
1090
|
+
className: u("text-xs font-medium capitalize transition-colors", e === n ? "text-content" : "text-muted hover:text-content"),
|
|
1846
1091
|
children: n
|
|
1847
1092
|
}, n))
|
|
1848
|
-
}),
|
|
1093
|
+
}), Be = ({ method: e, url: t, isSending: n, editable: r, onMethodChange: i, onUrlChange: a, onSend: o }) => /* @__PURE__ */ l("div", {
|
|
1849
1094
|
className: "grid gap-3 md:grid-cols-[1fr_auto]",
|
|
1850
|
-
children: [/* @__PURE__ */ l(
|
|
1095
|
+
children: [/* @__PURE__ */ l(Re, {
|
|
1851
1096
|
className: "min-w-0",
|
|
1852
|
-
children: [/* @__PURE__ */ c(
|
|
1097
|
+
children: [/* @__PURE__ */ c(ce, {
|
|
1853
1098
|
value: e,
|
|
1854
1099
|
onChange: i,
|
|
1855
|
-
methods:
|
|
1100
|
+
methods: Ae,
|
|
1856
1101
|
disabled: !r
|
|
1857
1102
|
}), /* @__PURE__ */ c("input", {
|
|
1858
1103
|
value: t,
|
|
@@ -1861,24 +1106,24 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1861
1106
|
"aria-label": "Request URL",
|
|
1862
1107
|
className: "min-w-0 flex-1 bg-transparent px-2 py-2 font-mono text-[14px] text-muted outline-none read-only:cursor-default"
|
|
1863
1108
|
})]
|
|
1864
|
-
}), /* @__PURE__ */ c(
|
|
1109
|
+
}), /* @__PURE__ */ c(g, {
|
|
1865
1110
|
size: "md",
|
|
1866
1111
|
variant: "primary",
|
|
1867
1112
|
isLoading: n,
|
|
1868
1113
|
onClick: o,
|
|
1869
|
-
rightIcon: /* @__PURE__ */ c(
|
|
1114
|
+
rightIcon: /* @__PURE__ */ c(f, {
|
|
1870
1115
|
name: "send",
|
|
1871
1116
|
className: "h-4 w-4"
|
|
1872
1117
|
}),
|
|
1873
1118
|
className: "min-h-10 px-7",
|
|
1874
1119
|
children: "Send"
|
|
1875
1120
|
})]
|
|
1876
|
-
}),
|
|
1121
|
+
}), Ve = ({ header: e, index: t, editable: n, onUpdate: r, onRemove: i }) => /* @__PURE__ */ l("div", {
|
|
1877
1122
|
className: "grid grid-cols-[auto_1fr_auto] gap-3 md:grid-cols-[auto_1fr_1fr_auto]",
|
|
1878
1123
|
children: [
|
|
1879
1124
|
/* @__PURE__ */ c("span", {
|
|
1880
1125
|
className: "flex h-8 items-center",
|
|
1881
|
-
children: /* @__PURE__ */ c(
|
|
1126
|
+
children: /* @__PURE__ */ c(O, {
|
|
1882
1127
|
size: "sm",
|
|
1883
1128
|
checked: e.enabled,
|
|
1884
1129
|
onChange: (e) => r(t, { enabled: e }),
|
|
@@ -1886,7 +1131,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1886
1131
|
"aria-label": `Enable ${e.key}`
|
|
1887
1132
|
})
|
|
1888
1133
|
}),
|
|
1889
|
-
/* @__PURE__ */ c(
|
|
1134
|
+
/* @__PURE__ */ c(F, {
|
|
1890
1135
|
size: "sm",
|
|
1891
1136
|
value: e.key,
|
|
1892
1137
|
onChange: (e) => r(t, { key: e.target.value }),
|
|
@@ -1894,7 +1139,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1894
1139
|
"aria-label": "Header name",
|
|
1895
1140
|
className: "font-mono"
|
|
1896
1141
|
}),
|
|
1897
|
-
/* @__PURE__ */ c(
|
|
1142
|
+
/* @__PURE__ */ c(F, {
|
|
1898
1143
|
size: "sm",
|
|
1899
1144
|
value: e.value,
|
|
1900
1145
|
onChange: (e) => r(t, { value: e.target.value }),
|
|
@@ -1909,13 +1154,13 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1909
1154
|
onClick: () => i(t),
|
|
1910
1155
|
disabled: !n,
|
|
1911
1156
|
className: "row-span-2 inline-flex h-8 w-8 items-center justify-center rounded-md text-muted transition-colors hover:bg-surface-2 hover:text-content disabled:cursor-not-allowed disabled:opacity-40 md:row-span-1",
|
|
1912
|
-
children: /* @__PURE__ */ c(
|
|
1157
|
+
children: /* @__PURE__ */ c(f, {
|
|
1913
1158
|
name: "trash",
|
|
1914
1159
|
className: "h-4 w-4"
|
|
1915
1160
|
})
|
|
1916
1161
|
})
|
|
1917
1162
|
]
|
|
1918
|
-
}),
|
|
1163
|
+
}), He = ({ body: e, error: t, editable: n, onBodyChange: r, onClearError: i }) => /* @__PURE__ */ l("div", {
|
|
1919
1164
|
className: "space-y-2",
|
|
1920
1165
|
children: [t && /* @__PURE__ */ c("div", {
|
|
1921
1166
|
className: "text-xs text-muted",
|
|
@@ -1928,16 +1173,16 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1928
1173
|
readOnly: !n,
|
|
1929
1174
|
"aria-label": "Request body",
|
|
1930
1175
|
spellCheck: !1,
|
|
1931
|
-
rows:
|
|
1932
|
-
className:
|
|
1176
|
+
rows: Fe(e),
|
|
1177
|
+
className: u("w-full resize-none overflow-hidden rounded-lg border border-border bg-surface-2 p-3 [field-sizing:content]", "font-mono text-[13px] leading-relaxed text-content outline-none placeholder:text-muted read-only:cursor-default")
|
|
1933
1178
|
})]
|
|
1934
|
-
}),
|
|
1179
|
+
}), Ue = ({ auth: e, editable: t, onChange: n }) => {
|
|
1935
1180
|
let [r, i] = o(!1), a = /* @__PURE__ */ c("button", {
|
|
1936
1181
|
type: "button",
|
|
1937
1182
|
"aria-label": r ? "Hide secret" : "Show secret",
|
|
1938
1183
|
onClick: () => i((e) => !e),
|
|
1939
1184
|
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-muted transition-colors hover:text-content",
|
|
1940
|
-
children: /* @__PURE__ */ c(
|
|
1185
|
+
children: /* @__PURE__ */ c(f, {
|
|
1941
1186
|
name: r ? "eye-closed" : "eye",
|
|
1942
1187
|
className: "h-4 w-4"
|
|
1943
1188
|
})
|
|
@@ -1945,7 +1190,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1945
1190
|
return /* @__PURE__ */ l("div", {
|
|
1946
1191
|
className: "grid items-start gap-3 md:grid-cols-[auto_1fr]",
|
|
1947
1192
|
children: [
|
|
1948
|
-
/* @__PURE__ */ c(
|
|
1193
|
+
/* @__PURE__ */ c(ie, {
|
|
1949
1194
|
value: e.type,
|
|
1950
1195
|
onChange: (t) => {
|
|
1951
1196
|
t === "none" && n({ type: "none" }), t === "bearer" && n({
|
|
@@ -1953,12 +1198,12 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1953
1198
|
token: e.type === "bearer" ? e.token : ""
|
|
1954
1199
|
}), t === "apiKey" && n({
|
|
1955
1200
|
type: "apiKey",
|
|
1956
|
-
key: e.type === "apiKey" ? e.key :
|
|
1201
|
+
key: e.type === "apiKey" ? e.key : q,
|
|
1957
1202
|
value: e.type === "apiKey" ? e.value : "",
|
|
1958
1203
|
in: "header"
|
|
1959
1204
|
});
|
|
1960
1205
|
},
|
|
1961
|
-
items:
|
|
1206
|
+
items: Pe,
|
|
1962
1207
|
size: "md",
|
|
1963
1208
|
disabled: !t,
|
|
1964
1209
|
minWidthClassName: "min-w-28"
|
|
@@ -1967,7 +1212,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1967
1212
|
className: "rounded-lg border border-border bg-surface-2 p-2.5 text-xs text-muted",
|
|
1968
1213
|
children: "Auth is disabled for this request."
|
|
1969
1214
|
}),
|
|
1970
|
-
e.type === "bearer" && /* @__PURE__ */ c(
|
|
1215
|
+
e.type === "bearer" && /* @__PURE__ */ c(F, {
|
|
1971
1216
|
size: "sm",
|
|
1972
1217
|
type: r ? "text" : "password",
|
|
1973
1218
|
value: e.token,
|
|
@@ -1981,7 +1226,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1981
1226
|
}),
|
|
1982
1227
|
e.type === "apiKey" && /* @__PURE__ */ l("div", {
|
|
1983
1228
|
className: "grid gap-3 md:grid-cols-[minmax(0,0.7fr)_minmax(0,1fr)]",
|
|
1984
|
-
children: [/* @__PURE__ */ c(
|
|
1229
|
+
children: [/* @__PURE__ */ c(F, {
|
|
1985
1230
|
size: "sm",
|
|
1986
1231
|
value: e.key,
|
|
1987
1232
|
onChange: (t) => n({
|
|
@@ -1992,7 +1237,7 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
1992
1237
|
}),
|
|
1993
1238
|
readOnly: !t,
|
|
1994
1239
|
className: "font-mono"
|
|
1995
|
-
}), /* @__PURE__ */ c(
|
|
1240
|
+
}), /* @__PURE__ */ c(F, {
|
|
1996
1241
|
size: "sm",
|
|
1997
1242
|
type: r ? "text" : "password",
|
|
1998
1243
|
value: e.value,
|
|
@@ -2009,19 +1254,19 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2009
1254
|
})
|
|
2010
1255
|
]
|
|
2011
1256
|
});
|
|
2012
|
-
},
|
|
1257
|
+
}, We = ({ activeTab: e, auth: t, headers: n, body: r, bodyError: i, editable: a, onAuthChange: o, onHeaderUpdate: s, onHeaderRemove: u, onHeaderAdd: d, onBodyChange: p, onBodyErrorClear: m }) => e === "body" ? /* @__PURE__ */ c(He, {
|
|
2013
1258
|
body: r,
|
|
2014
1259
|
error: i,
|
|
2015
1260
|
editable: a,
|
|
2016
|
-
onBodyChange:
|
|
2017
|
-
onClearError:
|
|
2018
|
-
}) : e === "auth" ? /* @__PURE__ */ c(
|
|
1261
|
+
onBodyChange: p,
|
|
1262
|
+
onClearError: m
|
|
1263
|
+
}) : e === "auth" ? /* @__PURE__ */ c(Ue, {
|
|
2019
1264
|
auth: t,
|
|
2020
1265
|
editable: a,
|
|
2021
1266
|
onChange: o
|
|
2022
1267
|
}) : /* @__PURE__ */ l("div", {
|
|
2023
1268
|
className: "space-y-2.5",
|
|
2024
|
-
children: [n.map((e, t) => /* @__PURE__ */ c(
|
|
1269
|
+
children: [n.map((e, t) => /* @__PURE__ */ c(Ve, {
|
|
2025
1270
|
header: e,
|
|
2026
1271
|
index: t,
|
|
2027
1272
|
editable: a,
|
|
@@ -2032,19 +1277,19 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2032
1277
|
onClick: d,
|
|
2033
1278
|
disabled: !a,
|
|
2034
1279
|
className: "inline-flex items-center gap-1.5 rounded-md px-1 py-1 text-xs font-medium text-primary transition-colors hover:text-primary-hover disabled:cursor-not-allowed disabled:opacity-40",
|
|
2035
|
-
children: [/* @__PURE__ */ c(
|
|
1280
|
+
children: [/* @__PURE__ */ c(f, {
|
|
2036
1281
|
name: "plus",
|
|
2037
1282
|
className: "h-4 w-4"
|
|
2038
1283
|
}), "Add header"]
|
|
2039
1284
|
})]
|
|
2040
|
-
}),
|
|
1285
|
+
}), Ge = ({ responsePanel: e, response: t }) => {
|
|
2041
1286
|
let n = e === "body", r = t.headers.map((e) => `${e.key}: ${e.value}`).join("\n"), i = n ? t.body : r || "No response headers";
|
|
2042
1287
|
return /* @__PURE__ */ l("div", {
|
|
2043
1288
|
className: "relative p-3",
|
|
2044
1289
|
children: [/* @__PURE__ */ l("div", {
|
|
2045
1290
|
className: "absolute right-5 top-5 z-10 flex items-center gap-1",
|
|
2046
1291
|
children: [
|
|
2047
|
-
/* @__PURE__ */ c(
|
|
1292
|
+
/* @__PURE__ */ c(y, {
|
|
2048
1293
|
"aria-label": "Download response",
|
|
2049
1294
|
variant: "surface",
|
|
2050
1295
|
size: "sm",
|
|
@@ -2052,12 +1297,12 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2052
1297
|
let e = new Blob([i], { type: n ? "application/json" : "text/plain" }), t = URL.createObjectURL(e), r = document.createElement("a");
|
|
2053
1298
|
r.href = t, r.download = n ? "response.json" : "response-headers.txt", r.click(), URL.revokeObjectURL(t);
|
|
2054
1299
|
},
|
|
2055
|
-
children: /* @__PURE__ */ c(
|
|
1300
|
+
children: /* @__PURE__ */ c(f, {
|
|
2056
1301
|
name: "download",
|
|
2057
1302
|
size: 14
|
|
2058
1303
|
})
|
|
2059
1304
|
}),
|
|
2060
|
-
/* @__PURE__ */ c(
|
|
1305
|
+
/* @__PURE__ */ c(y, {
|
|
2061
1306
|
"aria-label": "Share response",
|
|
2062
1307
|
variant: "surface",
|
|
2063
1308
|
size: "sm",
|
|
@@ -2070,17 +1315,17 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2070
1315
|
} catch {}
|
|
2071
1316
|
else await navigator.clipboard?.writeText(i);
|
|
2072
1317
|
},
|
|
2073
|
-
children: /* @__PURE__ */ c(
|
|
1318
|
+
children: /* @__PURE__ */ c(f, {
|
|
2074
1319
|
name: "share",
|
|
2075
1320
|
size: 14
|
|
2076
1321
|
})
|
|
2077
1322
|
}),
|
|
2078
|
-
/* @__PURE__ */ c(
|
|
1323
|
+
/* @__PURE__ */ c(S, {
|
|
2079
1324
|
value: i,
|
|
2080
1325
|
size: "sm"
|
|
2081
1326
|
})
|
|
2082
1327
|
]
|
|
2083
|
-
}), /* @__PURE__ */ c(
|
|
1328
|
+
}), /* @__PURE__ */ c(L, {
|
|
2084
1329
|
code: i,
|
|
2085
1330
|
language: n ? "json" : "plain",
|
|
2086
1331
|
copyable: !1,
|
|
@@ -2089,17 +1334,17 @@ var Ke = ({ children: e, className: t }) => /* @__PURE__ */ c("div", {
|
|
|
2089
1334
|
})]
|
|
2090
1335
|
});
|
|
2091
1336
|
};
|
|
2092
|
-
function
|
|
1337
|
+
function Ke(e) {
|
|
2093
1338
|
let t = Math.max(0, Math.round((Date.now() - e) / 1e3));
|
|
2094
1339
|
if (t < 5) return "just now";
|
|
2095
1340
|
if (t < 60) return `${t}s ago`;
|
|
2096
1341
|
let n = Math.round(t / 60);
|
|
2097
1342
|
return n < 60 ? `${n}m ago` : `${Math.round(n / 60)}h ago`;
|
|
2098
1343
|
}
|
|
2099
|
-
var
|
|
1344
|
+
var qe = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PURE__ */ l("div", {
|
|
2100
1345
|
className: "flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border px-6 py-10 text-center",
|
|
2101
1346
|
children: [
|
|
2102
|
-
/* @__PURE__ */ c(
|
|
1347
|
+
/* @__PURE__ */ c(f, {
|
|
2103
1348
|
name: "restart",
|
|
2104
1349
|
className: "h-6 w-6 text-muted"
|
|
2105
1350
|
}),
|
|
@@ -2138,7 +1383,7 @@ var tt = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PUR
|
|
|
2138
1383
|
onClick: () => t(e),
|
|
2139
1384
|
className: "flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-surface-2",
|
|
2140
1385
|
children: [
|
|
2141
|
-
/* @__PURE__ */ c(
|
|
1386
|
+
/* @__PURE__ */ c(T, {
|
|
2142
1387
|
method: e.request.method,
|
|
2143
1388
|
className: "shrink-0"
|
|
2144
1389
|
}),
|
|
@@ -2146,7 +1391,7 @@ var tt = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PUR
|
|
|
2146
1391
|
className: "min-w-0 flex-1 truncate font-mono text-[13px] text-content",
|
|
2147
1392
|
children: e.request.url
|
|
2148
1393
|
}),
|
|
2149
|
-
/* @__PURE__ */ c(
|
|
1394
|
+
/* @__PURE__ */ c(te, {
|
|
2150
1395
|
status: e.response.status,
|
|
2151
1396
|
statusText: e.response.statusText,
|
|
2152
1397
|
className: "shrink-0"
|
|
@@ -2157,40 +1402,40 @@ var tt = ({ entries: e, onSelect: t, onClear: n }) => e.length === 0 ? /* @__PUR
|
|
|
2157
1402
|
}),
|
|
2158
1403
|
/* @__PURE__ */ c("span", {
|
|
2159
1404
|
className: "hidden shrink-0 text-xs text-muted md:inline",
|
|
2160
|
-
children:
|
|
1405
|
+
children: Ke(e.at)
|
|
2161
1406
|
})
|
|
2162
1407
|
]
|
|
2163
1408
|
})
|
|
2164
|
-
},
|
|
1409
|
+
}, K(e.request)))
|
|
2165
1410
|
})]
|
|
2166
1411
|
});
|
|
2167
|
-
async function
|
|
1412
|
+
async function Je(e, t) {
|
|
2168
1413
|
let n = performance.now();
|
|
2169
1414
|
try {
|
|
2170
|
-
return t ? await t(e) : await
|
|
1415
|
+
return t ? await t(e) : await V(e);
|
|
2171
1416
|
} catch (e) {
|
|
2172
|
-
return
|
|
1417
|
+
return B(e, n);
|
|
2173
1418
|
}
|
|
2174
1419
|
}
|
|
2175
|
-
var
|
|
2176
|
-
let
|
|
1420
|
+
var Ye = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack: a, onImport: d, className: p }) => {
|
|
1421
|
+
let m = i(() => we(e), [e]), h = i(() => Te(e, m), [e, m]), _ = Le(e.body ?? ke), v = e.body ?? "", [y, b] = o("body"), [x, S] = o("response"), [C, w] = o("body"), [ee, T] = o(!1), [ne, E] = o([]), [D, O] = o(null), [j, M] = o(null), N = i(() => H(e), [e]), P = j ?? N, F = h.filter((e) => e.enabled).length, re = je.map((e) => e.id === "headers" ? {
|
|
2177
1422
|
...e,
|
|
2178
1423
|
badge: F
|
|
2179
|
-
} : e),
|
|
1424
|
+
} : e), I = (n) => {
|
|
2180
1425
|
if (!r) return;
|
|
2181
|
-
let i =
|
|
1426
|
+
let i = Oe(e, {
|
|
2182
1427
|
method: e.method,
|
|
2183
1428
|
url: e.url,
|
|
2184
|
-
body:
|
|
2185
|
-
auth:
|
|
2186
|
-
headers:
|
|
1429
|
+
body: v,
|
|
1430
|
+
auth: m,
|
|
1431
|
+
headers: h,
|
|
2187
1432
|
...n
|
|
2188
1433
|
});
|
|
2189
1434
|
t?.(i);
|
|
2190
1435
|
};
|
|
2191
1436
|
return /* @__PURE__ */ l("div", {
|
|
2192
|
-
className:
|
|
2193
|
-
children: [/* @__PURE__ */ l(
|
|
1437
|
+
className: u("space-y-3", p),
|
|
1438
|
+
children: [/* @__PURE__ */ l(k, {
|
|
2194
1439
|
flush: !0,
|
|
2195
1440
|
children: [
|
|
2196
1441
|
/* @__PURE__ */ l("div", {
|
|
@@ -2204,7 +1449,7 @@ var rt = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack:
|
|
|
2204
1449
|
"aria-label": "Back to request snippets",
|
|
2205
1450
|
onClick: a,
|
|
2206
1451
|
className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-content transition-colors hover:bg-surface-2",
|
|
2207
|
-
children: /* @__PURE__ */ c(
|
|
1452
|
+
children: /* @__PURE__ */ c(f, {
|
|
2208
1453
|
name: "arrow-left",
|
|
2209
1454
|
className: "h-5 w-5"
|
|
2210
1455
|
})
|
|
@@ -2212,62 +1457,62 @@ var rt = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack:
|
|
|
2212
1457
|
className: "font-heading text-sm font-semibold text-content",
|
|
2213
1458
|
children: "Try it Out"
|
|
2214
1459
|
})]
|
|
2215
|
-
}), r &&
|
|
1460
|
+
}), r && d && /* @__PURE__ */ c(g, {
|
|
2216
1461
|
type: "button",
|
|
2217
1462
|
size: "sm",
|
|
2218
1463
|
variant: "ghost",
|
|
2219
|
-
onClick:
|
|
2220
|
-
leftIcon: /* @__PURE__ */ c(
|
|
1464
|
+
onClick: d,
|
|
1465
|
+
leftIcon: /* @__PURE__ */ c(f, {
|
|
2221
1466
|
name: "download",
|
|
2222
1467
|
className: "h-4 w-4"
|
|
2223
1468
|
}),
|
|
2224
1469
|
children: "Import"
|
|
2225
1470
|
})]
|
|
2226
|
-
}), /* @__PURE__ */ c(
|
|
1471
|
+
}), /* @__PURE__ */ c(Be, {
|
|
2227
1472
|
method: e.method,
|
|
2228
1473
|
url: e.url,
|
|
2229
|
-
isSending:
|
|
1474
|
+
isSending: ee,
|
|
2230
1475
|
editable: r,
|
|
2231
|
-
onMethodChange: (e) =>
|
|
2232
|
-
onUrlChange: (e) =>
|
|
1476
|
+
onMethodChange: (e) => I({ method: e }),
|
|
1477
|
+
onUrlChange: (e) => I({ url: e }),
|
|
2233
1478
|
onSend: async () => {
|
|
2234
|
-
let t =
|
|
1479
|
+
let t = Oe(e, {
|
|
2235
1480
|
method: e.method,
|
|
2236
1481
|
url: e.url,
|
|
2237
|
-
body:
|
|
2238
|
-
auth:
|
|
2239
|
-
headers:
|
|
2240
|
-
}), r =
|
|
2241
|
-
|
|
2242
|
-
let i = await
|
|
2243
|
-
|
|
1482
|
+
body: v,
|
|
1483
|
+
auth: m,
|
|
1484
|
+
headers: h
|
|
1485
|
+
}), r = K(t);
|
|
1486
|
+
T(!0);
|
|
1487
|
+
let i = await Je(t, n);
|
|
1488
|
+
T(!1), M(i), S("response"), E((e) => [{
|
|
2244
1489
|
request: t,
|
|
2245
1490
|
response: i,
|
|
2246
1491
|
at: Date.now()
|
|
2247
|
-
}, ...e.filter((e) =>
|
|
1492
|
+
}, ...e.filter((e) => K(e.request) !== r)].slice(0, 25));
|
|
2248
1493
|
}
|
|
2249
1494
|
})]
|
|
2250
1495
|
}),
|
|
2251
1496
|
/* @__PURE__ */ l("div", {
|
|
2252
1497
|
className: "flex items-center justify-between gap-3 border-y border-border px-3",
|
|
2253
|
-
children: [/* @__PURE__ */ c(
|
|
2254
|
-
items:
|
|
2255
|
-
activeId:
|
|
2256
|
-
onChange: (e) =>
|
|
1498
|
+
children: [/* @__PURE__ */ c(A, {
|
|
1499
|
+
items: re,
|
|
1500
|
+
activeId: y,
|
|
1501
|
+
onChange: (e) => b(e),
|
|
2257
1502
|
className: "border-b-0"
|
|
2258
|
-
}),
|
|
1503
|
+
}), y === "body" && /* @__PURE__ */ c(g, {
|
|
2259
1504
|
type: "button",
|
|
2260
1505
|
size: "sm",
|
|
2261
1506
|
variant: "ghost",
|
|
2262
1507
|
onClick: () => {
|
|
2263
1508
|
try {
|
|
2264
|
-
|
|
1509
|
+
I({ body: Ie(_) }), O(null);
|
|
2265
1510
|
} catch {
|
|
2266
|
-
|
|
1511
|
+
O("Invalid JSON");
|
|
2267
1512
|
}
|
|
2268
1513
|
},
|
|
2269
1514
|
disabled: !r,
|
|
2270
|
-
leftIcon: /* @__PURE__ */ c(
|
|
1515
|
+
leftIcon: /* @__PURE__ */ c(f, {
|
|
2271
1516
|
name: "magic",
|
|
2272
1517
|
className: "h-4 w-4"
|
|
2273
1518
|
}),
|
|
@@ -2276,107 +1521,107 @@ var rt = ({ request: e, onRequestChange: t, onSend: n, editable: r = !0, onBack:
|
|
|
2276
1521
|
}),
|
|
2277
1522
|
/* @__PURE__ */ c("div", {
|
|
2278
1523
|
className: "p-3",
|
|
2279
|
-
children: /* @__PURE__ */ c(
|
|
2280
|
-
activeTab:
|
|
2281
|
-
auth:
|
|
2282
|
-
headers:
|
|
2283
|
-
body:
|
|
2284
|
-
bodyError:
|
|
1524
|
+
children: /* @__PURE__ */ c(We, {
|
|
1525
|
+
activeTab: y,
|
|
1526
|
+
auth: m,
|
|
1527
|
+
headers: h,
|
|
1528
|
+
body: _,
|
|
1529
|
+
bodyError: D,
|
|
2285
1530
|
editable: r,
|
|
2286
1531
|
onAuthChange: (e) => {
|
|
2287
|
-
|
|
1532
|
+
I({
|
|
2288
1533
|
auth: e,
|
|
2289
|
-
headers:
|
|
1534
|
+
headers: Ee(h, e, m)
|
|
2290
1535
|
});
|
|
2291
1536
|
},
|
|
2292
1537
|
onHeaderUpdate: (e, t) => {
|
|
2293
|
-
let n =
|
|
1538
|
+
let n = h[e], r = h.map((n, r) => r === e ? {
|
|
2294
1539
|
...n,
|
|
2295
1540
|
...t
|
|
2296
1541
|
} : n), i = r[e];
|
|
2297
|
-
|
|
2298
|
-
auth: i && (n &&
|
|
1542
|
+
I({
|
|
1543
|
+
auth: i && (n && G(n, m) || G(i, m) || W(i.key, q)) ? i.enabled ? Se(i) : { type: "none" } : m,
|
|
2299
1544
|
headers: r
|
|
2300
1545
|
});
|
|
2301
1546
|
},
|
|
2302
1547
|
onHeaderRemove: (e) => {
|
|
2303
|
-
let t =
|
|
2304
|
-
|
|
2305
|
-
auth: t && (
|
|
2306
|
-
headers:
|
|
1548
|
+
let t = h[e];
|
|
1549
|
+
I({
|
|
1550
|
+
auth: t && (G(t, m) || W(t.key, q)) ? { type: "none" } : m,
|
|
1551
|
+
headers: h.filter((t, n) => n !== e)
|
|
2307
1552
|
});
|
|
2308
1553
|
},
|
|
2309
1554
|
onHeaderAdd: () => {
|
|
2310
|
-
|
|
1555
|
+
I({ headers: [...h, {
|
|
2311
1556
|
key: "",
|
|
2312
1557
|
value: "",
|
|
2313
1558
|
enabled: !0
|
|
2314
1559
|
}] });
|
|
2315
1560
|
},
|
|
2316
|
-
onBodyChange: (e) =>
|
|
2317
|
-
onBodyErrorClear: () =>
|
|
1561
|
+
onBodyChange: (e) => I({ body: e }),
|
|
1562
|
+
onBodyErrorClear: () => O(null)
|
|
2318
1563
|
})
|
|
2319
1564
|
})
|
|
2320
1565
|
]
|
|
2321
|
-
}), /* @__PURE__ */ l(
|
|
1566
|
+
}), /* @__PURE__ */ l(k, {
|
|
2322
1567
|
flush: !0,
|
|
2323
1568
|
children: [/* @__PURE__ */ l("div", {
|
|
2324
1569
|
className: "flex flex-wrap items-center justify-between gap-3 border-b border-border px-3",
|
|
2325
|
-
children: [/* @__PURE__ */ c(
|
|
2326
|
-
items:
|
|
2327
|
-
activeId:
|
|
2328
|
-
onChange: (e) =>
|
|
1570
|
+
children: [/* @__PURE__ */ c(A, {
|
|
1571
|
+
items: Me,
|
|
1572
|
+
activeId: x,
|
|
1573
|
+
onChange: (e) => S(e),
|
|
2329
1574
|
className: "border-b-0"
|
|
2330
|
-
}),
|
|
2331
|
-
value:
|
|
2332
|
-
onChange:
|
|
1575
|
+
}), x === "response" && /* @__PURE__ */ c(ze, {
|
|
1576
|
+
value: C,
|
|
1577
|
+
onChange: w
|
|
2333
1578
|
})]
|
|
2334
|
-
}),
|
|
1579
|
+
}), x === "response" ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
|
|
2335
1580
|
className: "flex flex-wrap items-center gap-5 border-b border-border px-3 py-3 text-xs text-muted",
|
|
2336
1581
|
children: [
|
|
2337
|
-
/* @__PURE__ */ c(
|
|
1582
|
+
/* @__PURE__ */ c(te, {
|
|
2338
1583
|
status: P.status,
|
|
2339
1584
|
statusText: P.statusText
|
|
2340
1585
|
}),
|
|
2341
1586
|
/* @__PURE__ */ l("span", { children: [P.timeMs, "ms"] }),
|
|
2342
1587
|
/* @__PURE__ */ c("span", { children: P.size })
|
|
2343
1588
|
]
|
|
2344
|
-
}), /* @__PURE__ */ c(
|
|
2345
|
-
responsePanel:
|
|
1589
|
+
}), /* @__PURE__ */ c(Ge, {
|
|
1590
|
+
responsePanel: C,
|
|
2346
1591
|
response: P
|
|
2347
1592
|
})] }) : /* @__PURE__ */ c("div", {
|
|
2348
1593
|
className: "p-3",
|
|
2349
|
-
children: /* @__PURE__ */ c(
|
|
2350
|
-
entries:
|
|
1594
|
+
children: /* @__PURE__ */ c(qe, {
|
|
1595
|
+
entries: ne,
|
|
2351
1596
|
onSelect: (e) => {
|
|
2352
|
-
t?.(e.request), M(e.response),
|
|
1597
|
+
t?.(e.request), M(e.response), S("response");
|
|
2353
1598
|
},
|
|
2354
|
-
onClear: () =>
|
|
1599
|
+
onClear: () => E([])
|
|
2355
1600
|
})
|
|
2356
1601
|
})]
|
|
2357
1602
|
})]
|
|
2358
1603
|
});
|
|
2359
|
-
},
|
|
1604
|
+
}, Xe = [
|
|
2360
1605
|
"GET",
|
|
2361
1606
|
"POST",
|
|
2362
1607
|
"PUT",
|
|
2363
1608
|
"PATCH",
|
|
2364
1609
|
"DELETE"
|
|
2365
|
-
],
|
|
1610
|
+
], Ze = /* @__PURE__ */ new Set([
|
|
2366
1611
|
"-d",
|
|
2367
1612
|
"--data",
|
|
2368
1613
|
"--data-raw",
|
|
2369
1614
|
"--data-binary",
|
|
2370
1615
|
"--data-ascii"
|
|
2371
|
-
]),
|
|
2372
|
-
function
|
|
1616
|
+
]), Qe = /* @__PURE__ */ new Set(["-H", "--header"]), $e = /* @__PURE__ */ new Set(["-X", "--request"]), et = /* @__PURE__ */ new Set(["--url"]), tt = "authorization", nt = "Bearer ";
|
|
1617
|
+
function rt(e) {
|
|
2373
1618
|
return e.replace(/\\\s*\n\s*/g, " ").trim();
|
|
2374
1619
|
}
|
|
2375
|
-
function
|
|
1620
|
+
function it(e) {
|
|
2376
1621
|
return e.trim().replace(/^```(?:bash|sh|shell|zsh|curl)?\s*/i, "").replace(/\s*```$/i, "").replace(/^\s*[$>]\s*/gm, "").replace(/\\n/g, "\n").replace(/\\"/g, "\"").replace(/\\'/g, "'");
|
|
2377
1622
|
}
|
|
2378
|
-
function
|
|
2379
|
-
let t = [], n = "", r = null, i = !1, a =
|
|
1623
|
+
function at(e) {
|
|
1624
|
+
let t = [], n = "", r = null, i = !1, a = rt(it(e)), o = () => {
|
|
2380
1625
|
n &&= (t.push(n), "");
|
|
2381
1626
|
};
|
|
2382
1627
|
for (let e = 0; e < a.length; e++) {
|
|
@@ -2410,30 +1655,30 @@ function pt(e) {
|
|
|
2410
1655
|
}
|
|
2411
1656
|
return i && (n += "\\"), o(), t;
|
|
2412
1657
|
}
|
|
2413
|
-
function
|
|
1658
|
+
function ot(e) {
|
|
2414
1659
|
let t = e.findIndex((e) => e === "curl" || e.endsWith("/curl"));
|
|
2415
1660
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
2416
1661
|
}
|
|
2417
|
-
function
|
|
1662
|
+
function st(e) {
|
|
2418
1663
|
return /^(?:https?:\/\/\S+|\/\S*|[A-Za-z0-9.-]+\.[A-Za-z]{2,}\S*)$/.test(e);
|
|
2419
1664
|
}
|
|
2420
|
-
function
|
|
1665
|
+
function J(e) {
|
|
2421
1666
|
return e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") ? e : `https://${e}`;
|
|
2422
1667
|
}
|
|
2423
|
-
function
|
|
1668
|
+
function ct(e) {
|
|
2424
1669
|
let t = e.toUpperCase();
|
|
2425
|
-
return
|
|
1670
|
+
return Xe.includes(t) ? t : null;
|
|
2426
1671
|
}
|
|
2427
|
-
function
|
|
1672
|
+
function Y(e) {
|
|
2428
1673
|
let t = e.indexOf(":");
|
|
2429
1674
|
return t < 0 ? null : {
|
|
2430
1675
|
key: e.slice(0, t).trim(),
|
|
2431
1676
|
value: e.slice(t + 1).trim()
|
|
2432
1677
|
};
|
|
2433
1678
|
}
|
|
2434
|
-
function
|
|
2435
|
-
let t = e.find((e) => e.key.toLowerCase() ===
|
|
2436
|
-
if (t) return t.value.toLowerCase().startsWith(
|
|
1679
|
+
function lt(e) {
|
|
1680
|
+
let t = e.find((e) => e.key.toLowerCase() === tt);
|
|
1681
|
+
if (t) return t.value.toLowerCase().startsWith(nt.toLowerCase()) ? {
|
|
2437
1682
|
type: "bearer",
|
|
2438
1683
|
token: t.value.slice(7)
|
|
2439
1684
|
} : {
|
|
@@ -2443,72 +1688,72 @@ function vt(e) {
|
|
|
2443
1688
|
in: "header"
|
|
2444
1689
|
};
|
|
2445
1690
|
}
|
|
2446
|
-
function
|
|
1691
|
+
function ut(e) {
|
|
2447
1692
|
try {
|
|
2448
1693
|
return JSON.stringify(JSON.parse(e), null, 2);
|
|
2449
1694
|
} catch {
|
|
2450
1695
|
return e;
|
|
2451
1696
|
}
|
|
2452
1697
|
}
|
|
2453
|
-
function
|
|
2454
|
-
let t =
|
|
1698
|
+
function X(e) {
|
|
1699
|
+
let t = ot(at(e));
|
|
2455
1700
|
if (t.length === 0) return null;
|
|
2456
1701
|
let n = [], r = [], i = null, a = "";
|
|
2457
1702
|
for (let e = 0; e < t.length; e++) {
|
|
2458
1703
|
let o = t[e], s = t[e + 1];
|
|
2459
|
-
if (
|
|
2460
|
-
i =
|
|
1704
|
+
if ($e.has(o) && s) {
|
|
1705
|
+
i = ct(s) ?? i, e++;
|
|
2461
1706
|
continue;
|
|
2462
1707
|
}
|
|
2463
1708
|
if (o.startsWith("-X") && o.length > 2) {
|
|
2464
|
-
i =
|
|
1709
|
+
i = ct(o.slice(2)) ?? i;
|
|
2465
1710
|
continue;
|
|
2466
1711
|
}
|
|
2467
|
-
if (
|
|
2468
|
-
let t =
|
|
1712
|
+
if (Qe.has(o) && s) {
|
|
1713
|
+
let t = Y(s);
|
|
2469
1714
|
t && n.push(t), e++;
|
|
2470
1715
|
continue;
|
|
2471
1716
|
}
|
|
2472
1717
|
if (o.startsWith("-H") && o.length > 2) {
|
|
2473
|
-
let e =
|
|
1718
|
+
let e = Y(o.slice(2));
|
|
2474
1719
|
e && n.push(e);
|
|
2475
1720
|
continue;
|
|
2476
1721
|
}
|
|
2477
|
-
if (
|
|
1722
|
+
if (Ze.has(o) && s !== void 0) {
|
|
2478
1723
|
r.push(s), e++;
|
|
2479
1724
|
continue;
|
|
2480
1725
|
}
|
|
2481
|
-
let c = [...
|
|
1726
|
+
let c = [...Ze].find((e) => o.startsWith(`${e}=`));
|
|
2482
1727
|
if (c) {
|
|
2483
1728
|
r.push(o.slice(c.length + 1));
|
|
2484
1729
|
continue;
|
|
2485
1730
|
}
|
|
2486
|
-
if (
|
|
2487
|
-
a =
|
|
1731
|
+
if (et.has(o) && s) {
|
|
1732
|
+
a = J(s), e++;
|
|
2488
1733
|
continue;
|
|
2489
1734
|
}
|
|
2490
1735
|
if (o.startsWith("--url=")) {
|
|
2491
|
-
a =
|
|
1736
|
+
a = J(o.slice(6));
|
|
2492
1737
|
continue;
|
|
2493
1738
|
}
|
|
2494
|
-
!o.startsWith("-") &&
|
|
1739
|
+
!o.startsWith("-") && st(o) && (a = J(o));
|
|
2495
1740
|
}
|
|
2496
1741
|
if (!a) return null;
|
|
2497
|
-
let o = r.length ?
|
|
1742
|
+
let o = r.length ? ut(r.join("&")) : "", s = i ?? (o ? "POST" : "GET"), c = lt(n);
|
|
2498
1743
|
return {
|
|
2499
1744
|
title: "Imported request",
|
|
2500
1745
|
method: s,
|
|
2501
1746
|
url: a,
|
|
2502
|
-
headers: c ? n.filter((e) => e.key.toLowerCase() !==
|
|
1747
|
+
headers: c ? n.filter((e) => e.key.toLowerCase() !== tt) : n,
|
|
2503
1748
|
auth: c,
|
|
2504
1749
|
body: o || void 0
|
|
2505
1750
|
};
|
|
2506
1751
|
}
|
|
2507
1752
|
//#endregion
|
|
2508
1753
|
//#region src/features/api-widget/ImportCard.tsx
|
|
2509
|
-
var
|
|
1754
|
+
var dt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Content-Type: application/json' \\\n -d '{ \"title\": \"API client\", \"body\": \"Live request\", \"userId\": 1 }'", ft = ({ onImport: e, onCancel: t, className: n }) => {
|
|
2510
1755
|
let [r, i] = o(""), [a, s] = o(null);
|
|
2511
|
-
return /* @__PURE__ */ c(
|
|
1756
|
+
return /* @__PURE__ */ c(k, {
|
|
2512
1757
|
flush: !0,
|
|
2513
1758
|
className: n,
|
|
2514
1759
|
children: /* @__PURE__ */ l("div", {
|
|
@@ -2521,7 +1766,7 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2521
1766
|
"aria-label": "Back",
|
|
2522
1767
|
onClick: t,
|
|
2523
1768
|
className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-content transition-colors hover:bg-surface-2",
|
|
2524
|
-
children: /* @__PURE__ */ c(
|
|
1769
|
+
children: /* @__PURE__ */ c(f, {
|
|
2525
1770
|
name: "arrow-left",
|
|
2526
1771
|
className: "h-5 w-5"
|
|
2527
1772
|
})
|
|
@@ -2541,9 +1786,9 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2541
1786
|
},
|
|
2542
1787
|
spellCheck: !1,
|
|
2543
1788
|
rows: 5,
|
|
2544
|
-
placeholder:
|
|
1789
|
+
placeholder: dt,
|
|
2545
1790
|
"aria-label": "cURL command",
|
|
2546
|
-
className:
|
|
1791
|
+
className: u("w-full resize-none rounded-lg border bg-surface-2 p-3 font-mono text-[13px] leading-relaxed text-content outline-none", "placeholder:text-muted/50 focus:ring-2 focus:ring-primary/20", a ? "border-red-500/60" : "border-border focus:border-primary/60")
|
|
2547
1792
|
}),
|
|
2548
1793
|
a && /* @__PURE__ */ c("p", {
|
|
2549
1794
|
className: "text-xs text-red-400",
|
|
@@ -2551,10 +1796,10 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2551
1796
|
}),
|
|
2552
1797
|
/* @__PURE__ */ c("div", {
|
|
2553
1798
|
className: "flex items-center justify-end",
|
|
2554
|
-
children: /* @__PURE__ */ c(
|
|
1799
|
+
children: /* @__PURE__ */ c(g, {
|
|
2555
1800
|
size: "sm",
|
|
2556
1801
|
onClick: () => {
|
|
2557
|
-
let t =
|
|
1802
|
+
let t = X(r);
|
|
2558
1803
|
if (!t) {
|
|
2559
1804
|
s("Could not parse a valid cURL command. Make sure it includes a URL.");
|
|
2560
1805
|
return;
|
|
@@ -2562,7 +1807,7 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2562
1807
|
e(t, r), i(""), s(null);
|
|
2563
1808
|
},
|
|
2564
1809
|
disabled: !r.trim(),
|
|
2565
|
-
leftIcon: /* @__PURE__ */ c(
|
|
1810
|
+
leftIcon: /* @__PURE__ */ c(f, {
|
|
2566
1811
|
name: "download",
|
|
2567
1812
|
className: "h-4 w-4"
|
|
2568
1813
|
}),
|
|
@@ -2572,7 +1817,7 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2572
1817
|
]
|
|
2573
1818
|
})
|
|
2574
1819
|
});
|
|
2575
|
-
},
|
|
1820
|
+
}, pt = [
|
|
2576
1821
|
{
|
|
2577
1822
|
id: "curl",
|
|
2578
1823
|
label: "cURL"
|
|
@@ -2590,10 +1835,10 @@ var bt = "curl -X POST 'https://jsonplaceholder.typicode.com/posts' \\\n -H 'Co
|
|
|
2590
1835
|
label: "Go"
|
|
2591
1836
|
}
|
|
2592
1837
|
];
|
|
2593
|
-
function
|
|
1838
|
+
function mt(e) {
|
|
2594
1839
|
return e === "curl" ? "bash" : e;
|
|
2595
1840
|
}
|
|
2596
|
-
function
|
|
1841
|
+
function ht(e) {
|
|
2597
1842
|
return !e || e.type === "none" ? null : e.type === "bearer" ? {
|
|
2598
1843
|
key: "Authorization",
|
|
2599
1844
|
value: `Bearer ${e.token}`
|
|
@@ -2602,17 +1847,17 @@ function wt(e) {
|
|
|
2602
1847
|
value: e.value
|
|
2603
1848
|
};
|
|
2604
1849
|
}
|
|
2605
|
-
function
|
|
2606
|
-
let t =
|
|
1850
|
+
function Z(e) {
|
|
1851
|
+
let t = ht(e.auth);
|
|
2607
1852
|
return t ? [...(e.headers ?? []).filter((e) => e.key.toLowerCase() !== t.key.toLowerCase()), t] : e.headers ?? [];
|
|
2608
1853
|
}
|
|
2609
|
-
function
|
|
1854
|
+
function gt(e) {
|
|
2610
1855
|
let t = `curl -X ${e.method} '${e.url}'`;
|
|
2611
|
-
for (let n of
|
|
1856
|
+
for (let n of Z(e)) t += ` \\\n -H '${n.key}: ${n.value}'`;
|
|
2612
1857
|
return e.body && (t += ` \\\n -d '${e.body}'`), t;
|
|
2613
1858
|
}
|
|
2614
|
-
function
|
|
2615
|
-
let t = [`method: '${e.method}'`], n =
|
|
1859
|
+
function _t(e) {
|
|
1860
|
+
let t = [`method: '${e.method}'`], n = Z(e);
|
|
2616
1861
|
if (n.length) {
|
|
2617
1862
|
let e = n.map((e) => ` '${e.key}': '${e.value}'`).join(",\n");
|
|
2618
1863
|
t.push(`headers: {\n${e}\n }`);
|
|
@@ -2626,12 +1871,12 @@ function Et(e) {
|
|
|
2626
1871
|
"console.log(data);"
|
|
2627
1872
|
].join("\n");
|
|
2628
1873
|
}
|
|
2629
|
-
function
|
|
1874
|
+
function vt(e) {
|
|
2630
1875
|
let t = [
|
|
2631
1876
|
"import requests",
|
|
2632
1877
|
"",
|
|
2633
1878
|
`url = "${e.url}"`
|
|
2634
|
-
], n = ["url"], r =
|
|
1879
|
+
], n = ["url"], r = Z(e);
|
|
2635
1880
|
if (r.length) {
|
|
2636
1881
|
t.push("", "headers = {");
|
|
2637
1882
|
for (let e of r) t.push(` "${e.key}": "${e.value}",`);
|
|
@@ -2639,7 +1884,7 @@ function Dt(e) {
|
|
|
2639
1884
|
}
|
|
2640
1885
|
return e.body && (t.push("", `payload = ${e.body}`), n.push("json=payload")), t.push("", `response = requests.${e.method.toLowerCase()}(${n.join(", ")})`, "print(response.json())"), t.join("\n");
|
|
2641
1886
|
}
|
|
2642
|
-
function
|
|
1887
|
+
function yt(e) {
|
|
2643
1888
|
let t = [
|
|
2644
1889
|
"\"fmt\"",
|
|
2645
1890
|
"\"io\"",
|
|
@@ -2653,39 +1898,39 @@ function Ot(e) {
|
|
|
2653
1898
|
];
|
|
2654
1899
|
for (let e of t) n.push(`\t${e}`);
|
|
2655
1900
|
n.push(")", "", "func main() {"), e.body ? (n.push(`\tpayload := strings.NewReader(\`${e.body}\`)`), n.push(`\treq, _ := http.NewRequest("${e.method}", "${e.url}", payload)`)) : n.push(`\treq, _ := http.NewRequest("${e.method}", "${e.url}", nil)`);
|
|
2656
|
-
for (let t of
|
|
1901
|
+
for (let t of Z(e)) n.push(`\treq.Header.Set("${t.key}", "${t.value}")`);
|
|
2657
1902
|
return n.push(" res, _ := http.DefaultClient.Do(req)", " defer res.Body.Close()", "", " body, _ := io.ReadAll(res.Body)", " fmt.Println(string(body))", "}"), n.join("\n");
|
|
2658
1903
|
}
|
|
2659
|
-
function
|
|
1904
|
+
function Q(e, t) {
|
|
2660
1905
|
switch (t) {
|
|
2661
|
-
case "curl": return
|
|
2662
|
-
case "javascript": return
|
|
2663
|
-
case "python": return
|
|
2664
|
-
case "go": return
|
|
1906
|
+
case "curl": return gt(e);
|
|
1907
|
+
case "javascript": return _t(e);
|
|
1908
|
+
case "python": return vt(e);
|
|
1909
|
+
case "go": return yt(e);
|
|
2665
1910
|
}
|
|
2666
1911
|
}
|
|
2667
1912
|
//#endregion
|
|
2668
1913
|
//#region src/features/api-widget/RequestSnippet.tsx
|
|
2669
|
-
var
|
|
2670
|
-
let [n, r] = o("curl"), a = i(() =>
|
|
1914
|
+
var bt = ({ request: e, onTryItOut: t }) => {
|
|
1915
|
+
let [n, r] = o("curl"), a = i(() => Q(e, n), [e, n]), s = !!t;
|
|
2671
1916
|
return /* @__PURE__ */ l("div", {
|
|
2672
1917
|
className: "space-y-3",
|
|
2673
|
-
children: [/* @__PURE__ */ l(
|
|
1918
|
+
children: [/* @__PURE__ */ l(k, {
|
|
2674
1919
|
label: e.title,
|
|
2675
1920
|
children: [/* @__PURE__ */ l("div", {
|
|
2676
1921
|
className: "relative flex items-center justify-between",
|
|
2677
|
-
children: [/* @__PURE__ */ c(
|
|
2678
|
-
items:
|
|
1922
|
+
children: [/* @__PURE__ */ c(A, {
|
|
1923
|
+
items: pt,
|
|
2679
1924
|
activeId: n,
|
|
2680
1925
|
onChange: (e) => {
|
|
2681
1926
|
r(e);
|
|
2682
1927
|
},
|
|
2683
1928
|
className: "[&_button]:text-[14px]"
|
|
2684
|
-
}), s && /* @__PURE__ */ c(
|
|
1929
|
+
}), s && /* @__PURE__ */ c(g, {
|
|
2685
1930
|
size: "sm",
|
|
2686
1931
|
variant: "primary",
|
|
2687
1932
|
onClick: t,
|
|
2688
|
-
rightIcon: /* @__PURE__ */ c(
|
|
1933
|
+
rightIcon: /* @__PURE__ */ c(f, {
|
|
2689
1934
|
name: "arrow-right",
|
|
2690
1935
|
className: "h-4 w-4"
|
|
2691
1936
|
}),
|
|
@@ -2693,15 +1938,15 @@ var At = ({ request: e, onTryItOut: t }) => {
|
|
|
2693
1938
|
})]
|
|
2694
1939
|
}), /* @__PURE__ */ c("div", {
|
|
2695
1940
|
className: "mt-4",
|
|
2696
|
-
children: /* @__PURE__ */ c(
|
|
1941
|
+
children: /* @__PURE__ */ c(L, {
|
|
2697
1942
|
code: a,
|
|
2698
|
-
language:
|
|
1943
|
+
language: mt(n),
|
|
2699
1944
|
showLineNumbers: !0
|
|
2700
1945
|
})
|
|
2701
1946
|
})]
|
|
2702
|
-
}), e.sampleResponse && /* @__PURE__ */ c(
|
|
1947
|
+
}), e.sampleResponse && /* @__PURE__ */ c(k, {
|
|
2703
1948
|
label: "",
|
|
2704
|
-
children: /* @__PURE__ */ c(
|
|
1949
|
+
children: /* @__PURE__ */ c(L, {
|
|
2705
1950
|
code: e.sampleResponse,
|
|
2706
1951
|
language: "json"
|
|
2707
1952
|
})
|
|
@@ -2710,7 +1955,7 @@ var At = ({ request: e, onTryItOut: t }) => {
|
|
|
2710
1955
|
};
|
|
2711
1956
|
//#endregion
|
|
2712
1957
|
//#region src/features/api-widget/ApiPlayground.tsx
|
|
2713
|
-
function
|
|
1958
|
+
function xt(e) {
|
|
2714
1959
|
let [n, r] = o(() => typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
2715
1960
|
return t(() => {
|
|
2716
1961
|
if (e !== "system") return;
|
|
@@ -2718,7 +1963,7 @@ function jt(e) {
|
|
|
2718
1963
|
return n(), t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
2719
1964
|
}, [e]), e === "system" ? n : e;
|
|
2720
1965
|
}
|
|
2721
|
-
function
|
|
1966
|
+
function St(e) {
|
|
2722
1967
|
try {
|
|
2723
1968
|
let t = new URL(e.url);
|
|
2724
1969
|
return `${e.method} ${t.pathname || "/"}`;
|
|
@@ -2726,7 +1971,7 @@ function Mt(e) {
|
|
|
2726
1971
|
return `${e.method} ${e.url || "/"}`;
|
|
2727
1972
|
}
|
|
2728
1973
|
}
|
|
2729
|
-
var
|
|
1974
|
+
var Ct = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__PURE__ */ l(k, {
|
|
2730
1975
|
label: "Invalid request",
|
|
2731
1976
|
children: [
|
|
2732
1977
|
/* @__PURE__ */ l("div", {
|
|
@@ -2734,11 +1979,11 @@ var Nt = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__
|
|
|
2734
1979
|
children: [/* @__PURE__ */ c("div", {
|
|
2735
1980
|
className: "text-sm font-medium text-content",
|
|
2736
1981
|
children: "cURL"
|
|
2737
|
-
}), t && n && /* @__PURE__ */ c(
|
|
1982
|
+
}), t && n && /* @__PURE__ */ c(g, {
|
|
2738
1983
|
size: "sm",
|
|
2739
1984
|
variant: "primary",
|
|
2740
1985
|
onClick: r,
|
|
2741
|
-
rightIcon: /* @__PURE__ */ c(
|
|
1986
|
+
rightIcon: /* @__PURE__ */ c(f, {
|
|
2742
1987
|
name: "download",
|
|
2743
1988
|
className: "h-4 w-4"
|
|
2744
1989
|
}),
|
|
@@ -2747,7 +1992,7 @@ var Nt = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__
|
|
|
2747
1992
|
}),
|
|
2748
1993
|
/* @__PURE__ */ c("div", {
|
|
2749
1994
|
className: "mt-4",
|
|
2750
|
-
children: /* @__PURE__ */ c(
|
|
1995
|
+
children: /* @__PURE__ */ c(L, {
|
|
2751
1996
|
code: e.trim() || "Paste or pass a cURL request with a URL.",
|
|
2752
1997
|
language: "bash",
|
|
2753
1998
|
showLineNumbers: !0
|
|
@@ -2759,28 +2004,28 @@ var Nt = ({ request: e, allowImport: t, editable: n, onTryImport: r }) => /* @__
|
|
|
2759
2004
|
})
|
|
2760
2005
|
]
|
|
2761
2006
|
});
|
|
2762
|
-
function
|
|
2007
|
+
function $(e, t, n) {
|
|
2763
2008
|
return {
|
|
2764
2009
|
...e,
|
|
2765
|
-
title: t ??
|
|
2010
|
+
title: t ?? St(e),
|
|
2766
2011
|
sampleResponse: n
|
|
2767
2012
|
};
|
|
2768
2013
|
}
|
|
2769
|
-
var
|
|
2770
|
-
let p =
|
|
2014
|
+
var wt = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editable: s = !0, allowImport: l = !0, mode: u = "dark", syncSnippet: d = !1, customization: f }) => {
|
|
2015
|
+
let p = xt(u), [m, h] = o("idle"), [g, _] = o(e);
|
|
2771
2016
|
t(() => {
|
|
2772
2017
|
_(e);
|
|
2773
2018
|
}, [e]);
|
|
2774
2019
|
let v = i(() => {
|
|
2775
|
-
let e =
|
|
2776
|
-
return e ?
|
|
2020
|
+
let e = X(g);
|
|
2021
|
+
return e ? $(e, n, r) : null;
|
|
2777
2022
|
}, [
|
|
2778
2023
|
g,
|
|
2779
2024
|
n,
|
|
2780
2025
|
r
|
|
2781
2026
|
]), y = d ? g : e, b = i(() => {
|
|
2782
|
-
let e =
|
|
2783
|
-
return e ?
|
|
2027
|
+
let e = X(y);
|
|
2028
|
+
return e ? $(e, n, r) : null;
|
|
2784
2029
|
}, [
|
|
2785
2030
|
y,
|
|
2786
2031
|
n,
|
|
@@ -2788,7 +2033,7 @@ var Ft = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editabl
|
|
|
2788
2033
|
]), x = (e) => {
|
|
2789
2034
|
_(e), a?.(e);
|
|
2790
2035
|
}, S = (e) => {
|
|
2791
|
-
x(
|
|
2036
|
+
x(Q(e, "curl"));
|
|
2792
2037
|
}, C = (e, t) => {
|
|
2793
2038
|
x(t.trim()), h("console");
|
|
2794
2039
|
};
|
|
@@ -2801,23 +2046,23 @@ var Ft = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editabl
|
|
|
2801
2046
|
className: "bg-bg text-content text-left",
|
|
2802
2047
|
children: m === "import" ? /* @__PURE__ */ c("div", {
|
|
2803
2048
|
className: "motion-safe:animate-[widget-slide-in_180ms_ease-out]",
|
|
2804
|
-
children: /* @__PURE__ */ c(
|
|
2049
|
+
children: /* @__PURE__ */ c(ft, {
|
|
2805
2050
|
onImport: C,
|
|
2806
2051
|
onCancel: () => h(v ? "console" : "idle")
|
|
2807
2052
|
})
|
|
2808
2053
|
}, "import") : m === "console" && v ? /* @__PURE__ */ c("div", {
|
|
2809
2054
|
className: "motion-safe:animate-[widget-slide-in_180ms_ease-out]",
|
|
2810
|
-
children: /* @__PURE__ */ c(
|
|
2055
|
+
children: /* @__PURE__ */ c(Ye, {
|
|
2811
2056
|
request: v,
|
|
2812
2057
|
onRequestChange: S,
|
|
2813
2058
|
editable: s,
|
|
2814
2059
|
onBack: () => h("idle"),
|
|
2815
2060
|
onImport: l && s ? () => h("import") : void 0
|
|
2816
2061
|
})
|
|
2817
|
-
}, "console") : b ? /* @__PURE__ */ c(
|
|
2062
|
+
}, "console") : b ? /* @__PURE__ */ c(bt, {
|
|
2818
2063
|
request: b,
|
|
2819
2064
|
onTryItOut: () => h("console")
|
|
2820
|
-
}) : /* @__PURE__ */ c(
|
|
2065
|
+
}) : /* @__PURE__ */ c(Ct, {
|
|
2821
2066
|
request: y,
|
|
2822
2067
|
allowImport: l,
|
|
2823
2068
|
editable: s,
|
|
@@ -2826,4 +2071,4 @@ var Ft = ({ request: e, title: n, sampleResponse: r, onUpdateRequest: a, editabl
|
|
|
2826
2071
|
});
|
|
2827
2072
|
};
|
|
2828
2073
|
//#endregion
|
|
2829
|
-
export {
|
|
2074
|
+
export { Ye as ApiConsole, wt as ApiPlayground, ft as ImportCard, bt as RequestSnippet, pt as SNIPPET_LANGUAGES, V as executeWidgetRequest, Q as generateSnippet, mt as highlightFor, H as mockWidgetResponse, X as parseCurl, B as widgetErrorResponse };
|