@tomehq/theme 0.3.4 → 0.4.0

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 (76) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/chunk-2APCPR2Y.js +2110 -0
  3. package/dist/chunk-2AXAEADQ.js +2525 -0
  4. package/dist/chunk-2WNOJXK3.js +2581 -0
  5. package/dist/chunk-37JI6XGT.js +1720 -0
  6. package/dist/chunk-3A2LPGUL.js +1991 -0
  7. package/dist/chunk-3I2QTWTW.js +1948 -0
  8. package/dist/chunk-3I4SJMER.js +2538 -0
  9. package/dist/chunk-45M5UIAB.js +2110 -0
  10. package/dist/chunk-462AGU3S.js +1959 -0
  11. package/dist/chunk-5GVQFIPI.js +2581 -0
  12. package/dist/chunk-7MUTU5D4.js +1720 -0
  13. package/dist/chunk-7NQ4IMDY.js +2294 -0
  14. package/dist/chunk-ABNPB6BB.js +2133 -0
  15. package/dist/chunk-BZGWSKT2.js +573 -0
  16. package/dist/chunk-BZIB2LMI.js +2519 -0
  17. package/dist/chunk-CMQCNCSY.js +2127 -0
  18. package/dist/chunk-CTPOZMMK.js +1703 -0
  19. package/dist/chunk-DKSQZLWR.js +2569 -0
  20. package/dist/chunk-DO544M3G.js +1702 -0
  21. package/dist/chunk-DPKZBFQP.js +1777 -0
  22. package/dist/chunk-EK7PZUEB.js +2147 -0
  23. package/dist/chunk-FMOLIHQF.js +2182 -0
  24. package/dist/chunk-FWBTK5TL.js +1444 -0
  25. package/dist/chunk-GDQIBNX5.js +1962 -0
  26. package/dist/chunk-GHQ2MODM.js +2127 -0
  27. package/dist/chunk-GR2WCRGK.js +2182 -0
  28. package/dist/chunk-H5XZVNBW.js +2291 -0
  29. package/dist/chunk-HNLKDQ64.js +2139 -0
  30. package/dist/chunk-INUMUXN5.js +2095 -0
  31. package/dist/chunk-IW3NHNOQ.js +2187 -0
  32. package/dist/chunk-JA4PMX6M.js +1500 -0
  33. package/dist/chunk-JSPFS7G5.js +2102 -0
  34. package/dist/chunk-JZRT4WNC.js +1441 -0
  35. package/dist/chunk-KQBY2JDB.js +2112 -0
  36. package/dist/chunk-LIMYFTPC.js +1468 -0
  37. package/dist/chunk-LIY62BGC.js +2519 -0
  38. package/dist/chunk-MEP7P6A7.js +1500 -0
  39. package/dist/chunk-MHYKO7KM.js +2570 -0
  40. package/dist/chunk-MSXVVBDW.js +2542 -0
  41. package/dist/chunk-NOZBIES7.js +1948 -0
  42. package/dist/chunk-O4GH3KYX.js +1712 -0
  43. package/dist/chunk-OEDJTH5F.js +2569 -0
  44. package/dist/chunk-OEXM3BEC.js +1702 -0
  45. package/dist/chunk-PGKSFQ7A.js +2459 -0
  46. package/dist/chunk-PIV6CPY2.js +2395 -0
  47. package/dist/chunk-Q7PYTVW3.js +1771 -0
  48. package/dist/chunk-QCWZYABW.js +1468 -0
  49. package/dist/chunk-RDF25WB2.js +2085 -0
  50. package/dist/chunk-RKTT3ZEX.js +1500 -0
  51. package/dist/chunk-S47BRMNQ.js +1715 -0
  52. package/dist/chunk-S4ZH5F56.js +1949 -0
  53. package/dist/chunk-SRD7NJHS.js +1949 -0
  54. package/dist/chunk-SWFYJO5H.js +2187 -0
  55. package/dist/chunk-TQDWPSTO.js +2087 -0
  56. package/dist/chunk-TTRXRPP6.js +1941 -0
  57. package/dist/chunk-UKYFJSUA.js +509 -0
  58. package/dist/chunk-VKEQHP2E.js +2133 -0
  59. package/dist/chunk-VUT2FMSI.js +1937 -0
  60. package/dist/chunk-VVCC5JHK.js +1949 -0
  61. package/dist/chunk-W732TVBK.js +1944 -0
  62. package/dist/chunk-X4VQYPKO.js +1768 -0
  63. package/dist/chunk-YX7HV4EP.js +2568 -0
  64. package/dist/chunk-YXKONM3A.js +2192 -0
  65. package/dist/chunk-YZ3P3TNS.js +1760 -0
  66. package/dist/chunk-ZVZ7JN3V.js +2568 -0
  67. package/dist/chunk-ZXW4STTN.js +2568 -0
  68. package/dist/entry.js +1 -1
  69. package/dist/index.js +1 -1
  70. package/package.json +3 -3
  71. package/src/Shell.test.tsx +25 -0
  72. package/src/Shell.tsx +8 -8
  73. package/src/entry-helpers.test.ts +60 -12
  74. package/src/entry-helpers.ts +56 -30
  75. package/src/entry.test.tsx +208 -3
  76. package/src/entry.tsx +27 -4
