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