@olonjs/react 0.1.1

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.
@@ -0,0 +1,1248 @@
1
+ import Ie, { Component as je, useContext as re, createContext as ne, useMemo as X, useState as J, useEffect as z, forwardRef as Se, createElement as le, useRef as fe, useLayoutEffect as Oe } from "react";
2
+ import { Link as De, createRoutesFromElements as Me, createBrowserRouter as Le, RouterProvider as Fe, ScrollRestoration as ze, Outlet as $e, useLocation as He, Route as L } from "react-router-dom";
3
+ import { buildThemeVariableMap as Ye, resolveRuntimeConfig as Ce, normalizeBasePath as Ue, ensureWebMcpRuntime as Je, cn as ce, shouldRenderSiteGlobalHeader as We, resolveSectionMenuItems as Z, STUDIO_EVENTS as M, resolveHeaderMenuItems as Be, buildSelectionPath as he, resolveSlugFromPathname as qe, resolvePageMatchFromRegistry as Ve, resolveCollectionContext as Ge, syncHeadLink as ge, buildPageManifestHref as Xe, buildPageContractHref as Qe, syncWebMcpJsonLd as Ze } from "@olonjs/core";
4
+ import { buildThemeVariableMap as Lt } from "@olonjs/core";
5
+ var K = { exports: {} }, V = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var ve;
16
+ function Ke() {
17
+ if (ve) return V;
18
+ ve = 1;
19
+ var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
20
+ function s(a, o, d) {
21
+ var m = null;
22
+ if (d !== void 0 && (m = "" + d), o.key !== void 0 && (m = "" + o.key), "key" in o) {
23
+ d = {};
24
+ for (var y in o)
25
+ y !== "key" && (d[y] = o[y]);
26
+ } else d = o;
27
+ return o = d.ref, {
28
+ $$typeof: e,
29
+ type: a,
30
+ key: m,
31
+ ref: o !== void 0 ? o : null,
32
+ props: d
33
+ };
34
+ }
35
+ return V.Fragment = n, V.jsx = s, V.jsxs = s, V;
36
+ }
37
+ var G = {};
38
+ /**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */
47
+ var be;
48
+ function et() {
49
+ return be || (be = 1, process.env.NODE_ENV !== "production" && (function() {
50
+ function e(t) {
51
+ if (t == null) return null;
52
+ if (typeof t == "function")
53
+ return t.$$typeof === D ? null : t.displayName || t.name || null;
54
+ if (typeof t == "string") return t;
55
+ switch (t) {
56
+ case h:
57
+ return "Fragment";
58
+ case A:
59
+ return "Profiler";
60
+ case j:
61
+ return "StrictMode";
62
+ case w:
63
+ return "Suspense";
64
+ case k:
65
+ return "SuspenseList";
66
+ case O:
67
+ return "Activity";
68
+ }
69
+ if (typeof t == "object")
70
+ switch (typeof t.tag == "number" && console.error(
71
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
+ ), t.$$typeof) {
73
+ case E:
74
+ return "Portal";
75
+ case g:
76
+ return t.displayName || "Context";
77
+ case v:
78
+ return (t._context.displayName || "Context") + ".Consumer";
79
+ case u:
80
+ var c = t.render;
81
+ return t = t.displayName, t || (t = c.displayName || c.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
82
+ case T:
83
+ return c = t.displayName || null, c !== null ? c : e(t.type) || "Memo";
84
+ case P:
85
+ c = t._payload, t = t._init;
86
+ try {
87
+ return e(t(c));
88
+ } catch {
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ function n(t) {
94
+ return "" + t;
95
+ }
96
+ function s(t) {
97
+ try {
98
+ n(t);
99
+ var c = !1;
100
+ } catch {
101
+ c = !0;
102
+ }
103
+ if (c) {
104
+ c = console;
105
+ var S = c.error, R = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
106
+ return S.call(
107
+ c,
108
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
+ R
110
+ ), n(t);
111
+ }
112
+ }
113
+ function a(t) {
114
+ if (t === h) return "<>";
115
+ if (typeof t == "object" && t !== null && t.$$typeof === P)
116
+ return "<...>";
117
+ try {
118
+ var c = e(t);
119
+ return c ? "<" + c + ">" : "<...>";
120
+ } catch {
121
+ return "<...>";
122
+ }
123
+ }
124
+ function o() {
125
+ var t = $.A;
126
+ return t === null ? null : t.getOwner();
127
+ }
128
+ function d() {
129
+ return Error("react-stack-top-frame");
130
+ }
131
+ function m(t) {
132
+ if (U.call(t, "key")) {
133
+ var c = Object.getOwnPropertyDescriptor(t, "key").get;
134
+ if (c && c.isReactWarning) return !1;
135
+ }
136
+ return t.key !== void 0;
137
+ }
138
+ function y(t, c) {
139
+ function S() {
140
+ F || (F = !0, console.error(
141
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
142
+ c
143
+ ));
144
+ }
145
+ S.isReactWarning = !0, Object.defineProperty(t, "key", {
146
+ get: S,
147
+ configurable: !0
148
+ });
149
+ }
150
+ function C() {
151
+ var t = e(this.type);
152
+ return I[t] || (I[t] = !0, console.error(
153
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
+ )), t = this.props.ref, t !== void 0 ? t : null;
155
+ }
156
+ function b(t, c, S, R, Q, oe) {
157
+ var _ = S.ref;
158
+ return t = {
159
+ $$typeof: l,
160
+ type: t,
161
+ key: c,
162
+ props: S,
163
+ _owner: R
164
+ }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(t, "ref", {
165
+ enumerable: !1,
166
+ get: C
167
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
168
+ configurable: !1,
169
+ enumerable: !1,
170
+ writable: !0,
171
+ value: 0
172
+ }), Object.defineProperty(t, "_debugInfo", {
173
+ configurable: !1,
174
+ enumerable: !1,
175
+ writable: !0,
176
+ value: null
177
+ }), Object.defineProperty(t, "_debugStack", {
178
+ configurable: !1,
179
+ enumerable: !1,
180
+ writable: !0,
181
+ value: Q
182
+ }), Object.defineProperty(t, "_debugTask", {
183
+ configurable: !1,
184
+ enumerable: !1,
185
+ writable: !0,
186
+ value: oe
187
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
188
+ }
189
+ function f(t, c, S, R, Q, oe) {
190
+ var _ = c.children;
191
+ if (_ !== void 0)
192
+ if (R)
193
+ if (W(_)) {
194
+ for (R = 0; R < _.length; R++)
195
+ x(_[R]);
196
+ Object.freeze && Object.freeze(_);
197
+ } else
198
+ console.error(
199
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
200
+ );
201
+ else x(_);
202
+ if (U.call(c, "key")) {
203
+ _ = e(t);
204
+ var B = Object.keys(c).filter(function(Ae) {
205
+ return Ae !== "key";
206
+ });
207
+ R = 0 < B.length ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}", q[_ + R] || (B = 0 < B.length ? "{" + B.join(": ..., ") + ": ...}" : "{}", console.error(
208
+ `A props object containing a "key" prop is being spread into JSX:
209
+ let props = %s;
210
+ <%s {...props} />
211
+ React keys must be passed directly to JSX without using spread:
212
+ let props = %s;
213
+ <%s key={someKey} {...props} />`,
214
+ R,
215
+ _,
216
+ B,
217
+ _
218
+ ), q[_ + R] = !0);
219
+ }
220
+ if (_ = null, S !== void 0 && (s(S), _ = "" + S), m(c) && (s(c.key), _ = "" + c.key), "key" in c) {
221
+ S = {};
222
+ for (var se in c)
223
+ se !== "key" && (S[se] = c[se]);
224
+ } else S = c;
225
+ return _ && y(
226
+ S,
227
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
228
+ ), b(
229
+ t,
230
+ _,
231
+ S,
232
+ o(),
233
+ Q,
234
+ oe
235
+ );
236
+ }
237
+ function x(t) {
238
+ p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === P && (t._payload.status === "fulfilled" ? p(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
239
+ }
240
+ function p(t) {
241
+ return typeof t == "object" && t !== null && t.$$typeof === l;
242
+ }
243
+ var i = Ie, l = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), j = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), g = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), D = Symbol.for("react.client.reference"), $ = i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, W = Array.isArray, H = console.createTask ? console.createTask : function() {
244
+ return null;
245
+ };
246
+ i = {
247
+ react_stack_bottom_frame: function(t) {
248
+ return t();
249
+ }
250
+ };
251
+ var F, I = {}, N = i.react_stack_bottom_frame.bind(
252
+ i,
253
+ d
254
+ )(), Y = H(a(d)), q = {};
255
+ G.Fragment = h, G.jsx = function(t, c, S) {
256
+ var R = 1e4 > $.recentlyCreatedOwnerStacks++;
257
+ return f(
258
+ t,
259
+ c,
260
+ S,
261
+ !1,
262
+ R ? Error("react-stack-top-frame") : N,
263
+ R ? H(a(t)) : Y
264
+ );
265
+ }, G.jsxs = function(t, c, S) {
266
+ var R = 1e4 > $.recentlyCreatedOwnerStacks++;
267
+ return f(
268
+ t,
269
+ c,
270
+ S,
271
+ !0,
272
+ R ? Error("react-stack-top-frame") : N,
273
+ R ? H(a(t)) : Y
274
+ );
275
+ };
276
+ })()), G;
277
+ }
278
+ var ye;
279
+ function tt() {
280
+ return ye || (ye = 1, process.env.NODE_ENV === "production" ? K.exports = Ke() : K.exports = et()), K.exports;
281
+ }
282
+ var r = tt();
283
+ class rt extends je {
284
+ constructor(n) {
285
+ super(n), this.state = { hasError: !1, error: null };
286
+ }
287
+ static getDerivedStateFromError(n) {
288
+ return { hasError: !0, error: n };
289
+ }
290
+ componentDidCatch(n, s) {
291
+ console.error("[JsonPages Engine]", n, s);
292
+ }
293
+ render() {
294
+ return this.state.hasError && this.state.error ? /* @__PURE__ */ r.jsxs(
295
+ "div",
296
+ {
297
+ style: {
298
+ minHeight: "100vh",
299
+ display: "flex",
300
+ flexDirection: "column",
301
+ alignItems: "center",
302
+ justifyContent: "center",
303
+ padding: 24,
304
+ backgroundColor: "#0f172a",
305
+ color: "#e2e8f0",
306
+ fontFamily: "ui-sans-serif, system-ui, sans-serif"
307
+ },
308
+ children: [
309
+ /* @__PURE__ */ r.jsx("h1", { style: { fontSize: "1.25rem", fontWeight: 700, marginBottom: 8 }, children: "JsonPages Engine Error" }),
310
+ /* @__PURE__ */ r.jsx(
311
+ "pre",
312
+ {
313
+ style: {
314
+ maxWidth: "100%",
315
+ overflow: "auto",
316
+ padding: 16,
317
+ backgroundColor: "rgba(0,0,0,0.3)",
318
+ borderRadius: 8,
319
+ fontSize: 12,
320
+ marginTop: 8
321
+ },
322
+ children: this.state.error.message
323
+ }
324
+ )
325
+ ]
326
+ }
327
+ ) : this.props.children;
328
+ }
329
+ }
330
+ const nt = () => /* @__PURE__ */ r.jsxs(
331
+ "div",
332
+ {
333
+ style: {
334
+ "--local-bg": "var(--color-background)",
335
+ "--local-text": "var(--color-text)",
336
+ "--local-text-muted": "var(--color-text-muted)",
337
+ "--local-primary": "var(--color-primary)",
338
+ "--local-radius-md": "var(--radius-md)"
339
+ },
340
+ className: "min-h-screen flex flex-col items-center justify-center bg-[var(--local-bg)] px-6",
341
+ children: [
342
+ /* @__PURE__ */ r.jsx("h1", { className: "text-6xl font-bold text-[var(--local-text)] mb-4", children: "404" }),
343
+ /* @__PURE__ */ r.jsx("p", { className: "text-xl text-[var(--local-text-muted)] mb-8", children: "Page not found" }),
344
+ /* @__PURE__ */ r.jsx(
345
+ De,
346
+ {
347
+ to: "/",
348
+ className: "inline-flex items-center gap-2 px-6 py-3 rounded-[var(--local-radius-md)] bg-[var(--local-primary)] text-[var(--local-bg)] font-semibold text-sm hover:opacity-90 transition-opacity",
349
+ children: "Back to Home"
350
+ }
351
+ )
352
+ ]
353
+ }
354
+ ), we = ne(void 0), ot = ({ config: e, children: n }) => /* @__PURE__ */ r.jsx(
355
+ we.Provider,
356
+ {
357
+ value: {
358
+ registry: e.registry,
359
+ schemas: e.schemas,
360
+ tenantId: e.tenantId,
361
+ basePath: e.basePath,
362
+ assets: e.assets,
363
+ overlayDisabledSectionTypes: e.overlayDisabledSectionTypes
364
+ },
365
+ children: n
366
+ }
367
+ );
368
+ function st() {
369
+ const e = re(we);
370
+ if (e === void 0)
371
+ throw new Error("useConfig must be used within ConfigProvider");
372
+ return e;
373
+ }
374
+ const ae = /* @__PURE__ */ new Set(), de = {
375
+ setTheme: (e) => {
376
+ const n = document.documentElement, s = Ye(e);
377
+ ae.forEach((a) => {
378
+ n.style.removeProperty(a);
379
+ }), ae.clear(), Object.entries(s).forEach(([a, o]) => {
380
+ n.style.setProperty(a, o), ae.add(a);
381
+ });
382
+ }
383
+ }, Te = ne({}), Pt = () => re(Te);
384
+ function Re() {
385
+ return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
386
+ /* @__PURE__ */ r.jsx(ze, {}),
387
+ /* @__PURE__ */ r.jsx($e, {})
388
+ ] });
389
+ }
390
+ function _e({ config: e, routesBuilder: n, adminCss: s = "" }) {
391
+ var O, D, $, U, W, H, F;
392
+ const {
393
+ registry: a = {},
394
+ schemas: o = {},
395
+ basePath: d = "/",
396
+ pages: m = {},
397
+ siteConfig: y,
398
+ themeConfig: C,
399
+ menuConfig: b,
400
+ collections: f,
401
+ collectionSchemas: x,
402
+ refDocuments: p,
403
+ themeCss: i,
404
+ addSection: l,
405
+ NotFoundComponent: E = nt
406
+ } = e, h = (l == null ? void 0 : l.addableSectionTypes) ?? Object.keys(o).filter((I) => I !== "header" && I !== "footer"), j = {
407
+ saveToFile: (O = e.persistence) == null ? void 0 : O.saveToFile,
408
+ hotSave: (D = e.persistence) == null ? void 0 : D.hotSave,
409
+ coldSave: ($ = e.persistence) == null ? void 0 : $.coldSave,
410
+ showLocalSave: ((U = e.persistence) == null ? void 0 : U.showLocalSave) ?? !0,
411
+ showHotSave: ((W = e.persistence) == null ? void 0 : W.showHotSave) ?? !1,
412
+ showColdSave: ((H = e.persistence) == null ? void 0 : H.showColdSave) ?? !1
413
+ }, A = typeof (i == null ? void 0 : i.tenant) == "string" ? i.tenant : "", v = typeof (i == null ? void 0 : i.admin) == "string" ? i.admin : s, g = X(
414
+ () => Ce({
415
+ pages: m,
416
+ siteConfig: y,
417
+ themeConfig: C,
418
+ menuConfig: b,
419
+ collections: f,
420
+ collectionSchemas: x,
421
+ refDocuments: p
422
+ }),
423
+ [m, y, C, b, f, x, p]
424
+ ), [u, w] = J(!1), k = Ue(d);
425
+ z(() => {
426
+ var I, N;
427
+ try {
428
+ (I = g.themeConfig) != null && I.tokens && de.setTheme(g.themeConfig);
429
+ } catch (Y) {
430
+ console.warn("[JsonPages] setTheme failed", Y);
431
+ }
432
+ (N = e.webmcp) != null && N.enabled && Je(), w(!0);
433
+ }, [g.themeConfig, (F = e.webmcp) == null ? void 0 : F.enabled]);
434
+ const T = {
435
+ registry: a,
436
+ schemas: o,
437
+ pageRegistry: m,
438
+ siteConfig: y,
439
+ menuConfig: b,
440
+ themeConfig: g.themeConfig,
441
+ collections: f,
442
+ collectionSchemas: x,
443
+ refDocuments: p,
444
+ addSectionConfig: l,
445
+ addableSectionTypes: h,
446
+ webmcp: e.webmcp,
447
+ persistence: j,
448
+ routerBasePath: k,
449
+ tenantCss: A,
450
+ adminCss: v,
451
+ NotFoundComponent: E
452
+ }, P = X(() => {
453
+ const I = Me(n(T));
454
+ return Le(I, { basename: k });
455
+ }, [
456
+ E,
457
+ l,
458
+ h,
459
+ v,
460
+ g.themeConfig,
461
+ b,
462
+ f,
463
+ x,
464
+ m,
465
+ j.coldSave,
466
+ j.hotSave,
467
+ j.saveToFile,
468
+ j.showColdSave,
469
+ j.showHotSave,
470
+ j.showLocalSave,
471
+ p,
472
+ k,
473
+ o,
474
+ y,
475
+ A,
476
+ e.webmcp,
477
+ n
478
+ ]);
479
+ return u ? /* @__PURE__ */ r.jsx(rt, { children: /* @__PURE__ */ r.jsx(Te.Provider, { value: e.iconRegistry ?? {}, children: /* @__PURE__ */ r.jsx(
480
+ ot,
481
+ {
482
+ config: {
483
+ registry: a,
484
+ schemas: o,
485
+ tenantId: e.tenantId ?? "default",
486
+ basePath: k,
487
+ assets: e.assets,
488
+ overlayDisabledSectionTypes: e.overlayDisabledSectionTypes
489
+ },
490
+ children: /* @__PURE__ */ r.jsx(Fe, { router: P })
491
+ }
492
+ ) }) }) : /* @__PURE__ */ r.jsx(
493
+ "div",
494
+ {
495
+ style: {
496
+ minHeight: "100vh",
497
+ display: "flex",
498
+ alignItems: "center",
499
+ justifyContent: "center",
500
+ backgroundColor: "#0f172a",
501
+ color: "#94a3b8",
502
+ fontFamily: "ui-sans-serif, system-ui, sans-serif",
503
+ fontSize: 14
504
+ },
505
+ children: "Loading..."
506
+ }
507
+ );
508
+ }
509
+ const ke = ne(void 0), ue = ({ mode: e, children: n }) => (z(() => {
510
+ if (e !== "studio") return;
511
+ const s = new MutationObserver((a) => {
512
+ a.forEach((o) => {
513
+ o.addedNodes.forEach((d) => {
514
+ d instanceof HTMLElement && d.hasAttribute("data-radix-portal") && d.setAttribute("data-jp-studio-portal", "true");
515
+ });
516
+ });
517
+ });
518
+ return s.observe(document.body, { childList: !0 }), () => s.disconnect();
519
+ }, [e]), /* @__PURE__ */ r.jsx(ke.Provider, { value: { mode: e }, children: n })), at = () => {
520
+ const e = re(ke);
521
+ if (e === void 0)
522
+ throw new Error("useStudio must be used within a StudioProvider");
523
+ return e;
524
+ };
525
+ /**
526
+ * @license lucide-react v0.474.0 - ISC
527
+ *
528
+ * This source code is licensed under the ISC license.
529
+ * See the LICENSE file in the root directory of this source tree.
530
+ */
531
+ const it = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Ne = (...e) => e.filter((n, s, a) => !!n && n.trim() !== "" && a.indexOf(n) === s).join(" ").trim();
532
+ /**
533
+ * @license lucide-react v0.474.0 - ISC
534
+ *
535
+ * This source code is licensed under the ISC license.
536
+ * See the LICENSE file in the root directory of this source tree.
537
+ */
538
+ var lt = {
539
+ xmlns: "http://www.w3.org/2000/svg",
540
+ width: 24,
541
+ height: 24,
542
+ viewBox: "0 0 24 24",
543
+ fill: "none",
544
+ stroke: "currentColor",
545
+ strokeWidth: 2,
546
+ strokeLinecap: "round",
547
+ strokeLinejoin: "round"
548
+ };
549
+ /**
550
+ * @license lucide-react v0.474.0 - ISC
551
+ *
552
+ * This source code is licensed under the ISC license.
553
+ * See the LICENSE file in the root directory of this source tree.
554
+ */
555
+ const ct = Se(
556
+ ({
557
+ color: e = "currentColor",
558
+ size: n = 24,
559
+ strokeWidth: s = 2,
560
+ absoluteStrokeWidth: a,
561
+ className: o = "",
562
+ children: d,
563
+ iconNode: m,
564
+ ...y
565
+ }, C) => le(
566
+ "svg",
567
+ {
568
+ ref: C,
569
+ ...lt,
570
+ width: n,
571
+ height: n,
572
+ stroke: e,
573
+ strokeWidth: a ? Number(s) * 24 / Number(n) : s,
574
+ className: Ne("lucide", o),
575
+ ...y
576
+ },
577
+ [
578
+ ...m.map(([b, f]) => le(b, f)),
579
+ ...Array.isArray(d) ? d : [d]
580
+ ]
581
+ )
582
+ );
583
+ /**
584
+ * @license lucide-react v0.474.0 - ISC
585
+ *
586
+ * This source code is licensed under the ISC license.
587
+ * See the LICENSE file in the root directory of this source tree.
588
+ */
589
+ const me = (e, n) => {
590
+ const s = Se(
591
+ ({ className: a, ...o }, d) => le(ct, {
592
+ ref: d,
593
+ iconNode: n,
594
+ className: Ne(`lucide-${it(e)}`, a),
595
+ ...o
596
+ })
597
+ );
598
+ return s.displayName = `${e}`, s;
599
+ };
600
+ /**
601
+ * @license lucide-react v0.474.0 - ISC
602
+ *
603
+ * This source code is licensed under the ISC license.
604
+ * See the LICENSE file in the root directory of this source tree.
605
+ */
606
+ const dt = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], ut = me("ChevronDown", dt);
607
+ /**
608
+ * @license lucide-react v0.474.0 - ISC
609
+ *
610
+ * This source code is licensed under the ISC license.
611
+ * See the LICENSE file in the root directory of this source tree.
612
+ */
613
+ const mt = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], pt = me("ChevronUp", mt);
614
+ /**
615
+ * @license lucide-react v0.474.0 - ISC
616
+ *
617
+ * This source code is licensed under the ISC license.
618
+ * See the LICENSE file in the root directory of this source tree.
619
+ */
620
+ const ft = [
621
+ [
622
+ "path",
623
+ {
624
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
625
+ key: "wmoenq"
626
+ }
627
+ ],
628
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
629
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
630
+ ], ht = me("TriangleAlert", ft);
631
+ class gt extends je {
632
+ constructor(n) {
633
+ super(n), this.state = { hasError: !1 };
634
+ }
635
+ static getDerivedStateFromError() {
636
+ return { hasError: !0 };
637
+ }
638
+ componentDidCatch(n, s) {
639
+ console.error(`[JsonPages] Component Crash [${this.props.type}]:`, n, s);
640
+ }
641
+ render() {
642
+ return this.state.hasError ? /* @__PURE__ */ r.jsxs("div", { className: "p-8 m-4 bg-amber-500/5 border-2 border-dashed border-amber-500/20 rounded-xl flex flex-col items-center text-center gap-3", children: [
643
+ /* @__PURE__ */ r.jsx(ht, { className: "text-amber-500", size: 32 }),
644
+ /* @__PURE__ */ r.jsxs("div", { className: "space-y-1", children: [
645
+ /* @__PURE__ */ r.jsx("h4", { className: "text-sm font-bold text-amber-200 uppercase tracking-tight", children: "Component Error" }),
646
+ /* @__PURE__ */ r.jsxs("p", { className: "text-xs text-amber-500/70 font-mono", children: [
647
+ "Type: ",
648
+ this.props.type
649
+ ] })
650
+ ] }),
651
+ /* @__PURE__ */ r.jsx("p", { className: "text-xs text-zinc-400 max-w-[280px] leading-relaxed", children: "This section failed to render. Check the console for details or verify the JSON data structure." })
652
+ ] }) : this.props.children;
653
+ }
654
+ }
655
+ const vt = ({ type: e, scope: n, isSelected: s, sectionId: a, sectionIndex: o = 0, totalSections: d = 0, onReorder: m }) => {
656
+ const y = typeof o == "number" && o > 0 && m, C = typeof o == "number" && o < d - 1 && m;
657
+ return /* @__PURE__ */ r.jsx(
658
+ "div",
659
+ {
660
+ "data-jp-section-overlay": !0,
661
+ "aria-hidden": !0,
662
+ className: ce(
663
+ "absolute inset-0 pointer-events-none transition-all duration-200 z-[50]",
664
+ "border-2 border-transparent group-hover:border-blue-400/50 group-hover:border-dashed",
665
+ s && "border-2 border-blue-600 border-solid bg-blue-500/5"
666
+ ),
667
+ children: /* @__PURE__ */ r.jsxs(
668
+ "div",
669
+ {
670
+ className: ce(
671
+ "absolute top-0 right-0 flex flex-nowrap items-center gap-1 pl-1 pr-2 py-1 text-[9px] font-black uppercase tracking-widest transition-opacity pointer-events-auto",
672
+ "bg-blue-600 text-white",
673
+ s || "group-hover:opacity-100 opacity-0"
674
+ ),
675
+ children: [
676
+ m && a != null && /* @__PURE__ */ r.jsxs("span", { className: "shrink-0 flex items-center gap-0.5", children: [
677
+ /* @__PURE__ */ r.jsx(
678
+ "button",
679
+ {
680
+ type: "button",
681
+ onClick: (b) => {
682
+ b.stopPropagation(), y && m(a, o - 1);
683
+ },
684
+ disabled: !y,
685
+ className: "inline-flex items-center justify-center min-w-[18px] min-h-[18px] rounded bg-white/20 hover:bg-white/30 disabled:opacity-30 disabled:pointer-events-none",
686
+ title: "Move section up",
687
+ "aria-label": "Move section up",
688
+ children: /* @__PURE__ */ r.jsx(pt, { size: 12, strokeWidth: 2.5 })
689
+ }
690
+ ),
691
+ /* @__PURE__ */ r.jsx(
692
+ "button",
693
+ {
694
+ type: "button",
695
+ onClick: (b) => {
696
+ b.stopPropagation(), C && m(a, o + 2);
697
+ },
698
+ disabled: !C,
699
+ className: "inline-flex items-center justify-center min-w-[18px] min-h-[18px] rounded bg-white/20 hover:bg-white/30 disabled:opacity-30 disabled:pointer-events-none",
700
+ title: "Move section down",
701
+ "aria-label": "Move section down",
702
+ children: /* @__PURE__ */ r.jsx(ut, { size: 12, strokeWidth: 2.5 })
703
+ }
704
+ )
705
+ ] }),
706
+ /* @__PURE__ */ r.jsx("span", { className: "shrink-0", children: e }),
707
+ /* @__PURE__ */ r.jsx("span", { className: "opacity-50 shrink-0", children: "|" }),
708
+ /* @__PURE__ */ r.jsx("span", { className: "shrink-0", children: n })
709
+ ]
710
+ }
711
+ )
712
+ }
713
+ );
714
+ }, ee = ({
715
+ section: e,
716
+ menu: n,
717
+ selectedId: s,
718
+ reorderable: a,
719
+ sectionIndex: o,
720
+ totalSections: d,
721
+ onReorder: m
722
+ }) => {
723
+ const { mode: y } = at(), { registry: C, overlayDisabledSectionTypes: b } = st(), f = y === "studio", x = f && s === e.id, p = C[e.type], i = e.type === "header" || e.type === "footer" ? "global" : "local", l = Array.isArray(b) ? b.includes(e.type) : !1, E = e.type === "header" && typeof e.settings == "object" && e.settings !== null && "sticky" in e.settings && !!e.settings.sticky;
724
+ if (!p)
725
+ return /* @__PURE__ */ r.jsxs("div", { className: "p-6 m-4 bg-red-500/10 text-red-400 border border-red-500/20 rounded-lg text-sm font-mono", children: [
726
+ /* @__PURE__ */ r.jsx("strong", { children: "Missing Component:" }),
727
+ " ",
728
+ e.type
729
+ ] });
730
+ const h = () => {
731
+ const A = p;
732
+ return n ? /* @__PURE__ */ r.jsx(A, { data: e.data, settings: e.settings, menu: n }) : /* @__PURE__ */ r.jsx(A, { data: e.data, settings: e.settings });
733
+ }, j = typeof e.data == "object" && e.data !== null && "anchorId" in e.data ? String(e.data.anchorId ?? "") : void 0;
734
+ return /* @__PURE__ */ r.jsxs(
735
+ "div",
736
+ {
737
+ id: j || void 0,
738
+ "data-section-id": f ? e.id : void 0,
739
+ "data-section-type": f ? e.type : void 0,
740
+ "data-section-scope": f ? i : void 0,
741
+ ...f && x ? { "data-jp-selected": !0 } : {},
742
+ className: ce(
743
+ "relative w-full",
744
+ f && !l && "group cursor-pointer",
745
+ f && E ? "sticky top-0 z-[60]" : e.type === "header" ? "relative" : "relative z-0",
746
+ x && "z-[70]"
747
+ ),
748
+ children: [
749
+ /* @__PURE__ */ r.jsx("div", { className: e.type === "header" ? "relative" : "relative z-0", children: /* @__PURE__ */ r.jsx(gt, { type: e.type, children: h() }) }),
750
+ f && !l && /* @__PURE__ */ r.jsx(
751
+ vt,
752
+ {
753
+ type: e.type,
754
+ scope: i,
755
+ isSelected: !!x,
756
+ sectionId: a && i === "local" ? e.id : void 0,
757
+ sectionIndex: a && i === "local" ? o : void 0,
758
+ totalSections: a && i === "local" ? d : void 0,
759
+ onReorder: a && i === "local" ? m : void 0
760
+ }
761
+ )
762
+ ]
763
+ }
764
+ );
765
+ }, bt = (e) => {
766
+ z(() => {
767
+ document.title = e.title;
768
+ let n = document.querySelector('meta[name="description"]');
769
+ n || (n = document.createElement("meta"), n.setAttribute("name", "description"), document.head.appendChild(n)), n.setAttribute("content", e.description);
770
+ }, [e.title, e.description]);
771
+ }, yt = "application/json", Pe = ({
772
+ pageConfig: e,
773
+ siteConfig: n,
774
+ menuConfig: s,
775
+ selectedId: a,
776
+ onReorder: o,
777
+ scrollToSectionId: d,
778
+ onActiveSectionChange: m
779
+ }) => {
780
+ bt(e.meta);
781
+ const [y, C] = J(null), b = fe({}), f = fe(m);
782
+ f.current = m;
783
+ const x = We(e, n), p = x ? n.header ?? null : null, i = n.footer ?? null, l = (v) => {
784
+ var g;
785
+ (g = f.current) == null || g.call(f, v);
786
+ };
787
+ z(() => {
788
+ if (!d) return;
789
+ const v = b.current[d];
790
+ v && v.scrollIntoView({ behavior: "smooth", block: "center" });
791
+ }, [d]), z(() => {
792
+ if (!f.current) return;
793
+ const g = [
794
+ ...p ? [p.id] : [],
795
+ ...e.sections.map((T) => T.id),
796
+ ...i ? [i.id] : []
797
+ ], u = new IntersectionObserver(
798
+ (T) => {
799
+ T.forEach((P) => {
800
+ var O;
801
+ if (P.isIntersecting && P.intersectionRatio > 0.5) {
802
+ const D = P.target.getAttribute("data-section-id");
803
+ D && ((O = f.current) == null || O.call(f, D));
804
+ }
805
+ });
806
+ },
807
+ { threshold: [0, 0.5, 1], rootMargin: "-20% 0px -20% 0px" }
808
+ );
809
+ let w = !1;
810
+ const k = requestAnimationFrame(() => {
811
+ w || g.forEach((T) => {
812
+ const P = b.current[T];
813
+ P && u.observe(P);
814
+ });
815
+ });
816
+ return () => {
817
+ w = !0, cancelAnimationFrame(k), u.disconnect();
818
+ };
819
+ }, [i, p, e.sections, e["global-header"], x]);
820
+ const E = (v, g) => {
821
+ v.preventDefault(), v.dataTransfer.dropEffect = "move", C(g);
822
+ }, h = () => {
823
+ C(null);
824
+ }, j = (v, g) => {
825
+ if (v.preventDefault(), C(null), !!o)
826
+ try {
827
+ const u = v.dataTransfer.getData(yt), { sectionId: w } = JSON.parse(u);
828
+ typeof w == "string" && o(w, g);
829
+ } catch {
830
+ }
831
+ }, A = () => {
832
+ const v = typeof o == "function", g = e.sections.map((u, w) => {
833
+ const k = y === w;
834
+ return v ? /* @__PURE__ */ r.jsxs(
835
+ "div",
836
+ {
837
+ ref: (T) => {
838
+ b.current[u.id] = T;
839
+ },
840
+ "data-section-id": u.id,
841
+ style: { position: "relative" },
842
+ onMouseEnter: () => l(u.id),
843
+ children: [
844
+ /* @__PURE__ */ r.jsx(
845
+ "div",
846
+ {
847
+ "data-jp-drop-zone": !0,
848
+ style: {
849
+ position: "absolute",
850
+ left: 0,
851
+ right: 0,
852
+ top: -1,
853
+ height: 12,
854
+ zIndex: 55,
855
+ pointerEvents: "auto",
856
+ backgroundColor: k ? "rgba(59, 130, 246, 0.4)" : "transparent",
857
+ borderTop: k ? "2px solid rgb(96, 165, 250)" : "2px solid transparent"
858
+ },
859
+ onDragOver: (T) => E(T, w),
860
+ onDragLeave: h,
861
+ onDrop: (T) => j(T, w)
862
+ }
863
+ ),
864
+ /* @__PURE__ */ r.jsx(
865
+ ee,
866
+ {
867
+ section: u,
868
+ menu: Z(u, s.main ?? []),
869
+ selectedId: a,
870
+ reorderable: !0,
871
+ sectionIndex: w,
872
+ totalSections: e.sections.length,
873
+ onReorder: o
874
+ }
875
+ )
876
+ ]
877
+ },
878
+ u.id
879
+ ) : /* @__PURE__ */ r.jsx(
880
+ "div",
881
+ {
882
+ ref: (T) => {
883
+ b.current[u.id] = T;
884
+ },
885
+ "data-section-id": u.id,
886
+ onMouseEnter: () => l(u.id),
887
+ children: /* @__PURE__ */ r.jsx(
888
+ ee,
889
+ {
890
+ section: u,
891
+ menu: Z(u, s.main ?? []),
892
+ selectedId: a
893
+ }
894
+ )
895
+ },
896
+ u.id
897
+ );
898
+ });
899
+ if (v && g.length > 0) {
900
+ const u = e.sections.length, w = y === u;
901
+ g.push(
902
+ /* @__PURE__ */ r.jsx(
903
+ "div",
904
+ {
905
+ "data-jp-drop-zone": !0,
906
+ style: {
907
+ position: "relative",
908
+ left: 0,
909
+ right: 0,
910
+ height: 24,
911
+ minHeight: 24,
912
+ zIndex: 55,
913
+ pointerEvents: "auto",
914
+ backgroundColor: w ? "rgba(59, 130, 246, 0.4)" : "transparent",
915
+ borderTop: w ? "2px solid rgb(96, 165, 250)" : "2px solid transparent"
916
+ },
917
+ onDragOver: (k) => E(k, u),
918
+ onDragLeave: h,
919
+ onDrop: (k) => j(k, u)
920
+ },
921
+ "jp-drop-after-last"
922
+ )
923
+ );
924
+ }
925
+ return g;
926
+ };
927
+ return /* @__PURE__ */ r.jsxs("div", { className: "min-h-screen flex flex-col bg-[var(--color-background)]", children: [
928
+ p != null && /* @__PURE__ */ r.jsx(
929
+ "div",
930
+ {
931
+ ref: (v) => {
932
+ b.current[p.id] = v;
933
+ },
934
+ "data-section-id": p.id,
935
+ onMouseEnter: () => l(p.id),
936
+ children: /* @__PURE__ */ r.jsx(
937
+ ee,
938
+ {
939
+ section: p,
940
+ menu: Z(p, s.main ?? []),
941
+ selectedId: a
942
+ }
943
+ )
944
+ }
945
+ ),
946
+ /* @__PURE__ */ r.jsx("main", { className: "flex-1", children: A() }),
947
+ i != null && /* @__PURE__ */ r.jsx(
948
+ "div",
949
+ {
950
+ ref: (v) => {
951
+ b.current[i.id] = v;
952
+ },
953
+ "data-section-id": i.id,
954
+ onMouseEnter: () => l(i.id),
955
+ children: /* @__PURE__ */ r.jsx(
956
+ ee,
957
+ {
958
+ section: i,
959
+ menu: Z(i, s.main ?? []),
960
+ selectedId: a
961
+ }
962
+ )
963
+ }
964
+ )
965
+ ] });
966
+ }, xt = '[data-jp-ignore-select="true"],[data-jp-interactive="true"],.ProseMirror,[contenteditable="true"],button,input,textarea,select,[role="button"],[role="menuitem"]', Et = "[data-jp-field],[data-jp-item-id],[data-jp-item-field]", jt = () => {
967
+ var p;
968
+ const [e, n] = J(null), [s, a] = J(null), [o, d] = J({ main: [] }), [m, y] = J(null), [C, b] = J(null);
969
+ if (z(() => {
970
+ const i = (l) => {
971
+ if (!(l.origin !== window.location.origin || l.source !== window.parent) && (l.data.type === M.UPDATE_DRAFTS && (n(l.data.draft), a(l.data.globalDraft), l.data.menuConfig && d(l.data.menuConfig), l.data.themeConfig && de.setTheme(l.data.themeConfig)), l.data.type === M.SYNC_SELECTION && y(l.data.selectedId), l.data.type === M.REQUEST_SCROLL_TO_SECTION && b(l.data.sectionId ?? null), l.data.type === M.REQUEST_INLINE_FLUSH)) {
972
+ const E = typeof l.data.requestId == "string" ? l.data.requestId : null;
973
+ window.dispatchEvent(new CustomEvent(M.REQUEST_INLINE_FLUSH, { detail: { requestId: E } })), setTimeout(() => {
974
+ window.parent.postMessage(
975
+ { type: M.INLINE_FLUSHED, requestId: E },
976
+ window.location.origin
977
+ );
978
+ }, 0);
979
+ }
980
+ };
981
+ return window.addEventListener("message", i), window.parent.postMessage({ type: M.STAGE_READY }, "*"), () => window.removeEventListener("message", i);
982
+ }, []), z(() => {
983
+ const i = (h) => !!h.closest(Et), l = (h) => !!(h.closest('[data-jp-ignore-select="true"]') || h.closest(xt) && !i(h) || h.closest("a[href]") && !i(h)), E = (h) => {
984
+ var U, W, H;
985
+ const j = h.target;
986
+ if (l(j)) {
987
+ j.closest("a[href]") && h.preventDefault();
988
+ return;
989
+ }
990
+ const A = h.clientX, v = h.clientY;
991
+ let g = null, u = j;
992
+ for (; u && u !== document.body; ) {
993
+ const F = (U = u.getAttribute) == null ? void 0 : U.call(u, "data-section-id"), I = (W = u.getAttribute) == null ? void 0 : W.call(u, "data-section-type"), N = (H = u.getAttribute) == null ? void 0 : H.call(u, "data-section-scope");
994
+ if (F && I && N) {
995
+ g = u;
996
+ break;
997
+ }
998
+ u = u.parentElement;
999
+ }
1000
+ if (!g) return;
1001
+ h.preventDefault(), h.stopPropagation();
1002
+ const w = g.getAttribute("data-section-id"), k = g.getAttribute("data-section-type"), T = g.getAttribute("data-section-scope");
1003
+ if (!w || !k || !T) return;
1004
+ const P = { id: w, type: k, scope: T };
1005
+ if (j === g) {
1006
+ window.parent.postMessage({ type: M.SECTION_SELECT, section: P }, "*");
1007
+ return;
1008
+ }
1009
+ const O = document.elementFromPoint(A, v) ?? j;
1010
+ if (!O || !g.contains(O)) {
1011
+ window.parent.postMessage({ type: M.SECTION_SELECT, section: P }, "*");
1012
+ return;
1013
+ }
1014
+ if (O === g) {
1015
+ window.parent.postMessage({ type: M.SECTION_SELECT, section: P }, "*");
1016
+ return;
1017
+ }
1018
+ let D = he(O, g);
1019
+ if (D.length === 0 && O) {
1020
+ let F = null;
1021
+ const I = (N) => {
1022
+ var q, t;
1023
+ const Y = N.getBoundingClientRect();
1024
+ if (Y.left <= A && A <= Y.right && Y.top <= v && v <= Y.bottom) {
1025
+ for (let c = 0; c < N.children.length; c++) I(N.children[c]);
1026
+ ((q = N.getAttribute) != null && q.call(N, "data-jp-item-id") || (t = N.getAttribute) != null && t.call(N, "data-jp-field")) && (F = N);
1027
+ }
1028
+ };
1029
+ I(O), F && (D = he(F, g));
1030
+ }
1031
+ const $ = { type: M.SECTION_SELECT, section: P };
1032
+ D.length > 0 && ($.itemPath = D), window.parent.postMessage($, "*");
1033
+ };
1034
+ return document.addEventListener("click", E, !0), () => document.removeEventListener("click", E, !0);
1035
+ }, []), z(() => {
1036
+ if (!C) return;
1037
+ const i = setTimeout(() => b(null), 600);
1038
+ return () => clearTimeout(i);
1039
+ }, [C]), !e || !s)
1040
+ return /* @__PURE__ */ r.jsx("div", { className: "flex items-center justify-center h-screen w-full bg-zinc-950 text-zinc-500 font-mono text-xs uppercase tracking-widest animate-pulse", children: "Waiting for Studio Signal..." });
1041
+ const f = {
1042
+ ...o,
1043
+ main: Be((p = s.header) == null ? void 0 : p.data, o.main ?? [])
1044
+ }, x = (i) => {
1045
+ window.parent.postMessage({
1046
+ type: M.ACTIVE_SECTION_CHANGED,
1047
+ activeSectionId: i
1048
+ }, "*");
1049
+ };
1050
+ return /* @__PURE__ */ r.jsx(ue, { mode: "studio", children: /* @__PURE__ */ r.jsx("div", { className: "jp-ice-active", children: /* @__PURE__ */ r.jsx(
1051
+ Pe,
1052
+ {
1053
+ pageConfig: e,
1054
+ siteConfig: s,
1055
+ menuConfig: f,
1056
+ selectedId: m,
1057
+ scrollToSectionId: C,
1058
+ onActiveSectionChange: x
1059
+ }
1060
+ ) }) });
1061
+ }, pe = ({ mode: e, tenantCss: n, adminCss: s, children: a }) => (Oe(() => {
1062
+ const o = `jp-theme-${e}`, d = e === "tenant" ? n : s;
1063
+ if (!document.getElementById(o) && d) {
1064
+ const m = document.createElement("style");
1065
+ m.id = o, m.innerHTML = d, document.head.appendChild(m);
1066
+ }
1067
+ return () => {
1068
+ const m = document.getElementById(o);
1069
+ m && m.remove();
1070
+ };
1071
+ }, [e, n, s]), /* @__PURE__ */ r.jsx(r.Fragment, { children: a })), xe = ({ tenantCss: e, adminCss: n }) => /* @__PURE__ */ r.jsx(pe, { mode: "tenant", tenantCss: e, adminCss: n, children: /* @__PURE__ */ r.jsx(jt, {}) });
1072
+ let ie = null;
1073
+ function St() {
1074
+ return ie || (ie = import("@olonjs/studio")), ie;
1075
+ }
1076
+ const Ee = ({ tenantCss: e, adminCss: n, ...s }) => {
1077
+ const [a, o] = J(null);
1078
+ z(() => {
1079
+ let m = !1;
1080
+ return St().then((y) => {
1081
+ m || o(y);
1082
+ }), () => {
1083
+ m = !0;
1084
+ };
1085
+ }, []);
1086
+ const d = n || (a == null ? void 0 : a.adminSkinCss) || "";
1087
+ return /* @__PURE__ */ r.jsx(pe, { mode: "admin", tenantCss: e, adminCss: d, children: /* @__PURE__ */ r.jsx(ue, { mode: "studio", children: a ? /* @__PURE__ */ r.jsx(a.StudioRouteBody, { ...s }) : /* @__PURE__ */ r.jsx("div", { className: "flex items-center justify-center h-screen w-screen bg-zinc-950 text-zinc-500 font-mono text-xs uppercase tracking-widest animate-pulse", children: "Loading Studio..." }) }) });
1088
+ }, te = ({
1089
+ pageRegistry: e,
1090
+ siteConfig: n,
1091
+ menuConfig: s,
1092
+ themeConfig: a,
1093
+ collections: o,
1094
+ collectionSchemas: d,
1095
+ refDocuments: m,
1096
+ tenantCss: y,
1097
+ adminCss: C,
1098
+ NotFoundComponent: b
1099
+ }) => {
1100
+ const f = He(), x = qe(f.pathname), p = X(
1101
+ () => Ve(e, x),
1102
+ [e, x]
1103
+ ), i = X(
1104
+ () => p ? Ge(p.page, p.params, o) : null,
1105
+ [o, p]
1106
+ ), l = X(
1107
+ () => Ce({
1108
+ pages: p ? { [p.registrySlug]: p.page } : {},
1109
+ siteConfig: n,
1110
+ themeConfig: a,
1111
+ menuConfig: s,
1112
+ collections: o,
1113
+ collectionSchemas: d,
1114
+ collectionContext: i,
1115
+ refDocuments: m
1116
+ }),
1117
+ [p, n, a, s, o, d, i, m]
1118
+ ), E = p ? l.pages[p.registrySlug] : void 0;
1119
+ return z(() => {
1120
+ var h;
1121
+ try {
1122
+ (h = l.themeConfig) != null && h.tokens && de.setTheme(l.themeConfig);
1123
+ } catch (j) {
1124
+ console.warn("[JsonPages] visitor theme resolution failed", j);
1125
+ }
1126
+ }, [l.themeConfig]), z(() => {
1127
+ var A, v;
1128
+ if (!E) return;
1129
+ const h = typeof ((A = E.meta) == null ? void 0 : A.title) == "string" ? E.meta.title : x, j = typeof ((v = E.meta) == null ? void 0 : v.description) == "string" ? E.meta.description : "";
1130
+ ge("mcp-manifest", Xe(x)), ge("olon-contract", Qe(x)), Ze(h, j, x === "home" ? "/" : `/${x}`);
1131
+ }, [E, x]), E ? /* @__PURE__ */ r.jsx(pe, { mode: "tenant", tenantCss: y, adminCss: C, children: /* @__PURE__ */ r.jsx(ue, { mode: "visitor", children: /* @__PURE__ */ r.jsx(
1132
+ Pe,
1133
+ {
1134
+ pageConfig: E,
1135
+ siteConfig: l.siteConfig,
1136
+ menuConfig: l.menuConfig
1137
+ }
1138
+ ) }) }) : /* @__PURE__ */ r.jsx(b, {});
1139
+ };
1140
+ function Ct(e) {
1141
+ const n = {
1142
+ pageRegistry: e.pageRegistry,
1143
+ siteConfig: e.siteConfig,
1144
+ menuConfig: e.menuConfig,
1145
+ themeConfig: e.themeConfig,
1146
+ collections: e.collections,
1147
+ collectionSchemas: e.collectionSchemas,
1148
+ refDocuments: e.refDocuments,
1149
+ tenantCss: e.tenantCss,
1150
+ adminCss: e.adminCss,
1151
+ NotFoundComponent: e.NotFoundComponent
1152
+ }, s = {
1153
+ pageRegistry: e.pageRegistry,
1154
+ schemas: e.schemas,
1155
+ siteConfig: e.siteConfig,
1156
+ menuConfig: e.menuConfig,
1157
+ themeConfig: e.themeConfig,
1158
+ collections: e.collections,
1159
+ collectionSchemas: e.collectionSchemas,
1160
+ refDocuments: e.refDocuments,
1161
+ tenantCss: e.tenantCss,
1162
+ adminCss: e.adminCss,
1163
+ addSectionConfig: e.addSectionConfig,
1164
+ addableSectionTypes: e.addableSectionTypes,
1165
+ webMcp: e.webmcp,
1166
+ saveToFile: e.persistence.saveToFile,
1167
+ hotSave: e.persistence.hotSave,
1168
+ coldSave: e.persistence.coldSave,
1169
+ showLocalSave: e.persistence.showLocalSave,
1170
+ showHotSave: e.persistence.showHotSave,
1171
+ showColdSave: e.persistence.showColdSave
1172
+ };
1173
+ return /* @__PURE__ */ r.jsxs(L, { element: /* @__PURE__ */ r.jsx(Re, {}), children: [
1174
+ /* @__PURE__ */ r.jsx(L, { path: "/", element: /* @__PURE__ */ r.jsx(te, { ...n }) }),
1175
+ /* @__PURE__ */ r.jsx(L, { path: "/*", element: /* @__PURE__ */ r.jsx(te, { ...n }) }),
1176
+ /* @__PURE__ */ r.jsx(L, { path: "/admin", element: /* @__PURE__ */ r.jsx(Ee, { ...s }) }),
1177
+ /* @__PURE__ */ r.jsx(L, { path: "/admin/*", element: /* @__PURE__ */ r.jsx(Ee, { ...s }) }),
1178
+ /* @__PURE__ */ r.jsx(
1179
+ L,
1180
+ {
1181
+ path: "/admin/preview",
1182
+ element: /* @__PURE__ */ r.jsx(xe, { tenantCss: e.tenantCss, adminCss: e.adminCss })
1183
+ }
1184
+ ),
1185
+ /* @__PURE__ */ r.jsx(
1186
+ L,
1187
+ {
1188
+ path: "/admin/preview/*",
1189
+ element: /* @__PURE__ */ r.jsx(xe, { tenantCss: e.tenantCss, adminCss: e.adminCss })
1190
+ }
1191
+ ),
1192
+ /* @__PURE__ */ r.jsx(L, { path: "*", element: /* @__PURE__ */ r.jsx(e.NotFoundComponent, {}) })
1193
+ ] });
1194
+ }
1195
+ function At({ config: e }) {
1196
+ return /* @__PURE__ */ r.jsx(_e, { config: e, routesBuilder: Ct });
1197
+ }
1198
+ function wt(e) {
1199
+ const n = {
1200
+ pageRegistry: e.pageRegistry,
1201
+ siteConfig: e.siteConfig,
1202
+ menuConfig: e.menuConfig,
1203
+ themeConfig: e.themeConfig,
1204
+ collections: e.collections,
1205
+ collectionSchemas: e.collectionSchemas,
1206
+ refDocuments: e.refDocuments,
1207
+ tenantCss: e.tenantCss,
1208
+ adminCss: e.adminCss,
1209
+ // empty string at the Core level for runtime; ignored by ThemeLoader in tenant mode
1210
+ NotFoundComponent: e.NotFoundComponent
1211
+ };
1212
+ return /* @__PURE__ */ r.jsxs(L, { element: /* @__PURE__ */ r.jsx(Re, {}), children: [
1213
+ /* @__PURE__ */ r.jsx(L, { path: "/", element: /* @__PURE__ */ r.jsx(te, { ...n }) }),
1214
+ /* @__PURE__ */ r.jsx(L, { path: "/*", element: /* @__PURE__ */ r.jsx(te, { ...n }) }),
1215
+ /* @__PURE__ */ r.jsx(L, { path: "*", element: /* @__PURE__ */ r.jsx(e.NotFoundComponent, {}) })
1216
+ ] });
1217
+ }
1218
+ function It({ config: e }) {
1219
+ return /* @__PURE__ */ r.jsx(_e, { config: e, routesBuilder: wt });
1220
+ }
1221
+ const Tt = { status: "idle", message: "" }, Rt = ne({});
1222
+ function Ot(e) {
1223
+ return re(Rt)[e] ?? Tt;
1224
+ }
1225
+ export {
1226
+ ot as ConfigProvider,
1227
+ nt as DefaultNotFound,
1228
+ rt as EngineErrorBoundary,
1229
+ Te as IconRegistryContext,
1230
+ At as JsonPagesEngine,
1231
+ Rt as OlonFormsContext,
1232
+ It as OlonJSEngine,
1233
+ Pe as PageRenderer,
1234
+ jt as PreviewEntry,
1235
+ xe as PreviewRoute,
1236
+ ee as SectionRenderer,
1237
+ ue as StudioProvider,
1238
+ Ee as StudioRoute,
1239
+ pe as ThemeLoader,
1240
+ te as VisitorRoute,
1241
+ Lt as buildThemeVariableMap,
1242
+ de as themeManager,
1243
+ st as useConfig,
1244
+ bt as useDocumentMeta,
1245
+ Ot as useFormState,
1246
+ Pt as useIconRegistry,
1247
+ at as useStudio
1248
+ };