@olonjs/react 0.1.1 → 0.1.3

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.
@@ -1,4 +1,4 @@
1
- (function(E,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react"),require("react-router-dom"),require("@olonjs/core")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","@olonjs/core"],i):(E=typeof globalThis<"u"?globalThis:E||self,i(E.OlonJsReact={},E.React,E.ReactRouterDOM,E.OlonJsCore))})(this,(function(E,i,k,p){"use strict";var q={exports:{}},G={};/**
1
+ (function(g,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react-router-dom"),require("@olonjs/core")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom","@olonjs/core"],l):(g=typeof globalThis<"u"?globalThis:g||self,l(g.OlonJsReact={},g.React,g.ReactRouterDOM,g.OlonJsCore))})(this,(function(g,l,O,p){"use strict";var q={exports:{}},G={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var me;function Re(){if(me)return G;me=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(a,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var C in o)C!=="key"&&(u[C]=o[C])}else u=o;return o=u.ref,{$$typeof:e,type:a,key:f,ref:o!==void 0?o:null,props:u}}return G.Fragment=s,G.jsx=r,G.jsxs=r,G}var X={};/**
9
+ */var me;function Ne(){if(me)return G;me=1;var e=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(a,s,i){var c=null;if(i!==void 0&&(c=""+i),s.key!==void 0&&(c=""+s.key),"key"in s){i={};for(var S in s)S!=="key"&&(i[S]=s[S])}else i=s;return s=i.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:i}}return G.Fragment=o,G.jsx=r,G.jsxs=r,G}var K={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,44 +14,44 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var fe;function Ne(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===U?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case v:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case R:return"Suspense";case I:return"SuspenseList";case F:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case x:return"Portal";case b:return t.displayName||"Context";case y:return(t._context.displayName||"Context")+".Consumer";case m:var d=t.render;return t=t.displayName,t||(t=d.displayName||d.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case N:return d=t.displayName||null,d!==null?d:e(t.type)||"Memo";case M:d=t._payload,t=t._init;try{return e(t(d))}catch{}}return null}function s(t){return""+t}function r(t){try{s(t);var d=!1}catch{d=!0}if(d){d=console;var w=d.error,P=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(d,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",P),s(t)}}function a(t){if(t===v)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===M)return"<...>";try{var d=e(t);return d?"<"+d+">":"<...>"}catch{return"<...>"}}function o(){var t=V.A;return t===null?null:t.getOwner()}function u(){return Error("react-stack-top-frame")}function f(t){if(Y.call(t,"key")){var d=Object.getOwnPropertyDescriptor(t,"key").get;if(d&&d.isReactWarning)return!1}return t.key!==void 0}function C(t,d){function w(){z||(z=!0,console.error("%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)",d))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,configurable:!0})}function _(){var t=e(this.type);return L[t]||(L[t]=!0,console.error("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.")),t=this.props.ref,t!==void 0?t:null}function S(t,d,w,P,ne,de){var O=w.ref;return t={$$typeof:c,type:t,key:d,props:w,_owner:P},(O!==void 0?O:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:_}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ne}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:de}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function g(t,d,w,P,ne,de){var O=d.children;if(O!==void 0)if(P)if(B(O)){for(P=0;P<O.length;P++)j(O[P]);Object.freeze&&Object.freeze(O)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(O);if(Y.call(d,"key")){O=e(t);var W=Object.keys(d).filter(function(Ze){return Ze!=="key"});P=0<W.length?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}",K[O+P]||(W=0<W.length?"{"+W.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var pe;function Oe(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===U?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case b:return"Fragment";case D:return"Profiler";case w:return"StrictMode";case R:return"Suspense";case I:return"SuspenseList";case F:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case x:return"Portal";case E:return t.displayName||"Context";case y:return(t._context.displayName||"Context")+".Consumer";case m:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case N:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case M:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function o(t){return""+t}function r(t){try{o(t);var f=!1}catch{f=!0}if(f){f=console;var _=f.error,P=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return _.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",P),o(t)}}function a(t){if(t===b)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===M)return"<...>";try{var f=e(t);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function s(){var t=H.A;return t===null?null:t.getOwner()}function i(){return Error("react-stack-top-frame")}function c(t){if(Y.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function S(t,f){function _(){V||(V=!0,console.error("%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)",f))}_.isReactWarning=!0,Object.defineProperty(t,"key",{get:_,configurable:!0})}function T(){var t=e(this.type);return L[t]||(L[t]=!0,console.error("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.")),t=this.props.ref,t!==void 0?t:null}function C(t,f,_,P,oe,ue){var k=_.ref;return t={$$typeof:u,type:t,key:f,props:_,_owner:P},(k!==void 0?k:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:T}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:oe}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function h(t,f,_,P,oe,ue){var k=f.children;if(k!==void 0)if(P)if(B(k)){for(P=0;P<k.length;P++)j(k[P]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(k);if(Y.call(f,"key")){k=e(t);var W=Object.keys(f).filter(function(ot){return ot!=="key"});P=0<W.length?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}",Z[k+P]||(W=0<W.length?"{"+W.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,P,O,W,O),K[O+P]=!0)}if(O=null,w!==void 0&&(r(w),O=""+w),f(d)&&(r(d.key),O=""+d.key),"key"in d){w={};for(var ue in d)ue!=="key"&&(w[ue]=d[ue])}else w=d;return O&&C(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),S(t,O,w,o(),ne,de)}function j(t){h(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===M&&(t._payload.status==="fulfilled"?h(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function h(t){return typeof t=="object"&&t!==null&&t.$$typeof===c}var l=i,c=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),b=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),U=Symbol.for("react.client.reference"),V=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,B=Array.isArray,H=console.createTask?console.createTask:function(){return null};l={react_stack_bottom_frame:function(t){return t()}};var z,L={},A=l.react_stack_bottom_frame.bind(l,u)(),J=H(a(u)),K={};X.Fragment=v,X.jsx=function(t,d,w){var P=1e4>V.recentlyCreatedOwnerStacks++;return g(t,d,w,!1,P?Error("react-stack-top-frame"):A,P?H(a(t)):J)},X.jsxs=function(t,d,w){var P=1e4>V.recentlyCreatedOwnerStacks++;return g(t,d,w,!0,P?Error("react-stack-top-frame"):A,P?H(a(t)):J)}})()),X}var pe;function ke(){return pe||(pe=1,process.env.NODE_ENV==="production"?q.exports=Re():q.exports=Ne()),q.exports}var n=ke();class he extends i.Component{constructor(s){super(s),this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,r){console.error("[JsonPages Engine]",s,r)}render(){return this.state.hasError&&this.state.error?n.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:24,backgroundColor:"#0f172a",color:"#e2e8f0",fontFamily:"ui-sans-serif, system-ui, sans-serif"},children:[n.jsx("h1",{style:{fontSize:"1.25rem",fontWeight:700,marginBottom:8},children:"JsonPages Engine Error"}),n.jsx("pre",{style:{maxWidth:"100%",overflow:"auto",padding:16,backgroundColor:"rgba(0,0,0,0.3)",borderRadius:8,fontSize:12,marginTop:8},children:this.state.error.message})]}):this.props.children}}const ge=()=>n.jsxs("div",{style:{"--local-bg":"var(--color-background)","--local-text":"var(--color-text)","--local-text-muted":"var(--color-text-muted)","--local-primary":"var(--color-primary)","--local-radius-md":"var(--radius-md)"},className:"min-h-screen flex flex-col items-center justify-center bg-[var(--local-bg)] px-6",children:[n.jsx("h1",{className:"text-6xl font-bold text-[var(--local-text)] mb-4",children:"404"}),n.jsx("p",{className:"text-xl text-[var(--local-text-muted)] mb-8",children:"Page not found"}),n.jsx(k.Link,{to:"/",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",children:"Back to Home"})]}),ve=i.createContext(void 0),be=({config:e,children:s})=>n.jsx(ve.Provider,{value:{registry:e.registry,schemas:e.schemas,tenantId:e.tenantId,basePath:e.basePath,assets:e.assets,overlayDisabledSectionTypes:e.overlayDisabledSectionTypes},children:s});function Ee(){const e=i.useContext(ve);if(e===void 0)throw new Error("useConfig must be used within ConfigProvider");return e}const se=new Set,$={setTheme:e=>{const s=document.documentElement,r=p.buildThemeVariableMap(e);se.forEach(a=>{s.style.removeProperty(a)}),se.clear(),Object.entries(r).forEach(([a,o])=>{s.style.setProperty(a,o),se.add(a)})}},oe=i.createContext({}),Pe=()=>i.useContext(oe);function ye(){return n.jsxs(n.Fragment,{children:[n.jsx(k.ScrollRestoration,{}),n.jsx(k.Outlet,{})]})}function Se({config:e,routesBuilder:s,adminCss:r=""}){var F,U,V,Y,B,H,z;const{registry:a={},schemas:o={},basePath:u="/",pages:f={},siteConfig:C,themeConfig:_,menuConfig:S,collections:g,collectionSchemas:j,refDocuments:h,themeCss:l,addSection:c,NotFoundComponent:x=ge}=e,v=(c==null?void 0:c.addableSectionTypes)??Object.keys(o).filter(L=>L!=="header"&&L!=="footer"),T={saveToFile:(F=e.persistence)==null?void 0:F.saveToFile,hotSave:(U=e.persistence)==null?void 0:U.hotSave,coldSave:(V=e.persistence)==null?void 0:V.coldSave,showLocalSave:((Y=e.persistence)==null?void 0:Y.showLocalSave)??!0,showHotSave:((B=e.persistence)==null?void 0:B.showHotSave)??!1,showColdSave:((H=e.persistence)==null?void 0:H.showColdSave)??!1},D=typeof(l==null?void 0:l.tenant)=="string"?l.tenant:"",y=typeof(l==null?void 0:l.admin)=="string"?l.admin:r,b=i.useMemo(()=>p.resolveRuntimeConfig({pages:f,siteConfig:C,themeConfig:_,menuConfig:S,collections:g,collectionSchemas:j,refDocuments:h}),[f,C,_,S,g,j,h]),[m,R]=i.useState(!1),I=p.normalizeBasePath(u);i.useEffect(()=>{var L,A;try{(L=b.themeConfig)!=null&&L.tokens&&$.setTheme(b.themeConfig)}catch(J){console.warn("[JsonPages] setTheme failed",J)}(A=e.webmcp)!=null&&A.enabled&&p.ensureWebMcpRuntime(),R(!0)},[b.themeConfig,(z=e.webmcp)==null?void 0:z.enabled]);const N={registry:a,schemas:o,pageRegistry:f,siteConfig:C,menuConfig:S,themeConfig:b.themeConfig,collections:g,collectionSchemas:j,refDocuments:h,addSectionConfig:c,addableSectionTypes:v,webmcp:e.webmcp,persistence:T,routerBasePath:I,tenantCss:D,adminCss:y,NotFoundComponent:x},M=i.useMemo(()=>{const L=k.createRoutesFromElements(s(N));return k.createBrowserRouter(L,{basename:I})},[x,c,v,y,b.themeConfig,S,g,j,f,T.coldSave,T.hotSave,T.saveToFile,T.showColdSave,T.showHotSave,T.showLocalSave,h,I,o,C,D,e.webmcp,s]);return m?n.jsx(he,{children:n.jsx(oe.Provider,{value:e.iconRegistry??{},children:n.jsx(be,{config:{registry:a,schemas:o,tenantId:e.tenantId??"default",basePath:I,assets:e.assets,overlayDisabledSectionTypes:e.overlayDisabledSectionTypes},children:n.jsx(k.RouterProvider,{router:M})})})}):n.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#0f172a",color:"#94a3b8",fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:14},children:"Loading..."})}const Ce=i.createContext(void 0),ee=({mode:e,children:s})=>(i.useEffect(()=>{if(e!=="studio")return;const r=new MutationObserver(a=>{a.forEach(o=>{o.addedNodes.forEach(u=>{u instanceof HTMLElement&&u.hasAttribute("data-radix-portal")&&u.setAttribute("data-jp-studio-portal","true")})})});return r.observe(document.body,{childList:!0}),()=>r.disconnect()},[e]),n.jsx(Ce.Provider,{value:{mode:e},children:s})),je=()=>{const e=i.useContext(Ce);if(e===void 0)throw new Error("useStudio must be used within a StudioProvider");return e};/**
22
+ <%s key={someKey} {...props} />`,P,k,W,k),Z[k+P]=!0)}if(k=null,_!==void 0&&(r(_),k=""+_),c(f)&&(r(f.key),k=""+f.key),"key"in f){_={};for(var fe in f)fe!=="key"&&(_[fe]=f[fe])}else _=f;return k&&S(_,typeof t=="function"?t.displayName||t.name||"Unknown":t),C(t,k,_,s(),oe,ue)}function j(t){v(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===M&&(t._payload.status==="fulfilled"?v(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function v(t){return typeof t=="object"&&t!==null&&t.$$typeof===u}var d=l,u=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),E=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),U=Symbol.for("react.client.reference"),H=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,B=Array.isArray,z=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(t){return t()}};var V,L={},A=d.react_stack_bottom_frame.bind(d,i)(),J=z(a(i)),Z={};K.Fragment=b,K.jsx=function(t,f,_){var P=1e4>H.recentlyCreatedOwnerStacks++;return h(t,f,_,!1,P?Error("react-stack-top-frame"):A,P?z(a(t)):J)},K.jsxs=function(t,f,_){var P=1e4>H.recentlyCreatedOwnerStacks++;return h(t,f,_,!0,P?Error("react-stack-top-frame"):A,P?z(a(t)):J)}})()),K}var he;function Pe(){return he||(he=1,process.env.NODE_ENV==="production"?q.exports=Ne():q.exports=Oe()),q.exports}var n=Pe();class ge extends l.Component{constructor(o){super(o),this.state={hasError:!1,error:null}}static getDerivedStateFromError(o){return{hasError:!0,error:o}}componentDidCatch(o,r){console.error("[JsonPages Engine]",o,r)}render(){return this.state.hasError&&this.state.error?n.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:24,backgroundColor:"#0f172a",color:"#e2e8f0",fontFamily:"ui-sans-serif, system-ui, sans-serif"},children:[n.jsx("h1",{style:{fontSize:"1.25rem",fontWeight:700,marginBottom:8},children:"JsonPages Engine Error"}),n.jsx("pre",{style:{maxWidth:"100%",overflow:"auto",padding:16,backgroundColor:"rgba(0,0,0,0.3)",borderRadius:8,fontSize:12,marginTop:8},children:this.state.error.message})]}):this.props.children}}const ve=()=>n.jsxs("div",{style:{"--local-bg":"var(--color-background)","--local-text":"var(--color-text)","--local-text-muted":"var(--color-text-muted)","--local-primary":"var(--color-primary)","--local-radius-md":"var(--radius-md)"},className:"min-h-screen flex flex-col items-center justify-center bg-[var(--local-bg)] px-6",children:[n.jsx("h1",{className:"text-6xl font-bold text-[var(--local-text)] mb-4",children:"404"}),n.jsx("p",{className:"text-xl text-[var(--local-text-muted)] mb-8",children:"Page not found"}),n.jsx(O.Link,{to:"/",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",children:"Back to Home"})]}),be=l.createContext(void 0),Ee=({config:e,children:o})=>n.jsx(be.Provider,{value:{registry:e.registry,schemas:e.schemas,tenantId:e.tenantId,basePath:e.basePath,assets:e.assets,overlayDisabledSectionTypes:e.overlayDisabledSectionTypes},children:o});function Se(){const e=l.useContext(be);if(e===void 0)throw new Error("useConfig must be used within ConfigProvider");return e}const re=new Set,$={setTheme:e=>{const o=document.documentElement,r=p.buildThemeVariableMap(e);re.forEach(a=>{o.style.removeProperty(a)}),re.clear(),Object.entries(r).forEach(([a,s])=>{o.style.setProperty(a,s),re.add(a)})}},se=l.createContext({}),ke=()=>l.useContext(se);function ye(){return n.jsxs(n.Fragment,{children:[n.jsx(O.ScrollRestoration,{}),n.jsx(O.Outlet,{})]})}function Ce({config:e,routesBuilder:o,adminCss:r=""}){var F,U,H,Y,B,z,V;const{registry:a={},schemas:s={},basePath:i="/",pages:c={},siteConfig:S,themeConfig:T,menuConfig:C,collections:h,collectionSchemas:j,refDocuments:v,themeCss:d,addSection:u,NotFoundComponent:x=ve}=e,b=(u==null?void 0:u.addableSectionTypes)??Object.keys(s).filter(L=>L!=="header"&&L!=="footer"),w={saveToFile:(F=e.persistence)==null?void 0:F.saveToFile,hotSave:(U=e.persistence)==null?void 0:U.hotSave,coldSave:(H=e.persistence)==null?void 0:H.coldSave,showLocalSave:((Y=e.persistence)==null?void 0:Y.showLocalSave)??!0,showHotSave:((B=e.persistence)==null?void 0:B.showHotSave)??!1,showColdSave:((z=e.persistence)==null?void 0:z.showColdSave)??!1},D=typeof(d==null?void 0:d.tenant)=="string"?d.tenant:"",y=typeof(d==null?void 0:d.admin)=="string"?d.admin:r,E=l.useMemo(()=>p.resolveRuntimeConfig({pages:c,siteConfig:S,themeConfig:T,menuConfig:C,collections:h,collectionSchemas:j,refDocuments:v}),[c,S,T,C,h,j,v]),[m,R]=l.useState(!1),I=p.normalizeBasePath(i);l.useEffect(()=>{var L,A;try{(L=E.themeConfig)!=null&&L.tokens&&$.setTheme(E.themeConfig)}catch(J){console.warn("[JsonPages] setTheme failed",J)}(A=e.webmcp)!=null&&A.enabled&&p.ensureWebMcpRuntime(),R(!0)},[E.themeConfig,(V=e.webmcp)==null?void 0:V.enabled]);const N={registry:a,schemas:s,pageRegistry:c,siteConfig:S,menuConfig:C,themeConfig:E.themeConfig,collections:h,collectionSchemas:j,refDocuments:v,addSectionConfig:u,addableSectionTypes:b,webmcp:e.webmcp,persistence:w,routerBasePath:I,tenantCss:D,adminCss:y,NotFoundComponent:x},M=l.useMemo(()=>{const L=O.createRoutesFromElements(o(N));return O.createBrowserRouter(L,{basename:I})},[x,u,b,y,E.themeConfig,C,h,j,c,w.coldSave,w.hotSave,w.saveToFile,w.showColdSave,w.showHotSave,w.showLocalSave,v,I,s,S,D,e.webmcp,o]);return m?n.jsx(ge,{children:n.jsx(se.Provider,{value:e.iconRegistry??{},children:n.jsx(Ee,{config:{registry:a,schemas:s,tenantId:e.tenantId??"default",basePath:I,assets:e.assets,overlayDisabledSectionTypes:e.overlayDisabledSectionTypes},children:n.jsx(O.RouterProvider,{router:M})})})}):n.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#0f172a",color:"#94a3b8",fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:14},children:"Loading..."})}const je=l.createContext(void 0),ee=({mode:e,children:o})=>(l.useEffect(()=>{if(e!=="studio")return;const r=new MutationObserver(a=>{a.forEach(s=>{s.addedNodes.forEach(i=>{i instanceof HTMLElement&&i.hasAttribute("data-radix-portal")&&i.setAttribute("data-jp-studio-portal","true")})})});return r.observe(document.body,{childList:!0}),()=>r.disconnect()},[e]),n.jsx(je.Provider,{value:{mode:e},children:o})),Te=()=>{const e=l.useContext(je);if(e===void 0)throw new Error("useStudio must be used within a StudioProvider");return e};/**
23
23
  * @license lucide-react v0.474.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
26
26
  * See the LICENSE file in the root directory of this source tree.
27
- */const Oe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xe=(...e)=>e.filter((s,r,a)=>!!s&&s.trim()!==""&&a.indexOf(s)===r).join(" ").trim();/**
27
+ */const Ie=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xe=(...e)=>e.filter((o,r,a)=>!!o&&o.trim()!==""&&a.indexOf(o)===r).join(" ").trim();/**
28
28
  * @license lucide-react v0.474.0 - ISC
29
29
  *
30
30
  * This source code is licensed under the ISC license.
31
31
  * See the LICENSE file in the root directory of this source tree.
32
- */var Ie={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
32
+ */var Ae={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
33
33
  * @license lucide-react v0.474.0 - ISC
34
34
  *
35
35
  * This source code is licensed under the ISC license.
36
36
  * See the LICENSE file in the root directory of this source tree.
37
- */const Ae=i.forwardRef(({color:e="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:o="",children:u,iconNode:f,...C},_)=>i.createElement("svg",{ref:_,...Ie,width:s,height:s,stroke:e,strokeWidth:a?Number(r)*24/Number(s):r,className:xe("lucide",o),...C},[...f.map(([S,g])=>i.createElement(S,g)),...Array.isArray(u)?u:[u]]));/**
37
+ */const Me=l.forwardRef(({color:e="currentColor",size:o=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:s="",children:i,iconNode:c,...S},T)=>l.createElement("svg",{ref:T,...Ae,width:o,height:o,stroke:e,strokeWidth:a?Number(r)*24/Number(o):r,className:xe("lucide",s),...S},[...c.map(([C,h])=>l.createElement(C,h)),...Array.isArray(i)?i:[i]]));/**
38
38
  * @license lucide-react v0.474.0 - ISC
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */const re=(e,s)=>{const r=i.forwardRef(({className:a,...o},u)=>i.createElement(Ae,{ref:u,iconNode:s,className:xe(`lucide-${Oe(e)}`,a),...o}));return r.displayName=`${e}`,r};/**
42
+ */const ae=(e,o)=>{const r=l.forwardRef(({className:a,...s},i)=>l.createElement(Me,{ref:i,iconNode:o,className:xe(`lucide-${Ie(e)}`,a),...s}));return r.displayName=`${e}`,r};/**
43
43
  * @license lucide-react v0.474.0 - ISC
44
44
  *
45
45
  * This source code is licensed under the ISC license.
46
46
  * See the LICENSE file in the root directory of this source tree.
47
- */const Me=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
47
+ */const De=ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
48
48
  * @license lucide-react v0.474.0 - ISC
49
49
  *
50
50
  * This source code is licensed under the ISC license.
51
51
  * See the LICENSE file in the root directory of this source tree.
52
- */const De=re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
52
+ */const Le=ae("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
53
53
  * @license lucide-react v0.474.0 - ISC
54
54
  *
55
55
  * This source code is licensed under the ISC license.
56
56
  * See the LICENSE file in the root directory of this source tree.
57
- */const Le=re("TriangleAlert",[["path",{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",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);class Fe extends i.Component{constructor(s){super(s),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s,r){console.error(`[JsonPages] Component Crash [${this.props.type}]:`,s,r)}render(){return this.state.hasError?n.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:[n.jsx(Le,{className:"text-amber-500",size:32}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h4",{className:"text-sm font-bold text-amber-200 uppercase tracking-tight",children:"Component Error"}),n.jsxs("p",{className:"text-xs text-amber-500/70 font-mono",children:["Type: ",this.props.type]})]}),n.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."})]}):this.props.children}}const Ue=({type:e,scope:s,isSelected:r,sectionId:a,sectionIndex:o=0,totalSections:u=0,onReorder:f})=>{const C=typeof o=="number"&&o>0&&f,_=typeof o=="number"&&o<u-1&&f;return n.jsx("div",{"data-jp-section-overlay":!0,"aria-hidden":!0,className:p.cn("absolute inset-0 pointer-events-none transition-all duration-200 z-[50]","border-2 border-transparent group-hover:border-blue-400/50 group-hover:border-dashed",r&&"border-2 border-blue-600 border-solid bg-blue-500/5"),children:n.jsxs("div",{className:p.cn("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","bg-blue-600 text-white",r||"group-hover:opacity-100 opacity-0"),children:[f&&a!=null&&n.jsxs("span",{className:"shrink-0 flex items-center gap-0.5",children:[n.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),C&&f(a,o-1)},disabled:!C,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",title:"Move section up","aria-label":"Move section up",children:n.jsx(De,{size:12,strokeWidth:2.5})}),n.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),_&&f(a,o+2)},disabled:!_,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",title:"Move section down","aria-label":"Move section down",children:n.jsx(Me,{size:12,strokeWidth:2.5})})]}),n.jsx("span",{className:"shrink-0",children:e}),n.jsx("span",{className:"opacity-50 shrink-0",children:"|"}),n.jsx("span",{className:"shrink-0",children:s})]})})},Q=({section:e,menu:s,selectedId:r,reorderable:a,sectionIndex:o,totalSections:u,onReorder:f})=>{const{mode:C}=je(),{registry:_,overlayDisabledSectionTypes:S}=Ee(),g=C==="studio",j=g&&r===e.id,h=_[e.type],l=e.type==="header"||e.type==="footer"?"global":"local",c=Array.isArray(S)?S.includes(e.type):!1,x=e.type==="header"&&typeof e.settings=="object"&&e.settings!==null&&"sticky"in e.settings&&!!e.settings.sticky;if(!h)return n.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:[n.jsx("strong",{children:"Missing Component:"})," ",e.type]});const v=()=>{const D=h;return s?n.jsx(D,{data:e.data,settings:e.settings,menu:s}):n.jsx(D,{data:e.data,settings:e.settings})},T=typeof e.data=="object"&&e.data!==null&&"anchorId"in e.data?String(e.data.anchorId??""):void 0;return n.jsxs("div",{id:T||void 0,"data-section-id":g?e.id:void 0,"data-section-type":g?e.type:void 0,"data-section-scope":g?l:void 0,...g&&j?{"data-jp-selected":!0}:{},className:p.cn("relative w-full",g&&!c&&"group cursor-pointer",g&&x?"sticky top-0 z-[60]":e.type==="header"?"relative":"relative z-0",j&&"z-[70]"),children:[n.jsx("div",{className:e.type==="header"?"relative":"relative z-0",children:n.jsx(Fe,{type:e.type,children:v()})}),g&&!c&&n.jsx(Ue,{type:e.type,scope:l,isSelected:!!j,sectionId:a&&l==="local"?e.id:void 0,sectionIndex:a&&l==="local"?o:void 0,totalSections:a&&l==="local"?u:void 0,onReorder:a&&l==="local"?f:void 0})]})},Te=e=>{i.useEffect(()=>{document.title=e.title;let s=document.querySelector('meta[name="description"]');s||(s=document.createElement("meta"),s.setAttribute("name","description"),document.head.appendChild(s)),s.setAttribute("content",e.description)},[e.title,e.description])},ze="application/json",ae=({pageConfig:e,siteConfig:s,menuConfig:r,selectedId:a,onReorder:o,scrollToSectionId:u,onActiveSectionChange:f})=>{Te(e.meta);const[C,_]=i.useState(null),S=i.useRef({}),g=i.useRef(f);g.current=f;const j=p.shouldRenderSiteGlobalHeader(e,s),h=j?s.header??null:null,l=s.footer??null,c=y=>{var b;(b=g.current)==null||b.call(g,y)};i.useEffect(()=>{if(!u)return;const y=S.current[u];y&&y.scrollIntoView({behavior:"smooth",block:"center"})},[u]),i.useEffect(()=>{if(!g.current)return;const b=[...h?[h.id]:[],...e.sections.map(N=>N.id),...l?[l.id]:[]],m=new IntersectionObserver(N=>{N.forEach(M=>{var F;if(M.isIntersecting&&M.intersectionRatio>.5){const U=M.target.getAttribute("data-section-id");U&&((F=g.current)==null||F.call(g,U))}})},{threshold:[0,.5,1],rootMargin:"-20% 0px -20% 0px"});let R=!1;const I=requestAnimationFrame(()=>{R||b.forEach(N=>{const M=S.current[N];M&&m.observe(M)})});return()=>{R=!0,cancelAnimationFrame(I),m.disconnect()}},[l,h,e.sections,e["global-header"],j]);const x=(y,b)=>{y.preventDefault(),y.dataTransfer.dropEffect="move",_(b)},v=()=>{_(null)},T=(y,b)=>{if(y.preventDefault(),_(null),!!o)try{const m=y.dataTransfer.getData(ze),{sectionId:R}=JSON.parse(m);typeof R=="string"&&o(R,b)}catch{}},D=()=>{const y=typeof o=="function",b=e.sections.map((m,R)=>{const I=C===R;return y?n.jsxs("div",{ref:N=>{S.current[m.id]=N},"data-section-id":m.id,style:{position:"relative"},onMouseEnter:()=>c(m.id),children:[n.jsx("div",{"data-jp-drop-zone":!0,style:{position:"absolute",left:0,right:0,top:-1,height:12,zIndex:55,pointerEvents:"auto",backgroundColor:I?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:I?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:N=>x(N,R),onDragLeave:v,onDrop:N=>T(N,R)}),n.jsx(Q,{section:m,menu:p.resolveSectionMenuItems(m,r.main??[]),selectedId:a,reorderable:!0,sectionIndex:R,totalSections:e.sections.length,onReorder:o})]},m.id):n.jsx("div",{ref:N=>{S.current[m.id]=N},"data-section-id":m.id,onMouseEnter:()=>c(m.id),children:n.jsx(Q,{section:m,menu:p.resolveSectionMenuItems(m,r.main??[]),selectedId:a})},m.id)});if(y&&b.length>0){const m=e.sections.length,R=C===m;b.push(n.jsx("div",{"data-jp-drop-zone":!0,style:{position:"relative",left:0,right:0,height:24,minHeight:24,zIndex:55,pointerEvents:"auto",backgroundColor:R?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:R?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:I=>x(I,m),onDragLeave:v,onDrop:I=>T(I,m)},"jp-drop-after-last"))}return b};return n.jsxs("div",{className:"min-h-screen flex flex-col bg-[var(--color-background)]",children:[h!=null&&n.jsx("div",{ref:y=>{S.current[h.id]=y},"data-section-id":h.id,onMouseEnter:()=>c(h.id),children:n.jsx(Q,{section:h,menu:p.resolveSectionMenuItems(h,r.main??[]),selectedId:a})}),n.jsx("main",{className:"flex-1",children:D()}),l!=null&&n.jsx("div",{ref:y=>{S.current[l.id]=y},"data-section-id":l.id,onMouseEnter:()=>c(l.id),children:n.jsx(Q,{section:l,menu:p.resolveSectionMenuItems(l,r.main??[]),selectedId:a})})]})},Ve='[data-jp-ignore-select="true"],[data-jp-interactive="true"],.ProseMirror,[contenteditable="true"],button,input,textarea,select,[role="button"],[role="menuitem"]',He="[data-jp-field],[data-jp-item-id],[data-jp-item-field]",we=()=>{var h;const[e,s]=i.useState(null),[r,a]=i.useState(null),[o,u]=i.useState({main:[]}),[f,C]=i.useState(null),[_,S]=i.useState(null);if(i.useEffect(()=>{const l=c=>{if(!(c.origin!==window.location.origin||c.source!==window.parent)&&(c.data.type===p.STUDIO_EVENTS.UPDATE_DRAFTS&&(s(c.data.draft),a(c.data.globalDraft),c.data.menuConfig&&u(c.data.menuConfig),c.data.themeConfig&&$.setTheme(c.data.themeConfig)),c.data.type===p.STUDIO_EVENTS.SYNC_SELECTION&&C(c.data.selectedId),c.data.type===p.STUDIO_EVENTS.REQUEST_SCROLL_TO_SECTION&&S(c.data.sectionId??null),c.data.type===p.STUDIO_EVENTS.REQUEST_INLINE_FLUSH)){const x=typeof c.data.requestId=="string"?c.data.requestId:null;window.dispatchEvent(new CustomEvent(p.STUDIO_EVENTS.REQUEST_INLINE_FLUSH,{detail:{requestId:x}})),setTimeout(()=>{window.parent.postMessage({type:p.STUDIO_EVENTS.INLINE_FLUSHED,requestId:x},window.location.origin)},0)}};return window.addEventListener("message",l),window.parent.postMessage({type:p.STUDIO_EVENTS.STAGE_READY},"*"),()=>window.removeEventListener("message",l)},[]),i.useEffect(()=>{const l=v=>!!v.closest(He),c=v=>!!(v.closest('[data-jp-ignore-select="true"]')||v.closest(Ve)&&!l(v)||v.closest("a[href]")&&!l(v)),x=v=>{var Y,B,H;const T=v.target;if(c(T)){T.closest("a[href]")&&v.preventDefault();return}const D=v.clientX,y=v.clientY;let b=null,m=T;for(;m&&m!==document.body;){const z=(Y=m.getAttribute)==null?void 0:Y.call(m,"data-section-id"),L=(B=m.getAttribute)==null?void 0:B.call(m,"data-section-type"),A=(H=m.getAttribute)==null?void 0:H.call(m,"data-section-scope");if(z&&L&&A){b=m;break}m=m.parentElement}if(!b)return;v.preventDefault(),v.stopPropagation();const R=b.getAttribute("data-section-id"),I=b.getAttribute("data-section-type"),N=b.getAttribute("data-section-scope");if(!R||!I||!N)return;const M={id:R,type:I,scope:N};if(T===b){window.parent.postMessage({type:p.STUDIO_EVENTS.SECTION_SELECT,section:M},"*");return}const F=document.elementFromPoint(D,y)??T;if(!F||!b.contains(F)){window.parent.postMessage({type:p.STUDIO_EVENTS.SECTION_SELECT,section:M},"*");return}if(F===b){window.parent.postMessage({type:p.STUDIO_EVENTS.SECTION_SELECT,section:M},"*");return}let U=p.buildSelectionPath(F,b);if(U.length===0&&F){let z=null;const L=A=>{var K,t;const J=A.getBoundingClientRect();if(J.left<=D&&D<=J.right&&J.top<=y&&y<=J.bottom){for(let d=0;d<A.children.length;d++)L(A.children[d]);((K=A.getAttribute)!=null&&K.call(A,"data-jp-item-id")||(t=A.getAttribute)!=null&&t.call(A,"data-jp-field"))&&(z=A)}};L(F),z&&(U=p.buildSelectionPath(z,b))}const V={type:p.STUDIO_EVENTS.SECTION_SELECT,section:M};U.length>0&&(V.itemPath=U),window.parent.postMessage(V,"*")};return document.addEventListener("click",x,!0),()=>document.removeEventListener("click",x,!0)},[]),i.useEffect(()=>{if(!_)return;const l=setTimeout(()=>S(null),600);return()=>clearTimeout(l)},[_]),!e||!r)return n.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..."});const g={...o,main:p.resolveHeaderMenuItems((h=r.header)==null?void 0:h.data,o.main??[])},j=l=>{window.parent.postMessage({type:p.STUDIO_EVENTS.ACTIVE_SECTION_CHANGED,activeSectionId:l},"*")};return n.jsx(ee,{mode:"studio",children:n.jsx("div",{className:"jp-ice-active",children:n.jsx(ae,{pageConfig:e,siteConfig:r,menuConfig:g,selectedId:f,scrollToSectionId:_,onActiveSectionChange:j})})})},te=({mode:e,tenantCss:s,adminCss:r,children:a})=>(i.useLayoutEffect(()=>{const o=`jp-theme-${e}`,u=e==="tenant"?s:r;if(!document.getElementById(o)&&u){const f=document.createElement("style");f.id=o,f.innerHTML=u,document.head.appendChild(f)}return()=>{const f=document.getElementById(o);f&&f.remove()}},[e,s,r]),n.jsx(n.Fragment,{children:a})),ie=({tenantCss:e,adminCss:s})=>n.jsx(te,{mode:"tenant",tenantCss:e,adminCss:s,children:n.jsx(we,{})});let le=null;function Je(){return le||(le=import("@olonjs/studio")),le}const ce=({tenantCss:e,adminCss:s,...r})=>{const[a,o]=i.useState(null);i.useEffect(()=>{let f=!1;return Je().then(C=>{f||o(C)}),()=>{f=!0}},[]);const u=s||(a==null?void 0:a.adminSkinCss)||"";return n.jsx(te,{mode:"admin",tenantCss:e,adminCss:u,children:n.jsx(ee,{mode:"studio",children:a?n.jsx(a.StudioRouteBody,{...r}):n.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..."})})})},Z=({pageRegistry:e,siteConfig:s,menuConfig:r,themeConfig:a,collections:o,collectionSchemas:u,refDocuments:f,tenantCss:C,adminCss:_,NotFoundComponent:S})=>{const g=k.useLocation(),j=p.resolveSlugFromPathname(g.pathname),h=i.useMemo(()=>p.resolvePageMatchFromRegistry(e,j),[e,j]),l=i.useMemo(()=>h?p.resolveCollectionContext(h.page,h.params,o):null,[o,h]),c=i.useMemo(()=>p.resolveRuntimeConfig({pages:h?{[h.registrySlug]:h.page}:{},siteConfig:s,themeConfig:a,menuConfig:r,collections:o,collectionSchemas:u,collectionContext:l,refDocuments:f}),[h,s,a,r,o,u,l,f]),x=h?c.pages[h.registrySlug]:void 0;return i.useEffect(()=>{var v;try{(v=c.themeConfig)!=null&&v.tokens&&$.setTheme(c.themeConfig)}catch(T){console.warn("[JsonPages] visitor theme resolution failed",T)}},[c.themeConfig]),i.useEffect(()=>{var D,y;if(!x)return;const v=typeof((D=x.meta)==null?void 0:D.title)=="string"?x.meta.title:j,T=typeof((y=x.meta)==null?void 0:y.description)=="string"?x.meta.description:"";p.syncHeadLink("mcp-manifest",p.buildPageManifestHref(j)),p.syncHeadLink("olon-contract",p.buildPageContractHref(j)),p.syncWebMcpJsonLd(v,T,j==="home"?"/":`/${j}`)},[x,j]),x?n.jsx(te,{mode:"tenant",tenantCss:C,adminCss:_,children:n.jsx(ee,{mode:"visitor",children:n.jsx(ae,{pageConfig:x,siteConfig:c.siteConfig,menuConfig:c.menuConfig})})}):n.jsx(S,{})};function Ye(e){const s={pageRegistry:e.pageRegistry,siteConfig:e.siteConfig,menuConfig:e.menuConfig,themeConfig:e.themeConfig,collections:e.collections,collectionSchemas:e.collectionSchemas,refDocuments:e.refDocuments,tenantCss:e.tenantCss,adminCss:e.adminCss,NotFoundComponent:e.NotFoundComponent},r={pageRegistry:e.pageRegistry,schemas:e.schemas,siteConfig:e.siteConfig,menuConfig:e.menuConfig,themeConfig:e.themeConfig,collections:e.collections,collectionSchemas:e.collectionSchemas,refDocuments:e.refDocuments,tenantCss:e.tenantCss,adminCss:e.adminCss,addSectionConfig:e.addSectionConfig,addableSectionTypes:e.addableSectionTypes,webMcp:e.webmcp,saveToFile:e.persistence.saveToFile,hotSave:e.persistence.hotSave,coldSave:e.persistence.coldSave,showLocalSave:e.persistence.showLocalSave,showHotSave:e.persistence.showHotSave,showColdSave:e.persistence.showColdSave};return n.jsxs(k.Route,{element:n.jsx(ye,{}),children:[n.jsx(k.Route,{path:"/",element:n.jsx(Z,{...s})}),n.jsx(k.Route,{path:"/*",element:n.jsx(Z,{...s})}),n.jsx(k.Route,{path:"/admin",element:n.jsx(ce,{...r})}),n.jsx(k.Route,{path:"/admin/*",element:n.jsx(ce,{...r})}),n.jsx(k.Route,{path:"/admin/preview",element:n.jsx(ie,{tenantCss:e.tenantCss,adminCss:e.adminCss})}),n.jsx(k.Route,{path:"/admin/preview/*",element:n.jsx(ie,{tenantCss:e.tenantCss,adminCss:e.adminCss})}),n.jsx(k.Route,{path:"*",element:n.jsx(e.NotFoundComponent,{})})]})}function Be({config:e}){return n.jsx(Se,{config:e,routesBuilder:Ye})}function We(e){const s={pageRegistry:e.pageRegistry,siteConfig:e.siteConfig,menuConfig:e.menuConfig,themeConfig:e.themeConfig,collections:e.collections,collectionSchemas:e.collectionSchemas,refDocuments:e.refDocuments,tenantCss:e.tenantCss,adminCss:e.adminCss,NotFoundComponent:e.NotFoundComponent};return n.jsxs(k.Route,{element:n.jsx(ye,{}),children:[n.jsx(k.Route,{path:"/",element:n.jsx(Z,{...s})}),n.jsx(k.Route,{path:"/*",element:n.jsx(Z,{...s})}),n.jsx(k.Route,{path:"*",element:n.jsx(e.NotFoundComponent,{})})]})}function Ge({config:e}){return n.jsx(Se,{config:e,routesBuilder:We})}const Xe={status:"idle",message:""},_e=i.createContext({});function Qe(e){return i.useContext(_e)[e]??Xe}Object.defineProperty(E,"buildThemeVariableMap",{enumerable:!0,get:()=>p.buildThemeVariableMap}),E.ConfigProvider=be,E.DefaultNotFound=ge,E.EngineErrorBoundary=he,E.IconRegistryContext=oe,E.JsonPagesEngine=Be,E.OlonFormsContext=_e,E.OlonJSEngine=Ge,E.PageRenderer=ae,E.PreviewEntry=we,E.PreviewRoute=ie,E.SectionRenderer=Q,E.StudioProvider=ee,E.StudioRoute=ce,E.ThemeLoader=te,E.VisitorRoute=Z,E.themeManager=$,E.useConfig=Ee,E.useDocumentMeta=Te,E.useFormState=Qe,E.useIconRegistry=Pe,E.useStudio=je,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
57
+ */const Fe=ae("TriangleAlert",[["path",{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",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);class Ue extends l.Component{constructor(o){super(o),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,r){console.error(`[JsonPages] Component Crash [${this.props.type}]:`,o,r)}render(){return this.state.hasError?n.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:[n.jsx(Fe,{className:"text-amber-500",size:32}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h4",{className:"text-sm font-bold text-amber-200 uppercase tracking-tight",children:"Component Error"}),n.jsxs("p",{className:"text-xs text-amber-500/70 font-mono",children:["Type: ",this.props.type]})]}),n.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."})]}):this.props.children}}const Ve=({type:e,scope:o,isSelected:r,sectionId:a,sectionIndex:s=0,totalSections:i=0,onReorder:c})=>{const S=typeof s=="number"&&s>0&&c,T=typeof s=="number"&&s<i-1&&c;return n.jsx("div",{"data-jp-section-overlay":!0,"aria-hidden":!0,className:p.cn("absolute inset-0 pointer-events-none transition-all duration-200 z-[50]","border-2 border-transparent group-hover:border-blue-400/50 group-hover:border-dashed",r&&"border-2 border-blue-600 border-solid bg-blue-500/5"),children:n.jsxs("div",{className:p.cn("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","bg-blue-600 text-white",r||"group-hover:opacity-100 opacity-0"),children:[c&&a!=null&&n.jsxs("span",{className:"shrink-0 flex items-center gap-0.5",children:[n.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),S&&c(a,s-1)},disabled:!S,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",title:"Move section up","aria-label":"Move section up",children:n.jsx(Le,{size:12,strokeWidth:2.5})}),n.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),T&&c(a,s+2)},disabled:!T,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",title:"Move section down","aria-label":"Move section down",children:n.jsx(De,{size:12,strokeWidth:2.5})})]}),n.jsx("span",{className:"shrink-0",children:e}),n.jsx("span",{className:"opacity-50 shrink-0",children:"|"}),n.jsx("span",{className:"shrink-0",children:o})]})})},X=({section:e,menu:o,selectedId:r,reorderable:a,sectionIndex:s,totalSections:i,onReorder:c})=>{const{mode:S}=Te(),{registry:T,overlayDisabledSectionTypes:C}=Se(),h=S==="studio",j=h&&r===e.id,v=T[e.type],d=e.type==="header"||e.type==="footer"?"global":"local",u=Array.isArray(C)?C.includes(e.type):!1,x=e.type==="header"&&typeof e.settings=="object"&&e.settings!==null&&"sticky"in e.settings&&!!e.settings.sticky;if(!v)return n.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:[n.jsx("strong",{children:"Missing Component:"})," ",e.type]});const b=()=>{const D=v;return o?n.jsx(D,{data:e.data,settings:e.settings,menu:o}):n.jsx(D,{data:e.data,settings:e.settings})},w=typeof e.data=="object"&&e.data!==null&&"anchorId"in e.data?String(e.data.anchorId??""):void 0;return n.jsxs("div",{id:w||void 0,"data-section-id":h?e.id:void 0,"data-section-type":h?e.type:void 0,"data-section-scope":h?d:void 0,...h&&j?{"data-jp-selected":!0}:{},className:p.cn("relative w-full",h&&!u&&"group cursor-pointer",h&&x?"sticky top-0 z-[60]":e.type==="header"?"relative":"relative z-0",j&&"z-[70]"),children:[n.jsx("div",{className:e.type==="header"?"relative":"relative z-0",children:n.jsx(Ue,{type:e.type,children:b()})}),h&&!u&&n.jsx(Ve,{type:e.type,scope:d,isSelected:!!j,sectionId:a&&d==="local"?e.id:void 0,sectionIndex:a&&d==="local"?s:void 0,totalSections:a&&d==="local"?i:void 0,onReorder:a&&d==="local"?c:void 0})]})},we=e=>{l.useEffect(()=>{document.title=e.title;let o=document.querySelector('meta[name="description"]');o||(o=document.createElement("meta"),o.setAttribute("name","description"),document.head.appendChild(o)),o.setAttribute("content",e.description)},[e.title,e.description])},He="application/json",ie=({pageConfig:e,siteConfig:o,menuConfig:r,selectedId:a,onReorder:s,scrollToSectionId:i,onActiveSectionChange:c})=>{we(e.meta);const[S,T]=l.useState(null),C=l.useRef({}),h=l.useRef(c);h.current=c;const j=p.shouldRenderSiteGlobalHeader(e,o),v=j?o.header??null:null,d=o.footer??null,u=y=>{var E;(E=h.current)==null||E.call(h,y)};l.useEffect(()=>{if(!i)return;const y=C.current[i];y&&y.scrollIntoView({behavior:"smooth",block:"center"})},[i]),l.useEffect(()=>{if(!h.current)return;const E=[...v?[v.id]:[],...e.sections.map(N=>N.id),...d?[d.id]:[]],m=new IntersectionObserver(N=>{N.forEach(M=>{var F;if(M.isIntersecting&&M.intersectionRatio>.5){const U=M.target.getAttribute("data-section-id");U&&((F=h.current)==null||F.call(h,U))}})},{threshold:[0,.5,1],rootMargin:"-20% 0px -20% 0px"});let R=!1;const I=requestAnimationFrame(()=>{R||E.forEach(N=>{const M=C.current[N];M&&m.observe(M)})});return()=>{R=!0,cancelAnimationFrame(I),m.disconnect()}},[d,v,e.sections,e["global-header"],j]);const x=(y,E)=>{y.preventDefault(),y.dataTransfer.dropEffect="move",T(E)},b=()=>{T(null)},w=(y,E)=>{if(y.preventDefault(),T(null),!!s)try{const m=y.dataTransfer.getData(He),{sectionId:R}=JSON.parse(m);typeof R=="string"&&s(R,E)}catch{}},D=()=>{const y=typeof s=="function",E=e.sections.map((m,R)=>{const I=S===R;return y?n.jsxs("div",{ref:N=>{C.current[m.id]=N},"data-section-id":m.id,style:{position:"relative"},onMouseEnter:()=>u(m.id),children:[n.jsx("div",{"data-jp-drop-zone":!0,style:{position:"absolute",left:0,right:0,top:-1,height:12,zIndex:55,pointerEvents:"auto",backgroundColor:I?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:I?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:N=>x(N,R),onDragLeave:b,onDrop:N=>w(N,R)}),n.jsx(X,{section:m,menu:p.resolveSectionMenuItems(m,r.main??[]),selectedId:a,reorderable:!0,sectionIndex:R,totalSections:e.sections.length,onReorder:s})]},m.id):n.jsx("div",{ref:N=>{C.current[m.id]=N},"data-section-id":m.id,onMouseEnter:()=>u(m.id),children:n.jsx(X,{section:m,menu:p.resolveSectionMenuItems(m,r.main??[]),selectedId:a})},m.id)});if(y&&E.length>0){const m=e.sections.length,R=S===m;E.push(n.jsx("div",{"data-jp-drop-zone":!0,style:{position:"relative",left:0,right:0,height:24,minHeight:24,zIndex:55,pointerEvents:"auto",backgroundColor:R?"rgba(59, 130, 246, 0.4)":"transparent",borderTop:R?"2px solid rgb(96, 165, 250)":"2px solid transparent"},onDragOver:I=>x(I,m),onDragLeave:b,onDrop:I=>w(I,m)},"jp-drop-after-last"))}return E};return n.jsxs("div",{className:"min-h-screen flex flex-col bg-[var(--color-background)]",children:[v!=null&&n.jsx("div",{ref:y=>{C.current[v.id]=y},"data-section-id":v.id,onMouseEnter:()=>u(v.id),children:n.jsx(X,{section:v,menu:p.resolveSectionMenuItems(v,r.main??[]),selectedId:a})}),n.jsx("main",{className:"flex-1",children:D()}),d!=null&&n.jsx("div",{ref:y=>{C.current[d.id]=y},"data-section-id":d.id,onMouseEnter:()=>u(d.id),children:n.jsx(X,{section:d,menu:p.resolveSectionMenuItems(d,r.main??[]),selectedId:a})})]})},ze='[data-jp-ignore-select="true"],[data-jp-interactive="true"],.ProseMirror,[contenteditable="true"],button,input,textarea,select,[role="button"],[role="menuitem"]',Je="[data-jp-field],[data-jp-item-id],[data-jp-item-field]",_e=()=>{var v;const[e,o]=l.useState(null),[r,a]=l.useState(null),[s,i]=l.useState({main:[]}),[c,S]=l.useState(null),[T,C]=l.useState(null);if(l.useEffect(()=>{const d=u=>{if(!(u.origin!==window.location.origin||u.source!==window.parent)&&(u.data.type===p.STUDIO_EVENTS.UPDATE_DRAFTS&&(o(u.data.draft),a(u.data.globalDraft),u.data.menuConfig&&i(u.data.menuConfig),u.data.themeConfig&&$.setTheme(u.data.themeConfig)),u.data.type===p.STUDIO_EVENTS.SYNC_SELECTION&&S(u.data.selectedId),u.data.type===p.STUDIO_EVENTS.REQUEST_SCROLL_TO_SECTION&&C(u.data.sectionId??null),u.data.type===p.STUDIO_EVENTS.REQUEST_INLINE_FLUSH)){const x=typeof u.data.requestId=="string"?u.data.requestId:null;window.dispatchEvent(new CustomEvent(p.STUDIO_EVENTS.REQUEST_INLINE_FLUSH,{detail:{requestId:x}})),setTimeout(()=>{window.parent.postMessage({type:p.STUDIO_EVENTS.INLINE_FLUSHED,requestId:x},window.location.origin)},0)}};return window.addEventListener("message",d),window.parent.postMessage({type:p.STUDIO_EVENTS.STAGE_READY},"*"),()=>window.removeEventListener("message",d)},[]),l.useEffect(()=>{const d=b=>!!b.closest(Je),u=b=>!!(b.closest('[data-jp-ignore-select="true"]')||b.closest(ze)&&!d(b)||b.closest("a[href]")&&!d(b)),x=b=>{var Y,B,z;const w=b.target;if(u(w)){w.closest("a[href]")&&b.preventDefault();return}const D=b.clientX,y=b.clientY;let E=null,m=w;for(;m&&m!==document.body;){const V=(Y=m.getAttribute)==null?void 0:Y.call(m,"data-section-id"),L=(B=m.getAttribute)==null?void 0:B.call(m,"data-section-type"),A=(z=m.getAttribute)==null?void 0:z.call(m,"data-section-scope");if(V&&L&&A){E=m;break}m=m.parentElement}if(!E)return;b.preventDefault(),b.stopPropagation();const R=E.getAttribute("data-section-id"),I=E.getAttribute("data-section-type"),N=E.getAttribute("data-section-scope");if(!R||!I||!N)return;const M={id:R,type:I,scope:N};if(w===E){window.parent.postMessage({type:p.STUDIO_EVENTS.SECTION_SELECT,section:M},"*");return}const F=document.elementFromPoint(D,y)??w;if(!F||!E.contains(F)){window.parent.postMessage({type:p.STUDIO_EVENTS.SECTION_SELECT,section:M},"*");return}if(F===E){window.parent.postMessage({type:p.STUDIO_EVENTS.SECTION_SELECT,section:M},"*");return}let U=p.buildSelectionPath(F,E);if(U.length===0&&F){let V=null;const L=A=>{var Z,t;const J=A.getBoundingClientRect();if(J.left<=D&&D<=J.right&&J.top<=y&&y<=J.bottom){for(let f=0;f<A.children.length;f++)L(A.children[f]);((Z=A.getAttribute)!=null&&Z.call(A,"data-jp-item-id")||(t=A.getAttribute)!=null&&t.call(A,"data-jp-field"))&&(V=A)}};L(F),V&&(U=p.buildSelectionPath(V,E))}const H={type:p.STUDIO_EVENTS.SECTION_SELECT,section:M};U.length>0&&(H.itemPath=U),window.parent.postMessage(H,"*")};return document.addEventListener("click",x,!0),()=>document.removeEventListener("click",x,!0)},[]),l.useEffect(()=>{if(!T)return;const d=setTimeout(()=>C(null),600);return()=>clearTimeout(d)},[T]),!e||!r)return n.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..."});const h={...s,main:p.resolveHeaderMenuItems((v=r.header)==null?void 0:v.data,s.main??[])},j=d=>{window.parent.postMessage({type:p.STUDIO_EVENTS.ACTIVE_SECTION_CHANGED,activeSectionId:d},"*")};return n.jsx(ee,{mode:"studio",children:n.jsx("div",{className:"jp-ice-active",children:n.jsx(ie,{pageConfig:e,siteConfig:r,menuConfig:h,selectedId:c,scrollToSectionId:T,onActiveSectionChange:j})})})},te=({mode:e,tenantCss:o,adminCss:r,children:a})=>(l.useLayoutEffect(()=>{const s=`jp-theme-${e}`,i=e==="tenant"?o:r;if(!document.getElementById(s)&&i){const c=document.createElement("style");c.id=s,c.innerHTML=i,document.head.appendChild(c)}return()=>{const c=document.getElementById(s);c&&c.remove()}},[e,o,r]),n.jsx(n.Fragment,{children:a})),le=({tenantCss:e,adminCss:o})=>n.jsx(te,{mode:"tenant",tenantCss:e,adminCss:o,children:n.jsx(_e,{})});let ce=null;function Ye(){return ce||(ce=import("@olonjs/studio")),ce}const de=({tenantCss:e,adminCss:o,...r})=>{const[a,s]=l.useState(null);l.useEffect(()=>{let c=!1;return Ye().then(S=>{c||s(S)}),()=>{c=!0}},[]);const i=o||(a==null?void 0:a.adminSkinCss)||"";return n.jsx(te,{mode:"admin",tenantCss:e,adminCss:i,children:n.jsx(ee,{mode:"studio",children:a?n.jsx(a.StudioRouteBody,{...r}):n.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..."})})})},Q=({pageRegistry:e,siteConfig:o,menuConfig:r,themeConfig:a,collections:s,collectionSchemas:i,refDocuments:c,tenantCss:S,adminCss:T,NotFoundComponent:C})=>{const h=O.useLocation(),j=p.resolveSlugFromPathname(h.pathname),v=l.useMemo(()=>p.resolvePageMatchFromRegistry(e,j),[e,j]),d=l.useMemo(()=>v?p.resolveCollectionContext(v.page,v.params,s):null,[s,v]),u=l.useMemo(()=>p.resolveRuntimeConfig({pages:v?{[v.registrySlug]:v.page}:{},siteConfig:o,themeConfig:a,menuConfig:r,collections:s,collectionSchemas:i,collectionContext:d,refDocuments:c}),[v,o,a,r,s,i,d,c]),x=v?u.pages[v.registrySlug]:void 0;return l.useEffect(()=>{var b;try{(b=u.themeConfig)!=null&&b.tokens&&$.setTheme(u.themeConfig)}catch(w){console.warn("[JsonPages] visitor theme resolution failed",w)}},[u.themeConfig]),l.useEffect(()=>{var D,y;if(!x)return;const b=typeof((D=x.meta)==null?void 0:D.title)=="string"?x.meta.title:j,w=typeof((y=x.meta)==null?void 0:y.description)=="string"?x.meta.description:"";p.syncHeadLink("mcp-manifest",p.buildPageManifestHref(j)),p.syncHeadLink("olon-contract",p.buildPageContractHref(j)),p.syncWebMcpJsonLd(b,w,j==="home"?"/":`/${j}`)},[x,j]),x?n.jsx(te,{mode:"tenant",tenantCss:S,adminCss:T,children:n.jsx(ee,{mode:"visitor",children:n.jsx(ie,{pageConfig:x,siteConfig:u.siteConfig,menuConfig:u.menuConfig})})}):n.jsx(C,{})};function Be(e){const o={pageRegistry:e.pageRegistry,siteConfig:e.siteConfig,menuConfig:e.menuConfig,themeConfig:e.themeConfig,collections:e.collections,collectionSchemas:e.collectionSchemas,refDocuments:e.refDocuments,tenantCss:e.tenantCss,adminCss:e.adminCss,NotFoundComponent:e.NotFoundComponent},r={pageRegistry:e.pageRegistry,schemas:e.schemas,siteConfig:e.siteConfig,menuConfig:e.menuConfig,themeConfig:e.themeConfig,collections:e.collections,collectionSchemas:e.collectionSchemas,refDocuments:e.refDocuments,tenantCss:e.tenantCss,adminCss:e.adminCss,addSectionConfig:e.addSectionConfig,addableSectionTypes:e.addableSectionTypes,webMcp:e.webmcp,saveToFile:e.persistence.saveToFile,hotSave:e.persistence.hotSave,coldSave:e.persistence.coldSave,showLocalSave:e.persistence.showLocalSave,showHotSave:e.persistence.showHotSave,showColdSave:e.persistence.showColdSave};return n.jsxs(O.Route,{element:n.jsx(ye,{}),children:[n.jsx(O.Route,{path:"/",element:n.jsx(Q,{...o})}),n.jsx(O.Route,{path:"/*",element:n.jsx(Q,{...o})}),n.jsx(O.Route,{path:"/admin",element:n.jsx(de,{...r})}),n.jsx(O.Route,{path:"/admin/*",element:n.jsx(de,{...r})}),n.jsx(O.Route,{path:"/admin/preview",element:n.jsx(le,{tenantCss:e.tenantCss,adminCss:e.adminCss})}),n.jsx(O.Route,{path:"/admin/preview/*",element:n.jsx(le,{tenantCss:e.tenantCss,adminCss:e.adminCss})}),n.jsx(O.Route,{path:"*",element:n.jsx(e.NotFoundComponent,{})})]})}function We({config:e}){return n.jsx(Ce,{config:e,routesBuilder:Be})}function Ge(e){const o={pageRegistry:e.pageRegistry,siteConfig:e.siteConfig,menuConfig:e.menuConfig,themeConfig:e.themeConfig,collections:e.collections,collectionSchemas:e.collectionSchemas,refDocuments:e.refDocuments,tenantCss:e.tenantCss,adminCss:e.adminCss,NotFoundComponent:e.NotFoundComponent};return n.jsxs(O.Route,{element:n.jsx(ye,{}),children:[n.jsx(O.Route,{path:"/",element:n.jsx(Q,{...o})}),n.jsx(O.Route,{path:"/*",element:n.jsx(Q,{...o})}),n.jsx(O.Route,{path:"*",element:n.jsx(e.NotFoundComponent,{})})]})}function Ke({config:e}){return n.jsx(Ce,{config:e,routesBuilder:Ge})}const Xe={status:"idle",message:""},Re=l.createContext({});function Qe(e){return l.useContext(Re)[e]??Xe}function Ze(e,o){return!!(e&&o)}function qe(e){const o=e.apiUrl.trim(),r=e.apiKey.trim(),a=Ze(o,r),s=a&&e.save2RepoFlag,i=a;let c="local";return a&&(c=s?"static":"live"),{isCloudMode:a,bootSource:c,hotSaveEnabled:i,save2RepoEnabled:s,showLocalSave:!a,showHotSave:i,showColdSave:s,apiUrl:o,apiKey:r}}function ne(e,o){const r=e[o];return typeof r=="string"?r.trim():""}function $e(e){const o=ne(e,"VITE_OLONJS_CLOUD_URL")||ne(e,"VITE_JSONPAGES_CLOUD_URL"),r=ne(e,"VITE_OLONJS_API_KEY")||ne(e,"VITE_JSONPAGES_API_KEY"),a=e.VITE_SAVE2REPO==="true";return{apiUrl:o,apiKey:r,save2RepoFlag:a}}function et(e){return e.trim().replace(/\/+$/,"")}function tt(e){const o=et(e);if(!o)return[];const r=/\/api\/v1$/i.test(o)?o:`${o}/api/v1`;return Array.from(new Set([r,o]))}function nt(e){const{apiUrl:o,apiKey:r,fetchImpl:a=fetch,onSuccess:s}=e;return async(i,c)=>{const S=o.trim(),T=r.trim();if(!S||!T)throw new Error("Cloud mode is not configured for hot save.");const C=S.replace(/\/+$/,""),h=await a(`${C}/hotSave`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({slug:c,page:i.page,siteConfig:i.site,collections:i.collections})}),j=await h.json().catch(()=>({}));if(!h.ok)throw new Error(j.error||j.code||`Hot save failed: ${h.status}`);await(s==null?void 0:s({state:i,slug:c,apiUrl:S,apiKey:T}))}}Object.defineProperty(g,"buildThemeVariableMap",{enumerable:!0,get:()=>p.buildThemeVariableMap}),g.ConfigProvider=Ee,g.DefaultNotFound=ve,g.EngineErrorBoundary=ge,g.IconRegistryContext=se,g.JsonPagesEngine=We,g.OlonFormsContext=Re,g.OlonJSEngine=Ke,g.PageRenderer=ie,g.PreviewEntry=_e,g.PreviewRoute=le,g.SectionRenderer=X,g.StudioProvider=ee,g.StudioRoute=de,g.ThemeLoader=te,g.VisitorRoute=Q,g.buildApiCandidates=tt,g.createHotSaveHandler=nt,g.readCloudEnvFromVite=$e,g.resolveCloudPolicy=qe,g.themeManager=$,g.useConfig=Se,g.useDocumentMeta=we,g.useFormState=Qe,g.useIconRegistry=ke,g.useStudio=Te,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olonjs/react",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/olonjs-react.umd.cjs",
@@ -42,7 +42,7 @@
42
42
  "react": "^19.0.0",
43
43
  "react-dom": "^19.0.0",
44
44
  "react-router-dom": "^6.29.0",
45
- "@olonjs/studio": "^0.1.1"
45
+ "@olonjs/studio": "^0.1.3"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@olonjs/studio": {
@@ -50,7 +50,7 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@olonjs/core": "^1.1.18",
53
+ "@olonjs/core": "^1.1.20",
54
54
  "lucide-react": "^0.474.0"
55
55
  },
56
56
  "devDependencies": {