@chaibuilder/pages 0.1.0-beta.35 → 0.1.0-beta.36

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./STCWXWCR-DUcuCL1k.cjs"),t=require("./ChaiBuilderPages-CuARrKoP.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./STCWXWCR-Bz9DdDPv.cjs"),t=require("./ChaiBuilderPages-B1-BOgdM.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./STCWXWCR-CYflySHg.js";
2
- import { g as d, c as f, a as e } from "./ChaiBuilderPages-90fDaAoT.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./STCWXWCR-Bej-Qva0.js";
2
+ import { g as d, c as f, a as e } from "./ChaiBuilderPages-BL1F6ebo.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -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 qn;function wr(){if(qn)return Ye;qn=1;var e=k,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,u,d){var g,h={},w=null,S=null;d!==void 0&&(w=""+d),u.key!==void 0&&(w=""+u.key),u.ref!==void 0&&(S=u.ref);for(g in u)s.call(u,g)&&!a.hasOwnProperty(g)&&(h[g]=u[g]);if(l&&l.defaultProps)for(g in u=l.defaultProps,u)h[g]===void 0&&(h[g]=u[g]);return{$$typeof:t,type:l,key:w,ref:S,props:h,_owner:r.current}}return Ye.Fragment=n,Ye.jsx=o,Ye.jsxs=o,Ye}var Xe={};/**
9
+ */var qn;function wr(){if(qn)return Ye;qn=1;var e=k,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,u,d){var g,h={},j=null,S=null;d!==void 0&&(j=""+d),u.key!==void 0&&(j=""+u.key),u.ref!==void 0&&(S=u.ref);for(g in u)s.call(u,g)&&!a.hasOwnProperty(g)&&(h[g]=u[g]);if(l&&l.defaultProps)for(g in u=l.defaultProps,u)h[g]===void 0&&(h[g]=u[g]);return{$$typeof:t,type:l,key:j,ref:S,props:h,_owner:r.current}}return Ye.Fragment=n,Ye.jsx=o,Ye.jsxs=o,Ye}var Xe={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,17 +14,17 @@
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 $n;function jr(){return $n||($n=1,process.env.NODE_ENV!=="production"&&function(){var e=k,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),C=Symbol.iterator,x="@@iterator";function b(c){if(c===null||typeof c!="object")return null;var m=C&&c[C]||c[x];return typeof m=="function"?m:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(c){{for(var m=arguments.length,v=new Array(m>1?m-1:0),E=1;E<m;E++)v[E-1]=arguments[E];O("error",c,v)}}function O(c,m,v){{var E=y.ReactDebugCurrentFrame,R=E.getStackAddendum();R!==""&&(m+="%s",v=v.concat([R]));var q=v.map(function(P){return String(P)});q.unshift("Warning: "+m),Function.prototype.apply.call(console[c],console,q)}}var $=!1,B=!1,he=!1,ve=!1,ge=!1,U;U=Symbol.for("react.module.reference");function V(c){return!!(typeof c=="string"||typeof c=="function"||c===s||c===a||ge||c===r||c===d||c===g||ve||c===S||$||B||he||typeof c=="object"&&c!==null&&(c.$$typeof===w||c.$$typeof===h||c.$$typeof===o||c.$$typeof===l||c.$$typeof===u||c.$$typeof===U||c.getModuleId!==void 0))}function G(c,m,v){var E=c.displayName;if(E)return E;var R=m.displayName||m.name||"";return R!==""?v+"("+R+")":v}function ae(c){return c.displayName||"Context"}function re(c){if(c==null)return null;if(typeof c.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case s:return"Fragment";case n:return"Portal";case a:return"Profiler";case r:return"StrictMode";case d:return"Suspense";case g:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case l:var m=c;return ae(m)+".Consumer";case o:var v=c;return ae(v._context)+".Provider";case u:return G(c,c.render,"ForwardRef");case h:var E=c.displayName||null;return E!==null?E:re(c.type)||"Memo";case w:{var R=c,q=R._payload,P=R._init;try{return re(P(q))}catch{return null}}}return null}var ue=Object.assign,xe=0,z,oe,Se,xt,wn,jn,Sn;function Cn(){}Cn.__reactDisabledLog=!0;function zs(){{if(xe===0){z=console.log,oe=console.info,Se=console.warn,xt=console.error,wn=console.group,jn=console.groupCollapsed,Sn=console.groupEnd;var c={configurable:!0,enumerable:!0,value:Cn,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}xe++}}function Qs(){{if(xe--,xe===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ue({},c,{value:z}),info:ue({},c,{value:oe}),warn:ue({},c,{value:Se}),error:ue({},c,{value:xt}),group:ue({},c,{value:wn}),groupCollapsed:ue({},c,{value:jn}),groupEnd:ue({},c,{value:Sn})})}xe<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var qt=y.ReactCurrentDispatcher,$t;function bt(c,m,v){{if($t===void 0)try{throw Error()}catch(R){var E=R.stack.trim().match(/\n( *(at )?)/);$t=E&&E[1]||""}return`
17
+ */var $n;function jr(){return $n||($n=1,process.env.NODE_ENV!=="production"&&function(){var e=k,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),C=Symbol.iterator,x="@@iterator";function w(c){if(c===null||typeof c!="object")return null;var m=C&&c[C]||c[x];return typeof m=="function"?m:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(c){{for(var m=arguments.length,v=new Array(m>1?m-1:0),E=1;E<m;E++)v[E-1]=arguments[E];O("error",c,v)}}function O(c,m,v){{var E=y.ReactDebugCurrentFrame,R=E.getStackAddendum();R!==""&&(m+="%s",v=v.concat([R]));var q=v.map(function(P){return String(P)});q.unshift("Warning: "+m),Function.prototype.apply.call(console[c],console,q)}}var $=!1,B=!1,he=!1,ve=!1,ge=!1,U;U=Symbol.for("react.module.reference");function V(c){return!!(typeof c=="string"||typeof c=="function"||c===s||c===a||ge||c===r||c===d||c===g||ve||c===S||$||B||he||typeof c=="object"&&c!==null&&(c.$$typeof===j||c.$$typeof===h||c.$$typeof===o||c.$$typeof===l||c.$$typeof===u||c.$$typeof===U||c.getModuleId!==void 0))}function G(c,m,v){var E=c.displayName;if(E)return E;var R=m.displayName||m.name||"";return R!==""?v+"("+R+")":v}function ae(c){return c.displayName||"Context"}function re(c){if(c==null)return null;if(typeof c.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case s:return"Fragment";case n:return"Portal";case a:return"Profiler";case r:return"StrictMode";case d:return"Suspense";case g:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case l:var m=c;return ae(m)+".Consumer";case o:var v=c;return ae(v._context)+".Provider";case u:return G(c,c.render,"ForwardRef");case h:var E=c.displayName||null;return E!==null?E:re(c.type)||"Memo";case j:{var R=c,q=R._payload,P=R._init;try{return re(P(q))}catch{return null}}}return null}var ue=Object.assign,xe=0,z,oe,Se,xt,wn,jn,Sn;function Cn(){}Cn.__reactDisabledLog=!0;function zs(){{if(xe===0){z=console.log,oe=console.info,Se=console.warn,xt=console.error,wn=console.group,jn=console.groupCollapsed,Sn=console.groupEnd;var c={configurable:!0,enumerable:!0,value:Cn,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}xe++}}function Qs(){{if(xe--,xe===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ue({},c,{value:z}),info:ue({},c,{value:oe}),warn:ue({},c,{value:Se}),error:ue({},c,{value:xt}),group:ue({},c,{value:wn}),groupCollapsed:ue({},c,{value:jn}),groupEnd:ue({},c,{value:Sn})})}xe<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var qt=y.ReactCurrentDispatcher,$t;function bt(c,m,v){{if($t===void 0)try{throw Error()}catch(R){var E=R.stack.trim().match(/\n( *(at )?)/);$t=E&&E[1]||""}return`
18
18
  `+$t+c}}var Gt=!1,wt;{var Ws=typeof WeakMap=="function"?WeakMap:Map;wt=new Ws}function En(c,m){if(!c||Gt)return"";{var v=wt.get(c);if(v!==void 0)return v}var E;Gt=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var q;q=qt.current,qt.current=null,zs();try{if(m){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(ne){E=ne}Reflect.construct(c,[],P)}else{try{P.call()}catch(ne){E=ne}c.call(P.prototype)}}else{try{throw Error()}catch(ne){E=ne}c()}}catch(ne){if(ne&&E&&typeof ne.stack=="string"){for(var A=ne.stack.split(`
19
19
  `),ee=E.stack.split(`
20
20
  `),Q=A.length-1,W=ee.length-1;Q>=1&&W>=0&&A[Q]!==ee[W];)W--;for(;Q>=1&&W>=0;Q--,W--)if(A[Q]!==ee[W]){if(Q!==1||W!==1)do if(Q--,W--,W<0||A[Q]!==ee[W]){var ie=`
21
- `+A[Q].replace(" at new "," at ");return c.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",c.displayName)),typeof c=="function"&&wt.set(c,ie),ie}while(Q>=1&&W>=0);break}}}finally{Gt=!1,qt.current=q,Qs(),Error.prepareStackTrace=R}var Ee=c?c.displayName||c.name:"",be=Ee?bt(Ee):"";return typeof c=="function"&&wt.set(c,be),be}function Hs(c,m,v){return En(c,!1)}function Ys(c){var m=c.prototype;return!!(m&&m.isReactComponent)}function jt(c,m,v){if(c==null)return"";if(typeof c=="function")return En(c,Ys(c));if(typeof c=="string")return bt(c);switch(c){case d:return bt("Suspense");case g:return bt("SuspenseList")}if(typeof c=="object")switch(c.$$typeof){case u:return Hs(c.render);case h:return jt(c.type,m,v);case w:{var E=c,R=E._payload,q=E._init;try{return jt(q(R),m,v)}catch{}}}return""}var We=Object.prototype.hasOwnProperty,Nn={},kn=y.ReactDebugCurrentFrame;function St(c){if(c){var m=c._owner,v=jt(c.type,c._source,m?m.type:null);kn.setExtraStackFrame(v)}else kn.setExtraStackFrame(null)}function Xs(c,m,v,E,R){{var q=Function.call.bind(We);for(var P in c)if(q(c,P)){var A=void 0;try{if(typeof c[P]!="function"){var ee=Error((E||"React class")+": "+v+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ee.name="Invariant Violation",ee}A=c[P](m,P,E,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Q){A=Q}A&&!(A instanceof Error)&&(St(R),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",v,P,typeof A),St(null)),A instanceof Error&&!(A.message in Nn)&&(Nn[A.message]=!0,St(R),j("Failed %s type: %s",v,A.message),St(null))}}}var Js=Array.isArray;function Vt(c){return Js(c)}function Zs(c){{var m=typeof Symbol=="function"&&Symbol.toStringTag,v=m&&c[Symbol.toStringTag]||c.constructor.name||"Object";return v}}function er(c){try{return Tn(c),!1}catch{return!0}}function Tn(c){return""+c}function An(c){if(er(c))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Zs(c)),Tn(c)}var He=y.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},Pn,On,Kt;Kt={};function nr(c){if(We.call(c,"ref")){var m=Object.getOwnPropertyDescriptor(c,"ref").get;if(m&&m.isReactWarning)return!1}return c.ref!==void 0}function sr(c){if(We.call(c,"key")){var m=Object.getOwnPropertyDescriptor(c,"key").get;if(m&&m.isReactWarning)return!1}return c.key!==void 0}function rr(c,m){if(typeof c.ref=="string"&&He.current&&m&&He.current.stateNode!==m){var v=re(He.current.type);Kt[v]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',re(He.current.type),c.ref),Kt[v]=!0)}}function ir(c,m){{var v=function(){Pn||(Pn=!0,j("%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://reactjs.org/link/special-props)",m))};v.isReactWarning=!0,Object.defineProperty(c,"key",{get:v,configurable:!0})}}function ar(c,m){{var v=function(){On||(On=!0,j("%s: `ref` 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://reactjs.org/link/special-props)",m))};v.isReactWarning=!0,Object.defineProperty(c,"ref",{get:v,configurable:!0})}}var or=function(c,m,v,E,R,q,P){var A={$$typeof:t,type:c,key:m,ref:v,props:P,_owner:q};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function lr(c,m,v,E,R){{var q,P={},A=null,ee=null;v!==void 0&&(An(v),A=""+v),sr(m)&&(An(m.key),A=""+m.key),nr(m)&&(ee=m.ref,rr(m,R));for(q in m)We.call(m,q)&&!tr.hasOwnProperty(q)&&(P[q]=m[q]);if(c&&c.defaultProps){var Q=c.defaultProps;for(q in Q)P[q]===void 0&&(P[q]=Q[q])}if(A||ee){var W=typeof c=="function"?c.displayName||c.name||"Unknown":c;A&&ir(P,W),ee&&ar(P,W)}return or(c,A,ee,R,E,He.current,P)}}var zt=y.ReactCurrentOwner,Dn=y.ReactDebugCurrentFrame;function Ce(c){if(c){var m=c._owner,v=jt(c.type,c._source,m?m.type:null);Dn.setExtraStackFrame(v)}else Dn.setExtraStackFrame(null)}var Qt;Qt=!1;function Wt(c){return typeof c=="object"&&c!==null&&c.$$typeof===t}function Rn(){{if(zt.current){var c=re(zt.current.type);if(c)return`
21
+ `+A[Q].replace(" at new "," at ");return c.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",c.displayName)),typeof c=="function"&&wt.set(c,ie),ie}while(Q>=1&&W>=0);break}}}finally{Gt=!1,qt.current=q,Qs(),Error.prepareStackTrace=R}var Ee=c?c.displayName||c.name:"",be=Ee?bt(Ee):"";return typeof c=="function"&&wt.set(c,be),be}function Hs(c,m,v){return En(c,!1)}function Ys(c){var m=c.prototype;return!!(m&&m.isReactComponent)}function jt(c,m,v){if(c==null)return"";if(typeof c=="function")return En(c,Ys(c));if(typeof c=="string")return bt(c);switch(c){case d:return bt("Suspense");case g:return bt("SuspenseList")}if(typeof c=="object")switch(c.$$typeof){case u:return Hs(c.render);case h:return jt(c.type,m,v);case j:{var E=c,R=E._payload,q=E._init;try{return jt(q(R),m,v)}catch{}}}return""}var We=Object.prototype.hasOwnProperty,Nn={},kn=y.ReactDebugCurrentFrame;function St(c){if(c){var m=c._owner,v=jt(c.type,c._source,m?m.type:null);kn.setExtraStackFrame(v)}else kn.setExtraStackFrame(null)}function Xs(c,m,v,E,R){{var q=Function.call.bind(We);for(var P in c)if(q(c,P)){var A=void 0;try{if(typeof c[P]!="function"){var ee=Error((E||"React class")+": "+v+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ee.name="Invariant Violation",ee}A=c[P](m,P,E,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Q){A=Q}A&&!(A instanceof Error)&&(St(R),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",v,P,typeof A),St(null)),A instanceof Error&&!(A.message in Nn)&&(Nn[A.message]=!0,St(R),b("Failed %s type: %s",v,A.message),St(null))}}}var Js=Array.isArray;function Vt(c){return Js(c)}function Zs(c){{var m=typeof Symbol=="function"&&Symbol.toStringTag,v=m&&c[Symbol.toStringTag]||c.constructor.name||"Object";return v}}function er(c){try{return Tn(c),!1}catch{return!0}}function Tn(c){return""+c}function An(c){if(er(c))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Zs(c)),Tn(c)}var He=y.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},Pn,On,Kt;Kt={};function nr(c){if(We.call(c,"ref")){var m=Object.getOwnPropertyDescriptor(c,"ref").get;if(m&&m.isReactWarning)return!1}return c.ref!==void 0}function sr(c){if(We.call(c,"key")){var m=Object.getOwnPropertyDescriptor(c,"key").get;if(m&&m.isReactWarning)return!1}return c.key!==void 0}function rr(c,m){if(typeof c.ref=="string"&&He.current&&m&&He.current.stateNode!==m){var v=re(He.current.type);Kt[v]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',re(He.current.type),c.ref),Kt[v]=!0)}}function ir(c,m){{var v=function(){Pn||(Pn=!0,b("%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://reactjs.org/link/special-props)",m))};v.isReactWarning=!0,Object.defineProperty(c,"key",{get:v,configurable:!0})}}function ar(c,m){{var v=function(){On||(On=!0,b("%s: `ref` 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://reactjs.org/link/special-props)",m))};v.isReactWarning=!0,Object.defineProperty(c,"ref",{get:v,configurable:!0})}}var or=function(c,m,v,E,R,q,P){var A={$$typeof:t,type:c,key:m,ref:v,props:P,_owner:q};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function lr(c,m,v,E,R){{var q,P={},A=null,ee=null;v!==void 0&&(An(v),A=""+v),sr(m)&&(An(m.key),A=""+m.key),nr(m)&&(ee=m.ref,rr(m,R));for(q in m)We.call(m,q)&&!tr.hasOwnProperty(q)&&(P[q]=m[q]);if(c&&c.defaultProps){var Q=c.defaultProps;for(q in Q)P[q]===void 0&&(P[q]=Q[q])}if(A||ee){var W=typeof c=="function"?c.displayName||c.name||"Unknown":c;A&&ir(P,W),ee&&ar(P,W)}return or(c,A,ee,R,E,He.current,P)}}var zt=y.ReactCurrentOwner,Dn=y.ReactDebugCurrentFrame;function Ce(c){if(c){var m=c._owner,v=jt(c.type,c._source,m?m.type:null);Dn.setExtraStackFrame(v)}else Dn.setExtraStackFrame(null)}var Qt;Qt=!1;function Wt(c){return typeof c=="object"&&c!==null&&c.$$typeof===t}function Rn(){{if(zt.current){var c=re(zt.current.type);if(c)return`
22
22
 
23
23
  Check the render method of \``+c+"`."}return""}}function cr(c){return""}var In={};function ur(c){{var m=Rn();if(!m){var v=typeof c=="string"?c:c.displayName||c.name;v&&(m=`
24
24
 
25
- Check the top-level render call using <`+v+">.")}return m}}function _n(c,m){{if(!c._store||c._store.validated||c.key!=null)return;c._store.validated=!0;var v=ur(m);if(In[v])return;In[v]=!0;var E="";c&&c._owner&&c._owner!==zt.current&&(E=" It was passed a child from "+re(c._owner.type)+"."),Ce(c),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,E),Ce(null)}}function Ln(c,m){{if(typeof c!="object")return;if(Vt(c))for(var v=0;v<c.length;v++){var E=c[v];Wt(E)&&_n(E,m)}else if(Wt(c))c._store&&(c._store.validated=!0);else if(c){var R=b(c);if(typeof R=="function"&&R!==c.entries)for(var q=R.call(c),P;!(P=q.next()).done;)Wt(P.value)&&_n(P.value,m)}}}function fr(c){{var m=c.type;if(m==null||typeof m=="string")return;var v;if(typeof m=="function")v=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===u||m.$$typeof===h))v=m.propTypes;else return;if(v){var E=re(m);Xs(v,c.props,"prop",E,c)}else if(m.PropTypes!==void 0&&!Qt){Qt=!0;var R=re(m);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(c){{for(var m=Object.keys(c.props),v=0;v<m.length;v++){var E=m[v];if(E!=="children"&&E!=="key"){Ce(c),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",E),Ce(null);break}}c.ref!==null&&(Ce(c),j("Invalid attribute `ref` supplied to `React.Fragment`."),Ce(null))}}var Fn={};function Mn(c,m,v,E,R,q){{var P=V(c);if(!P){var A="";(c===void 0||typeof c=="object"&&c!==null&&Object.keys(c).length===0)&&(A+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ee=cr();ee?A+=ee:A+=Rn();var Q;c===null?Q="null":Vt(c)?Q="array":c!==void 0&&c.$$typeof===t?(Q="<"+(re(c.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof c,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,A)}var W=lr(c,m,v,R,q);if(W==null)return W;if(P){var ie=m.children;if(ie!==void 0)if(E)if(Vt(ie)){for(var Ee=0;Ee<ie.length;Ee++)Ln(ie[Ee],c);Object.freeze&&Object.freeze(ie)}else j("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 Ln(ie,c)}if(We.call(m,"key")){var be=re(c),ne=Object.keys(m).filter(function(vr){return vr!=="key"}),Ht=ne.length>0?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}";if(!Fn[be+Ht]){var pr=ne.length>0?"{"+ne.join(": ..., ")+": ...}":"{}";j(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+v+">.")}return m}}function _n(c,m){{if(!c._store||c._store.validated||c.key!=null)return;c._store.validated=!0;var v=ur(m);if(In[v])return;In[v]=!0;var E="";c&&c._owner&&c._owner!==zt.current&&(E=" It was passed a child from "+re(c._owner.type)+"."),Ce(c),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,E),Ce(null)}}function Ln(c,m){{if(typeof c!="object")return;if(Vt(c))for(var v=0;v<c.length;v++){var E=c[v];Wt(E)&&_n(E,m)}else if(Wt(c))c._store&&(c._store.validated=!0);else if(c){var R=w(c);if(typeof R=="function"&&R!==c.entries)for(var q=R.call(c),P;!(P=q.next()).done;)Wt(P.value)&&_n(P.value,m)}}}function fr(c){{var m=c.type;if(m==null||typeof m=="string")return;var v;if(typeof m=="function")v=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===u||m.$$typeof===h))v=m.propTypes;else return;if(v){var E=re(m);Xs(v,c.props,"prop",E,c)}else if(m.PropTypes!==void 0&&!Qt){Qt=!0;var R=re(m);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(c){{for(var m=Object.keys(c.props),v=0;v<m.length;v++){var E=m[v];if(E!=="children"&&E!=="key"){Ce(c),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",E),Ce(null);break}}c.ref!==null&&(Ce(c),b("Invalid attribute `ref` supplied to `React.Fragment`."),Ce(null))}}var Fn={};function Mn(c,m,v,E,R,q){{var P=V(c);if(!P){var A="";(c===void 0||typeof c=="object"&&c!==null&&Object.keys(c).length===0)&&(A+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ee=cr();ee?A+=ee:A+=Rn();var Q;c===null?Q="null":Vt(c)?Q="array":c!==void 0&&c.$$typeof===t?(Q="<"+(re(c.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof c,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,A)}var W=lr(c,m,v,R,q);if(W==null)return W;if(P){var ie=m.children;if(ie!==void 0)if(E)if(Vt(ie)){for(var Ee=0;Ee<ie.length;Ee++)Ln(ie[Ee],c);Object.freeze&&Object.freeze(ie)}else b("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 Ln(ie,c)}if(We.call(m,"key")){var be=re(c),ne=Object.keys(m).filter(function(vr){return vr!=="key"}),Ht=ne.length>0?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}";if(!Fn[be+Ht]){var pr=ne.length>0?"{"+ne.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Ht,be,pr,be),Fn[be+Ht]=!0}}return c===s?dr(W):fr(W),W}}function hr(c,m,v){return Mn(c,m,v,!0)}function gr(c,m,v){return Mn(c,m,v,!1)}var mr=gr,yr=hr;Xe.Fragment=s,Xe.jsx=mr,Xe.jsxs=yr}()),Xe}process.env.NODE_ENV==="production"?en.exports=wr():en.exports=jr();var i=en.exports,T={context:void 0,registry:void 0,getContextId(){return Gn(this.context.count)},getNextContextId(){return Gn(this.context.count++)}};function Gn(e){const t=String(e),n=t.length-1;return T.context.id+(n?String.fromCharCode(96+n):"")+t}function Je(e){T.context=e}var Sr=(e,t)=>e===t,Tt=Symbol("solid-proxy"),dn=Symbol("solid-track"),At={equals:Sr},ts=os,de=1,Pt=2,ns={owned:null,cleanups:null,context:null,owner:null},Yt={},D=null,Xt=null,Cr=null,L=null,X=null,fe=null,Lt=0;function me(e,t){const n=L,s=D,r=e.length===0,a=t===void 0?s:t,o=r?ns:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=r?e:()=>e(()=>Y(()=>Mt(o)));D=o,L=null;try{return ce(l,!0)}finally{L=n,D=s}}function K(e,t){t=t?Object.assign({},At,t):At;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=r=>(typeof r=="function"&&(r=r(n.value)),as(n,r));return[is.bind(n),s]}function tn(e,t,n){const s=Ft(e,t,!0,de);ze(s)}function ye(e,t,n){const s=Ft(e,t,!1,de);ze(s)}function hn(e,t,n){ts=Mr;const s=Ft(e,t,!1,de);(!n||!n.render)&&(s.user=!0),fe?fe.push(s):ze(s)}function te(e,t,n){n=n?Object.assign({},At,n):At;const s=Ft(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,ze(s),is.bind(s)}function Er(e){return e&&typeof e=="object"&&"then"in e}function Nr(e,t,n){let s,r,a;arguments.length===2&&typeof t=="object"||arguments.length===1?(s=!0,r=e,a={}):(s=e,r=t,a={});let o=null,l=Yt,u=null,d=!1,g="initialValue"in a,h=typeof s=="function"&&te(s);const w=new Set,[S,C]=(a.storage||K)(a.initialValue),[x,b]=K(void 0),[y,j]=K(void 0,{equals:!1}),[O,$]=K(g?"ready":"unresolved");if(T.context){u=T.getNextContextId();let U;a.ssrLoadFrom==="initial"?l=a.initialValue:T.load&&(U=T.load(u))&&(l=U)}function B(U,V,G,ae){return o===U&&(o=null,ae!==void 0&&(g=!0),(U===l||V===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(ae,{value:V})),l=Yt,he(V,G)),V}function he(U,V){ce(()=>{V===void 0&&C(()=>U),$(V!==void 0?"errored":g?"ready":"unresolved"),b(V);for(const G of w.keys())G.decrement();w.clear()},!1)}function ve(){const U=_r,V=S(),G=x();if(G!==void 0&&!o)throw G;return L&&!L.user&&U&&tn(()=>{y(),o&&(U.resolved||w.has(U)||(U.increment(),w.add(U)))}),V}function ge(U=!0){if(U!==!1&&d)return;d=!1;const V=h?h():s;if(V==null||V===!1){B(o,Y(S));return}const G=l!==Yt?l:Y(()=>r(V,{value:S(),refetching:U}));return Er(G)?(o=G,"value"in G?(G.status==="success"?B(o,G.value,void 0,V):B(o,void 0,nn(G.value),V),G):(d=!0,queueMicrotask(()=>d=!1),ce(()=>{$(g?"refreshing":"pending"),j()},!1),G.then(ae=>B(G,ae,void 0,V),ae=>B(G,void 0,nn(ae),V)))):(B(o,G,void 0,V),G)}return Object.defineProperties(ve,{state:{get:()=>O()},error:{get:()=>x()},loading:{get(){const U=O();return U==="pending"||U==="refreshing"}},latest:{get(){if(!g)return ve();const U=x();if(U&&!o)throw U;return S()}}}),h?tn(()=>ge(!1)):ge(!1),[ve,{refetch:ge,mutate:C}]}function kr(e){return ce(e,!1)}function Y(e){if(L===null)return e();const t=L;L=null;try{return e()}finally{L=t}}function Tr(e,t,n){const s=Array.isArray(e);let r,a=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let d=0;d<e.length;d++)l[d]=e[d]()}else l=e();if(a)return a=!1,o;const u=Y(()=>t(l,r,o));return r=l,u}}function ss(e){hn(()=>Y(e))}function Ge(e){return D===null||(D.cleanups===null?D.cleanups=[e]:D.cleanups.push(e)),e}function Vn(){return D}function Ar(e,t){const n=D,s=L;D=e,L=null;try{return ce(t,!0)}catch(r){gn(r)}finally{D=n,L=s}}function Pr(e){const t=L,n=D;return Promise.resolve().then(()=>{L=t,D=n;let s;return ce(e,!1),L=D=null,s?s.done:void 0})}var[Or,Ba]=K(!1);function Dr(){return[Or,Pr]}function Rr(e,t){const n=Symbol("context");return{id:n,Provider:Br(n),defaultValue:e}}function Ir(e){let t;return D&&D.context&&(t=D.context[e.id])!==void 0?t:e.defaultValue}function rs(e){const t=te(e),n=te(()=>sn(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var _r;function is(){if(this.sources&&this.state)if(this.state===de)ze(this);else{const e=X;X=null,ce(()=>Dt(this),!1),X=e}if(L){const e=this.observers?this.observers.length:0;L.sources?(L.sources.push(this),L.sourceSlots.push(e)):(L.sources=[this],L.sourceSlots=[e]),this.observers?(this.observers.push(L),this.observerSlots.push(L.sources.length-1)):(this.observers=[L],this.observerSlots=[L.sources.length-1])}return this.value}function as(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&ce(()=>{for(let r=0;r<e.observers.length;r+=1){const a=e.observers[r],o=Xt&&Xt.running;o&&Xt.disposed.has(a),(o?!a.tState:!a.state)&&(a.pure?X.push(a):fe.push(a),a.observers&&ls(a)),o||(a.state=de)}if(X.length>1e6)throw X=[],new Error},!1)),t}function ze(e){if(!e.fn)return;Mt(e);const t=Lt;Lr(e,e.value,t)}function Lr(e,t,n){let s;const r=D,a=L;L=D=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=de,e.owned&&e.owned.forEach(Mt),e.owned=null),e.updatedAt=n+1,gn(o)}finally{L=a,D=r}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?as(e,s):e.value=s,e.updatedAt=n)}function Ft(e,t,n,s=de,r){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:D,context:D?D.context:null,pure:n};return D===null||D!==ns&&(D.owned?D.owned.push(a):D.owned=[a]),a}function Ot(e){if(e.state===0)return;if(e.state===Pt)return Dt(e);if(e.suspense&&Y(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Lt);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===de)ze(e);else if(e.state===Pt){const s=X;X=null,ce(()=>Dt(e,t[0]),!1),X=s}}function ce(e,t){if(X)return e();let n=!1;t||(X=[]),fe?n=!0:fe=[],Lt++;try{const s=e();return Fr(n),s}catch(s){n||(fe=null),X=null,gn(s)}}function Fr(e){if(X&&(os(X),X=null),e)return;const t=fe;fe=null,t.length&&ce(()=>ts(t),!1)}function os(e){for(let t=0;t<e.length;t++)Ot(e[t])}function Mr(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:Ot(s)}if(T.context){if(T.count){T.effects||(T.effects=[]),T.effects.push(...e.slice(0,n));return}else T.effects&&(e=[...T.effects,...e],n+=T.effects.length,delete T.effects);Je()}for(t=0;t<n;t++)Ot(e[t])}function Dt(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const r=s.state;r===de?s!==t&&(!s.updatedAt||s.updatedAt<Lt)&&Ot(s):r===Pt&&Dt(s,t)}}}function ls(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Pt,n.pure?X.push(n):fe.push(n),n.observers&&ls(n))}}function Mt(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const a=r.pop(),o=n.observerSlots.pop();s<r.length&&(a.sourceSlots[o]=s,r[s]=a,n.observerSlots[s]=o)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Mt(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function nn(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function gn(e,t=D){throw nn(e)}function sn(e){if(typeof e=="function"&&!e.length)return sn(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=sn(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function Br(e,t){return function(s){let r;return ye(()=>r=Y(()=>(D.context={...D.context,[e]:s.value},rs(()=>s.children))),void 0),r}}var rn=Symbol("fallback");function Rt(e){for(let t=0;t<e.length;t++)e[t]()}function Ur(e,t,n={}){let s=[],r=[],a=[],o=0,l=t.length>1?[]:null;return Ge(()=>Rt(a)),()=>{let u=e()||[],d=u.length,g,h;return u[dn],Y(()=>{let S,C,x,b,y,j,O,$,B;if(d===0)o!==0&&(Rt(a),a=[],s=[],r=[],o=0,l&&(l=[])),n.fallback&&(s=[rn],r[0]=me(he=>(a[0]=he,n.fallback())),o=1);else if(o===0){for(r=new Array(d),h=0;h<d;h++)s[h]=u[h],r[h]=me(w);o=d}else{for(x=new Array(d),b=new Array(d),l&&(y=new Array(d)),j=0,O=Math.min(o,d);j<O&&s[j]===u[j];j++);for(O=o-1,$=d-1;O>=j&&$>=j&&s[O]===u[$];O--,$--)x[$]=r[O],b[$]=a[O],l&&(y[$]=l[O]);for(S=new Map,C=new Array($+1),h=$;h>=j;h--)B=u[h],g=S.get(B),C[h]=g===void 0?-1:g,S.set(B,h);for(g=j;g<=O;g++)B=s[g],h=S.get(B),h!==void 0&&h!==-1?(x[h]=r[g],b[h]=a[g],l&&(y[h]=l[g]),h=C[h],S.set(B,h)):a[g]();for(h=j;h<d;h++)h in x?(r[h]=x[h],a[h]=b[h],l&&(l[h]=y[h],l[h](h))):r[h]=me(w);r=r.slice(0,o=d),s=u.slice(0)}return r});function w(S){if(a[h]=S,l){const[C,x]=K(h);return l[h]=x,t(u[h],C)}return t(u[h])}}}function qr(e,t,n={}){let s=[],r=[],a=[],o=[],l=0,u;return Ge(()=>Rt(a)),()=>{const d=e()||[],g=d.length;return d[dn],Y(()=>{if(g===0)return l!==0&&(Rt(a),a=[],s=[],r=[],l=0,o=[]),n.fallback&&(s=[rn],r[0]=me(w=>(a[0]=w,n.fallback())),l=1),r;for(s[0]===rn&&(a[0](),a=[],s=[],r=[],l=0),u=0;u<g;u++)u<s.length&&s[u]!==d[u]?o[u](()=>d[u]):u>=s.length&&(r[u]=me(h));for(;u<s.length;u++)a[u]();return l=o.length=a.length=g,s=d.slice(0),r=r.slice(0,l)});function h(w){a[u]=w;const[S,C]=K(d[u]);return o[u]=C,t(S,u)}}}function mn(e,t){return Y(()=>e(t||{}))}function Ct(){return!0}var an={get(e,t,n){return t===Tt?n:e.get(t)},has(e,t){return t===Tt?!0:e.has(t)},set:Ct,deleteProperty:Ct,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Ct,deleteProperty:Ct}},ownKeys(e){return e.keys()}};function Jt(e){return(e=typeof e=="function"?e():e)?e:{}}function $r(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function yn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Tt in l,e[o]=typeof l=="function"?(t=!0,te(l)):l}if(t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const u=Jt(e[l])[o];if(u!==void 0)return u}},has(o){for(let l=e.length-1;l>=0;l--)if(o in Jt(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(Jt(e[l])));return[...new Set(o)]}},an);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const u=Object.getOwnPropertyNames(l);for(let d=u.length-1;d>=0;d--){const g=u[d];if(g==="__proto__"||g==="constructor")continue;const h=Object.getOwnPropertyDescriptor(l,g);if(!s[g])s[g]=h.get?{enumerable:!0,configurable:!0,get:$r.bind(n[g]=[h.get.bind(l)])}:h.value!==void 0?h:void 0;else{const w=n[g];w&&(h.get?w.push(h.get.bind(l)):h.value!==void 0&&w.push(()=>h.value))}}}const r={},a=Object.keys(s);for(let o=a.length-1;o>=0;o--){const l=a[o],u=s[l];u&&u.get?Object.defineProperty(r,l,u):r[l]=u?u.value:void 0}return r}function cs(e,...t){if(Tt in e){const r=new Set(t.length>1?t.flat():t[0]),a=t.map(o=>new Proxy({get(l){return o.includes(l)?e[l]:void 0},has(l){return o.includes(l)&&l in e},keys(){return o.filter(l=>l in e)}},an));return a.push(new Proxy({get(o){return r.has(o)?void 0:e[o]},has(o){return r.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!r.has(o))}},an)),a}const n={},s=t.map(()=>({}));for(const r of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,r),o=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let l=!1,u=0;for(const d of t)d.includes(r)&&(l=!0,o?s[u][r]=a.value:Object.defineProperty(s[u],r,a)),++u;l||(o?n[r]=a.value:Object.defineProperty(n,r,a))}return[...s,n]}function us(e){let t,n;const s=r=>{const a=T.context;if(a){const[l,u]=K();T.count||(T.count=0),T.count++,(n||(n=e())).then(d=>{Je(a),T.count--,u(()=>d.default),Je()}),t=l}else if(!t){const[l]=Nr(()=>(n||(n=e())).then(u=>u.default));t=l}let o;return te(()=>(o=t())&&Y(()=>{if(!a)return o(r);const l=T.context;Je(a);const u=o(r);return Je(l),u}))};return s.preload=()=>n||((n=e()).then(r=>t=()=>r.default),n),s}var Gr=0;function Vr(){return T.context?T.getNextContextId():`cl-${Gr++}`}var fs=e=>`Stale read from <${e}>.`;function Kr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return te(Ur(()=>e.each,e.children,t||void 0))}function zr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return te(qr(()=>e.each,e.children,t||void 0))}function Qr(e){const t=e.keyed,n=te(()=>e.when,void 0,{equals:(s,r)=>t?s===r:!s==!r});return te(()=>{const s=n();if(s){const r=e.children;return typeof r=="function"&&r.length>0?Y(()=>r(t?s:()=>{if(!Y(n))throw fs("Show");return e.when})):r}return e.fallback},void 0,void 0)}function Wr(e){let t=!1;const n=(a,o)=>(t?a[1]===o[1]:!a[1]==!o[1])&&a[2]===o[2],s=rs(()=>e.children),r=te(()=>{let a=s();Array.isArray(a)||(a=[a]);for(let o=0;o<a.length;o++){const l=a[o].when;if(l)return t=!!a[o].keyed,[o,l,a[o]]}return[-1]},void 0,{equals:n});return te(()=>{const[a,o,l]=r();if(a<0)return e.fallback;const u=l.children;return typeof u=="function"&&u.length>0?Y(()=>u(t?o:()=>{if(Y(r)[0]!==a)throw fs("Match");return l.when})):u},void 0,void 0)}function Hr(e){return e}var Yr=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Xr=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Yr]),Jr=new Set(["innerHTML","textContent","innerText","children"]),Zr=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ei=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ti(e,t){const n=ei[e];return typeof n=="object"?n[t]?n.$:void 0:n}var ni=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),si=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),ri={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function ii(e,t,n){let s=n.length,r=t.length,a=s,o=0,l=0,u=t[r-1].nextSibling,d=null;for(;o<r||l<a;){if(t[o]===n[l]){o++,l++;continue}for(;t[r-1]===n[a-1];)r--,a--;if(r===o){const g=a<s?l?n[l-1].nextSibling:n[a-l]:u;for(;l<a;)e.insertBefore(n[l++],g)}else if(a===l)for(;o<r;)(!d||!d.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[l]===t[r-1]){const g=t[--r].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--a],g),t[r]=n[a]}else{if(!d){d=new Map;let h=l;for(;h<a;)d.set(n[h],h++)}const g=d.get(t[o]);if(g!=null)if(l<g&&g<a){let h=o,w=1,S;for(;++h<r&&h<a&&!((S=d.get(t[h]))==null||S!==g+w);)w++;if(w>g-l){const C=t[o];for(;l<g;)e.insertBefore(n[l++],C)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var tt="_$DX_DELEGATE";function ds(e,t,n,s={}){let r;return me(a=>{r=a,t===document?e():_t(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{r(),t.textContent=""}}function ai(e,t,n){let s;const r=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},a=()=>(s||(s=r())).cloneNode(!0);return a.cloneNode=a,a}function hs(e,t=window.document){const n=t[tt]||(t[tt]=new Set);for(let s=0,r=e.length;s<r;s++){const a=e[s];n.has(a)||(n.add(a),t.addEventListener(a,vs))}}function oi(e=window.document){if(e[tt]){for(let t of e[tt].keys())e.removeEventListener(t,vs);delete e[tt]}}function It(e,t,n){T.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function li(e,t,n,s){T.context&&e.isConnected||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function gs(e,t){T.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function ms(e,t,n,s){if(s)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const r=n[0];e.addEventListener(t,n[0]=a=>r.call(e,n[1],a))}else e.addEventListener(t,n)}function ci(e,t,n={}){const s=Object.keys(t||{}),r=Object.keys(n);let a,o;for(a=0,o=r.length;a<o;a++){const l=r[a];!l||l==="undefined"||t[l]||(Kn(e,l,!1),delete n[l])}for(a=0,o=s.length;a<o;a++){const l=s[a],u=!!t[l];!l||l==="undefined"||n[l]===u||!u||(Kn(e,l,!0),n[l]=u)}return n}function ui(e,t,n){if(!t)return n?It(e,"style"):t;const s=e.style;if(typeof t=="string")return s.cssText=t;typeof n=="string"&&(s.cssText=n=void 0),n||(n={}),t||(t={});let r,a;for(a in n)t[a]==null&&s.removeProperty(a),delete n[a];for(a in t)r=t[a],r!==n[a]&&(s.setProperty(a,r),n[a]=r);return n}function ys(e,t={},n,s){const r={};return s||ye(()=>r.children=st(e,t.children,r.children)),ye(()=>typeof t.ref=="function"&&ps(t.ref,e)),ye(()=>fi(e,t,n,!0,r,!0)),r}function ps(e,t,n){return Y(()=>e(t,n))}function _t(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return st(e,t,s,n);ye(r=>st(e,t(),r,n),s)}function fi(e,t,n,s,r={},a=!1){t||(t={});for(const o in r)if(!(o in t)){if(o==="children")continue;r[o]=zn(e,o,null,r[o],n,a)}for(const o in t){if(o==="children")continue;const l=t[o];r[o]=zn(e,o,l,r[o],n,a)}}function di(e){let t,n;return!T.context||!(t=T.registry.get(n=gi()))?e():(T.completed&&T.completed.add(t),T.registry.delete(n),t)}function hi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Kn(e,t,n){const s=t.trim().split(/\s+/);for(let r=0,a=s.length;r<a;r++)e.classList.toggle(s[r],n)}function zn(e,t,n,s,r,a){let o,l,u,d,g;if(t==="style")return ui(e,n,s);if(t==="classList")return ci(e,n,s);if(n===s)return s;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const h=t.slice(3);s&&e.removeEventListener(h,s),n&&e.addEventListener(h,n)}else if(t.slice(0,10)==="oncapture:"){const h=t.slice(10);s&&e.removeEventListener(h,s,!0),n&&e.addEventListener(h,n,!0)}else if(t.slice(0,2)==="on"){const h=t.slice(2).toLowerCase(),w=ni.has(h);if(!w&&s){const S=Array.isArray(s)?s[0]:s;e.removeEventListener(h,S)}(w||n)&&(ms(e,h,n,w),w&&hs([h]))}else if(t.slice(0,5)==="attr:")It(e,t.slice(5),n);else if((g=t.slice(0,5)==="prop:")||(u=Jr.has(t))||!r&&((d=ti(t,e.tagName))||(l=Xr.has(t)))||(o=e.nodeName.includes("-"))){if(g)t=t.slice(5),l=!0;else if(T.context&&e.isConnected)return n;t==="class"||t==="className"?gs(e,n):o&&!l&&!u?e[hi(t)]=n:e[d||t]=n}else{const h=r&&t.indexOf(":")>-1&&ri[t.split(":")[0]];h?li(e,h,t,n):It(e,Zr[t]||t,n)}return n}function vs(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),T.registry&&!T.done&&(T.done=_$HY.done=!0);n;){const s=n[t];if(s&&!n.disabled){const r=n[`${t}Data`];if(r!==void 0?s.call(n,r,e):s.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function st(e,t,n,s,r){const a=!!T.context&&e.isConnected;if(a){!n&&(n=[...e.childNodes]);let u=[];for(let d=0;d<n.length;d++){const g=n[d];g.nodeType===8&&g.data.slice(0,2)==="!$"?g.remove():u.push(g)}n=u}for(;typeof n=="function";)n=n();if(t===n)return n;const o=typeof t,l=s!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(a||o==="number"&&(t=t.toString(),t===n))return n;if(l){let u=n[0];u&&u.nodeType===3?u.data!==t&&(u.data=t):u=document.createTextNode(t),n=Ne(e,n,s,u)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(a)return n;n=Ne(e,n,s)}else{if(o==="function")return ye(()=>{let u=t();for(;typeof u=="function";)u=u();n=st(e,u,n,s)}),()=>n;if(Array.isArray(t)){const u=[],d=n&&Array.isArray(n);if(on(u,t,n,r))return ye(()=>n=st(e,u,n,s,!0)),()=>n;if(a){if(!u.length)return n;if(s===void 0)return[...e.childNodes];let g=u[0],h=[g];for(;(g=g.nextSibling)!==s;)h.push(g);return n=h}if(u.length===0){if(n=Ne(e,n,s),l)return n}else d?n.length===0?Qn(e,u,s):ii(e,n,u):(n&&Ne(e),Qn(e,u));n=u}else if(t.nodeType){if(a&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=Ne(e,n,s,t);Ne(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function on(e,t,n,s){let r=!1;for(let a=0,o=t.length;a<o;a++){let l=t[a],u=n&&n[e.length],d;if(!(l==null||l===!0||l===!1))if((d=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))r=on(e,l,u)||r;else if(d==="function")if(s){for(;typeof l=="function";)l=l();r=on(e,Array.isArray(l)?l:[l],Array.isArray(u)?u:[u])||r}else e.push(l),r=!0;else{const g=String(l);u&&u.nodeType===3&&u.data===g?e.push(u):e.push(document.createTextNode(g))}}return r}function Qn(e,t,n=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],n)}function Ne(e,t,n,s){if(n===void 0)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let a=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(r!==l){const u=l.parentNode===e;!a&&!o?u?e.replaceChild(r,l):e.insertBefore(r,n):u&&l.remove()}else a=!0}}else e.insertBefore(r,n);return[r]}function gi(){return T.getNextContextId()}var mi="http://www.w3.org/2000/svg";function xs(e,t=!1){return t?document.createElementNS(mi,e):document.createElement(e)}function yi(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,r=Vn();let a,o=!!T.context;return hn(()=>{o&&(Vn().user=o=!1),a||(a=Ar(r,()=>te(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[u,d]=K(!1),g=()=>d(!0);me(h=>_t(l,()=>u()?h():a(),null)),Ge(g)}else{const u=xs(e.isSVG?"g":"div",e.isSVG),d=t&&u.attachShadow?u.attachShadow({mode:"open"}):u;Object.defineProperty(u,"_$host",{get(){return n.parentNode},configurable:!0}),_t(d,a),l.appendChild(u),e.ref&&e.ref(u),Ge(()=>l.removeChild(u))}},void 0,{render:!o}),n}function pi(e){const[t,n]=cs(e,["component"]),s=te(()=>t.component);return te(()=>{const r=s();switch(typeof r){case"function":return Y(()=>r(n));case"string":const a=si.has(r),o=T.context?di():xs(r,a);return ys(o,n,a),o}})}var vi=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},bs=class{constructor(e){this.generateIdentifier=e,this.kv=new vi}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},xi=class extends bs{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function bi(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function wi(e,t){const n=bi(e);if("find"in n)return n.find(t);const s=n;for(let r=0;r<s.length;r++){const a=s[r];if(t(a))return a}}function Ve(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function kt(e,t){return e.indexOf(t)!==-1}function Wn(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var ji=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return wi(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Si=e=>Object.prototype.toString.call(e).slice(8,-1),ws=e=>typeof e>"u",Ci=e=>e===null,rt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,ln=e=>rt(e)&&Object.keys(e).length===0,pe=e=>Array.isArray(e),Ei=e=>typeof e=="string",Ni=e=>typeof e=="number"&&!isNaN(e),ki=e=>typeof e=="boolean",Ti=e=>e instanceof RegExp,it=e=>e instanceof Map,at=e=>e instanceof Set,js=e=>Si(e)==="Symbol",Ai=e=>e instanceof Date&&!isNaN(e.valueOf()),Pi=e=>e instanceof Error,Hn=e=>typeof e=="number"&&isNaN(e),Oi=e=>ki(e)||Ci(e)||ws(e)||Ni(e)||Ei(e)||js(e),Di=e=>typeof e=="bigint",Ri=e=>e===1/0||e===-1/0,Ii=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),_i=e=>e instanceof URL,Ss=e=>e.replace(/\./g,"\\."),Zt=e=>e.map(String).map(Ss).join("."),nt=e=>{const t=[];let n="";for(let r=0;r<e.length;r++){let a=e.charAt(r);if(a==="\\"&&e.charAt(r+1)==="."){n+=".",r++;continue}if(a==="."){t.push(n),n="";continue}n+=a}const s=n;return t.push(s),t};function le(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Cs=[le(ws,"undefined",()=>null,()=>{}),le(Di,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),le(Ai,"Date",e=>e.toISOString(),e=>new Date(e)),le(Pi,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n}),le(Ti,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),le(at,"set",e=>[...e.values()],e=>new Set(e)),le(it,"map",e=>[...e.entries()],e=>new Map(e)),le(e=>Hn(e)||Ri(e),"number",e=>Hn(e)?"NaN":e>0?"Infinity":"-Infinity",Number),le(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),le(_i,"URL",e=>e.toString(),e=>new URL(e))];function Bt(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Es=Bt((e,t)=>js(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const s=n.symbolRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown symbol");return s}),Li=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Ns=Bt(Ii,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=Li[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function ks(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Ts=Bt(ks,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const s={};return n.forEach(r=>{s[r]=e[r]}),s},(e,t,n)=>{const s=n.classRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(s.prototype),e)}),As=Bt((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const s=n.customTransformerRegistry.findByName(t[1]);if(!s)throw new Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),Fi=[Ts,Es,As,Ns],Yn=(e,t)=>{const n=Wn(Fi,r=>r.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=Wn(Cs,r=>r.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},Ps={};Cs.forEach(e=>{Ps[e.annotation]=e});var Mi=(e,t,n)=>{if(pe(t))switch(t[0]){case"symbol":return Es.untransform(e,t,n);case"class":return Ts.untransform(e,t,n);case"custom":return As.untransform(e,t,n);case"typed-array":return Ns.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=Ps[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},ke=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Os(e){if(kt(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(kt(e,"prototype"))throw new Error("prototype is not allowed as a property");if(kt(e,"constructor"))throw new Error("constructor is not allowed as a property")}var Bi=(e,t)=>{Os(t);for(let n=0;n<t.length;n++){const s=t[n];if(at(e))e=ke(e,+s);else if(it(e)){const r=+s,a=+t[++n]==0?"key":"value",o=ke(e,r);switch(a){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},cn=(e,t,n)=>{if(Os(t),t.length===0)return n(e);let s=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(pe(s)){const l=+o;s=s[l]}else if(rt(s))s=s[o];else if(at(s)){const l=+o;s=ke(s,l)}else if(it(s)){if(a===t.length-2)break;const u=+o,d=+t[++a]==0?"key":"value",g=ke(s,u);switch(d){case"key":s=g;break;case"value":s=s.get(g);break}}}const r=t[t.length-1];if(pe(s)?s[+r]=n(s[+r]):rt(s)&&(s[r]=n(s[r])),at(s)){const a=ke(s,+r),o=n(a);a!==o&&(s.delete(a),s.add(o))}if(it(s)){const a=+t[t.length-2],o=ke(s,a);switch(+r==0?"key":"value"){case"key":{const u=n(o);s.set(u,s.get(o)),u!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function un(e,t,n=[]){if(!e)return;if(!pe(e)){Ve(e,(a,o)=>un(a,t,[...n,...nt(o)]));return}const[s,r]=e;r&&Ve(r,(a,o)=>{un(a,t,[...n,...nt(o)])}),t(s,n)}function Ui(e,t,n){return un(t,(s,r)=>{e=cn(e,r,a=>Mi(a,s,n))}),e}function qi(e,t){function n(s,r){const a=Bi(e,nt(r));s.map(nt).forEach(o=>{e=cn(e,o,()=>a)})}if(pe(t)){const[s,r]=t;s.forEach(a=>{e=cn(e,nt(a),()=>e)}),r&&Ve(r,n)}else Ve(t,n);return e}var $i=(e,t)=>rt(e)||pe(e)||it(e)||at(e)||ks(e,t);function Gi(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function Vi(e,t){const n={};let s;return e.forEach(r=>{if(r.length<=1)return;t||(r=r.map(l=>l.map(String)).sort((l,u)=>l.length-u.length));const[a,...o]=r;a.length===0?s=o.map(Zt):n[Zt(a)]=o.map(Zt)}),s?ln(n)?[s]:[s,n]:ln(n)?void 0:n}var Ds=(e,t,n,s,r=[],a=[],o=new Map)=>{const l=Oi(e);if(!l){Gi(e,r,t);const S=o.get(e);if(S)return s?{transformedValue:null}:S}if(!$i(e,n)){const S=Yn(e,n),C=S?{transformedValue:S.value,annotations:[S.type]}:{transformedValue:e};return l||o.set(e,C),C}if(kt(a,e))return{transformedValue:null};const u=Yn(e,n),d=(u==null?void 0:u.value)??e,g=pe(d)?[]:{},h={};Ve(d,(S,C)=>{if(C==="__proto__"||C==="constructor"||C==="prototype")throw new Error(`Detected property ${C}. This is a prototype pollution risk, please remove it from your object.`);const x=Ds(S,t,n,s,[...r,C],[...a,e],o);g[C]=x.transformedValue,pe(x.annotations)?h[C]=x.annotations:rt(x.annotations)&&Ve(x.annotations,(b,y)=>{h[Ss(C)+"."+y]=b})});const w=ln(h)?{transformedValue:g,annotations:u?[u.type]:void 0}:{transformedValue:g,annotations:u?[u.type,h]:h};return l||o.set(e,w),w};function Rs(e){return Object.prototype.toString.call(e).slice(8,-1)}function Xn(e){return Rs(e)==="Array"}function Ki(e){if(Rs(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function zi(e,t,n,s,r){const a={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=n),r&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function fn(e,t={}){if(Xn(e))return e.map(r=>fn(r,t));if(!Ki(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((r,a)=>{if(Xn(t.props)&&!t.props.includes(a))return r;const o=e[a],l=fn(o,t);return zi(r,a,l,e,t.nonenumerable),r},{})}var F=class{constructor({dedupe:e=!1}={}){this.classRegistry=new xi,this.symbolRegistry=new bs(t=>t.description??""),this.customTransformerRegistry=new ji,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Ds(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const r=Vi(t,this.dedupe);return r&&(s.meta={...s.meta,referentialEqualities:r}),s}deserialize(e){const{json:t,meta:n}=e;let s=fn(t);return n!=null&&n.values&&(s=Ui(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=qi(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};F.defaultInstance=new F;F.serialize=F.defaultInstance.serialize.bind(F.defaultInstance);F.deserialize=F.defaultInstance.deserialize.bind(F.defaultInstance);F.stringify=F.defaultInstance.stringify.bind(F.defaultInstance);F.parse=F.defaultInstance.parse.bind(F.defaultInstance);F.registerClass=F.defaultInstance.registerClass.bind(F.defaultInstance);F.registerSymbol=F.defaultInstance.registerSymbol.bind(F.defaultInstance);F.registerCustom=F.defaultInstance.registerCustom.bind(F.defaultInstance);F.allowErrorProps=F.defaultInstance.allowErrorProps.bind(F.defaultInstance);var Is=F.serialize,Qi=F.stringify;function Wi(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Hi(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Yi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function Xi({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function Ji(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var Zi=(e,t=!1)=>{const{json:n}=Is(e);return JSON.stringify(n,null,t?2:void 0)},Et=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,ea=(e,t)=>e.queryHash.localeCompare(t.queryHash),_s=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,ta=(e,t)=>Et(e)===Et(t)?_s(e,t):Et(e)>Et(t)?1:-1,na={status:ta,"query hash":ea,"last updated":_s},Nt=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Ls=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,sa=(e,t)=>Nt(e)===Nt(t)?Ls(e,t):Nt(e)>Nt(t)?1:-1,ra={status:sa,"last updated":Ls},ia=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),aa=()=>{const[e,t]=K("dark");return ss(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=r=>{t(r.matches?"dark":"light")};n.addEventListener("change",s),Ge(()=>n.removeEventListener("change",s))}),e},Ze=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.set(t[0],n),s;const[r,...a]=t;return s.set(r,Ze(s.get(r),a,n)),s}if(e instanceof Set){const s=Ze(Array.from(e),t,n);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s[t[0]]=n,s;const[r,...a]=t;return s[r]=Ze(s[r],a,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[r,...a]=t;return s[r]=Ze(s[r],a,n),s}return e},et=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...r]=t;return n.set(s,et(n.get(s),r)),n}if(e instanceof Set){const n=et(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((a,o)=>o.toString()!==t[0]);const[s,...r]=t;return n[s]=et(n[s],r),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...r]=t;return n[s]=et(n[s],r),n}return e},Fs=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),r=document.createTextNode("");s.appendChild(r),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},Te,lt,ct,ut,we,ft,Ae,Pe,Oe,De,Re,Ie,dt,Jn,oa=(Jn=class{constructor(e){_(this,Te);_(this,lt);_(this,ct);_(this,ut);_(this,we,!1);_(this,ft);_(this,Ae);_(this,Pe);_(this,Oe);_(this,De);_(this,Re);_(this,Ie);_(this,dt);const{client:t,queryFlavor:n,version:s,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:d,shadowDOMTarget:g}=e;I(this,Te,K(t)),I(this,ct,n),I(this,ut,s),I(this,lt,r),I(this,ft,d),I(this,Ae,g),I(this,Pe,K(a)),I(this,Oe,K(o)),I(this,De,K(l)),I(this,Re,K(u))}setButtonPosition(e){N(this,Pe)[1](e)}setPosition(e){N(this,Oe)[1](e)}setInitialIsOpen(e){N(this,De)[1](e)}setErrorTypes(e){N(this,Re)[1](e)}setClient(e){N(this,Te)[1](e)}mount(e){if(N(this,we))throw new Error("Devtools is already mounted");const t=ds(()=>{const n=this,[s]=N(this,Pe),[r]=N(this,Oe),[a]=N(this,De),[o]=N(this,Re),[l]=N(this,Te);let u;return N(this,Ie)?u=N(this,Ie):(u=us(()=>Promise.resolve().then(()=>require("./BMGNQTAT-BjaltGdX.cjs"))),I(this,Ie,u)),Fs(N(this,ft),N(this,Ae)),mn(u,yn({get queryFlavor(){return N(n,ct)},get version(){return N(n,ut)},get onlineManager(){return N(n,lt)},get shadowDOMTarget(){return N(n,Ae)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()}}))},e);I(this,we,!0),I(this,dt,t)}unmount(){var e;if(!N(this,we))throw new Error("Devtools is not mounted");(e=N(this,dt))==null||e.call(this),I(this,we,!1)}},Te=new WeakMap,lt=new WeakMap,ct=new WeakMap,ut=new WeakMap,we=new WeakMap,ft=new WeakMap,Ae=new WeakMap,Pe=new WeakMap,Oe=new WeakMap,De=new WeakMap,Re=new WeakMap,Ie=new WeakMap,dt=new WeakMap,Jn),_e,ht,gt,mt,je,yt,Le,Fe,Me,Be,Ue,qe,$e,pt,Zn,la=(Zn=class{constructor(e){_(this,_e);_(this,ht);_(this,gt);_(this,mt);_(this,je,!1);_(this,yt);_(this,Le);_(this,Fe);_(this,Me);_(this,Be);_(this,Ue);_(this,qe);_(this,$e);_(this,pt);const{client:t,queryFlavor:n,version:s,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:d,shadowDOMTarget:g,onClose:h}=e;I(this,_e,K(t)),I(this,gt,n),I(this,mt,s),I(this,ht,r),I(this,yt,d),I(this,Le,g),I(this,Fe,K(a)),I(this,Me,K(o)),I(this,Be,K(l)),I(this,Ue,K(u)),I(this,qe,K(h))}setButtonPosition(e){N(this,Fe)[1](e)}setPosition(e){N(this,Me)[1](e)}setInitialIsOpen(e){N(this,Be)[1](e)}setErrorTypes(e){N(this,Ue)[1](e)}setClient(e){N(this,_e)[1](e)}setOnClose(e){N(this,qe)[1](()=>e)}mount(e){if(N(this,je))throw new Error("Devtools is already mounted");const t=ds(()=>{const n=this,[s]=N(this,Fe),[r]=N(this,Me),[a]=N(this,Be),[o]=N(this,Ue),[l]=N(this,_e),[u]=N(this,qe);let d;return N(this,$e)?d=N(this,$e):(d=us(()=>Promise.resolve().then(()=>require("./UODQIBEW-D6TjcU8i.cjs"))),I(this,$e,d)),Fs(N(this,yt),N(this,Le)),mn(d,yn({get queryFlavor(){return N(n,gt)},get version(){return N(n,mt)},get onlineManager(){return N(n,ht)},get shadowDOMTarget(){return N(n,Le)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()},get onClose(){return u()}}))},e);I(this,je,!0),I(this,pt,t)}unmount(){var e;if(!N(this,je))throw new Error("Devtools is not mounted");(e=N(this,pt))==null||e.call(this),I(this,je,!1)}},_e=new WeakMap,ht=new WeakMap,gt=new WeakMap,mt=new WeakMap,je=new WeakMap,yt=new WeakMap,Le=new WeakMap,Fe=new WeakMap,Me=new WeakMap,Be=new WeakMap,Ue=new WeakMap,qe=new WeakMap,$e=new WeakMap,pt=new WeakMap,Zn);function ca(e){const t=M.useQueryClient(e.client),n=se.useRef(null),{buttonPosition:s,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}=e,[d]=se.useState(new oa({client:t,queryFlavor:"React Query",version:"5",onlineManager:M.onlineManager,buttonPosition:s,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}));return se.useEffect(()=>{d.setClient(t)},[t,d]),se.useEffect(()=>{s&&d.setButtonPosition(s)},[s,d]),se.useEffect(()=>{r&&d.setPosition(r)},[r,d]),se.useEffect(()=>{d.setInitialIsOpen(a||!1)},[a,d]),se.useEffect(()=>{d.setErrorTypes(o||[])},[o,d]),se.useEffect(()=>(n.current&&d.mount(n.current),()=>{d.unmount()}),[d]),i.jsx("div",{className:"tsqd-parent-container",ref:n})}function ua(e){const t=M.useQueryClient(e.client),n=se.useRef(null),{errorTypes:s,styleNonce:r,shadowDOMTarget:a}=e,[o]=se.useState(new la({client:t,queryFlavor:"React Query",version:"5",onlineManager:M.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:r,shadowDOMTarget:a,onClose:e.onClose}));return se.useEffect(()=>{o.setClient(t)},[t,o]),se.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),se.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),se.useEffect(()=>(n.current&&o.mount(n.current),()=>{o.unmount()}),[o]),i.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:n})}var fa=process.env.NODE_ENV!=="development"?function(){return null}:ca;process.env.NODE_ENV;const da=es.atom({apiUrl:"",getPreviewUrl:async()=>""}),Ms=()=>es.useAtom(da),Bs=(e,t)=>{const[n]=Ms();return p.get(n,e,t)},J=()=>Bs("apiUrl","/chai/api"),pn=()=>{const e=M.useQueryClient(),{data:t}=M.useQuery({queryKey:["ai-context"],initialData:"",queryFn:()=>""});return{setAiContext:k.useCallback(s=>{e.setQueryData(["ai-context"],s)},[]),aiContext:t}},Z=async(e,t)=>{const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=await n.json();if(s!=null&&s.error||n.status===400||!n.ok)throw new Error((s==null?void 0:s.error)||"Something went wrong.");return s},ha=()=>{const e=J(),{aiContext:t}=pn();return k.useCallback(async(n,s,r,a)=>Z(e,{action:"ASK_AI",data:{type:n,prompt:s,blocks:r,context:t,lang:a}}),[e,t])},ga=()=>{const e=J(),{toast:t}=f.useToast();return{getUILibraryBlock:async(a,o)=>{const d=(await(await fetch(a.url+(o.path?"/blocks/"+o.path:"/"+o.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return Ke.getBlocksFromHTML(`${d}`)},getUILibraryBlocks:async a=>{try{return(await(await fetch(a.url+"/blocks.json")).json()).map(u=>({...u,preview:a.url.replace("chaiblocks","")+u.preview}))}catch(o){return console.error(o),[]}},onSave:async({page:a,blocks:o})=>{try{const l=await Z(e,{action:"UPDATE_PAGE",data:{id:a,blocks:o}});return t({title:"Success",description:"Page saved successfully",variant:"default"}),l}catch{return new Error("Failed to save blocks")}}}};function Qe(){const[e,t]=k.useState(new URLSearchParams(window.location.search));return k.useEffect(()=>{const n=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[]),[e,t]}const vn=()=>{const e=J();return M.useQuery({queryKey:["project-pages"],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:"GET_PROJECT_PAGES"})||[]})},vt=()=>{const[e]=Qe(),t=e.get("page"),{data:n,isFetching:s}=vn();return{data:k.useMemo(()=>p.find(n,{id:t})||{},[n,t]),isFetching:s}},ma=()=>M.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"meraki-ui",name:"Meraki UI",url:"https://chai-ui-blocks.vercel.app"},{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),ya=()=>{const[e]=Qe(),t=e.get("page"),n=J(),{setAiContext:s}=pn();return M.useQuery({queryKey:["page",t],initialData:[],queryFn:async()=>{const a=(await Z(n,{action:"GET_PAGE",data:{id:t,draft:!0}})).blocks??[],o=p.find(a,{_type:"@chai/ai-context"});return s(p.get(o,"_value","")||""),a},enabled:!!t})},pa=e=>k.useMemo(()=>{if(!e||p.isEmpty(e))return{blocks:[],theme:{}};const t=p.find(e,{_type:"@chai/theme"}),n=p.get(t,"_value",{})||{},s=p.filter(e,r=>!p.includes(r==null?void 0:r._type,"@chai/"));return{theme:n,blocks:s}},[e]),Us=()=>{const e=J();return M.useQuery({queryKey:["website-settings"],initialData:{theme:{},fallbackLang:"",languages:[]},queryFn:async()=>Z(e,{action:"GET_WEBSITE_SETTINGS"})})},va=()=>{const{data:e}=vn(),t=J();return{getGlobalBlocks:async()=>{const n={};for(const s of e??[])p.isEmpty(s==null?void 0:s.slug)&&(n[s.id]={name:p.startCase(s.name??s.slug),description:""});return n},getGlobalBlockBlocks:async n=>n?(await Z(t,{action:"GET_PAGE",data:{id:n,draft:!0}})).blocks:[]}},xa=()=>({uploadFile:async t=>(console.log("uploadFile",t),{})}),ot={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"},qs=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"CREATE_PAGE",data:s}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),n({title:`New ${r.collection==="global"?"global block":"page"} added successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to add new ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},xn=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"UPDATE_PAGE",data:s}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage||r!=null&&r.seo)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),r!=null&&r.seo?n({title:"SEO Settings updated successfully."}):n({title:`${r.collection==="global"?"Global block":"Page"} updated successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to update ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},ba=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"DELETE_PAGE",data:{id:s==null?void 0:s.id}}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),n({title:`${r.collection==="global"?"Global block":"Page"} deleted successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to delete ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},wa=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"TAKE_OFFLINE",data:{id:s==null?void 0:s.id}}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),n({title:`${r.collection==="global"?"Global block":"Page"} taken offline successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to take offline ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},ja=()=>{const e=J(),{toast:t}=f.useToast(),n=M.useQueryClient(),{data:s}=vt();return M.useMutation({mutationFn:async({ids:r,theme:a})=>Z(e,{action:"PUBLISH_CHANGES",data:{ids:r,theme:a}}),onSuccess:()=>{t({title:"Your changes have been published successfully."}),n.invalidateQueries({queryKey:["get-page-changes"]}),n.invalidateQueries({queryKey:["project-pages"]}),n.invalidateQueries({queryKey:["language-pages",s==null?void 0:s.id]})},onError:()=>{t({title:"Failed to publish pages.",variant:"destructive"})}})},Sa=()=>{const e=J(),{toast:t}=f.useToast(),n=M.useQueryClient();return M.useMutation({mutationFn:async({id:s,slug:r})=>Z(e,{action:"CHANGE_SLUG",data:{id:s,slug:r}}),onSuccess:(s,{primaryPage:r})=>{t({title:"Slug changed successfully."}),r?n.invalidateQueries({queryKey:["language-pages",r]}):n.invalidateQueries({queryKey:["project-pages"]})},onError:()=>{t({title:"Failed to change slug",variant:"destructive"})}})},bn=()=>{const e=J(),[t]=Qe(),n=t.get("page");return M.useQuery({queryKey:["language-pages",n],initialData:[],queryFn:async()=>{if(!n)return null;const s=await Z(e,{action:"GET_LANGUAGE_PAGES",data:{id:n}});return p.reverse(p.sortBy(s,"primaryPage"))}})},Ca=()=>{const{selectedLang:e}=Ke.useLanguages(),{data:t,isFetching:n}=bn();return{data:k.useMemo(()=>p.find(t,{lang:e||""})||{},[t,e]),isFetching:n}},$s=()=>{const{data:e,isFetching:t}=Ca(),n=e==null?void 0:e.seo,[s,r]=k.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n}),a=k.useRef({initial:s,updated:s}),{selectedLang:o,fallbackLang:l,languages:u}=Ke.useLanguages(),d=o.length?o:l,{mutate:g,isPending:h}=xn(),w=h;k.useEffect(()=>{!t&&n&&r({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n})},[t,n]);const S=async()=>{g({id:e==null?void 0:e.id,seo:s}),a.current.initial=s,a.current.updated=s},C=()=>{r({...s,ogTitle:s.title,ogDescription:s.description})},x=()=>{r({...s,searchTitle:s.ogTitle,searchDescription:s.ogDescription})},b=y=>{const j={...s,[y.target.name]:y.target.name==="noIndex"||y.target.name==="noFollow"?y.target.checked:y.target.value};r(j),a.current.updated=j};return i.jsxs("div",{className:"relative pb-40",children:[i.jsxs("div",{className:"text-xs bg-gray-100 p-2 rounded-md text-left",children:["Slug: ",e==null?void 0:e.slug,"  ",u.length>0&&i.jsxs("span",{className:"text-blue-500 font-semibold",children:["(",p.get(ot,d,d),")"]})]}),i.jsx("form",{className:"space-y-8",children:i.jsxs(f.Accordion,{type:"multiple",defaultValue:["page"],children:[i.jsxs(f.AccordionItem,{value:"page",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"Seo Page"}),i.jsx(f.AccordionContent,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"title",children:"SEO Title"}),i.jsx(f.Input,{type:"text",id:"title",name:"title",value:s.title,onChange:b,disabled:w,placeholder:"Enter SEO title"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The title should be between 10 and 60 characters."})]}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"description",children:"SEO Description"}),i.jsx(f.Textarea,{id:"description",name:"description",value:s.description,onChange:b,disabled:w,placeholder:"Enter SEO description"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The description should be between 50 and 160 characters."})]}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"title",children:"Canonical URL"}),i.jsx(f.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:s.canonicalUrl,onChange:b,disabled:w,placeholder:"Enter Canonical URL"})]}),i.jsxs("div",{className:"",children:[i.jsxs("div",{className:"flex items-center gap-x-2",children:[i.jsx(f.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:s.noIndex,onChange:b,disabled:w,className:"h-4 w-4"}),i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Index"})]}),i.jsx("p",{className:"mt-2 text-[10px] font-light text-gray-400",children:"Check this if you don't want search engines to index this page."})]}),i.jsxs("div",{className:"",children:[i.jsxs("div",{className:"flex items-center gap-x-2",children:[i.jsx(f.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:s.noFollow,onChange:b,disabled:w,className:"h-4 w-4"}),i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Follow"})]}),i.jsx("p",{className:"mt-2 text-[10px] font-light text-gray-400",children:"Check this if you don't want search engines to follow links on this page."})]})]})})]}),i.jsxs(f.AccordionItem,{value:"og",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"OG"}),i.jsx(f.AccordionContent,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx(f.Button,{type:"button",variant:"outline",size:"sm",onClick:C,children:"Copy from SEO Settings"})}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"ogTitle",children:"OG Title"}),i.jsx(f.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:s.ogTitle,onChange:b,disabled:w,placeholder:"Enter OG title"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The OG title should be between 10 and 60 characters."})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"ogDescription",children:"OG Description"}),i.jsx(f.Textarea,{id:"ogDescription",name:"ogDescription",value:s.ogDescription,onChange:b,disabled:w,placeholder:"Enter OG description"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The OG description should be between 50 and 160 characters."})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"ogImage",children:"OG Image URL"}),i.jsx(f.Input,{type:"text",id:"ogImage",name:"ogImage",value:s.ogImage,onChange:b,disabled:w,placeholder:"Enter OG image URL"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"Enter a valid URL for the OG image."})]})]})})]}),i.jsxs(f.AccordionItem,{value:"search",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"Search"}),i.jsx(f.AccordionContent,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx(f.Button,{type:"button",variant:"outline",size:"sm",onClick:x,children:"Copy from OG Settings"})}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"searchTitle",children:"Search Title"}),i.jsx(f.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:s.searchTitle,onChange:b,disabled:w,placeholder:"Enter search title"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The search title should be between 10 and 60 characters."})]}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"searchDescription",children:"Search Description"}),i.jsx(f.Textarea,{id:"searchDescription",name:"searchDescription",value:s.searchDescription,onChange:b,placeholder:"Enter search description"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The search description should be between 50 and 160 characters."})]})]})})]}),i.jsxs(f.AccordionItem,{value:"jsonLD",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"JSON-LD"}),i.jsx(f.AccordionContent,{children:i.jsx("div",{className:"space-y-4",children:i.jsx("div",{children:i.jsx(f.Textarea,{id:"jsonLD",name:"jsonLD",rows:3,value:s.jsonLD,onChange:b,placeholder:"Enter JSON-LD"})})})})]})]})}),i.jsx("div",{className:"w-full flex items-center justify-end mt-4",children:i.jsx(f.Button,{size:"lg",variant:"default",onClick:S,disabled:p.isEqual(a.current.initial,s)||w,children:h?"Saving...":"Save"})})]})};$s.displayName="SeoPanel";const Ut=()=>{const e=J();return M.useQuery({queryKey:["project-collections"],initialData:[],queryFn:async()=>Z(e,{action:"GET_COLLECTIONS"})})},Ea=()=>{const e=J();return M.useMutation({mutationFn:async({collection:t,query:n})=>{try{return Z(e,{action:"SEARCH_PAGES",data:{collection:t,query:Array.isArray(n)&&n.length>0?n[0]:n}})||[]}catch{return[]}}})},Gs=({page:e,onClose:t})=>{const[n,s]=k.useState(e.slug||""),{mutate:r,isPending:a}=Sa(),{data:o}=Ut(),l=p.find(o,{key:e==null?void 0:e.collection}),u=()=>{r({...e,slug:n},{onSuccess:t})},d=(e==null?void 0:e.lang)||"";return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Change Slug"}),i.jsx(f.DialogDescription,{className:"text-xs",children:i.jsxs(f.Alert,{variant:"destructive",className:"mt-2",children:[i.jsx(H.AlertCircle,{className:"h-4 w-4"}),"Changing the slug may have impact on your SEO. Please proceed with caution."]})})]}),i.jsxs("div",{className:"space-y-4 py-4 text-sm ",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{children:[i.jsx("span",{children:"Type:"}),i.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(l==null?void 0:l.name)||(e==null?void 0:e.collection)]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Name:"}),i.jsxs("span",{className:"font-medium text-gray-600",children:[" ",e.name]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs(f.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",i.jsxs("small",{className:"font-light text-gray-500",children:["Slug should start with /",d]})]}),i.jsx(f.Input,{id:"slug",value:n,onChange:g=>{const h=g.target.value;p.startsWith(h,`/${d}`)&&s(h)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),i.jsx(f.DialogFooter,{children:i.jsx(f.Button,{onClick:u,type:"button",disabled:a||!p.startsWith(n,`/${d}`),children:a?"Changing...":"Change Slug"})})]})})};function Vs({page:e,onClose:t}){const[,n]=Qe(),{mutate:s,isPending:r}=ba(),a=()=>{s(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),n(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Confirm Deletion"}),i.jsxs(f.DialogDescription,{children:[i.jsxs("div",{children:["Are you sure you want to remove ",i.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",(e==null?void 0:e.collection)==="global"?"global block?":`page? ${e!=null&&e.primaryPage?"":"This will also delete all associated language pages."}`]}),e.lang&&i.jsxs("div",{className:"py-2 text-sm",children:["Language:"," ",i.jsx("span",{className:"font-medium text-gray-500",children:p.get(ot,e.lang,e.lang)})]})]})]}),i.jsxs(f.DialogFooter,{children:[i.jsx(f.Button,{variant:"outline",onClick:t,children:"Cancel"}),i.jsx(f.Button,{variant:"destructive",disabled:r,onClick:a,children:r?"Deleting...":"Delete"})]})]})})}const Ks=({page:e,onClose:t})=>{const{mutate:n,isPending:s}=wa(),r=async()=>{n(e,{onSuccess:t})};return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Confirm action"}),i.jsxs(f.DialogDescription,{children:["Are you sure you want to take offline"," ",i.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)}),"?"]})]}),i.jsxs(f.DialogFooter,{children:[i.jsx(f.Button,{variant:"outline",onClick:t,children:"Cancel"}),i.jsx(f.Button,{variant:"destructive",disabled:s,onClick:r,children:s?"Updating...":"Take offline"})]})]})})},Na=({langProps:e,onClose:t,languages:n})=>{const{data:s}=vt(),[r,a]=k.useState(e.name||""),[o,l]=k.useState(e.edit?e.lang:""),[u,d]=k.useState(e.edit?e.slug:""),{mutate:g,isPending:h}=qs(),{mutate:w,isPending:S}=xn(),C=(e==null?void 0:e.collection)==="global",x=h||S,b=()=>{const y={name:r,lang:o,primaryPage:s==null?void 0:s.id,slug:u,collection:s==null?void 0:s.collection};y.collection=e.collection,e.edit&&(y.id=e==null?void 0:e.id),e.edit?w(y,{onSuccess:t}):g(y,{onSuccess:t})};return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{className:"sm:max-w-[425px]",children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:e.edit?"Edit language":"Add New language"}),i.jsx(f.DialogDescription,{children:"Enter the details for the language"})]}),i.jsxs("form",{children:[i.jsxs("div",{className:"grid gap-4 py-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"lang",className:"text-right",children:"Language"}),i.jsxs("select",{value:o,disabled:e.edit||p.isEmpty(n),onChange:y=>{const j=y.target.value;l(j),!C&&d(`/${j}`)},className:"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",children:[i.jsx("option",{value:"",disabled:!0,selected:!0,children:e.edit?p.get(ot,e.lang,e.lang):p.isEmpty(n)?"All available language page is created.":"Choose language"}),p.map(n,y=>i.jsx("option",{value:y,children:p.get(ot,y,y)},y))]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"slug",className:"text-right",children:"Page Name"}),i.jsx(f.Input,{id:"name",value:r,onChange:y=>a(y.target.value),className:"col-span-3",required:!0,placeholder:"Enter page name"})]}),!C&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs(f.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",i.jsx("small",{className:"font-light",children:e.edit?"To update slug use 'Change slug' action":" (Slug should start with /{lang})"})]}),i.jsx(f.Input,{id:"slug",value:u,onChange:y=>{const j=y.target.value;p.startsWith(j,`/${o}`)&&d(p.toLower(p.trim(j)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:p.isEmpty(o)||(e==null?void 0:e.edit),title:"Slug must start with /",placeholder:p.isEmpty(o)?"Choose language to add slug":"Enter page slug"})]})]}),i.jsx(f.DialogFooter,{children:i.jsx(f.Button,{onClick:b,type:"button",disabled:x||!o||!C&&!p.startsWith(u,`/${o}`),children:x?e.edit?"Updating...":"Adding...":e.edit?"Update":"Add new language"})})]})]})})},ka=()=>{const[e,t]=k.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:r}=Ke.useLanguages(),{data:a,isFetching:o}=bn(),{data:l}=vt(),[u,d]=k.useState(null),[g,h]=k.useState(null),[w,S]=k.useState(null),{data:C}=Us(),x=p.filter(p.get(C,"languages")||["en"],b=>!p.find(a,{lang:b})&&b!==p.get(C,"fallbackLang"));return i.jsxs("div",{className:"space-y-4 pt-2",children:[i.jsx("ul",{className:"space-y-2 mt-4",children:o?i.jsxs("div",{className:"w-full space-y-3 py-4",children:[i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):p.map(a,b=>{const y=b.lang,j=b.slug,O=!b.primaryPage,$=y===n;return i.jsxs(i.Fragment,{children:[i.jsxs("li",{className:`w-full p-2 rounded cursor-pointer flex items-center justify-between ${$?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>r(y),children:[i.jsxs("div",{className:" flex-1 gap-x-3",children:[i.jsxs("div",{className:"text-[13px] flex items-center gap-x-2",children:[p.get(ot,O?s:y,y),(b==null?void 0:b.online)&&i.jsx("div",{style:{backgroundColor:"lightgreen"},className:"rounded-full w-2 h-2 mt-1"})]}),i.jsxs("div",{children:[j&&i.jsxs("div",{className:"text-[11px] text-gray-500",children:["Slug:",i.jsxs("b",{children:[" ",j]})]}),i.jsxs("div",{className:"text-[11px] text-gray-500",children:["Name:",i.jsxs("b",{children:[" ",b.name," "]})]})]})]}),O?i.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[i.jsx(H.StarIcon,{fill:"orange",className:"w-3 h-3"}),i.jsx("b",{children:" Primary"})]}):i.jsx("div",{className:"flex items-center gap-x-3",children:i.jsxs(f.DropdownMenu,{children:[i.jsx(f.DropdownMenuTrigger,{asChild:!0,onClick:B=>B.stopPropagation(),children:i.jsx(f.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:i.jsx(H.MoreVertical,{className:"h-4 w-4"})})}),i.jsxs(f.DropdownMenuContent,{align:"end",className:"text-sm",children:[i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),t({...b,edit:!0})},children:[i.jsx(H.PencilIcon,{className:"size-3"}),"Edit"]}),(b==null?void 0:b.online)&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),h(b)},children:[i.jsx(H.Power,{className:"size-3"}),"Take offline"]}),(b==null?void 0:b.collection)!=="global"&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),S(b)},children:[i.jsx(H.Link,{className:"size-3"}),"Change slug"]}),i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),d(b)},children:[i.jsx(H.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},b.id),i.jsx("div",{className:"h-1 w-full border-b"})]})})}),i.jsx("div",{className:"flex justify-center w-full",children:i.jsx(f.Button,{variant:"default",size:"sm",disabled:p.isEmpty(x),onClick:()=>{t({name:l==null?void 0:l.name,collection:l==null?void 0:l.collection,lang:"",slug:"",edit:!1})},children:"+ Add new language"})}),e&&i.jsx(Na,{languages:x,langProps:e,onClose:()=>t(null)}),u&&i.jsx(Vs,{page:u,onClose:()=>d(null)}),g&&i.jsx(Ks,{page:g,onClose:()=>h(null)}),w&&i.jsx(Gs,{page:w,onClose:()=>S(null)})]})},Ta=({activePage:e,editPage:t,onAddEditPage:n})=>{const[s,r]=k.useState("pages"),{data:a,isFetching:o}=vn(),[l,u]=k.useState(null),[d,g]=k.useState(null),[h,w]=k.useState(null),S=x=>{var j;if(s==="globalBlocks")return C(p.filter(x,O=>!O.slug));const b=p.groupBy(p.filter(x,O=>O.slug),"collection"),y=Object.entries(b).sort(([O],[$])=>O?!$||O.toLowerCase()==="page"?-1:$.toLowerCase()==="page"?1:O.localeCompare($):1);return i.jsx(f.Accordion,{type:"single",collapsible:!0,className:"w-full",defaultValue:((j=y[0])==null?void 0:j[0])||"uncategorized",children:y.map(([O,$])=>i.jsxs(f.AccordionItem,{value:O||"uncategorized",children:[i.jsx(f.AccordionTrigger,{className:"px-2",children:p.startCase(O)||"Uncategorized"}),i.jsx(f.AccordionContent,{className:"bg-white",children:i.jsx("div",{className:"space-y-2",children:C($)})})]},O))})},C=x=>p.orderBy(x,"online","desc").map(y=>i.jsxs(f.Button,{onClick:()=>t(y.id),variant:y.id===e?"default":"ghost",className:"flex justify-between items-center h-auto w-full space-x-2 py-1",children:[i.jsxs("div",{className:"flex items-center space-x-2 relative",children:[i.jsx("div",{className:"",children:i.jsx("div",{style:{backgroundColor:y!=null&&y.online?"lightgreen":"lightgray"},className:"rounded-full w-2 h-2 "})}),i.jsxs("div",{className:"flex items-center",children:[i.jsxs("span",{children:[y.name??y.slug,"  "]}),(y==null?void 0:y.slug)&&i.jsxs("span",{className:"text-xs font-light",children:["(",y.slug,")"]})]})]}),i.jsx("div",{className:"flex items-center space-x-4",children:i.jsxs(f.DropdownMenu,{children:[i.jsx(f.DropdownMenuTrigger,{asChild:!0,onClick:j=>j.stopPropagation(),children:i.jsx(f.Button,{variant:"ghost",size:"sm",className:`h-8 w-8 p-0 hover:bg-transparent ${y.id===e?" hover:text-gray-200":"bg-transparent "}`,children:i.jsx(H.MoreVertical,{className:"h-4 w-4"})})}),i.jsxs(f.DropdownMenuContent,{align:"end",className:"text-sm",children:[i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:j=>{j.stopPropagation(),n({...y,global:s==="globalBlocks"})},children:[i.jsx(H.PencilIcon,{className:"size-3"}),"Edit"]}),(y==null?void 0:y.online)&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:j=>{j.stopPropagation(),g(y)},children:[i.jsx(H.Power,{className:"size-3"}),"Take offline"]}),(y==null?void 0:y.collection)!=="global"&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:j=>{j.stopPropagation(),w(y)},children:[i.jsx(H.Link,{className:"size-3"}),"Change slug"]}),i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:j=>{j.stopPropagation(),u(y)},children:[i.jsx(H.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},y.id));return i.jsxs(i.Fragment,{children:[i.jsx("br",{}),i.jsxs(f.Tabs,{value:s,className:"w-full",onValueChange:r,children:[i.jsxs(f.TabsList,{className:"w-full",children:[i.jsx(f.TabsTrigger,{value:"pages",className:"w-full",children:i.jsx("div",{className:"px-4",children:"Pages"})}),i.jsx(f.TabsTrigger,{value:"globalBlocks",className:"w-full",children:i.jsx("div",{className:"px-4",children:"Global Blocks"})})]}),o?i.jsxs("div",{className:"w-full space-y-3 py-4",children:[i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):i.jsxs("div",{className:"py-4 space-y-3",children:[i.jsx("div",{className:"w-full flex justify-center",children:i.jsxs(f.Button,{variant:"default",size:"sm",disabled:o,onClick:()=>n({slug:"",name:"",global:s==="globalBlocks"}),className:"mb-4 w-1/2 bg-blue-500 hover:bg-blue-400",children:[i.jsx(H.Plus,{className:"h-4 w-4 mr-2"}),o?"Loading...":`Add ${s==="pages"?"page":"Global Block"}`]})}),i.jsx("div",{className:"pt-0",children:i.jsx("div",{className:"space-y-2",children:o?i.jsx(Aa,{}):S(a)})})]})]}),l&&i.jsx(Vs,{page:l,onClose:()=>u(null)}),d&&i.jsx(Ks,{page:d,onClose:()=>g(null)}),h&&i.jsx(Gs,{page:h,onClose:()=>w(null)})]})};function Aa(){return i.jsx("div",{className:"h-32 w-full flex justify-center items-center text-sm animate-pulse",children:"Loading..."})}const Pa=({editPage:e,addEditPage:t,setAddEditPage:n})=>{const s=t.id,[r,a]=k.useState(s&&t.name||""),[o,l]=k.useState(s&&t.slug||""),[u,d]=k.useState(s?(t==null?void 0:t.collection)||"":"page"),{data:g=[]}=Ut(),{mutate:h,isPending:w}=qs(),{mutate:S,isPending:C}=xn(),x=w||C,b=()=>{s?S({name:r,slug:o,id:t.id,collection:t.global?"global":u},{onSuccess:()=>{n(void 0)}}):h({name:r,slug:o,collection:t.global?"global":u},{onSuccess:y=>{e(y.page.id)}})};return i.jsx(f.Dialog,{open:!!t,onOpenChange:()=>n(void 0),children:i.jsxs(f.DialogContent,{className:"sm:max-w-[425px]",children:[i.jsxs(f.DialogHeader,{children:[i.jsxs(f.DialogTitle,{children:[s?"Edit":"Add New"," ",t.global?"Global Block":p.startCase(u)]}),i.jsxs(f.DialogDescription,{children:["Enter the details for the new"," ",t.global?"Global Block":`${p.startCase(u)}. Slug must start with /`]})]}),i.jsxs("form",{children:[i.jsxs("div",{className:"grid gap-4 py-4",children:[!t.global&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"pageType",children:"Type"}),i.jsx("select",{value:u,disabled:s,onChange:y=>d(y.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:g.map(y=>i.jsx("option",{value:y.key,children:y.name},y.key))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"name",className:"text-right",children:"Name"}),i.jsx(f.Input,{id:"name",value:r,placeholder:`Enter ${t.global?"global block":"page"} name`,onChange:y=>a(y.target.value),className:"col-span-3",required:!0})]}),!t.global&&i.jsx(i.Fragment,{children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs(f.Label,{htmlFor:"slug",className:"text-right",children:[t.global?"Identifier":"Slug"," ",s&&i.jsx("small",{className:"text-gray-400 font-light",children:"To update slug use 'Change slug' action"})]}),i.jsx(f.Input,{id:"slug",value:o,disabled:s,onChange:y=>{var j;return l((j=y.target.value)==null?void 0:j.trim().toLowerCase())},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})})]}),i.jsx(f.DialogFooter,{children:i.jsx(f.Button,{onClick:b,type:"button",disabled:x||!r||!t.global&&!o.startsWith("/")||p.isEqual(t.name,r)&&p.isEqual(t.slug,o)&&p.isEqual(t.pageType,u),children:x?s?"Updating...":"Adding...":t.global?`${s?"Update":"Add"} global block`:`${s?"Update":"Add"} Page`})})]})]})})};function Oa(e){const{activePage:t,canClose:n,open:s,close:r}=e,[,a]=Qe(),[o,l]=k.useState(),u=d=>{window.history.pushState({},"",`?page=${d}`),a(new URLSearchParams({page:d})),window.dispatchEvent(new PopStateEvent("popstate")),l(void 0),r()};return i.jsx(f.Sheet,{open:s,onOpenChange:d=>{!d&&n&&r()},children:i.jsxs(f.SheetContent,{side:"left",className:`border-border w-full ${n?"":"sheet-hide-close-btn"}`,children:[i.jsx("div",{children:i.jsx(Ta,{onAddEditPage:d=>l(d),activePage:t,editPage:u})}),o&&i.jsx(Pa,{editPage:u,addEditPage:o,setAddEditPage:l})]})})}const Da=()=>{const{t:e}=Ke.useTranslation(),{data:t,isFetching:n}=vt(),s=Bs("getPreviewUrl",async o=>o),[r,a]=k.useState("");return k.useEffect(()=>{(async()=>{if(!s||!(t!=null&&t.slug)){a("");return}const o=await s((t==null?void 0:t.slug)||"");a(o)})()},[s,t==null?void 0:t.slug]),!r||(t==null?void 0:t.collection)==="global"?null:i.jsxs(f.Button,{variant:"outline",disabled:n,size:"sm",className:"ml-2",children:[i.jsx(H.EyeIcon,{className:"h-4 w-4 mr-2"}),i.jsx("a",{href:r,target:"_blank",children:e("Preview")})]})},Ra=()=>{const e=J();return M.useQuery({queryKey:["get-page-changes"],queryFn:async()=>Z(e,{action:"GET_CHANGES"})})};function Ia({onClose:e=()=>console.log("Cancelled")}){const[t,n]=k.useState([]),{data:s,isFetching:r}=Ra(),{data:a}=Ut(),o=k.useMemo(()=>p.filter(s,x=>x.collection!=="global"),[s]),l=k.useMemo(()=>p.filter(s,{collection:"global"}),[s]),{mutate:u,isPending:d}=ja();k.useEffect(()=>{n(p.map(p.filter(s,{online:!0}),"id"))},[s]);const g=t.length===(s==null?void 0:s.length),h=x=>{n(b=>p.includes(b,x)?p.filter(b,y=>y!==x):p.concat(b,x))},w=()=>{n(g?[]:p.map(s,"id"))},S=()=>{u({ids:t,theme:!1},{onSuccess:()=>{e()}})},C=x=>{if(x==="global")return"Global Block";const b=p.find(a,{key:x});return b?b==null?void 0:b.name:x};return i.jsx(f.Dialog,{open:!0,onOpenChange:d?()=>{}:e,children:i.jsxs(f.DialogContent,{className:"max-w-4xl",children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Publish changes"}),i.jsx(f.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),i.jsx("div",{className:"relative overflow-x-auto -mx-4",children:r?i.jsxs("div",{className:"space-y-2 px-1",children:[i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse mt-2"}),i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"})]}):i.jsxs("table",{className:"max-h-96 w-full text-xs text-left rtl:text-right text-gray-500 dark:text-gray-400",children:[i.jsx("thead",{className:"text-gray-700 border-b bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:i.jsxs("tr",{children:[i.jsxs("th",{scope:"col",className:"px-6 py-3 flex items-center gap-x-2 w-[1 50px]",children:[i.jsx("input",{checked:g,onClick:x=>{x.stopPropagation(),w()},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 mt-1 cursor-pointer"}),"Name"]}),i.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Type"}),i.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),i.jsx("tbody",{children:p.map([{label:"Updated Pages & Global Blocks",top:"pt-2"},...p.orderBy(p.filter(o,{online:!0}),"collection"),...p.orderBy(p.filter(l,{online:!0}),"collection"),{label:"Offline Pages & Global Blocks",top:"pt-6"},...p.orderBy(p.filter(o,{online:!1}),"collection"),...p.orderBy(p.filter(l,{online:!1}),"collection")],x=>x.label?i.jsx("tr",{children:i.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${x.top}`,children:[i.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:i.jsx("div",{className:"w-full order-gray-300"})}),i.jsx("div",{className:"relative flex justify-start",children:i.jsx("span",{className:"bg-gray-50 pr-2",children:x.label})})]})},"separator"):i.jsxs("tr",{className:"hover:bg-gray-50 border-b last:border-b-0",children:[i.jsxs("td",{scope:"row",className:"px-6 py-2 text-gray-900 whitespace-nowrap dark:text-white flex items-center gap-x-1",children:[i.jsx("input",{checked:p.includes(t,x==null?void 0:x.id),onClick:b=>{b.stopPropagation(),h(x==null?void 0:x.id)},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 cursor-pointer"})," ",x.collection==="global"?i.jsx(H.GlobeIcon,{className:"h-4 w-4"}):i.jsx(H.File,{className:"h-4 w-4"}),x.name,x.slug&&i.jsxs("span",{className:"text-xs text-gray-500",children:["(",x.slug,")"]})]}),i.jsx("td",{className:"px-2",children:C(x==null?void 0:x.collection)}),i.jsx("td",{className:"px-4 text-right",children:p.first(x.changes)||""})]},x==null?void 0:x.id))})]})}),i.jsxs(f.DialogFooter,{className:"mt-10",children:[i.jsx(f.Button,{disabled:d,variant:"outline",onClick:e,children:"Cancel"}),i.jsx(f.Button,{disabled:d||r||p.isEmpty(s),onClick:S,children:d?"Publishing...":"Publish"})]})]})})}xr.loadWebBlocks();const _a=e=>{const t=k.useRef([]),[n]=Qe(),s=n.get("page"),{data:r,isFetching:a}=vt(),{data:o}=ma(),{data:l,isFetching:u}=ya(),{blocks:d}=pa(l),{data:g}=Us(),{data:h}=Ut(),{data:w}=bn(),S=ha(),{uploadFile:C}=xa(),{getUILibraryBlock:x,getUILibraryBlocks:b,onSave:y}=ga(),{getGlobalBlocks:j,getGlobalBlockBlocks:O}=va(),{aiContext:$,setAiContext:B}=pn(),{mutateAsync:he}=Ea();t.current=d;const[ve,ge]=k.useState(!1),[U,V]=k.useState(!1),[G,ae]=k.useState("SAVED");k.useEffect(()=>{const z=oe=>{G==="UNSAVED"&&(oe.preventDefault(),oe.returnValue=!1)};return G==="UNSAVED"&&window.addEventListener("beforeunload",z),()=>{window.removeEventListener("beforeunload",z)}},[G]);const re=k.useMemo(()=>{const z={};return e.mediaManagerComponent&&(z.mediaManagerComponent=e.mediaManagerComponent,z.uploadMediaCallback=C),z},[e.mediaManagerComponent,C]),ue=k.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...o,...e==null?void 0:e.uiLibraries]:o,[o,e==null?void 0:e.uiLibraries]),xe=k.useCallback(async(z,oe)=>await he({collection:z,query:oe}),[he]);return i.jsxs(i.Fragment,{children:[i.jsx(Ke.ChaiBuilderEditor,{loading:u,fallbackLang:g.fallbackLang||"en",languages:p.compact(p.map(w,"lang"))||[],brandingOptions:(g==null?void 0:g.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:e.autoSaveSupport||!1,autoSaveInterval:e.autoSaveInterval||15,onError:e.onError||console.error,getGlobalBlockBlocks:O,getGlobalBlocks:j,blocks:d,getUILibraryBlock:x,getUILibraryBlocks:b,uiLibraries:ue,collections:h,searchCollectionItems:xe,saveAiContextCallback:async z=>{if(!s)return!0;const oe=t.current,Se={_type:"@chai/ai-context",_value:p.isString(z)?z:""},xt=[...oe,Se];return await y({page:s,blocks:xt}),B(z),!0},onSaveStateChange:z=>ae(z),aiContext:$,askAiCallBack:S,onSave:async({blocks:z})=>{if(!s)return!0;t.current=z;const oe={_type:"@chai/ai-context",_value:p.isString($)?$:""},Se=[...z,oe];return await y({page:s,blocks:Se}),t.current=z,!0},topBarComponents:{left:[()=>i.jsxs(f.Button,{variant:"default",className:"flex justify-start max-w-[250px] items-center w-full space-x-2 py-1",onClick:()=>ge(!0),children:[p.includes(r.slug,"/")?i.jsx(H.File,{className:"h-4 w-4"}):i.jsx(H.GlobeIcon,{className:"h-4 w-4"}),i.jsx("span",{className:"truncate",children:(r==null?void 0:r.name)??""}),i.jsx(H.ArrowLeftRightIcon,{className:"h-4 w-4"})]},"template-viewer")],right:[Da,()=>i.jsxs(f.Button,{disabled:G!=="SAVED",size:"sm",variant:"default",onClick:()=>V(!0),children:[i.jsx(H.RocketIcon,{className:"h-4 w-4"}),"   Publish"]})]},sideBarComponents:{top:[...(r==null?void 0:r.collection)!=="global"?[{label:"SEO Setting",component:$s,icon:i.jsx(i.Fragment,{children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",fill:"currentColor",width:"21",height:"21",children:[i.jsx("path",{d:"M9.931 6.818c-1.238 0-2.136.925-2.136 2.2 0 1.279.898 2.207 2.136 2.207.664 0 1.257-.246 1.67-.694a.15.15 0 0 0-.009-.213l-.311-.286a.15.15 0 0 0-.213.009c-.273.297-.677.46-1.137.46-.699 0-1.233-.444-1.375-1.12h3.295a.15.15 0 0 0 .151-.151v-.211c0-1.295-.852-2.2-2.072-2.2m0 .724c.697 0 1.188.422 1.315 1.113h-2.69c.142-.673.676-1.113 1.374-1.113m4.332-.724c-1.246 0-2.15.925-2.15 2.2 0 1.279.904 2.207 2.15 2.207.596 0 1.143-.223 1.538-.628s.612-.965.612-1.579c0-1.275-.904-2.2-2.15-2.2m0 3.683c-.826 0-1.426-.624-1.426-1.483 0-.855.6-1.475 1.426-1.475s1.426.621 1.426 1.476c0 .423-.144.804-.406 1.073-.258.264-.62.41-1.019.41M6.318 8.71c-.665-.206-.902-.335-.902-.645 0-.47.564-.521.806-.521.29 0 .552.07.801.215a.15.15 0 0 0 .206-.055l.212-.366a.15.15 0 0 0-.055-.206 2.27 2.27 0 0 0-1.165-.312c-.915 0-1.53.501-1.53 1.245 0 .899.816 1.152 1.411 1.336.655.203.812.307.804.53-.016.398-.567.429-.735.429-.386 0-.722-.129-.972-.374q-.043-.042-.107-.043a.15.15 0 0 0-.106.045l-.295.302a.15.15 0 0 0 .002.213c.383.374.908.58 1.478.58.859 0 1.432-.441 1.459-1.125.031-.833-.746-1.074-1.313-1.249"}),i.jsx("path",{d:"M20.396 2.049H.604A.604.604 0 0 0 0 2.653v12.7c0 .333.27.604.604.604h6.941c-.266 1.296-.881 1.966-.886 1.971a.604.604 0 0 0 .434 1.024h6.815a.604.604 0 0 0 .434-1.024c-.007-.007-.621-.675-.886-1.971h6.941c.333 0 .604-.27.604-.604V2.652a.604.604 0 0 0-.604-.604m-.604 12.701h-.985v-.17a.604.604 0 0 0-1.208 0v.17h-.63v-.17a.604.604 0 0 0-1.208 0v.17H1.207V3.256h18.585z"})]})})}]:[],...p.isEmpty(g==null?void 0:g.languages)?[]:[{label:`Language ${(r==null?void 0:r.collection)==="global"?"":"page"}`,component:ka,icon:i.jsx(i.Fragment,{children:i.jsx("svg",{width:"21",height:"21",viewBox:"0 0 21 21",fill:"currentColor",children:i.jsxs("g",{fill:"none","fill-rule":"evenodd",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",children:[i.jsx("path",{d:"M18.5 10.5v-6a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2"}),i.jsx("path",{d:"M6.5 8.503h-2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.003l6-.01a2 2 0 0 0 1.997-2V14.5"}),i.jsx("path",{d:"M7.5 12.503h-3M9 14l-1 1q-.5.5-2.5 1.5"}),i.jsx("path",{d:"M5.5 12.503q.501 1.75 1.5 2.499c1 .749 1.5.999 2.5 1.498m4-12-3 6m3-6 3 6m-1-2h-4"})]})})})}]]},...re}),i.jsx(Oa,{activePage:s||"",canClose:!!s&&!p.isEmpty(r),open:!s||!a&&p.isEmpty(r)||ve,close:()=>ge(!1)}),U&&i.jsx(Ia,{onClose:()=>V(!1)})]})},La=new M.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),Fa=e=>{const[,t]=Ms();return k.useEffect(()=>{t({apiUrl:e.apiUrl||"",getPreviewUrl:e.getPreviewUrl})},[e.apiUrl,e.getPreviewUrl,t]),i.jsxs(M.QueryClientProvider,{client:La,children:[i.jsx(_a,{...e}),i.jsx(fa,{})]})};exports.$TRACK=dn;exports.ChaiBuilderForge=Fa;exports.Dynamic=pi;exports.For=Kr;exports.Index=zr;exports.Match=Hr;exports.Portal=yi;exports.Show=Qr;exports.Switch=Wr;exports.addEventListener=ms;exports.batch=kr;exports.className=gs;exports.clearDelegatedEvents=oi;exports.convertRemToPixels=ia;exports.createComponent=mn;exports.createComputed=tn;exports.createContext=Rr;exports.createEffect=hn;exports.createMemo=te;exports.createRenderEffect=ye;exports.createRoot=me;exports.createSignal=K;exports.createUniqueId=Vr;exports.delegateEvents=hs;exports.deleteNestedDataByPath=et;exports.displayValue=Zi;exports.getMutationStatusColor=Xi;exports.getPreferredColorScheme=aa;exports.getQueryStatusColor=Yi;exports.getQueryStatusColorByLabel=Ji;exports.getQueryStatusLabel=Wi;exports.getSidedProp=Hi;exports.insert=_t;exports.mergeProps=yn;exports.mutationSortFns=ra;exports.on=Tr;exports.onCleanup=Ge;exports.onMount=ss;exports.serialize=Is;exports.setAttribute=It;exports.sortFns=na;exports.splitProps=cs;exports.spread=ys;exports.stringify=Qi;exports.template=ai;exports.untrack=Y;exports.updateNestedDataByPath=Ze;exports.use=ps;exports.useContext=Ir;exports.useTransition=Dr;
30
+ <%s key={someKey} {...props} />`,Ht,be,pr,be),Fn[be+Ht]=!0}}return c===s?dr(W):fr(W),W}}function hr(c,m,v){return Mn(c,m,v,!0)}function gr(c,m,v){return Mn(c,m,v,!1)}var mr=gr,yr=hr;Xe.Fragment=s,Xe.jsx=mr,Xe.jsxs=yr}()),Xe}process.env.NODE_ENV==="production"?en.exports=wr():en.exports=jr();var i=en.exports,T={context:void 0,registry:void 0,getContextId(){return Gn(this.context.count)},getNextContextId(){return Gn(this.context.count++)}};function Gn(e){const t=String(e),n=t.length-1;return T.context.id+(n?String.fromCharCode(96+n):"")+t}function Je(e){T.context=e}var Sr=(e,t)=>e===t,Tt=Symbol("solid-proxy"),dn=Symbol("solid-track"),At={equals:Sr},ts=os,de=1,Pt=2,ns={owned:null,cleanups:null,context:null,owner:null},Yt={},D=null,Xt=null,Cr=null,L=null,X=null,fe=null,Lt=0;function me(e,t){const n=L,s=D,r=e.length===0,a=t===void 0?s:t,o=r?ns:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=r?e:()=>e(()=>Y(()=>Mt(o)));D=o,L=null;try{return ce(l,!0)}finally{L=n,D=s}}function K(e,t){t=t?Object.assign({},At,t):At;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=r=>(typeof r=="function"&&(r=r(n.value)),as(n,r));return[is.bind(n),s]}function tn(e,t,n){const s=Ft(e,t,!0,de);ze(s)}function ye(e,t,n){const s=Ft(e,t,!1,de);ze(s)}function hn(e,t,n){ts=Mr;const s=Ft(e,t,!1,de);(!n||!n.render)&&(s.user=!0),fe?fe.push(s):ze(s)}function te(e,t,n){n=n?Object.assign({},At,n):At;const s=Ft(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,ze(s),is.bind(s)}function Er(e){return e&&typeof e=="object"&&"then"in e}function Nr(e,t,n){let s,r,a;arguments.length===2&&typeof t=="object"||arguments.length===1?(s=!0,r=e,a={}):(s=e,r=t,a={});let o=null,l=Yt,u=null,d=!1,g="initialValue"in a,h=typeof s=="function"&&te(s);const j=new Set,[S,C]=(a.storage||K)(a.initialValue),[x,w]=K(void 0),[y,b]=K(void 0,{equals:!1}),[O,$]=K(g?"ready":"unresolved");if(T.context){u=T.getNextContextId();let U;a.ssrLoadFrom==="initial"?l=a.initialValue:T.load&&(U=T.load(u))&&(l=U)}function B(U,V,G,ae){return o===U&&(o=null,ae!==void 0&&(g=!0),(U===l||V===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(ae,{value:V})),l=Yt,he(V,G)),V}function he(U,V){ce(()=>{V===void 0&&C(()=>U),$(V!==void 0?"errored":g?"ready":"unresolved"),w(V);for(const G of j.keys())G.decrement();j.clear()},!1)}function ve(){const U=_r,V=S(),G=x();if(G!==void 0&&!o)throw G;return L&&!L.user&&U&&tn(()=>{y(),o&&(U.resolved||j.has(U)||(U.increment(),j.add(U)))}),V}function ge(U=!0){if(U!==!1&&d)return;d=!1;const V=h?h():s;if(V==null||V===!1){B(o,Y(S));return}const G=l!==Yt?l:Y(()=>r(V,{value:S(),refetching:U}));return Er(G)?(o=G,"value"in G?(G.status==="success"?B(o,G.value,void 0,V):B(o,void 0,nn(G.value),V),G):(d=!0,queueMicrotask(()=>d=!1),ce(()=>{$(g?"refreshing":"pending"),b()},!1),G.then(ae=>B(G,ae,void 0,V),ae=>B(G,void 0,nn(ae),V)))):(B(o,G,void 0,V),G)}return Object.defineProperties(ve,{state:{get:()=>O()},error:{get:()=>x()},loading:{get(){const U=O();return U==="pending"||U==="refreshing"}},latest:{get(){if(!g)return ve();const U=x();if(U&&!o)throw U;return S()}}}),h?tn(()=>ge(!1)):ge(!1),[ve,{refetch:ge,mutate:C}]}function kr(e){return ce(e,!1)}function Y(e){if(L===null)return e();const t=L;L=null;try{return e()}finally{L=t}}function Tr(e,t,n){const s=Array.isArray(e);let r,a=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let d=0;d<e.length;d++)l[d]=e[d]()}else l=e();if(a)return a=!1,o;const u=Y(()=>t(l,r,o));return r=l,u}}function ss(e){hn(()=>Y(e))}function Ge(e){return D===null||(D.cleanups===null?D.cleanups=[e]:D.cleanups.push(e)),e}function Vn(){return D}function Ar(e,t){const n=D,s=L;D=e,L=null;try{return ce(t,!0)}catch(r){gn(r)}finally{D=n,L=s}}function Pr(e){const t=L,n=D;return Promise.resolve().then(()=>{L=t,D=n;let s;return ce(e,!1),L=D=null,s?s.done:void 0})}var[Or,Ba]=K(!1);function Dr(){return[Or,Pr]}function Rr(e,t){const n=Symbol("context");return{id:n,Provider:Br(n),defaultValue:e}}function Ir(e){let t;return D&&D.context&&(t=D.context[e.id])!==void 0?t:e.defaultValue}function rs(e){const t=te(e),n=te(()=>sn(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var _r;function is(){if(this.sources&&this.state)if(this.state===de)ze(this);else{const e=X;X=null,ce(()=>Dt(this),!1),X=e}if(L){const e=this.observers?this.observers.length:0;L.sources?(L.sources.push(this),L.sourceSlots.push(e)):(L.sources=[this],L.sourceSlots=[e]),this.observers?(this.observers.push(L),this.observerSlots.push(L.sources.length-1)):(this.observers=[L],this.observerSlots=[L.sources.length-1])}return this.value}function as(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&ce(()=>{for(let r=0;r<e.observers.length;r+=1){const a=e.observers[r],o=Xt&&Xt.running;o&&Xt.disposed.has(a),(o?!a.tState:!a.state)&&(a.pure?X.push(a):fe.push(a),a.observers&&ls(a)),o||(a.state=de)}if(X.length>1e6)throw X=[],new Error},!1)),t}function ze(e){if(!e.fn)return;Mt(e);const t=Lt;Lr(e,e.value,t)}function Lr(e,t,n){let s;const r=D,a=L;L=D=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=de,e.owned&&e.owned.forEach(Mt),e.owned=null),e.updatedAt=n+1,gn(o)}finally{L=a,D=r}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?as(e,s):e.value=s,e.updatedAt=n)}function Ft(e,t,n,s=de,r){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:D,context:D?D.context:null,pure:n};return D===null||D!==ns&&(D.owned?D.owned.push(a):D.owned=[a]),a}function Ot(e){if(e.state===0)return;if(e.state===Pt)return Dt(e);if(e.suspense&&Y(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Lt);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===de)ze(e);else if(e.state===Pt){const s=X;X=null,ce(()=>Dt(e,t[0]),!1),X=s}}function ce(e,t){if(X)return e();let n=!1;t||(X=[]),fe?n=!0:fe=[],Lt++;try{const s=e();return Fr(n),s}catch(s){n||(fe=null),X=null,gn(s)}}function Fr(e){if(X&&(os(X),X=null),e)return;const t=fe;fe=null,t.length&&ce(()=>ts(t),!1)}function os(e){for(let t=0;t<e.length;t++)Ot(e[t])}function Mr(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:Ot(s)}if(T.context){if(T.count){T.effects||(T.effects=[]),T.effects.push(...e.slice(0,n));return}else T.effects&&(e=[...T.effects,...e],n+=T.effects.length,delete T.effects);Je()}for(t=0;t<n;t++)Ot(e[t])}function Dt(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const r=s.state;r===de?s!==t&&(!s.updatedAt||s.updatedAt<Lt)&&Ot(s):r===Pt&&Dt(s,t)}}}function ls(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Pt,n.pure?X.push(n):fe.push(n),n.observers&&ls(n))}}function Mt(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const a=r.pop(),o=n.observerSlots.pop();s<r.length&&(a.sourceSlots[o]=s,r[s]=a,n.observerSlots[s]=o)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Mt(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function nn(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function gn(e,t=D){throw nn(e)}function sn(e){if(typeof e=="function"&&!e.length)return sn(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=sn(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function Br(e,t){return function(s){let r;return ye(()=>r=Y(()=>(D.context={...D.context,[e]:s.value},rs(()=>s.children))),void 0),r}}var rn=Symbol("fallback");function Rt(e){for(let t=0;t<e.length;t++)e[t]()}function Ur(e,t,n={}){let s=[],r=[],a=[],o=0,l=t.length>1?[]:null;return Ge(()=>Rt(a)),()=>{let u=e()||[],d=u.length,g,h;return u[dn],Y(()=>{let S,C,x,w,y,b,O,$,B;if(d===0)o!==0&&(Rt(a),a=[],s=[],r=[],o=0,l&&(l=[])),n.fallback&&(s=[rn],r[0]=me(he=>(a[0]=he,n.fallback())),o=1);else if(o===0){for(r=new Array(d),h=0;h<d;h++)s[h]=u[h],r[h]=me(j);o=d}else{for(x=new Array(d),w=new Array(d),l&&(y=new Array(d)),b=0,O=Math.min(o,d);b<O&&s[b]===u[b];b++);for(O=o-1,$=d-1;O>=b&&$>=b&&s[O]===u[$];O--,$--)x[$]=r[O],w[$]=a[O],l&&(y[$]=l[O]);for(S=new Map,C=new Array($+1),h=$;h>=b;h--)B=u[h],g=S.get(B),C[h]=g===void 0?-1:g,S.set(B,h);for(g=b;g<=O;g++)B=s[g],h=S.get(B),h!==void 0&&h!==-1?(x[h]=r[g],w[h]=a[g],l&&(y[h]=l[g]),h=C[h],S.set(B,h)):a[g]();for(h=b;h<d;h++)h in x?(r[h]=x[h],a[h]=w[h],l&&(l[h]=y[h],l[h](h))):r[h]=me(j);r=r.slice(0,o=d),s=u.slice(0)}return r});function j(S){if(a[h]=S,l){const[C,x]=K(h);return l[h]=x,t(u[h],C)}return t(u[h])}}}function qr(e,t,n={}){let s=[],r=[],a=[],o=[],l=0,u;return Ge(()=>Rt(a)),()=>{const d=e()||[],g=d.length;return d[dn],Y(()=>{if(g===0)return l!==0&&(Rt(a),a=[],s=[],r=[],l=0,o=[]),n.fallback&&(s=[rn],r[0]=me(j=>(a[0]=j,n.fallback())),l=1),r;for(s[0]===rn&&(a[0](),a=[],s=[],r=[],l=0),u=0;u<g;u++)u<s.length&&s[u]!==d[u]?o[u](()=>d[u]):u>=s.length&&(r[u]=me(h));for(;u<s.length;u++)a[u]();return l=o.length=a.length=g,s=d.slice(0),r=r.slice(0,l)});function h(j){a[u]=j;const[S,C]=K(d[u]);return o[u]=C,t(S,u)}}}function mn(e,t){return Y(()=>e(t||{}))}function Ct(){return!0}var an={get(e,t,n){return t===Tt?n:e.get(t)},has(e,t){return t===Tt?!0:e.has(t)},set:Ct,deleteProperty:Ct,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Ct,deleteProperty:Ct}},ownKeys(e){return e.keys()}};function Jt(e){return(e=typeof e=="function"?e():e)?e:{}}function $r(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function yn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Tt in l,e[o]=typeof l=="function"?(t=!0,te(l)):l}if(t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const u=Jt(e[l])[o];if(u!==void 0)return u}},has(o){for(let l=e.length-1;l>=0;l--)if(o in Jt(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(Jt(e[l])));return[...new Set(o)]}},an);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const u=Object.getOwnPropertyNames(l);for(let d=u.length-1;d>=0;d--){const g=u[d];if(g==="__proto__"||g==="constructor")continue;const h=Object.getOwnPropertyDescriptor(l,g);if(!s[g])s[g]=h.get?{enumerable:!0,configurable:!0,get:$r.bind(n[g]=[h.get.bind(l)])}:h.value!==void 0?h:void 0;else{const j=n[g];j&&(h.get?j.push(h.get.bind(l)):h.value!==void 0&&j.push(()=>h.value))}}}const r={},a=Object.keys(s);for(let o=a.length-1;o>=0;o--){const l=a[o],u=s[l];u&&u.get?Object.defineProperty(r,l,u):r[l]=u?u.value:void 0}return r}function cs(e,...t){if(Tt in e){const r=new Set(t.length>1?t.flat():t[0]),a=t.map(o=>new Proxy({get(l){return o.includes(l)?e[l]:void 0},has(l){return o.includes(l)&&l in e},keys(){return o.filter(l=>l in e)}},an));return a.push(new Proxy({get(o){return r.has(o)?void 0:e[o]},has(o){return r.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!r.has(o))}},an)),a}const n={},s=t.map(()=>({}));for(const r of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,r),o=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let l=!1,u=0;for(const d of t)d.includes(r)&&(l=!0,o?s[u][r]=a.value:Object.defineProperty(s[u],r,a)),++u;l||(o?n[r]=a.value:Object.defineProperty(n,r,a))}return[...s,n]}function us(e){let t,n;const s=r=>{const a=T.context;if(a){const[l,u]=K();T.count||(T.count=0),T.count++,(n||(n=e())).then(d=>{Je(a),T.count--,u(()=>d.default),Je()}),t=l}else if(!t){const[l]=Nr(()=>(n||(n=e())).then(u=>u.default));t=l}let o;return te(()=>(o=t())&&Y(()=>{if(!a)return o(r);const l=T.context;Je(a);const u=o(r);return Je(l),u}))};return s.preload=()=>n||((n=e()).then(r=>t=()=>r.default),n),s}var Gr=0;function Vr(){return T.context?T.getNextContextId():`cl-${Gr++}`}var fs=e=>`Stale read from <${e}>.`;function Kr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return te(Ur(()=>e.each,e.children,t||void 0))}function zr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return te(qr(()=>e.each,e.children,t||void 0))}function Qr(e){const t=e.keyed,n=te(()=>e.when,void 0,{equals:(s,r)=>t?s===r:!s==!r});return te(()=>{const s=n();if(s){const r=e.children;return typeof r=="function"&&r.length>0?Y(()=>r(t?s:()=>{if(!Y(n))throw fs("Show");return e.when})):r}return e.fallback},void 0,void 0)}function Wr(e){let t=!1;const n=(a,o)=>(t?a[1]===o[1]:!a[1]==!o[1])&&a[2]===o[2],s=rs(()=>e.children),r=te(()=>{let a=s();Array.isArray(a)||(a=[a]);for(let o=0;o<a.length;o++){const l=a[o].when;if(l)return t=!!a[o].keyed,[o,l,a[o]]}return[-1]},void 0,{equals:n});return te(()=>{const[a,o,l]=r();if(a<0)return e.fallback;const u=l.children;return typeof u=="function"&&u.length>0?Y(()=>u(t?o:()=>{if(Y(r)[0]!==a)throw fs("Match");return l.when})):u},void 0,void 0)}function Hr(e){return e}var Yr=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Xr=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Yr]),Jr=new Set(["innerHTML","textContent","innerText","children"]),Zr=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ei=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ti(e,t){const n=ei[e];return typeof n=="object"?n[t]?n.$:void 0:n}var ni=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),si=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),ri={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function ii(e,t,n){let s=n.length,r=t.length,a=s,o=0,l=0,u=t[r-1].nextSibling,d=null;for(;o<r||l<a;){if(t[o]===n[l]){o++,l++;continue}for(;t[r-1]===n[a-1];)r--,a--;if(r===o){const g=a<s?l?n[l-1].nextSibling:n[a-l]:u;for(;l<a;)e.insertBefore(n[l++],g)}else if(a===l)for(;o<r;)(!d||!d.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[l]===t[r-1]){const g=t[--r].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--a],g),t[r]=n[a]}else{if(!d){d=new Map;let h=l;for(;h<a;)d.set(n[h],h++)}const g=d.get(t[o]);if(g!=null)if(l<g&&g<a){let h=o,j=1,S;for(;++h<r&&h<a&&!((S=d.get(t[h]))==null||S!==g+j);)j++;if(j>g-l){const C=t[o];for(;l<g;)e.insertBefore(n[l++],C)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var tt="_$DX_DELEGATE";function ds(e,t,n,s={}){let r;return me(a=>{r=a,t===document?e():_t(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{r(),t.textContent=""}}function ai(e,t,n){let s;const r=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},a=()=>(s||(s=r())).cloneNode(!0);return a.cloneNode=a,a}function hs(e,t=window.document){const n=t[tt]||(t[tt]=new Set);for(let s=0,r=e.length;s<r;s++){const a=e[s];n.has(a)||(n.add(a),t.addEventListener(a,vs))}}function oi(e=window.document){if(e[tt]){for(let t of e[tt].keys())e.removeEventListener(t,vs);delete e[tt]}}function It(e,t,n){T.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function li(e,t,n,s){T.context&&e.isConnected||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function gs(e,t){T.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function ms(e,t,n,s){if(s)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const r=n[0];e.addEventListener(t,n[0]=a=>r.call(e,n[1],a))}else e.addEventListener(t,n)}function ci(e,t,n={}){const s=Object.keys(t||{}),r=Object.keys(n);let a,o;for(a=0,o=r.length;a<o;a++){const l=r[a];!l||l==="undefined"||t[l]||(Kn(e,l,!1),delete n[l])}for(a=0,o=s.length;a<o;a++){const l=s[a],u=!!t[l];!l||l==="undefined"||n[l]===u||!u||(Kn(e,l,!0),n[l]=u)}return n}function ui(e,t,n){if(!t)return n?It(e,"style"):t;const s=e.style;if(typeof t=="string")return s.cssText=t;typeof n=="string"&&(s.cssText=n=void 0),n||(n={}),t||(t={});let r,a;for(a in n)t[a]==null&&s.removeProperty(a),delete n[a];for(a in t)r=t[a],r!==n[a]&&(s.setProperty(a,r),n[a]=r);return n}function ys(e,t={},n,s){const r={};return s||ye(()=>r.children=st(e,t.children,r.children)),ye(()=>typeof t.ref=="function"&&ps(t.ref,e)),ye(()=>fi(e,t,n,!0,r,!0)),r}function ps(e,t,n){return Y(()=>e(t,n))}function _t(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return st(e,t,s,n);ye(r=>st(e,t(),r,n),s)}function fi(e,t,n,s,r={},a=!1){t||(t={});for(const o in r)if(!(o in t)){if(o==="children")continue;r[o]=zn(e,o,null,r[o],n,a)}for(const o in t){if(o==="children")continue;const l=t[o];r[o]=zn(e,o,l,r[o],n,a)}}function di(e){let t,n;return!T.context||!(t=T.registry.get(n=gi()))?e():(T.completed&&T.completed.add(t),T.registry.delete(n),t)}function hi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Kn(e,t,n){const s=t.trim().split(/\s+/);for(let r=0,a=s.length;r<a;r++)e.classList.toggle(s[r],n)}function zn(e,t,n,s,r,a){let o,l,u,d,g;if(t==="style")return ui(e,n,s);if(t==="classList")return ci(e,n,s);if(n===s)return s;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const h=t.slice(3);s&&e.removeEventListener(h,s),n&&e.addEventListener(h,n)}else if(t.slice(0,10)==="oncapture:"){const h=t.slice(10);s&&e.removeEventListener(h,s,!0),n&&e.addEventListener(h,n,!0)}else if(t.slice(0,2)==="on"){const h=t.slice(2).toLowerCase(),j=ni.has(h);if(!j&&s){const S=Array.isArray(s)?s[0]:s;e.removeEventListener(h,S)}(j||n)&&(ms(e,h,n,j),j&&hs([h]))}else if(t.slice(0,5)==="attr:")It(e,t.slice(5),n);else if((g=t.slice(0,5)==="prop:")||(u=Jr.has(t))||!r&&((d=ti(t,e.tagName))||(l=Xr.has(t)))||(o=e.nodeName.includes("-"))){if(g)t=t.slice(5),l=!0;else if(T.context&&e.isConnected)return n;t==="class"||t==="className"?gs(e,n):o&&!l&&!u?e[hi(t)]=n:e[d||t]=n}else{const h=r&&t.indexOf(":")>-1&&ri[t.split(":")[0]];h?li(e,h,t,n):It(e,Zr[t]||t,n)}return n}function vs(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),T.registry&&!T.done&&(T.done=_$HY.done=!0);n;){const s=n[t];if(s&&!n.disabled){const r=n[`${t}Data`];if(r!==void 0?s.call(n,r,e):s.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function st(e,t,n,s,r){const a=!!T.context&&e.isConnected;if(a){!n&&(n=[...e.childNodes]);let u=[];for(let d=0;d<n.length;d++){const g=n[d];g.nodeType===8&&g.data.slice(0,2)==="!$"?g.remove():u.push(g)}n=u}for(;typeof n=="function";)n=n();if(t===n)return n;const o=typeof t,l=s!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(a||o==="number"&&(t=t.toString(),t===n))return n;if(l){let u=n[0];u&&u.nodeType===3?u.data!==t&&(u.data=t):u=document.createTextNode(t),n=Ne(e,n,s,u)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(a)return n;n=Ne(e,n,s)}else{if(o==="function")return ye(()=>{let u=t();for(;typeof u=="function";)u=u();n=st(e,u,n,s)}),()=>n;if(Array.isArray(t)){const u=[],d=n&&Array.isArray(n);if(on(u,t,n,r))return ye(()=>n=st(e,u,n,s,!0)),()=>n;if(a){if(!u.length)return n;if(s===void 0)return[...e.childNodes];let g=u[0],h=[g];for(;(g=g.nextSibling)!==s;)h.push(g);return n=h}if(u.length===0){if(n=Ne(e,n,s),l)return n}else d?n.length===0?Qn(e,u,s):ii(e,n,u):(n&&Ne(e),Qn(e,u));n=u}else if(t.nodeType){if(a&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=Ne(e,n,s,t);Ne(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function on(e,t,n,s){let r=!1;for(let a=0,o=t.length;a<o;a++){let l=t[a],u=n&&n[e.length],d;if(!(l==null||l===!0||l===!1))if((d=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))r=on(e,l,u)||r;else if(d==="function")if(s){for(;typeof l=="function";)l=l();r=on(e,Array.isArray(l)?l:[l],Array.isArray(u)?u:[u])||r}else e.push(l),r=!0;else{const g=String(l);u&&u.nodeType===3&&u.data===g?e.push(u):e.push(document.createTextNode(g))}}return r}function Qn(e,t,n=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],n)}function Ne(e,t,n,s){if(n===void 0)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let a=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(r!==l){const u=l.parentNode===e;!a&&!o?u?e.replaceChild(r,l):e.insertBefore(r,n):u&&l.remove()}else a=!0}}else e.insertBefore(r,n);return[r]}function gi(){return T.getNextContextId()}var mi="http://www.w3.org/2000/svg";function xs(e,t=!1){return t?document.createElementNS(mi,e):document.createElement(e)}function yi(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,r=Vn();let a,o=!!T.context;return hn(()=>{o&&(Vn().user=o=!1),a||(a=Ar(r,()=>te(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[u,d]=K(!1),g=()=>d(!0);me(h=>_t(l,()=>u()?h():a(),null)),Ge(g)}else{const u=xs(e.isSVG?"g":"div",e.isSVG),d=t&&u.attachShadow?u.attachShadow({mode:"open"}):u;Object.defineProperty(u,"_$host",{get(){return n.parentNode},configurable:!0}),_t(d,a),l.appendChild(u),e.ref&&e.ref(u),Ge(()=>l.removeChild(u))}},void 0,{render:!o}),n}function pi(e){const[t,n]=cs(e,["component"]),s=te(()=>t.component);return te(()=>{const r=s();switch(typeof r){case"function":return Y(()=>r(n));case"string":const a=si.has(r),o=T.context?di():xs(r,a);return ys(o,n,a),o}})}var vi=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},bs=class{constructor(e){this.generateIdentifier=e,this.kv=new vi}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},xi=class extends bs{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function bi(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function wi(e,t){const n=bi(e);if("find"in n)return n.find(t);const s=n;for(let r=0;r<s.length;r++){const a=s[r];if(t(a))return a}}function Ve(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function kt(e,t){return e.indexOf(t)!==-1}function Wn(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var ji=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return wi(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Si=e=>Object.prototype.toString.call(e).slice(8,-1),ws=e=>typeof e>"u",Ci=e=>e===null,rt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,ln=e=>rt(e)&&Object.keys(e).length===0,pe=e=>Array.isArray(e),Ei=e=>typeof e=="string",Ni=e=>typeof e=="number"&&!isNaN(e),ki=e=>typeof e=="boolean",Ti=e=>e instanceof RegExp,it=e=>e instanceof Map,at=e=>e instanceof Set,js=e=>Si(e)==="Symbol",Ai=e=>e instanceof Date&&!isNaN(e.valueOf()),Pi=e=>e instanceof Error,Hn=e=>typeof e=="number"&&isNaN(e),Oi=e=>ki(e)||Ci(e)||ws(e)||Ni(e)||Ei(e)||js(e),Di=e=>typeof e=="bigint",Ri=e=>e===1/0||e===-1/0,Ii=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),_i=e=>e instanceof URL,Ss=e=>e.replace(/\./g,"\\."),Zt=e=>e.map(String).map(Ss).join("."),nt=e=>{const t=[];let n="";for(let r=0;r<e.length;r++){let a=e.charAt(r);if(a==="\\"&&e.charAt(r+1)==="."){n+=".",r++;continue}if(a==="."){t.push(n),n="";continue}n+=a}const s=n;return t.push(s),t};function le(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Cs=[le(ws,"undefined",()=>null,()=>{}),le(Di,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),le(Ai,"Date",e=>e.toISOString(),e=>new Date(e)),le(Pi,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n}),le(Ti,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),le(at,"set",e=>[...e.values()],e=>new Set(e)),le(it,"map",e=>[...e.entries()],e=>new Map(e)),le(e=>Hn(e)||Ri(e),"number",e=>Hn(e)?"NaN":e>0?"Infinity":"-Infinity",Number),le(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),le(_i,"URL",e=>e.toString(),e=>new URL(e))];function Bt(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Es=Bt((e,t)=>js(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const s=n.symbolRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown symbol");return s}),Li=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Ns=Bt(Ii,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=Li[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function ks(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Ts=Bt(ks,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const s={};return n.forEach(r=>{s[r]=e[r]}),s},(e,t,n)=>{const s=n.classRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(s.prototype),e)}),As=Bt((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const s=n.customTransformerRegistry.findByName(t[1]);if(!s)throw new Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),Fi=[Ts,Es,As,Ns],Yn=(e,t)=>{const n=Wn(Fi,r=>r.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=Wn(Cs,r=>r.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},Ps={};Cs.forEach(e=>{Ps[e.annotation]=e});var Mi=(e,t,n)=>{if(pe(t))switch(t[0]){case"symbol":return Es.untransform(e,t,n);case"class":return Ts.untransform(e,t,n);case"custom":return As.untransform(e,t,n);case"typed-array":return Ns.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=Ps[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},ke=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Os(e){if(kt(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(kt(e,"prototype"))throw new Error("prototype is not allowed as a property");if(kt(e,"constructor"))throw new Error("constructor is not allowed as a property")}var Bi=(e,t)=>{Os(t);for(let n=0;n<t.length;n++){const s=t[n];if(at(e))e=ke(e,+s);else if(it(e)){const r=+s,a=+t[++n]==0?"key":"value",o=ke(e,r);switch(a){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},cn=(e,t,n)=>{if(Os(t),t.length===0)return n(e);let s=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(pe(s)){const l=+o;s=s[l]}else if(rt(s))s=s[o];else if(at(s)){const l=+o;s=ke(s,l)}else if(it(s)){if(a===t.length-2)break;const u=+o,d=+t[++a]==0?"key":"value",g=ke(s,u);switch(d){case"key":s=g;break;case"value":s=s.get(g);break}}}const r=t[t.length-1];if(pe(s)?s[+r]=n(s[+r]):rt(s)&&(s[r]=n(s[r])),at(s)){const a=ke(s,+r),o=n(a);a!==o&&(s.delete(a),s.add(o))}if(it(s)){const a=+t[t.length-2],o=ke(s,a);switch(+r==0?"key":"value"){case"key":{const u=n(o);s.set(u,s.get(o)),u!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function un(e,t,n=[]){if(!e)return;if(!pe(e)){Ve(e,(a,o)=>un(a,t,[...n,...nt(o)]));return}const[s,r]=e;r&&Ve(r,(a,o)=>{un(a,t,[...n,...nt(o)])}),t(s,n)}function Ui(e,t,n){return un(t,(s,r)=>{e=cn(e,r,a=>Mi(a,s,n))}),e}function qi(e,t){function n(s,r){const a=Bi(e,nt(r));s.map(nt).forEach(o=>{e=cn(e,o,()=>a)})}if(pe(t)){const[s,r]=t;s.forEach(a=>{e=cn(e,nt(a),()=>e)}),r&&Ve(r,n)}else Ve(t,n);return e}var $i=(e,t)=>rt(e)||pe(e)||it(e)||at(e)||ks(e,t);function Gi(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function Vi(e,t){const n={};let s;return e.forEach(r=>{if(r.length<=1)return;t||(r=r.map(l=>l.map(String)).sort((l,u)=>l.length-u.length));const[a,...o]=r;a.length===0?s=o.map(Zt):n[Zt(a)]=o.map(Zt)}),s?ln(n)?[s]:[s,n]:ln(n)?void 0:n}var Ds=(e,t,n,s,r=[],a=[],o=new Map)=>{const l=Oi(e);if(!l){Gi(e,r,t);const S=o.get(e);if(S)return s?{transformedValue:null}:S}if(!$i(e,n)){const S=Yn(e,n),C=S?{transformedValue:S.value,annotations:[S.type]}:{transformedValue:e};return l||o.set(e,C),C}if(kt(a,e))return{transformedValue:null};const u=Yn(e,n),d=(u==null?void 0:u.value)??e,g=pe(d)?[]:{},h={};Ve(d,(S,C)=>{if(C==="__proto__"||C==="constructor"||C==="prototype")throw new Error(`Detected property ${C}. This is a prototype pollution risk, please remove it from your object.`);const x=Ds(S,t,n,s,[...r,C],[...a,e],o);g[C]=x.transformedValue,pe(x.annotations)?h[C]=x.annotations:rt(x.annotations)&&Ve(x.annotations,(w,y)=>{h[Ss(C)+"."+y]=w})});const j=ln(h)?{transformedValue:g,annotations:u?[u.type]:void 0}:{transformedValue:g,annotations:u?[u.type,h]:h};return l||o.set(e,j),j};function Rs(e){return Object.prototype.toString.call(e).slice(8,-1)}function Xn(e){return Rs(e)==="Array"}function Ki(e){if(Rs(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function zi(e,t,n,s,r){const a={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=n),r&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function fn(e,t={}){if(Xn(e))return e.map(r=>fn(r,t));if(!Ki(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((r,a)=>{if(Xn(t.props)&&!t.props.includes(a))return r;const o=e[a],l=fn(o,t);return zi(r,a,l,e,t.nonenumerable),r},{})}var F=class{constructor({dedupe:e=!1}={}){this.classRegistry=new xi,this.symbolRegistry=new bs(t=>t.description??""),this.customTransformerRegistry=new ji,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Ds(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const r=Vi(t,this.dedupe);return r&&(s.meta={...s.meta,referentialEqualities:r}),s}deserialize(e){const{json:t,meta:n}=e;let s=fn(t);return n!=null&&n.values&&(s=Ui(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=qi(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};F.defaultInstance=new F;F.serialize=F.defaultInstance.serialize.bind(F.defaultInstance);F.deserialize=F.defaultInstance.deserialize.bind(F.defaultInstance);F.stringify=F.defaultInstance.stringify.bind(F.defaultInstance);F.parse=F.defaultInstance.parse.bind(F.defaultInstance);F.registerClass=F.defaultInstance.registerClass.bind(F.defaultInstance);F.registerSymbol=F.defaultInstance.registerSymbol.bind(F.defaultInstance);F.registerCustom=F.defaultInstance.registerCustom.bind(F.defaultInstance);F.allowErrorProps=F.defaultInstance.allowErrorProps.bind(F.defaultInstance);var Is=F.serialize,Qi=F.stringify;function Wi(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Hi(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Yi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function Xi({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function Ji(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var Zi=(e,t=!1)=>{const{json:n}=Is(e);return JSON.stringify(n,null,t?2:void 0)},Et=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,ea=(e,t)=>e.queryHash.localeCompare(t.queryHash),_s=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,ta=(e,t)=>Et(e)===Et(t)?_s(e,t):Et(e)>Et(t)?1:-1,na={status:ta,"query hash":ea,"last updated":_s},Nt=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Ls=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,sa=(e,t)=>Nt(e)===Nt(t)?Ls(e,t):Nt(e)>Nt(t)?1:-1,ra={status:sa,"last updated":Ls},ia=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),aa=()=>{const[e,t]=K("dark");return ss(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=r=>{t(r.matches?"dark":"light")};n.addEventListener("change",s),Ge(()=>n.removeEventListener("change",s))}),e},Ze=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.set(t[0],n),s;const[r,...a]=t;return s.set(r,Ze(s.get(r),a,n)),s}if(e instanceof Set){const s=Ze(Array.from(e),t,n);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s[t[0]]=n,s;const[r,...a]=t;return s[r]=Ze(s[r],a,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[r,...a]=t;return s[r]=Ze(s[r],a,n),s}return e},et=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...r]=t;return n.set(s,et(n.get(s),r)),n}if(e instanceof Set){const n=et(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((a,o)=>o.toString()!==t[0]);const[s,...r]=t;return n[s]=et(n[s],r),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...r]=t;return n[s]=et(n[s],r),n}return e},Fs=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),r=document.createTextNode("");s.appendChild(r),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},Te,lt,ct,ut,we,ft,Ae,Pe,Oe,De,Re,Ie,dt,Jn,oa=(Jn=class{constructor(e){_(this,Te);_(this,lt);_(this,ct);_(this,ut);_(this,we,!1);_(this,ft);_(this,Ae);_(this,Pe);_(this,Oe);_(this,De);_(this,Re);_(this,Ie);_(this,dt);const{client:t,queryFlavor:n,version:s,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:d,shadowDOMTarget:g}=e;I(this,Te,K(t)),I(this,ct,n),I(this,ut,s),I(this,lt,r),I(this,ft,d),I(this,Ae,g),I(this,Pe,K(a)),I(this,Oe,K(o)),I(this,De,K(l)),I(this,Re,K(u))}setButtonPosition(e){N(this,Pe)[1](e)}setPosition(e){N(this,Oe)[1](e)}setInitialIsOpen(e){N(this,De)[1](e)}setErrorTypes(e){N(this,Re)[1](e)}setClient(e){N(this,Te)[1](e)}mount(e){if(N(this,we))throw new Error("Devtools is already mounted");const t=ds(()=>{const n=this,[s]=N(this,Pe),[r]=N(this,Oe),[a]=N(this,De),[o]=N(this,Re),[l]=N(this,Te);let u;return N(this,Ie)?u=N(this,Ie):(u=us(()=>Promise.resolve().then(()=>require("./BMGNQTAT-BMTuZgza.cjs"))),I(this,Ie,u)),Fs(N(this,ft),N(this,Ae)),mn(u,yn({get queryFlavor(){return N(n,ct)},get version(){return N(n,ut)},get onlineManager(){return N(n,lt)},get shadowDOMTarget(){return N(n,Ae)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()}}))},e);I(this,we,!0),I(this,dt,t)}unmount(){var e;if(!N(this,we))throw new Error("Devtools is not mounted");(e=N(this,dt))==null||e.call(this),I(this,we,!1)}},Te=new WeakMap,lt=new WeakMap,ct=new WeakMap,ut=new WeakMap,we=new WeakMap,ft=new WeakMap,Ae=new WeakMap,Pe=new WeakMap,Oe=new WeakMap,De=new WeakMap,Re=new WeakMap,Ie=new WeakMap,dt=new WeakMap,Jn),_e,ht,gt,mt,je,yt,Le,Fe,Me,Be,Ue,qe,$e,pt,Zn,la=(Zn=class{constructor(e){_(this,_e);_(this,ht);_(this,gt);_(this,mt);_(this,je,!1);_(this,yt);_(this,Le);_(this,Fe);_(this,Me);_(this,Be);_(this,Ue);_(this,qe);_(this,$e);_(this,pt);const{client:t,queryFlavor:n,version:s,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:d,shadowDOMTarget:g,onClose:h}=e;I(this,_e,K(t)),I(this,gt,n),I(this,mt,s),I(this,ht,r),I(this,yt,d),I(this,Le,g),I(this,Fe,K(a)),I(this,Me,K(o)),I(this,Be,K(l)),I(this,Ue,K(u)),I(this,qe,K(h))}setButtonPosition(e){N(this,Fe)[1](e)}setPosition(e){N(this,Me)[1](e)}setInitialIsOpen(e){N(this,Be)[1](e)}setErrorTypes(e){N(this,Ue)[1](e)}setClient(e){N(this,_e)[1](e)}setOnClose(e){N(this,qe)[1](()=>e)}mount(e){if(N(this,je))throw new Error("Devtools is already mounted");const t=ds(()=>{const n=this,[s]=N(this,Fe),[r]=N(this,Me),[a]=N(this,Be),[o]=N(this,Ue),[l]=N(this,_e),[u]=N(this,qe);let d;return N(this,$e)?d=N(this,$e):(d=us(()=>Promise.resolve().then(()=>require("./UODQIBEW-CvCtGFxl.cjs"))),I(this,$e,d)),Fs(N(this,yt),N(this,Le)),mn(d,yn({get queryFlavor(){return N(n,gt)},get version(){return N(n,mt)},get onlineManager(){return N(n,ht)},get shadowDOMTarget(){return N(n,Le)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()},get onClose(){return u()}}))},e);I(this,je,!0),I(this,pt,t)}unmount(){var e;if(!N(this,je))throw new Error("Devtools is not mounted");(e=N(this,pt))==null||e.call(this),I(this,je,!1)}},_e=new WeakMap,ht=new WeakMap,gt=new WeakMap,mt=new WeakMap,je=new WeakMap,yt=new WeakMap,Le=new WeakMap,Fe=new WeakMap,Me=new WeakMap,Be=new WeakMap,Ue=new WeakMap,qe=new WeakMap,$e=new WeakMap,pt=new WeakMap,Zn);function ca(e){const t=M.useQueryClient(e.client),n=se.useRef(null),{buttonPosition:s,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}=e,[d]=se.useState(new oa({client:t,queryFlavor:"React Query",version:"5",onlineManager:M.onlineManager,buttonPosition:s,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}));return se.useEffect(()=>{d.setClient(t)},[t,d]),se.useEffect(()=>{s&&d.setButtonPosition(s)},[s,d]),se.useEffect(()=>{r&&d.setPosition(r)},[r,d]),se.useEffect(()=>{d.setInitialIsOpen(a||!1)},[a,d]),se.useEffect(()=>{d.setErrorTypes(o||[])},[o,d]),se.useEffect(()=>(n.current&&d.mount(n.current),()=>{d.unmount()}),[d]),i.jsx("div",{className:"tsqd-parent-container",ref:n})}function ua(e){const t=M.useQueryClient(e.client),n=se.useRef(null),{errorTypes:s,styleNonce:r,shadowDOMTarget:a}=e,[o]=se.useState(new la({client:t,queryFlavor:"React Query",version:"5",onlineManager:M.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:r,shadowDOMTarget:a,onClose:e.onClose}));return se.useEffect(()=>{o.setClient(t)},[t,o]),se.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),se.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),se.useEffect(()=>(n.current&&o.mount(n.current),()=>{o.unmount()}),[o]),i.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:n})}var fa=process.env.NODE_ENV!=="development"?function(){return null}:ca;process.env.NODE_ENV;const da=es.atom({}),Ms=()=>es.useAtom(da),Bs=(e,t)=>{const[n]=Ms();return p.get(n,e,t)},J=()=>Bs("apiUrl","/chai/api"),pn=()=>{const e=M.useQueryClient(),{data:t}=M.useQuery({queryKey:["ai-context"],initialData:"",queryFn:()=>""});return{setAiContext:k.useCallback(s=>{e.setQueryData(["ai-context"],s)},[]),aiContext:t}},Z=async(e,t)=>{const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=await n.json();if(s!=null&&s.error||n.status===400||!n.ok)throw new Error((s==null?void 0:s.error)||"Something went wrong.");return s},ha=()=>{const e=J(),{aiContext:t}=pn();return k.useCallback(async(n,s,r,a)=>Z(e,{action:"ASK_AI",data:{type:n,prompt:s,blocks:r,context:t,lang:a}}),[e,t])},ga=()=>{const e=J(),{toast:t}=f.useToast();return{getUILibraryBlock:async(a,o)=>{const d=(await(await fetch(a.url+(o.path?"/blocks/"+o.path:"/"+o.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return Ke.getBlocksFromHTML(`${d}`)},getUILibraryBlocks:async a=>{try{return(await(await fetch(a.url+"/blocks.json")).json()).map(u=>({...u,preview:a.url.replace("chaiblocks","")+u.preview}))}catch(o){return console.error(o),[]}},onSave:async({page:a,blocks:o})=>{try{const l=await Z(e,{action:"UPDATE_PAGE",data:{id:a,blocks:o}});return t({title:"Success",description:"Page saved successfully",variant:"default"}),l}catch{return new Error("Failed to save blocks")}}}};function Qe(){const[e,t]=k.useState(new URLSearchParams(window.location.search));return k.useEffect(()=>{const n=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[]),[e,t]}const vn=()=>{const e=J();return M.useQuery({queryKey:["project-pages"],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:"GET_PROJECT_PAGES"})||[]})},vt=()=>{const[e]=Qe(),t=e.get("page"),{data:n,isFetching:s}=vn();return{data:k.useMemo(()=>p.find(n,{id:t})||{},[n,t]),isFetching:s}},ma=()=>M.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"meraki-ui",name:"Meraki UI",url:"https://chai-ui-blocks.vercel.app"},{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),ya=()=>{const[e]=Qe(),t=e.get("page"),n=J(),{setAiContext:s}=pn();return M.useQuery({queryKey:["page",t],initialData:[],queryFn:async()=>{const a=(await Z(n,{action:"GET_PAGE",data:{id:t,draft:!0}})).blocks??[],o=p.find(a,{_type:"@chai/ai-context"});return s(p.get(o,"_value","")||""),a},enabled:!!t})},pa=e=>k.useMemo(()=>{if(!e||p.isEmpty(e))return{blocks:[],theme:{}};const t=p.find(e,{_type:"@chai/theme"}),n=p.get(t,"_value",{})||{},s=p.filter(e,r=>!p.includes(r==null?void 0:r._type,"@chai/"));return{theme:n,blocks:s}},[e]),Us=()=>{const e=J();return M.useQuery({queryKey:["website-settings"],initialData:{theme:{},fallbackLang:"",languages:[]},queryFn:async()=>Z(e,{action:"GET_WEBSITE_SETTINGS"})})},va=()=>{const{data:e}=vn(),t=J();return{getGlobalBlocks:async()=>{const n={};for(const s of e??[])p.isEmpty(s==null?void 0:s.slug)&&(n[s.id]={name:p.startCase(s.name??s.slug),description:""});return n},getGlobalBlockBlocks:async n=>n?(await Z(t,{action:"GET_PAGE",data:{id:n,draft:!0}})).blocks:[]}},xa=()=>({uploadFile:async t=>(console.log("uploadFile",t),{})}),ot={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"},qs=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"CREATE_PAGE",data:s}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),n({title:`New ${r.collection==="global"?"global block":"page"} added successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to add new ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},xn=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"UPDATE_PAGE",data:s}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage||r!=null&&r.seo)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),r!=null&&r.seo?n({title:"SEO Settings updated successfully."}):n({title:`${r.collection==="global"?"Global block":"Page"} updated successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to update ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},ba=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"DELETE_PAGE",data:{id:s==null?void 0:s.id}}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),n({title:`${r.collection==="global"?"Global block":"Page"} deleted successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to delete ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},wa=()=>{const e=J(),t=M.useQueryClient(),{toast:n}=f.useToast();return M.useMutation({mutationFn:async s=>Z(e,{action:"TAKE_OFFLINE",data:{id:s==null?void 0:s.id}}),onSuccess:(s,r)=>{r&&(r!=null&&r.primaryPage)?t.invalidateQueries({queryKey:["language-pages",r==null?void 0:r.primaryPage]}):t.invalidateQueries({queryKey:["project-pages"]}),n({title:`${r.collection==="global"?"Global block":"Page"} taken offline successfully.`})},onError:(s,r)=>{n({variant:"destructive",title:`Failed to take offline ${r.collection==="global"?"global block":"page"}.`,description:s.message})}})},ja=()=>{const e=J(),{toast:t}=f.useToast(),n=M.useQueryClient(),{data:s}=vt();return M.useMutation({mutationFn:async({ids:r,theme:a})=>Z(e,{action:"PUBLISH_CHANGES",data:{ids:r,theme:a}}),onSuccess:()=>{t({title:"Your changes have been published successfully."}),n.invalidateQueries({queryKey:["get-page-changes"]}),n.invalidateQueries({queryKey:["project-pages"]}),n.invalidateQueries({queryKey:["language-pages",s==null?void 0:s.id]})},onError:()=>{t({title:"Failed to publish pages.",variant:"destructive"})}})},Sa=()=>{const e=J(),{toast:t}=f.useToast(),n=M.useQueryClient();return M.useMutation({mutationFn:async({id:s,slug:r})=>Z(e,{action:"CHANGE_SLUG",data:{id:s,slug:r}}),onSuccess:(s,{primaryPage:r})=>{t({title:"Slug changed successfully."}),r?n.invalidateQueries({queryKey:["language-pages",r]}):n.invalidateQueries({queryKey:["project-pages"]})},onError:()=>{t({title:"Failed to change slug",variant:"destructive"})}})},bn=()=>{const e=J(),[t]=Qe(),n=t.get("page");return M.useQuery({queryKey:["language-pages",n],initialData:[],queryFn:async()=>{if(!n)return null;const s=await Z(e,{action:"GET_LANGUAGE_PAGES",data:{id:n}});return p.reverse(p.sortBy(s,"primaryPage"))}})},Ca=()=>{const{selectedLang:e}=Ke.useLanguages(),{data:t,isFetching:n}=bn();return{data:k.useMemo(()=>p.find(t,{lang:e||""})||{},[t,e]),isFetching:n}},$s=()=>{const{data:e,isFetching:t}=Ca(),n=e==null?void 0:e.seo,[s,r]=k.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n}),a=k.useRef({initial:s,updated:s}),{selectedLang:o,fallbackLang:l,languages:u}=Ke.useLanguages(),d=o.length?o:l,{mutate:g,isPending:h}=xn(),j=h;k.useEffect(()=>{!t&&n&&r({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n})},[t,n]);const S=async()=>{g({id:e==null?void 0:e.id,seo:s}),a.current.initial=s,a.current.updated=s},C=()=>{r({...s,ogTitle:s.title,ogDescription:s.description})},x=()=>{r({...s,searchTitle:s.ogTitle,searchDescription:s.ogDescription})},w=y=>{const b={...s,[y.target.name]:y.target.name==="noIndex"||y.target.name==="noFollow"?y.target.checked:y.target.value};r(b),a.current.updated=b};return i.jsxs("div",{className:"relative pb-40",children:[i.jsxs("div",{className:"text-xs bg-gray-100 p-2 rounded-md text-left",children:["Slug: ",e==null?void 0:e.slug,"  ",u.length>0&&i.jsxs("span",{className:"text-blue-500 font-semibold",children:["(",p.get(ot,d,d),")"]})]}),i.jsx("form",{className:"space-y-8",children:i.jsxs(f.Accordion,{type:"multiple",defaultValue:["page"],children:[i.jsxs(f.AccordionItem,{value:"page",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"Seo Page"}),i.jsx(f.AccordionContent,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"title",children:"SEO Title"}),i.jsx(f.Input,{type:"text",id:"title",name:"title",value:s.title,onChange:w,disabled:j,placeholder:"Enter SEO title"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The title should be between 10 and 60 characters."})]}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"description",children:"SEO Description"}),i.jsx(f.Textarea,{id:"description",name:"description",value:s.description,onChange:w,disabled:j,placeholder:"Enter SEO description"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The description should be between 50 and 160 characters."})]}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"title",children:"Canonical URL"}),i.jsx(f.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:s.canonicalUrl,onChange:w,disabled:j,placeholder:"Enter Canonical URL"})]}),i.jsxs("div",{className:"",children:[i.jsxs("div",{className:"flex items-center gap-x-2",children:[i.jsx(f.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:s.noIndex,onChange:w,disabled:j,className:"h-4 w-4"}),i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Index"})]}),i.jsx("p",{className:"mt-2 text-[10px] font-light text-gray-400",children:"Check this if you don't want search engines to index this page."})]}),i.jsxs("div",{className:"",children:[i.jsxs("div",{className:"flex items-center gap-x-2",children:[i.jsx(f.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:s.noFollow,onChange:w,disabled:j,className:"h-4 w-4"}),i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Follow"})]}),i.jsx("p",{className:"mt-2 text-[10px] font-light text-gray-400",children:"Check this if you don't want search engines to follow links on this page."})]})]})})]}),i.jsxs(f.AccordionItem,{value:"og",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"OG"}),i.jsx(f.AccordionContent,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx(f.Button,{type:"button",variant:"outline",size:"sm",onClick:C,children:"Copy from SEO Settings"})}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"ogTitle",children:"OG Title"}),i.jsx(f.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:s.ogTitle,onChange:w,disabled:j,placeholder:"Enter OG title"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The OG title should be between 10 and 60 characters."})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"ogDescription",children:"OG Description"}),i.jsx(f.Textarea,{id:"ogDescription",name:"ogDescription",value:s.ogDescription,onChange:w,disabled:j,placeholder:"Enter OG description"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The OG description should be between 50 and 160 characters."})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"ogImage",children:"OG Image URL"}),i.jsx(f.Input,{type:"text",id:"ogImage",name:"ogImage",value:s.ogImage,onChange:w,disabled:j,placeholder:"Enter OG image URL"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"Enter a valid URL for the OG image."})]})]})})]}),i.jsxs(f.AccordionItem,{value:"search",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"Search"}),i.jsx(f.AccordionContent,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx(f.Button,{type:"button",variant:"outline",size:"sm",onClick:x,children:"Copy from OG Settings"})}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"searchTitle",children:"Search Title"}),i.jsx(f.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:s.searchTitle,onChange:w,disabled:j,placeholder:"Enter search title"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The search title should be between 10 and 60 characters."})]}),i.jsxs("div",{children:[i.jsx(f.Label,{className:"text-xs pb-1",htmlFor:"searchDescription",children:"Search Description"}),i.jsx(f.Textarea,{id:"searchDescription",name:"searchDescription",value:s.searchDescription,onChange:w,placeholder:"Enter search description"}),i.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400",children:"The search description should be between 50 and 160 characters."})]})]})})]}),i.jsxs(f.AccordionItem,{value:"jsonLD",children:[i.jsx(f.AccordionTrigger,{className:"text-blue-500",children:"JSON-LD"}),i.jsx(f.AccordionContent,{children:i.jsx("div",{className:"space-y-4",children:i.jsx("div",{children:i.jsx(f.Textarea,{id:"jsonLD",name:"jsonLD",rows:3,value:s.jsonLD,onChange:w,placeholder:"Enter JSON-LD"})})})})]})]})}),i.jsx("div",{className:"w-full flex items-center justify-end mt-4",children:i.jsx(f.Button,{size:"lg",variant:"default",onClick:S,disabled:p.isEqual(a.current.initial,s)||j,children:h?"Saving...":"Save"})})]})};$s.displayName="SeoPanel";const Ut=()=>{const e=J();return M.useQuery({queryKey:["project-collections"],initialData:[],queryFn:async()=>Z(e,{action:"GET_COLLECTIONS"})})},Ea=()=>{const e=J();return M.useMutation({mutationFn:async({collection:t,query:n})=>{try{return Z(e,{action:"SEARCH_PAGES",data:{collection:t,query:Array.isArray(n)&&n.length>0?n[0]:n}})||[]}catch{return[]}}})},Gs=({page:e,onClose:t})=>{const[n,s]=k.useState(e.slug||""),{mutate:r,isPending:a}=Sa(),{data:o}=Ut(),l=p.find(o,{key:e==null?void 0:e.collection}),u=g=>{g.preventDefault(),r({...e,slug:n},{onSuccess:t})},d=(e==null?void 0:e.lang)||"";return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Change Slug"}),i.jsx(f.DialogDescription,{className:"text-xs",children:i.jsxs(f.Alert,{variant:"destructive",className:"mt-2",children:[i.jsx(H.AlertCircle,{className:"h-4 w-4"}),"Changing the slug may have impact on your SEO. Please proceed with caution."]})})]}),i.jsxs("form",{onSubmit:u,children:[i.jsxs("div",{className:"space-y-4 py-4 text-sm ",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{children:[i.jsx("span",{children:"Type:"}),i.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(l==null?void 0:l.name)||(e==null?void 0:e.collection)]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Name:"}),i.jsxs("span",{className:"font-medium text-gray-600",children:[" ",e.name]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs(f.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",i.jsxs("small",{className:"font-light text-gray-500",children:["Slug should start with /",d]})]}),i.jsx(f.Input,{id:"slug",value:n,onChange:g=>{const h=g.target.value;p.startsWith(h,`/${d}`)&&s(h)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),i.jsx(f.DialogFooter,{children:i.jsx(f.Button,{type:"submit",disabled:a||!p.startsWith(n,`/${d}`)||p.isEqual(e==null?void 0:e.slug,n),children:a?"Changing...":"Change Slug"})})]})]})})};function Vs({page:e,onClose:t}){const[,n]=Qe(),{mutate:s,isPending:r}=ba(),a=()=>{s(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),n(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Confirm Deletion"}),i.jsxs(f.DialogDescription,{children:[i.jsxs("div",{children:["Are you sure you want to remove ",i.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",(e==null?void 0:e.collection)==="global"?"global block?":`page? ${e!=null&&e.primaryPage?"":"This will also delete all associated language pages."}`]}),e.lang&&i.jsxs("div",{className:"py-2 text-sm",children:["Language:"," ",i.jsx("span",{className:"font-medium text-gray-500",children:p.get(ot,e.lang,e.lang)})]})]})]}),i.jsxs(f.DialogFooter,{children:[i.jsx(f.Button,{variant:"outline",onClick:t,children:"Cancel"}),i.jsx(f.Button,{variant:"destructive",disabled:r,onClick:a,children:r?"Deleting...":"Delete"})]})]})})}const Ks=({page:e,onClose:t})=>{const{mutate:n,isPending:s}=wa(),r=async()=>{n(e,{onSuccess:t})};return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Confirm action"}),i.jsxs(f.DialogDescription,{children:["Are you sure you want to take offline"," ",i.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)}),"?"]})]}),i.jsxs(f.DialogFooter,{children:[i.jsx(f.Button,{variant:"outline",onClick:t,children:"Cancel"}),i.jsx(f.Button,{variant:"destructive",disabled:s,onClick:r,children:s?"Updating...":"Take offline"})]})]})})},Na=({langProps:e,onClose:t,languages:n})=>{const{data:s}=vt(),[r,a]=k.useState(e.name||""),[o,l]=k.useState(e.edit?e.lang:""),[u,d]=k.useState(e.edit?e.slug:""),{mutate:g,isPending:h}=qs(),{mutate:j,isPending:S}=xn(),C=(e==null?void 0:e.collection)==="global",x=h||S,w=y=>{y.preventDefault();const b={name:r,lang:o,primaryPage:s==null?void 0:s.id,slug:u,collection:s==null?void 0:s.collection};b.collection=e.collection,e.edit&&(b.id=e==null?void 0:e.id),e.edit?j(b,{onSuccess:t}):g(b,{onSuccess:t})};return i.jsx(f.Dialog,{open:!!e,onOpenChange:t,children:i.jsxs(f.DialogContent,{className:"sm:max-w-[425px]",children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:e.edit?"Edit language":"Add New language"}),i.jsx(f.DialogDescription,{children:"Enter the details for the language"})]}),i.jsxs("form",{onSubmit:w,children:[i.jsxs("div",{className:"grid gap-4 py-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"lang",className:"text-right",children:"Language"}),i.jsxs("select",{value:o,disabled:e.edit||p.isEmpty(n),onChange:y=>{const b=y.target.value;l(b),!C&&d(`/${b}`)},className:"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",children:[i.jsx("option",{value:"",disabled:!0,selected:!0,children:e.edit?p.get(ot,e.lang,e.lang):p.isEmpty(n)?"All available language page is created.":"Choose language"}),p.map(n,y=>i.jsx("option",{value:y,children:p.get(ot,y,y)},y))]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"slug",className:"text-right",children:"Page Name"}),i.jsx(f.Input,{id:"name",value:r,onChange:y=>a(y.target.value),className:"col-span-3",required:!0,placeholder:"Enter page name"})]}),!C&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs(f.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",i.jsx("small",{className:"font-light",children:e.edit?"To update slug use 'Change slug' action":" (Slug should start with /{lang})"})]}),i.jsx(f.Input,{id:"slug",value:u,onChange:y=>{const b=y.target.value;p.startsWith(b,`/${o}`)&&d(p.toLower(p.trim(b)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:p.isEmpty(o)||(e==null?void 0:e.edit),title:"Slug must start with /",placeholder:p.isEmpty(o)?"Choose language to add slug":"Enter page slug"})]})]}),i.jsx(f.DialogFooter,{children:i.jsx(f.Button,{type:"submit",disabled:x||!r||!o||!C&&!p.startsWith(u,`/${o}`),children:x?e.edit?"Updating...":"Adding...":e.edit?"Update":"Add new language"})})]})]})})},ka=()=>{const[e,t]=k.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:r}=Ke.useLanguages(),{data:a,isFetching:o}=bn(),{data:l}=vt(),[u,d]=k.useState(null),[g,h]=k.useState(null),[j,S]=k.useState(null),{data:C}=Us(),x=p.filter(p.get(C,"languages")||["en"],w=>!p.find(a,{lang:w})&&w!==p.get(C,"fallbackLang"));return i.jsxs("div",{className:"space-y-4 pt-2",children:[i.jsx("ul",{className:"space-y-2 mt-4",children:o?i.jsxs("div",{className:"w-full space-y-3 py-4",children:[i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):p.map(a,w=>{const y=w.lang,b=w.slug,O=!w.primaryPage,$=y===n;return i.jsxs(i.Fragment,{children:[i.jsxs("li",{className:`w-full p-2 rounded cursor-pointer flex items-center justify-between ${$?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>r(y),children:[i.jsxs("div",{className:" flex-1 gap-x-3",children:[i.jsxs("div",{className:"text-[13px] flex items-center gap-x-2",children:[p.get(ot,O?s:y,y),i.jsx("div",{style:{backgroundColor:w!=null&&w.online?"lightgreen":"lightgray"},className:"rounded-full w-3 h-3 mt-1"})]}),i.jsxs("div",{children:[b&&i.jsxs("div",{className:"text-[11px] text-gray-500",children:["Slug:",i.jsxs("b",{children:[" ",b]})]}),i.jsxs("div",{className:"text-[11px] text-gray-500",children:["Name:",i.jsxs("b",{children:[" ",w.name," "]})]})]})]}),O?i.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[i.jsx(H.StarIcon,{fill:"orange",className:"w-3 h-3"}),i.jsx("b",{children:" Primary"})]}):i.jsx("div",{className:"flex items-center gap-x-3",children:i.jsxs(f.DropdownMenu,{children:[i.jsx(f.DropdownMenuTrigger,{asChild:!0,onClick:B=>B.stopPropagation(),children:i.jsx(f.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:i.jsx(H.MoreVertical,{className:"h-4 w-4"})})}),i.jsxs(f.DropdownMenuContent,{align:"end",className:"text-sm",children:[i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),t({...w,edit:!0})},children:[i.jsx(H.PencilIcon,{className:"size-3"}),"Edit"]}),(w==null?void 0:w.online)&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),h(w)},children:[i.jsx(H.Power,{className:"size-3"}),"Take offline"]}),(w==null?void 0:w.collection)!=="global"&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),S(w)},children:[i.jsx(H.Link,{className:"size-3"}),"Change slug"]}),i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:B=>{B.stopPropagation(),d(w)},children:[i.jsx(H.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},w.id),i.jsx("div",{className:"h-1 w-full border-b"})]})})}),i.jsx("div",{className:"flex justify-center w-full",children:i.jsx(f.Button,{variant:"default",size:"sm",disabled:p.isEmpty(x),onClick:()=>{t({name:l==null?void 0:l.name,collection:l==null?void 0:l.collection,lang:"",slug:"",edit:!1})},children:"+ Add new language"})}),e&&i.jsx(Na,{languages:x,langProps:e,onClose:()=>t(null)}),u&&i.jsx(Vs,{page:u,onClose:()=>d(null)}),g&&i.jsx(Ks,{page:g,onClose:()=>h(null)}),j&&i.jsx(Gs,{page:j,onClose:()=>S(null)})]})},Ta=({activePage:e,editPage:t,onAddEditPage:n})=>{const[s,r]=k.useState("pages"),{data:a,isFetching:o}=vn(),[l,u]=k.useState(null),[d,g]=k.useState(null),[h,j]=k.useState(null),S=x=>{var b;if(s==="globalBlocks")return C(p.filter(x,O=>!O.slug));const w=p.groupBy(p.filter(x,O=>O.slug),"collection"),y=Object.entries(w).sort(([O],[$])=>O?!$||O.toLowerCase()==="page"?-1:$.toLowerCase()==="page"?1:O.localeCompare($):1);return i.jsx(f.Accordion,{type:"single",collapsible:!0,className:"w-full",defaultValue:((b=y[0])==null?void 0:b[0])||"uncategorized",children:y.map(([O,$])=>i.jsxs(f.AccordionItem,{value:O||"uncategorized",children:[i.jsx(f.AccordionTrigger,{className:"px-2",children:p.startCase(O)||"Uncategorized"}),i.jsx(f.AccordionContent,{className:"bg-white",children:i.jsx("div",{className:"space-y-2",children:C($)})})]},O))})},C=x=>p.orderBy(x,"online","desc").map(y=>i.jsxs(f.Button,{onClick:()=>t(y.id),variant:y.id===e?"default":"ghost",className:"flex justify-between items-center h-auto w-full space-x-2 py-1",children:[i.jsxs("div",{className:"flex items-center space-x-2 relative",children:[i.jsx("div",{className:"",children:i.jsx("div",{style:{backgroundColor:y!=null&&y.online?"lightgreen":"lightgray"},className:"rounded-full w-3 h-3"})}),i.jsxs("div",{className:"flex items-center",children:[i.jsxs("span",{children:[y.name??y.slug,"  "]}),(y==null?void 0:y.slug)&&i.jsxs("span",{className:"text-xs font-light",children:["(",y.slug,")"]})]})]}),i.jsx("div",{className:"flex items-center space-x-4",children:i.jsxs(f.DropdownMenu,{children:[i.jsx(f.DropdownMenuTrigger,{asChild:!0,onClick:b=>b.stopPropagation(),children:i.jsx(f.Button,{variant:"ghost",size:"sm",className:`h-8 w-8 p-0 hover:bg-transparent ${y.id===e?" hover:text-gray-200":"bg-transparent "}`,children:i.jsx(H.MoreVertical,{className:"h-4 w-4"})})}),i.jsxs(f.DropdownMenuContent,{align:"end",className:"text-sm",children:[i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),n({...y,global:s==="globalBlocks"})},children:[i.jsx(H.PencilIcon,{className:"size-3"}),"Edit"]}),(y==null?void 0:y.online)&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),g(y)},children:[i.jsx(H.Power,{className:"size-3"}),"Take offline"]}),(y==null?void 0:y.collection)!=="global"&&i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),j(y)},children:[i.jsx(H.Link,{className:"size-3"}),"Change slug"]}),i.jsxs(f.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),u(y)},children:[i.jsx(H.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},y.id));return i.jsxs(i.Fragment,{children:[i.jsx("br",{}),i.jsxs(f.Tabs,{value:s,className:"w-full",onValueChange:r,children:[i.jsxs(f.TabsList,{className:"w-full",children:[i.jsx(f.TabsTrigger,{value:"pages",className:"w-full",children:i.jsx("div",{className:"px-4",children:"Pages"})}),i.jsx(f.TabsTrigger,{value:"globalBlocks",className:"w-full",children:i.jsx("div",{className:"px-4",children:"Global Blocks"})})]}),o?i.jsxs("div",{className:"w-full space-y-3 py-4",children:[i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),i.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):i.jsxs("div",{className:"py-4 space-y-3",children:[i.jsx("div",{className:"w-full flex justify-center",children:i.jsxs(f.Button,{variant:"default",size:"sm",disabled:o,onClick:()=>n({slug:"",name:"",global:s==="globalBlocks"}),className:"mb-4 w-1/2 bg-blue-500 hover:bg-blue-400",children:[i.jsx(H.Plus,{className:"h-4 w-4 mr-2"}),o?"Loading...":`Add ${s==="pages"?"page":"Global Block"}`]})}),i.jsx("div",{className:"pt-0",children:i.jsx("div",{className:"space-y-2",children:o?i.jsx(Aa,{}):S(a)})})]})]}),l&&i.jsx(Vs,{page:l,onClose:()=>u(null)}),d&&i.jsx(Ks,{page:d,onClose:()=>g(null)}),h&&i.jsx(Gs,{page:h,onClose:()=>j(null)})]})};function Aa(){return i.jsx("div",{className:"h-32 w-full flex justify-center items-center text-sm animate-pulse",children:"Loading..."})}const Pa=({editPage:e,addEditPage:t,setAddEditPage:n})=>{const s=t.id,[r,a]=k.useState(s&&t.name||""),[o,l]=k.useState(s&&t.slug||""),[u,d]=k.useState(s?(t==null?void 0:t.collection)||"":"page"),{data:g=[]}=Ut(),{mutate:h,isPending:j}=qs(),{mutate:S,isPending:C}=xn(),x=j||C,w=y=>{y.preventDefault(),s?S({name:r,slug:o,id:t.id,collection:t.global?"global":u},{onSuccess:()=>{n(void 0)}}):h({name:r,slug:o,collection:t.global?"global":u},{onSuccess:b=>{e(b.page.id)}})};return i.jsx(f.Dialog,{open:!!t,onOpenChange:()=>n(void 0),children:i.jsxs(f.DialogContent,{className:"sm:max-w-[425px]",children:[i.jsxs(f.DialogHeader,{children:[i.jsxs(f.DialogTitle,{children:[s?"Edit":"Add New"," ",t.global?"Global Block":p.startCase(u)]}),i.jsxs(f.DialogDescription,{children:["Enter the details for the new"," ",t.global?"Global Block":`${p.startCase(u)}. Slug must start with /`]})]}),i.jsxs("form",{onSubmit:w,children:[i.jsxs("div",{className:"grid gap-4 py-4",children:[!t.global&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"pageType",children:"Type"}),i.jsx("select",{value:u,disabled:s,onChange:y=>d(y.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:g.map(y=>i.jsx("option",{value:y.key,children:y.name},y.key))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(f.Label,{htmlFor:"name",className:"text-right",children:"Name"}),i.jsx(f.Input,{id:"name",value:r,placeholder:`Enter ${t.global?"global block":"page"} name`,onChange:y=>a(y.target.value),className:"col-span-3",required:!0})]}),!t.global&&i.jsx(i.Fragment,{children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs(f.Label,{htmlFor:"slug",className:"text-right",children:[t.global?"Identifier":"Slug"," ",s&&i.jsx("small",{className:"text-gray-400 font-light",children:"To update slug use 'Change slug' action"})]}),i.jsx(f.Input,{id:"slug",value:o,disabled:s,onChange:y=>{var b;return l((b=y.target.value)==null?void 0:b.trim().toLowerCase())},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})})]}),i.jsx(f.DialogFooter,{children:i.jsx(f.Button,{type:"submit",disabled:x||!r||!t.global&&!o.startsWith("/")||p.isEqual(t.name,r)&&p.isEqual(t.slug,o)&&p.isEqual(t.pageType,u),children:x?s?"Updating...":"Adding...":t.global?`${s?"Update":"Add"} global block`:`${s?"Update":"Add"} Page`})})]})]})})};function Oa(e){const{activePage:t,canClose:n,open:s,close:r}=e,[,a]=Qe(),[o,l]=k.useState(),u=d=>{window.history.pushState({},"",`?page=${d}`),a(new URLSearchParams({page:d})),window.dispatchEvent(new PopStateEvent("popstate")),l(void 0),r()};return i.jsx(f.Sheet,{open:s,onOpenChange:d=>{!d&&n&&r()},children:i.jsxs(f.SheetContent,{side:"left",className:`border-border w-full ${n?"":"sheet-hide-close-btn"}`,children:[i.jsx("div",{children:i.jsx(Ta,{onAddEditPage:d=>l(d),activePage:t,editPage:u})}),o&&i.jsx(Pa,{editPage:u,addEditPage:o,setAddEditPage:l})]})})}const Da=()=>{const{t:e}=Ke.useTranslation(),{data:t,isFetching:n}=vt(),s=Bs("getPreviewUrl",async o=>o),[r,a]=k.useState("");return k.useEffect(()=>{(async()=>{if(!s||!(t!=null&&t.slug)){a("");return}const o=await s((t==null?void 0:t.slug)||"");a(o)})()},[s,t==null?void 0:t.slug]),!r||(t==null?void 0:t.collection)==="global"?null:i.jsxs(f.Button,{variant:"outline",disabled:n,size:"sm",className:"ml-2",children:[i.jsx(H.EyeIcon,{className:"h-4 w-4 mr-2"}),i.jsx("a",{href:r,target:"_blank",children:e("Preview")})]})},Ra=()=>{const e=J();return M.useQuery({queryKey:["get-page-changes"],queryFn:async()=>Z(e,{action:"GET_CHANGES"})})};function Ia({onClose:e=()=>console.log("Cancelled")}){const[t,n]=k.useState([]),{data:s,isFetching:r}=Ra(),{data:a}=Ut(),o=k.useMemo(()=>p.filter(s,x=>x.collection!=="global"),[s]),l=k.useMemo(()=>p.filter(s,{collection:"global"}),[s]),{mutate:u,isPending:d}=ja();k.useEffect(()=>{n(p.map(p.filter(s,{online:!0}),"id"))},[s]);const g=t.length===(s==null?void 0:s.length),h=x=>{n(w=>p.includes(w,x)?p.filter(w,y=>y!==x):p.concat(w,x))},j=()=>{n(g?[]:p.map(s,"id"))},S=()=>{u({ids:t,theme:!1},{onSuccess:()=>{e()}})},C=x=>{if(x==="global")return"Global Block";const w=p.find(a,{key:x});return w?w==null?void 0:w.name:x};return i.jsx(f.Dialog,{open:!0,onOpenChange:d?()=>{}:e,children:i.jsxs(f.DialogContent,{className:"max-w-4xl",children:[i.jsxs(f.DialogHeader,{children:[i.jsx(f.DialogTitle,{children:"Publish changes"}),i.jsx(f.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),i.jsx("div",{className:"relative overflow-x-auto -mx-4",children:r?i.jsxs("div",{className:"space-y-2 px-1",children:[i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse mt-2"}),i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),i.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"})]}):i.jsxs("table",{className:"max-h-96 w-full text-xs text-left rtl:text-right text-gray-500 dark:text-gray-400",children:[i.jsx("thead",{className:"text-gray-700 border-b bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:i.jsxs("tr",{children:[i.jsxs("th",{scope:"col",className:"px-6 py-3 flex items-center gap-x-2 w-[1 50px]",children:[i.jsx("input",{checked:g,onClick:x=>{x.stopPropagation(),j()},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 mt-1 cursor-pointer"}),"Name"]}),i.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Type"}),i.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),i.jsx("tbody",{children:p.map([{label:"Updated Pages & Global Blocks",top:"pt-2"},...p.orderBy(p.filter(o,{online:!0}),"collection"),...p.orderBy(p.filter(l,{online:!0}),"collection"),{label:"Offline Pages & Global Blocks",top:"pt-6"},...p.orderBy(p.filter(o,{online:!1}),"collection"),...p.orderBy(p.filter(l,{online:!1}),"collection")],x=>x.label?i.jsx("tr",{children:i.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${x.top}`,children:[i.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:i.jsx("div",{className:"w-full order-gray-300"})}),i.jsx("div",{className:"relative flex justify-start",children:i.jsx("span",{className:"bg-gray-50 pr-2",children:x.label})})]})},"separator"):i.jsxs("tr",{className:"hover:bg-gray-50 border-b last:border-b-0",children:[i.jsxs("td",{scope:"row",className:"px-6 py-2 text-gray-900 whitespace-nowrap dark:text-white flex items-center gap-x-1",children:[i.jsx("input",{checked:p.includes(t,x==null?void 0:x.id),onClick:w=>{w.stopPropagation(),h(x==null?void 0:x.id)},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 cursor-pointer"})," ",x.collection==="global"?i.jsx(H.GlobeIcon,{className:"h-4 w-4"}):i.jsx(H.File,{className:"h-4 w-4"}),x.name,x.slug&&i.jsxs("span",{className:"text-xs text-gray-500",children:["(",x.slug,")"]})]}),i.jsx("td",{className:"px-2",children:C(x==null?void 0:x.collection)}),i.jsx("td",{className:"px-4 text-right",children:p.first(x.changes)||""})]},x==null?void 0:x.id))})]})}),i.jsxs(f.DialogFooter,{className:"mt-10",children:[i.jsx(f.Button,{disabled:d,variant:"outline",onClick:e,children:"Cancel"}),i.jsx(f.Button,{disabled:d||r||p.isEmpty(s),onClick:S,children:d?"Publishing...":"Publish"})]})]})})}xr.loadWebBlocks();const _a=e=>{const t=k.useRef([]),[n]=Qe(),s=n.get("page"),{data:r,isFetching:a}=vt(),{data:o}=ma(),{data:l,isFetching:u}=ya(),{blocks:d}=pa(l),{data:g}=Us(),{data:h}=Ut(),{data:j}=bn(),S=ha(),{uploadFile:C}=xa(),{getUILibraryBlock:x,getUILibraryBlocks:w,onSave:y}=ga(),{getGlobalBlocks:b,getGlobalBlockBlocks:O}=va(),{aiContext:$,setAiContext:B}=pn(),{mutateAsync:he}=Ea();t.current=d;const[ve,ge]=k.useState(!1),[U,V]=k.useState(!1),[G,ae]=k.useState("SAVED");k.useEffect(()=>{const z=oe=>{G==="UNSAVED"&&(oe.preventDefault(),oe.returnValue=!1)};return G==="UNSAVED"&&window.addEventListener("beforeunload",z),()=>{window.removeEventListener("beforeunload",z)}},[G]);const re=k.useMemo(()=>{const z={};return e.mediaManagerComponent&&(z.mediaManagerComponent=e.mediaManagerComponent,z.uploadMediaCallback=C),z},[e.mediaManagerComponent,C]),ue=k.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...o,...e==null?void 0:e.uiLibraries]:o,[o,e==null?void 0:e.uiLibraries]),xe=k.useCallback(async(z,oe)=>await he({collection:z,query:oe}),[he]);return i.jsxs(i.Fragment,{children:[i.jsx(Ke.ChaiBuilderEditor,{loading:u,fallbackLang:g.fallbackLang||"en",languages:p.compact(p.map(j,"lang"))||[],brandingOptions:(g==null?void 0:g.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:e.autoSaveSupport||!1,autoSaveInterval:e.autoSaveInterval||15,onError:e.onError||console.error,getGlobalBlockBlocks:O,getGlobalBlocks:b,blocks:d,getUILibraryBlock:x,getUILibraryBlocks:w,uiLibraries:ue,collections:h,searchCollectionItems:xe,saveAiContextCallback:async z=>{if(!s)return!0;const oe=t.current,Se={_type:"@chai/ai-context",_value:p.isString(z)?z:""},xt=[...oe,Se];return await y({page:s,blocks:xt}),B(z),!0},onSaveStateChange:z=>ae(z),aiContext:$,askAiCallBack:S,onSave:async({blocks:z})=>{if(!s)return!0;t.current=z;const oe={_type:"@chai/ai-context",_value:p.isString($)?$:""},Se=[...z,oe];return await y({page:s,blocks:Se}),t.current=z,!0},topBarComponents:{left:[()=>i.jsxs(f.Button,{variant:"default",className:"flex justify-start max-w-[250px] items-center w-full space-x-2 py-1",onClick:()=>ge(!0),children:[p.includes(r.slug,"/")?i.jsx(H.File,{className:"h-4 w-4"}):i.jsx(H.GlobeIcon,{className:"h-4 w-4"}),i.jsx("span",{className:"truncate",children:(r==null?void 0:r.name)??""}),i.jsx(H.ArrowLeftRightIcon,{className:"h-4 w-4"})]},"template-viewer")],right:[Da,()=>i.jsxs(f.Button,{disabled:G!=="SAVED",size:"sm",variant:"default",onClick:()=>V(!0),children:[i.jsx(H.RocketIcon,{className:"h-4 w-4"}),"   Publish"]})]},sideBarComponents:{top:[...(r==null?void 0:r.collection)!=="global"?[{label:"SEO Setting",component:$s,icon:i.jsx(i.Fragment,{children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",fill:"currentColor",width:"21",height:"21",children:[i.jsx("path",{d:"M9.931 6.818c-1.238 0-2.136.925-2.136 2.2 0 1.279.898 2.207 2.136 2.207.664 0 1.257-.246 1.67-.694a.15.15 0 0 0-.009-.213l-.311-.286a.15.15 0 0 0-.213.009c-.273.297-.677.46-1.137.46-.699 0-1.233-.444-1.375-1.12h3.295a.15.15 0 0 0 .151-.151v-.211c0-1.295-.852-2.2-2.072-2.2m0 .724c.697 0 1.188.422 1.315 1.113h-2.69c.142-.673.676-1.113 1.374-1.113m4.332-.724c-1.246 0-2.15.925-2.15 2.2 0 1.279.904 2.207 2.15 2.207.596 0 1.143-.223 1.538-.628s.612-.965.612-1.579c0-1.275-.904-2.2-2.15-2.2m0 3.683c-.826 0-1.426-.624-1.426-1.483 0-.855.6-1.475 1.426-1.475s1.426.621 1.426 1.476c0 .423-.144.804-.406 1.073-.258.264-.62.41-1.019.41M6.318 8.71c-.665-.206-.902-.335-.902-.645 0-.47.564-.521.806-.521.29 0 .552.07.801.215a.15.15 0 0 0 .206-.055l.212-.366a.15.15 0 0 0-.055-.206 2.27 2.27 0 0 0-1.165-.312c-.915 0-1.53.501-1.53 1.245 0 .899.816 1.152 1.411 1.336.655.203.812.307.804.53-.016.398-.567.429-.735.429-.386 0-.722-.129-.972-.374q-.043-.042-.107-.043a.15.15 0 0 0-.106.045l-.295.302a.15.15 0 0 0 .002.213c.383.374.908.58 1.478.58.859 0 1.432-.441 1.459-1.125.031-.833-.746-1.074-1.313-1.249"}),i.jsx("path",{d:"M20.396 2.049H.604A.604.604 0 0 0 0 2.653v12.7c0 .333.27.604.604.604h6.941c-.266 1.296-.881 1.966-.886 1.971a.604.604 0 0 0 .434 1.024h6.815a.604.604 0 0 0 .434-1.024c-.007-.007-.621-.675-.886-1.971h6.941c.333 0 .604-.27.604-.604V2.652a.604.604 0 0 0-.604-.604m-.604 12.701h-.985v-.17a.604.604 0 0 0-1.208 0v.17h-.63v-.17a.604.604 0 0 0-1.208 0v.17H1.207V3.256h18.585z"})]})})}]:[],...p.isEmpty(g==null?void 0:g.languages)?[]:[{label:`Language ${(r==null?void 0:r.collection)==="global"?"":"page"}`,component:ka,icon:i.jsx(i.Fragment,{children:i.jsx("svg",{width:"21",height:"21",viewBox:"0 0 21 21",fill:"currentColor",children:i.jsxs("g",{fill:"none","fill-rule":"evenodd",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",children:[i.jsx("path",{d:"M18.5 10.5v-6a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2"}),i.jsx("path",{d:"M6.5 8.503h-2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.003l6-.01a2 2 0 0 0 1.997-2V14.5"}),i.jsx("path",{d:"M7.5 12.503h-3M9 14l-1 1q-.5.5-2.5 1.5"}),i.jsx("path",{d:"M5.5 12.503q.501 1.75 1.5 2.499c1 .749 1.5.999 2.5 1.498m4-12-3 6m3-6 3 6m-1-2h-4"})]})})})}]]},...re}),i.jsx(Oa,{activePage:s||"",canClose:!!s&&!p.isEmpty(r),open:!s||!a&&p.isEmpty(r)||ve,close:()=>ge(!1)}),U&&i.jsx(Ia,{onClose:()=>V(!1)})]})},La=new M.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),Fa=e=>{const[,t]=Ms();return k.useEffect(()=>{t(p.pick(e,["apiUrl","getPreviewUrl"]))},[e,t]),i.jsxs(M.QueryClientProvider,{client:La,children:[i.jsx(_a,{...e}),i.jsx(fa,{})]})};exports.$TRACK=dn;exports.ChaiBuilderForge=Fa;exports.Dynamic=pi;exports.For=Kr;exports.Index=zr;exports.Match=Hr;exports.Portal=yi;exports.Show=Qr;exports.Switch=Wr;exports.addEventListener=ms;exports.batch=kr;exports.className=gs;exports.clearDelegatedEvents=oi;exports.convertRemToPixels=ia;exports.createComponent=mn;exports.createComputed=tn;exports.createContext=Rr;exports.createEffect=hn;exports.createMemo=te;exports.createRenderEffect=ye;exports.createRoot=me;exports.createSignal=K;exports.createUniqueId=Vr;exports.delegateEvents=hs;exports.deleteNestedDataByPath=et;exports.displayValue=Zi;exports.getMutationStatusColor=Xi;exports.getPreferredColorScheme=aa;exports.getQueryStatusColor=Yi;exports.getQueryStatusColorByLabel=Ji;exports.getQueryStatusLabel=Wi;exports.getSidedProp=Hi;exports.insert=_t;exports.mergeProps=yn;exports.mutationSortFns=ra;exports.on=Tr;exports.onCleanup=Ge;exports.onMount=ss;exports.serialize=Is;exports.setAttribute=It;exports.sortFns=na;exports.splitProps=cs;exports.spread=ys;exports.stringify=Qi;exports.template=ai;exports.untrack=Y;exports.updateNestedDataByPath=Ze;exports.use=ps;exports.useContext=Ir;exports.useTransition=Dr;