@canofold/markdown 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/dist/ImageGallery-Bcpjlfh9.js +569 -0
  4. package/dist/Markdown-607_slPB.js +117 -0
  5. package/dist/assets-CqlggKr8.js +77 -0
  6. package/dist/client/bundler.js +308 -0
  7. package/dist/client/chunks/{client-CTpZrdpv.js → client-CHUUETWE.js} +3 -3
  8. package/dist/client/chunks/{gallery-BTg1qJjd.js → gallery-Cr0TgC1h.js} +2 -2
  9. package/dist/client/chunks/{image-BsfZtDsx.js → image-6_o7fPkU.js} +3 -3
  10. package/dist/client/chunks/provider-k1N-5njv.js +1037 -0
  11. package/dist/client/chunks/react-runtime-DRPMrVPX.js +12062 -0
  12. package/dist/client/chunks/{serialized-Ck9NBdg7.js → serialized-Chn9ydGA.js} +334 -295
  13. package/dist/client/chunks/{table-jaJMPch3.js → table-D99-Zhc8.js} +3 -3
  14. package/dist/client/index.js +1 -1
  15. package/dist/componentMap-CKSUGzQH.js +1483 -0
  16. package/dist/copyText-C0ZgrMnH.js +18 -0
  17. package/dist/{directiveValidation-BdVbgcY_.js → directiveValidation-B7LY-R5p.js} +187 -248
  18. package/dist/fileKinds-BPzIxbaS.js +170 -0
  19. package/dist/gallery-BqQ-i0TC.js +42 -0
  20. package/dist/image-CiPni6Az.js +38 -0
  21. package/dist/index.js +2 -2
  22. package/dist/plugins-CXYBB-oH.js +130 -0
  23. package/dist/{prepareMarkdown-DPMq7203.js → prepareMarkdown-CS6sALIb.js} +13 -11
  24. package/dist/provider-BJDHf4Z_.js +8 -0
  25. package/dist/serialized-DFiNQYA5.js +39 -0
  26. package/dist/server/analyze.js +11 -11
  27. package/dist/server.js +30 -28
  28. package/dist/table-DQSeLjVL.js +32 -0
  29. package/package.json +14 -9
  30. package/dist/Markdown-CPG2lcO7.js +0 -2127
  31. package/dist/client/chunks/provider-DNSHvvN7.js +0 -841
  32. package/dist/client/chunks/react-runtime-Dzgdzn6D.js +0 -10571
  33. package/dist/plugins-StkCS2su.js +0 -298
