@chaibuilder/pages 0.1.0-beta.113 → 0.1.0-beta.115
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.
- package/dist/{B4MFY5CR-BHM8zBJ-.cjs → B4MFY5CR-0C0u3YUF.cjs} +1 -1
- package/dist/{B4MFY5CR-DNer06Nd.js → B4MFY5CR-BBH88ePS.js} +1 -1
- package/dist/ChaiBuilderPages-CWsQnQsC.cjs +2 -0
- package/dist/ChaiBuilderPages-Cw4f2xbe.js +5636 -0
- package/dist/{HO4MOOFI-CffePJhl.cjs → HO4MOOFI-BGSYiPyp.cjs} +1 -1
- package/dist/{HO4MOOFI-DUeNOQ_Y.js → HO4MOOFI-Cw8NZ7cx.js} +2 -2
- package/dist/{HUY7CZI3-BsMJpjj2.cjs → HUY7CZI3-BJcRiq_q.cjs} +1 -1
- package/dist/{HUY7CZI3-DC9HgLo-.js → HUY7CZI3-DUzYiPV5.js} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -2
- package/package.json +3 -3
- package/dist/ChaiBuilderPages-7ZaR7nA5.cjs +0 -31
- package/dist/ChaiBuilderPages-DTfW3jhA.js +0 -6262
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-0C0u3YUF.cjs"),t=require("./ChaiBuilderPages-CWsQnQsC.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 "./B4MFY5CR-
|
|
2
|
-
import { g as d, c as f, a as e } from "./ChaiBuilderPages-
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-BBH88ePS.js";
|
|
2
|
+
import { g as d, c as f, a as e } from "./ChaiBuilderPages-Cw4f2xbe.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-0C0u3YUF.cjs"),t=require("./ChaiBuilderPages-CWsQnQsC.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-
|
|
2
|
-
import { g as v, c as C, a as e } from "./ChaiBuilderPages-
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-BBH88ePS.js";
|
|
2
|
+
import { g as v, c as C, a as e } from "./ChaiBuilderPages-Cw4f2xbe.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require("react/jsx-runtime");require("@chaibuilder/sdk");const e=require("./ChaiBuilderPages-CWsQnQsC.cjs");require("@chaibuilder/sdk/web-blocks");require("@tanstack/react-query");require("lodash-es");require("lucide-react");require("react");module.exports=e.ChaiBuilderForge;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
2
|
import "@chaibuilder/sdk";
|
|
3
|
+
import { W as d } from "./ChaiBuilderPages-Cw4f2xbe.js";
|
|
3
4
|
import "@chaibuilder/sdk/web-blocks";
|
|
4
5
|
import "@tanstack/react-query";
|
|
5
6
|
import "lodash-es";
|
|
6
7
|
import "lucide-react";
|
|
7
8
|
import "react";
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
d as default
|
|
10
11
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Suraj Air",
|
|
4
4
|
"license": "Private",
|
|
5
5
|
"homepage": "https://chaibuilder.com",
|
|
6
|
-
"version": "0.1.0-beta.
|
|
6
|
+
"version": "0.1.0-beta.115",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test": "vitest"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@chaibuilder/sdk": "^2.0.0-beta.
|
|
62
|
+
"@chaibuilder/sdk": "^2.0.0-beta.65",
|
|
63
63
|
"@types/react": "*",
|
|
64
64
|
"@types/react-dom": "*",
|
|
65
65
|
"react": "^18.0 || ^19.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@chaibuilder/runtime": "2.0.0-beta.21",
|
|
81
|
-
"@chaibuilder/sdk": "^2.0.0-beta.
|
|
81
|
+
"@chaibuilder/sdk": "^2.0.0-beta.65",
|
|
82
82
|
"@mhsdesign/jit-browser-tailwindcss": "^0.4.2",
|
|
83
83
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
84
84
|
"@tailwindcss/forms": "^0.5.10",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";var ls=e=>{throw TypeError(e)};var cs=(e,t,n)=>t.has(e)||ls("Cannot "+n);var G=(e,t,n)=>(cs(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?ls("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ne=(e,t,n,s)=>(cs(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);const w=require("react"),Oe=require("@chaibuilder/sdk"),Or=require("@chaibuilder/sdk/web-blocks"),K=require("@tanstack/react-query"),p=require("lodash-es"),R=require("lucide-react"),gn=require("jotai"),Cs=require("@chaibuilder/runtime"),d=require("@chaibuilder/sdk/ui");function Gr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const pe=Gr(w);var en={exports:{}},At={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var us;function Ur(){if(us)return At;us=1;var e=w,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,h){var y,g={},S=null,x=null;h!==void 0&&(S=""+h),c.key!==void 0&&(S=""+c.key),c.ref!==void 0&&(x=c.ref);for(y in c)s.call(c,y)&&!i.hasOwnProperty(y)&&(g[y]=c[y]);if(l&&l.defaultProps)for(y in c=l.defaultProps,c)g[y]===void 0&&(g[y]=c[y]);return{$$typeof:t,type:l,key:S,ref:x,props:g,_owner:a.current}}return At.Fragment=n,At.jsx=o,At.jsxs=o,At}var Nt={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ds;function Rr(){return ds||(ds=1,process.env.NODE_ENV!=="production"&&function(){var e=w,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),j=Symbol.iterator,A="@@iterator";function T(u){if(u===null||typeof u!="object")return null;var E=j&&u[j]||u[A];return typeof E=="function"?E:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(u){{for(var E=arguments.length,C=new Array(E>1?E-1:0),L=1;L<E;L++)C[L-1]=arguments[L];P("error",u,C)}}function P(u,E,C){{var L=v.ReactDebugCurrentFrame,te=L.getStackAddendum();te!==""&&(E+="%s",C=C.concat([te]));var ce=C.map(function(Y){return String(Y)});ce.unshift("Warning: "+E),Function.prototype.apply.call(console[u],console,ce)}}var V=!1,U=!1,de=!1,Se=!1,$=!1,X;X=Symbol.for("react.module.reference");function J(u){return!!(typeof u=="string"||typeof u=="function"||u===s||u===i||$||u===a||u===h||u===y||Se||u===x||V||U||de||typeof u=="object"&&u!==null&&(u.$$typeof===S||u.$$typeof===g||u.$$typeof===o||u.$$typeof===l||u.$$typeof===c||u.$$typeof===X||u.getModuleId!==void 0))}function B(u,E,C){var L=u.displayName;if(L)return L;var te=E.displayName||E.name||"";return te!==""?C+"("+te+")":C}function ge(u){return u.displayName||"Context"}function N(u){if(u==null)return null;if(typeof u.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case s:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case h:return"Suspense";case y:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case l:var E=u;return ge(E)+".Consumer";case o:var C=u;return ge(C._context)+".Provider";case c:return B(u,u.render,"ForwardRef");case g:var L=u.displayName||null;return L!==null?L:N(u.type)||"Memo";case S:{var te=u,ce=te._payload,Y=te._init;try{return N(Y(ce))}catch{return null}}}return null}var ie=Object.assign,Ce=0,Te,bt,Et,Ke,m,f,_;function I(){}I.__reactDisabledLog=!0;function F(){{if(Ce===0){Te=console.log,bt=console.info,Et=console.warn,Ke=console.error,m=console.group,f=console.groupCollapsed,_=console.groupEnd;var u={configurable:!0,enumerable:!0,value:I,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}Ce++}}function H(){{if(Ce--,Ce===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ie({},u,{value:Te}),info:ie({},u,{value:bt}),warn:ie({},u,{value:Et}),error:ie({},u,{value:Ke}),group:ie({},u,{value:m}),groupCollapsed:ie({},u,{value:f}),groupEnd:ie({},u,{value:_})})}Ce<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=v.ReactCurrentDispatcher,k;function q(u,E,C){{if(k===void 0)try{throw Error()}catch(te){var L=te.stack.trim().match(/\n( *(at )?)/);k=L&&L[1]||""}return`
|
|
18
|
-
`+k+u}}var ee=!1,oe;{var le=typeof WeakMap=="function"?WeakMap:Map;oe=new le}function ue(u,E){if(!u||ee)return"";{var C=oe.get(u);if(C!==void 0)return C}var L;ee=!0;var te=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ce;ce=W.current,W.current=null,F();try{if(E){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(_e){L=_e}Reflect.construct(u,[],Y)}else{try{Y.call()}catch(_e){L=_e}u.call(Y.prototype)}}else{try{throw Error()}catch(_e){L=_e}u()}}catch(_e){if(_e&&L&&typeof _e.stack=="string"){for(var z=_e.stack.split(`
|
|
19
|
-
`),Ae=L.stack.split(`
|
|
20
|
-
`),ye=z.length-1,xe=Ae.length-1;ye>=1&&xe>=0&&z[ye]!==Ae[xe];)xe--;for(;ye>=1&&xe>=0;ye--,xe--)if(z[ye]!==Ae[xe]){if(ye!==1||xe!==1)do if(ye--,xe--,xe<0||z[ye]!==Ae[xe]){var Le=`
|
|
21
|
-
`+z[ye].replace(" at new "," at ");return u.displayName&&Le.includes("<anonymous>")&&(Le=Le.replace("<anonymous>",u.displayName)),typeof u=="function"&&oe.set(u,Le),Le}while(ye>=1&&xe>=0);break}}}finally{ee=!1,W.current=ce,H(),Error.prepareStackTrace=te}var Ze=u?u.displayName||u.name:"",ze=Ze?q(Ze):"";return typeof u=="function"&&oe.set(u,ze),ze}function ve(u,E,C){return ue(u,!1)}function Q(u){var E=u.prototype;return!!(E&&E.isReactComponent)}function be(u,E,C){if(u==null)return"";if(typeof u=="function")return ue(u,Q(u));if(typeof u=="string")return q(u);switch(u){case h:return q("Suspense");case y:return q("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return ve(u.render);case g:return be(u.type,E,C);case S:{var L=u,te=L._payload,ce=L._init;try{return be(ce(te),E,C)}catch{}}}return""}var we=Object.prototype.hasOwnProperty,Pe={},ke=v.ReactDebugCurrentFrame;function Ie(u){if(u){var E=u._owner,C=be(u.type,u._source,E?E.type:null);ke.setExtraStackFrame(C)}else ke.setExtraStackFrame(null)}function De(u,E,C,L,te){{var ce=Function.call.bind(we);for(var Y in u)if(ce(u,Y)){var z=void 0;try{if(typeof u[Y]!="function"){var Ae=Error((L||"React class")+": "+C+" type `"+Y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[Y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ae.name="Invariant Violation",Ae}z=u[Y](E,Y,L,C,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ye){z=ye}z&&!(z instanceof Error)&&(Ie(te),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).",L||"React class",C,Y,typeof z),Ie(null)),z instanceof Error&&!(z.message in Pe)&&(Pe[z.message]=!0,Ie(te),b("Failed %s type: %s",C,z.message),Ie(null))}}}var bn=Array.isArray;function St(u){return bn(u)}function En(u){{var E=typeof Symbol=="function"&&Symbol.toStringTag,C=E&&u[Symbol.toStringTag]||u.constructor.name||"Object";return C}}function Xt(u){try{return Jt(u),!1}catch{return!0}}function Jt(u){return""+u}function wt(u){if(Xt(u))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",En(u)),Jt(u)}var Zt=v.ReactCurrentOwner,Sn={key:!0,ref:!0,__self:!0,__source:!0},jt,Ct;function Tt(u){if(we.call(u,"ref")){var E=Object.getOwnPropertyDescriptor(u,"ref").get;if(E&&E.isReactWarning)return!1}return u.ref!==void 0}function wn(u){if(we.call(u,"key")){var E=Object.getOwnPropertyDescriptor(u,"key").get;if(E&&E.isReactWarning)return!1}return u.key!==void 0}function jn(u,E){typeof u.ref=="string"&&Zt.current}function Er(u,E){{var C=function(){jt||(jt=!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)",E))};C.isReactWarning=!0,Object.defineProperty(u,"key",{get:C,configurable:!0})}}function Sr(u,E){{var C=function(){Ct||(Ct=!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)",E))};C.isReactWarning=!0,Object.defineProperty(u,"ref",{get:C,configurable:!0})}}var wr=function(u,E,C,L,te,ce,Y){var z={$$typeof:t,type:u,key:E,ref:C,props:Y,_owner:ce};return z._store={},Object.defineProperty(z._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(z,"_self",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.defineProperty(z,"_source",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.freeze&&(Object.freeze(z.props),Object.freeze(z)),z};function jr(u,E,C,L,te){{var ce,Y={},z=null,Ae=null;C!==void 0&&(wt(C),z=""+C),wn(E)&&(wt(E.key),z=""+E.key),Tt(E)&&(Ae=E.ref,jn(E,te));for(ce in E)we.call(E,ce)&&!Sn.hasOwnProperty(ce)&&(Y[ce]=E[ce]);if(u&&u.defaultProps){var ye=u.defaultProps;for(ce in ye)Y[ce]===void 0&&(Y[ce]=ye[ce])}if(z||Ae){var xe=typeof u=="function"?u.displayName||u.name||"Unknown":u;z&&Er(Y,xe),Ae&&Sr(Y,xe)}return wr(u,z,Ae,te,L,Zt.current,Y)}}var Cn=v.ReactCurrentOwner,ts=v.ReactDebugCurrentFrame;function Je(u){if(u){var E=u._owner,C=be(u.type,u._source,E?E.type:null);ts.setExtraStackFrame(C)}else ts.setExtraStackFrame(null)}var Tn;Tn=!1;function An(u){return typeof u=="object"&&u!==null&&u.$$typeof===t}function ns(){{if(Cn.current){var u=N(Cn.current.type);if(u)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+u+"`."}return""}}function Cr(u){return""}var ss={};function Tr(u){{var E=ns();if(!E){var C=typeof u=="string"?u:u.displayName||u.name;C&&(E=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+C+">.")}return E}}function rs(u,E){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var C=Tr(E);if(ss[C])return;ss[C]=!0;var L="";u&&u._owner&&u._owner!==Cn.current&&(L=" It was passed a child from "+N(u._owner.type)+"."),Je(u),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',C,L),Je(null)}}function as(u,E){{if(typeof u!="object")return;if(St(u))for(var C=0;C<u.length;C++){var L=u[C];An(L)&&rs(L,E)}else if(An(u))u._store&&(u._store.validated=!0);else if(u){var te=T(u);if(typeof te=="function"&&te!==u.entries)for(var ce=te.call(u),Y;!(Y=ce.next()).done;)An(Y.value)&&rs(Y.value,E)}}}function Ar(u){{var E=u.type;if(E==null||typeof E=="string")return;var C;if(typeof E=="function")C=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===c||E.$$typeof===g))C=E.propTypes;else return;if(C){var L=N(E);De(C,u.props,"prop",L,u)}else if(E.PropTypes!==void 0&&!Tn){Tn=!0;var te=N(E);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",te||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Nr(u){{for(var E=Object.keys(u.props),C=0;C<E.length;C++){var L=E[C];if(L!=="children"&&L!=="key"){Je(u),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",L),Je(null);break}}u.ref!==null&&(Je(u),b("Invalid attribute `ref` supplied to `React.Fragment`."),Je(null))}}var is={};function os(u,E,C,L,te,ce){{var Y=J(u);if(!Y){var z="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(z+=" 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 Ae=Cr();Ae?z+=Ae:z+=ns();var ye;u===null?ye="null":St(u)?ye="array":u!==void 0&&u.$$typeof===t?(ye="<"+(N(u.type)||"Unknown")+" />",z=" Did you accidentally export a JSX literal instead of a component?"):ye=typeof u,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ye,z)}var xe=jr(u,E,C,te,ce);if(xe==null)return xe;if(Y){var Le=E.children;if(Le!==void 0)if(L)if(St(Le)){for(var Ze=0;Ze<Le.length;Ze++)as(Le[Ze],u);Object.freeze&&Object.freeze(Le)}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 as(Le,u)}if(we.call(E,"key")){var ze=N(u),_e=Object.keys(E).filter(function(Lr){return Lr!=="key"}),Nn=_e.length>0?"{key: someKey, "+_e.join(": ..., ")+": ...}":"{key: someKey}";if(!is[ze+Nn]){var Dr=_e.length>0?"{"+_e.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s {...props} />
|
|
28
|
-
React keys must be passed directly to JSX without using spread:
|
|
29
|
-
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Nn,ze,Dr,ze),is[ze+Nn]=!0}}return u===s?Nr(xe):Ar(xe),xe}}function Pr(u,E,C){return os(u,E,C,!0)}function _r(u,E,C){return os(u,E,C,!1)}var kr=_r,Ir=Pr;Nt.Fragment=s,Nt.jsx=kr,Nt.jsxs=Ir}()),Nt}var fs;function Mr(){return fs||(fs=1,process.env.NODE_ENV==="production"?en.exports=Ur():en.exports=Rr()),en.exports}var r=Mr(),M={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return hs(this.context.count)},getNextContextId(){return hs(this.context.count++)}};function hs(e){const t=String(e),n=t.length-1;return M.context.id+(n?String.fromCharCode(96+n):"")+t}function Pt(e){M.context=e}var Br=(e,t)=>e===t,an=Symbol("solid-proxy"),Ts=typeof Proxy=="function",Hn=Symbol("solid-track"),on={equals:Br},As=Ls,qe=1,ln=2,Ns={owned:null,cleanups:null,context:null,owner:null},Pn={},Z=null,_n=null,Fr=null,re=null,je=null,Be=null,yn=0;function We(e,t){const n=re,s=Z,a=e.length===0,i=t===void 0?s:t,o=a?Ns:{owned:null,cleanups:null,context:i?i.context:null,owner:i},l=a?e:()=>e(()=>Ee(()=>Lt(o)));Z=o,re=null;try{return Re(l,!0)}finally{re=n,Z=s}}function fe(e,t){t=t?Object.assign({},on,t):on;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=a=>(typeof a=="function"&&(a=a(n.value)),Ds(n,a));return[Is.bind(n),s]}function Ps(e,t,n){const s=pn(e,t,!0,qe);vt(s)}function $e(e,t,n){const s=pn(e,t,!1,qe);vt(s)}function Wn(e,t,n){As=ta;const s=pn(e,t,!1,qe);(!n||!n.render)&&(s.user=!0),Be?Be.push(s):vt(s)}function Ne(e,t,n){n=n?Object.assign({},on,n):on;const s=pn(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,vt(s),Is.bind(s)}function qr(e){return e&&typeof e=="object"&&"then"in e}function Hr(e,t,n){let s,a,i;arguments.length===1?(s=!0,a=e,i={}):(s=e,a=t,i={});let o=null,l=Pn,c=null,h=!1,y="initialValue"in i,g=typeof s=="function"&&Ne(s);const S=new Set,[x,j]=(i.storage||fe)(i.initialValue),[A,T]=fe(void 0),[v,b]=fe(void 0,{equals:!1}),[P,V]=fe(y?"ready":"unresolved");M.context&&(c=M.getNextContextId(),i.ssrLoadFrom==="initial"?l=i.initialValue:M.load&&M.has(c)&&(l=M.load(c)));function U(X,J,B,ge){return o===X&&(o=null,ge!==void 0&&(y=!0),(X===l||J===l)&&i.onHydrated&&queueMicrotask(()=>i.onHydrated(ge,{value:J})),l=Pn,de(J,B)),J}function de(X,J){Re(()=>{J===void 0&&j(()=>X),V(J!==void 0?"errored":y?"ready":"unresolved"),T(J);for(const B of S.keys())B.decrement();S.clear()},!1)}function Se(){const X=Jr,J=x(),B=A();if(B!==void 0&&!o)throw B;return re&&re.user,J}function $(X=!0){if(X!==!1&&h)return;h=!1;const J=g?g():s;if(J==null||J===!1){U(o,Ee(x));return}const B=l!==Pn?l:Ee(()=>a(J,{value:x(),refetching:X}));return qr(B)?(o=B,"value"in B?(B.status==="success"?U(o,B.value,void 0,J):U(o,void 0,Ln(B.value),J),B):(h=!0,queueMicrotask(()=>h=!1),Re(()=>{V(y?"refreshing":"pending"),b()},!1),B.then(ge=>U(B,ge,void 0,J),ge=>U(B,void 0,Ln(ge),J)))):(U(o,B,void 0,J),B)}return Object.defineProperties(Se,{state:{get:()=>P()},error:{get:()=>A()},loading:{get(){const X=P();return X==="pending"||X==="refreshing"}},latest:{get(){if(!y)return Se();const X=A();if(X&&!o)throw X;return x()}}}),g?Ps(()=>$(!1)):$(!1),[Se,{refetch:$,mutate:j}]}function Wr(e){return Re(e,!1)}function Ee(e){if(re===null)return e();const t=re;re=null;try{return e()}finally{re=t}}function $r(e,t,n){const s=Array.isArray(e);let a,i=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let h=0;h<e.length;h++)l[h]=e[h]()}else l=e();if(i)return i=!1,o;const c=Ee(()=>t(l,a,o));return a=l,c}}function _s(e){Wn(()=>Ee(e))}function pt(e){return Z===null||(Z.cleanups===null?Z.cleanups=[e]:Z.cleanups.push(e)),e}function ms(){return Z}function Vr(e,t){const n=Z,s=re;Z=e,re=null;try{return Re(t,!0)}catch(a){$n(a)}finally{Z=n,re=s}}function Kr(e){const t=re,n=Z;return Promise.resolve().then(()=>{re=t,Z=n;let s;return Re(e,!1),re=Z=null,s?s.done:void 0})}var[zr,To]=fe(!1);function Qr(){return[zr,Kr]}function Yr(e,t){const n=Symbol("context");return{id:n,Provider:na(n),defaultValue:e}}function Xr(e){let t;return Z&&Z.context&&(t=Z.context[e.id])!==void 0?t:e.defaultValue}function ks(e){const t=Ne(e),n=Ne(()=>On(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var Jr;function Is(){if(this.sources&&this.state)if(this.state===qe)vt(this);else{const e=je;je=null,Re(()=>un(this),!1),je=e}if(re){const e=this.observers?this.observers.length:0;re.sources?(re.sources.push(this),re.sourceSlots.push(e)):(re.sources=[this],re.sourceSlots=[e]),this.observers?(this.observers.push(re),this.observerSlots.push(re.sources.length-1)):(this.observers=[re],this.observerSlots=[re.sources.length-1])}return this.value}function Ds(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&Re(()=>{for(let a=0;a<e.observers.length;a+=1){const i=e.observers[a],o=_n&&_n.running;o&&_n.disposed.has(i),(o?!i.tState:!i.state)&&(i.pure?je.push(i):Be.push(i),i.observers&&Os(i)),o||(i.state=qe)}if(je.length>1e6)throw je=[],new Error},!1)),t}function vt(e){if(!e.fn)return;Lt(e);const t=yn;Zr(e,e.value,t)}function Zr(e,t,n){let s;const a=Z,i=re;re=Z=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=qe,e.owned&&e.owned.forEach(Lt),e.owned=null),e.updatedAt=n+1,$n(o)}finally{re=i,Z=a}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Ds(e,s):e.value=s,e.updatedAt=n)}function pn(e,t,n,s=qe,a){const i={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Z,context:Z?Z.context:null,pure:n};return Z===null||Z!==Ns&&(Z.owned?Z.owned.push(i):Z.owned=[i]),i}function cn(e){if(e.state===0)return;if(e.state===ln)return un(e);if(e.suspense&&Ee(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<yn);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===qe)vt(e);else if(e.state===ln){const s=je;je=null,Re(()=>un(e,t[0]),!1),je=s}}function Re(e,t){if(je)return e();let n=!1;t||(je=[]),Be?n=!0:Be=[],yn++;try{const s=e();return ea(n),s}catch(s){n||(Be=null),je=null,$n(s)}}function ea(e){if(je&&(Ls(je),je=null),e)return;const t=Be;Be=null,t.length&&Re(()=>As(t),!1)}function Ls(e){for(let t=0;t<e.length;t++)cn(e[t])}function ta(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:cn(s)}if(M.context){if(M.count){M.effects||(M.effects=[]),M.effects.push(...e.slice(0,n));return}Pt()}for(M.effects&&(M.done||!M.count)&&(e=[...M.effects,...e],n+=M.effects.length,delete M.effects),t=0;t<n;t++)cn(e[t])}function un(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const a=s.state;a===qe?s!==t&&(!s.updatedAt||s.updatedAt<yn)&&cn(s):a===ln&&un(s,t)}}}function Os(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=ln,n.pure?je.push(n):Be.push(n),n.observers&&Os(n))}}function Lt(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),a=n.observers;if(a&&a.length){const i=a.pop(),o=n.observerSlots.pop();s<a.length&&(i.sourceSlots[o]=s,a[s]=i,n.observerSlots[s]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Lt(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Lt(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 Ln(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function $n(e,t=Z){throw Ln(e)}function On(e){if(typeof e=="function"&&!e.length)return On(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=On(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function na(e,t){return function(s){let a;return $e(()=>a=Ee(()=>(Z.context={...Z.context,[e]:s.value},ks(()=>s.children))),void 0),a}}var Gn=Symbol("fallback");function dn(e){for(let t=0;t<e.length;t++)e[t]()}function sa(e,t,n={}){let s=[],a=[],i=[],o=0,l=t.length>1?[]:null;return pt(()=>dn(i)),()=>{let c=e()||[],h=c.length,y,g;return c[Hn],Ee(()=>{let x,j,A,T,v,b,P,V,U;if(h===0)o!==0&&(dn(i),i=[],s=[],a=[],o=0,l&&(l=[])),n.fallback&&(s=[Gn],a[0]=We(de=>(i[0]=de,n.fallback())),o=1);else if(o===0){for(a=new Array(h),g=0;g<h;g++)s[g]=c[g],a[g]=We(S);o=h}else{for(A=new Array(h),T=new Array(h),l&&(v=new Array(h)),b=0,P=Math.min(o,h);b<P&&s[b]===c[b];b++);for(P=o-1,V=h-1;P>=b&&V>=b&&s[P]===c[V];P--,V--)A[V]=a[P],T[V]=i[P],l&&(v[V]=l[P]);for(x=new Map,j=new Array(V+1),g=V;g>=b;g--)U=c[g],y=x.get(U),j[g]=y===void 0?-1:y,x.set(U,g);for(y=b;y<=P;y++)U=s[y],g=x.get(U),g!==void 0&&g!==-1?(A[g]=a[y],T[g]=i[y],l&&(v[g]=l[y]),g=j[g],x.set(U,g)):i[y]();for(g=b;g<h;g++)g in A?(a[g]=A[g],i[g]=T[g],l&&(l[g]=v[g],l[g](g))):a[g]=We(S);a=a.slice(0,o=h),s=c.slice(0)}return a});function S(x){if(i[g]=x,l){const[j,A]=fe(g);return l[g]=A,t(c[g],j)}return t(c[g])}}}function ra(e,t,n={}){let s=[],a=[],i=[],o=[],l=0,c;return pt(()=>dn(i)),()=>{const h=e()||[],y=h.length;return h[Hn],Ee(()=>{if(y===0)return l!==0&&(dn(i),i=[],s=[],a=[],l=0,o=[]),n.fallback&&(s=[Gn],a[0]=We(S=>(i[0]=S,n.fallback())),l=1),a;for(s[0]===Gn&&(i[0](),i=[],s=[],a=[],l=0),c=0;c<y;c++)c<s.length&&s[c]!==h[c]?o[c](()=>h[c]):c>=s.length&&(a[c]=We(g));for(;c<s.length;c++)i[c]();return l=o.length=i.length=y,s=h.slice(0),a=a.slice(0,l)});function g(S){i[c]=S;const[x,j]=fe(h[c]);return o[c]=j,t(x,c)}}}function Vn(e,t){return Ee(()=>e(t||{}))}function tn(){return!0}var Un={get(e,t,n){return t===an?n:e.get(t)},has(e,t){return t===an?!0:e.has(t)},set:tn,deleteProperty:tn,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:tn,deleteProperty:tn}},ownKeys(e){return e.keys()}};function kn(e){return(e=typeof e=="function"?e():e)?e:{}}function aa(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function Kn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&an in l,e[o]=typeof l=="function"?(t=!0,Ne(l)):l}if(Ts&&t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const c=kn(e[l])[o];if(c!==void 0)return c}},has(o){for(let l=e.length-1;l>=0;l--)if(o in kn(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(kn(e[l])));return[...new Set(o)]}},Un);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const c=Object.getOwnPropertyNames(l);for(let h=c.length-1;h>=0;h--){const y=c[h];if(y==="__proto__"||y==="constructor")continue;const g=Object.getOwnPropertyDescriptor(l,y);if(!s[y])s[y]=g.get?{enumerable:!0,configurable:!0,get:aa.bind(n[y]=[g.get.bind(l)])}:g.value!==void 0?g:void 0;else{const S=n[y];S&&(g.get?S.push(g.get.bind(l)):g.value!==void 0&&S.push(()=>g.value))}}}const a={},i=Object.keys(s);for(let o=i.length-1;o>=0;o--){const l=i[o],c=s[l];c&&c.get?Object.defineProperty(a,l,c):a[l]=c?c.value:void 0}return a}function Gs(e,...t){if(Ts&&an in e){const a=new Set(t.length>1?t.flat():t[0]),i=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)}},Un));return i.push(new Proxy({get(o){return a.has(o)?void 0:e[o]},has(o){return a.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!a.has(o))}},Un)),i}const n={},s=t.map(()=>({}));for(const a of Object.getOwnPropertyNames(e)){const i=Object.getOwnPropertyDescriptor(e,a),o=!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable;let l=!1,c=0;for(const h of t)h.includes(a)&&(l=!0,o?s[c][a]=i.value:Object.defineProperty(s[c],a,i)),++c;l||(o?n[a]=i.value:Object.defineProperty(n,a,i))}return[...s,n]}function Us(e){let t,n;const s=a=>{const i=M.context;if(i){const[l,c]=fe();M.count||(M.count=0),M.count++,(n||(n=e())).then(h=>{!M.done&&Pt(i),M.count--,c(()=>h.default),Pt()}),t=l}else if(!t){const[l]=Hr(()=>(n||(n=e())).then(c=>c.default));t=l}let o;return Ne(()=>(o=t())?Ee(()=>{if(!i||M.done)return o(a);const l=M.context;Pt(i);const c=o(a);return Pt(l),c}):"")};return s.preload=()=>n||((n=e()).then(a=>t=()=>a.default),n),s}var ia=0;function oa(){return M.context?M.getNextContextId():`cl-${ia++}`}var Rs=e=>`Stale read from <${e}>.`;function la(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Ne(sa(()=>e.each,e.children,t||void 0))}function ca(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Ne(ra(()=>e.each,e.children,t||void 0))}function ua(e){const t=e.keyed,n=Ne(()=>e.when,void 0,{equals:(s,a)=>t?s===a:!s==!a});return Ne(()=>{const s=n();if(s){const a=e.children;return typeof a=="function"&&a.length>0?Ee(()=>a(t?s:()=>{if(!Ee(n))throw Rs("Show");return e.when})):a}return e.fallback},void 0,void 0)}function da(e){let t=!1;const n=(i,o)=>(t?i[1]===o[1]:!i[1]==!o[1])&&i[2]===o[2],s=ks(()=>e.children),a=Ne(()=>{let i=s();Array.isArray(i)||(i=[i]);for(let o=0;o<i.length;o++){const l=i[o].when;if(l)return t=!!i[o].keyed,[o,l,i[o]]}return[-1]},void 0,{equals:n});return Ne(()=>{const[i,o,l]=a();if(i<0)return e.fallback;const c=l.children;return typeof c=="function"&&c.length>0?Ee(()=>c(t?o:()=>{if(Ee(a)[0]!==i)throw Rs("Match");return l.when})):c},void 0,void 0)}function fa(e){return e}var ha=["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"],ma=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...ha]),ga=new Set(["innerHTML","textContent","innerText","children"]),ya=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),pa=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 xa(e,t){const n=pa[e];return typeof n=="object"?n[t]?n.$:void 0:n}var va=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),ba=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"]),Ea={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Sa(e,t,n){let s=n.length,a=t.length,i=s,o=0,l=0,c=t[a-1].nextSibling,h=null;for(;o<a||l<i;){if(t[o]===n[l]){o++,l++;continue}for(;t[a-1]===n[i-1];)a--,i--;if(a===o){const y=i<s?l?n[l-1].nextSibling:n[i-l]:c;for(;l<i;)e.insertBefore(n[l++],y)}else if(i===l)for(;o<a;)(!h||!h.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[i-1]&&n[l]===t[a-1]){const y=t[--a].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--i],y),t[a]=n[i]}else{if(!h){h=new Map;let g=l;for(;g<i;)h.set(n[g],g++)}const y=h.get(t[o]);if(y!=null)if(l<y&&y<i){let g=o,S=1,x;for(;++g<a&&g<i&&!((x=h.get(t[g]))==null||x!==y+S);)S++;if(S>y-l){const j=t[o];for(;l<y;)e.insertBefore(n[l++],j)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var It="_$DX_DELEGATE";function Ms(e,t,n,s={}){let a;return We(i=>{a=i,t===document?e():hn(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{a(),t.textContent=""}}function wa(e,t,n){let s;const a=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},i=()=>(s||(s=a())).cloneNode(!0);return i.cloneNode=i,i}function Bs(e,t=window.document){const n=t[It]||(t[It]=new Set);for(let s=0,a=e.length;s<a;s++){const i=e[s];n.has(i)||(n.add(i),t.addEventListener(i,$s))}}function ja(e=window.document){if(e[It]){for(let t of e[It].keys())e.removeEventListener(t,$s);delete e[It]}}function fn(e,t,n){Xe(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Ca(e,t,n,s){Xe(e)||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function Ta(e,t,n){Xe(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function Fs(e,t){Xe(e)||(t==null?e.removeAttribute("class"):e.className=t)}function qs(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 a=n[0];e.addEventListener(t,n[0]=i=>a.call(e,n[1],i))}else e.addEventListener(t,n,typeof n!="function"&&n)}function Aa(e,t,n={}){const s=Object.keys(t||{}),a=Object.keys(n);let i,o;for(i=0,o=a.length;i<o;i++){const l=a[i];!l||l==="undefined"||t[l]||(gs(e,l,!1),delete n[l])}for(i=0,o=s.length;i<o;i++){const l=s[i],c=!!t[l];!l||l==="undefined"||n[l]===c||!c||(gs(e,l,!0),n[l]=c)}return n}function Na(e,t,n){if(!t)return n?fn(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 a,i;for(i in n)t[i]==null&&s.removeProperty(i),delete n[i];for(i in t)a=t[i],a!==n[i]&&(s.setProperty(i,a),n[i]=a);return n}function Hs(e,t={},n,s){const a={};return s||$e(()=>a.children=Ot(e,t.children,a.children)),$e(()=>typeof t.ref=="function"&&Ws(t.ref,e)),$e(()=>Pa(e,t,n,!0,a,!0)),a}function Ws(e,t,n){return Ee(()=>e(t,n))}function hn(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return Ot(e,t,s,n);$e(a=>Ot(e,t(),a,n),s)}function Pa(e,t,n,s,a={},i=!1){t||(t={});for(const o in a)if(!(o in t)){if(o==="children")continue;a[o]=ys(e,o,null,a[o],n,i,t)}for(const o in t){if(o==="children")continue;const l=t[o];a[o]=ys(e,o,l,a[o],n,i,t)}}function _a(e){let t,n;return!Xe()||!(t=M.registry.get(n=Ia()))?e():(M.completed&&M.completed.add(t),M.registry.delete(n),t)}function Xe(e){return!!M.context&&!M.done&&(!e||e.isConnected)}function ka(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function gs(e,t,n){const s=t.trim().split(/\s+/);for(let a=0,i=s.length;a<i;a++)e.classList.toggle(s[a],n)}function ys(e,t,n,s,a,i,o){let l,c,h,y,g;if(t==="style")return Na(e,n,s);if(t==="classList")return Aa(e,n,s);if(n===s)return s;if(t==="ref")i||n(e);else if(t.slice(0,3)==="on:"){const S=t.slice(3);s&&e.removeEventListener(S,s,typeof s!="function"&&s),n&&e.addEventListener(S,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const S=t.slice(10);s&&e.removeEventListener(S,s,!0),n&&e.addEventListener(S,n,!0)}else if(t.slice(0,2)==="on"){const S=t.slice(2).toLowerCase(),x=va.has(S);if(!x&&s){const j=Array.isArray(s)?s[0]:s;e.removeEventListener(S,j)}(x||n)&&(qs(e,S,n,x),x&&Bs([S]))}else if(t.slice(0,5)==="attr:")fn(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Ta(e,t.slice(5),n);else if((g=t.slice(0,5)==="prop:")||(h=ga.has(t))||!a&&((y=xa(t,e.tagName))||(c=ma.has(t)))||(l=e.nodeName.includes("-")||"is"in o)){if(g)t=t.slice(5),c=!0;else if(Xe(e))return n;t==="class"||t==="className"?Fs(e,n):l&&!c&&!h?e[ka(t)]=n:e[y||t]=n}else{const S=a&&t.indexOf(":")>-1&&Ea[t.split(":")[0]];S?Ca(e,S,t,n):fn(e,ya[t]||t,n)}return n}function $s(e){if(M.registry&&M.events&&M.events.find(([c,h])=>h===e))return;let t=e.target;const n=`$$${e.type}`,s=e.target,a=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),o=()=>{const c=t[n];if(c&&!t.disabled){const h=t[`${n}Data`];if(h!==void 0?c.call(t,h,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},l=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),M.registry&&!M.done&&(M.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let h=0;h<c.length-2&&(t=c[h],!!o());h++){if(t._$host){t=t._$host,l();break}if(t.parentNode===a)break}}else l();i(s)}function Ot(e,t,n,s,a){const i=Xe(e);if(i){!n&&(n=[...e.childNodes]);let c=[];for(let h=0;h<n.length;h++){const y=n[h];y.nodeType===8&&y.data.slice(0,2)==="!$"?y.remove():c.push(y)}n=c}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(i||o==="number"&&(t=t.toString(),t===n))return n;if(l){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=et(e,n,s,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(i)return n;n=et(e,n,s)}else{if(o==="function")return $e(()=>{let c=t();for(;typeof c=="function";)c=c();n=Ot(e,c,n,s)}),()=>n;if(Array.isArray(t)){const c=[],h=n&&Array.isArray(n);if(Rn(c,t,n,a))return $e(()=>n=Ot(e,c,n,s,!0)),()=>n;if(i){if(!c.length)return n;if(s===void 0)return n=[...e.childNodes];let y=c[0];if(y.parentNode!==e)return n;const g=[y];for(;(y=y.nextSibling)!==s;)g.push(y);return n=g}if(c.length===0){if(n=et(e,n,s),l)return n}else h?n.length===0?ps(e,c,s):Sa(e,n,c):(n&&et(e),ps(e,c));n=c}else if(t.nodeType){if(i&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=et(e,n,s,t);et(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function Rn(e,t,n,s){let a=!1;for(let i=0,o=t.length;i<o;i++){let l=t[i],c=n&&n[e.length],h;if(!(l==null||l===!0||l===!1))if((h=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))a=Rn(e,l,c)||a;else if(h==="function")if(s){for(;typeof l=="function";)l=l();a=Rn(e,Array.isArray(l)?l:[l],Array.isArray(c)?c:[c])||a}else e.push(l),a=!0;else{const y=String(l);c&&c.nodeType===3&&c.data===y?e.push(c):e.push(document.createTextNode(y))}}return a}function ps(e,t,n=null){for(let s=0,a=t.length;s<a;s++)e.insertBefore(t[s],n)}function et(e,t,n,s){if(n===void 0)return e.textContent="";const a=s||document.createTextNode("");if(t.length){let i=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(a!==l){const c=l.parentNode===e;!i&&!o?c?e.replaceChild(a,l):e.insertBefore(a,n):c&&l.remove()}else i=!0}}else e.insertBefore(a,n);return[a]}function Ia(){return M.getNextContextId()}var Da="http://www.w3.org/2000/svg";function Vs(e,t=!1){return t?document.createElementNS(Da,e):document.createElement(e)}function La(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,a=ms();let i,o=!!M.context;return Wn(()=>{o&&(ms().user=o=!1),i||(i=Vr(a,()=>Ne(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[c,h]=fe(!1),y=()=>h(!0);We(g=>hn(l,()=>c()?g():i(),null)),pt(y)}else{const c=Vs(e.isSVG?"g":"div",e.isSVG),h=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),hn(h,i),l.appendChild(c),e.ref&&e.ref(c),pt(()=>l.removeChild(c))}},void 0,{render:!o}),n}function Oa(e){const[t,n]=Gs(e,["component"]),s=Ne(()=>t.component);return Ne(()=>{const a=s();switch(typeof a){case"function":return Ee(()=>a(n));case"string":const i=ba.has(a),o=M.context?_a():Vs(a,i);return Hs(o,n,i),o}})}var Ga=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()}},Ks=class{constructor(e){this.generateIdentifier=e,this.kv=new Ga}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)}},Ua=class extends Ks{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 Ra(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 Ma(e,t){const n=Ra(e);if("find"in n)return n.find(t);const s=n;for(let a=0;a<s.length;a++){const i=s[a];if(t(i))return i}}function xt(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function rn(e,t){return e.indexOf(t)!==-1}function xs(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var Ba=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Ma(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Fa=e=>Object.prototype.toString.call(e).slice(8,-1),zs=e=>typeof e>"u",qa=e=>e===null,Gt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,Mn=e=>Gt(e)&&Object.keys(e).length===0,Ve=e=>Array.isArray(e),Ha=e=>typeof e=="string",Wa=e=>typeof e=="number"&&!isNaN(e),$a=e=>typeof e=="boolean",Va=e=>e instanceof RegExp,Ut=e=>e instanceof Map,Rt=e=>e instanceof Set,Qs=e=>Fa(e)==="Symbol",Ka=e=>e instanceof Date&&!isNaN(e.valueOf()),za=e=>e instanceof Error,vs=e=>typeof e=="number"&&isNaN(e),Qa=e=>$a(e)||qa(e)||zs(e)||Wa(e)||Ha(e)||Qs(e),Ya=e=>typeof e=="bigint",Xa=e=>e===1/0||e===-1/0,Ja=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Za=e=>e instanceof URL,Ys=e=>e.replace(/\./g,"\\."),In=e=>e.map(String).map(Ys).join("."),Dt=e=>{const t=[];let n="";for(let a=0;a<e.length;a++){let i=e.charAt(a);if(i==="\\"&&e.charAt(a+1)==="."){n+=".",a++;continue}if(i==="."){t.push(n),n="";continue}n+=i}const s=n;return t.push(s),t};function Ge(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Xs=[Ge(zs,"undefined",()=>null,()=>{}),Ge(Ya,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),Ge(Ka,"Date",e=>e.toISOString(),e=>new Date(e)),Ge(za,"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}),Ge(Va,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),Ge(Rt,"set",e=>[...e.values()],e=>new Set(e)),Ge(Ut,"map",e=>[...e.entries()],e=>new Map(e)),Ge(e=>vs(e)||Xa(e),"number",e=>vs(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Ge(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Ge(Za,"URL",e=>e.toString(),e=>new URL(e))];function xn(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Js=xn((e,t)=>Qs(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}),ei=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Zs=xn(Ja,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=ei[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function er(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var tr=xn(er,(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(a=>{s[a]=e[a]}),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)}),nr=xn((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)}),ti=[tr,Js,nr,Zs],bs=(e,t)=>{const n=xs(ti,a=>a.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=xs(Xs,a=>a.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},sr={};Xs.forEach(e=>{sr[e.annotation]=e});var ni=(e,t,n)=>{if(Ve(t))switch(t[0]){case"symbol":return Js.untransform(e,t,n);case"class":return tr.untransform(e,t,n);case"custom":return nr.untransform(e,t,n);case"typed-array":return Zs.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=sr[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},tt=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function rr(e){if(rn(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(rn(e,"prototype"))throw new Error("prototype is not allowed as a property");if(rn(e,"constructor"))throw new Error("constructor is not allowed as a property")}var si=(e,t)=>{rr(t);for(let n=0;n<t.length;n++){const s=t[n];if(Rt(e))e=tt(e,+s);else if(Ut(e)){const a=+s,i=+t[++n]==0?"key":"value",o=tt(e,a);switch(i){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},Bn=(e,t,n)=>{if(rr(t),t.length===0)return n(e);let s=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(Ve(s)){const l=+o;s=s[l]}else if(Gt(s))s=s[o];else if(Rt(s)){const l=+o;s=tt(s,l)}else if(Ut(s)){if(i===t.length-2)break;const c=+o,h=+t[++i]==0?"key":"value",y=tt(s,c);switch(h){case"key":s=y;break;case"value":s=s.get(y);break}}}const a=t[t.length-1];if(Ve(s)?s[+a]=n(s[+a]):Gt(s)&&(s[a]=n(s[a])),Rt(s)){const i=tt(s,+a),o=n(i);i!==o&&(s.delete(i),s.add(o))}if(Ut(s)){const i=+t[t.length-2],o=tt(s,i);switch(+a==0?"key":"value"){case"key":{const c=n(o);s.set(c,s.get(o)),c!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function Fn(e,t,n=[]){if(!e)return;if(!Ve(e)){xt(e,(i,o)=>Fn(i,t,[...n,...Dt(o)]));return}const[s,a]=e;a&&xt(a,(i,o)=>{Fn(i,t,[...n,...Dt(o)])}),t(s,n)}function ri(e,t,n){return Fn(t,(s,a)=>{e=Bn(e,a,i=>ni(i,s,n))}),e}function ai(e,t){function n(s,a){const i=si(e,Dt(a));s.map(Dt).forEach(o=>{e=Bn(e,o,()=>i)})}if(Ve(t)){const[s,a]=t;s.forEach(i=>{e=Bn(e,Dt(i),()=>e)}),a&&xt(a,n)}else xt(t,n);return e}var ii=(e,t)=>Gt(e)||Ve(e)||Ut(e)||Rt(e)||er(e,t);function oi(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function li(e,t){const n={};let s;return e.forEach(a=>{if(a.length<=1)return;t||(a=a.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[i,...o]=a;i.length===0?s=o.map(In):n[In(i)]=o.map(In)}),s?Mn(n)?[s]:[s,n]:Mn(n)?void 0:n}var ar=(e,t,n,s,a=[],i=[],o=new Map)=>{const l=Qa(e);if(!l){oi(e,a,t);const x=o.get(e);if(x)return s?{transformedValue:null}:x}if(!ii(e,n)){const x=bs(e,n),j=x?{transformedValue:x.value,annotations:[x.type]}:{transformedValue:e};return l||o.set(e,j),j}if(rn(i,e))return{transformedValue:null};const c=bs(e,n),h=(c==null?void 0:c.value)??e,y=Ve(h)?[]:{},g={};xt(h,(x,j)=>{if(j==="__proto__"||j==="constructor"||j==="prototype")throw new Error(`Detected property ${j}. This is a prototype pollution risk, please remove it from your object.`);const A=ar(x,t,n,s,[...a,j],[...i,e],o);y[j]=A.transformedValue,Ve(A.annotations)?g[j]=A.annotations:Gt(A.annotations)&&xt(A.annotations,(T,v)=>{g[Ys(j)+"."+v]=T})});const S=Mn(g)?{transformedValue:y,annotations:c?[c.type]:void 0}:{transformedValue:y,annotations:c?[c.type,g]:g};return l||o.set(e,S),S};function ir(e){return Object.prototype.toString.call(e).slice(8,-1)}function Es(e){return ir(e)==="Array"}function ci(e){if(ir(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function ui(e,t,n,s,a){const i={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";i==="enumerable"&&(e[t]=n),a&&i==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function qn(e,t={}){if(Es(e))return e.map(a=>qn(a,t));if(!ci(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((a,i)=>{if(Es(t.props)&&!t.props.includes(i))return a;const o=e[i],l=qn(o,t);return ui(a,i,l,e,t.nonenumerable),a},{})}var ae=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Ua,this.symbolRegistry=new Ks(t=>t.description??""),this.customTransformerRegistry=new Ba,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=ar(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const a=li(t,this.dedupe);return a&&(s.meta={...s.meta,referentialEqualities:a}),s}deserialize(e){const{json:t,meta:n}=e;let s=qn(t);return n!=null&&n.values&&(s=ri(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=ai(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)}};ae.defaultInstance=new ae;ae.serialize=ae.defaultInstance.serialize.bind(ae.defaultInstance);ae.deserialize=ae.defaultInstance.deserialize.bind(ae.defaultInstance);ae.stringify=ae.defaultInstance.stringify.bind(ae.defaultInstance);ae.parse=ae.defaultInstance.parse.bind(ae.defaultInstance);ae.registerClass=ae.defaultInstance.registerClass.bind(ae.defaultInstance);ae.registerSymbol=ae.defaultInstance.registerSymbol.bind(ae.defaultInstance);ae.registerCustom=ae.defaultInstance.registerCustom.bind(ae.defaultInstance);ae.allowErrorProps=ae.defaultInstance.allowErrorProps.bind(ae.defaultInstance);var or=ae.serialize,di=ae.stringify;function fi(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 mi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function gi({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function yi(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var pi=(e,t=!1)=>{const{json:n}=or(e);return JSON.stringify(n,null,t?2:void 0)},nn=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,xi=(e,t)=>e.queryHash.localeCompare(t.queryHash),lr=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,vi=(e,t)=>nn(e)===nn(t)?lr(e,t):nn(e)>nn(t)?1:-1,bi={status:vi,"query hash":xi,"last updated":lr},sn=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,cr=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,Ei=(e,t)=>sn(e)===sn(t)?cr(e,t):sn(e)>sn(t)?1:-1,Si={status:Ei,"last updated":cr},wi=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),ji=()=>{const[e,t]=fe("dark");return _s(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=a=>{t(a.matches?"dark":"light")};n.addEventListener("change",s),pt(()=>n.removeEventListener("change",s))}),e},_t=(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[a,...i]=t;return s.set(a,_t(s.get(a),i,n)),s}if(e instanceof Set){const s=_t(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[a,...i]=t;return s[a]=_t(s[a],i,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[a,...i]=t;return s[a]=_t(s[a],i,n),s}return e},kt=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...a]=t;return n.set(s,kt(n.get(s),a)),n}if(e instanceof Set){const n=kt(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((i,o)=>o.toString()!==t[0]);const[s,...a]=t;return n[s]=kt(n[s],a),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...a]=t;return n[s]=kt(n[s],a),n}return e},ur=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),a=document.createTextNode("");s.appendChild(a),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},nt,Mt,Bt,Ft,Qe,qt,st,rt,at,it,ot,lt,Ht,ws,Ci=(ws=class{constructor(e){se(this,nt);se(this,Mt);se(this,Bt);se(this,Ft);se(this,Qe,!1);se(this,qt);se(this,st);se(this,rt);se(this,at);se(this,it);se(this,ot);se(this,lt);se(this,Ht);const{client:t,queryFlavor:n,version:s,onlineManager:a,buttonPosition:i,position:o,initialIsOpen:l,errorTypes:c,styleNonce:h,shadowDOMTarget:y}=e;ne(this,nt,fe(t)),ne(this,Bt,n),ne(this,Ft,s),ne(this,Mt,a),ne(this,qt,h),ne(this,st,y),ne(this,rt,fe(i)),ne(this,at,fe(o)),ne(this,it,fe(l)),ne(this,ot,fe(c))}setButtonPosition(e){G(this,rt)[1](e)}setPosition(e){G(this,at)[1](e)}setInitialIsOpen(e){G(this,it)[1](e)}setErrorTypes(e){G(this,ot)[1](e)}setClient(e){G(this,nt)[1](e)}mount(e){if(G(this,Qe))throw new Error("Devtools is already mounted");const t=Ms(()=>{const n=this,[s]=G(this,rt),[a]=G(this,at),[i]=G(this,it),[o]=G(this,ot),[l]=G(this,nt);let c;return G(this,lt)?c=G(this,lt):(c=Us(()=>Promise.resolve().then(()=>require("./HO4MOOFI-CffePJhl.cjs"))),ne(this,lt,c)),ur(G(this,qt),G(this,st)),Vn(c,Kn({get queryFlavor(){return G(n,Bt)},get version(){return G(n,Ft)},get onlineManager(){return G(n,Mt)},get shadowDOMTarget(){return G(n,st)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return a()},get initialIsOpen(){return i()},get errorTypes(){return o()}}))},e);ne(this,Qe,!0),ne(this,Ht,t)}unmount(){var e;if(!G(this,Qe))throw new Error("Devtools is not mounted");(e=G(this,Ht))==null||e.call(this),ne(this,Qe,!1)}},nt=new WeakMap,Mt=new WeakMap,Bt=new WeakMap,Ft=new WeakMap,Qe=new WeakMap,qt=new WeakMap,st=new WeakMap,rt=new WeakMap,at=new WeakMap,it=new WeakMap,ot=new WeakMap,lt=new WeakMap,Ht=new WeakMap,ws),ct,Wt,$t,Vt,Ye,Kt,ut,dt,ft,ht,mt,gt,yt,zt,js,Ti=(js=class{constructor(e){se(this,ct);se(this,Wt);se(this,$t);se(this,Vt);se(this,Ye,!1);se(this,Kt);se(this,ut);se(this,dt);se(this,ft);se(this,ht);se(this,mt);se(this,gt);se(this,yt);se(this,zt);const{client:t,queryFlavor:n,version:s,onlineManager:a,buttonPosition:i,position:o,initialIsOpen:l,errorTypes:c,styleNonce:h,shadowDOMTarget:y,onClose:g}=e;ne(this,ct,fe(t)),ne(this,$t,n),ne(this,Vt,s),ne(this,Wt,a),ne(this,Kt,h),ne(this,ut,y),ne(this,dt,fe(i)),ne(this,ft,fe(o)),ne(this,ht,fe(l)),ne(this,mt,fe(c)),ne(this,gt,fe(g))}setButtonPosition(e){G(this,dt)[1](e)}setPosition(e){G(this,ft)[1](e)}setInitialIsOpen(e){G(this,ht)[1](e)}setErrorTypes(e){G(this,mt)[1](e)}setClient(e){G(this,ct)[1](e)}setOnClose(e){G(this,gt)[1](()=>e)}mount(e){if(G(this,Ye))throw new Error("Devtools is already mounted");const t=Ms(()=>{const n=this,[s]=G(this,dt),[a]=G(this,ft),[i]=G(this,ht),[o]=G(this,mt),[l]=G(this,ct),[c]=G(this,gt);let h;return G(this,yt)?h=G(this,yt):(h=Us(()=>Promise.resolve().then(()=>require("./HUY7CZI3-BsMJpjj2.cjs"))),ne(this,yt,h)),ur(G(this,Kt),G(this,ut)),Vn(h,Kn({get queryFlavor(){return G(n,$t)},get version(){return G(n,Vt)},get onlineManager(){return G(n,Wt)},get shadowDOMTarget(){return G(n,ut)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return a()},get initialIsOpen(){return i()},get errorTypes(){return o()},get onClose(){return c()}}))},e);ne(this,Ye,!0),ne(this,zt,t)}unmount(){var e;if(!G(this,Ye))throw new Error("Devtools is not mounted");(e=G(this,zt))==null||e.call(this),ne(this,Ye,!1)}},ct=new WeakMap,Wt=new WeakMap,$t=new WeakMap,Vt=new WeakMap,Ye=new WeakMap,Kt=new WeakMap,ut=new WeakMap,dt=new WeakMap,ft=new WeakMap,ht=new WeakMap,mt=new WeakMap,gt=new WeakMap,yt=new WeakMap,zt=new WeakMap,js);function Ai(e){const t=K.useQueryClient(e.client),n=pe.useRef(null),{buttonPosition:s,position:a,initialIsOpen:i,errorTypes:o,styleNonce:l,shadowDOMTarget:c}=e,[h]=pe.useState(new Ci({client:t,queryFlavor:"React Query",version:"5",onlineManager:K.onlineManager,buttonPosition:s,position:a,initialIsOpen:i,errorTypes:o,styleNonce:l,shadowDOMTarget:c}));return pe.useEffect(()=>{h.setClient(t)},[t,h]),pe.useEffect(()=>{s&&h.setButtonPosition(s)},[s,h]),pe.useEffect(()=>{a&&h.setPosition(a)},[a,h]),pe.useEffect(()=>{h.setInitialIsOpen(i||!1)},[i,h]),pe.useEffect(()=>{h.setErrorTypes(o||[])},[o,h]),pe.useEffect(()=>(n.current&&h.mount(n.current),()=>{h.unmount()}),[h]),r.jsx("div",{className:"tsqd-parent-container",ref:n})}function Ni(e){const t=K.useQueryClient(e.client),n=pe.useRef(null),{errorTypes:s,styleNonce:a,shadowDOMTarget:i}=e,[o]=pe.useState(new Ti({client:t,queryFlavor:"React Query",version:"5",onlineManager:K.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:a,shadowDOMTarget:i,onClose:e.onClose}));return pe.useEffect(()=>{o.setClient(t)},[t,o]),pe.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),pe.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),pe.useEffect(()=>(n.current&&o.mount(n.current),()=>{o.unmount()}),[o]),r.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:n})}var Pi=process.env.NODE_ENV!=="development"?function(){return null}:Ai;process.env.NODE_ENV;const O={ASK_AI:"ASK_AI",GET_PAGE:"GET_PAGE",CREATE_PAGE:"CREATE_PAGE",UPDATE_PAGE:"UPDATE_PAGE",DELETE_PAGE:"DELETE_PAGE",CHANGE_SLUG:"CHANGE_SLUG",TAKE_OFFLINE:"TAKE_OFFLINE",PUBLISH_PAGE:"PUBLISH_PAGE",PUBLISH_CHANGES:"PUBLISH_CHANGES",ADD_NEW_LANGUAGE:"ADD_NEW_LANGUAGE",EDIT_LANGUAGE:"EDIT_LANGUAGE",DELETE_LANGUAGE:"DELETE_LANGUAGE",GET_CHANGES:"GET_CHANGES",GET_SERVER_BLOCK:"GET_SERVER_BLOCK",GET_LANGUAGE_PAGES:"GET_LANGUAGE_PAGES",GET_PROJECT_PAGES:"GET_PROJECT_PAGES",GET_WEBSITE_PAGES:"GET_WEBSITE_PAGES",UPDATE_WEBSITE_SETTINGS:"UPDATE_WEBSITE_SETTINGS",GET_COLLECTIONS:"GET_COLLECTIONS",GET_PAGE_TYPES:"GET_PAGE_TYPES",SEARCH_PAGES:"SEARCH_PAGES",GET_WEBSITE_SETTINGS:"GET_WEBSITE_SETTINGS",AI_CONTEXT:"AI_CONTEXT",GET_WEBSITE_DATA:"GET_WEBSITE_DATA",UPDATE_WEBSITE_DATA:"UPDATE_WEBSITE_DATA",GET_CHAI_USER:"GET_CHAI_USER",RELEASE_LOCK:"RELEASE_LOCK",GET_SEO_FIELDS:"GET_SEO_FIELDS",GET_BUILDER_PAGE_DATA:"GET_BUILDER_PAGE_DATA"},zn=()=>{const e=K.useQueryClient(),{data:t}=K.useQuery({queryKey:[O.AI_CONTEXT],initialData:"",queryFn:()=>""});return{setAiContext:w.useCallback(s=>{e.setQueryData([O.AI_CONTEXT],s)},[]),aiContext:t}},_i=gn.atom({}),dr=()=>gn.useAtom(_i),Fe=(e,t)=>{const[n]=dr();return p.get(n,e,t)},he=()=>Fe("apiUrl","/chai/api"),ki=async(e,t,n={})=>await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)}),me=()=>{const e=Fe("user"),t=Fe("onSessionExpired"),n=w.useMemo(()=>e==null?void 0:e.authToken,[e]);return w.useCallback(async(s,a,i={})=>{if(n)try{const o=await ki(s,a,{...i,Authorization:`Bearer ${n}`});if(o.status===401)throw t(),new Error("Session expired");if(o.status===400)throw new Error((await o.json()).error);return await o.json()}catch(o){throw console.error(o),o}},[n,t])},Ii=()=>{const e=he(),{aiContext:t}=zn(),n=me();return w.useCallback(async(s,a,i,o)=>n(e,{action:O.ASK_AI,data:{type:s,prompt:a,blocks:i,context:t,lang:o}}),[e,t,n])};function He(){const[e,t]=w.useState(new URLSearchParams(window.location.search));return w.useEffect(()=>{const n=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[]),[e,t]}const vn=()=>{const e=me(),t=he();return K.useQuery({queryKey:[O.GET_WEBSITE_PAGES],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:O.GET_WEBSITE_PAGES})||[]})},Me=()=>{const[e]=He(),t=e.get("page"),{data:n,isFetching:s}=vn();return{data:w.useMemo(()=>p.find(n,{id:t})||{},[n,t]),isFetching:s}},Di=(e,t)=>t.map(n=>{if(p.has(e,n._type)){const s=Cs.getDefaultBlockProps(n._type);return{...s,...p.pick(n,[...p.keys(s),"_type","_id","_name","_parent","_bindings"]),...p.pickBy(n,(a,i)=>p.endsWith(i,"_attrs")),...n}}return n}),Li=e=>{const t=Cs.useRegisteredChaiBlocks();return w.useMemo(()=>{if(!e||p.isEmpty(e))return{blocks:[]};const n=p.filter(e,s=>!p.includes(s==null?void 0:s._type,"@chai/"));return{blocks:Di(t,n)}},[e,t])},fr=e=>{const t=he(),n=me();return K.useQuery({queryKey:["chaiUserInfo",e],queryFn:async()=>await n(t,{action:O.GET_CHAI_USER,data:{userId:e}}),enabled:!!e&&e!=="EXPIRED"})},Oi=gn.atom(void 0),Qt=()=>{const[e]=He(),t=e.get("page"),n=Fe("user"),[s,a]=gn.useAtom(Oi);return w.useMemo(()=>({isLocked:t&&(n==null?void 0:n.id)!==s,currentEditor:s,setCurrentEditor:i=>a(i)}),[s,t,a,n==null?void 0:n.id])},hr=()=>{const[e]=He(),t=e.get("page"),n=he(),{setAiContext:s}=zn(),{setCurrentEditor:a}=Qt(),i=me();return K.useQuery({queryKey:[O.GET_PAGE,t],initialData:[],queryFn:async()=>{a("");const o=await i(n,{action:O.GET_PAGE,data:{id:t,draft:!0}});a(o.currentEditor);const l=o.blocks??[],c=p.find(l,{_type:"@chai/ai-context"});return s(p.get(c,"_value","")||""),l},enabled:!!t})},Gi=()=>{const{data:e}=Me(),{selectedLang:t}=Oe.useLanguages(),n=he(),s=me();return K.useQuery({queryKey:[O.GET_BUILDER_PAGE_DATA,e],queryFn:async()=>s(n,{action:O.GET_BUILDER_PAGE_DATA,data:{pageType:e==null?void 0:e.pageType,lang:t}}),enabled:!!(e!=null&&e.pageType)})},mr=()=>{const e=he(),t=K.useQueryClient(),n=me();return K.useMutation({mutationFn:async s=>n(e,{action:O.RELEASE_LOCK,data:s}),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:[O.GET_PAGE,a.id??""]})}})},gr=()=>{const e=he(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=me();return K.useMutation({mutationFn:async a=>s(e,{action:O.UPDATE_WEBSITE_SETTINGS,data:a}),onSuccess:(a,i)=>{var o;t.invalidateQueries({queryKey:[O.GET_WEBSITE_SETTINGS]}),(o=i==null?void 0:i.settings)!=null&&o.theme||n({title:"Website settings updated successfully."})},onError:a=>{n({variant:"destructive",title:"Failed to update website settings",description:a.message})}})},Ui=()=>{const e=he(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=me();return K.useMutation({mutationFn:async a=>s(e,{action:O.UPDATE_WEBSITE_DATA,data:a}),onSuccess:()=>{t.invalidateQueries({queryKey:[O.GET_WEBSITE_DATA]}),n({title:"Website data updated successfully."})},onError:a=>{n({variant:"destructive",title:"Failed to update website data",description:a.message})}})},Yt=()=>{const e=he(),t=me();return K.useQuery({queryKey:[O.GET_PAGE_TYPES],initialData:[],queryFn:async()=>t(e,{action:O.GET_PAGE_TYPES})})},Ri=()=>{const e=he(),t=me();return K.useMutation({mutationFn:async({pageType:n,query:s})=>{try{return t(e,{action:O.SEARCH_PAGES,data:{pageType:n,query:Array.isArray(s)&&s.length>0?s[0]:s}})||[]}catch(a){return console.error(a),[]}}})},Mi=()=>K.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),Qn=()=>{const e=he(),t=me();return K.useQuery({queryKey:[O.GET_WEBSITE_SETTINGS],initialData:{theme:{},fallbackLang:"en",languages:[]},queryFn:async()=>t(e,{action:O.GET_WEBSITE_SETTINGS,data:{draft:!0}})})},Bi=()=>{const e=he(),t=me(),{setCurrentEditor:n}=Qt();return{getUILibraryBlock:async(o,l)=>{const y=(await(await fetch(o.url+(l.path?"/blocks/"+l.path:"/"+l.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return Oe.getBlocksFromHTML(`${y}`)},getUILibraryBlocks:async o=>{try{return(await(await fetch(o.url+"/blocks.json")).json()).map(h=>({...h,preview:o.url.replace("chaiblocks","")+h.preview}))}catch(l){return console.error(l),[]}},onSave:async({page:o,blocks:l})=>{try{const c=await t(e,{action:"UPDATE_PAGE",data:{id:o,blocks:l}});return c.code==="PAGE_LOCKED"?(n(c.editor===null?"EXPIRED":c.editor),!0):c}catch(c){return console.error(c),new Error("Failed to save blocks")}}}},Fi=()=>{const{data:e}=vn(),t=he(),n=me();return{getGlobalBlocks:async()=>{const s={};for(const a of e??[])p.isEmpty(a==null?void 0:a.slug)&&(s[a.id]={name:p.startCase(a.name??a.slug),description:""});return s},getGlobalBlockBlocks:async s=>s?(await n(t,{action:"GET_PAGE",data:{id:s,draft:!0,editor:!1}})).blocks:[]}},Ue={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"},Yn=()=>{const e=he(),[t]=He(),n=t.get("page"),s=me();return K.useQuery({queryKey:[O.GET_LANGUAGE_PAGES,n],initialData:[],queryFn:async()=>{if(!n)return null;const a=await s(e,{action:O.GET_LANGUAGE_PAGES,data:{id:n}});return p.reverse(p.sortBy(a,"primaryPage"))},enabled:!!n})},D={PREVIEW:"Preview",THEME:"Theme",SAVEDRAFT:"Save draft",SAVING:"Saving",SAVED:"Saved",PUBLISHED:"Published",PUBLISH:"Publish",UNPUBLISH:"Unpublish",WEBSITEDATA:"Website data",OPEN:"Open",EDIT_LANGUAGE:"Edit language",ADD_NEW_LANGUAGE:"Add New language",ENTER_LANGUAGE_DETAILS:"Enter the details for the language",LANGUAGE:"Language",PAGE_NAME:"Page Name",SLUG:"Slug",UPDATE:"Update",UPDATING:"Updating...",ADDING:"Adding...",CHOOSE_LANGUAGE:"Choose language",ALL_AVAILABLE_LANGUAGE_PAGE:"All available language page is created.",TO_UPDATE_SLUG:"To update slug use 'Change slug' action",SLUG_SHOULD_START_WITH:" (Slug should start with /{lang})",CHOOSE_LANGUAGE_TO_ADD_SLUG:"Choose language to add slug",ENTER_PAGE_SLUG:"Enter page slug",ENTER_PAGE_NAME:"Enter page name",DELETE:"Delete",CHANGE_SLUG:"Change slug",PRIMARY:"Primary",SLUG_MUST_START_WITH:"Slug must start with /",EDIT:"Edit",UNPUBLISH_MSG:"Are you sure you want to unpublish",PAGE_ADD_SUCCESS:"New page added successfully.",GLOBAL_BLOCK_ADD_SUCCESS:"New global block added successfully.",SEO_SETTINGS_UPDATE_SUCCESS:"SEO Settings updated successfully.",PAGE_UPDATE_SUCCESS:"Page updated successfully.",GLOBAL_BLOCK_UPDATE_SUCCESS:"Global block updated successfully.",PAGE_DELETE_SUCCESS:"Page deleted successfully.",GLOBAL_BLOCK_DELETE_SUCCESS:"Global block deleted successfully.",PAGE_UNPUBLISH_SUCCESS:"Page unpublished successfully.",GLOBAL_BLOCK_UNPUBLISH_SUCCESS:"Global block unpublished successfully.",PAGE_PUBLISH_SUCCESS:"Page published successfully.",GLOBAL_BLOCK_PUBLISH_SUCCESS:"Global block published successfully.",PAGES_PUBLISH_SUCCESS:"Your changes have been published successfully.",SLUG_CHANGE_SUCCESS:"Slug changed successfully."},qi={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},yr=()=>{const e=he(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=me();return K.useMutation({mutationFn:async a=>s(e,{action:O.CREATE_PAGE,data:a}),onSuccess:(a,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[O.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[O.GET_WEBSITE_PAGES]}),n({title:i.pageType==="global"?D.GLOBAL_BLOCK_ADD_SUCCESS:D.PAGE_ADD_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to add new ${i.pageType==="global"?"global block":"page"}.`,description:p.get(qi,a.message,a.message)})}})},Xn=()=>{const e=he(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=me();return K.useMutation({mutationFn:async a=>await s(e,{action:O.UPDATE_PAGE,data:a}),onSuccess:(a,i)=>{i&&(i!=null&&i.primaryPage||i!=null&&i.seo)?t.invalidateQueries({queryKey:[O.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[O.GET_WEBSITE_PAGES]}),i!=null&&i.seo?n({title:D.SEO_SETTINGS_UPDATE_SUCCESS}):n({title:i.pageType==="global"?D.GLOBAL_BLOCK_UPDATE_SUCCESS:D.PAGE_UPDATE_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to update ${i.pageType==="global"?"global block":"page"}.`,description:a.message})}})},Hi=()=>{const e=he(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=me();return K.useMutation({mutationFn:async a=>s(e,{action:O.DELETE_PAGE,data:{id:a==null?void 0:a.id}}),onSuccess:(a,i)=>{if(a.code==="PAGE_LOCKED"){n({title:"Delete not allowed",description:"Page is currently being edited by another user.",variant:"destructive"});return}i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[O.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[O.GET_WEBSITE_PAGES]}),n({title:i.pageType==="global"?D.GLOBAL_BLOCK_DELETE_SUCCESS:D.PAGE_DELETE_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to delete ${i.pageType==="global"?"global block":"page"}.`,description:a.message})}})},Wi=()=>{const e=he(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=me();return K.useMutation({mutationFn:async a=>s(e,{action:O.TAKE_OFFLINE,data:{id:a==null?void 0:a.id}}),onSuccess:(a,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[O.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[O.GET_WEBSITE_PAGES]}),n({title:i.pageType==="global"?D.GLOBAL_BLOCK_UNPUBLISH_SUCCESS:D.PAGE_UNPUBLISH_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to take offline ${i.pageType==="global"?"global block":"page"}.`,description:a.message})}})},Jn=()=>{const e=he(),{toast:t}=d.useToast(),n=me(),s=K.useQueryClient(),{data:a}=Me();return K.useMutation({mutationFn:async({ids:i})=>n(e,{action:O.PUBLISH_CHANGES,data:{ids:i}}),onSuccess:()=>{s.invalidateQueries({queryKey:[O.GET_CHANGES]}),s.invalidateQueries({queryKey:[O.GET_WEBSITE_PAGES]}),s.invalidateQueries({queryKey:[O.GET_LANGUAGE_PAGES,a==null?void 0:a.id]})},onError:()=>{t({title:"Failed to publish pages.",variant:"destructive"})}})},$i=()=>{const e=he(),{toast:t}=d.useToast(),n=me(),s=K.useQueryClient();return K.useMutation({mutationFn:async({id:a,slug:i})=>n(e,{action:O.CHANGE_SLUG,data:{id:a,slug:i}}),onSuccess:(a,{primaryPage:i})=>{t({title:D.SLUG_CHANGE_SUCCESS}),i?s.invalidateQueries({queryKey:[O.GET_LANGUAGE_PAGES,i]}):s.invalidateQueries({queryKey:[O.GET_WEBSITE_PAGES]})},onError:()=>{t({title:"Failed to change slug",variant:"destructive"})}})},Vi=({page:e,onClose:t})=>{const[n,s]=w.useState(e.slug||""),{mutate:a,isPending:i}=$i(),{data:o}=Yt(),l=p.find(o,{key:e==null?void 0:e.pageType}),c=y=>{if(y.preventDefault(),!(e!=null&&e.primaryPage)&&Object.keys(Ue).some(x=>n===`/${x}`||p.startsWith(n,`/${x}/`))){d.toast({title:"Error",description:"Slugs cannot start with a language code for primary page",variant:"destructive"});return}a({...e,slug:n},{onSuccess:t})},h=(e==null?void 0:e.lang)||"";return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Change Slug"}),r.jsx(d.DialogDescription,{className:"text-xs",children:r.jsxs(d.Alert,{variant:"destructive",className:"mt-2",children:[r.jsx(R.AlertCircle,{className:"h-4 w-4"}),"Changing the slug may have impact on your SEO. Please proceed with caution."]})})]}),r.jsxs("form",{onSubmit:c,children:[r.jsxs("div",{className:"space-y-4 py-4 text-sm ",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{children:[r.jsx("span",{children:"Type:"}),r.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(l==null?void 0:l.name)||(e==null?void 0:e.pageType)]})]}),r.jsxs("div",{children:[r.jsx("span",{children:"Name:"}),r.jsxs("span",{className:"font-medium text-gray-600",children:[" ",e.name]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",r.jsxs("small",{className:"font-light text-gray-500",children:["Slug should start with /",h]})]}),r.jsx(d.Input,{id:"slug",value:n,onChange:y=>{const g=y.target.value;p.startsWith(g,`/${h}`)&&s(g)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:i||!p.startsWith(n,`/${h}`)||p.isEqual(e==null?void 0:e.slug,n),children:i?"Changing...":"Change Slug"})})]})]})})};function pr({page:e,onClose:t}){const[,n]=He(),{mutate:s,isPending:a}=Hi(),i=()=>{s(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),n(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm Deletion"}),r.jsxs(d.DialogDescription,{className:"py-4 text-slate-500",children:[r.jsxs("div",{children:["Are you sure you want to remove ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",(e==null?void 0:e.pageType)==="global"?"global block?":`page? ${e!=null&&e.primaryPage?"":"This will also delete all associated language pages."}`]}),e.lang&&r.jsxs("div",{className:"py-2 text-sm",children:["Language:"," ",r.jsx("span",{className:"font-medium text-gray-500",children:p.get(Ue,e.lang,e.lang)})]})]})]}),r.jsxs(d.DialogFooter,{children:[r.jsx(d.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(d.Button,{variant:"destructive",disabled:a,onClick:i,children:a?"Deleting...":"Delete"})]})]})})}const Zn=({page:e,onClose:t})=>{const{mutate:n,isPending:s}=Wi(),a=async()=>{n(e,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm action"}),r.jsxs(d.DialogDescription,{children:[D.UNPUBLISH_MSG," ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)}),"?"]})]}),r.jsxs(d.DialogFooter,{children:[r.jsx(d.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(d.Button,{variant:"destructive",disabled:s,onClick:a,children:s?D.UPDATING:D.UNPUBLISH})]})]})})},xr=({langProps:e,onClose:t,languages:n})=>{const{data:s}=Me(),[a,i]=w.useState(e.name||""),[o,l]=w.useState(e.edit?e.lang:""),[c,h]=w.useState(e.edit?e.slug:""),{mutate:y,isPending:g}=yr(),{mutate:S,isPending:x}=Xn(),j=(e==null?void 0:e.pageType)==="global",A=g||x,T=v=>{v.preventDefault();const b={name:a,lang:o,primaryPage:s==null?void 0:s.id,slug:c,pageType:s==null?void 0:s.pageType};b.pageType=e.pageType,e.edit&&(b.id=e==null?void 0:e.id),e.edit?S(b,{onSuccess:t}):y(b,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px] text-slate-600",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:e.edit?D.EDIT_LANGUAGE:D.ADD_NEW_LANGUAGE}),r.jsx(d.DialogDescription,{className:"font-light",children:D.ENTER_LANGUAGE_DETAILS})]}),r.jsxs("form",{onSubmit:T,children:[r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"lang",className:"text-right",children:D.LANGUAGE}),r.jsxs("select",{value:o,disabled:e.edit||p.isEmpty(n),onChange:v=>{const b=v.target.value;l(b),!j&&h(`/${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:[r.jsx("option",{value:"",disabled:!0,selected:!0,children:e.edit?p.get(Ue,e.lang,e.lang):p.isEmpty(n)?D.ALL_AVAILABLE_LANGUAGE_PAGE:D.CHOOSE_LANGUAGE}),p.map(n,v=>r.jsx("option",{value:v,children:p.get(Ue,v,v)},v))]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"slug",className:"text-right",children:D.PAGE_NAME}),r.jsx(d.Input,{id:"name",value:a,onChange:v=>i(v.target.value),className:"col-span-3",required:!0,placeholder:D.ENTER_PAGE_NAME})]}),!j&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:[D.SLUG," ",r.jsx("small",{className:"font-light",children:D.SLUG_SHOULD_START_WITH})]}),r.jsx(d.Input,{id:"slug",value:c,onChange:v=>{const b=v.target.value;p.startsWith(b,`/${o}`)&&h(p.toLower(p.trim(b)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:p.isEmpty(o),title:D.SLUG_MUST_START_WITH,placeholder:p.isEmpty(o)?D.CHOOSE_LANGUAGE_TO_ADD_SLUG:D.ENTER_PAGE_SLUG})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:A||!a||!o||!j&&!p.startsWith(c,`/${o}`),children:A?e.edit?D.UPDATING:D.ADDING:e.edit?D.UPDATE:D.ADD_NEW_LANGUAGE})})]})]})})},Ki=()=>{const[e,t]=w.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:a}=Oe.useLanguages(),{data:i,isFetching:o}=Yn(),{data:l}=Me(),[c,h]=w.useState(null),[y,g]=w.useState(null),[S,x]=w.useState(null),{data:j}=Qn(),A=p.filter(p.get(j,"languages")||["en"],T=>!p.find(i,{lang:T})&&T!==p.get(j,"fallbackLang"));return r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsx("ul",{className:"space-y-2 mt-4",children:o?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):p.map(i,T=>{const v=T.lang,b=T.slug,P=!T.primaryPage,V=v===n;return r.jsxs(r.Fragment,{children:[r.jsxs("li",{className:`text-slate-500 w-full p-2 rounded cursor-pointer flex items-center justify-between ${V?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>a(v),children:[r.jsxs("div",{className:" flex-1 gap-x-3",children:[r.jsxs("div",{className:"text-[13px] text-slate-800 flex items-center gap-x-2",children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${T.online?"bg-green-300":"bg-gray-300"}`}),p.get(Ue,P?s:v,v)]}),r.jsxs("div",{children:[b&&r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Slug: ",r.jsx("b",{className:"font-medium",children:b})]}),r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Name:",r.jsxs("b",{className:"font-medium",children:[" ",T.name," "]})]})]})]}),P?r.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[r.jsx(R.StarIcon,{fill:"orange",className:"w-3 h-3"}),r.jsx("b",{children:" Primary"})]}):r.jsx("div",{className:"flex items-center gap-x-3",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:U=>U.stopPropagation(),children:r.jsx(d.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:r.jsx(R.MoreHorizontal,{className:"h-4 w-4"})})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:U=>{U.stopPropagation(),t({...T,edit:!0})},children:[r.jsx(R.PencilIcon,{className:"size-3"}),D.EDIT]}),(T==null?void 0:T.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:U=>{U.stopPropagation(),g(T)},children:[r.jsx(R.Power,{className:"size-3"}),D.UNPUBLISH]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:U=>{U.stopPropagation(),h(T)},children:[r.jsx(R.TrashIcon,{className:"size-3"}),D.DELETE]})]})]})})]},T.id),r.jsx("div",{className:"h-1 w-full border-b"})]})})}),r.jsx("div",{className:"flex justify-center w-full",children:r.jsx(d.Button,{variant:"default",size:"sm",disabled:p.isEmpty(A),onClick:()=>{t({name:l==null?void 0:l.name,pageType:l==null?void 0:l.pageType,lang:"",slug:"",edit:!1})},children:D.ADD_NEW_LANGUAGE})}),e&&r.jsx(xr,{languages:A,langProps:e,onClose:()=>t(null)}),c&&r.jsx(pr,{page:c,onClose:()=>h(null)}),y&&r.jsx(Zn,{page:y,onClose:()=>g(null)}),S&&r.jsx(Vi,{page:S,onClose:()=>x(null)})]})};function zi({avatar:e,name:t,email:n,onTakeOver:s,currentEditor:a}){const[i,o]=w.useState(!1),l=()=>{o(!1),s()};return r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex items-center justify-center w-screen top-14 bg-black/30 backdrop-blur-sm",children:r.jsxs(d.Card,{className:"w-full max-w-md mx-auto",children:[r.jsx(d.CardHeader,{className:"space-y-1",children:r.jsxs(d.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(R.LockIcon,{className:"w-6 h-6 text-yellow-500"}),a==="EXPIRED"?"Editing access timed out":"Page locked for editing"]})}),r.jsx(d.CardContent,{className:"grid gap-4",children:a==="EXPIRED"?r.jsx("div",{children:r.jsx("p",{children:"Your editing access has been paused due to inactivity. Please refresh the page to continue"})}):r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[e?r.jsx("img",{src:e,alt:t,className:"w-12 h-12 border border-gray-300 rounded-full"}):r.jsx(R.UserIcon,{className:"w-12 h-12 p-2 border border-gray-300 rounded-full"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold",children:t}),n&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})]}),r.jsx("div",{className:"text-sm",children:r.jsx("p",{children:"This user is currently editing the page. You cannot make changes."})})]})}),r.jsx(d.CardFooter,{children:a==="EXPIRED"?r.jsx("div",{children:r.jsx(d.Button,{className:"w-full",onClick:()=>window.location.reload(),variant:"destructive",children:"Refresh"})}):r.jsxs(d.AlertDialog,{open:i,onOpenChange:o,children:[r.jsx(d.AlertDialogTrigger,{asChild:!0,children:r.jsxs("span",{className:"flex flex-col items-center",children:[r.jsx(d.Button,{className:"w-full",variant:"destructive",children:"Take Over"}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"If you need to edit, you can take over the lock, but be aware that the other user might lose unsaved changes."})]})}),r.jsxs(d.AlertDialogContent,{children:[r.jsxs(d.AlertDialogHeader,{children:[r.jsx(d.AlertDialogTitle,{children:"Are you sure you want to take over?"}),r.jsxs(d.AlertDialogDescription,{children:[r.jsxs("div",{className:"flex items-center space-x-2 text-yellow-500",children:[r.jsx(R.AlertTriangleIcon,{className:"w-5 h-5"}),r.jsx("span",{children:"This action might cause the other user to lose unsaved changes."})]}),r.jsxs("p",{className:"mt-2",children:["By taking over, you will become the active editor of this page, and ",t," will lose their editing access."]})]})]}),r.jsxs(d.AlertDialogFooter,{children:[r.jsx(d.AlertDialogCancel,{children:"Cancel"}),r.jsx(d.AlertDialogAction,{onClick:l,children:"Yes, Take Over"})]})]})]})})]})})}const Qi=()=>{const{isLocked:e,currentEditor:t}=Qt(),{data:n}=fr(t),s=Fe("pageLockComponent",zi),[a]=He(),i=a.get("page"),{mutate:o}=mr(),{isFetching:l}=hr(),c=w.useCallback(()=>{o({id:i})},[i,o]);return!e||l?r.jsx("div",{className:""}):r.jsx(s,{...n,isLocked:e,currentEditor:t,onTakeOver:c})},Yi=()=>{const{selectedLang:e}=Oe.useLanguages(),{data:t,isFetching:n}=Yn();return{data:w.useMemo(()=>p.find(t,{lang:e||""})||{},[t,e]),isFetching:n}};function Ss({data:e,onSelect:t,dataType:n="value"}){const[s,a]=pe.useState(!1),[i,o]=pe.useState([]),[l,c]=pe.useState(e);pe.useEffect(()=>{c(e)},[e]);const h=x=>Array.isArray(x)?"array":typeof x=="object"&&x!==null?"object":"value",y=pe.useCallback(x=>{const j=A=>n==="value"?A==="value"||A==="object":n==="array"?A==="array":A===n;x.type==="object"?(o(A=>[...A,x.key]),c(x.value)):j(x.type)&&(t([...i,x.key].join(".")),a(!1))},[i,t,n]),g=pe.useCallback(()=>{if(i.length>0){const x=i.slice(0,-1);o(x),c(x.reduce((j,A)=>j[A],e))}},[i,e]),S=pe.useMemo(()=>Object.entries(l).map(([x,j])=>({key:x,value:j,type:h(j)})).filter(x=>n==="value"?x.type==="value"||x.type==="object":n==="array"?x.type==="array"||x.type==="object":n==="object"?x.type==="object":!0),[l,n]);return r.jsxs(d.Popover,{open:s,onOpenChange:a,children:[r.jsx(d.PopoverTrigger,{asChild:!0,children:r.jsx(d.Button,{size:"sm",variant:"outline",className:"h-5 px-1 py-0 text-[9px] text-muted-foreground",role:"combobox","aria-expanded":s,children:"+ Add Field"})}),r.jsx(d.PopoverContent,{className:"w-[300px] p-0",children:r.jsxs(d.Command,{children:[r.jsx(d.CommandInput,{className:"border-none",placeholder:"Search..."}),r.jsxs(d.CommandList,{children:[r.jsx(d.CommandEmpty,{children:"No option found."}),r.jsxs(d.CommandGroup,{children:[i.length>0&&r.jsxs(d.CommandItem,{onSelect:g,className:"flex items-center text-sm",children:[r.jsx(R.ChevronLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),S.map(x=>r.jsxs(d.CommandItem,{onSelect:()=>y(x),className:"flex items-center justify-between",children:[r.jsx("span",{children:x.key}),r.jsxs("div",{className:"flex items-center gap-2",children:[n==="object"&&x.type==="object"&&r.jsx(d.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:j=>{j.stopPropagation(),t([...i,x.key].join(".")),a(!1)},children:"Select"}),(x.type==="object"||x.type==="array")&&r.jsx("div",{className:"p-1 rounded hover:bg-muted cursor-pointer",children:r.jsx(R.ChevronRight,{className:"w-4 h-4 opacity-50"})})]})]},x.key))]})]})]})})]})}const Xi=(e,t)=>{const n=e.selectionStart||0,s=e.selectionEnd||0,a=e.value;return{value:a.substring(0,n)+`[${t}]`+a.substring(s),newCursorPos:n+t.length+2}},vr=()=>{const{data:e}=Gi(),{data:t,isFetching:n}=Yi(),s=t==null?void 0:t.seo,[a,i]=w.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...s}),o=w.useRef({initial:a,updated:a}),{selectedLang:l,fallbackLang:c,languages:h}=Oe.useLanguages(),y=l.length?l:c,{mutate:g,isPending:S}=Xn(),x=S;w.useEffect(()=>{!n&&s&&i({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...s})},[n,s]);const j=async()=>{g({id:t==null?void 0:t.id,seo:a}),o.current.initial=a,o.current.updated=a},A=()=>{i({...a,ogTitle:a.title,ogDescription:a.description})},T=()=>{i({...a,searchTitle:a.ogTitle,searchDescription:a.ogDescription})},v=(P,V)=>{const U=document.getElementById(V);if(U){const{value:de,newCursorPos:Se}=Xi(U,P);i($=>({...$,[U.name]:de})),setTimeout(()=>{U.focus(),U.setSelectionRange(Se,Se)},0)}},b=P=>{const V={...a,[P.target.name]:P.target.name==="noIndex"||P.target.name==="noFollow"?P.target.checked:P.target.value};i(V),o.current.updated=V};return r.jsxs("div",{className:"relative pb-40",children:[r.jsxs("div",{className:"p-2 text-xs text-left bg-gray-100 rounded-md",children:["Slug: ",t==null?void 0:t.slug," ",h.length>0&&r.jsxs("span",{className:"font-semibold text-blue-500",children:["(",p.get(Ue,y,y),")"]})]}),r.jsx("form",{className:"space-y-8",children:r.jsxs(d.Accordion,{type:"multiple",defaultValue:["page"],children:[r.jsxs(d.AccordionItem,{value:"page",children:[r.jsx(d.AccordionTrigger,{className:"font-semibold text-slate-700",children:"SEO"}),r.jsx(d.AccordionContent,{className:"pt-2",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"SEO Title"}),r.jsx(Ss,{dataType:"value",data:e??{},onSelect:P=>v(P,"title")})]}),r.jsx(d.Input,{type:"text",id:"title",name:"title",value:a.title,onChange:b,disabled:x,placeholder:"Enter SEO title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"description",children:"SEO Description"}),r.jsx(Ss,{data:e??{},onSelect:P=>v(P,"description")})]}),r.jsx(d.Textarea,{id:"description",name:"description",value:a.description,onChange:b,disabled:x,placeholder:"Enter SEO description"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"Canonical URL"}),r.jsx(d.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:a.canonicalUrl,onChange:b,disabled:x,placeholder:"Enter Canonical URL"})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:a.noIndex,onChange:b,disabled:x,className:"w-4 h-4"}),r.jsx(d.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:"No Index"})]}),r.jsx("p",{className:"mt-0 text-[10px] font-light text-gray-400 leading-4",children:"Check this if you don't want search engines to index this page."})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:a.noFollow,onChange:b,disabled:x,className:"w-4 h-4"}),r.jsx(d.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:"No Follow"})]}),r.jsx("p",{className:"text-[10px] font-light text-gray-400 leading-4",children:"Check this if you don't want search engines to follow links on this page."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"og",children:[r.jsx(d.AccordionTrigger,{className:"font-bold text-slate-700",children:"OG"}),r.jsx(d.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:A,children:"Copy from SEO Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"ogTitle",children:"OG Title"})}),r.jsx(d.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:a.ogTitle,onChange:b,disabled:x,placeholder:"Enter OG title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"ogDescription",children:"OG Description"})}),r.jsx(d.Textarea,{id:"ogDescription",name:"ogDescription",value:a.ogDescription,onChange:b,disabled:x,placeholder:"Enter OG description"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"ogImage",children:"OG Image URL"}),r.jsx(d.Input,{type:"text",id:"ogImage",name:"ogImage",value:a.ogImage,onChange:b,disabled:x,placeholder:"Enter OG image URL"})]})]})})]}),r.jsxs(d.AccordionItem,{value:"search",children:[r.jsx(d.AccordionTrigger,{className:"font-bold text-slate-700",children:"SEARCH"}),r.jsx(d.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:T,children:"Copy from OG Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"searchTitle",children:"Search Title"})}),r.jsx(d.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:a.searchTitle,onChange:b,disabled:x,placeholder:"Enter search title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"searchDescription",children:"Search Description"})}),r.jsx(d.Textarea,{id:"searchDescription",name:"searchDescription",value:a.searchDescription,onChange:b,placeholder:"Enter search description"})]})]})})]}),r.jsxs(d.AccordionItem,{value:"jsonLD",children:[r.jsx(d.AccordionTrigger,{className:"font-bold text-slate-700",children:"JSON-LD"}),r.jsx(d.AccordionContent,{children:r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"jsonLD",children:"JSON-LD"})}),r.jsx(d.Textarea,{id:"jsonLD",name:"jsonLD",rows:3,value:a.jsonLD,onChange:b,placeholder:"Enter JSON-LD"})]})})})]})]})}),r.jsx("div",{className:"flex items-center justify-end w-full mt-4",children:r.jsx(d.Button,{size:"lg",variant:"default",onClick:j,disabled:p.isEqual(o.current.initial,a)||x,children:S?"Saving...":"Save"})})]})};vr.displayName="SeoPanel";var es={};(function e(t,n,s,a){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!t.OffscreenCanvas)return!1;var m=new OffscreenCanvas(1,1),f=m.getContext("2d");f.fillRect(0,0,1,1);var _=m.transferToImageBitmap();try{f.createPattern(_,"no-repeat")}catch{return!1}return!0}();function c(){}function h(m){var f=n.exports.Promise,_=f!==void 0?f:t.Promise;return typeof _=="function"?new _(m):(m(c,c),null)}var y=function(m,f){return{transform:function(_){if(m)return _;if(f.has(_))return f.get(_);var I=new OffscreenCanvas(_.width,_.height),F=I.getContext("2d");return F.drawImage(_,0,0),f.set(_,I),I},clear:function(){f.clear()}}}(l,new Map),g=function(){var m=Math.floor(16.666666666666668),f,_,I={},F=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(f=function(H){var W=Math.random();return I[W]=requestAnimationFrame(function k(q){F===q||F+m-1<q?(F=q,delete I[W],H()):I[W]=requestAnimationFrame(k)}),W},_=function(H){I[H]&&cancelAnimationFrame(I[H])}):(f=function(H){return setTimeout(H,m)},_=function(H){return clearTimeout(H)}),{frame:f,cancel:_}}(),S=function(){var m,f,_={};function I(F){function H(W,k){F.postMessage({options:W||{},callback:k})}F.init=function(k){var q=k.transferControlToOffscreen();F.postMessage({canvas:q},[q])},F.fire=function(k,q,ee){if(f)return H(k,null),f;var oe=Math.random().toString(36).slice(2);return f=h(function(le){function ue(ve){ve.data.callback===oe&&(delete _[oe],F.removeEventListener("message",ue),f=null,y.clear(),ee(),le())}F.addEventListener("message",ue),H(k,oe),_[oe]=ue.bind(null,{data:{callback:oe}})}),f},F.reset=function(){F.postMessage({reset:!0});for(var k in _)_[k](),delete _[k]}}return function(){if(m)return m;if(!s&&i){var F=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
|
|
31
|
-
`);try{m=new Worker(URL.createObjectURL(new Blob([F])))}catch(H){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",H),null}I(m)}return m}}(),x={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function j(m,f){return f?f(m):m}function A(m){return m!=null}function T(m,f,_){return j(m&&A(m[f])?m[f]:x[f],_)}function v(m){return m<0?0:Math.floor(m)}function b(m,f){return Math.floor(Math.random()*(f-m))+m}function P(m){return parseInt(m,16)}function V(m){return m.map(U)}function U(m){var f=String(m).replace(/[^0-9a-f]/gi,"");return f.length<6&&(f=f[0]+f[0]+f[1]+f[1]+f[2]+f[2]),{r:P(f.substring(0,2)),g:P(f.substring(2,4)),b:P(f.substring(4,6))}}function de(m){var f=T(m,"origin",Object);return f.x=T(f,"x",Number),f.y=T(f,"y",Number),f}function Se(m){m.width=document.documentElement.clientWidth,m.height=document.documentElement.clientHeight}function $(m){var f=m.getBoundingClientRect();m.width=f.width,m.height=f.height}function X(m){var f=document.createElement("canvas");return f.style.position="fixed",f.style.top="0px",f.style.left="0px",f.style.pointerEvents="none",f.style.zIndex=m,f}function J(m,f,_,I,F,H,W,k,q){m.save(),m.translate(f,_),m.rotate(H),m.scale(I,F),m.arc(0,0,1,W,k,q),m.restore()}function B(m){var f=m.angle*(Math.PI/180),_=m.spread*(Math.PI/180);return{x:m.x,y:m.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:m.startVelocity*.5+Math.random()*m.startVelocity,angle2D:-f+(.5*_-Math.random()*_),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:m.color,shape:m.shape,tick:0,totalTicks:m.ticks,decay:m.decay,drift:m.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:m.gravity*3,ovalScalar:.6,scalar:m.scalar,flat:m.flat}}function ge(m,f){f.x+=Math.cos(f.angle2D)*f.velocity+f.drift,f.y+=Math.sin(f.angle2D)*f.velocity+f.gravity,f.velocity*=f.decay,f.flat?(f.wobble=0,f.wobbleX=f.x+10*f.scalar,f.wobbleY=f.y+10*f.scalar,f.tiltSin=0,f.tiltCos=0,f.random=1):(f.wobble+=f.wobbleSpeed,f.wobbleX=f.x+10*f.scalar*Math.cos(f.wobble),f.wobbleY=f.y+10*f.scalar*Math.sin(f.wobble),f.tiltAngle+=.1,f.tiltSin=Math.sin(f.tiltAngle),f.tiltCos=Math.cos(f.tiltAngle),f.random=Math.random()+2);var _=f.tick++/f.totalTicks,I=f.x+f.random*f.tiltCos,F=f.y+f.random*f.tiltSin,H=f.wobbleX+f.random*f.tiltCos,W=f.wobbleY+f.random*f.tiltSin;if(m.fillStyle="rgba("+f.color.r+", "+f.color.g+", "+f.color.b+", "+(1-_)+")",m.beginPath(),o&&f.shape.type==="path"&&typeof f.shape.path=="string"&&Array.isArray(f.shape.matrix))m.fill(bt(f.shape.path,f.shape.matrix,f.x,f.y,Math.abs(H-I)*.1,Math.abs(W-F)*.1,Math.PI/10*f.wobble));else if(f.shape.type==="bitmap"){var k=Math.PI/10*f.wobble,q=Math.abs(H-I)*.1,ee=Math.abs(W-F)*.1,oe=f.shape.bitmap.width*f.scalar,le=f.shape.bitmap.height*f.scalar,ue=new DOMMatrix([Math.cos(k)*q,Math.sin(k)*q,-Math.sin(k)*ee,Math.cos(k)*ee,f.x,f.y]);ue.multiplySelf(new DOMMatrix(f.shape.matrix));var ve=m.createPattern(y.transform(f.shape.bitmap),"no-repeat");ve.setTransform(ue),m.globalAlpha=1-_,m.fillStyle=ve,m.fillRect(f.x-oe/2,f.y-le/2,oe,le),m.globalAlpha=1}else if(f.shape==="circle")m.ellipse?m.ellipse(f.x,f.y,Math.abs(H-I)*f.ovalScalar,Math.abs(W-F)*f.ovalScalar,Math.PI/10*f.wobble,0,2*Math.PI):J(m,f.x,f.y,Math.abs(H-I)*f.ovalScalar,Math.abs(W-F)*f.ovalScalar,Math.PI/10*f.wobble,0,2*Math.PI);else if(f.shape==="star")for(var Q=Math.PI/2*3,be=4*f.scalar,we=8*f.scalar,Pe=f.x,ke=f.y,Ie=5,De=Math.PI/Ie;Ie--;)Pe=f.x+Math.cos(Q)*we,ke=f.y+Math.sin(Q)*we,m.lineTo(Pe,ke),Q+=De,Pe=f.x+Math.cos(Q)*be,ke=f.y+Math.sin(Q)*be,m.lineTo(Pe,ke),Q+=De;else m.moveTo(Math.floor(f.x),Math.floor(f.y)),m.lineTo(Math.floor(f.wobbleX),Math.floor(F)),m.lineTo(Math.floor(H),Math.floor(W)),m.lineTo(Math.floor(I),Math.floor(f.wobbleY));return m.closePath(),m.fill(),f.tick<f.totalTicks}function N(m,f,_,I,F){var H=f.slice(),W=m.getContext("2d"),k,q,ee=h(function(oe){function le(){k=q=null,W.clearRect(0,0,I.width,I.height),y.clear(),F(),oe()}function ue(){s&&!(I.width===a.width&&I.height===a.height)&&(I.width=m.width=a.width,I.height=m.height=a.height),!I.width&&!I.height&&(_(m),I.width=m.width,I.height=m.height),W.clearRect(0,0,I.width,I.height),H=H.filter(function(ve){return ge(W,ve)}),H.length?k=g.frame(ue):le()}k=g.frame(ue),q=le});return{addFettis:function(oe){return H=H.concat(oe),ee},canvas:m,promise:ee,reset:function(){k&&g.cancel(k),q&&q()}}}function ie(m,f){var _=!m,I=!!T(f||{},"resize"),F=!1,H=T(f,"disableForReducedMotion",Boolean),W=i&&!!T(f||{},"useWorker"),k=W?S():null,q=_?Se:$,ee=m&&k?!!m.__confetti_initialized:!1,oe=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,le;function ue(Q,be,we){for(var Pe=T(Q,"particleCount",v),ke=T(Q,"angle",Number),Ie=T(Q,"spread",Number),De=T(Q,"startVelocity",Number),bn=T(Q,"decay",Number),St=T(Q,"gravity",Number),En=T(Q,"drift",Number),Xt=T(Q,"colors",V),Jt=T(Q,"ticks",Number),wt=T(Q,"shapes"),Zt=T(Q,"scalar"),Sn=!!T(Q,"flat"),jt=de(Q),Ct=Pe,Tt=[],wn=m.width*jt.x,jn=m.height*jt.y;Ct--;)Tt.push(B({x:wn,y:jn,angle:ke,spread:Ie,startVelocity:De,color:Xt[Ct%Xt.length],shape:wt[b(0,wt.length)],ticks:Jt,decay:bn,gravity:St,drift:En,scalar:Zt,flat:Sn}));return le?le.addFettis(Tt):(le=N(m,Tt,q,be,we),le.promise)}function ve(Q){var be=H||T(Q,"disableForReducedMotion",Boolean),we=T(Q,"zIndex",Number);if(be&&oe)return h(function(De){De()});_&&le?m=le.canvas:_&&!m&&(m=X(we),document.body.appendChild(m)),I&&!ee&&q(m);var Pe={width:m.width,height:m.height};k&&!ee&&k.init(m),ee=!0,k&&(m.__confetti_initialized=!0);function ke(){if(k){var De={getBoundingClientRect:function(){if(!_)return m.getBoundingClientRect()}};q(De),k.postMessage({resize:{width:De.width,height:De.height}});return}Pe.width=Pe.height=null}function Ie(){le=null,I&&(F=!1,t.removeEventListener("resize",ke)),_&&m&&(document.body.contains(m)&&document.body.removeChild(m),m=null,ee=!1)}return I&&!F&&(F=!0,t.addEventListener("resize",ke,!1)),k?k.fire(Q,Pe,Ie):ue(Q,Pe,Ie)}return ve.reset=function(){k&&k.reset(),le&&le.reset()},ve}var Ce;function Te(){return Ce||(Ce=ie(null,{useWorker:!0,resize:!0})),Ce}function bt(m,f,_,I,F,H,W){var k=new Path2D(m),q=new Path2D;q.addPath(k,new DOMMatrix(f));var ee=new Path2D;return ee.addPath(q,new DOMMatrix([Math.cos(W)*F,Math.sin(W)*F,-Math.sin(W)*H,Math.cos(W)*H,_,I])),ee}function Et(m){if(!o)throw new Error("path confetti are not supported in this browser");var f,_;typeof m=="string"?f=m:(f=m.path,_=m.matrix);var I=new Path2D(f),F=document.createElement("canvas"),H=F.getContext("2d");if(!_){for(var W=1e3,k=W,q=W,ee=0,oe=0,le,ue,ve=0;ve<W;ve+=2)for(var Q=0;Q<W;Q+=2)H.isPointInPath(I,ve,Q,"nonzero")&&(k=Math.min(k,ve),q=Math.min(q,Q),ee=Math.max(ee,ve),oe=Math.max(oe,Q));le=ee-k,ue=oe-q;var be=10,we=Math.min(be/le,be/ue);_=[we,0,0,we,-Math.round(le/2+k)*we,-Math.round(ue/2+q)*we]}return{type:"path",path:f,matrix:_}}function Ke(m){var f,_=1,I="#000000",F='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof m=="string"?f=m:(f=m.text,_="scalar"in m?m.scalar:_,F="fontFamily"in m?m.fontFamily:F,I="color"in m?m.color:I);var H=10*_,W=""+H+"px "+F,k=new OffscreenCanvas(H,H),q=k.getContext("2d");q.font=W;var ee=q.measureText(f),oe=Math.ceil(ee.actualBoundingBoxRight+ee.actualBoundingBoxLeft),le=Math.ceil(ee.actualBoundingBoxAscent+ee.actualBoundingBoxDescent),ue=2,ve=ee.actualBoundingBoxLeft+ue,Q=ee.actualBoundingBoxAscent+ue;oe+=ue+ue,le+=ue+ue,k=new OffscreenCanvas(oe,le),q=k.getContext("2d"),q.font=W,q.fillStyle=I,q.fillText(f,ve,Q);var be=1/_;return{type:"bitmap",bitmap:k.transferToImageBitmap(),matrix:[be,0,0,be,-oe*be/2,-le*be/2]}}n.exports=function(){return Te().apply(this,arguments)},n.exports.reset=function(){Te().reset()},n.exports.create=ie,n.exports.shapeFromPath=Et,n.exports.shapeFromText=Ke})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),es,!1);const Ji=es.exports;es.exports.create;const Zi={particleCount:350,spread:120,origin:{y:.6},angle:90},eo={TOP_RIGHT:{angle:225,origin:{x:.9,y:0}},BOTTOM_RIGHT:{angle:100,origin:{x:.9,y:.9}}},mn=e=>{let t=eo[e];t||(t={});const n={...Zi,...t};Ji(n)},to=()=>{const[e]=Oe.useTheme(),{mutate:t,isPending:n}=Jn(),{mutateAsync:s,isPending:a}=gr(),i=()=>{s({settings:{theme:e}})},o=()=>{t({ids:["THEME"]},{onSuccess:()=>{mn("BOTTOM_RIGHT")}})};return r.jsxs("div",{className:"bg-white py-3 flex items-center justify-center gap-x-3 border-t",children:[r.jsx(d.Button,{size:"sm",variant:"outline",disabled:n||a,onClick:i,children:"Save draft"}),r.jsx(d.Button,{size:"sm",disabled:n||a,onClick:o,children:"Publish"})]})};function no({addEditPage:e,additionalPageTypes:t=[],close:n}){var B,ge;const s=!!(e!=null&&e.id),{data:a}=vn(),{mutate:i,isPending:o}=yr(),{mutate:l,isPending:c}=Xn(),[h,y]=w.useState(null),[g,S]=w.useState((e==null?void 0:e.pageType)??"page"),[x,j]=w.useState((e==null?void 0:e.parent)??""),[A,T]=w.useState((e==null?void 0:e.name)??""),[v,b]=w.useState(((e==null?void 0:e.slug)??"").split("/").pop()||""),[P,V]=w.useState((e==null?void 0:e.dynamic)??!1),U=o||c,de=t.find(N=>N.key===g),Se=N=>{S(N),j(""),b(""),V(!1)},$=N=>{V(N),N&&b("")},X=N=>{if(j(N),N&&N!=="none"){const ie=a==null?void 0:a.find(Te=>Te.id===N),Ce=(ie==null?void 0:ie.slug)||"";if(v.startsWith(Ce)){const Te=v.slice(Ce.length).replace(/^\/+/,"");b(Te)}else b(v.replace(/^\/+/,""))}else b(v?`${v}`:"")},J=N=>{if(N.preventDefault(),v.length>0&&!P&&!v.match(/^[a-zA-Z0-9-_]+$/)){y("Slug can only contain letters, numbers, and hyphens");return}if(P&&v!==""){y("Slug must be empty when using dynamic slug");return}if(!A.trim()){d.toast({title:"Error",description:"Name is required",variant:"destructive"});return}if(g==="global"){const ie={pageType:"global",name:A,slug:""};if(s){l({id:e==null?void 0:e.id,name:A},{onSuccess:()=>{d.toast({title:"Success",description:"Global Block updated successfully"}),n()}});return}i(ie,{onSuccess:()=>{d.toast({title:"Success",description:"Global Block created successfully"}),n()}});return}if(x&&x!=="none"){if(!v.trim()&&!P){d.toast({title:"Error",description:"Child page slug is required",variant:"destructive"});return}const ie=a==null?void 0:a.find(m=>m.id===x),Ce=(ie==null?void 0:ie.slug)||"",Te=Ce==="/"?`/${v}`:`${Ce}/${v}`;if(Object.keys(Ue).some(m=>Te===`/${m}`||(Te==null?void 0:Te.startsWith(`/${m}/`)))){d.toast({title:"Error",description:"Slugs cannot start with a language code for primary page",variant:"destructive"});return}const Ke={pageType:g,name:A,slug:Te.replace(/\/$/,""),parent:x,dynamic:P};if(s){l({id:e==null?void 0:e.id,...Ke},{onSuccess:()=>{d.toast({title:"Success",description:"Page updated successfully"}),n()}});return}i(Ke,{onSuccess:()=>{d.toast({title:"Success",description:"Page created successfully"}),n()}})}else{const ie={pageType:g,name:A,slug:v===""?"/":`/${v.replace(/\/$/,"")}`};if(s){l({id:e==null?void 0:e.id,...ie},{onSuccess:()=>{d.toast({title:"Success",description:"Page updated successfully"}),n()}});return}i(ie,{onSuccess:()=>{d.toast({title:"Success",description:"Page created successfully"}),n()}})}};return g==="global"?r.jsxs("form",{onSubmit:J,className:"w-full max-w-md mx-auto space-y-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"pageType",className:"text-sm",children:"Page Type"}),r.jsx("select",{id:"pageType",value:g,disabled:s,onChange:N=>Se(N.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${s?"cursor-not-allowed text-gray-500":""}`,children:t.map(N=>r.jsx("option",{value:N.key,children:N.name},N.key))}),r.jsx("p",{className:"text-sm text-gray-500",children:(B=t.find(N=>N.key===g))==null?void 0:B.helpText})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),r.jsx(d.Input,{id:"name",value:A,onChange:N=>T(N.target.value),required:!0,"aria-required":"true"})]}),r.jsx(d.Button,{disabled:U,type:"submit",className:"w-full",children:s?U?"Updating...":"Update Global Block":U?"Creating...":"Create Global Block"})]}):r.jsxs("form",{onSubmit:J,className:"w-full max-w-md mx-auto space-y-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"pageType",className:"text-sm",children:"Page Type"}),r.jsx("select",{id:"pageType",value:g,disabled:s,onChange:N=>Se(N.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${s?"cursor-not-allowed text-gray-500":""}`,children:t.map(N=>r.jsx("option",{value:N.key,children:N.name},N.key))})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"parentPage",className:"text-sm",children:"Parent"}),r.jsxs("select",{id:"parentPage",value:x,onChange:N=>X(N.target.value),className:"w-full rounded-md border border-gray-300 px-3 py-2",children:[r.jsx("option",{value:"none",children:"None"}),a==null?void 0:a.filter(N=>N.pageType!=="global"&&N.slug!=="/").map(N=>r.jsxs("option",{value:N.id,children:[N.name," (",N.slug,")"]},N.id))]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),r.jsx(d.Input,{id:"name",value:A,onChange:N=>T(N.target.value),required:!0,"aria-required":"true"})]}),(de==null?void 0:de.dynamicSegments)&&x&&x!=="none"&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("input",{type:"checkbox",id:"useDynamicSlug",checked:P,onChange:N=>$(N.target.checked),className:"rounded border-gray-300"}),r.jsx(d.Label,{htmlFor:"useDynamicSlug",className:"text-sm",children:"Use Dynamic Slug"})]}),P&&r.jsxs("div",{className:"text-sm text-gray-500",children:["Pages will use pattern: ",de.dynamicSlug]})]}),(!(de!=null&&de.dynamicSegments)||!P)&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-sm",children:["Slug",x&&x!=="none"&&r.jsxs("span",{className:"ml-2 text-sm text-gray-500",children:["Parent:"," ",(ge=a==null?void 0:a.find(N=>N.id===x))==null?void 0:ge.slug]})]}),r.jsx(d.Input,{id:"slug",value:v,onChange:N=>b(N.target.value),placeholder:x&&x!=="none"?"Enter page slug":g==="page"?"Leave empty for home page":"Required - e.g. /your-slug"}),h&&r.jsx("p",{className:"text-xs text-red-500",children:h})]}),r.jsx(d.Button,{disabled:U,type:"submit",className:"w-full",children:s?U?"Updating...":"Update page":U?"Creating...":"Create Page"})]})}const so=({addEditPage:e,setAddEditPage:t})=>{const{data:n}=Yt(),s=!!(e!=null&&e.id);return r.jsx(d.Dialog,{open:!!e,onOpenChange:()=>t(void 0),children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px]",children:[r.jsxs(d.DialogHeader,{children:[r.jsxs(d.DialogTitle,{children:[s?"Edit":"Add New"," "]}),r.jsx(d.DialogDescription,{children:s?"Update your page name":"Enter details to create a new page"})]}),r.jsx(no,{addEditPage:e,close:()=>t(void 0),additionalPageTypes:n??[]})]})})},Dn=({parentSlug:e,page:t,active:n,changeActivePage:s,setUnpublishPage:a,setDeletePage:i,setAddEditPage:o})=>{const{data:l}=Yt(),c=p.find(l,{key:t.pageType});return r.jsxs("div",{onClick:()=>s(p.get(t,"id")),className:`rounded flex p-1.5 items-center justify-between leading-none duration-300 cursor-pointer px-3 py-1.5 ${n?"bg-gray-200":"hover:bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[t.dynamic?r.jsx("div",{className:"w-4 h-4 text-slate-500 stroke-[1]",children:r.jsx(R.StarsIcon,{className:"w-4 h-4 text-yellow-400"})}):c!=null&&c.icon?r.jsx("div",{className:"w-4 h-4 text-slate-500 stroke-[1]",dangerouslySetInnerHTML:{__html:c.icon}}):t.pageType==="global"?r.jsx(R.Globe,{className:"w-4 h-4 text-slate-500 stroke-[1]"}):r.jsx(R.File,{className:"w-4 h-4 text-slate-500 stroke-[1]"}),r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.jsx("span",{className:"font-light leading-none text-slate-800",children:p.startCase(t.name)??""}),t.pageType!=="global"?r.jsxs(d.Badge,{variant:"outline",className:"ml-2 text-xs font-bold leading-none rounded-full text-slate-500",children:[p.get(t,"slug").replace(e,"")||"/",t.dynamic&&r.jsx("span",{className:"text-xs font-light leading-none text-slate-500",children:`${c.dynamicSlug}`})]}):r.jsx(d.Badge,{variant:"outline",className:"ml-2 text-xs font-bold leading-none rounded-full text-slate-500",children:"Global Block"})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:h=>h.stopPropagation(),children:r.jsx(R.MoreHorizontal,{className:"h-4 w-4 hover:stroke-[3]"})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:h=>{h.stopPropagation(),o({...t,global:t.pageType==="global"})},children:[r.jsx(R.Pencil,{className:"size-3"}),"Edit"]}),(t==null?void 0:t.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:h=>{h.stopPropagation(),a(t)},children:[r.jsx(R.Power,{className:"size-3"}),D.UNPUBLISH]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:h=>{h.stopPropagation(),i(t)},children:[r.jsx(R.Trash,{className:"size-3"}),D.DELETE]})]})]})})]})},ro=({close:e})=>{const[,t]=w.useState([]),[n,s]=w.useState(""),[a,i]=w.useState(null),[o,l]=w.useState(null),[c,h]=w.useState(null),{mutate:y}=mr(),{data:g,isFetching:S}=vn(),[x,j]=He(),A=x.get("page"),T=w.useCallback(b=>{A&&y({id:A}),window.history.pushState({},"",`?page=${b}`),j(new URLSearchParams({page:b})),window.dispatchEvent(new PopStateEvent("popstate")),e()},[A,j,e,y]);w.useEffect(()=>{if(A&&!S){const b=p.find(g,{id:A});b&&(b!=null&&b.pageType)?t(P=>[...P,b==null?void 0:b.pageType]):(window.history.replaceState(null,"","/"),j(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate")))}},[g,A,S,j]);const v=w.useMemo(()=>{const b=p.filter(g,$=>p.isEmpty(n)?!0:p.includes(p.toLower($==null?void 0:$.name),p.toLower(n))||p.includes(p.toLower($==null?void 0:$.slug),p.toLower(n))),P=new Map;b.forEach($=>{P.set($.id,{...$,children:[]})});const V=[],U=[];P.forEach($=>{if($.parent){const X=P.get($.parent);X?X.children.push($):V.push($)}else U.push($)}),V.sort(($,X)=>$.name.localeCompare(X.name)),V.forEach($=>{$.children.sort((X,J)=>X.name.localeCompare(J.name))});const de=p.filter(U,$=>$.pageType==="global"),Se=p.filter(U,$=>$.pageType!=="global").sort(($,X)=>$.name.localeCompare(X.name));return p.compact([...Se,...de,...V])},[g,n]);return r.jsxs("div",{className:"flex flex-col justify-between h-full",children:[r.jsxs("div",{className:"flex flex-col h-full space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary text-primary-foreground",children:r.jsx(R.File,{className:"w-6 h-6"})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-sm font-semibold",children:"Pages"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Manage your site structure"})]})]}),r.jsxs("div",{className:"relative flex item-center gap-x-4",children:[r.jsx(R.Search,{strokeWidth:2.5,className:"absolute left-3 top-2.5 h-4 w-4 text-gray-400"}),r.jsx(d.Input,{placeholder:"Search pages...",className:"text-xs font-medium leading-none text-gray-700 pl-9 placeholder:text-gray-400",value:n,onChange:b=>s(b.target.value)})]}),S?r.jsx("div",{className:"space-y-2",children:p.map([...Array(5).keys()],b=>r.jsx("div",{className:"w-full bg-gray-200 rounded h-9 animate-pulse"},b))}):p.isEmpty(v)?r.jsxs("div",{className:"h-[70vh] flex flex-col gap-y-1 items-center justify-center text-slate-500 text-sm font-medium",children:[r.jsx(R.File,{className:"h-6 w-6 stroke-[1]"}),"Empty List!",r.jsx("span",{className:"font-light",children:"Add new page to start"})]}):r.jsx("div",{className:"text-sm text-slate-700 space-y-2 h-[70vh] overflow-y-auto",children:p.map(v,b=>b.children.length>0?r.jsxs("div",{className:"border-0",children:[r.jsx(Dn,{changeActivePage:T,setUnpublishPage:l,setDeletePage:i,setAddEditPage:h,active:A===b.id,page:b}),r.jsx("div",{className:"pt-2 pl-6 bg-white",children:p.map(p.get(b,"children",[]),P=>{const V=A===p.get(P,"id");return r.jsx(Dn,{parentSlug:b.slug,changeActivePage:T,setUnpublishPage:l,setDeletePage:i,setAddEditPage:h,active:V,page:P})})})]},b.key):r.jsx(Dn,{changeActivePage:T,setUnpublishPage:l,setDeletePage:i,setAddEditPage:h,active:A===b.id,page:b}))})]}),r.jsxs(d.Button,{className:"flex text-sm gap-x-2",onClick:()=>{h({slug:"",name:"",pageType:"page"})},children:[r.jsx(R.Plus,{className:"w-4 h-4"})," Add New"]}),c&&r.jsx(so,{editPage:T,addEditPage:c,setAddEditPage:h}),a&&r.jsx(pr,{page:a,onClose:()=>i(null)}),o&&r.jsx(Zn,{page:o,onClose:()=>l(null)})]})},ao=()=>{const e=Fe("logo",null);return e?r.jsx("div",{className:"w-full max-h-9 overflow-hidden pr-2",children:w.createElement(e,{})}):null},io=()=>{const[e]=He(),t=e.get("page"),{data:n,isFetching:s}=Me(),[a,i]=w.useState(!1),o=!!t&&!p.isEmpty(n),l=!t||!s&&p.isEmpty(n)||a;return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{variant:"secondary",className:"flex items-center w-full space-x-2 py-1",onClick:()=>i(!0),children:[r.jsx("div",{children:r.jsx(R.Logs,{className:"h-4 w-4"})}),r.jsxs("span",{className:"truncate leading-tight flex items-center max-w-[200px]",children:[r.jsx("span",{className:"text-slate-600 pr-1 font-light",children:"Editing:"}),s?r.jsx(R.Loader,{className:"h-4 w-4 animate-spin text-slate-400 ml-2"}):p.startCase(p.get(n,"name"))??""]})]},"template-viewer"),r.jsx(d.Sheet,{open:l,onOpenChange:c=>!c&&o&&i(!1),children:r.jsx(d.SheetContent,{side:"left",className:`!max-w-screen-sm border-border w-full ${o?"":"sheet-hide-close-btn"}`,children:r.jsx(ro,{close:()=>i(!1)})})})]})},oo=()=>{const{fallbackLang:e,languages:t,selectedLang:n,setSelectedLang:s}=Oe.useLanguages(),a=p.isEmpty(n)?e:n,[i,o]=w.useState(null),{data:l}=Me(),{data:c}=Qn(),{data:h,isFetching:y}=Yn(),g=w.useMemo(()=>{const S=p.compact(p.map(p.get(c,"languages"),x=>{const j=p.find(h,{lang:x});return{key:x,value:p.get(Ue,x,x),isLangPageAdded:!!j}})).filter(Boolean);return[{key:e,value:p.get(Ue,e),isLangPageAdded:!0},...S]},[e,h,c]);return p.isEmpty(t)||y?null:r.jsxs(r.Fragment,{children:[r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(R.Languages,{className:"w-4 h-4"}),p.get(Ue,a,a),r.jsx(R.ChevronDown,{className:"w-4 h-4"})]})}),r.jsxs(d.DropdownMenuContent,{className:"border-border space-y-1",children:[p.map(g.filter(S=>S.isLangPageAdded),S=>r.jsxs(d.DropdownMenuItem,{className:Oe.mergeClasses("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",S.key===a&&"!bg-gray-200 text-gray-700"),onClick:()=>s(S.key),children:[r.jsx("div",{className:"text-slate-600",children:S.value}),S.key===e&&r.jsxs("small",{className:"text-[9px] flex items-center gap-x-1 text-orange-500 leading-none",children:[r.jsx(R.Star,{fill:"orange",className:"w-2 h-2"}),"Primary"]})]},S.value)),!p.isEmpty(g.filter(S=>!S.isLangPageAdded))&&r.jsxs(r.Fragment,{children:[r.jsx(d.Separator,{}),r.jsxs(d.Button,{size:"sm",variant:"ghost",onClick:()=>{o({name:l==null?void 0:l.name,pageType:l==null?void 0:l.pageType,lang:"",slug:"",edit:!1})},className:"hover:bg-slate-300 duration-200 font-normal text-xs hover:text-slate-800",children:[r.jsx(R.Plus,{className:"w-3 h-3 mr-1"})," Add Langauge"]})]})]})]}),i&&r.jsx(xr,{languages:t,langProps:i,onClose:()=>o(null)})]})};function lo(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ao,{}),r.jsx(io,{}),r.jsx(oo,{})]})}function br({children:e,content:t}){return r.jsx(d.TooltipProvider,{children:r.jsxs(d.Tooltip,{children:[r.jsx(d.TooltipTrigger,{asChild:!0,children:e}),r.jsx(d.TooltipContent,{side:"bottom",sideOffset:10,children:r.jsx("p",{children:t})})]})})}const co=()=>{const e=he(),t=me();return K.useQuery({queryKey:[O.GET_CHANGES],queryFn:async()=>t(e,{action:O.GET_CHANGES})})},uo=({currentEditor:e})=>{const{data:t}=fr(e);return t==null?void 0:t.name};function fo({onClose:e=()=>console.log("Cancelled")}){const[t,n]=w.useState([]),{data:s,isFetching:a}=co(),{data:i}=Yt(),o=w.useMemo(()=>p.filter(s,v=>v.pageType!=="global"),[s]),l=w.useMemo(()=>p.filter(s,{pageType:"global"}),[s]),c=w.useMemo(()=>p.find(s,{pageType:"theme",id:"THEME"}),[s]),{mutate:h,isPending:y}=Jn();w.useEffect(()=>{const v=p.map(p.filter(s,{online:!0}),"id");c&&v.push(c==null?void 0:c.id),n(v)},[s,c]);const g=t.length===(s==null?void 0:s.length),S=v=>{n(b=>p.includes(b,v)?p.filter(b,P=>P!==v):p.concat(b,v))},x=()=>{n(g?[]:p.map(s,"id"))},j=()=>{h({ids:p.uniq(t)},{onSuccess:()=>{e(),mn("CENTER_CENTER")}})},A=v=>{if(v==="global")return"Global Block";if(v==="theme")return"Theme";const b=p.find(i,{key:v});return b?b==null?void 0:b.name:v},T=w.useMemo(()=>{const v=[{label:"Updated Pages & Global Blocks",top:"pt-2"},...p.orderBy(p.filter(o,{online:!0}),"pageType"),...p.orderBy(p.filter(l,{online:!0}),"pageType")].filter(V=>V.pageType!=="theme"),b=[{label:"Offline Pages & Global Blocks",top:"pt-6"},...p.orderBy(p.filter(o,{online:!1}),"pageType"),...p.orderBy(p.filter(l,{online:!1}),"pageType")],P=c?[{label:"Theme",top:"pt-6"},c]:[];return[...v,...P,...b]},[o,l,c]);return r.jsx(d.Dialog,{open:!0,onOpenChange:y?()=>{}:e,children:r.jsxs(d.DialogContent,{className:"max-w-4xl max-h-[80%] flex flex-col",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Publish changes"}),r.jsx(d.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),r.jsx("div",{className:"relative h-full max-h-full -mx-4 overflow-y-auto no-scrollbar",children:a?r.jsxs("div",{className:"px-1 space-y-2",children:[r.jsx("div",{className:"w-full h-6 mt-2 bg-gray-200 rounded animate-pulse"}),r.jsx("div",{className:"w-full h-6 bg-gray-200 rounded animate-pulse"}),r.jsx("div",{className:"w-full h-6 bg-gray-200 rounded animate-pulse"}),r.jsx("div",{className:"w-full h-6 bg-gray-200 rounded animate-pulse"})]}):r.jsxs("table",{className:"w-full text-xs text-left text-gray-500 rtl:text-right dark:text-gray-400",children:[r.jsx("thead",{className:"text-gray-700 border-b bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:r.jsxs("tr",{children:[r.jsxs("th",{scope:"col",className:"px-6 py-3 flex items-center gap-x-2 w-[1 50px]",children:[r.jsx("input",{checked:g,onClick:v=>{v.stopPropagation(),x()},type:"checkbox",className:"mt-1 rounded cursor-pointer focus:outline-none focus:ring-0"}),"Name"]}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Language"}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Type"}),r.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),r.jsx("tbody",{children:p.map(T,v=>v.label?r.jsx("tr",{children:r.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${v.top}`,children:[r.jsx("div",{className:"absolute inset-0 flex items-center left-6",children:r.jsx("div",{className:"w-full order-gray-300"})}),r.jsx("div",{className:"relative flex justify-start",children:r.jsx("span",{className:"pr-2 bg-gray-50",children:v.label})})]})},"separator"):r.jsxs("tr",{className:"border-b group hover:bg-gray-50 last:border-b-0",children:[r.jsxs("td",{scope:"row",className:"flex items-center px-6 py-2 text-gray-900 whitespace-nowrap dark:text-white gap-x-1",children:[r.jsx("input",{checked:p.includes(t,v==null?void 0:v.id),onClick:b=>{b.stopPropagation(),S(v==null?void 0:v.id)},type:"checkbox",className:"rounded cursor-pointer focus:outline-none focus:ring-0"})," ",v.pageType==="global"?r.jsx(R.GlobeIcon,{className:"w-4 h-4"}):r.jsx(R.File,{className:"w-4 h-4"}),v.name,v.slug&&r.jsxs("span",{className:"text-xs text-gray-500",children:["(",v.slug,")"]}),v.currentEditor&&r.jsx("div",{className:"flex items-center gap-x-1",children:r.jsxs("span",{className:"flex text-xs font-bold text-gray-500",children:[" ","-"," ",r.jsx(uo,{currentEditor:v.currentEditor})," ","is editing"]})})]}),r.jsx("td",{className:"px-2",children:v.lang}),r.jsx("td",{className:"px-2",children:A(v==null?void 0:v.pageType)}),r.jsx("td",{className:"px-4 text-right",children:p.first(v.changes)||""})]},v==null?void 0:v.id))})]})}),r.jsxs(d.DialogFooter,{className:"mt-10",children:[r.jsx(d.Button,{disabled:y,variant:"outline",onClick:e,children:"Cancel"}),r.jsx(d.Button,{disabled:y||a||p.isEmpty(s),onClick:j,children:y?"Publishing...":"Publish"})]})]})})}const ho=()=>{const e=me(),t=he();return K.useQuery({queryKey:[O.GET_WEBSITE_DATA],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:O.GET_WEBSITE_DATA,data:{draft:!0}})})};function mo({onClose:e}){const{data:t,isFetching:n}=ho(),{mutateAsync:s,isPending:a}=Ui(),i=Fe("settingComponent",null),o=p.debounce(async l=>(await s({data:l}),!0),300);return i?r.jsx(d.Dialog,{open:!0,onOpenChange:e,children:r.jsxs(d.DialogContent,{className:"w-full",children:[r.jsx(d.DialogHeader,{children:r.jsx(d.DialogTitle,{children:"Website Settings"})}),n?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):r.jsx("div",{children:w.createElement(i,{data:t||{},onSave:a?()=>{}:o,cancel:a?()=>{}:e})})]})}):null}const go=()=>{const e=Fe("getPreviewUrl",async o=>o),[t,n]=w.useState(""),{data:s,isFetching:a}=Me(),i=w.useMemo(()=>s==null?void 0:s.slug,[s==null?void 0:s.slug]);return w.useEffect(()=>{(async()=>{if(i&&typeof e=="function"){const o=await e(i||"");n(o)}else n("")})()},[e,i]),!t||(s==null?void 0:s.pageType)==="global"||a?null:r.jsx(r.Fragment,{children:r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(R.Eye,{className:"w-4 h-4"})," ",D.PREVIEW]})})})},yo=()=>{const[e,t]=Oe.useRightPanel();return r.jsxs(r.Fragment,{children:[r.jsx(br,{content:D.THEME,children:r.jsx(d.Button,{variant:e==="theme"?"outline":"ghost",size:"icon",className:"gap-2",onClick:()=>t(e==="theme"?"block":"theme"),children:r.jsx(R.Palette,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},po=()=>{const[e,t]=w.useState(!1),{isLocked:n}=Qt(),{savePage:s,saveState:a}=Oe.useSavePage();w.useEffect(()=>{const y=g=>{a==="UNSAVED"&&(g.preventDefault(),g.returnValue=!1)};return a==="UNSAVED"&&window.addEventListener("beforeunload",y),()=>{window.removeEventListener("beforeunload",y)}},[a]);const i=w.useCallback(async()=>{t(!0),await s(!1)},[s]);w.useEffect(()=>{a==="SAVED"&&t(!1)},[a]);const o=w.useMemo(()=>{if(a==="SAVED"||a==="UNSAVED")return a;if(a==="SAVING")return e?a:"SAVED"},[e,a]),{buttonIcon:l,buttonClass:c,tooltipContent:h}=w.useMemo(()=>{switch(o){case"UNSAVED":return{tooltipContent:D.SAVEDRAFT,buttonIcon:r.jsx(R.Save,{className:"w-4 h-4"}),buttonClass:"flex items-center gap-x-1 leading-tight"};case"SAVING":return{tooltipContent:D.SAVING,buttonIcon:r.jsx(R.Loader,{className:"w-4 h-4 animate-spin"}),buttonClass:"flex items-center gap-x-1 leading-tight"};case"SAVED":return{tooltipContent:D.SAVED,buttonIcon:r.jsx(R.CheckCircle,{className:"w-4 h-4"}),buttonClass:"text-green-500 flex items-center gap-x-1 leading-tight"}}},[o]);return n?null:r.jsxs(d.Button,{size:"sm",variant:"ghost",onClick:i,className:c,children:[l," ",h]})},xo=()=>{const[e,t]=w.useState(!1),[n,s]=w.useState(!1),[a,i]=w.useState(null),{data:o}=Me(),{mutate:l,isPending:c}=Jn(),[h]=Oe.useBlocksStore(),{buttonText:y,buttonClassName:g,isPublished:S}=w.useMemo(()=>{const j=o&&(o==null?void 0:o.online);return{buttonClassName:j?"hover:bg-green-600 bg-green-500":"",isPublished:j,buttonText:j?D.PUBLISHED:D.PUBLISH}},[o]),x=async()=>{var A,T;const j=((T=(A=h==null?void 0:h.filter(v=>(v==null?void 0:v._type)==="GlobalBlock"))==null?void 0:A.map(v=>v==null?void 0:v.globalBlock))==null?void 0:T.filter(v=>typeof v=="string"))||[];l({ids:[o==null?void 0:o.id,...j]},{onSuccess:()=>mn("TOP_RIGHT")})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex",children:[r.jsxs(d.Button,{size:"sm",onClick:x,disabled:c||!(o!=null&&o.id),className:`relative overflow-hidden transition-all duration-300 ease-in-out text-white flex items-center gap-1 rounded-r-none ${g}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[r.jsx("span",{className:`flex items-center transition-transform duration-300 ease-in-out ${n?"-translate-y-10":""}`,children:S?r.jsx(R.Send,{className:"w-4 h-4"}):r.jsx(R.Rocket,{className:"w-4 h-4"})}),r.jsx("span",{className:`absolute inset-0 flex items-center left-3 transition-transform duration-300 ease-in-out ${n?"":"translate-y-10"}`,children:S?r.jsx(R.Rocket,{className:"w-4 h-4"}):r.jsx(R.Send,{className:"w-4 h-4"})}),r.jsx("span",{children:y})]}),r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,children:r.jsx(d.Button,{size:"sm",disabled:c||!(o!=null&&o.id),className:`px-2 text-white border-l border-white/50 rounded-l-none ${g}`,children:r.jsx(R.ChevronDown,{className:"w-4 h-4"})})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"w-36",children:[!S&&r.jsxs(d.DropdownMenuItem,{disabled:c,className:"text-xs cursor-pointer",onClick:()=>l({ids:[o==null?void 0:o.id]},{onSuccess:()=>mn("TOP_RIGHT")}),children:[D.PUBLISH," page"]}),r.jsxs(d.DropdownMenuItem,{onClick:()=>t(!0),className:"text-xs cursor-pointer",children:[D.OPEN," publish menu"]}),S&&r.jsxs(d.DropdownMenuItem,{onClick:()=>i(o),className:"text-xs cursor-pointer",children:[D.UNPUBLISH," page"]})]})]})]}),e&&r.jsx(fo,{onClose:()=>t(!1)}),a&&r.jsx(Zn,{page:a,onClose:()=>i(null)})]})},vo=()=>{const e=Fe("settingComponent",null),[t,n]=w.useState(!1);return e?r.jsxs(r.Fragment,{children:[r.jsx(br,{content:D.WEBSITEDATA,children:r.jsx(d.Button,{variant:"ghost",size:"icon",className:"gap-2",onClick:()=>n(!0),children:r.jsx(R.Settings,{className:"w-4 h-4"})})}),t&&r.jsx(mo,{onClose:()=>n(!1)}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]}):null},bo=()=>{const{data:e}=Me(),t=e&&(e==null?void 0:e.online);return(e==null?void 0:e.pageType)==="global"?null:r.jsxs(d.Button,{onClick:()=>t&&window.open(`${window.location.origin}${e.slug}`,"_blank"),disabled:!t,variant:"ghost",size:"sm",className:"flex items-center gap-1",children:[r.jsx(R.ExternalLink,{className:"w-4 h-4"}),r.jsx("span",{className:"hidden sm:inline",children:D.OPEN})]})};function Eo(){const{isLocked:e}=Qt();return e?null:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(yo,{}),r.jsx(vo,{}),r.jsx(go,{}),r.jsx(po,{}),r.jsx(xo,{}),r.jsx(bo,{})]})}Or.loadWebBlocks();const So=e=>{const t=w.useRef([]),[n]=He(),s=n.get("page"),{data:a}=Me(),{data:i}=Mi(),{data:o,isFetching:l}=hr(),{blocks:c}=Li(o),{data:h}=Qn(),{data:y}=Yt(),{mutateAsync:g}=gr(),S=Ii(),{getUILibraryBlock:x,getUILibraryBlocks:j,onSave:A}=Bi(),{getGlobalBlocks:T,getGlobalBlockBlocks:v}=Fi(),{aiContext:b,setAiContext:P}=zn(),{mutateAsync:V}=Ri(),[U,de]=w.useState(!1);w.useEffect(()=>{const B=()=>{document.hidden?de(!0):de(!1)};return window.addEventListener("visibilitychange",B),()=>window.removeEventListener("visibilitychange",B)},[]),t.current=c;const Se=w.useMemo(()=>{const B={};return e.mediaManagerComponent&&(B.mediaManagerComponent=e.mediaManagerComponent),B},[e.mediaManagerComponent]),$=w.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...i,...e==null?void 0:e.uiLibraries]:i,[i,e==null?void 0:e.uiLibraries]),X=w.useCallback(async(B,ge)=>await V({pageType:B,query:ge}),[V]),J=w.useMemo(()=>p.get(h,"theme",{})||{},[h]);return r.jsxs(r.Fragment,{children:[l&&r.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center w-screen h-screen bg-white/30",children:r.jsx("div",{className:"flex items-center justify-center bg-white rounded-full size-10",children:r.jsx(R.Loader2,{className:"size-5 animate-spin"})})}),r.jsx(Oe.ChaiBuilderEditor,{themePresets:e.themePresets??[],pageId:a==null?void 0:a.id,addBlocksDialogTabs:e.addBlocksDialogTabs||[],loading:l,fallbackLang:h.fallbackLang||"en",languages:(h==null?void 0:h.languages)||[],brandingOptions:(h==null?void 0:h.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:!U&&(e.autoSaveSupport??!0),autoSaveInterval:e.autoSaveInterval??15,onError:e.onError||console.error,getGlobalBlockBlocks:v,getGlobalBlocks:T,blocks:l?[]:c,theme:p.cloneDeep(J),getUILibraryBlock:x,getUILibraryBlocks:j,uiLibraries:$,pageTypes:y,searchPageTypeItems:X,saveAiContextCallback:async B=>{if(!s)return!0;const ge=t.current,N={_type:"@chai/ai-context",_value:p.isString(B)?B:""},ie=[...ge,N];return await A({page:s,blocks:ie}),P(B),!0},aiContext:b,askAiCallBack:S,onSave:async({blocks:B,theme:ge})=>{if(!s)return!0;t.current=B;const N={_type:"@chai/ai-context",_value:p.isString(b)?b:""},ie=[...B,N];return await A({page:s,blocks:ie}),t.current=B,p.isEqual(ge,J)||await g({settings:{theme:ge}}),!0},topBarComponents:{left:[lo],right:[Eo]},sideBarComponents:{top:[...(a==null?void 0:a.pageType)!=="global"?[{label:"SEO Setting",component:vr,icon:r.jsx(r.Fragment,{children:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",fill:"currentColor",width:"21",height:"21",children:[r.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"}),r.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(h==null?void 0:h.languages)?[]:[{label:`Language ${(a==null?void 0:a.pageType)==="global"?"":"page"}`,component:Ki,icon:r.jsx(R.Languages,{className:"w-5 h-5 stroke-[2]"})}]],bottom:[...e!=null&&e.sidebarBottomComponents?[...e.sidebarBottomComponents]:[],Qi]},themePanelComponent:to,...Se})]})},wo=new K.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1}}}),jo=e=>{const[,t]=dr(),[n,s]=w.useState(!1);return w.useEffect(()=>(t(p.pick(e,["apiUrl","getPreviewUrl","logo","settingComponent","user","onSessionExpired","pageLockComponent"])),setTimeout(()=>{s(!0)},200),()=>{s(!1),t({})}),[e,t]),n?r.jsxs(K.QueryClientProvider,{client:wo,children:[r.jsx(So,{...e}),r.jsx(Pi,{})]}):r.jsx("div",{})};exports.$TRACK=Hn;exports.ChaiBuilderForge=jo;exports.Dynamic=Oa;exports.For=la;exports.Index=ca;exports.Match=fa;exports.Portal=La;exports.Show=ua;exports.Switch=da;exports.addEventListener=qs;exports.batch=Wr;exports.className=Fs;exports.clearDelegatedEvents=ja;exports.convertRemToPixels=wi;exports.createComponent=Vn;exports.createComputed=Ps;exports.createContext=Yr;exports.createEffect=Wn;exports.createMemo=Ne;exports.createRenderEffect=$e;exports.createRoot=We;exports.createSignal=fe;exports.createUniqueId=oa;exports.delegateEvents=Bs;exports.deleteNestedDataByPath=kt;exports.displayValue=pi;exports.getMutationStatusColor=gi;exports.getPreferredColorScheme=ji;exports.getQueryStatusColor=mi;exports.getQueryStatusColorByLabel=yi;exports.getQueryStatusLabel=fi;exports.getSidedProp=hi;exports.insert=hn;exports.mergeProps=Kn;exports.mutationSortFns=Si;exports.on=$r;exports.onCleanup=pt;exports.onMount=_s;exports.serialize=or;exports.setAttribute=fn;exports.sortFns=bi;exports.splitProps=Gs;exports.spread=Hs;exports.stringify=di;exports.template=wa;exports.untrack=Ee;exports.updateNestedDataByPath=_t;exports.use=Ws;exports.useContext=Xr;exports.useTransition=Qr;
|