@@ -0,0 +1,1500 @@
1
+ // src/entry.tsx
2
+ import { useState as useState3, useEffect as useEffect3, useCallback as useCallback3 } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+
5
+ // src/Shell.tsx
6
+ import { useState as useState2, useEffect as useEffect2, useRef as useRef2, useCallback as useCallback2 } from "react";
7
+
8
+ // src/presets.ts
9
+ var THEME_PRESETS = {
10
+ amber: {
11
+ dark: {
12
+ bg: "#09090b",
13
+ sf: "#111114",
14
+ sfH: "#18181c",
15
+ bd: "#1e1e24",
16
+ tx: "#e4e4e7",
17
+ tx2: "#a1a1aa",
18
+ txM: "#919199",
19
+ ac: "#e8a845",
20
+ acD: "rgba(232,168,69,0.12)",
21
+ acT: "#fbbf24",
22
+ cdBg: "#0c0c0f",
23
+ cdTx: "#c4c4cc",
24
+ sbBg: "#0c0c0e",
25
+ hdBg: "rgba(9,9,11,0.85)"
26
+ },
27
+ light: {
28
+ bg: "#fafaf9",
29
+ sf: "#ffffff",
30
+ sfH: "#f5f5f4",
31
+ bd: "#e7e5e4",
32
+ tx: "#1c1917",
33
+ tx2: "#57534e",
34
+ txM: "#706b66",
35
+ ac: "#96640a",
36
+ acD: "rgba(150,100,10,0.08)",
37
+ acT: "#7a5208",
38
+ cdBg: "#f5f3f0",
39
+ cdTx: "#2c2520",
40
+ sbBg: "#f5f5f3",
41
+ hdBg: "rgba(250,250,249,0.85)"
42
+ },
43
+ fonts: { heading: "Instrument Serif", body: "DM Sans", code: "JetBrains Mono" }
44
+ },
45
+ editorial: {
46
+ dark: {
47
+ bg: "#080c1f",
48
+ sf: "#0e1333",
49
+ sfH: "#141940",
50
+ bd: "#1a2050",
51
+ tx: "#e8e6f0",
52
+ tx2: "#b5b1c8",
53
+ txM: "#9490ae",
54
+ ac: "#ff6b4a",
55
+ acD: "rgba(255,107,74,0.1)",
56
+ acT: "#ff8a70",
57
+ cdBg: "#0a0e27",
58
+ cdTx: "#b8b4cc",
59
+ sbBg: "#0a0e27",
60
+ hdBg: "rgba(8,12,31,0.9)"
61
+ },
62
+ light: {
63
+ bg: "#f6f4f0",
64
+ sf: "#ffffff",
65
+ sfH: "#eeece6",
66
+ bd: "#ddd9d0",
67
+ tx: "#1a1716",
68
+ tx2: "#4a443e",
69
+ txM: "#706960",
70
+ ac: "#b83d22",
71
+ acD: "rgba(184,61,34,0.07)",
72
+ acT: "#9c3019",
73
+ cdBg: "#edeae4",
74
+ cdTx: "#3a3530",
75
+ sbBg: "#f0ede8",
76
+ hdBg: "rgba(246,244,240,0.92)"
77
+ },
78
+ fonts: { heading: "Cormorant Garamond", body: "Bricolage Grotesque", code: "Fira Code" }
79
+ }
80
+ };
81
+
82
+ // src/AiChat.tsx
83
+ import { useState, useRef, useEffect, useCallback } from "react";
84
+ import { jsx, jsxs } from "react/jsx-runtime";
85
+ var ChatIcon = () => /* @__PURE__ */ jsx(
86
+ "svg",
87
+ {
88
+ width: 22,
89
+ height: 22,
90
+ viewBox: "0 0 24 24",
91
+ fill: "none",
92
+ stroke: "currentColor",
93
+ strokeWidth: "1.5",
94
+ strokeLinecap: "round",
95
+ strokeLinejoin: "round",
96
+ children: /* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
97
+ }
98
+ );
99
+ var CloseIcon = () => /* @__PURE__ */ jsx(
100
+ "svg",
101
+ {
102
+ width: 18,
103
+ height: 18,
104
+ viewBox: "0 0 24 24",
105
+ fill: "none",
106
+ stroke: "currentColor",
107
+ strokeWidth: "1.5",
108
+ strokeLinecap: "round",
109
+ strokeLinejoin: "round",
110
+ children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
111
+ }
112
+ );
113
+ var SendIcon = () => /* @__PURE__ */ jsx(
114
+ "svg",
115
+ {
116
+ width: 16,
117
+ height: 16,
118
+ viewBox: "0 0 24 24",
119
+ fill: "none",
120
+ stroke: "currentColor",
121
+ strokeWidth: "2",
122
+ strokeLinecap: "round",
123
+ strokeLinejoin: "round",
124
+ children: /* @__PURE__ */ jsx("path", { d: "M22 2L11 13M22 2l-7 20-4-9-9-4z" })
125
+ }
126
+ );
127
+ function buildSystemPrompt(context) {
128
+ let prompt = "You are a helpful documentation assistant. Answer questions accurately based on the documentation provided below. If the answer isn't in the documentation, say so clearly. Keep answers concise and reference specific sections when possible.";
129
+ if (context) {
130
+ const trimmed = context.length > 1e5 ? context.slice(0, 1e5) + "\n\n[Documentation truncated...]" : context;
131
+ prompt += `
132
+
133
+ Documentation:
134
+ ${trimmed}`;
135
+ }
136
+ return prompt;
137
+ }
138
+ async function callOpenAI(messages, apiKey, model, context) {
139
+ const res = await fetch("https://api.openai.com/v1/chat/completions", {
140
+ method: "POST",
141
+ headers: {
142
+ "Content-Type": "application/json",
143
+ "Authorization": `Bearer ${apiKey}`
144
+ },
145
+ body: JSON.stringify({
146
+ model,
147
+ messages: [
148
+ { role: "system", content: buildSystemPrompt(context) },
149
+ ...messages.map((m) => ({ role: m.role, content: m.content }))
150
+ ]
151
+ })
152
+ });
153
+ if (!res.ok) {
154
+ const err = await res.text();
155
+ throw new Error(`OpenAI API error (${res.status}): ${err}`);
156
+ }
157
+ const data = await res.json();
158
+ return data.choices?.[0]?.message?.content || "No response.";
159
+ }
160
+ async function callAnthropic(messages, apiKey, model, context) {
161
+ const res = await fetch("https://api.anthropic.com/v1/messages", {
162
+ method: "POST",
163
+ headers: {
164
+ "Content-Type": "application/json",
165
+ "x-api-key": apiKey,
166
+ "anthropic-version": "2023-06-01",
167
+ "anthropic-dangerous-direct-browser-access": "true"
168
+ },
169
+ body: JSON.stringify({
170
+ model,
171
+ max_tokens: 1024,
172
+ system: buildSystemPrompt(context),
173
+ messages: messages.map((m) => ({ role: m.role, content: m.content }))
174
+ })
175
+ });
176
+ if (!res.ok) {
177
+ const err = await res.text();
178
+ throw new Error(`Anthropic API error (${res.status}): ${err}`);
179
+ }
180
+ const data = await res.json();
181
+ return data.content?.[0]?.text || "No response.";
182
+ }
183
+ function getDefaultModel(provider) {
184
+ if (provider === "openai") return "gpt-4o-mini";
185
+ return "claude-sonnet-4-20250514";
186
+ }
187
+ function AiChat({ provider, model, apiKey, context }) {
188
+ const [open, setOpen] = useState(false);
189
+ const [messages, setMessages] = useState([]);
190
+ const [input, setInput] = useState("");
191
+ const [loading, setLoading] = useState(false);
192
+ const [error, setError] = useState(null);
193
+ const messagesEndRef = useRef(null);
194
+ const inputRef = useRef(null);
195
+ const resolvedKey = apiKey || (typeof window !== "undefined" ? window.__TOME_AI_KEY__ : void 0);
196
+ const resolvedModel = model || getDefaultModel(provider);
197
+ useEffect(() => {
198
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
199
+ }, [messages]);
200
+ useEffect(() => {
201
+ if (open) {
202
+ setTimeout(() => inputRef.current?.focus(), 100);
203
+ }
204
+ }, [open]);
205
+ const sendMessage = useCallback(async () => {
206
+ const text = input.trim();
207
+ if (!text || loading) return;
208
+ if (!resolvedKey) return;
209
+ const userMsg = { role: "user", content: text };
210
+ const updatedMessages = [...messages, userMsg];
211
+ setMessages(updatedMessages);
212
+ setInput("");
213
+ setLoading(true);
214
+ setError(null);
215
+ try {
216
+ let response;
217
+ if (provider === "openai") {
218
+ response = await callOpenAI(updatedMessages, resolvedKey, resolvedModel, context);
219
+ } else {
220
+ response = await callAnthropic(updatedMessages, resolvedKey, resolvedModel, context);
221
+ }
222
+ setMessages((prev) => [...prev, { role: "assistant", content: response }]);
223
+ } catch (err) {
224
+ setError(err instanceof Error ? err.message : "Failed to get response");
225
+ } finally {
226
+ setLoading(false);
227
+ }
228
+ }, [input, loading, messages, provider, resolvedKey, resolvedModel, context]);
229
+ const handleKeyDown = useCallback(
230
+ (e) => {
231
+ if (e.key === "Enter" && !e.shiftKey) {
232
+ e.preventDefault();
233
+ sendMessage();
234
+ }
235
+ },
236
+ [sendMessage]
237
+ );
238
+ if (!open) {
239
+ return /* @__PURE__ */ jsx(
240
+ "button",
241
+ {
242
+ "data-testid": "ai-chat-button",
243
+ onClick: () => setOpen(true),
244
+ "aria-label": "Open AI chat",
245
+ style: {
246
+ position: "fixed",
247
+ bottom: 24,
248
+ right: 24,
249
+ zIndex: 900,
250
+ width: 48,
251
+ height: 48,
252
+ borderRadius: "50%",
253
+ background: "var(--ac)",
254
+ color: "#fff",
255
+ border: "none",
256
+ cursor: "pointer",
257
+ display: "flex",
258
+ alignItems: "center",
259
+ justifyContent: "center",
260
+ boxShadow: "0 4px 16px rgba(0,0,0,0.25)",
261
+ transition: "transform 0.15s"
262
+ },
263
+ children: /* @__PURE__ */ jsx(ChatIcon, {})
264
+ }
265
+ );
266
+ }
267
+ return /* @__PURE__ */ jsxs(
268
+ "div",
269
+ {
270
+ "data-testid": "ai-chat-panel",
271
+ style: {
272
+ position: "fixed",
273
+ bottom: 24,
274
+ right: 24,
275
+ zIndex: 900,
276
+ width: 380,
277
+ maxWidth: "calc(100vw - 48px)",
278
+ height: 520,
279
+ maxHeight: "calc(100vh - 48px)",
280
+ background: "var(--sf)",
281
+ border: "1px solid var(--bd)",
282
+ borderRadius: 12,
283
+ boxShadow: "0 16px 64px rgba(0,0,0,0.3)",
284
+ display: "flex",
285
+ flexDirection: "column",
286
+ overflow: "hidden",
287
+ fontFamily: "var(--font-body)"
288
+ },
289
+ children: [
290
+ /* @__PURE__ */ jsxs(
291
+ "div",
292
+ {
293
+ style: {
294
+ display: "flex",
295
+ alignItems: "center",
296
+ justifyContent: "space-between",
297
+ padding: "12px 16px",
298
+ borderBottom: "1px solid var(--bd)",
299
+ flexShrink: 0
300
+ },
301
+ children: [
302
+ /* @__PURE__ */ jsx(
303
+ "span",
304
+ {
305
+ style: {
306
+ fontSize: 14,
307
+ fontWeight: 600,
308
+ color: "var(--tx)"
309
+ },
310
+ children: "Ask AI"
311
+ }
312
+ ),
313
+ /* @__PURE__ */ jsx(
314
+ "button",
315
+ {
316
+ "data-testid": "ai-chat-close",
317
+ onClick: () => setOpen(false),
318
+ "aria-label": "Close AI chat",
319
+ style: {
320
+ background: "none",
321
+ border: "none",
322
+ color: "var(--txM)",
323
+ cursor: "pointer",
324
+ display: "flex",
325
+ padding: 4
326
+ },
327
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
328
+ }
329
+ )
330
+ ]
331
+ }
332
+ ),
333
+ /* @__PURE__ */ jsxs(
334
+ "div",
335
+ {
336
+ style: {
337
+ flex: 1,
338
+ overflow: "auto",
339
+ padding: "12px 16px"
340
+ },
341
+ children: [
342
+ !resolvedKey && /* @__PURE__ */ jsxs(
343
+ "div",
344
+ {
345
+ "data-testid": "ai-chat-no-key",
346
+ style: {
347
+ textAlign: "center",
348
+ color: "var(--txM)",
349
+ fontSize: 13,
350
+ padding: "24px 8px",
351
+ lineHeight: 1.6
352
+ },
353
+ children: [
354
+ /* @__PURE__ */ jsx("p", { style: { marginBottom: 8, fontWeight: 500, color: "var(--tx)" }, children: "AI not configured" }),
355
+ /* @__PURE__ */ jsxs("p", { style: { marginBottom: 8 }, children: [
356
+ "To enable AI chat, set the ",
357
+ /* @__PURE__ */ jsx("code", { style: {
358
+ fontFamily: "var(--font-code)",
359
+ fontSize: "0.88em",
360
+ background: "var(--cdBg)",
361
+ padding: "0.15em 0.4em",
362
+ borderRadius: 4
363
+ }, children: "apiKeyEnv" }),
364
+ " in ",
365
+ /* @__PURE__ */ jsx("code", { style: {
366
+ fontFamily: "var(--font-code)",
367
+ fontSize: "0.88em",
368
+ background: "var(--cdBg)",
369
+ padding: "0.15em 0.4em",
370
+ borderRadius: 4
371
+ }, children: "tome.config.js" }),
372
+ " and provide the environment variable at build time."
373
+ ] }),
374
+ /* @__PURE__ */ jsxs("p", { style: { fontSize: 11.5, color: "var(--txM)" }, children: [
375
+ "Example: ",
376
+ /* @__PURE__ */ jsx("code", { style: {
377
+ fontFamily: "var(--font-code)",
378
+ fontSize: "0.88em",
379
+ background: "var(--cdBg)",
380
+ padding: "0.15em 0.4em",
381
+ borderRadius: 4
382
+ }, children: "TOME_AI_KEY=sk-... tome build" })
383
+ ] })
384
+ ]
385
+ }
386
+ ),
387
+ messages.map((msg, i) => /* @__PURE__ */ jsx(
388
+ "div",
389
+ {
390
+ "data-testid": `ai-chat-message-${msg.role}`,
391
+ style: {
392
+ marginBottom: 12,
393
+ display: "flex",
394
+ justifyContent: msg.role === "user" ? "flex-end" : "flex-start"
395
+ },
396
+ children: /* @__PURE__ */ jsx(
397
+ "div",
398
+ {
399
+ style: {
400
+ maxWidth: "85%",
401
+ padding: "8px 12px",
402
+ borderRadius: 10,
403
+ fontSize: 13,
404
+ lineHeight: 1.55,
405
+ whiteSpace: "pre-wrap",
406
+ wordBreak: "break-word",
407
+ background: msg.role === "user" ? "var(--ac)" : "var(--cdBg)",
408
+ color: msg.role === "user" ? "#fff" : "var(--tx)"
409
+ },
410
+ children: msg.content
411
+ }
412
+ )
413
+ },
414
+ i
415
+ )),
416
+ loading && /* @__PURE__ */ jsx(
417
+ "div",
418
+ {
419
+ "data-testid": "ai-chat-loading",
420
+ style: {
421
+ display: "flex",
422
+ justifyContent: "flex-start",
423
+ marginBottom: 12
424
+ },
425
+ children: /* @__PURE__ */ jsx(
426
+ "div",
427
+ {
428
+ style: {
429
+ padding: "8px 12px",
430
+ borderRadius: 10,
431
+ fontSize: 13,
432
+ background: "var(--cdBg)",
433
+ color: "var(--txM)"
434
+ },
435
+ children: "Thinking..."
436
+ }
437
+ )
438
+ }
439
+ ),
440
+ error && /* @__PURE__ */ jsx(
441
+ "div",
442
+ {
443
+ "data-testid": "ai-chat-error",
444
+ style: {
445
+ padding: "8px 12px",
446
+ borderRadius: 8,
447
+ fontSize: 12,
448
+ background: "rgba(220,50,50,0.1)",
449
+ color: "#d44",
450
+ marginBottom: 12
451
+ },
452
+ children: error
453
+ }
454
+ ),
455
+ /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
456
+ ]
457
+ }
458
+ ),
459
+ /* @__PURE__ */ jsxs(
460
+ "div",
461
+ {
462
+ style: {
463
+ display: "flex",
464
+ alignItems: "center",
465
+ gap: 8,
466
+ padding: "10px 12px",
467
+ borderTop: "1px solid var(--bd)",
468
+ flexShrink: 0
469
+ },
470
+ children: [
471
+ /* @__PURE__ */ jsx(
472
+ "input",
473
+ {
474
+ ref: inputRef,
475
+ "data-testid": "ai-chat-input",
476
+ value: input,
477
+ onChange: (e) => setInput(e.target.value),
478
+ onKeyDown: handleKeyDown,
479
+ placeholder: resolvedKey ? "Ask a question..." : "API key required",
480
+ disabled: !resolvedKey,
481
+ style: {
482
+ flex: 1,
483
+ background: "var(--cdBg)",
484
+ border: "1px solid var(--bd)",
485
+ borderRadius: 8,
486
+ padding: "8px 12px",
487
+ color: "var(--tx)",
488
+ fontSize: 13,
489
+ fontFamily: "var(--font-body)",
490
+ outline: "none"
491
+ }
492
+ }
493
+ ),
494
+ /* @__PURE__ */ jsx(
495
+ "button",
496
+ {
497
+ "data-testid": "ai-chat-send",
498
+ onClick: sendMessage,
499
+ disabled: !resolvedKey || !input.trim() || loading,
500
+ "aria-label": "Send message",
501
+ style: {
502
+ width: 34,
503
+ height: 34,
504
+ borderRadius: 8,
505
+ background: resolvedKey && input.trim() ? "var(--ac)" : "var(--cdBg)",
506
+ color: resolvedKey && input.trim() ? "#fff" : "var(--txM)",
507
+ border: "none",
508
+ cursor: resolvedKey && input.trim() ? "pointer" : "default",
509
+ display: "flex",
510
+ alignItems: "center",
511
+ justifyContent: "center",
512
+ flexShrink: 0
513
+ },
514
+ children: /* @__PURE__ */ jsx(SendIcon, {})
515
+ }
516
+ )
517
+ ]
518
+ }
519
+ )
520
+ ]
521
+ }
522
+ );
523
+ }
524
+
525
+ // src/Shell.tsx
526
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
527
+ function hexToRgb(hex) {
528
+ const m = /^#([0-9a-f]{6})$/i.exec(hex.trim());
529
+ if (!m) return null;
530
+ const n = parseInt(m[1], 16);
531
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
532
+ }
533
+ function buildAccentOverride(hex, isDark) {
534
+ const rgb = hexToRgb(hex);
535
+ if (!rgb) return null;
536
+ const [r, g, b] = rgb;
537
+ const acD = `rgba(${r},${g},${b},${isDark ? 0.12 : 0.08})`;
538
+ const factor = isDark ? 1.15 : 0.85;
539
+ const tr = Math.min(255, Math.round(r * factor));
540
+ const tg = Math.min(255, Math.round(g * factor));
541
+ const tb = Math.min(255, Math.round(b * factor));
542
+ const acT = `rgb(${tr},${tg},${tb})`;
543
+ return { ac: hex, acD, acT };
544
+ }
545
+ var Icon = ({ d, size = 16 }) => /* @__PURE__ */ jsx2(
546
+ "svg",
547
+ {
548
+ width: size,
549
+ height: size,
550
+ viewBox: "0 0 24 24",
551
+ fill: "none",
552
+ stroke: "currentColor",
553
+ strokeWidth: "1.5",
554
+ strokeLinecap: "round",
555
+ strokeLinejoin: "round",
556
+ children: /* @__PURE__ */ jsx2("path", { d })
557
+ }
558
+ );
559
+ var SearchIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3" });
560
+ var ChevRight = () => /* @__PURE__ */ jsx2(Icon, { d: "M9 18l6-6-6-6", size: 14 });
561
+ var ChevDown = () => /* @__PURE__ */ jsx2(Icon, { d: "M6 9l6 6 6-6", size: 14 });
562
+ var MenuIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M3 12h18M3 6h18M3 18h18", size: 20 });
563
+ var XIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M18 6L6 18M6 6l12 12", size: 18 });
564
+ var MoonIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" });
565
+ var SunIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10Z" });
566
+ var ArrowLeft = () => /* @__PURE__ */ jsx2(Icon, { d: "M19 12H5M12 19l-7-7 7-7", size: 14 });
567
+ var ArrowRight = () => /* @__PURE__ */ jsx2(Icon, { d: "M5 12h14M12 5l7 7-7 7", size: 14 });
568
+ var pagefindInstance = null;
569
+ var PAGEFIND_PATH = "/_pagefind/pagefind.js";
570
+ async function initPagefind() {
571
+ if (pagefindInstance) return pagefindInstance;
572
+ try {
573
+ pagefindInstance = await import(
574
+ /* @vite-ignore */
575
+ PAGEFIND_PATH
576
+ );
577
+ await pagefindInstance.init();
578
+ return pagefindInstance;
579
+ } catch {
580
+ return null;
581
+ }
582
+ }
583
+ var docSearchLoaded = null;
584
+ function loadDocSearch() {
585
+ if (docSearchLoaded) return docSearchLoaded;
586
+ docSearchLoaded = import("@docsearch/react").catch(() => null);
587
+ return docSearchLoaded;
588
+ }
589
+ function AlgoliaSearchModal({
590
+ appId,
591
+ apiKey,
592
+ indexName,
593
+ onNavigate,
594
+ onClose
595
+ }) {
596
+ const [DocSearchComponent, setDocSearchComponent] = useState2(null);
597
+ const [loadFailed, setLoadFailed] = useState2(false);
598
+ useEffect2(() => {
599
+ loadDocSearch().then((mod) => {
600
+ if (mod && mod.DocSearch) {
601
+ setDocSearchComponent(() => mod.DocSearch);
602
+ } else if (mod && mod.default) {
603
+ setDocSearchComponent(() => mod.default);
604
+ } else {
605
+ setLoadFailed(true);
606
+ }
607
+ });
608
+ }, []);
609
+ const extractPageId = useCallback2((url) => {
610
+ try {
611
+ const parsed = new URL(url, "http://localhost");
612
+ const pathname = parsed.pathname;
613
+ return pathname.replace(/^\//, "").replace(/\/index\.html$/, "").replace(/\.html$/, "") || "index";
614
+ } catch {
615
+ return "index";
616
+ }
617
+ }, []);
618
+ if (loadFailed) {
619
+ return /* @__PURE__ */ jsx2("div", { onClick: onClose, style: {
620
+ position: "fixed",
621
+ inset: 0,
622
+ zIndex: 1e3,
623
+ background: "rgba(0,0,0,0.55)",
624
+ backdropFilter: "blur(6px)",
625
+ display: "flex",
626
+ alignItems: "flex-start",
627
+ justifyContent: "center",
628
+ paddingTop: "12vh"
629
+ }, children: /* @__PURE__ */ jsx2("div", { onClick: (e) => e.stopPropagation(), style: {
630
+ background: "var(--sf)",
631
+ border: "1px solid var(--bd)",
632
+ borderRadius: 12,
633
+ width: "100%",
634
+ maxWidth: 520,
635
+ boxShadow: "0 24px 80px rgba(0,0,0,0.4)",
636
+ padding: "32px 18px",
637
+ textAlign: "center",
638
+ color: "var(--txM)",
639
+ fontSize: 14
640
+ }, children: "Algolia DocSearch is not available. Install @docsearch/react to enable it." }) });
641
+ }
642
+ if (!DocSearchComponent) {
643
+ return /* @__PURE__ */ jsx2("div", { onClick: onClose, style: {
644
+ position: "fixed",
645
+ inset: 0,
646
+ zIndex: 1e3,
647
+ background: "rgba(0,0,0,0.55)",
648
+ backdropFilter: "blur(6px)",
649
+ display: "flex",
650
+ alignItems: "flex-start",
651
+ justifyContent: "center",
652
+ paddingTop: "12vh"
653
+ }, children: /* @__PURE__ */ jsx2("div", { style: {
654
+ background: "var(--sf)",
655
+ border: "1px solid var(--bd)",
656
+ borderRadius: 12,
657
+ width: "100%",
658
+ maxWidth: 520,
659
+ boxShadow: "0 24px 80px rgba(0,0,0,0.4)",
660
+ padding: "32px 18px",
661
+ textAlign: "center",
662
+ color: "var(--txM)",
663
+ fontSize: 14
664
+ }, children: "Loading search..." }) });
665
+ }
666
+ return /* @__PURE__ */ jsx2("div", { "data-testid": "algolia-search-modal", children: /* @__PURE__ */ jsx2(
667
+ DocSearchComponent,
668
+ {
669
+ appId,
670
+ apiKey,
671
+ indexName,
672
+ navigator: {
673
+ navigate({ itemUrl }) {
674
+ const pageId = extractPageId(itemUrl);
675
+ onNavigate(pageId);
676
+ }
677
+ },
678
+ hitComponent: ({ hit, children }) => /* @__PURE__ */ jsx2("a", { href: hit.url, onClick: (e) => {
679
+ e.preventDefault();
680
+ const pageId = extractPageId(hit.url);
681
+ onNavigate(pageId);
682
+ }, children })
683
+ }
684
+ ) });
685
+ }
686
+ var VersionIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M12 8v4l3 3m6-3a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z", size: 14 });
687
+ var GlobeIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM3.6 9h16.8M3.6 15h16.8M12 3a15 15 0 0 1 4 9 15 15 0 0 1-4 9 15 15 0 0 1-4-9 15 15 0 0 1 4-9Z", size: 14 });
688
+ var ExtLinkIcon = () => /* @__PURE__ */ jsx2(Icon, { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3", size: 11 });
689
+ function Shell({
690
+ config: config2,
691
+ navigation: navigation2,
692
+ currentPageId,
693
+ pageHtml,
694
+ pageComponent,
695
+ mdxComponents,
696
+ pageTitle,
697
+ pageDescription,
698
+ headings,
699
+ onNavigate,
700
+ allPages,
701
+ versioning,
702
+ currentVersion,
703
+ i18n,
704
+ currentLocale,
705
+ docContext: docContext2
706
+ }) {
707
+ const themeMode = config2.theme?.mode || "auto";
708
+ const [isDark, setDark] = useState2(() => {
709
+ if (themeMode === "dark") return true;
710
+ if (themeMode === "light") return false;
711
+ return window.matchMedia?.("(prefers-color-scheme: dark)").matches ?? true;
712
+ });
713
+ const [sbOpen, setSb] = useState2(true);
714
+ const [searchOpen, setSearch] = useState2(false);
715
+ const [versionDropdownOpen, setVersionDropdown] = useState2(false);
716
+ const [localeDropdownOpen, setLocaleDropdown] = useState2(false);
717
+ const isOldVersion = versioning && currentVersion && currentVersion !== versioning.current;
718
+ const [expanded, setExpanded] = useState2(navigation2.map((n) => n.section));
719
+ const contentRef = useRef2(null);
720
+ const [wide, setWide] = useState2(true);
721
+ const preset = config2.theme?.preset || "amber";
722
+ const baseTokens = THEME_PRESETS[preset]?.[isDark ? "dark" : "light"] || THEME_PRESETS.amber.dark;
723
+ const accentOverride = config2.theme?.accent ? buildAccentOverride(config2.theme.accent, isDark) : null;
724
+ const t = accentOverride ? { ...baseTokens, ...accentOverride } : baseTokens;
725
+ const presetFonts = THEME_PRESETS[preset]?.fonts || THEME_PRESETS.amber.fonts;
726
+ const fonts = {
727
+ heading: config2.theme?.fonts?.heading || presetFonts.heading,
728
+ body: config2.theme?.fonts?.body || presetFonts.body,
729
+ code: config2.theme?.fonts?.code || presetFonts.code
730
+ };
731
+ useEffect2(() => {
732
+ if (themeMode !== "auto") return;
733
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
734
+ const handler = (e) => setDark(e.matches);
735
+ mq.addEventListener("change", handler);
736
+ return () => mq.removeEventListener("change", handler);
737
+ }, [themeMode]);
738
+ useEffect2(() => {
739
+ const c = () => setWide(window.innerWidth > 1100);
740
+ c();
741
+ window.addEventListener("resize", c);
742
+ return () => window.removeEventListener("resize", c);
743
+ }, []);
744
+ useEffect2(() => {
745
+ contentRef.current?.scrollTo(0, 0);
746
+ }, [currentPageId]);
747
+ useEffect2(() => {
748
+ const h = (e) => {
749
+ if ((e.metaKey || e.ctrlKey) && e.key === "k") {
750
+ e.preventDefault();
751
+ setSearch(true);
752
+ }
753
+ if (e.key === "Escape") setSearch(false);
754
+ };
755
+ window.addEventListener("keydown", h);
756
+ return () => window.removeEventListener("keydown", h);
757
+ }, []);
758
+ const allNavPages = navigation2.flatMap((g) => g.pages);
759
+ const idx = allNavPages.findIndex((p) => p.id === currentPageId);
760
+ const prev = idx > 0 ? allNavPages[idx - 1] : null;
761
+ const next = idx < allNavPages.length - 1 ? allNavPages[idx + 1] : null;
762
+ const togSec = (s) => setExpanded((p) => p.includes(s) ? p.filter((x) => x !== s) : [...p, s]);
763
+ const cssVars = {
764
+ "--bg": t.bg,
765
+ "--sf": t.sf,
766
+ "--sfH": t.sfH,
767
+ "--bd": t.bd,
768
+ "--tx": t.tx,
769
+ "--tx2": t.tx2,
770
+ "--txM": t.txM,
771
+ "--ac": t.ac,
772
+ "--acD": t.acD,
773
+ "--acT": t.acT,
774
+ "--cdBg": t.cdBg,
775
+ "--cdTx": t.cdTx,
776
+ "--sbBg": t.sbBg,
777
+ "--hdBg": t.hdBg,
778
+ "--font-heading": `"${fonts.heading}", serif`,
779
+ "--font-body": `"${fonts.body}", sans-serif`,
780
+ "--font-code": `"${fonts.code}", monospace`
781
+ };
782
+ const PageComponent = pageComponent;
783
+ return /* @__PURE__ */ jsxs2("div", { className: "tome-grain", style: { ...cssVars, color: "var(--tx)", background: "var(--bg)", fontFamily: "var(--font-body)", minHeight: "100vh" }, children: [
784
+ searchOpen && config2.search?.provider === "algolia" && config2.search.appId && config2.search.apiKey && config2.search.indexName ? /* @__PURE__ */ jsx2(
785
+ AlgoliaSearchModal,
786
+ {
787
+ appId: config2.search.appId,
788
+ apiKey: config2.search.apiKey,
789
+ indexName: config2.search.indexName,
790
+ onNavigate: (id) => {
791
+ onNavigate(id);
792
+ setSearch(false);
793
+ },
794
+ onClose: () => setSearch(false)
795
+ }
796
+ ) : searchOpen ? /* @__PURE__ */ jsx2(
797
+ SearchModal,
798
+ {
799
+ allPages,
800
+ onNavigate: (id) => {
801
+ onNavigate(id);
802
+ setSearch(false);
803
+ },
804
+ onClose: () => setSearch(false)
805
+ }
806
+ ) : null,
807
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", height: "100vh" }, children: [
808
+ /* @__PURE__ */ jsxs2("aside", { style: {
809
+ width: sbOpen ? 270 : 0,
810
+ minWidth: sbOpen ? 270 : 0,
811
+ background: "var(--sbBg)",
812
+ borderRight: "1px solid var(--bd)",
813
+ display: "flex",
814
+ flexDirection: "column",
815
+ transition: "width .2s, min-width .2s",
816
+ overflow: "hidden"
817
+ }, children: [
818
+ /* @__PURE__ */ jsxs2("div", { style: { padding: "18px 20px", display: "flex", alignItems: "baseline", gap: 6, borderBottom: "1px solid var(--bd)" }, children: [
819
+ /* @__PURE__ */ jsx2("span", { style: { fontFamily: "var(--font-heading)", fontSize: 22, fontWeight: 700, fontStyle: "italic" }, children: config2.name }),
820
+ /* @__PURE__ */ jsx2("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "var(--ac)", display: "inline-block" } })
821
+ ] }),
822
+ /* @__PURE__ */ jsx2("div", { style: { padding: "12px 14px" }, children: /* @__PURE__ */ jsxs2("button", { onClick: () => setSearch(true), style: {
823
+ display: "flex",
824
+ alignItems: "center",
825
+ gap: 8,
826
+ width: "100%",
827
+ background: "var(--cdBg)",
828
+ border: "1px solid var(--bd)",
829
+ borderRadius: 2,
830
+ padding: "8px 12px",
831
+ cursor: "pointer",
832
+ color: "var(--txM)",
833
+ fontSize: 12.5,
834
+ fontFamily: "var(--font-body)"
835
+ }, children: [
836
+ /* @__PURE__ */ jsx2(SearchIcon, {}),
837
+ /* @__PURE__ */ jsx2("span", { style: { flex: 1, textAlign: "left" }, children: "Search..." }),
838
+ /* @__PURE__ */ jsx2("kbd", { style: { fontFamily: "var(--font-code)", fontSize: 9, background: "var(--sf)", border: "1px solid var(--bd)", borderRadius: 2, padding: "2px 6px" }, children: "\u2318K" })
839
+ ] }) }),
840
+ /* @__PURE__ */ jsx2("nav", { style: { flex: 1, overflow: "auto", padding: "4px 10px 20px" }, children: navigation2.map((sec) => /* @__PURE__ */ jsxs2("div", { style: { marginBottom: 8 }, children: [
841
+ /* @__PURE__ */ jsxs2("button", { onClick: () => togSec(sec.section), style: {
842
+ display: "flex",
843
+ alignItems: "center",
844
+ gap: 6,
845
+ width: "100%",
846
+ background: "none",
847
+ border: "none",
848
+ padding: "8px 10px",
849
+ cursor: "pointer",
850
+ borderRadius: 2,
851
+ color: "var(--txM)",
852
+ fontSize: 10,
853
+ fontWeight: 600,
854
+ textTransform: "uppercase",
855
+ letterSpacing: ".1em",
856
+ fontFamily: "var(--font-code)"
857
+ }, children: [
858
+ expanded.includes(sec.section) ? /* @__PURE__ */ jsx2(ChevDown, {}) : /* @__PURE__ */ jsx2(ChevRight, {}),
859
+ sec.section
860
+ ] }),
861
+ expanded.includes(sec.section) && /* @__PURE__ */ jsx2("div", { style: { marginLeft: 8, borderLeft: "1px solid var(--bd)", paddingLeft: 0 }, children: sec.pages.map((p) => {
862
+ const active = currentPageId === p.id;
863
+ return /* @__PURE__ */ jsx2("button", { onClick: () => onNavigate(p.id), style: {
864
+ display: "flex",
865
+ alignItems: "center",
866
+ gap: 10,
867
+ width: "100%",
868
+ textAlign: "left",
869
+ background: "none",
870
+ border: "none",
871
+ borderRadius: 0,
872
+ borderLeft: active ? "2px solid var(--ac)" : "2px solid transparent",
873
+ padding: "7px 14px",
874
+ cursor: "pointer",
875
+ color: active ? "var(--ac)" : "var(--tx2)",
876
+ fontSize: 13,
877
+ fontWeight: active ? 500 : 400,
878
+ fontFamily: "var(--font-body)",
879
+ transition: "all .12s"
880
+ }, children: p.title }, p.id);
881
+ }) })
882
+ ] }, sec.section)) }),
883
+ /* @__PURE__ */ jsxs2("div", { style: { padding: "12px 16px", borderTop: "1px solid var(--bd)", display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
884
+ themeMode === "auto" ? /* @__PURE__ */ jsx2("button", { onClick: () => setDark((d) => !d), style: { background: "none", border: "none", color: "var(--txM)", cursor: "pointer", display: "flex" }, children: isDark ? /* @__PURE__ */ jsx2(SunIcon, {}) : /* @__PURE__ */ jsx2(MoonIcon, {}) }) : /* @__PURE__ */ jsx2("div", {}),
885
+ /* @__PURE__ */ jsx2("span", { style: { fontFamily: "var(--font-code)", fontSize: 10, color: "var(--txM)" }, children: "v0.1.0" })
886
+ ] })
887
+ ] }),
888
+ /* @__PURE__ */ jsxs2("div", { style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
889
+ /* @__PURE__ */ jsxs2("header", { style: {
890
+ display: "flex",
891
+ alignItems: "center",
892
+ gap: 12,
893
+ padding: "10px 24px",
894
+ borderBottom: "1px solid var(--bd)",
895
+ background: "var(--hdBg)",
896
+ backdropFilter: "blur(12px)"
897
+ }, children: [
898
+ /* @__PURE__ */ jsx2("button", { onClick: () => setSb(!sbOpen), style: { background: "none", border: "none", color: "var(--txM)", cursor: "pointer", display: "flex" }, children: sbOpen ? /* @__PURE__ */ jsx2(XIcon, {}) : /* @__PURE__ */ jsx2(MenuIcon, {}) }),
899
+ /* @__PURE__ */ jsx2("div", { style: { display: "flex", alignItems: "center", gap: 8, fontFamily: "var(--font-code)", fontSize: 11, color: "var(--txM)", letterSpacing: ".03em", flex: 1 }, children: navigation2.map((s) => {
900
+ const f = s.pages.find((p) => p.id === currentPageId);
901
+ if (!f) return null;
902
+ return /* @__PURE__ */ jsxs2("span", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
903
+ /* @__PURE__ */ jsx2("span", { children: s.section }),
904
+ /* @__PURE__ */ jsx2(ChevRight, {}),
905
+ /* @__PURE__ */ jsx2("span", { style: { color: "var(--ac)" }, children: f.title })
906
+ ] }, s.section);
907
+ }) }),
908
+ config2.topNav && config2.topNav.length > 0 && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
909
+ config2.topNav.map((link) => {
910
+ const isExternal = link.href.startsWith("http") || !link.href.startsWith("#");
911
+ return /* @__PURE__ */ jsxs2(
912
+ "a",
913
+ {
914
+ href: link.href,
915
+ ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {},
916
+ style: {
917
+ display: "flex",
918
+ alignItems: "center",
919
+ gap: 4,
920
+ color: "var(--txM)",
921
+ textDecoration: "none",
922
+ fontSize: 12,
923
+ fontFamily: "var(--font-body)",
924
+ fontWeight: 500,
925
+ transition: "color .15s"
926
+ },
927
+ onMouseOver: (e) => e.currentTarget.style.color = "var(--ac)",
928
+ onMouseOut: (e) => e.currentTarget.style.color = "var(--txM)",
929
+ children: [
930
+ link.label,
931
+ isExternal && /* @__PURE__ */ jsx2(ExtLinkIcon, {})
932
+ ]
933
+ },
934
+ link.label
935
+ );
936
+ }),
937
+ /* @__PURE__ */ jsx2("span", { style: { width: 1, height: 16, background: "var(--bd)" } })
938
+ ] }),
939
+ versioning && /* @__PURE__ */ jsxs2("div", { style: { position: "relative" }, children: [
940
+ /* @__PURE__ */ jsxs2(
941
+ "button",
942
+ {
943
+ "data-testid": "version-switcher",
944
+ onClick: () => setVersionDropdown((o) => !o),
945
+ style: {
946
+ display: "flex",
947
+ alignItems: "center",
948
+ gap: 6,
949
+ background: "var(--sf)",
950
+ border: "1px solid var(--bd)",
951
+ borderRadius: 2,
952
+ padding: "5px 10px",
953
+ cursor: "pointer",
954
+ color: "var(--tx2)",
955
+ fontSize: 12,
956
+ fontFamily: "var(--font-code)"
957
+ },
958
+ children: [
959
+ /* @__PURE__ */ jsx2(VersionIcon, {}),
960
+ currentVersion || versioning.current,
961
+ /* @__PURE__ */ jsx2(ChevDown, {})
962
+ ]
963
+ }
964
+ ),
965
+ versionDropdownOpen && /* @__PURE__ */ jsx2(
966
+ "div",
967
+ {
968
+ "data-testid": "version-dropdown",
969
+ style: {
970
+ position: "absolute",
971
+ top: "100%",
972
+ right: 0,
973
+ marginTop: 4,
974
+ background: "var(--sf)",
975
+ border: "1px solid var(--bd)",
976
+ borderRadius: 2,
977
+ boxShadow: "0 8px 32px rgba(0,0,0,0.2)",
978
+ overflow: "hidden",
979
+ zIndex: 100,
980
+ minWidth: 120
981
+ },
982
+ children: versioning.versions.map((v) => /* @__PURE__ */ jsxs2(
983
+ "button",
984
+ {
985
+ onClick: () => {
986
+ setVersionDropdown(false);
987
+ const targetUrl = v === versioning.current ? "/" : `/${v}`;
988
+ window.location.href = targetUrl;
989
+ },
990
+ style: {
991
+ display: "block",
992
+ width: "100%",
993
+ textAlign: "left",
994
+ background: v === (currentVersion || versioning.current) ? "var(--acD)" : "none",
995
+ border: "none",
996
+ padding: "8px 14px",
997
+ cursor: "pointer",
998
+ color: v === (currentVersion || versioning.current) ? "var(--ac)" : "var(--tx2)",
999
+ fontSize: 12,
1000
+ fontFamily: "var(--font-code)",
1001
+ fontWeight: v === versioning.current ? 600 : 400
1002
+ },
1003
+ children: [
1004
+ v,
1005
+ v === versioning.current ? " (latest)" : ""
1006
+ ]
1007
+ },
1008
+ v
1009
+ ))
1010
+ }
1011
+ )
1012
+ ] }),
1013
+ i18n && i18n.locales.length > 1 && /* @__PURE__ */ jsxs2("div", { style: { position: "relative" }, children: [
1014
+ /* @__PURE__ */ jsxs2(
1015
+ "button",
1016
+ {
1017
+ "data-testid": "language-switcher",
1018
+ onClick: () => setLocaleDropdown((o) => !o),
1019
+ style: {
1020
+ display: "flex",
1021
+ alignItems: "center",
1022
+ gap: 6,
1023
+ background: "var(--sf)",
1024
+ border: "1px solid var(--bd)",
1025
+ borderRadius: 2,
1026
+ padding: "5px 10px",
1027
+ cursor: "pointer",
1028
+ color: "var(--tx2)",
1029
+ fontSize: 12,
1030
+ fontFamily: "var(--font-body)"
1031
+ },
1032
+ children: [
1033
+ /* @__PURE__ */ jsx2(GlobeIcon, {}),
1034
+ i18n.localeNames?.[currentLocale || i18n.defaultLocale] || currentLocale || i18n.defaultLocale,
1035
+ /* @__PURE__ */ jsx2(ChevDown, {})
1036
+ ]
1037
+ }
1038
+ ),
1039
+ localeDropdownOpen && /* @__PURE__ */ jsx2(
1040
+ "div",
1041
+ {
1042
+ "data-testid": "language-dropdown",
1043
+ style: {
1044
+ position: "absolute",
1045
+ top: "100%",
1046
+ right: 0,
1047
+ marginTop: 4,
1048
+ background: "var(--sf)",
1049
+ border: "1px solid var(--bd)",
1050
+ borderRadius: 2,
1051
+ boxShadow: "0 8px 32px rgba(0,0,0,0.2)",
1052
+ overflow: "hidden",
1053
+ zIndex: 100,
1054
+ minWidth: 120
1055
+ },
1056
+ children: i18n.locales.map((locale) => {
1057
+ const isActive = locale === (currentLocale || i18n.defaultLocale);
1058
+ const displayName = i18n.localeNames?.[locale] || locale;
1059
+ const activeLocale = currentLocale || i18n.defaultLocale;
1060
+ let basePageId = currentPageId;
1061
+ if (activeLocale !== i18n.defaultLocale && currentPageId.startsWith(`${activeLocale}/`)) {
1062
+ basePageId = currentPageId.slice(activeLocale.length + 1);
1063
+ }
1064
+ const targetId = locale === i18n.defaultLocale ? basePageId : `${locale}/${basePageId}`;
1065
+ return /* @__PURE__ */ jsx2(
1066
+ "button",
1067
+ {
1068
+ onClick: () => {
1069
+ setLocaleDropdown(false);
1070
+ onNavigate(targetId);
1071
+ },
1072
+ style: {
1073
+ display: "block",
1074
+ width: "100%",
1075
+ textAlign: "left",
1076
+ background: isActive ? "var(--acD)" : "none",
1077
+ border: "none",
1078
+ padding: "8px 14px",
1079
+ cursor: "pointer",
1080
+ color: isActive ? "var(--ac)" : "var(--tx2)",
1081
+ fontSize: 12,
1082
+ fontFamily: "var(--font-body)",
1083
+ fontWeight: isActive ? 600 : 400
1084
+ },
1085
+ children: displayName
1086
+ },
1087
+ locale
1088
+ );
1089
+ })
1090
+ }
1091
+ )
1092
+ ] })
1093
+ ] }),
1094
+ isOldVersion && /* @__PURE__ */ jsxs2(
1095
+ "div",
1096
+ {
1097
+ "data-testid": "old-version-banner",
1098
+ style: {
1099
+ display: "flex",
1100
+ alignItems: "center",
1101
+ justifyContent: "center",
1102
+ gap: 8,
1103
+ background: "var(--acD)",
1104
+ borderBottom: "1px solid var(--bd)",
1105
+ padding: "8px 24px",
1106
+ fontSize: 13,
1107
+ color: "var(--tx2)"
1108
+ },
1109
+ children: [
1110
+ /* @__PURE__ */ jsxs2("span", { children: [
1111
+ "You're viewing docs for ",
1112
+ currentVersion,
1113
+ "."
1114
+ ] }),
1115
+ /* @__PURE__ */ jsx2(
1116
+ "button",
1117
+ {
1118
+ onClick: () => {
1119
+ window.location.href = "/";
1120
+ },
1121
+ style: {
1122
+ background: "none",
1123
+ border: "none",
1124
+ color: "var(--ac)",
1125
+ cursor: "pointer",
1126
+ fontWeight: 600,
1127
+ fontSize: 13,
1128
+ fontFamily: "var(--font-body)",
1129
+ textDecoration: "underline"
1130
+ },
1131
+ children: "Switch to latest."
1132
+ }
1133
+ )
1134
+ ]
1135
+ }
1136
+ ),
1137
+ /* @__PURE__ */ jsxs2("div", { ref: contentRef, style: { flex: 1, overflow: "auto", display: "flex" }, children: [
1138
+ /* @__PURE__ */ jsxs2("main", { style: { flex: 1, maxWidth: 760, padding: "40px 48px 80px", margin: "0 auto" }, children: [
1139
+ /* @__PURE__ */ jsx2("h1", { style: { fontFamily: "var(--font-heading)", fontSize: 38, fontWeight: 400, fontStyle: "italic", lineHeight: 1.15, marginBottom: 8 }, children: pageTitle }),
1140
+ pageDescription && /* @__PURE__ */ jsx2("p", { style: { fontSize: 16, color: "var(--tx2)", lineHeight: 1.6, marginBottom: 32 }, children: pageDescription }),
1141
+ /* @__PURE__ */ jsx2("div", { style: { borderTop: "1px solid var(--bd)", paddingTop: 28 }, children: PageComponent ? /* @__PURE__ */ jsx2("div", { className: "tome-content", children: /* @__PURE__ */ jsx2(PageComponent, { components: mdxComponents || {} }) }) : /* @__PURE__ */ jsx2(
1142
+ "div",
1143
+ {
1144
+ className: "tome-content",
1145
+ dangerouslySetInnerHTML: { __html: pageHtml || "" }
1146
+ }
1147
+ ) }),
1148
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 48, paddingTop: 24, borderTop: "1px solid var(--bd)", gap: 16 }, children: [
1149
+ prev ? /* @__PURE__ */ jsxs2("button", { onClick: () => onNavigate(prev.id), style: {
1150
+ display: "flex",
1151
+ alignItems: "center",
1152
+ gap: 8,
1153
+ background: "none",
1154
+ border: "1px solid var(--bd)",
1155
+ borderRadius: 2,
1156
+ padding: "10px 16px",
1157
+ cursor: "pointer",
1158
+ color: "var(--tx2)",
1159
+ fontSize: 13,
1160
+ fontFamily: "var(--font-body)",
1161
+ transition: "border-color .15s, color .15s"
1162
+ }, children: [
1163
+ /* @__PURE__ */ jsx2(ArrowLeft, {}),
1164
+ " ",
1165
+ prev.title
1166
+ ] }) : /* @__PURE__ */ jsx2("div", {}),
1167
+ next ? /* @__PURE__ */ jsxs2("button", { onClick: () => onNavigate(next.id), style: {
1168
+ display: "flex",
1169
+ alignItems: "center",
1170
+ gap: 8,
1171
+ background: "none",
1172
+ border: "1px solid var(--bd)",
1173
+ borderRadius: 2,
1174
+ padding: "10px 16px",
1175
+ cursor: "pointer",
1176
+ color: "var(--tx2)",
1177
+ fontSize: 13,
1178
+ fontFamily: "var(--font-body)",
1179
+ transition: "border-color .15s, color .15s"
1180
+ }, children: [
1181
+ next.title,
1182
+ " ",
1183
+ /* @__PURE__ */ jsx2(ArrowRight, {})
1184
+ ] }) : /* @__PURE__ */ jsx2("div", {})
1185
+ ] })
1186
+ ] }),
1187
+ headings.length > 0 && wide && /* @__PURE__ */ jsxs2("aside", { style: { width: 200, padding: "40px 16px 40px 0", position: "sticky", top: 0, alignSelf: "flex-start", flexShrink: 0 }, children: [
1188
+ /* @__PURE__ */ jsx2("div", { style: { fontSize: 10, fontWeight: 600, textTransform: "uppercase", letterSpacing: ".1em", color: "var(--txM)", marginBottom: 12, fontFamily: "var(--font-code)" }, children: "On this page" }),
1189
+ /* @__PURE__ */ jsx2("div", { style: { borderLeft: "1px solid var(--bd)", paddingLeft: 0 }, children: headings.map((h, i) => /* @__PURE__ */ jsx2("a", { href: `#${h.id}`, style: {
1190
+ display: "block",
1191
+ fontSize: 12,
1192
+ color: "var(--txM)",
1193
+ textDecoration: "none",
1194
+ padding: "4px 12px",
1195
+ paddingLeft: 12 + (h.depth - 2) * 12,
1196
+ lineHeight: 1.4,
1197
+ transition: "color .12s"
1198
+ }, children: h.text }, i)) })
1199
+ ] })
1200
+ ] })
1201
+ ] })
1202
+ ] }),
1203
+ config2.ai?.enabled && /* @__PURE__ */ jsx2(
1204
+ AiChat,
1205
+ {
1206
+ provider: config2.ai.provider || "anthropic",
1207
+ model: config2.ai.model,
1208
+ apiKey: typeof __TOME_AI_API_KEY__ !== "undefined" && __TOME_AI_API_KEY__ ? __TOME_AI_API_KEY__ : void 0,
1209
+ context: docContext2?.map((d) => `## ${d.title}
1210
+ ${d.content}`).join("\n\n") ?? allPages.map((p) => `- ${p.title}${p.description ? ": " + p.description : ""}`).join("\n")
1211
+ }
1212
+ )
1213
+ ] });
1214
+ }
1215
+ function SearchModal({ allPages, onNavigate, onClose }) {
1216
+ const [q, setQ] = useState2("");
1217
+ const [results, setResults] = useState2([]);
1218
+ const [selected, setSelected] = useState2(0);
1219
+ const [pagefindReady, setPagefindReady] = useState2(null);
1220
+ const inputRef = useRef2(null);
1221
+ const debounceRef = useRef2(void 0);
1222
+ useEffect2(() => {
1223
+ initPagefind().then((pf) => setPagefindReady(!!pf));
1224
+ setTimeout(() => inputRef.current?.focus(), 50);
1225
+ }, []);
1226
+ const fallbackSearch = useCallback2((query) => {
1227
+ if (!query.trim()) return [];
1228
+ const ql = query.toLowerCase();
1229
+ return allPages.filter((p) => p.title.toLowerCase().includes(ql) || (p.description || "").toLowerCase().includes(ql)).slice(0, 8).map((p) => ({ id: p.id, title: p.title, excerpt: p.description }));
1230
+ }, [allPages]);
1231
+ const doSearch = useCallback2(async (query) => {
1232
+ if (!query.trim()) {
1233
+ setResults([]);
1234
+ setSelected(0);
1235
+ return;
1236
+ }
1237
+ const pf = pagefindInstance;
1238
+ if (pf) {
1239
+ try {
1240
+ const search = await pf.search(query);
1241
+ const items = [];
1242
+ for (const result of search.results.slice(0, 8)) {
1243
+ const data = await result.data();
1244
+ const url = data.url || "";
1245
+ const id = url.replace(/^\//, "").replace(/\/index\.html$/, "").replace(/\.html$/, "") || "index";
1246
+ items.push({
1247
+ id,
1248
+ title: data.meta?.title || id,
1249
+ excerpt: data.excerpt || void 0
1250
+ });
1251
+ }
1252
+ setResults(items);
1253
+ setSelected(0);
1254
+ return;
1255
+ } catch {
1256
+ }
1257
+ }
1258
+ setResults(fallbackSearch(query));
1259
+ setSelected(0);
1260
+ }, [fallbackSearch]);
1261
+ useEffect2(() => {
1262
+ if (debounceRef.current) clearTimeout(debounceRef.current);
1263
+ debounceRef.current = setTimeout(() => doSearch(q), 120);
1264
+ return () => {
1265
+ if (debounceRef.current) clearTimeout(debounceRef.current);
1266
+ };
1267
+ }, [q, doSearch]);
1268
+ const handleKeyDown = useCallback2((e) => {
1269
+ if (e.key === "ArrowDown") {
1270
+ e.preventDefault();
1271
+ setSelected((i) => Math.min(i + 1, results.length - 1));
1272
+ } else if (e.key === "ArrowUp") {
1273
+ e.preventDefault();
1274
+ setSelected((i) => Math.max(i - 1, 0));
1275
+ } else if (e.key === "Enter" && results.length > 0) {
1276
+ e.preventDefault();
1277
+ onNavigate(results[selected].id);
1278
+ }
1279
+ }, [results, selected, onNavigate]);
1280
+ return /* @__PURE__ */ jsx2("div", { onClick: onClose, style: {
1281
+ position: "fixed",
1282
+ inset: 0,
1283
+ zIndex: 1e3,
1284
+ background: "rgba(0,0,0,0.55)",
1285
+ backdropFilter: "blur(6px)",
1286
+ display: "flex",
1287
+ alignItems: "flex-start",
1288
+ justifyContent: "center",
1289
+ paddingTop: "12vh"
1290
+ }, children: /* @__PURE__ */ jsxs2("div", { onClick: (e) => e.stopPropagation(), style: {
1291
+ background: "var(--sf)",
1292
+ border: "1px solid var(--bd)",
1293
+ borderRadius: 2,
1294
+ width: "100%",
1295
+ maxWidth: 520,
1296
+ boxShadow: "0 24px 80px rgba(0,0,0,0.4)",
1297
+ overflow: "hidden"
1298
+ }, children: [
1299
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: 10, padding: "14px 18px", borderBottom: "1px solid var(--bd)" }, children: [
1300
+ /* @__PURE__ */ jsx2(SearchIcon, {}),
1301
+ /* @__PURE__ */ jsx2(
1302
+ "input",
1303
+ {
1304
+ ref: inputRef,
1305
+ value: q,
1306
+ onChange: (e) => setQ(e.target.value),
1307
+ onKeyDown: handleKeyDown,
1308
+ placeholder: "Search documentation...",
1309
+ style: { flex: 1, background: "none", border: "none", outline: "none", color: "var(--tx)", fontSize: 15, fontFamily: "var(--font-body)" }
1310
+ }
1311
+ ),
1312
+ /* @__PURE__ */ jsx2("kbd", { style: { fontFamily: "var(--font-code)", fontSize: 10, color: "var(--txM)", background: "var(--cdBg)", padding: "2px 6px", borderRadius: 2, border: "1px solid var(--bd)" }, children: "ESC" })
1313
+ ] }),
1314
+ results.length > 0 && /* @__PURE__ */ jsx2("div", { style: { padding: 6, maxHeight: 360, overflow: "auto" }, children: results.map((r, i) => /* @__PURE__ */ jsxs2(
1315
+ "button",
1316
+ {
1317
+ onClick: () => onNavigate(r.id),
1318
+ style: {
1319
+ display: "block",
1320
+ width: "100%",
1321
+ textAlign: "left",
1322
+ background: i === selected ? "var(--acD)" : "none",
1323
+ border: "none",
1324
+ borderRadius: 2,
1325
+ padding: "10px 14px",
1326
+ cursor: "pointer",
1327
+ color: "var(--tx)",
1328
+ fontFamily: "var(--font-body)"
1329
+ },
1330
+ onMouseEnter: () => setSelected(i),
1331
+ children: [
1332
+ /* @__PURE__ */ jsx2("div", { style: { fontWeight: 500, fontSize: 14, marginBottom: 2 }, children: r.title }),
1333
+ r.excerpt && /* @__PURE__ */ jsx2("div", { style: {
1334
+ fontSize: 12,
1335
+ color: "var(--txM)",
1336
+ lineHeight: 1.3
1337
+ }, dangerouslySetInnerHTML: { __html: r.excerpt } })
1338
+ ]
1339
+ },
1340
+ r.id + i
1341
+ )) }),
1342
+ q && !results.length && /* @__PURE__ */ jsx2("div", { style: { padding: "32px 18px", textAlign: "center", color: "var(--txM)", fontSize: 14 }, children: "No results found" }),
1343
+ pagefindReady === false && q && results.length > 0 && /* @__PURE__ */ jsx2("div", { style: { padding: "6px 18px 10px", fontSize: 11, color: "var(--txM)", textAlign: "center" }, children: "Showing title matches. Build your site for full-text search." })
1344
+ ] }) });
1345
+ }
1346
+
1347
+ // src/entry.tsx
1348
+ import config from "virtual:tome/config";
1349
+ import { routes, navigation } from "virtual:tome/routes";
1350
+ import loadPageModule from "virtual:tome/page-loader";
1351
+ import docContext from "virtual:tome/doc-context";
1352
+ import {
1353
+ Callout,
1354
+ Tabs,
1355
+ Card,
1356
+ CardGroup,
1357
+ Steps,
1358
+ Accordion
1359
+ } from "@tome/components";
1360
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1361
+ var MDX_COMPONENTS = {
1362
+ Callout,
1363
+ Tabs,
1364
+ Card,
1365
+ CardGroup,
1366
+ Steps,
1367
+ Accordion
1368
+ };
1369
+ var contentStyles = `
1370
+ @import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,700&family=Fira+Code:wght@400;500;600&display=swap');
1371
+
1372
+ .tome-content h2 { font-family: var(--font-body); font-size: 1.35em; font-weight: 600; margin-top: 2em; margin-bottom: 0.5em; display: flex; align-items: center; gap: 10px; letter-spacing: 0.01em; }
1373
+ .tome-content h2::before { content: "#"; font-family: var(--font-heading); font-size: 1.2em; font-weight: 300; font-style: italic; color: var(--ac); opacity: 0.5; }
1374
+ .tome-content h3 { font-family: var(--font-body); font-size: 1.15em; font-weight: 600; margin-top: 1.5em; margin-bottom: 0.5em; }
1375
+ .tome-content h4 { font-family: var(--font-body); font-size: 1.05em; font-weight: 600; margin-top: 1.2em; margin-bottom: 0.5em; }
1376
+ .tome-content p { color: var(--tx2); line-height: 1.8; margin-bottom: 1em; font-size: 14.5px; }
1377
+ .tome-content a { color: var(--ac); text-decoration: none; }
1378
+ .tome-content a:hover { text-decoration: underline; }
1379
+ .tome-content .heading-anchor { display: none; }
1380
+ .tome-content ul, .tome-content ol { color: var(--tx2); padding-left: 1.5em; margin-bottom: 1em; }
1381
+ .tome-content li { margin-bottom: 0.3em; line-height: 1.7; }
1382
+ .tome-content code { font-family: var(--font-code); font-size: 0.88em; background: var(--cdBg); padding: 0.15em 0.4em; border-radius: 2px; color: var(--ac); }
1383
+ .tome-content pre { margin-bottom: 1.2em; border-radius: 2px; overflow-x: auto; border: 1px solid var(--bd); }
1384
+ .tome-content pre code { background: none; padding: 1em 1.2em; display: block; font-size: 12.5px; line-height: 1.7; color: var(--cdTx); }
1385
+ .tome-content blockquote { border-left: 3px solid var(--ac); padding: 0.5em 1em; margin: 1em 0; background: var(--acD); border-radius: 0 2px 2px 0; }
1386
+ .tome-content blockquote p { color: var(--tx2); margin: 0; }
1387
+ .tome-content table { width: 100%; border-collapse: collapse; margin-bottom: 1em; }
1388
+ .tome-content th, .tome-content td { padding: 0.5em 0.8em; border: 1px solid var(--bd); text-align: left; font-size: 0.9em; }
1389
+ .tome-content th { background: var(--sf); font-weight: 600; }
1390
+ .tome-content img { max-width: 100%; border-radius: 2px; }
1391
+ .tome-content hr { border: none; border-top: 1px solid var(--bd); margin: 2em 0; }
1392
+
1393
+ /* Selection style */
1394
+ ::selection { background: var(--acD); color: var(--ac); }
1395
+
1396
+ /* Scrollbar style */
1397
+ ::-webkit-scrollbar { width: 5px; height: 5px; }
1398
+ ::-webkit-scrollbar-track { background: transparent; }
1399
+ ::-webkit-scrollbar-thumb { background: var(--bd); border-radius: 10px; }
1400
+
1401
+ /* Grain overlay */
1402
+ .tome-grain::before {
1403
+ content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
1404
+ opacity: .35;
1405
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
1406
+ background-repeat: repeat; background-size: 256px;
1407
+ }
1408
+
1409
+ /* Shiki dual-theme support */
1410
+ .shiki { background: var(--cdBg) !important; }
1411
+ html.dark .shiki .shiki-light { display: none; }
1412
+ html.light .shiki .shiki-dark { display: none; }
1413
+ `;
1414
+ async function loadPage(id) {
1415
+ try {
1416
+ const route = routes.find((r) => r.id === id);
1417
+ const mod = await loadPageModule(id);
1418
+ if (route?.isMdx && mod.meta) {
1419
+ return {
1420
+ isMdx: true,
1421
+ component: mod.default,
1422
+ frontmatter: mod.meta.frontmatter,
1423
+ headings: mod.meta.headings
1424
+ };
1425
+ }
1426
+ if (!mod.default) return null;
1427
+ return { isMdx: false, ...mod.default };
1428
+ } catch (err) {
1429
+ console.error(`Failed to load page: ${id}`, err);
1430
+ return null;
1431
+ }
1432
+ }
1433
+ function App() {
1434
+ const [currentPageId, setCurrentPageId] = useState3(() => {
1435
+ const hash = window.location.hash.slice(1);
1436
+ if (hash && routes.some((r) => r.id === hash)) return hash;
1437
+ return routes[0]?.id || "index";
1438
+ });
1439
+ const [pageData, setPageData] = useState3(null);
1440
+ const [loading, setLoading] = useState3(true);
1441
+ const navigateTo = useCallback3(async (id) => {
1442
+ setLoading(true);
1443
+ setCurrentPageId(id);
1444
+ window.location.hash = id;
1445
+ const data = await loadPage(id);
1446
+ setPageData(data);
1447
+ setLoading(false);
1448
+ }, []);
1449
+ useEffect3(() => {
1450
+ navigateTo(currentPageId);
1451
+ }, []);
1452
+ useEffect3(() => {
1453
+ const onHashChange = () => {
1454
+ const hash = window.location.hash.slice(1);
1455
+ if (hash && hash !== currentPageId && routes.some((r) => r.id === hash)) {
1456
+ navigateTo(hash);
1457
+ }
1458
+ };
1459
+ window.addEventListener("hashchange", onHashChange);
1460
+ return () => window.removeEventListener("hashchange", onHashChange);
1461
+ }, [currentPageId, navigateTo]);
1462
+ const allPages = routes.map((r) => ({
1463
+ id: r.id,
1464
+ title: r.frontmatter.title,
1465
+ description: r.frontmatter.description
1466
+ }));
1467
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
1468
+ /* @__PURE__ */ jsx3("style", { children: contentStyles }),
1469
+ /* @__PURE__ */ jsx3(
1470
+ Shell,
1471
+ {
1472
+ config,
1473
+ navigation,
1474
+ currentPageId,
1475
+ pageHtml: !pageData?.isMdx ? loading ? "<p>Loading...</p>" : pageData?.html || "<p>Page not found</p>" : void 0,
1476
+ pageComponent: pageData?.isMdx ? pageData.component : void 0,
1477
+ mdxComponents: MDX_COMPONENTS,
1478
+ pageTitle: pageData?.frontmatter.title || (loading ? "Loading..." : "Not Found"),
1479
+ pageDescription: pageData?.frontmatter.description,
1480
+ headings: pageData?.headings || [],
1481
+ onNavigate: navigateTo,
1482
+ allPages,
1483
+ docContext
1484
+ }
1485
+ )
1486
+ ] });
1487
+ }
1488
+ var container = document.getElementById("tome-root");
1489
+ if (container) {
1490
+ const root = createRoot(container);
1491
+ root.render(/* @__PURE__ */ jsx3(App, {}));
1492
+ }
1493
+ var entry_default = App;
1494
+
1495
+ export {
1496
+ THEME_PRESETS,
1497
+ AiChat,
1498
+ Shell,
1499
+ entry_default
1500
+ };