@@ -1,2127 +0,0 @@
1
- import { jsx as l, jsxs as L, Fragment as U } from "react/jsx-runtime";
2
- import { toJsxRuntime as ht } from "hast-util-to-jsx-runtime";
3
- import { createContext as Ye, createElement as w, useContext as Qe, useState as B, useEffect as Z, isValidElement as A, Children as O, useMemo as le, useRef as _, cloneElement as R, useId as yt, version as vt, Fragment as Ct } from "react";
4
- import { ChevronRight as wt, ChevronLeft as kt, X as Lt, Link2 as Nt, Workflow as St, FileText as xt, Folder as It, Table2 as Mt, ChevronsUpDown as Tt, RotateCcw as Ft, Plus as At, Minus as zt, Maximize2 as Dt, Code2 as $t, Download as Pt, Copy as Ot, Check as Rt, ChevronDown as Et, CheckCircle2 as jt, TriangleAlert as Bt, CircleAlert as _t, Info as Wt } from "lucide-react";
5
- import { createPortal as Gt } from "react-dom";
6
- import { f as Ut, g as Kt, s as Vt } from "./plugins-StkCS2su.js";
7
- const I = {
8
- copyCode: "Copy code",
9
- copyFailed: "Copy failed",
10
- copySnippet: "Copy snippet",
11
- copyTerminal: "Copy terminal output",
12
- terminalTitle: "Terminal",
13
- tabsTitle: "Tabs",
14
- tabItem: "Tab {index}",
15
- codeGroupTitle: "Code group",
16
- codeGroupItem: "Code {index}",
17
- taskCompleted: "Completed task",
18
- taskIncomplete: "Incomplete task",
19
- copySectionLink: "Copy section link",
20
- tableTitle: "table",
21
- copyTableCsv: "Copy table as CSV",
22
- downloadTableCsv: "Download table as CSV",
23
- zoomTable: "Zoom table",
24
- closeTablePreview: "Close table preview",
25
- sortTableColumn: "Sort table by column {column}",
26
- zoomImage: "Zoom image",
27
- closeImagePreview: "Close image preview",
28
- imageGallery: "Image gallery",
29
- closeImageGallery: "Close gallery",
30
- previousGalleryImage: "Previous image",
31
- nextGalleryImage: "Next image",
32
- galleryThumbnails: "Gallery thumbnails",
33
- galleryImage: "image"
34
- };
35
- async function et(e) {
36
- if (typeof navigator < "u" && navigator.clipboard)
37
- try {
38
- return await navigator.clipboard.writeText(e), !0;
39
- } catch {
40
- }
41
- if (typeof document > "u" || typeof document.execCommand != "function") return !1;
42
- const t = document.createElement("textarea");
43
- t.value = e, t.setAttribute("readonly", ""), t.style.position = "fixed", t.style.inset = "0 auto auto 0", t.style.opacity = "0", document.body.appendChild(t), t.select();
44
- try {
45
- return document.execCommand("copy");
46
- } finally {
47
- t.remove();
48
- }
49
- }
50
- const Ht = {
51
- copy: "CopyIcon",
52
- download: "DownloadIcon",
53
- code: "CodeIcon",
54
- maximize: "MaximizeIcon",
55
- minus: "MinusIcon",
56
- plus: "PlusIcon",
57
- reset: "ResetIcon",
58
- sort: "SortIcon",
59
- table: "TableIcon",
60
- folder: "FolderIcon",
61
- file: "FileIcon",
62
- workflow: "WorkflowIcon",
63
- link: "LinkIcon",
64
- close: "CloseIcon",
65
- previous: "PreviousIcon",
66
- next: "NextIcon"
67
- }, tt = Object.freeze({}), at = Ye(tt);
68
- function Zt({ slots: e, children: t }) {
69
- return w(at.Provider, { value: e ?? tt }, t);
70
- }
71
- function ot() {
72
- return Qe(at);
73
- }
74
- function nt(e, t) {
75
- const a = e?.[Ht[t]];
76
- return a ? (o) => w(a, { ...o, name: t }) : void 0;
77
- }
78
- function rt(e) {
79
- return e?.ImageCaption;
80
- }
81
- const qt = {
82
- copy: Ot,
83
- download: Pt,
84
- code: $t,
85
- maximize: Dt,
86
- minus: zt,
87
- plus: At,
88
- reset: Ft,
89
- sort: Tt,
90
- table: Mt,
91
- folder: It,
92
- file: xt,
93
- workflow: St,
94
- link: Nt,
95
- close: Lt,
96
- previous: kt,
97
- next: wt
98
- };
99
- function E({
100
- name: e,
101
- size: t = 16,
102
- className: a
103
- }) {
104
- const o = nt(ot(), e);
105
- if (o) return /* @__PURE__ */ l(o, { size: t, className: a, "aria-hidden": "true" });
106
- const n = qt[e];
107
- return /* @__PURE__ */ l(n, { className: a, size: t, strokeWidth: 2, "aria-hidden": "true" });
108
- }
109
- const ct = 1500;
110
- function me({
111
- value: e,
112
- label: t,
113
- action: a,
114
- className: o = "cf-block-button",
115
- icon: n = "copy",
116
- failureLabel: c = I.copyFailed
117
- }) {
118
- const [r, i] = B("idle");
119
- Z(() => {
120
- if (r === "idle") return;
121
- const f = setTimeout(() => i("idle"), ct);
122
- return () => clearTimeout(f);
123
- }, [r]);
124
- const s = r === "success" ? `${t} ✓` : r === "error" ? c : t;
125
- return /* @__PURE__ */ L(
126
- "button",
127
- {
128
- className: `${o}${r === "success" ? " cf-action-success" : ""}${r === "error" ? " cf-action-error" : ""}`,
129
- type: "button",
130
- "data-cf-action": a,
131
- "data-cf-copied": r === "success" ? "true" : void 0,
132
- "data-cf-copy-error": r === "error" ? "true" : void 0,
133
- "aria-label": s,
134
- title: s,
135
- onClick: async () => {
136
- try {
137
- i(await et(e) ? "success" : "error");
138
- } catch {
139
- i("error");
140
- }
141
- },
142
- children: [
143
- /* @__PURE__ */ l("span", { className: "cf-action-icon cf-action-icon-copy", "aria-hidden": "true", children: /* @__PURE__ */ l(E, { name: n }) }),
144
- /* @__PURE__ */ l("span", { className: "cf-action-icon cf-action-icon-success", "aria-hidden": "true", children: /* @__PURE__ */ l(Rt, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) }),
145
- /* @__PURE__ */ l("span", { className: "cf-sr-only", "aria-live": "polite", "aria-atomic": "true", children: r === "idle" ? "" : s })
146
- ]
147
- }
148
- );
149
- }
150
- function Jt({
151
- value: e,
152
- filename: t,
153
- label: a,
154
- action: o,
155
- className: n = "cf-block-button",
156
- contentType: c = "text/plain;charset=utf-8"
157
- }) {
158
- const [r, i] = B();
159
- return Z(() => {
160
- if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
161
- const s = URL.createObjectURL(new Blob([e], { type: c }));
162
- return i(s), () => URL.revokeObjectURL(s);
163
- }, [c, e]), /* @__PURE__ */ l(
164
- "a",
165
- {
166
- className: n,
167
- href: r ?? "#",
168
- download: t,
169
- "data-cf-action": o,
170
- "aria-disabled": r ? void 0 : "true",
171
- "aria-label": a,
172
- title: a,
173
- tabIndex: r ? void 0 : -1,
174
- onClick: (s) => {
175
- r || s.preventDefault();
176
- },
177
- children: /* @__PURE__ */ l(E, { name: "download" })
178
- }
179
- );
180
- }
181
- function Xt({ filename: e, language: t }) {
182
- const a = Ut(e, t), o = Kt(e, t);
183
- return /* @__PURE__ */ l(
184
- "span",
185
- {
186
- className: "cf-code-file-icon",
187
- "data-cf-file-icon": o,
188
- "data-cf-file-kind": a,
189
- "aria-hidden": "true"
190
- }
191
- );
192
- }
193
- function j(e) {
194
- return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(j).join("") : A(e) ? j(e.props.children) : !e || typeof e != "object" ? "" : e.type === "text" ? String(e.value ?? "") : j(e.children);
195
- }
196
- function Q(e) {
197
- return O.toArray(e).filter((t) => A(t));
198
- }
199
- function W(e) {
200
- if (typeof e.type == "string") return e.type;
201
- const a = e.type.displayName;
202
- return a?.startsWith("Markdown") ? a.slice(8).toLowerCase() : "";
203
- }
204
- function fe(e, ...t) {
205
- const a = e;
206
- for (const o of t)
207
- if (a[o] !== void 0 && a[o] !== null) return a[o];
208
- }
209
- function p(e, ...t) {
210
- const a = fe(e, ...t);
211
- return typeof a == "string" ? a : "";
212
- }
213
- const Yt = /* @__PURE__ */ new Set([
214
- "id",
215
- "className",
216
- "style",
217
- "title",
218
- "role",
219
- "tabIndex",
220
- "hidden",
221
- "dir",
222
- "lang",
223
- "slot",
224
- "draggable",
225
- "contentEditable",
226
- "spellCheck",
227
- "open",
228
- "href",
229
- "target",
230
- "rel",
231
- "download",
232
- "src",
233
- "alt",
234
- "width",
235
- "height",
236
- "loading",
237
- "srcSet",
238
- "sizes",
239
- "type",
240
- "name",
241
- "value",
242
- "checked",
243
- "disabled",
244
- "controls",
245
- "loop",
246
- "muted",
247
- "autoPlay",
248
- "poster",
249
- "preload",
250
- "colSpan",
251
- "rowSpan",
252
- "scope",
253
- "dateTime"
254
- ]);
255
- function J(e, t = []) {
256
- const a = /* @__PURE__ */ new Set(["node", ...t]);
257
- return Object.fromEntries(
258
- Object.entries(e).filter(
259
- ([o]) => !a.has(o) && !o.startsWith("dataCf") && !o.startsWith("data-cf-") && (Yt.has(o) || o.startsWith("aria-") || o.startsWith("data-") && !o.startsWith("data-cf-") || /^on[A-Z]/.test(o))
260
- )
261
- );
262
- }
263
- function V(e, t) {
264
- const a = typeof t == "string" ? t.split(/\s+/) : [];
265
- return [...new Set([...e.split(/\s+/), ...a].filter(Boolean))].join(" ");
266
- }
267
- function Qt(e) {
268
- const t = Q(e).find((a) => W(a) === "pre");
269
- return j(t ? t.props.children : e);
270
- }
271
- function ve({
272
- children: e,
273
- source: t,
274
- language: a,
275
- filename: o,
276
- overflow: n,
277
- copyLabel: c,
278
- copyFailureLabel: r,
279
- ...i
280
- }) {
281
- const s = i, f = t ?? (p(s, "data-cf-source", "dataCfSource") || Qt(e)), b = a ?? (p(s, "data-cf-language", "dataCfLanguage") || "text"), d = o ?? (p(s, "data-cf-filename", "dataCfFilename") || void 0), y = p(s, "data-cf-code-overflow", "dataCfCodeOverflow"), m = n ?? (y === "wrap" || y === "scroll" ? y : void 0), v = c ?? (p(s, "data-cf-copy-label", "dataCfCopyLabel") || I.copyCode), C = r ?? (p(s, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || I.copyFailed), S = V("cf-code", s.className), { className: g, ...M } = J(s);
282
- return /* @__PURE__ */ L(
283
- "figure",
284
- {
285
- ...M,
286
- className: S,
287
- "data-cf-component": "code-block",
288
- "data-cf-slot": "root",
289
- "data-cf-code-overflow": m,
290
- children: [
291
- /* @__PURE__ */ l(
292
- ea,
293
- {
294
- source: f,
295
- language: b,
296
- filename: d,
297
- copyLabel: v,
298
- copyFailureLabel: C
299
- }
300
- ),
301
- e
302
- ]
303
- }
304
- );
305
- }
306
- function ea({
307
- source: e,
308
- language: t,
309
- filename: a,
310
- copyLabel: o = I.copyCode,
311
- copyFailureLabel: n = I.copyFailed
312
- }) {
313
- return /* @__PURE__ */ l(
314
- "div",
315
- {
316
- className: "cf-code-bar",
317
- "data-cf-slot": "toolbar",
318
- "data-cf-behavior": "code-toolbar",
319
- "data-cf-language": t,
320
- "data-cf-filename": a,
321
- "data-cf-copy-label": o,
322
- "data-cf-copy-failure-label": n,
323
- children: /* @__PURE__ */ L(U, { children: [
324
- a ? /* @__PURE__ */ L("span", { className: "cf-code-file", "data-cf-slot": "title", "data-cf-language": t, children: [
325
- /* @__PURE__ */ l(Xt, { filename: a, language: t }),
326
- /* @__PURE__ */ l("span", { className: "cf-code-file-name", children: a })
327
- ] }) : /* @__PURE__ */ l("span", { className: "cf-code-lang", "data-cf-slot": "title", children: t }),
328
- /* @__PURE__ */ l("div", { className: "cf-block-actions", "data-cf-slot": "actions", children: /* @__PURE__ */ l(
329
- me,
330
- {
331
- value: e,
332
- label: o,
333
- failureLabel: n,
334
- action: "copy-code"
335
- }
336
- ) })
337
- ] })
338
- }
339
- );
340
- }
341
- function Ce({
342
- children: e,
343
- value: t,
344
- copyLabel: a,
345
- copyFailureLabel: o,
346
- className: n,
347
- inner: c = !1,
348
- ...r
349
- }) {
350
- const i = t ?? (p(r, "data-cf-value", "dataCfValue") || j(e)), s = a || p(r, "data-cf-copy-label", "dataCfCopyLabel") || I.copySnippet, f = o || p(r, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || I.copyFailed, b = V("cf-copy-snippet", n), { className: d, ...y } = J(r), m = /* @__PURE__ */ L(U, { children: [
351
- /* @__PURE__ */ l("code", { "data-cf-slot": "content", children: e ?? i }),
352
- /* @__PURE__ */ l(
353
- me,
354
- {
355
- value: i,
356
- label: s,
357
- action: "copy-snippet",
358
- className: "cf-copy-snippet-button",
359
- failureLabel: f
360
- }
361
- )
362
- ] });
363
- return c ? m : /* @__PURE__ */ l(
364
- "span",
365
- {
366
- ...y,
367
- className: b,
368
- "data-cf-component": "copy-snippet",
369
- "data-cf-slot": "root",
370
- "data-cf-behavior": "copy-snippet",
371
- "data-cf-value": i,
372
- "data-cf-copy-label": s,
373
- "data-cf-copy-failure-label": f,
374
- children: m
375
- }
376
- );
377
- }
378
- function we(e) {
379
- return e.type === "root" ? ["r", e.children.map(we)] : e.type === "element" ? ["e", e.tagName, e.properties, e.children.map(we)] : e.type === "comment" ? ["c", e.value] : ["t", "value" in e ? String(e.value) : ""];
380
- }
381
- function ta(e) {
382
- try {
383
- return !e || typeof e != "object" || typeof e.type != "string" ? void 0 : JSON.stringify(we(e));
384
- } catch {
385
- return;
386
- }
387
- }
388
- const aa = [
389
- "a[href]",
390
- "button:not([disabled])",
391
- "input:not([disabled])",
392
- "select:not([disabled])",
393
- "textarea:not([disabled])",
394
- '[tabindex]:not([tabindex="-1"])'
395
- ].join(",");
396
- function Ee({ children: e }) {
397
- return typeof document > "u" ? null : Gt(e, document.body);
398
- }
399
- function je({
400
- open: e,
401
- close: t,
402
- dialogRef: a,
403
- initialFocusRef: o,
404
- triggerRef: n
405
- }) {
406
- return Z(() => {
407
- if (!e) return;
408
- const c = document.body.style.overflow;
409
- return document.body.style.overflow = "hidden", o.current?.focus(), () => {
410
- document.body.style.overflow = c, n.current?.focus();
411
- };
412
- }, [o, e, n]), (c) => {
413
- if (c.key === "Escape") {
414
- c.preventDefault(), t();
415
- return;
416
- }
417
- if (c.key !== "Tab") return;
418
- const r = Array.from(
419
- a.current?.querySelectorAll(aa) ?? []
420
- ).filter(
421
- (f) => !f.hidden && !f.closest("[hidden], [inert]") && f.getAttribute("aria-hidden") !== "true"
422
- );
423
- if (!r.length) {
424
- c.preventDefault(), a.current?.focus();
425
- return;
426
- }
427
- const i = r[0], s = r.at(-1);
428
- !i || !s || (c.shiftKey && document.activeElement === i ? (c.preventDefault(), s.focus()) : !c.shiftKey && document.activeElement === s && (c.preventDefault(), i.focus()));
429
- };
430
- }
431
- const it = Ye(void 0), oa = /^(?:https?|ircs?|mailto|tel|xmpp)$/i;
432
- function na(e) {
433
- const t = e.indexOf(":"), a = e.indexOf("/"), o = e.indexOf("?"), n = e.indexOf("#");
434
- if (t === -1 || a !== -1 && t > a || o !== -1 && t > o || n !== -1 && t > n)
435
- return e;
436
- const c = e.slice(0, t).replace(/[\u0000-\u0020]/g, "");
437
- return oa.test(c) ? e : void 0;
438
- }
439
- function Be(e, t, a) {
440
- return na(a ? a(e, t) : e);
441
- }
442
- function ra({
443
- transform: e,
444
- children: t
445
- }) {
446
- const a = le(
447
- () => (o, n) => Be(o, n, e) ?? "",
448
- [e]
449
- );
450
- return w(it.Provider, { value: a, children: t });
451
- }
452
- function lt() {
453
- return Qe(it);
454
- }
455
- function ca(e) {
456
- const t = [];
457
- let a = 0;
458
- for (; a < e.length; ) {
459
- for (; a < e.length && /[\t\n\f\r ,]/.test(e[a] ?? ""); ) a += 1;
460
- if (a >= e.length) break;
461
- const o = a;
462
- for (; a < e.length && !/[\t\n\f\r ]/.test(e[a] ?? ""); ) a += 1;
463
- let n = e.slice(o, a), c = 0;
464
- for (; n.endsWith(","); )
465
- n = n.slice(0, -1), c += 1;
466
- if (c > 0) {
467
- t.push({ url: n, descriptor: "" });
468
- continue;
469
- }
470
- for (; a < e.length && /[\t\n\f\r ]/.test(e[a] ?? ""); ) a += 1;
471
- const r = a;
472
- for (; a < e.length && e[a] !== ","; ) a += 1;
473
- const i = e.slice(r, a).trim();
474
- e[a] === "," && (a += 1), t.push({ url: n, descriptor: i });
475
- }
476
- return t;
477
- }
478
- function _e(e, t) {
479
- return ca(e).flatMap(({ url: a, descriptor: o }) => {
480
- const n = Be(a, "srcSet", t);
481
- return n ? [`${n}${o ? ` ${o}` : ""}`] : [];
482
- }).join(", ");
483
- }
484
- function ke(e, t) {
485
- let a = e;
486
- const o = () => (a === e && (a = { ...e }), a);
487
- for (const n of ["href", "src", "poster"]) {
488
- const c = e[n];
489
- if (typeof c != "string") continue;
490
- const r = Be(c, n, t);
491
- r === void 0 ? delete o()[n] : r !== c && (o()[n] = r);
492
- }
493
- for (const n of ["srcSet", "srcset"]) {
494
- const c = e[n];
495
- if (typeof c != "string") continue;
496
- const r = _e(c, t);
497
- r ? r !== c && (o()[n] = r) : delete o()[n];
498
- }
499
- return a;
500
- }
501
- function Le({
502
- children: e,
503
- node: t,
504
- src: a,
505
- alt: o,
506
- caption: n,
507
- title: c,
508
- width: r,
509
- height: i,
510
- loading: s,
511
- srcSet: f,
512
- sizes: b,
513
- zoomLabel: d,
514
- closeLabel: y,
515
- inner: m = !1,
516
- ...v
517
- }) {
518
- const C = v, S = lt(), g = a && S ? S(a, "src") : a, M = f && S ? _e(f, S) : f, h = rt(ot()), k = O.toArray(e).find(
519
- (X) => A(X) && W(X) === "img"
520
- ), z = O.toArray(e).find((X) => {
521
- if (!A(X)) return !1;
522
- const oe = X;
523
- return W(oe) === "figcaption" || oe.props["data-cf-slot"] === "caption";
524
- }), F = d || p(C, "data-cf-zoom-label", "dataCfZoomLabel") || I.zoomImage, D = y || p(C, "data-cf-close-label", "dataCfCloseLabel") || I.closeImagePreview, [T, G] = B(!1), $ = _(null), u = _(null), x = _(null), K = () => G(!1), te = je({
525
- open: T,
526
- close: K,
527
- dialogRef: x,
528
- initialFocusRef: u,
529
- triggerRef: $
530
- }), re = k ?? (g ? /* @__PURE__ */ l(
531
- "img",
532
- {
533
- src: g,
534
- alt: o ?? "",
535
- title: c,
536
- width: r,
537
- height: i,
538
- loading: s,
539
- srcSet: M,
540
- sizes: b,
541
- "data-cf-element": "image"
542
- }
543
- ) : null), Y = z ?? (n ? /* @__PURE__ */ l("figcaption", { "data-cf-slot": "caption", children: n }) : null), ae = V("cf-media-frame", C.className), { className: se, ...de } = J(C);
544
- if (!re)
545
- return m ? /* @__PURE__ */ l(U, { children: e }) : /* @__PURE__ */ l("figure", { ...de, className: ae, "data-cf-component": "image", "data-cf-slot": "root", children: e });
546
- const he = /* @__PURE__ */ L(U, { children: [
547
- /* @__PURE__ */ l(
548
- "button",
549
- {
550
- ref: $,
551
- className: "cf-media-zoom",
552
- type: "button",
553
- "data-cf-action": "zoom-image",
554
- "data-cf-slot": "action",
555
- "aria-label": F,
556
- "aria-haspopup": "dialog",
557
- title: F,
558
- onClick: () => G(!0),
559
- children: re
560
- }
561
- ),
562
- Y ? h ? /* @__PURE__ */ l(h, { ...Y.props, "data-cf-slot": "caption", children: Y.props.children }) : /* @__PURE__ */ l("figcaption", { "data-cf-slot": "caption", children: Y.props.children }) : null,
563
- T ? /* @__PURE__ */ l(Ee, { children: /* @__PURE__ */ L(
564
- "div",
565
- {
566
- ref: x,
567
- className: "cf-image-lightbox",
568
- "data-cf-slot": "lightbox",
569
- role: "dialog",
570
- "aria-modal": "true",
571
- "aria-label": F,
572
- tabIndex: -1,
573
- onKeyDown: te,
574
- children: [
575
- /* @__PURE__ */ l(
576
- "div",
577
- {
578
- className: "cf-image-lightbox-backdrop",
579
- "data-cf-action": "close-image",
580
- "aria-hidden": "true",
581
- onClick: K
582
- }
583
- ),
584
- /* @__PURE__ */ L("div", { className: "cf-image-lightbox-card", children: [
585
- /* @__PURE__ */ l(
586
- "button",
587
- {
588
- ref: u,
589
- className: "cf-icon-button cf-image-lightbox-close",
590
- type: "button",
591
- "data-cf-action": "close-image",
592
- "data-cf-slot": "close",
593
- "aria-label": D,
594
- onClick: K,
595
- children: /* @__PURE__ */ l(E, { name: "close" })
596
- }
597
- ),
598
- R(re, { loading: "eager" }),
599
- Y ? /* @__PURE__ */ l("p", { children: j(Y.props.children) }) : null
600
- ] })
601
- ]
602
- }
603
- ) }) : null
604
- ] });
605
- return m ? he : /* @__PURE__ */ l(
606
- "figure",
607
- {
608
- ...de,
609
- className: ae,
610
- "data-cf-component": "image",
611
- "data-cf-slot": "root",
612
- "data-cf-island": "image",
613
- "data-cf-zoom-label": F,
614
- "data-cf-close-label": D,
615
- "data-cf-island-data": ta(t),
616
- children: he
617
- }
618
- );
619
- }
620
- function ia(e) {
621
- return Q(e).find((t) => W(t) === "table");
622
- }
623
- function Ne(e) {
624
- return e ? Q(e.props.children).filter((t) => W(t) === "tr") : [];
625
- }
626
- function ue(e) {
627
- return Q(e.props.children).filter(
628
- (t) => W(t) === "th" || W(t) === "td"
629
- );
630
- }
631
- function Ve(e, t) {
632
- return Q(e.props.children).find(
633
- (a) => W(a) === t
634
- );
635
- }
636
- function la(e) {
637
- return /[",\n]/.test(e) ? `"${e.replace(/"/g, '""')}"` : e;
638
- }
639
- function sa(e) {
640
- return e ? Q(e.props.children).filter(
641
- (a) => W(a) === "thead" || W(a) === "tbody"
642
- ).flatMap(
643
- (a) => Ne(a).map(
644
- (o) => ue(o).map((n) => la(j(n.props.children))).join(",")
645
- )
646
- ).join(`
647
- `) : "";
648
- }
649
- function da(e, t, a, o) {
650
- if (!e) return null;
651
- const n = Ve(e, "thead"), c = Ve(e, "tbody"), r = Ne(n), i = r[0] ? ue(r[0]).map((b, d) => {
652
- const y = t?.column === d, m = y ? t.direction : void 0;
653
- return R(b, {
654
- "aria-sort": y ? m === "asc" ? "ascending" : "descending" : void 0,
655
- children: /* @__PURE__ */ L(
656
- "button",
657
- {
658
- className: "cf-sort-button",
659
- type: "button",
660
- "data-cf-action": "sort-table",
661
- "data-column": String(d),
662
- "data-sort": m,
663
- "aria-pressed": y ? "true" : "false",
664
- "aria-label": a.replace("{column}", String(d + 1)),
665
- title: a.replace("{column}", String(d + 1)),
666
- onClick: () => o?.(d),
667
- children: [
668
- /* @__PURE__ */ l("span", { className: "cf-sort-label", children: b.props.children }),
669
- /* @__PURE__ */ l("span", { className: "cf-sort-icon", "aria-hidden": "true", children: /* @__PURE__ */ l(E, { name: "sort", direction: m }) })
670
- ]
671
- }
672
- )
673
- });
674
- }) : [], s = c ? Ne(c).slice().sort((b, d) => {
675
- if (!t) return 0;
676
- const y = j(ue(b)[t.column]?.props.children), m = j(ue(d)[t.column]?.props.children), v = y.localeCompare(m, void 0, { numeric: !0, sensitivity: "base" });
677
- return t.direction === "asc" ? v : -v;
678
- }) : [], f = Q(e.props.children).map((b) => W(b) === "thead" && r[0] ? R(b, {
679
- children: r.map(
680
- (d, y) => y === 0 ? R(d, { children: i }) : d
681
- )
682
- }) : W(b) === "tbody" && c && t ? R(b, { children: s }) : b);
683
- return R(e, { children: f });
684
- }
685
- function Se({
686
- children: e,
687
- tableTitle: t,
688
- copyLabel: a,
689
- copyFailureLabel: o,
690
- downloadLabel: n,
691
- zoomLabel: c,
692
- closeLabel: r,
693
- sortLabel: i,
694
- serializedTable: s,
695
- inner: f = !1,
696
- ...b
697
- }) {
698
- const d = b, y = ia(e), m = le(() => sa(y), [y]), [v, C] = B(null), [S, g] = B(!1), M = _(null), h = _(null), k = _(null), z = t || p(d, "data-cf-table-title", "dataCfTableTitle") || I.tableTitle, F = a || p(d, "data-cf-copy-label", "dataCfCopyLabel") || I.copyTableCsv, D = o || p(d, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || I.copyFailed, T = n || p(d, "data-cf-download-label", "dataCfDownloadLabel") || I.downloadTableCsv, G = c || p(d, "data-cf-zoom-label", "dataCfZoomLabel") || I.zoomTable, $ = r || p(d, "data-cf-close-label", "dataCfCloseLabel") || I.closeTablePreview, u = i || p(d, "data-cf-sort-label", "dataCfSortLabel") || I.sortTableColumn, x = s ?? p(d, "data-cf-table", "dataCfTable"), K = V("cf-table-window", d.className), { className: te, ...re } = J(d), ae = da(y, v, u, (oe) => C(
699
- (Ke) => Ke?.column === oe ? Ke.direction === "asc" ? { column: oe, direction: "desc" } : null : { column: oe, direction: "asc" }
700
- )), se = () => g(!1), de = je({
701
- open: S,
702
- close: se,
703
- dialogRef: k,
704
- initialFocusRef: k,
705
- triggerRef: M
706
- }), X = /* @__PURE__ */ L(U, { children: [
707
- /* @__PURE__ */ L("div", { className: "cf-block-toolbar", "data-cf-slot": "toolbar", children: [
708
- /* @__PURE__ */ L("span", { className: "cf-block-title", "data-cf-slot": "title", children: [
709
- /* @__PURE__ */ l(E, { name: "table" }),
710
- /* @__PURE__ */ l("span", { children: z })
711
- ] }),
712
- /* @__PURE__ */ L("div", { className: "cf-block-actions", "data-cf-slot": "actions", children: [
713
- /* @__PURE__ */ l(
714
- me,
715
- {
716
- value: m,
717
- label: F,
718
- failureLabel: D,
719
- action: "copy-table"
720
- }
721
- ),
722
- /* @__PURE__ */ l(
723
- Jt,
724
- {
725
- value: m,
726
- filename: "table.csv",
727
- label: T,
728
- action: "download-table",
729
- contentType: "text/csv;charset=utf-8"
730
- }
731
- ),
732
- /* @__PURE__ */ l(
733
- "button",
734
- {
735
- ref: M,
736
- className: "cf-block-button",
737
- type: "button",
738
- "data-cf-action": "zoom-table",
739
- "aria-label": G,
740
- title: G,
741
- "aria-haspopup": "dialog",
742
- onClick: () => g(!0),
743
- children: /* @__PURE__ */ l(E, { name: "maximize" })
744
- }
745
- )
746
- ] })
747
- ] }),
748
- /* @__PURE__ */ l("div", { className: "cf-data-table", "data-cf-slot": "content", children: ae ?? e }),
749
- S && ae ? /* @__PURE__ */ l(Ee, { children: /* @__PURE__ */ L(
750
- "div",
751
- {
752
- ref: k,
753
- className: "cf-table-preview",
754
- "data-cf-slot": "preview",
755
- role: "dialog",
756
- "aria-modal": "true",
757
- "aria-label": z,
758
- tabIndex: -1,
759
- onKeyDown: de,
760
- children: [
761
- /* @__PURE__ */ l(
762
- "div",
763
- {
764
- className: "cf-table-preview-backdrop",
765
- "data-cf-action": "close-table",
766
- "aria-hidden": "true",
767
- onClick: se
768
- }
769
- ),
770
- /* @__PURE__ */ L("div", { className: "cf-table-preview-card", children: [
771
- /* @__PURE__ */ L("div", { className: "cf-table-preview-head", children: [
772
- /* @__PURE__ */ l("strong", { children: z }),
773
- /* @__PURE__ */ l(
774
- "button",
775
- {
776
- ref: h,
777
- className: "cf-icon-button",
778
- type: "button",
779
- "data-cf-action": "close-table",
780
- "data-cf-slot": "close",
781
- "aria-label": $,
782
- onClick: se,
783
- children: /* @__PURE__ */ l(E, { name: "close" })
784
- }
785
- )
786
- ] }),
787
- /* @__PURE__ */ l("div", { className: "cf-table-preview-body", children: /* @__PURE__ */ l("div", { className: "cf-table-window", children: /* @__PURE__ */ l("div", { className: "cf-data-table", children: ae }) }) })
788
- ] })
789
- ]
790
- }
791
- ) }) : null
792
- ] });
793
- return f ? X : /* @__PURE__ */ l(
794
- "figure",
795
- {
796
- ...re,
797
- className: K,
798
- "data-cf-component": "table",
799
- "data-cf-slot": "root",
800
- "data-cf-island": "table",
801
- "data-cf-table-title": z,
802
- "data-cf-copy-label": F,
803
- "data-cf-copy-failure-label": D,
804
- "data-cf-download-label": T,
805
- "data-cf-zoom-label": G,
806
- "data-cf-close-label": $,
807
- "data-cf-sort-label": u,
808
- "data-cf-table": x || void 0,
809
- children: X
810
- }
811
- );
812
- }
813
- function fa(e) {
814
- return e.replace(/\r\n?/g, `
815
- `).split(`
816
- `).map((t, a, o) => {
817
- const n = t.match(/^(\s*)([$>])(\s*)/), c = n ? null : t.match(/^(\s*)([✓✔✕✖!→•])(\s*)/), r = n ? /* @__PURE__ */ L(U, { children: [
818
- /* @__PURE__ */ l("span", { className: "cf-terminal-prompt", children: `${n[1]}${n[2]}` }),
819
- n[3] || " ",
820
- t.slice(n[0].length)
821
- ] }) : c ? /* @__PURE__ */ L(U, { children: [
822
- /* @__PURE__ */ l("span", { className: "cf-terminal-status", children: `${c[1]}${c[2]}` }),
823
- c[3] || " ",
824
- t.slice(c[0].length)
825
- ] }) : /* @__PURE__ */ l("span", { className: "cf-terminal-output", children: t });
826
- return /* @__PURE__ */ L("span", { children: [
827
- r,
828
- a < o.length - 1 ? `
829
- ` : null
830
- ] }, `${a}-${t}`);
831
- });
832
- }
833
- function pe({
834
- children: e,
835
- node: t,
836
- title: a,
837
- source: o,
838
- copyLabel: n,
839
- copyFailureLabel: c,
840
- ...r
841
- }) {
842
- const i = r, s = a || p(i, "data-cf-title", "dataCfTitle") || I.terminalTitle, f = o ?? p(i, "data-cf-source", "dataCfSource"), b = n || p(i, "data-cf-copy-label", "dataCfCopyLabel") || I.copyTerminal, d = c || p(i, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || I.copyFailed, y = V("cf-terminal", i.className), { className: m, ...v } = J(i);
843
- return /* @__PURE__ */ L("div", { ...v, className: y, "data-cf-component": "terminal", "data-cf-slot": "root", children: [
844
- /* @__PURE__ */ l(
845
- ua,
846
- {
847
- title: s,
848
- source: f,
849
- copyLabel: b,
850
- copyFailureLabel: d
851
- }
852
- ),
853
- /* @__PURE__ */ l("pre", { "data-cf-slot": "content", children: fa(f) })
854
- ] });
855
- }
856
- function ua({
857
- title: e,
858
- source: t,
859
- copyLabel: a = I.copyTerminal,
860
- copyFailureLabel: o = I.copyFailed,
861
- inner: n = !1
862
- }) {
863
- const c = /* @__PURE__ */ L(U, { children: [
864
- /* @__PURE__ */ l("span", { children: e }),
865
- /* @__PURE__ */ l(
866
- me,
867
- {
868
- value: t,
869
- label: a,
870
- action: "copy-terminal",
871
- className: "cf-copy-snippet-button",
872
- failureLabel: o
873
- }
874
- )
875
- ] });
876
- return n ? c : /* @__PURE__ */ l(
877
- "div",
878
- {
879
- className: "cf-terminal-head",
880
- "data-cf-slot": "toolbar",
881
- "data-cf-behavior": "terminal-toolbar",
882
- "data-cf-title": e,
883
- "data-cf-copy-label": a,
884
- "data-cf-copy-failure-label": o,
885
- children: c
886
- }
887
- );
888
- }
889
- function xe(e, t) {
890
- return O.toArray(e).find((a) => A(a) ? a.type === t : !1);
891
- }
892
- function pa(e) {
893
- return O.toArray(e).flatMap((t) => {
894
- if (!A(t) || t.type !== "figure") return [];
895
- const a = t.props, o = xe(a.children, "img");
896
- if (!o || typeof o.props.src != "string") return [];
897
- const n = xe(a.children, "figcaption");
898
- return [
899
- {
900
- src: o.props.src,
901
- alt: typeof o.props.alt == "string" ? o.props.alt : "",
902
- caption: n ? j(n.props.children) : void 0,
903
- title: typeof o.props.title == "string" ? o.props.title : void 0,
904
- srcSet: typeof o.props.srcSet == "string" ? o.props.srcSet : void 0,
905
- sizes: typeof o.props.sizes == "string" ? o.props.sizes : void 0,
906
- width: typeof o.props.width == "number" || typeof o.props.width == "string" ? o.props.width : void 0,
907
- height: typeof o.props.height == "number" || typeof o.props.height == "string" ? o.props.height : void 0
908
- }
909
- ];
910
- });
911
- }
912
- function ba(e) {
913
- return O.toArray(e).filter((t) => {
914
- if (!A(t)) return !0;
915
- const a = t.props;
916
- if (t.type === "figure") {
917
- const o = xe(a.children, "img");
918
- return !o || typeof o.props.src != "string";
919
- }
920
- return We({ children: [a.node] }).length === 0;
921
- });
922
- }
923
- function We(e) {
924
- return !e || typeof e != "object" ? [] : (Array.isArray(e.children) ? e.children : []).flatMap((a) => {
925
- if (!a || typeof a != "object" || a.tagName !== "figure")
926
- return [];
927
- const o = Array.isArray(a.children) ? a.children : [], n = o.find(
928
- (r) => r && typeof r == "object" && r.tagName === "img"
929
- );
930
- if (!n?.properties || typeof n.properties.src != "string") return [];
931
- const c = o.find(
932
- (r) => r && typeof r == "object" && r.tagName === "figcaption"
933
- );
934
- return [
935
- {
936
- src: n.properties.src,
937
- alt: typeof n.properties.alt == "string" ? n.properties.alt : "",
938
- caption: c ? j(c) : void 0,
939
- title: typeof n.properties.title == "string" ? n.properties.title : void 0,
940
- srcSet: typeof n.properties.srcSet == "string" ? n.properties.srcSet : void 0,
941
- sizes: typeof n.properties.sizes == "string" ? n.properties.sizes : void 0,
942
- width: typeof n.properties.width == "number" || typeof n.properties.width == "string" ? n.properties.width : void 0,
943
- height: typeof n.properties.height == "number" || typeof n.properties.height == "string" ? n.properties.height : void 0
944
- }
945
- ];
946
- });
947
- }
948
- function st(e, t, a) {
949
- if (e?.length) return e;
950
- const o = We(t);
951
- return o.length ? o : pa(a);
952
- }
953
- function ma(e, t) {
954
- return {
955
- gallery: e?.gallery ?? (p(t, "data-cf-gallery-label", "dataCfGalleryLabel") || I.imageGallery),
956
- close: e?.close ?? (p(t, "data-cf-close-label", "dataCfCloseLabel") || I.closeImageGallery),
957
- previous: e?.previous ?? (p(t, "data-cf-previous-label", "dataCfPreviousLabel") || I.previousGalleryImage),
958
- next: e?.next ?? (p(t, "data-cf-next-label", "dataCfNextLabel") || I.nextGalleryImage),
959
- thumbnails: e?.thumbnails ?? (p(t, "data-cf-thumbnails-label", "dataCfThumbnailsLabel") || I.galleryThumbnails),
960
- image: e?.image ?? (p(t, "data-cf-image-label", "dataCfImageLabel") || I.galleryImage)
961
- };
962
- }
963
- function Ie({
964
- children: e,
965
- items: t,
966
- className: a,
967
- role: o = "group",
968
- labels: n,
969
- node: c,
970
- inner: r = !1,
971
- ...i
972
- }) {
973
- const s = i, f = lt(), b = We(c), d = st(t, c, e).map((u) => ({
974
- ...u,
975
- src: f ? f(u.src, "src") : u.src,
976
- srcSet: u.srcSet && f ? _e(u.srcSet, f) : u.srcSet
977
- })), y = JSON.stringify(d), m = d.length && b.length === 0 ? ba(e) : [], [v, C] = B(null), S = v === null ? void 0 : d[v], g = _(null), M = _(null), h = _(null), k = ma(n, s), z = (u, x) => {
978
- g.current = x, C(u);
979
- }, F = () => C(null), D = je({
980
- open: !!S,
981
- close: F,
982
- dialogRef: h,
983
- initialFocusRef: M,
984
- triggerRef: g
985
- });
986
- Z(() => {
987
- v !== null && !S && C(null);
988
- }, [v, S]);
989
- const T = (u) => {
990
- d.length && C(
991
- (x) => x === null ? 0 : (x + u + d.length) % d.length
992
- );
993
- }, G = (u) => {
994
- D(u), !u.defaultPrevented && (u.key === "ArrowLeft" || u.key === "ArrowRight") && (u.preventDefault(), T(u.key === "ArrowLeft" ? -1 : 1));
995
- }, $ = /* @__PURE__ */ L(U, { children: [
996
- d.length ? d.map((u, x) => /* @__PURE__ */ L("figure", { "data-cf-slot": "item", children: [
997
- /* @__PURE__ */ l(
998
- "button",
999
- {
1000
- className: "cf-gallery-trigger",
1001
- type: "button",
1002
- "data-cf-action": "open-gallery",
1003
- "aria-label": `${u.alt || k.image} ${x + 1}`,
1004
- "aria-haspopup": "dialog",
1005
- onClick: (K) => z(x, K.currentTarget),
1006
- children: /* @__PURE__ */ l(
1007
- "img",
1008
- {
1009
- src: u.src,
1010
- alt: u.alt,
1011
- title: u.title,
1012
- srcSet: u.srcSet,
1013
- sizes: u.sizes,
1014
- width: u.width,
1015
- height: u.height,
1016
- loading: "lazy"
1017
- }
1018
- )
1019
- }
1020
- ),
1021
- u.caption ? /* @__PURE__ */ l("figcaption", { children: u.caption }) : null
1022
- ] }, `${u.src}-${x}`)) : e,
1023
- m,
1024
- v !== null && S ? /* @__PURE__ */ l(Ee, { children: /* @__PURE__ */ L(
1025
- "div",
1026
- {
1027
- ref: h,
1028
- className: "cf-gallery-lightbox",
1029
- "data-cf-slot": "lightbox",
1030
- role: "dialog",
1031
- "aria-modal": "true",
1032
- "aria-label": k.gallery,
1033
- tabIndex: -1,
1034
- onKeyDown: G,
1035
- children: [
1036
- /* @__PURE__ */ l(
1037
- "div",
1038
- {
1039
- className: "cf-gallery-backdrop",
1040
- "data-cf-action": "close-gallery",
1041
- "aria-hidden": "true",
1042
- onClick: F
1043
- }
1044
- ),
1045
- /* @__PURE__ */ L("div", { className: "cf-gallery-dialog", children: [
1046
- /* @__PURE__ */ L("div", { className: "cf-gallery-dialog-head", children: [
1047
- /* @__PURE__ */ l("span", { children: k.gallery }),
1048
- /* @__PURE__ */ l(
1049
- "button",
1050
- {
1051
- ref: M,
1052
- className: "cf-icon-button",
1053
- type: "button",
1054
- "data-cf-action": "close-gallery",
1055
- "aria-label": k.close,
1056
- title: k.close,
1057
- onClick: F,
1058
- children: /* @__PURE__ */ l(E, { name: "close", size: 20 })
1059
- }
1060
- )
1061
- ] }),
1062
- /* @__PURE__ */ L("div", { className: "cf-gallery-stage", children: [
1063
- d.length > 1 ? /* @__PURE__ */ l(
1064
- "button",
1065
- {
1066
- className: "cf-gallery-nav cf-gallery-prev",
1067
- type: "button",
1068
- "data-cf-action": "previous-gallery-image",
1069
- "aria-label": k.previous,
1070
- title: k.previous,
1071
- onClick: () => T(-1),
1072
- children: /* @__PURE__ */ l(E, { name: "previous", size: 20 })
1073
- }
1074
- ) : null,
1075
- /* @__PURE__ */ L("figure", { children: [
1076
- /* @__PURE__ */ l(
1077
- "img",
1078
- {
1079
- src: S.src,
1080
- alt: S.alt,
1081
- title: S.title,
1082
- srcSet: S.srcSet,
1083
- sizes: S.sizes,
1084
- width: S.width,
1085
- height: S.height
1086
- }
1087
- ),
1088
- /* @__PURE__ */ L("figcaption", { children: [
1089
- /* @__PURE__ */ l("span", { className: "cf-gallery-caption", children: S.caption || S.alt }),
1090
- /* @__PURE__ */ L(
1091
- "small",
1092
- {
1093
- className: "cf-gallery-count",
1094
- "data-cf-gallery-count": "",
1095
- "aria-live": "polite",
1096
- "aria-atomic": "true",
1097
- children: [
1098
- v + 1,
1099
- " / ",
1100
- d.length
1101
- ]
1102
- }
1103
- )
1104
- ] })
1105
- ] }),
1106
- d.length > 1 ? /* @__PURE__ */ l(
1107
- "button",
1108
- {
1109
- className: "cf-gallery-nav cf-gallery-next",
1110
- type: "button",
1111
- "data-cf-action": "next-gallery-image",
1112
- "aria-label": k.next,
1113
- title: k.next,
1114
- onClick: () => T(1),
1115
- children: /* @__PURE__ */ l(E, { name: "next", size: 20 })
1116
- }
1117
- ) : null
1118
- ] }),
1119
- d.length > 1 ? /* @__PURE__ */ l("div", { className: "cf-gallery-thumbs", role: "group", "aria-label": k.thumbnails, children: d.map((u, x) => /* @__PURE__ */ l(
1120
- "button",
1121
- {
1122
- className: x === v ? "is-current" : void 0,
1123
- type: "button",
1124
- "data-cf-action": "select-gallery-image",
1125
- "aria-current": x === v ? "true" : void 0,
1126
- "aria-label": `${u.alt || k.image} ${x + 1}`,
1127
- onClick: () => C(x),
1128
- children: /* @__PURE__ */ l("img", { src: u.src, alt: "", loading: "lazy" })
1129
- },
1130
- `${u.src}-thumb-${x}`
1131
- )) }) : null
1132
- ] })
1133
- ]
1134
- }
1135
- ) }) : null
1136
- ] });
1137
- return r ? $ : /* @__PURE__ */ l(
1138
- "div",
1139
- {
1140
- ...J(s),
1141
- className: ["cf-image-gallery", a].filter(Boolean).join(" "),
1142
- "data-cf-component": "gallery",
1143
- "data-cf-slot": "root",
1144
- "data-cf-island": "gallery",
1145
- "data-cf-gallery-items": y,
1146
- "data-cf-gallery-label": k.gallery,
1147
- "data-cf-close-label": k.close,
1148
- "data-cf-previous-label": k.previous,
1149
- "data-cf-next-label": k.next,
1150
- "data-cf-thumbnails-label": k.thumbnails,
1151
- "data-cf-image-label": k.image,
1152
- role: o,
1153
- "aria-label": k.gallery,
1154
- children: $
1155
- }
1156
- );
1157
- }
1158
- function Ge(e, t, a) {
1159
- const o = e;
1160
- return o[t] ?? o[a];
1161
- }
1162
- function ce(e) {
1163
- return A(e);
1164
- }
1165
- function dt(e) {
1166
- return String(Ge(e.props, "data-cf-tab", "dataCfTab") ?? "");
1167
- }
1168
- function ga(e) {
1169
- return String(Ge(e.props, "data-cf-tab-panel", "dataCfTabPanel") ?? "");
1170
- }
1171
- function Me(e) {
1172
- return O.toArray(e.props.children).filter(ce);
1173
- }
1174
- function Te(e) {
1175
- return e.props.disabled === !0 || e.props["aria-disabled"] === "true";
1176
- }
1177
- function ha(e) {
1178
- return e.props["aria-selected"] === !0 || e.props["aria-selected"] === "true";
1179
- }
1180
- function He(e) {
1181
- return Number.parseInt(vt, 10) >= 19 ? e.props.ref : e.ref;
1182
- }
1183
- function ya(e, t, a = "smooth") {
1184
- if (typeof e.scrollTo != "function") return;
1185
- const o = t.offsetLeft, n = o + t.offsetWidth;
1186
- o < e.scrollLeft ? e.scrollTo({ left: o, behavior: a }) : n > e.scrollLeft + e.clientWidth && e.scrollTo({ left: n - e.clientWidth, behavior: a });
1187
- }
1188
- function va(e, t, a, o, n, c) {
1189
- const r = O.toArray(e), i = r.findIndex((g) => ce(g) && g.props.role === "tablist");
1190
- if (i < 0) return e;
1191
- const s = r[i], f = Me(s);
1192
- if (!f.length) return e;
1193
- const b = f.map((g, M) => dt(g) || `tab-${M + 1}`), d = f.flatMap((g, M) => Te(g) ? [] : [M]), y = (g, M = !1) => {
1194
- g && (a(g), queueMicrotask(() => {
1195
- const h = o.current[g];
1196
- h && (ya(n.current ?? h.parentElement ?? h, h), M && h.focus());
1197
- }));
1198
- }, m = (g, M) => {
1199
- if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(g.key)) return;
1200
- const h = d.indexOf(M);
1201
- if (h < 0 || d.length === 0) return;
1202
- g.preventDefault(), g.stopPropagation();
1203
- const k = g.key === "Home" ? d[0] : g.key === "End" ? d.at(-1) : d[(h + (g.key === "ArrowRight" || g.key === "ArrowDown" ? 1 : -1) + d.length) % d.length];
1204
- if (k === void 0) return;
1205
- const z = b[k];
1206
- z && y(z, !0);
1207
- }, v = f.map((g, M) => {
1208
- const h = b[M] ?? `tab-${M + 1}`, k = h === t, z = g.props.onClick, F = g.props.onKeyDown, D = He(g);
1209
- return R(g, {
1210
- id: `${c}-tab-${M + 1}`,
1211
- "aria-controls": `${c}-panel-${M + 1}`,
1212
- "aria-selected": k ? "true" : "false",
1213
- tabIndex: k ? 0 : -1,
1214
- ref: (T) => {
1215
- o.current[h] = T, typeof D == "function" ? D(T) : D && "current" in D && (D.current = T);
1216
- },
1217
- onClick: (T) => {
1218
- z?.(T), !T.defaultPrevented && (T.stopPropagation(), y(h));
1219
- },
1220
- onKeyDown: (T) => {
1221
- F?.(T), T.defaultPrevented || m(T, M);
1222
- }
1223
- });
1224
- }), C = He(s), S = R(s, {
1225
- children: v,
1226
- ref: (g) => {
1227
- n.current = g, typeof C == "function" ? C(g) : C && "current" in C && (C.current = g);
1228
- }
1229
- });
1230
- return r.map((g, M) => {
1231
- if (M === i) return S;
1232
- if (!ce(g) || g.props.role !== "tabpanel") return g;
1233
- const h = r.filter((z) => ce(z) && z.props.role === "tabpanel").indexOf(g), k = ga(g) || b[h] || "";
1234
- return R(g, {
1235
- id: `${c}-panel-${h + 1}`,
1236
- "aria-labelledby": `${c}-tab-${h + 1}`,
1237
- hidden: k !== t
1238
- });
1239
- });
1240
- }
1241
- function ie({
1242
- children: e,
1243
- kind: t = "tabs",
1244
- component: a,
1245
- ...o
1246
- }) {
1247
- const c = O.toArray(e).find(
1248
- (u) => ce(u) && u.props.role === "tablist"
1249
- ), r = c ? Me(c).map((u, x) => dt(u) || `tab-${x + 1}`) : [], i = c ? Me(c) : [], s = i.findIndex(
1250
- (u) => ha(u) && !Te(u)
1251
- ), f = i.findIndex((u) => !Te(u)), b = r[s >= 0 ? s : f] ?? "", [d, y] = B(b), m = r.includes(d) ? d : b, v = _({}), C = _(null), [S, g] = B(!1), [M, h] = B(!1), k = yt().replace(/:/g, ""), F = String(Ge(o, "data-cf-tabs-id", "dataCfTabsId") ?? "") || `cf-tabs-${k}`, D = va(e, m, y, v, C, F);
1252
- Z(() => {
1253
- if (t !== "code-group") return;
1254
- const u = C.current;
1255
- if (!u) return;
1256
- const x = () => {
1257
- const te = Math.max(0, u.scrollWidth - u.clientWidth);
1258
- g(te > 1 && u.scrollLeft > 1), h(te > 1 && u.scrollLeft < te - 1);
1259
- };
1260
- x(), u.addEventListener("scroll", x, { passive: !0 });
1261
- const K = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(x);
1262
- return K?.observe(u), () => {
1263
- u.removeEventListener("scroll", x), K?.disconnect();
1264
- };
1265
- }, [e, t]);
1266
- const T = (u) => {
1267
- const x = C.current;
1268
- !x || typeof x.scrollBy != "function" || x.scrollBy({
1269
- left: u * Math.max(180, x.clientWidth * 0.72),
1270
- behavior: "smooth"
1271
- });
1272
- }, G = J(o), $ = V(
1273
- t === "code-group" ? "cf-tabs cf-code-group" : "cf-tabs",
1274
- o.className
1275
- );
1276
- return a ? /* @__PURE__ */ l(
1277
- a,
1278
- {
1279
- ...G,
1280
- className: $,
1281
- kind: t,
1282
- "data-cf-component": t,
1283
- "data-cf-slot": "root",
1284
- "data-cf-behavior": "tabs",
1285
- "data-cf-tabs-id": F,
1286
- children: D
1287
- }
1288
- ) : /* @__PURE__ */ L(
1289
- "div",
1290
- {
1291
- ...G,
1292
- className: $,
1293
- "data-cf-component": t,
1294
- "data-cf-slot": "root",
1295
- "data-cf-behavior": "tabs",
1296
- "data-cf-tabs-id": F,
1297
- children: [
1298
- t === "code-group" ? /* @__PURE__ */ l(
1299
- "button",
1300
- {
1301
- type: "button",
1302
- className: "cf-code-tabs-scroll cf-code-tabs-scroll-start",
1303
- "data-cf-action": "scroll-code-tabs",
1304
- "data-cf-direction": "-1",
1305
- "aria-label": "Previous code files",
1306
- hidden: !S,
1307
- onClick: () => T(-1),
1308
- children: /* @__PURE__ */ l(E, { name: "previous", size: 18 })
1309
- }
1310
- ) : null,
1311
- D,
1312
- t === "code-group" ? /* @__PURE__ */ l(
1313
- "button",
1314
- {
1315
- type: "button",
1316
- className: "cf-code-tabs-scroll cf-code-tabs-scroll-end",
1317
- "data-cf-action": "scroll-code-tabs",
1318
- "data-cf-direction": "1",
1319
- "aria-label": "Next code files",
1320
- hidden: !M,
1321
- onClick: () => T(1),
1322
- children: /* @__PURE__ */ l(E, { name: "next", size: 18 })
1323
- }
1324
- ) : null
1325
- ]
1326
- }
1327
- );
1328
- }
1329
- function Ze(e) {
1330
- if (typeof e.type == "string") return e.type;
1331
- const t = e.type.displayName ?? "";
1332
- return t.startsWith("Markdown") ? t.slice(8).toLowerCase() : "";
1333
- }
1334
- function ft(e) {
1335
- return typeof e == "string" && !e.trim();
1336
- }
1337
- function Fe(e, t, a, o) {
1338
- if (!A(e)) return e;
1339
- const n = e, c = O.toArray(n.props.children).filter((h) => !ft(h)), r = n.props["data-cf-file-tree-file"] !== void 0 || n.props.dataCfFileTreeFile !== void 0, i = n.props["data-cf-file-tree-branch"] !== void 0 || n.props.dataCfFileTreeBranch !== void 0, s = n.props["aria-current"] === "page" || n.props["aria-current"] === !0 || n.props["data-cf-current"] !== void 0 || n.props.dataCfCurrent !== void 0, f = i ? c.findIndex(
1340
- (h) => A(h) && Ze(h) === "button"
1341
- ) : -1, b = i ? c.findIndex(
1342
- (h) => A(h) && Ze(h) === "ul"
1343
- ) : -1, d = String(
1344
- n.props["data-cf-file-tree-path"] ?? n.props.dataCfFileTreePath ?? ""
1345
- ), y = f >= 0 ? j(c[f].props.children) : "", m = d || `${t}:${y.trim().toLowerCase()}`, v = f >= 0 ? c[f].props["aria-expanded"] : void 0, C = i ? a[m] ?? (v !== !1 && v !== "false") : !0, S = c.map((h, k) => {
1346
- const z = `${t}.${k}`;
1347
- if (i && k === f && A(h)) {
1348
- const F = h, D = F.props.onClick, T = O.toArray(F.props.children), G = T.some(
1349
- ($) => A($) && ($.props["data-cf-slot"] === "folder-icon" || $.props.dataCfSlot === "folder-icon")
1350
- );
1351
- return R(F, {
1352
- className: V("cf-file-tree-folder", F.props.className),
1353
- "data-cf-action": "toggle-file-tree",
1354
- "data-cf-file-tree-toggle": "",
1355
- "aria-expanded": String(C),
1356
- children: G ? T : [
1357
- /* @__PURE__ */ l("span", { className: "cf-file-tree-folder-icon", "data-cf-slot": "folder-icon", children: /* @__PURE__ */ l(E, { name: "folder" }) }, "folder-icon"),
1358
- ...T
1359
- ],
1360
- onClick: ($) => {
1361
- typeof D == "function" && D($), $.defaultPrevented || o(m, !C);
1362
- }
1363
- });
1364
- }
1365
- if (i && k === b && A(h)) {
1366
- const F = Fe(h, z, a, o);
1367
- return /* @__PURE__ */ l(
1368
- "div",
1369
- {
1370
- className: "cf-file-tree-children",
1371
- "data-cf-state": C ? "expanded" : "collapsed",
1372
- "aria-hidden": C ? void 0 : "true",
1373
- inert: C ? void 0 : !0,
1374
- children: F
1375
- },
1376
- `${m}-children`
1377
- );
1378
- }
1379
- return Fe(h, z, a, o);
1380
- }), g = c.some(
1381
- (h) => A(h) && (h.props["data-cf-slot"] === "file-icon" || h.props.dataCfSlot === "file-icon")
1382
- ), M = r && !g ? [
1383
- /* @__PURE__ */ l("span", { className: "cf-file-tree-file-icon", "data-cf-slot": "file-icon", children: /* @__PURE__ */ l(E, { name: "file" }) }, "file-icon"),
1384
- ...S
1385
- ] : S;
1386
- return R(n, {
1387
- ...r || i ? {
1388
- className: V(
1389
- [
1390
- r ? "cf-file-tree-file" : "",
1391
- i ? "cf-file-tree-branch" : "",
1392
- s ? "cf-file-tree-current" : ""
1393
- ].filter(Boolean).join(" "),
1394
- n.props.className
1395
- )
1396
- } : {},
1397
- ...i ? {
1398
- "data-cf-state": C ? "expanded" : "collapsed",
1399
- "data-cf-file-tree-path": m
1400
- } : {},
1401
- children: M
1402
- });
1403
- }
1404
- function Ae({ children: e, ...t }) {
1405
- const [a, o] = B({}), n = O.toArray(e).filter((i) => !ft(i)).map(
1406
- (i, s) => Fe(
1407
- i,
1408
- String(s),
1409
- a,
1410
- (f, b) => o((d) => ({ ...d, [f]: b }))
1411
- )
1412
- ), c = O.map(
1413
- n,
1414
- (i) => A(i) ? R(i, { "data-cf-slot": "content" }) : i
1415
- ), r = J(t);
1416
- return /* @__PURE__ */ l(
1417
- "div",
1418
- {
1419
- ...r,
1420
- className: V("cf-file-tree", t.className),
1421
- "data-cf-component": "file-tree",
1422
- "data-cf-slot": "root",
1423
- "data-cf-behavior": "file-tree",
1424
- children: c
1425
- }
1426
- );
1427
- }
1428
- function ee(e, t, a) {
1429
- return {
1430
- ...J(e),
1431
- ...a ? { className: V(a, e.className) } : {},
1432
- "data-cf-component": t,
1433
- "data-cf-slot": "root"
1434
- };
1435
- }
1436
- function be({ children: e, ...t }) {
1437
- const a = String(
1438
- t["data-callout"] ?? t.dataCallout ?? "info"
1439
- ), o = a === "tip" ? jt : a === "warning" ? Bt : a === "danger" ? _t : Wt, n = O.map(e, (c) => {
1440
- if (!A(c)) return c;
1441
- const r = c;
1442
- return r.props["data-cf-slot"] === "title" || r.props.dataCfSlot === "title" ? R(r, {
1443
- children: /* @__PURE__ */ L(U, { children: [
1444
- /* @__PURE__ */ l(o, { className: "cf-callout-icon", size: 17, strokeWidth: 2, "aria-hidden": "true" }),
1445
- r.props.children
1446
- ] })
1447
- }) : c;
1448
- });
1449
- return w("div", ee(t, "callout", "cf-callout"), n);
1450
- }
1451
- function ze({ children: e, ...t }) {
1452
- return w("ol", ee(t, "steps", "cf-steps"), e);
1453
- }
1454
- function Ca(e) {
1455
- const t = O.toArray(e), a = t.findIndex(
1456
- (o) => A(o) && W(o) === "summary"
1457
- );
1458
- return a < 0 ? { summary: void 0, content: t } : {
1459
- summary: t[a],
1460
- content: t.filter(
1461
- (o, n) => n !== a && !(typeof o == "string" && o.trim().length === 0)
1462
- )
1463
- };
1464
- }
1465
- function De({ children: e, onToggle: t, ...a }) {
1466
- const o = a.open === !0, [n, c] = B(o), [r, i] = B(!1), s = _(null), { summary: f, content: b } = Ca(e), d = A(f) ? (() => {
1467
- const m = f, v = m.props.onClick;
1468
- return R(m, {
1469
- children: /* @__PURE__ */ L(U, { children: [
1470
- m.props.children,
1471
- /* @__PURE__ */ l(Et, { className: "cf-details-chevron", size: 17, strokeWidth: 2, "aria-hidden": "true" })
1472
- ] }),
1473
- onClick: (C) => {
1474
- if (v?.(C), C.defaultPrevented) return;
1475
- const S = C.currentTarget.closest("details");
1476
- queueMicrotask(() => c(S?.open ?? !1));
1477
- }
1478
- });
1479
- })() : f;
1480
- Z(() => {
1481
- i(!0);
1482
- }, []);
1483
- const y = /* @__PURE__ */ L(U, { children: [
1484
- d,
1485
- /* @__PURE__ */ l(
1486
- "div",
1487
- {
1488
- ref: s,
1489
- className: "cf-details-content",
1490
- "data-cf-slot": "content",
1491
- inert: r && !n ? !0 : void 0,
1492
- children: /* @__PURE__ */ l("div", { className: "cf-details-content-inner", children: b.map((m, v) => /* @__PURE__ */ l(Ct, { children: m }, A(m) && m.key !== null ? m.key : `details-${v}`)) })
1493
- }
1494
- )
1495
- ] });
1496
- return /* @__PURE__ */ l(
1497
- "details",
1498
- {
1499
- ...ee(a, "details"),
1500
- "data-cf-behavior": "details",
1501
- "data-cf-enhanced": r ? "true" : void 0,
1502
- onToggle: (m) => {
1503
- c(m.currentTarget.open), t?.(m);
1504
- },
1505
- children: y
1506
- }
1507
- );
1508
- }
1509
- function ut(e, t) {
1510
- return O.map(e, (a) => A(a) ? R(a, { "data-cf-slot": t }) : a);
1511
- }
1512
- function $e({ children: e, ...t }) {
1513
- return /* @__PURE__ */ l("div", { ...ee(t, "card-grid", "cf-card-grid"), children: ut(e, "card") });
1514
- }
1515
- function Pe({ children: e, ...t }) {
1516
- return /* @__PURE__ */ l("section", { ...ee(t, "api", "cf-api-block"), children: ut(e, "section") });
1517
- }
1518
- function Oe({ children: e, ...t }) {
1519
- return /* @__PURE__ */ l("aside", { ...ee(t, "aside", "cf-aside"), children: e });
1520
- }
1521
- function Re({ children: e, ...t }) {
1522
- const a = ee(t, "badge", "cf-badge");
1523
- return /* @__PURE__ */ l("span", { ...a, "data-cf-slot": "label", children: e });
1524
- }
1525
- function wa({
1526
- anchor: e,
1527
- anchorLabel: t,
1528
- copyFailureLabel: a = I.copyFailed
1529
- }) {
1530
- const [o, n] = B("idle");
1531
- Z(() => {
1532
- if (o === "idle") return;
1533
- const s = setTimeout(() => n("idle"), ct);
1534
- return () => clearTimeout(s);
1535
- }, [o]);
1536
- const c = async () => {
1537
- const s = typeof window > "u" ? e : `${window.location.origin}${window.location.pathname}${window.location.search}${e}`;
1538
- try {
1539
- n(await et(s) ? "success" : "error");
1540
- } catch {
1541
- n("error");
1542
- }
1543
- }, r = t || I.copySectionLink, i = o === "success" ? `${r} ✓` : o === "error" ? a : r;
1544
- return /* @__PURE__ */ L(
1545
- "button",
1546
- {
1547
- className: `cf-anchor${o === "success" ? " cf-action-success" : ""}${o === "error" ? " cf-action-error" : ""}`,
1548
- type: "button",
1549
- "data-anchor": e,
1550
- "data-cf-action": "copy-section-link",
1551
- "data-cf-anchor-label": r,
1552
- "data-cf-copy-error": o === "error" ? "true" : void 0,
1553
- "aria-label": i,
1554
- title: i,
1555
- onClick: c,
1556
- children: [
1557
- /* @__PURE__ */ l(E, { name: "link" }),
1558
- /* @__PURE__ */ l("span", { className: "cf-sr-only", "aria-live": "polite", "aria-atomic": "true", children: o === "idle" ? "" : i })
1559
- ]
1560
- }
1561
- );
1562
- }
1563
- function ka({
1564
- level: e,
1565
- as: t,
1566
- id: a,
1567
- anchor: o,
1568
- anchorLabel: n,
1569
- copyFailureLabel: c,
1570
- children: r,
1571
- className: i,
1572
- ...s
1573
- }) {
1574
- const f = t ?? `h${e}`, b = i?.split(/\s+/).filter(Boolean) ?? [], d = b.some((v) => v === "sr-only" || v === "cf-sr-only"), y = e > 1 && !!o && !d;
1575
- d && !b.includes("cf-sr-only") && b.push("cf-sr-only"), y && b.push("cf-heading-with-anchor");
1576
- const m = b.join(" ");
1577
- return /* @__PURE__ */ L(f, { ...s, id: a, className: m || void 0, children: [
1578
- r,
1579
- y && o ? /* @__PURE__ */ l(
1580
- "span",
1581
- {
1582
- className: "cf-anchor-island",
1583
- "data-cf-behavior": "heading",
1584
- "data-cf-anchor": o,
1585
- "data-cf-anchor-label": n || I.copySectionLink,
1586
- "data-cf-copy-failure-label": c || I.copyFailed,
1587
- children: /* @__PURE__ */ l(
1588
- wa,
1589
- {
1590
- anchor: o,
1591
- anchorLabel: n,
1592
- copyFailureLabel: c
1593
- }
1594
- )
1595
- }
1596
- ) : null
1597
- ] });
1598
- }
1599
- function qe(e, t) {
1600
- return O.toArray(e).find((a) => {
1601
- if (!A(a)) return !1;
1602
- const o = a;
1603
- return W(o) === t || t === "figcaption" && (o.props["data-cf-slot"] === "caption" || o.props.dataCfSlot === "caption");
1604
- });
1605
- }
1606
- function pt(e, t, a) {
1607
- const o = { ...t, children: a };
1608
- if (e === "code-block")
1609
- return {
1610
- ...o,
1611
- source: p(t, "data-cf-source", "dataCfSource") || j(a),
1612
- language: p(t, "data-cf-language", "dataCfLanguage") || "text",
1613
- copyLabel: p(t, "data-cf-copy-label", "dataCfCopyLabel") || void 0,
1614
- copyFailureLabel: p(t, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || void 0
1615
- };
1616
- if (e === "copy-snippet")
1617
- return {
1618
- ...o,
1619
- value: p(t, "data-cf-value", "dataCfValue") || j(a),
1620
- copyLabel: p(t, "data-cf-copy-label", "dataCfCopyLabel") || void 0,
1621
- copyFailureLabel: p(t, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || void 0
1622
- };
1623
- if (e === "table")
1624
- return {
1625
- ...o,
1626
- tableTitle: p(t, "data-cf-table-title", "dataCfTableTitle") || void 0,
1627
- copyLabel: p(t, "data-cf-copy-label", "dataCfCopyLabel") || void 0,
1628
- copyFailureLabel: p(t, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || void 0,
1629
- downloadLabel: p(t, "data-cf-download-label", "dataCfDownloadLabel") || void 0,
1630
- zoomLabel: p(t, "data-cf-zoom-label", "dataCfZoomLabel") || void 0,
1631
- closeLabel: p(t, "data-cf-close-label", "dataCfCloseLabel") || void 0,
1632
- sortLabel: p(t, "data-cf-sort-label", "dataCfSortLabel") || void 0
1633
- };
1634
- if (e === "image") {
1635
- const n = qe(a, "img"), c = qe(a, "figcaption"), r = n ? fe(n.props, "width") : void 0, i = n ? fe(n.props, "height") : void 0, s = n ? fe(n.props, "loading") : void 0;
1636
- return {
1637
- ...o,
1638
- src: n && p(n.props, "src") || void 0,
1639
- alt: n ? p(n.props, "alt") : void 0,
1640
- caption: c ? j(c.props.children) : void 0,
1641
- title: n && p(n.props, "title") || void 0,
1642
- width: typeof r == "string" || typeof r == "number" ? r : void 0,
1643
- height: typeof i == "string" || typeof i == "number" ? i : void 0,
1644
- loading: s === "eager" || s === "lazy" ? s : void 0,
1645
- srcSet: n && p(n.props, "srcSet", "srcset") || void 0,
1646
- sizes: n && p(n.props, "sizes") || void 0,
1647
- zoomLabel: p(t, "data-cf-zoom-label", "dataCfZoomLabel") || void 0,
1648
- closeLabel: p(t, "data-cf-close-label", "dataCfCloseLabel") || void 0
1649
- };
1650
- }
1651
- return e === "terminal" ? {
1652
- ...o,
1653
- title: p(t, "data-cf-title", "dataCfTitle") || void 0,
1654
- source: p(t, "data-cf-source", "dataCfSource"),
1655
- copyLabel: p(t, "data-cf-copy-label", "dataCfCopyLabel") || void 0,
1656
- copyFailureLabel: p(t, "data-cf-copy-failure-label", "dataCfCopyFailureLabel") || void 0
1657
- } : e === "gallery" ? {
1658
- ...o,
1659
- items: st(void 0, t.node, a),
1660
- labels: {
1661
- gallery: p(t, "data-cf-gallery-label", "dataCfGalleryLabel") || void 0,
1662
- close: p(t, "data-cf-close-label", "dataCfCloseLabel") || void 0,
1663
- previous: p(t, "data-cf-previous-label", "dataCfPreviousLabel") || void 0,
1664
- next: p(t, "data-cf-next-label", "dataCfNextLabel") || void 0,
1665
- thumbnails: p(t, "data-cf-thumbnails-label", "dataCfThumbnailsLabel") || void 0,
1666
- image: p(t, "data-cf-image-label", "dataCfImageLabel") || void 0
1667
- }
1668
- } : o;
1669
- }
1670
- function La(e) {
1671
- return Array.isArray(e) ? e.join(" ") : typeof e == "string" ? e : "";
1672
- }
1673
- function P(e, t) {
1674
- const a = [La(e), t].filter(Boolean);
1675
- return a.length ? a.join(" ") : void 0;
1676
- }
1677
- const Ue = {
1678
- callout: { className: "callout", override: "Callout" },
1679
- tabs: { className: "tabs", override: "Tabs" },
1680
- "code-group": { className: "tabs", override: "CodeGroup" },
1681
- steps: { className: "steps", override: "Steps" },
1682
- "code-block": { className: "codeBlock", override: "CodeBlock" },
1683
- "copy-snippet": { className: "copySnippet", override: "CopySnippet" },
1684
- table: { className: "table", override: "Table" },
1685
- image: { className: "image", override: "Image" },
1686
- terminal: { className: "terminal", override: "Terminal" },
1687
- details: { className: "details", override: "Details" },
1688
- "file-tree": { className: "fileTree", override: "FileTree" },
1689
- gallery: { className: "gallery", override: "Gallery" },
1690
- "card-grid": { className: "cardGrid", override: "CardGrid" },
1691
- api: { className: "api", override: "Api" },
1692
- aside: { className: "aside", override: "Aside" },
1693
- badge: { className: "badge", override: "Badge" }
1694
- };
1695
- function Je(e) {
1696
- const t = typeof e == "string" ? e : "";
1697
- return Object.hasOwn(Ue, t) ? t : void 0;
1698
- }
1699
- function ge(e) {
1700
- return Je(e["data-cf-component"]) ?? Je(e.dataCfComponent);
1701
- }
1702
- function Na(e, t) {
1703
- return t[Ue[e].className];
1704
- }
1705
- function ne(e, t) {
1706
- return e[Ue[t].override];
1707
- }
1708
- function q(e, t) {
1709
- return e[t];
1710
- }
1711
- function bt(e, t, a, o, n, c) {
1712
- const r = P(t.className, Na(e, o)), i = ne(n, e);
1713
- if (i) {
1714
- const s = pt(e, { ...t, className: r }, a);
1715
- return w(i, mt(e, s, c));
1716
- }
1717
- if (e === "file-tree") return w(Ae, { ...t, className: r, children: a });
1718
- if (e === "gallery") return w(Ie, { ...t, className: r, children: a });
1719
- if (e === "terminal") return w(pe, { ...t, className: r, children: a });
1720
- if (e === "copy-snippet")
1721
- return w(Ce, { ...t, className: r, children: a });
1722
- if (e === "card-grid") return w($e, { ...t, className: r, children: a });
1723
- if (e === "api") return w(Pe, { ...t, className: r, children: a });
1724
- if (e === "aside") return w(Oe, { ...t, className: r, children: a });
1725
- if (e === "badge") return w(Re, { ...t, className: r, children: a });
1726
- }
1727
- function mt(e, t, a) {
1728
- const o = ke(t, a);
1729
- return e !== "gallery" || !Array.isArray(o.items) ? o : {
1730
- ...o,
1731
- items: o.items.map(
1732
- (n) => n && typeof n == "object" ? ke(n, a) : n
1733
- )
1734
- };
1735
- }
1736
- function N(e, t, a, o, n) {
1737
- const c = t.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
1738
- function r({ children: i, node: s, ...f }) {
1739
- const b = q(o, e) ?? e, d = ke(f, n);
1740
- if (t === "heading" && /^h[1-6]$/.test(e)) {
1741
- const y = f["data-cf-anchor"] ?? f.dataCfAnchor, m = f["data-cf-anchor-label"] ?? f.dataCfAnchorLabel, v = f["data-cf-copy-failure-label"] ?? f.dataCfCopyFailureLabel;
1742
- return w(ka, {
1743
- ...d,
1744
- as: b,
1745
- level: Number(e.slice(1)),
1746
- anchor: typeof y == "string" ? y : void 0,
1747
- anchorLabel: typeof m == "string" ? m : void 0,
1748
- copyFailureLabel: typeof v == "string" ? v : void 0,
1749
- className: P(d.className, a[t]),
1750
- "data-cf-element": c,
1751
- children: i
1752
- });
1753
- }
1754
- return w(
1755
- b,
1756
- {
1757
- ...d,
1758
- className: P(d.className, a[t]),
1759
- "data-cf-element": c
1760
- },
1761
- i
1762
- );
1763
- }
1764
- return r.displayName = `Markdown${e.charAt(0).toUpperCase()}${e.slice(1)}`, r;
1765
- }
1766
- function Sa(e, t) {
1767
- return function({ children: o, node: n, ...c }) {
1768
- const r = c["data-cf-icon"] ?? c.dataCfIcon, i = typeof r == "string" ? nt(e, r) : void 0;
1769
- if (i)
1770
- return w(i, {
1771
- size: Number(c.width ?? 16),
1772
- className: typeof c.className == "string" ? c.className : void 0,
1773
- "aria-hidden": c["aria-hidden"]
1774
- });
1775
- const { ["data-cf-icon"]: s, dataCfIcon: f, ...b } = c;
1776
- return w(q(t, "svg") ?? "svg", b, o);
1777
- };
1778
- }
1779
- function xa(e, t) {
1780
- return function({ children: o, node: n, ...c }) {
1781
- const r = c["data-cf-slot"] === "caption" ? rt(e) : void 0;
1782
- return r ? w(r, {
1783
- children: o,
1784
- className: typeof c.className == "string" ? c.className : void 0,
1785
- "data-cf-slot": typeof c["data-cf-slot"] == "string" ? c["data-cf-slot"] : void 0
1786
- }) : w(q(t, "figcaption") ?? "figcaption", c, o);
1787
- };
1788
- }
1789
- function Ia(e, t, a) {
1790
- return function({ children: n, node: c, ...r }) {
1791
- const i = ge(r), s = i ? ne(t, i) : void 0;
1792
- if (i === "callout")
1793
- return w(s ?? be, {
1794
- ...r,
1795
- className: P(r.className, e.callout),
1796
- children: n
1797
- });
1798
- if (i === "tabs" || i === "code-group")
1799
- return w(ie, {
1800
- ...r,
1801
- className: P(r.className, e.tabs),
1802
- kind: i,
1803
- component: s,
1804
- children: n
1805
- });
1806
- const f = i && bt(i, { ...r, node: c }, n, e, t, a);
1807
- return f || w(
1808
- q(t, "div") ?? "div",
1809
- {
1810
- ...r,
1811
- ...i ? { "data-cf-component": i } : {}
1812
- },
1813
- n
1814
- );
1815
- };
1816
- }
1817
- function ye(e, t, a, o) {
1818
- return function({ children: c, node: r, ...i }) {
1819
- const s = ge(i), f = s ? ne(a, s) : void 0;
1820
- if (s === "callout")
1821
- return w(f ?? be, {
1822
- ...i,
1823
- className: P(i.className, t.callout),
1824
- children: c
1825
- });
1826
- if (s === "tabs" || s === "code-group")
1827
- return w(ie, {
1828
- ...i,
1829
- className: P(i.className, t.tabs),
1830
- kind: s,
1831
- component: f,
1832
- children: c
1833
- });
1834
- const b = s && bt(s, { ...i, node: r }, c, t, a, o);
1835
- if (b) return b;
1836
- const d = e === "section" && (i["data-cf-element"] === "footnotes" || i.dataCfElement === "footnotes");
1837
- return w(
1838
- q(a, e) ?? e,
1839
- {
1840
- ...i,
1841
- className: d ? P(i.className, t.footnotes) : i.className,
1842
- ...d ? { "data-cf-element": "footnotes" } : {},
1843
- ...s ? { "data-cf-component": s } : {}
1844
- },
1845
- c
1846
- );
1847
- };
1848
- }
1849
- function Ma(e, t, a) {
1850
- return function({ children: n, node: c, ...r }) {
1851
- const i = ge(r);
1852
- if (i && ["code-block", "table", "image", "terminal"].includes(i)) {
1853
- const f = e[i === "code-block" ? "codeBlock" : i], b = ne(t, i);
1854
- if (b) {
1855
- const d = pt(
1856
- i,
1857
- { ...r, className: P(r.className, f) },
1858
- n
1859
- );
1860
- return w(b, mt(i, d, a));
1861
- }
1862
- return i === "code-block" ? w(ve, {
1863
- ...r,
1864
- className: P(r.className, f),
1865
- children: n
1866
- }) : i === "table" ? w(Se, {
1867
- ...r,
1868
- className: P(r.className, f),
1869
- children: n
1870
- }) : i === "image" ? w(Le, {
1871
- ...r,
1872
- className: P(r.className, f),
1873
- children: n
1874
- }) : i === "terminal" ? w(pe, {
1875
- ...r,
1876
- node: c,
1877
- className: P(r.className, f),
1878
- children: n
1879
- }) : w(
1880
- q(t, "figure") ?? "figure",
1881
- { ...r, className: P(r.className, f), "data-cf-component": i },
1882
- n
1883
- );
1884
- }
1885
- return w(
1886
- q(t, "figure") ?? "figure",
1887
- {
1888
- ...r,
1889
- ...i ? { "data-cf-component": i } : {}
1890
- },
1891
- n
1892
- );
1893
- };
1894
- }
1895
- function Ta(e, t) {
1896
- return function({ children: o, node: n, ...c }) {
1897
- const r = ge(c);
1898
- if (r === "steps") {
1899
- const i = ne(t, r) ?? ze;
1900
- return w(i, {
1901
- ...c,
1902
- className: P(c.className, e.steps),
1903
- children: o
1904
- });
1905
- }
1906
- return w(
1907
- q(t, "ol") ?? "ol",
1908
- {
1909
- ...c,
1910
- className: P(c.className, e.list),
1911
- ...r ? { "data-cf-component": r } : {}
1912
- },
1913
- o
1914
- );
1915
- };
1916
- }
1917
- function Fa(e, t) {
1918
- return function({ children: o, node: n, ...c }) {
1919
- const r = ne(t, "details") ?? q(t, "details") ?? De;
1920
- return w(r, {
1921
- ...c,
1922
- node: n,
1923
- className: P(c.className, e.details),
1924
- children: o
1925
- });
1926
- };
1927
- }
1928
- function gt(e = {}, t = {}, a = {}, o) {
1929
- return {
1930
- h1: N("h1", "heading", e, a, o),
1931
- h2: N("h2", "heading", e, a, o),
1932
- h3: N("h3", "heading", e, a, o),
1933
- h4: N("h4", "heading", e, a, o),
1934
- h5: N("h5", "heading", e, a, o),
1935
- h6: N("h6", "heading", e, a, o),
1936
- p: N("p", "paragraph", e, a, o),
1937
- a: N("a", "link", e, a, o),
1938
- ul: N("ul", "list", e, a, o),
1939
- ol: Ta(e, a),
1940
- li: N("li", "listItem", e, a, o),
1941
- blockquote: N("blockquote", "blockquote", e, a),
1942
- hr: N("hr", "horizontalRule", e, a),
1943
- strong: N("strong", "strong", e, a),
1944
- em: N("em", "emphasis", e, a),
1945
- del: N("del", "strikethrough", e, a),
1946
- mark: N("mark", "highlight", e, a),
1947
- kbd: N("kbd", "keyboard", e, a),
1948
- sup: N("sup", "superscript", e, a),
1949
- sub: N("sub", "subscript", e, a),
1950
- code: N("code", "inlineCode", e, a),
1951
- div: Ia(e, a, o),
1952
- aside: ye("aside", e, a, o),
1953
- section: ye("section", e, a, o),
1954
- span: ye("span", e, a, o),
1955
- pre: N("pre", "code", e, a),
1956
- table: N("table", "table", e, a),
1957
- thead: N("thead", "tableHead", e, a),
1958
- tbody: N("tbody", "tableBody", e, a),
1959
- tr: N("tr", "tableRow", e, a),
1960
- th: N("th", "tableHeader", e, a),
1961
- td: N("td", "tableCell", e, a),
1962
- input: N("input", "taskCheckbox", e, a),
1963
- figure: Ma(e, a, o),
1964
- img: N("img", "image", e, a, o),
1965
- video: N("video", "video", e, a, o),
1966
- audio: N("audio", "audio", e, a, o),
1967
- iframe: N("iframe", "embed", e, a, o),
1968
- dl: N("dl", "definitionList", e, a),
1969
- dt: N("dt", "definitionTerm", e, a),
1970
- dd: N("dd", "definitionDescription", e, a),
1971
- summary: N("summary", "summary", e, a),
1972
- figcaption: xa(t, a),
1973
- svg: Sa(t, a),
1974
- details: Fa(e, a),
1975
- MarkdownCallout: be,
1976
- MarkdownTabs: ie,
1977
- MarkdownSteps: ze,
1978
- MarkdownCodeBlock: ve,
1979
- MarkdownCopySnippet: Ce,
1980
- MarkdownTable: Se,
1981
- MarkdownImage: Le,
1982
- MarkdownDetails: De,
1983
- MarkdownTerminal: pe,
1984
- MarkdownFileTree: Ae,
1985
- MarkdownGallery: Ie,
1986
- MarkdownCardGrid: $e,
1987
- MarkdownApiBlock: Pe,
1988
- MarkdownAside: Oe,
1989
- MarkdownBadge: Re,
1990
- Callout: be,
1991
- Tabs: ie,
1992
- CodeGroup: ie,
1993
- Steps: ze,
1994
- CodeBlock: ve,
1995
- CopySnippet: Ce,
1996
- Table: Se,
1997
- Image: Le,
1998
- Details: De,
1999
- Terminal: pe,
2000
- FileTree: Ae,
2001
- Gallery: Ie,
2002
- CardGrid: $e,
2003
- Api: Pe,
2004
- Aside: Oe,
2005
- Badge: Re
2006
- };
2007
- }
2008
- function Ga(e = {}, t = {}, a = {}, o) {
2009
- const n = gt(e, t, a, o);
2010
- for (const [c, r] of Object.entries(a))
2011
- /^[A-Z]/.test(c) && (n[c] = r);
2012
- return n;
2013
- }
2014
- function Aa(...e) {
2015
- return e.filter(Boolean).join(" ");
2016
- }
2017
- function za({
2018
- as: e = "div",
2019
- className: t,
2020
- classNames: a,
2021
- slots: o,
2022
- urlTransform: n,
2023
- children: c,
2024
- "data-cf-root": r = "markdown",
2025
- ...i
2026
- }) {
2027
- return w(ra, {
2028
- transform: n,
2029
- children: w(Zt, {
2030
- slots: o,
2031
- children: w(
2032
- e,
2033
- {
2034
- ...i,
2035
- className: Aa("cf-content", a?.root, t),
2036
- "data-cf-root": r,
2037
- "data-cf-runtime": i["data-cf-runtime"] ?? "react",
2038
- "data-cf-component": "markdown"
2039
- },
2040
- c
2041
- )
2042
- })
2043
- });
2044
- }
2045
- function Xe({
2046
- document: e,
2047
- classNames: t,
2048
- components: a,
2049
- slots: o,
2050
- urlTransform: n,
2051
- ...c
2052
- }) {
2053
- const r = le(
2054
- () => gt(t, o, a, n),
2055
- [t, a, o, n]
2056
- ), i = le(
2057
- () => ht(e, {
2058
- Fragment: U,
2059
- jsx: l,
2060
- jsxs: L,
2061
- components: r,
2062
- passNode: !0
2063
- }),
2064
- [r, e]
2065
- );
2066
- return /* @__PURE__ */ l(za, { ...c, classNames: t, slots: o, urlTransform: n, children: i });
2067
- }
2068
- function Da(e) {
2069
- return Vt(e ?? {});
2070
- }
2071
- const H = /* @__PURE__ */ new Map(), $a = 32;
2072
- function Pa(e, t) {
2073
- return t === void 0 ? void 0 : `${t.length}:${t}\0${e}`;
2074
- }
2075
- async function Oa(e, t, a) {
2076
- const o = () => import("./prepareMarkdown-DPMq7203.js").then((i) => i.b).then(({ prepareMarkdown: i }) => i(e, t)), n = Pa(e, a);
2077
- if (n === void 0) return o();
2078
- const c = H.get(n);
2079
- if (c)
2080
- return H.delete(n), H.set(n, c), c;
2081
- const r = o().catch((i) => {
2082
- throw H.get(n) === r && H.delete(n), i;
2083
- });
2084
- for (H.set(n, r); H.size > $a; ) {
2085
- const i = H.keys().next().value;
2086
- if (i === void 0) break;
2087
- H.delete(i);
2088
- }
2089
- return r;
2090
- }
2091
- function Ua({
2092
- source: e,
2093
- options: t,
2094
- onError: a,
2095
- onReady: o,
2096
- fallback: n = null,
2097
- retainPrevious: c = !1,
2098
- ...r
2099
- }) {
2100
- const i = le(() => Da(t), [t]), s = i ?? t ?? null, f = _(a);
2101
- f.current = a;
2102
- const b = _(o);
2103
- b.current = o;
2104
- const [d, y] = B({});
2105
- Z(() => {
2106
- let v = !0;
2107
- return c || y({ source: e, optionsIdentity: s }), Oa(e, t, i).then((C) => {
2108
- v && y({ source: e, optionsIdentity: s, prepared: C });
2109
- }).catch((C) => {
2110
- v && (f.current?.(C), c || y({ source: e, optionsIdentity: s }));
2111
- }), () => {
2112
- v = !1;
2113
- };
2114
- }, [e, s, c]);
2115
- const m = d.source === e && Object.is(d.optionsIdentity, s) && !!d.prepared;
2116
- return Z(() => {
2117
- m && b.current?.();
2118
- }, [m, d.prepared]), m ? d.prepared ? /* @__PURE__ */ l(Xe, { document: d.prepared.document, "data-cf-runtime": "react", ...r }) : n : c && d.prepared ? /* @__PURE__ */ l(Xe, { document: d.prepared.document, "data-cf-runtime": "react", ...r }) : n;
2119
- }
2120
- export {
2121
- I as D,
2122
- Ua as M,
2123
- za as a,
2124
- Xe as b,
2125
- Ga as c,
2126
- ta as s
2127
- };