@chaibuilder/sdk 4.0.0-beta.7 → 4.0.0-beta.9
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/README.md +5 -8
- package/dist/{2SSKDMRQ-hL7THuKW.js → 2SSKDMRQ-CdFBQR2o.js} +2 -2
- package/dist/{2SSKDMRQ-DDOgISWg.cjs → 2SSKDMRQ-CuQ42ST6.cjs} +1 -1
- package/dist/{AP7HFJJL-tcAhVllC.cjs → AP7HFJJL-DcnEb4BE.cjs} +1 -1
- package/dist/{AP7HFJJL-BsLQ13V_.js → AP7HFJJL-bDlWX5Yx.js} +1 -1
- package/dist/{IconPicker-FLSVAZxx.js → IconPicker-CNwplOGy.js} +2 -2
- package/dist/{IconPicker-J1KLNrSB.cjs → IconPicker-FpyYsxOf.cjs} +1 -1
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-BTj8AXV6.cjs → WDYDFRGG-BxLmjulP.cjs} +1 -1
- package/dist/{WDYDFRGG-Yi0eNS2V.js → WDYDFRGG-CWq7H6Qk.js} +2 -2
- package/dist/{actions-registery-CtQSSexG.cjs → actions-registery-BRgseJas.cjs} +16 -16
- package/dist/{actions-registery-DqrFhSMp.js → actions-registery-DRV8xywr.js} +180 -181
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +112 -51
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-Dozn833d.js → active-in-another-tab-C392ZWQc.js} +3 -3
- package/dist/{active-in-another-tab-BtAiatqq.cjs → active-in-another-tab-DEWOFgY5.cjs} +1 -1
- package/dist/{add-new-language-page-DD-CAoAQ.js → add-new-language-page-BL2F_Cu7.js} +4 -4
- package/dist/{add-new-language-page-9AMizlES.cjs → add-new-language-page-DBWd0wDY.cjs} +1 -1
- package/dist/{add-new-page-BS9vPnFG.cjs → add-new-page-DYrQeKCi.cjs} +1 -1
- package/dist/{add-new-page-uZKCk9eB.js → add-new-page-QVlyJhn9.js} +2 -2
- package/dist/{ai-panel-content-CK4XOkEh.js → ai-panel-content-CCOluPtK.js} +4 -4
- package/dist/{ai-panel-content-PovaKJaj.cjs → ai-panel-content-DCZRBa6s.cjs} +1 -1
- package/dist/{ai-panel-default-lang-B37k5ADH.cjs → ai-panel-default-lang-C3t0elrO.cjs} +2 -2
- package/dist/{ai-panel-default-lang-BtLjUl9d.js → ai-panel-default-lang-Crz7QAxl.js} +4 -4
- package/dist/{ai-panel-other-lang-CdQmASqv.cjs → ai-panel-other-lang-BRkr4Te3.cjs} +1 -1
- package/dist/{ai-panel-other-lang-Dp1MNaLi.js → ai-panel-other-lang-DIF8PYLh.js} +4 -4
- package/dist/{ai-prompt-input-BT-mEdTX.js → ai-prompt-input-D4dqy8L2.js} +2 -2
- package/dist/{ai-prompt-input-Dtym4w8J.cjs → ai-prompt-input-Ybgvrvd6.cjs} +1 -1
- package/dist/{ai-translation-prompt-B-lH7emI.cjs → ai-translation-prompt-Ck12Bfl6.cjs} +1 -1
- package/dist/{ai-translation-prompt-B17GK1QR.js → ai-translation-prompt-eZ4Sllva.js} +2 -2
- package/dist/{apply-binding-BvWfJCSZ.js → apply-binding-CLU6Xp4K.js} +77 -81
- package/dist/apply-binding-NvZX_rJe.cjs +1 -0
- package/dist/{code-display-DloSPyPr.cjs → code-display-9Onx6RCq.cjs} +1 -1
- package/dist/{code-display-Ck81Id9K.js → code-display-oa1j0ri7.js} +1 -1
- package/dist/{code-editor-EZT2pMsU.js → code-editor-D45h29W1.js} +1 -1
- package/dist/{code-editor-CUeNiMzA.cjs → code-editor-DH8eU4WL.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-CS7C6h9Q.js → continue-editing-in-this-client-BRrIvSrl.js} +3 -3
- package/dist/{continue-editing-in-this-client-DMZOc36k.cjs → continue-editing-in-this-client-DgZ9Q18G.cjs} +1 -1
- package/dist/core-8lkXy4lC.cjs +1 -0
- package/dist/core-BvsZwF26.js +52 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +143 -172
- package/dist/core.js +22 -34
- package/dist/{css-import-modal-s7t5gZQo.js → css-import-modal-BhLPzQH8.js} +5 -4
- package/dist/css-import-modal-C2-oVwFv.cjs +13 -0
- package/dist/{delete-design-token-C1smbx4E.js → delete-design-token-D4Q5-Xql.js} +1 -1
- package/dist/{delete-design-token-Mbw_6sYI.cjs → delete-design-token-DJSQluQ6.cjs} +1 -1
- package/dist/{delete-page-B7J3t0FN.cjs → delete-page-BxbsKhY5.cjs} +1 -1
- package/dist/{delete-page-2GfBi8Iv.js → delete-page-xHdZT-7c.js} +3 -3
- package/dist/{design-token-usage-DyO3xM-F.js → design-token-usage-7wgmVSWI.js} +2 -2
- package/dist/{design-token-usage-BoGOULG8.cjs → design-token-usage-KZ4pilLm.cjs} +1 -1
- package/dist/{digital-asset-manager-Cz3Nlrzl.js → digital-asset-manager-BmbVU7fX.js} +4 -4
- package/dist/{digital-asset-manager-DDk2ucTE.cjs → digital-asset-manager-a1fqrQVH.cjs} +1 -1
- package/dist/{duplicate-page-BwAY4Ssm.js → duplicate-page-5uIno9Yh.js} +4 -4
- package/dist/{duplicate-page-Dw3U4wTT.cjs → duplicate-page-BBTxn_o1.cjs} +1 -1
- package/dist/{dynamic-page-selector-CvBFyX2F.cjs → dynamic-page-selector-C1ef0i2I.cjs} +1 -1
- package/dist/{dynamic-page-selector-sViJuQlU.js → dynamic-page-selector-rhvhg7ol.js} +3 -3
- package/dist/{image-editor-BgGQuESa.js → image-editor-BXYZDa0s.js} +1 -1
- package/dist/{image-editor-AIsccrqC.cjs → image-editor-rqUgAO8V.cjs} +1 -1
- package/dist/{index-B7eWP_hB.js → index-Be9lAaD7.js} +421 -425
- package/dist/index-BhqugjzS.cjs +160 -0
- package/dist/index-CNEEEgTV.cjs +5 -0
- package/dist/{index-RYr8kQdI.js → index-mjuSGlPU.js} +5136 -5613
- package/dist/{json-diff-viewer-B2A78udz.cjs → json-diff-viewer-C9qmLiaq.cjs} +1 -1
- package/dist/{json-diff-viewer-Svw-kbhe.js → json-diff-viewer-aVwY7_hZ.js} +3 -3
- package/dist/{lang-panel-Bnc-9wkM.js → lang-panel-BTWk23Mw.js} +4 -4
- package/dist/{lang-panel-AmEkoWid.cjs → lang-panel-Bo1ZWYfu.cjs} +1 -1
- package/dist/{manage-design-tokens-BBkh1t4w.js → manage-design-tokens-id8bylgO.js} +4 -4
- package/dist/manage-design-tokens-lUMCgjdS.cjs +1 -0
- package/dist/{mark-as-template-CE6tRoQy.cjs → mark-as-template-BYXBDXMv.cjs} +1 -1
- package/dist/{mark-as-template-0CPzZnk-.js → mark-as-template-hv3WD852.js} +3 -3
- package/dist/{nested-path-selector-content-kGznHufl.js → nested-path-selector-content-B8z90MFF.js} +2 -2
- package/dist/{nested-path-selector-content-SmfjElr-.cjs → nested-path-selector-content-DgFFXcTD.cjs} +1 -1
- package/dist/{no-language-page-content-B4bQLc4K.cjs → no-language-page-content-6Kk8UjFX.cjs} +1 -1
- package/dist/{no-language-page-content-DXsAPDZd.js → no-language-page-content-DMACzysm.js} +3 -3
- package/dist/{no-language-page-dialog-BpPqmw9a.js → no-language-page-dialog-D4n_XYUq.js} +2 -2
- package/dist/{no-language-page-dialog-BC8NHzK2.cjs → no-language-page-dialog-mBH-fthh.cjs} +1 -1
- package/dist/{page-creator-82qTbBj4.cjs → page-creator-CGglYnYg.cjs} +1 -1
- package/dist/{page-creator-Bazn6yH4.js → page-creator-CgsOF0Eg.js} +4 -4
- package/dist/{page-lock-CRFyqKZE.js → page-lock-CUCEBnJb.js} +2 -2
- package/dist/{page-lock-D2iFZDUK.cjs → page-lock-Hsi61Mk5.cjs} +1 -1
- package/dist/{page-locked-dialog-xLqvKzax.cjs → page-locked-dialog-DSxbAMpt.cjs} +1 -1
- package/dist/{page-locked-dialog-GKfQEOmk.js → page-locked-dialog-bHvbFllT.js} +3 -3
- package/dist/{page-manager-new-Bn2QKjbf.cjs → page-manager-new-CBfFl5rL.cjs} +1 -1
- package/dist/{page-manager-new-DItY2hjd.js → page-manager-new-Cifc526h.js} +8 -8
- package/dist/{page-manager-search-and-filter-CPa8IXdd.js → page-manager-search-and-filter-CLJss6pV.js} +3 -3
- package/dist/{page-manager-search-and-filter-Dc4ky-qV.cjs → page-manager-search-and-filter-mEKl-UKh.cjs} +1 -1
- package/dist/page-revisions-content-C95dQJyx.cjs +1 -0
- package/dist/{page-revisions-content-CH-PZK0O.js → page-revisions-content-DvL4ya9g.js} +75 -67
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +146 -92
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-BzJDObqr.cjs → publish-pages-content-B-6vSkql.cjs} +1 -1
- package/dist/{publish-pages-content-CSJCFElu.js → publish-pages-content-B8-IZW_U.js} +4 -4
- package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-CX_JkRJn.js} +78 -78
- package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +14 -15
- package/dist/render.js +3 -3
- package/dist/{rte-widget-modal-5T81P_hg.js → rte-widget-modal-1SbY5bcQ.js} +7 -7
- package/dist/{rte-widget-modal-BfXcA7OP.cjs → rte-widget-modal-CyKwtbOG.cjs} +1 -1
- package/dist/runtime-client.cjs +1 -0
- package/dist/runtime-client.d.ts +158 -0
- package/dist/runtime-client.js +32 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +92 -240
- package/dist/runtime.js +72 -72
- package/dist/{save-to-lib-MtWKSVeN.js → save-to-lib-BKcBfjfi.js} +3 -3
- package/dist/{save-to-lib-DGAdSa-0.cjs → save-to-lib-BmPh_Vns.cjs} +1 -1
- package/dist/{selected-block-display-CB1-hVR5.js → selected-block-display-B3hHlcLA.js} +3 -3
- package/dist/{selected-block-display-DLt_nMn9.cjs → selected-block-display-BCvTNcp2.cjs} +1 -1
- package/dist/{seo-panel-CRzzw4FW.js → seo-panel-D3EyOYij.js} +3 -3
- package/dist/{seo-panel-_kGXE9MC.cjs → seo-panel-DVClgzX9.cjs} +1 -1
- package/dist/{shared-json-ld-DoRgzDPC.cjs → shared-json-ld-BRgJTv0m.cjs} +1 -1
- package/dist/{shared-json-ld-CXukkDeS.js → shared-json-ld-DSPadwbY.js} +3 -3
- package/dist/{slug-input-Dp187Tiy.cjs → slug-input-B39SPBdP.cjs} +1 -1
- package/dist/{slug-input-CeEQ0zyv.js → slug-input-C3UrwSkt.js} +2 -2
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-C9J3_rev.js → take-over-request-DfAlPvpE.js} +3 -3
- package/dist/{take-over-request-CXuakFBm.cjs → take-over-request-Tq9-gOCV.cjs} +1 -1
- package/dist/{theme-panel-footer-DvwsyHNQ.js → theme-panel-footer-DIy4baYU.js} +3 -3
- package/dist/{theme-panel-footer-CWZ0qs13.cjs → theme-panel-footer-DQzjVBBP.cjs} +1 -1
- package/dist/{translation-warning-modal-_aBp5ZZQ.js → translation-warning-modal-BHwLZZOw.js} +2 -2
- package/dist/{translation-warning-modal-DEt_ExQp.cjs → translation-warning-modal-Ckwt5Skc.cjs} +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +598 -0
- package/dist/types.js +1 -0
- package/dist/{unmark-as-template-BYL5naYx.cjs → unmark-as-template-BKA-sNZr.cjs} +1 -1
- package/dist/{unmark-as-template-JN-cDUV_.js → unmark-as-template-CbgifSbI.js} +3 -3
- package/dist/{unpublish-page-B06iZEIO.cjs → unpublish-page-BqzvOD76.cjs} +1 -1
- package/dist/{unpublish-page-DqwBY2yI.js → unpublish-page-DXQpAkvc.js} +3 -3
- package/dist/utils.d.ts +5 -5
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +214 -214
- package/dist/{web-preview-h39D3TUh.js → web-preview-DH7Yv-jg.js} +2 -2
- package/dist/{web-preview-wRgRY3Tv.cjs → web-preview-DShy13AM.cjs} +1 -1
- package/package.json +13 -7
- package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
- package/dist/core-Dr7QYemB.js +0 -56
- package/dist/core-Y0lXLwkq.cjs +0 -1
- package/dist/css-import-modal-kHB0ramf.cjs +0 -13
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-BwH1mRm_.cjs +0 -5
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/index-xYnNKovy.cjs +0 -160
- package/dist/manage-design-tokens-B2fG80bi.cjs +0 -1
- package/dist/page-revisions-content-CcLFI4YK.cjs +0 -1
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as d, createElement as m } from "react";
|
|
3
|
-
import { B as s } from "./register-chai-top-bar-
|
|
3
|
+
import { B as s } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
5
|
import { map as p } from "lodash-es";
|
|
6
6
|
import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
|
|
7
|
-
import { p as v, T as _ } from "./index-
|
|
7
|
+
import { p as v, T as _ } from "./index-Be9lAaD7.js";
|
|
8
8
|
const b = [
|
|
9
9
|
{
|
|
10
10
|
title: "mobile_xs_title",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DWTuRU53.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-CNEEEgTV.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:o,setIframeWidth:r})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>r(s),variant:s===t?"default":"ghost",children:o}),p=()=>{const[t,s]=l.useState(1200),o=i=>s(i),[r,d]=u.useAtom(c.previewUrlAtom);if(!r)return null;const h=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,i=>l.createElement(w,{...i,setIframeWidth:o,key:i.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:h,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor",fillRule:"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:r})]})};exports.default=p;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "4.0.0-beta.
|
|
8
|
+
"version": "4.0.0-beta.9",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -47,6 +47,11 @@
|
|
|
47
47
|
"import": "./dist/runtime.js",
|
|
48
48
|
"require": "./dist/runtime.cjs"
|
|
49
49
|
},
|
|
50
|
+
"./runtime/client": {
|
|
51
|
+
"types": "./dist/runtime-client.d.ts",
|
|
52
|
+
"import": "./dist/runtime-client.js",
|
|
53
|
+
"require": "./dist/runtime-client.cjs"
|
|
54
|
+
},
|
|
50
55
|
"./actions/supabase": {
|
|
51
56
|
"types": "./dist/supabase-actions.d.ts",
|
|
52
57
|
"import": "./dist/supabase-actions.js",
|
|
@@ -60,6 +65,11 @@
|
|
|
60
65
|
"./styles": {
|
|
61
66
|
"import": "./dist/sdk.css",
|
|
62
67
|
"require": "./dist/sdk.css"
|
|
68
|
+
},
|
|
69
|
+
"./types": {
|
|
70
|
+
"types": "./dist/types.d.ts",
|
|
71
|
+
"import": "./dist/types.js",
|
|
72
|
+
"require": "./dist/types.cjs"
|
|
63
73
|
}
|
|
64
74
|
},
|
|
65
75
|
"peerDependencies": {
|
|
@@ -71,8 +81,7 @@
|
|
|
71
81
|
"postgres": "^3.4.8",
|
|
72
82
|
"react": "^18.0 || ^19.0 || ^19.1 || ^19.2",
|
|
73
83
|
"react-dom": "^18.0 || ^19.0 || ^19.1 || ^19.2",
|
|
74
|
-
"sharp": "^0.34.5"
|
|
75
|
-
"streamdown": "^1.6.10"
|
|
84
|
+
"sharp": "^0.34.5"
|
|
76
85
|
},
|
|
77
86
|
"peerDependenciesMeta": {
|
|
78
87
|
"@types/react": {
|
|
@@ -90,9 +99,6 @@
|
|
|
90
99
|
"ai": {
|
|
91
100
|
"optional": true
|
|
92
101
|
},
|
|
93
|
-
"streamdown": {
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
102
|
"sharp": {
|
|
97
103
|
"optional": true
|
|
98
104
|
},
|
|
@@ -188,6 +194,7 @@
|
|
|
188
194
|
"react-i18next": "16.0.0",
|
|
189
195
|
"react-wrap-balancer": "^1.1.1",
|
|
190
196
|
"sonner": "^2.0.7",
|
|
197
|
+
"streamdown": "^1.6.10",
|
|
191
198
|
"tailwind-merge": "^3.4.0",
|
|
192
199
|
"tree-model": "^1.0.7",
|
|
193
200
|
"undo-manager": "1.1.1",
|
|
@@ -246,7 +253,6 @@
|
|
|
246
253
|
"react-router-dom": "^7.11.0",
|
|
247
254
|
"shadcn": "2.3.0",
|
|
248
255
|
"sharp": "^0.34.5",
|
|
249
|
-
"streamdown": "^1.6.10",
|
|
250
256
|
"tailwindcss": "^3.4.19",
|
|
251
257
|
"ts-jest": "^29.4.6",
|
|
252
258
|
"ts-node": "^10.9.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const T=require("./common-functions-B3a4xKt_.cjs"),e=require("lodash-es"),f=require("himalaya"),q=require("./core-Y0lXLwkq.cjs"),U=require("tailwind-merge"),m="#styles:",Y="__ADD_BLOCK_INTERNAL_ROOT",K="@",H="#",v="dt#",O=t=>{if(t=t.replace(m,""),!t)return{baseClasses:"",classes:""};const l=t.split(/,(?![^\[]*\])/);if(l.length===1)return{baseClasses:"",classes:l[0].trim()};const[n,...s]=l;return{baseClasses:n.trim(),classes:s.join(",").trim().replace(/ +(?= )/g,"")}};function X(t,l,n){const s=e.get(n,"i18nProps",[]);if(e.isEmpty(l)||e.isEmpty(s))return t;const a=e.cloneDeep(t);return e.forEach(e.keys(a),o=>{if(e.includes(s,o)&&!e.isEmpty(l)){const r=e.get(a,o),i=e.get(a,`${o}-${l}`,"");e.isString(r)?a[o]=e.isString(i)&&!e.isEmpty(i.trim())&&i.trimStart()||r:a[o]=e.isEmpty(i)?r:i}}),a}const M=(t,l)=>{const{baseClasses:n,classes:s}=O(t),o=s.split(" ").filter(i=>i.startsWith(v)).map(i=>{var d;return(d=l[i])==null?void 0:d.value}),r=s.split(" ").filter(i=>!i.startsWith(v)).join(" ");return U.twMerge.apply(null,[n,...o,r])};function G(t,l){return e.get(t,`${l}_attrs`,{})}function Z(t,l=!0,n={}){const s={};return Object.keys(t).forEach(a=>{if(e.isString(t[a])&&t[a].startsWith(m)){const o=M(t[a],n),r=G(t,a);s[a]={...!e.isEmpty(o)&&{className:o},...r,...l?{"data-style-prop":a,"data-block-parent":t._id,"data-style-id":`${a}-${t._id}`}:{}}}}),s}const Q=e.memoize(t=>{const l=q.getRegisteredChaiBlock(t),n=e.get(l,"schema.properties",{});return Object.fromEntries(Object.entries(n).filter(([,s])=>e.get(s,"runtime",!1)))}),ee=(t,l)=>{if(!e.isArray(t))return t;let n=t,s;return typeof l.limit=="number"&&l.limit>0&&(s=l.limit),s!==void 0&&(n=n.slice(0,s)),n},te=(t,l)=>{const n=e.cloneDeep(t);return e.forEach(e.keys(n),s=>{if(e.isString(n[s])&&!e.startsWith(s,"_")){let a=n[s];s==="repeaterItems"&&(n.repeaterItemsBinding=a);const o=/\{\{(.*?)\}\}/g,r=a.match(o);r&&r.forEach(i=>{let d=i.slice(2,-2);const c=e.get(l,d,i);a=e.isArray(c)?c:a.replace(i,c)}),n[s]=a}}),n},se=t=>{const l=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,n=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return l.test(t)||n.test(t)},ne=t=>{if(e.isEmpty(t))return t;const l=/<video[^>]+src=['"]([^'">]+)['"]/,n=/<iframe[^>]+src=['"]([^'">]+)['"]/,s=t.match(l),a=t.match(n),o=s?s[1]:a?a[1]:null,r=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,i=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return o&&(r.test(o)||i.test(o))?o:t},F=["chai-name","data-chai-name"],ae={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"},form:{action:"action"}},le=(t,l)=>{var n;return((n=t.children)==null?void 0:n.length)===1&&e.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link","RichText"],l._type)},E=t=>t.map(l=>l.type==="text"?e.get(l,"content",""):e.isEmpty(l.children)?"":E(l.children||[])).join(""),B=t=>t===null?"":t,J=t=>{const l=e.compact(e.map(t.split(/\s+/),e.trim)),n=e.find(l,i=>/^w-/.test(i)),s=e.find(l,i=>/^h-/.test(i));if(!s||!n)return{height:"",width:""};const a=i=>{if(!i)return;const d=i.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);if(!d)return;if(d[1])return d[1];const c=d[2];return/^\d+(\.\d+)?$/.test(c)?`${Number(c)*4}px`:c==="auto"||e.includes(c,"%")?c:"16px"},o=a(n),r=a(s);return{width:e.includes(o,"px")?o:"16px",height:e.includes(r,"px")?r:"16px"}},V=t=>{if(t.tagName==="svg")return{};const l={},n=ae[t.tagName||""]||{},s=t.attributes||[];return e.forEach(s,({key:a,value:o})=>{var r;if(!e.includes(F,a))if(a==="bid"&&(l._bid=B(o)),n[a]){if(t.tagName==="img"&&a==="src"&&!o.startsWith("http")){const i=e.find(t.attributes,{key:"width"}),d=e.find(t.attributes,{key:"height"});i&&d?o=`https://picsum.photos/${i==null?void 0:i.value}x${d==null?void 0:d.value}`:o="https://picsum.photos/150x150"}else if(t.tagName==="a"){const i=e.find(t.attributes,{key:"href"});i&&typeof(i==null?void 0:i.value)=="string"&&((r=i==null?void 0:i.value)!=null&&r.startsWith("pageType:"))&&e.set(l,"link.type","pageType")}e.set(l,n[a],B(o))}else e.includes(["style","class","srcset","bid"],a)||(l.styles_attrs=l.styles_attrs||{},e.startsWith(a,"@")&&(a=a.replace("@","x-on:")),l.styles_attrs[`${a}`]=B(o))}),delete l.class,l},oe=(t,l="styles")=>{if(!t.attributes)return{[l]:`${m},`};const n=e.find(t.attributes,{key:"class"});if(n){const s=n.value;return{[l]:`${m},${s}`}}return{[l]:`${m},`}},ie=t=>{const l=e.get(t,"attributes",[]),n=l.find(c=>c.key==="data-chai-richtext"||c.key==="chai-richtext"),s=l.find(c=>c.key==="data-chai-lightbox"||c.key==="chai-lightbox"),a=l.find(c=>c.key==="data-chai-dropdown"||c.key==="chai-dropdown"),o=l.find(c=>c.key==="data-chai-dropdown-button"||c.key==="chai-dropdown-button"),r=l.find(c=>c.key==="data-chai-dropdown-content"||c.key==="chai-dropdown-content"),i=l.find(c=>c.key==="class"),d=i&&i.value.split(/\s+/).includes("rte");if(a)return{_type:"Dropdown"};if(o)return{_type:"DropdownButton"};if(r)return{_type:"DropdownContent"};if(n||d)return{_type:"Paragraph"};if(s)return{_type:"LightBoxLink"};switch(t.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"canvas":return{_type:"Canvas"};case"video":case"iframe":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:t.tagName,_listType:t.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:t.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:t.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Box",_name:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:t.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:t.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:{const c=e.get(t,"children",[]).length>0?"Box":"EmptyBox";return{_type:c,tag:t.tagName,_name:c=="EmptyBox"||t.tagName==="div"?c:e.capitalize(t.tagName)}}}},w=(t,l=null)=>e.flatMapDeep(t,n=>{var D,C,I,$,N,L,W,A,P,R;if(n.type==="comment")return[];let s={_id:T.generateUUID()};if(l&&(s._parent=l.block._id),n.type==="text")return e.isEmpty(e.get(n,"content",""))?[]:l&&le(l.node,l.block)?(e.set(l,"block.content",e.get(n,"content","")),[]):{...s,_type:"Text",content:e.get(n,"content","")};if(e.startsWith(n.tagName,"chai-")){const p=n.attributes||[],u=e.find(p,{key:"chai-type"}),y=(u==null?void 0:u.value)||e.startCase(e.camelCase(n.tagName||"")).replace(/ /g,"").replace(/\s+/g,"");s._type=y,e.forEach(p,({key:h,value:j})=>{if(h==="about-this-component"||h==="chai-type"||h==="can-move"||h==="can-delete")return;if(h==="id"){s._id=j;return}const z=e.startsWith(h,"_")?h:e.camelCase(h);let k=B(j);typeof k=="string"&&e.startsWith(k,"#styles:")&&(k=k.replace("#styles:","#styles:,")),s[z]=k});const g=w(n.children||[],{block:s,node:n});return[s,...g]}const a=e.get(n,"attributes",[]),o=n.tagName==="p"||a.find(p=>p.key==="data-chai-richtext"||p.key==="chai-richtext"),r=a.find(p=>p.key==="class"),i=r&&r.value.split(/\s+/).includes("rte"),d=a.find(p=>p.key==="data-chai-lightbox"||p.key==="chai-lightbox"),c=a.find(p=>p.key==="data-chai-dropdown"||p.key==="chai-dropdown"),b=a.find(p=>p.key==="data-chai-dropdown-button"||p.key==="chai-dropdown-button"),_=a.find(p=>p.key==="data-chai-dropdown-content"||p.key==="chai-dropdown-content");if(s={...s,...ie(n),...V(n),...oe(n)},n.attributes){const p=n.attributes.find(u=>e.includes(F,u.key));p&&(s._name=p.value)}if(o||i)return s.content=`<p>${f.stringify(n.children||[])}</p>`,e.has(s,"styles_attrs.data-chai-richtext")&&delete s.styles_attrs["data-chai-richtext"],e.has(s,"styles_attrs.chai-richtext")&&delete s.styles_attrs["chai-richtext"],[s];if(d){const p=["data-chai-lightbox","chai-lightbox","data-vbtype","data-autoplay","data-maxwidth","data-overlay","data-gall","href"];s={...s,href:((D=a.find(u=>u.key==="href"))==null?void 0:D.value)||"",hrefType:((C=a.find(u=>u.key==="data-vbtype"))==null?void 0:C.value)||"video",autoplay:((I=a.find(u=>u.key==="data-autoplay"))==null?void 0:I.value)==="true"?"true":"false",maxWidth:((N=($=a.find(u=>u.key==="data-maxwidth"))==null?void 0:$.value)==null?void 0:N.replace("px",""))||"",backdropColor:((L=a.find(u=>u.key==="data-overlay"))==null?void 0:L.value)||"",galleryName:((W=a.find(u=>u.key==="data-gall"))==null?void 0:W.value)||""},e.forEach(p,u=>{e.has(s,`styles_attrs.${u}`)&&delete s.styles_attrs[u]})}if(c&&(delete s.styles_attrs,s.showDropdown=!1),_&&delete s.styles_attrs,b){delete s.styles_attrs;const p=e.filter(n.children||[],y=>(y==null?void 0:y.tagName)!=="span");s.content=E(p);const u=e.find(n.children||[],y=>(y==null?void 0:y.tagName)==="span"&&e.some(y.children||[],g=>(g==null?void 0:g.tagName)==="svg"));if(u){const y=e.find(u.children||[],g=>(g==null?void 0:g.tagName)==="svg");if(y){s.icon=f.stringify([y]);const{height:g,width:h}=re(y,"16px","16px");s.iconHeight=g,s.iconWidth=h}}return[s]}if(s._type==="Input"){const p=s.inputType||"text";p==="checkbox"?e.set(s,"_type","Checkbox"):p==="radio"&&e.set(s,"_type","Radio")}else if(n.tagName==="video"||n.tagName==="iframe"){const p=f.stringify([n]);return se(p)&&(e.set(s,"_type","Video"),e.set(s,"url",ne(p)),e.set(s,"styles",`${m},`),e.set(s,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),s.content=p,[s]}else if(n.tagName==="svg"){const p=e.get(e.find(n.attributes,{key:"class"}),"value",""),{height:u,width:y}=J(p);if(u&&y)s.styles=`${m}, ${T.cn(`w-${y} h-${u}`,p)}`.trim(),s.height=u==null?void 0:u.replace("px",""),s.width=y==null?void 0:y.replace("px","");else{const g=(A=e.find(n.attributes,{key:"height"}))==null?void 0:A.value,h=(P=e.find(n.attributes,{key:"width"}))==null?void 0:P.value;g&&h?(s.styles=`${m}, ${T.cn(`w-[${h}px] h-[${g}px]`,p)}`.trim(),s.height=g,s.width=h):s.styles=`${m}, ${T.cn("w-full h-full",p)}`.trim()}return n.attributes=e.filter(n.attributes,g=>!e.includes(["style","width","height","class"],g.key)),s.icon=f.stringify([n]),[s]}else if(n.tagName=="option"&&l&&((R=l.block)==null?void 0:R._type)==="Select")return l.block.options.push({label:E(n.children||[]),...V(n)}),[];const x=w(n.children||[],{block:s,node:n});return[s,...x]}),re=(t,l,n)=>{var d,c;const s=e.get(t,"attributes",[]),{height:a,width:o}=J(e.get(e.find(s,{key:"class"}),"value",""));if(a&&o)return{height:`[${a}px]`,width:`[${o}px]`};const r=(d=e.find(s,{key:"height"}))==null?void 0:d.value,i=(c=e.find(s,{key:"width"}))==null?void 0:c.value;return{height:r?`[${r}px]`:n,width:i?`[${i}px]`:l}},ce=t=>{t=t.replace(/(\w+)=\\?"(.*?)\\?"/g,(s,a,o)=>{let r=o.replace(/\\"/g,'"');return r=r.replace(/{([^}]+)}/g,i=>i.replace(/"/g,'\\"')),`${a}="${r.replace(/\\"/g,'"')}"`}),t=t.replace(/\\n/g,"").replace(/\\\\/g,"").replace(/\\([/<>])/g,"$1").replace(/\\./g,"").replace(/[\n\r\t\f\v]/g,""),t=t.replace(/\$name="[^"]*"/g,"");const l=t.match(/<body[^>]*>[\s\S]*?<\/body>/);return(l&&l.length>0?l[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):t).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},pe=t=>{const l=f.parse(ce(t));if(e.isEmpty(t))return[];const n=e.flatten(w(l));return q.syncBlocksWithDefaults(n)},ue=(t,l)=>t.map(n=>{const s=e.keys(n).filter(a=>e.isString(n[a])&&n[a].startsWith(m));return e.each(s,a=>{n[a]=`${m},${M(n[a],l)}`}),n}),de=t=>{const l=e.last(t);return t.map(n=>{const s=Object.keys(n);for(let a=0;a<s.length;a++)if(e.isString(n[s[a]])&&e.startsWith(s[a],"content")){const o=n===l?"":" ";n[s[a]]=`${n[s[a]].trim()}${o}`}return n})},S=(t,l,{index:n,key:s},a)=>{if(e.isString(t)){let o=t;const r=/\{\{(.*?)\}\}/g,i=t.match(r);if(i){const d=a==="image"||a==="mobileImage";i.forEach(c=>{let b=c.slice(2,-2).trim(),_=s.slice(2,-2).trim();n!==-1&&e.startsWith(b,"$index.")?b=`${_}.${n}.${b.slice(7)}`:n!==-1&&e.startsWith(b,"$index")&&(b=`${_}.${n}`);const x=e.get(l,b);x===void 0?o=o.replace(c,""):d&&!e.isArray(x)?o=x:o=e.isArray(x)?x:o.replace(c,x)})}return o}if(e.isArray(t))return t.map(o=>S(o,l,{index:n,key:s},a));if(t&&typeof t=="object"){const o={};return e.forEach(e.keys(t),r=>{!e.startsWith(r,"_")&&r!=="$repeaterItemsKey"?o[r]=S(t[r],l,{index:n,key:s},r):o[r]=t[r]}),o}return t},ye=(t,l,{index:n,key:s})=>{let a=e.cloneDeep(t);return a.repeaterItems&&(a.$repeaterItemsKey=a.repeaterItems,e.startsWith(a.repeaterItems,`{{${H}`)&&(a.$repeaterItemsKey=a.repeaterItems=`${a.repeaterItems.replace("}}",`/${a._id}}}`)}`),!e.isEmpty(a.repeaterItems)&&a.pagination&&(a.repeaterTotalItems=`${a.repeaterItems.replace("}}",`/${a._id}/totalItems}}`)}`)),S(a,l,{index:n,key:s})};exports.COLLECTION_PREFIX=H;exports.DESIGN_TOKEN_PREFIX=v;exports.REPEATER_PREFIX=K;exports.ROOT_TEMP_KEY=Y;exports.STYLES_KEY=m;exports.adjustSpacingInContentBlocks=de;exports.applyBindingToBlockProps=ye;exports.applyChaiDataBinding=te;exports.applyDesignTokens=ue;exports.applyLanguage=X;exports.applyLimit=ee;exports.getBlockRuntimeProps=Q;exports.getBlockTagAttributes=Z;exports.getBlocksFromHTML=pe;exports.getSplitChaiClasses=O;
|
package/dist/core-Dr7QYemB.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { get as c, each as g, has as u, set as o, cloneDeep as k, omitBy as f } from "lodash-es";
|
|
2
|
-
import { useMemo as h } from "react";
|
|
3
|
-
const s = {}, P = () => s, S = (e) => h(() => c(s, e, null), [e]), i = (e) => c(s, e, null), d = (e) => {
|
|
4
|
-
const t = c(s, `${e}.schema.properties`, {}), r = {};
|
|
5
|
-
return g(t, (n, l) => {
|
|
6
|
-
u(n, "block") || o(r, l, n.default);
|
|
7
|
-
}), r;
|
|
8
|
-
}, p = (e) => c(s, `${e}.i18nProps`, []), $ = (e) => c(s, `${e}.aiProps`, []), w = (e) => {
|
|
9
|
-
const t = i(e);
|
|
10
|
-
if (!t)
|
|
11
|
-
return null;
|
|
12
|
-
const r = k(t.schema), n = c(r, "properties", {}), l = f(n, (a) => (a == null ? void 0 : a.styles) === !0);
|
|
13
|
-
o(r, "properties", l);
|
|
14
|
-
const B = c(s, `${e}.uiSchema`, {});
|
|
15
|
-
return { schema: r, uiSchema: B };
|
|
16
|
-
}, D = (e) => e.map((t) => u(s, t._type) ? { ...d(t._type), ...t } : t), m = (e, t) => {
|
|
17
|
-
const r = c(s, t.type);
|
|
18
|
-
r ? o(s, t.type, { ...r, component: e, ...t }) : o(s, t.type, { component: e, ...t });
|
|
19
|
-
}, E = (e, t) => {
|
|
20
|
-
m(e, { ...t, category: t.category || "core" });
|
|
21
|
-
}, I = (e, t) => {
|
|
22
|
-
const r = c(s, t.type);
|
|
23
|
-
r ? o(s, t.type, { ...r, component: e, ...t }) : o(s, t.type, { component: e, ...t });
|
|
24
|
-
}, R = (e, t) => {
|
|
25
|
-
const r = i(e);
|
|
26
|
-
if (!r)
|
|
27
|
-
throw new Error(`Block ${e} not found`);
|
|
28
|
-
o(s, e, { ...r, dataProvider: t });
|
|
29
|
-
}, _ = (e, t) => {
|
|
30
|
-
const r = i(e);
|
|
31
|
-
if (!r)
|
|
32
|
-
throw new Error(`Block ${e} not found`);
|
|
33
|
-
o(s, e, { ...r, component: t });
|
|
34
|
-
}, v = (e, t) => ({
|
|
35
|
-
type: "null",
|
|
36
|
-
block: e,
|
|
37
|
-
prop: t,
|
|
38
|
-
default: null,
|
|
39
|
-
runtime: !0,
|
|
40
|
-
ui: { "ui:widget": "hidden" }
|
|
41
|
-
});
|
|
42
|
-
export {
|
|
43
|
-
w as a,
|
|
44
|
-
d as b,
|
|
45
|
-
v as c,
|
|
46
|
-
p as d,
|
|
47
|
-
i as e,
|
|
48
|
-
I as f,
|
|
49
|
-
$ as g,
|
|
50
|
-
_ as h,
|
|
51
|
-
D as i,
|
|
52
|
-
P as j,
|
|
53
|
-
E as r,
|
|
54
|
-
R as s,
|
|
55
|
-
S as u
|
|
56
|
-
};
|
package/dist/core-Y0lXLwkq.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("lodash-es"),g=require("react"),o={},B=()=>o,k=e=>g.useMemo(()=>r.get(o,e,null),[e]),l=e=>r.get(o,e,null),u=e=>{const t=r.get(o,`${e}.schema.properties`,{}),s={};return r.each(t,(c,n)=>{r.has(c,"block")||r.set(s,n,c.default)}),s},h=e=>r.get(o,`${e}.i18nProps`,[]),d=e=>r.get(o,`${e}.aiProps`,[]),f=e=>{const t=l(e);if(!t)return null;const s=r.cloneDeep(t.schema),c=r.get(s,"properties",{}),n=r.omitBy(c,i=>(i==null?void 0:i.styles)===!0);r.set(s,"properties",n);const a=r.get(o,`${e}.uiSchema`,{});return{schema:s,uiSchema:a}},C=e=>e.map(t=>r.has(o,t._type)?{...u(t._type),...t}:t),P=(e,t)=>{const s=r.get(o,t.type);s?r.set(o,t.type,{...s,component:e,...t}):r.set(o,t.type,{component:e,...t})},m=(e,t)=>{P(e,{...t,category:t.category||"core"})},y=(e,t)=>{const s=r.get(o,t.type);s?r.set(o,t.type,{...s,component:e,...t}):r.set(o,t.type,{component:e,...t})},S=(e,t)=>{const s=l(e);if(!s)throw new Error(`Block ${e} not found`);r.set(o,e,{...s,dataProvider:t})},R=(e,t)=>{const s=l(e);if(!s)throw new Error(`Block ${e} not found`);r.set(o,e,{...s,component:t})},p=(e,t)=>({type:"null",block:e,prop:t,default:null,runtime:!0,ui:{"ui:widget":"hidden"}});exports.closestBlockProp=p;exports.getAIBlockProps=d;exports.getBlockFormSchemas=f;exports.getDefaultBlockProps=u;exports.getI18nBlockProps=h;exports.getRegisteredChaiBlock=l;exports.registerChaiBlock=m;exports.registerChaiServerBlock=y;exports.setChaiBlockComponent=R;exports.setChaiServerBlockDataProvider=S;exports.syncBlocksWithDefaults=C;exports.useRegisteredChaiBlock=k;exports.useRegisteredChaiBlocks=B;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("./register-chai-top-bar-BqwKw4uy.cjs"),f=require("./index-xYnNKovy.cjs"),T=require("culori"),V=require("./fonts-B-Xt29pe.cjs"),N=require("react"),R=require("react-i18next");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const b=j(T),C=j(N),d=e=>e?e%1===0?e:e.toFixed(4):"0",E=e=>`hsl(${d(e.h)} ${d(e.s*100)}% ${d(e.l*100)}%)`,I=(e,o="hsl",t="4")=>{try{const r=b.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=b.converter("hsl")(r);return t==="4"?E(s):`${d(s.h)} ${d(s.s*100)}% ${d(s.l*100)}%`}case"rgb":return b.formatRgb(r);case"oklch":{const s=b.converter("oklch")(r);return`oklch(${d(s.l)} ${d(s.c)} ${d(s.h)})`}case"hex":return b.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},x=e=>I(e,"hex"),q=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=w(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),$();const r=v(e,":root"),s=v(e,".dark"),c=u(r,"--font-sans")||u(r,"--font-family")||u(r,"--font-heading")||u(r,"--font-body"),a=D(c);o.fontFamily={heading:a,body:a};const h=u(r,"--radius")||u(r,"--border-radius")||"0.5rem";o.borderRadius=P(h),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=u(r,`--${i}`),g=u(s,`--${i}`);if(p||g){const l=p?k(p):"#000000",S=g?k(g):l;o.colors[i]=[l,S]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),$()}return o},v=(e,o)=>{var r,s;const t=new RegExp(`${F(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},u=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${F(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},k=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return x(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return x(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[,r,s,c]=t,a=`hsl(${r} ${s}% ${c}%)`;return x(a)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const c=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return x(c)||"#000000"}}return x(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=V.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(c=>c.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},$=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),F=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,w=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
|
|
2
|
-
--background: 0 0% 100%;
|
|
3
|
-
--foreground: oklch(0.52 0.13 144.17);
|
|
4
|
-
--primary: #3e2723;
|
|
5
|
-
--primary-foreground: #ffffff;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.dark {
|
|
9
|
-
--background: 222.2 84% 4.9%;
|
|
10
|
-
--foreground: hsl(37.50 36.36% 95.69%);
|
|
11
|
-
--primary: rgb(46, 125, 50);
|
|
12
|
-
--primary-foreground: #ffffff;
|
|
13
|
-
}`,_=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=C.useState(""),[c,a]=C.useState(null),[h,m]=C.useState(!1),{t:i}=R.useTranslation(),p=async()=>{m(!0),a(null);try{const l=w(r);if(!l.isValid){a(l.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),m(!1);return}const S=q(r);if(!B(S)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),m(!1);return}t(S),s(""),a(null),o(!1)}catch(l){console.error("Error importing CSS:",l),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{m(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(f.Dialog,{open:e,onOpenChange:o,children:n.jsxs(f.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(f.DialogHeader,{children:[n.jsx(f.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(f.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(y.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(f.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(f.Textarea,{id:"css-input",placeholder:M,value:r,onChange:l=>s(l.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:h})]}),c&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:c})})]}),n.jsxs(f.DialogFooter,{className:"gap-2",children:[n.jsx(y.Button,{variant:"outline",onClick:g,disabled:h,children:i("Cancel")}),n.jsx(y.Button,{onClick:p,disabled:!r.trim()||h,children:i(h?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=_;
|
package/dist/index-B-rSiAp_.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("lodash-es"),s="#styles:",l=e=>{const n=["_type","_id","_parent","_bindings","_name"],o=["$loading","blockProps","inBuilder","lang","draft","pageProps","pageData","children"],r=t.keys(e.properties);if(t.intersection(r,n).length>0)throw new Error(`Reserved props are not allowed: ${t.intersection(r,n).join(", ")}`);if(t.intersection(r,o).length>0)throw new Error(`Runtime props are not allowed in schema: ${t.intersection(r,o).join(", ")}`);const i=t.get(e,"properties",{}),u={};return t.each(i,(p,a)=>{t.isEmpty(p.ui)||(u[a]={...p.ui},delete i[a].ui)}),{schema:t.isEmpty(i)?{}:{...t.omit(e,["ui"])},uiSchema:{...t.get(e,"ui",{}),...u}}},d=(e="")=>({type:"string",styles:!0,default:`${s},${e}`,ui:{"ui:widget":"hidden"}}),c=(e="")=>({type:"string",styles:!0,default:`${s},${e}`,ui:{"ui:widget":"hidden"}}),h=e=>(console.warn("runtimeProp is deprecated, use builderProp instead"),{runtime:!0,...e}),g=e=>({builderProp:!0,...e}),y=e=>`${s},${e}`;exports.StylesProp=d;exports.builderProp=g;exports.defaultChaiStyles=y;exports.registerChaiBlockSchema=l;exports.runtimeProp=h;exports.stylesProp=c;
|
package/dist/index-BwH1mRm_.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";var or=Object.create;var bs=Object.defineProperty;var lr=Object.getOwnPropertyDescriptor;var cr=Object.getOwnPropertyNames;var ur=Object.getPrototypeOf,dr=Object.prototype.hasOwnProperty;var Cs=e=>{throw TypeError(e)};var fr=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of cr(t))!dr.call(e,r)&&r!==s&&bs(e,r,{get:()=>t[r],enumerable:!(n=lr(t,r))||n.enumerable});return e};var hr=(e,t,s)=>(s=e!=null?or(ur(e)):{},fr(t||!e||!e.__esModule?bs(s,"default",{value:e,enumerable:!0}):s,e));var Is=(e,t,s)=>t.has(e)||Cs("Cannot "+s);var P=(e,t,s)=>(Is(e,t,"read from private field"),s?s.call(e):t.get(e)),R=(e,t,s)=>t.has(e)?Cs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),O=(e,t,s,n)=>(Is(e,t,"write to private field"),n?n.call(e,s):t.set(e,s),s);const i=require("react/jsx-runtime"),m=require("./index-xYnNKovy.cjs"),L=require("./register-chai-top-bar-BqwKw4uy.cjs"),H=require("jotai"),p=require("lodash-es"),h=require("react"),S=require("@tanstack/react-query"),x=require("lucide-react"),he=require("react-i18next"),jt=require("./common-functions-B3a4xKt_.cjs"),F=require("sonner"),Vs=require("./core-Y0lXLwkq.cjs"),gr=require("./apply-binding-IsUf6UWJ.cjs"),mr=require("./web-blocks.cjs"),Er=require("react-error-boundary");function pr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const Q=pr(h),st=H.atom(null),y={GET_GLOBAL_JSONLD_ITEMS:"GET_GLOBAL_JSONLD_ITEMS",GENERATE_SEO_FIELD:"GENERATE_SEO_FIELD",UPDATE_PAGE_METADATA:"UPDATE_PAGE_METADATA",GET_BLOCK_ASYNC_PROPS:"GET_BLOCK_ASYNC_PROPS",ASK_AI:"ASK_AI",GET_DRAFT_PAGE:"GET_DRAFT_PAGE",CREATE_PAGE:"CREATE_PAGE",UPDATE_PAGE:"UPDATE_PAGE",DELETE_PAGE:"DELETE_PAGE",DUPLICATE_PAGE:"DUPLICATE_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_DRAFT_SETTINGS:"GET_WEBSITE_DRAFT_SETTINGS",AI_CONTEXT:"AI_CONTEXT",GET_WEBSITE_DATA:"GET_WEBSITE_DATA",GET_CHAI_USER:"GET_CHAI_USER",GET_SEO_FIELDS:"GET_SEO_FIELDS",GET_BUILDER_PAGE_DATA:"GET_BUILDER_PAGE_DATA",GET_PAGE_REVISIONS:"GET_PAGE_REVISIONS",DELETE_PAGE_REVISION:"DELETE_PAGE_REVISION",RESTORE_PAGE_REVISION:"RESTORE_PAGE_REVISION",GET_REVISION_DATA:"GET_REVISION_DATA",GET_PAGE_DATA:"GET_PAGE_DATA",GET_COMPARE_DATA:"GET_COMPARE_DATA",GET_ROLE_AND_PERMISSIONS:"GET_ROLE_AND_PERMISSIONS",UPSERT_LIBRARY_ITEM:"UPSERT_LIBRARY_ITEM",GET_LIBRARIES:"GET_LIBRARIES",GET_LIBRARY_ITEM:"GET_LIBRARY_ITEM",GET_LIBRARY_ITEMS:"GET_LIBRARY_ITEMS",DELETE_LIBRARY_ITEM:"DELETE_LIBRARY_ITEM",MARK_AS_TEMPLATE:"MARK_AS_TEMPLATE",UNMARK_AS_TEMPLATE:"UNMARK_AS_TEMPLATE",GET_TEMPLATES_BY_TYPE:"GET_TEMPLATES_BY_TYPE",GET_DYNAMIC_PAGES:"GET_DYNAMIC_PAGES",GET_APP_SHARED_JSONLD:"GET_APP_SHARED_JSONLD",UPDATE_APP_SHARED_JSONLD:"UPDATE_APP_SHARED_JSONLD",ADD_GLOBAL_SCHEMA:"ADD_GLOBAL_SCHEMA",UPDATE_GLOBAL_SCHEMA:"UPDATE_GLOBAL_SCHEMA",DELETE_GLOBAL_SCHEMA:"DELETE_GLOBAL_SCHEMA",TOGGLE_PAGE_GLOBAL_SCHEMA:"TOGGLE_PAGE_GLOBAL_SCHEMA",APPLY_SCHEMA_TO_ALL_PAGES:"APPLY_SCHEMA_TO_ALL_PAGES",REMOVE_SCHEMA_FROM_ALL_PAGES:"REMOVE_SCHEMA_FROM_ALL_PAGES",UPLOAD_ASSET:"UPLOAD_ASSET",DELETE_ASSET:"DELETE_ASSET",UPDATE_ASSET:"UPDATE_ASSET",GET_ASSETS:"GET_ASSETS",GET_ASSET:"GET_ASSET"},yr=H.atom({}),Ft=()=>H.useAtom(yr),ie=(e,t)=>{const[s]=Ft();return h.useMemo(()=>p.get(s,e,t),[s,e,t])},N=()=>ie("apiUrl","/chai/api"),Hs=()=>ie("websocket",null),Tr=async(e,t,s={})=>await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...s},body:JSON.stringify(t)}),Ar=()=>{const e=j(),t=N();return h.useCallback(async({body:s,headers:n={},url:r=t,streamResponse:a=!1})=>e(r,s,n,a),[e])},j=()=>{const e=ie("onLogout",p.noop),t=ie("getAccessToken"),s=N();return h.useCallback(async(n=s,r,a={},o=!1)=>{const l=await t();try{const c=p.get(r,"action","").toLowerCase(),f=await Tr(n+(c?`?action=${c}`:""),r,{...a,Authorization:`Bearer ${l}`});if(o)return f;if(f.status===401)return console.log("401 Response",f),await e(),null;if(!f.ok){const d=await f.json();throw console.error(`API Error (${f.status}):`,d),{status:f.status,statusText:f.statusText,...d,message:d.error||d.message||`Server error: ${f.status}`}}return await f.json()}catch(c){throw console.error("API request failed:",r,c),c}},[e,t])};function le(){const[e,t]=h.useState(new URLSearchParams(window.location.search));return h.useEffect(()=>{const s=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[]),[e,t]}const Ae=e=>{const t=N(),[s]=le(),n=e??s.get("page"),r=j();return S.useQuery({queryKey:[y.GET_LANGUAGE_PAGES,n],staleTime:1/0,gcTime:0,placeholderData:[],queryFn:async()=>{if(!n)return null;const a=await r(t,{action:y.GET_LANGUAGE_PAGES,data:{id:n}});return p.reverse(p.sortBy(a,"primaryPage"))},enabled:!!n})},Sr=H.atom(null),Qs=()=>H.useAtom(Sr),ls=()=>{const[e]=Qs();return(e==null?void 0:e.slug)||""};function Pr(e,t){const[s,n]=h.useState(e);return h.useEffect(()=>{const r=setTimeout(()=>n(e),t);return()=>clearTimeout(r)},[e,t]),s}const xr=({query:e,uuid:t})=>{const{selectedLang:s,fallbackLang:n}=m.useLanguages(),{data:r}=te(),a=r==null?void 0:r.pageType,o=N(),l=j(),{data:c,isFetching:f}=S.useQuery({queryKey:[y.GET_DYNAMIC_PAGES,e,a,t],staleTime:3600*1e3,placeholderData:[],queryFn:async()=>await l(o,{action:y.GET_DYNAMIC_PAGES,data:{query:e,pageType:a,uuid:t}})||[],enabled:!!a}),d=h.useMemo(()=>s===""?c.filter(u=>u.lang===""||u.lang===n):c.filter(u=>u.lang===s),[s,n,c]);return{allLangPages:c,data:d,isFetching:f}},zs=()=>{const{selectedLang:e,fallbackLang:t}=m.useLanguages(),[s,n]=Qs(),[r,a]=h.useState(""),o=Pr(r,500),{allLangPages:l,data:c,isFetching:f}=xr({query:o}),d=h.useCallback(g=>n(g),[n]),u=h.useCallback(g=>a(g),[a]),E=h.useCallback(()=>{if(!s)return;const g=!(s!=null&&s.primaryPage),T=e.length===0,_=g?s==null?void 0:s.id:s==null?void 0:s.primaryPage,M=l.filter(A=>(A==null?void 0:A.primaryPage)===_||A.id===_).find(A=>T?A.lang===e||A.lang===t:A.lang===e);n(M||s)},[s,e,l,n,t]);return{isFetching:f,dynamicPage:s,searchQuery:r,selectedLang:e,dynamicPages:c,allLangPages:l,updateDynamicPage:d,updateSearchQuery:u,onChangeLanguage:E}},_r=H.atom({lastSaved:void 0}),cs=()=>H.useAtom(_r),te=()=>{const[e]=le(),t=e.get("page"),{data:s,isFetching:n}=Ae();return{data:h.useMemo(()=>({...p.find(s,{id:t})||{}}),[s,t]),isFetching:n}},ge=()=>{const[e]=le(),t=e.get("lang")??"",{data:s,isFetching:n}=Ae();return{data:h.useMemo(()=>p.find(s,{lang:t})||{},[s,t]),isFetching:n}},wr=H.atom({}),vr=()=>H.useAtom(wr),br=()=>{const{data:e}=ge(),t=ls(),s=ie("getLiveUrl",p.noop),n=e==null?void 0:e.slug,r=s(n||"/");return t?r+t:r},se={...m.PERMISSIONS,ADD_PAGE:"add_page",EDIT_PAGE:"edit_page",DELETE_PAGE:"delete_page",CHANGE_PAGE_TYPE:"change_page_type",PUBLISH_PAGE:"publish_page",UNPUBLISH_PAGE:"unpublish_page",MARK_AS_TEMPLATE:"mark_as_template",EDIT_SEO:"edit_seo",RESTORE_REVISION:"restore_revision",DELETE_REVISION:"delete_revision",DELETE_LIBRARY_BLOCK:"delete_library_block"},me=()=>{const e=N(),t=j();return S.useQuery({queryKey:[y.GET_PAGE_TYPES],staleTime:1/0,placeholderData:[],queryFn:async()=>t(e,{action:y.GET_PAGE_TYPES})})},$s=e=>{const{data:t}=me();return h.useMemo(()=>t==null?void 0:t.find(s=>s.key===e),[t,e])},Cr=()=>{const e=N(),t=j();return S.useMutation({mutationFn:async({pageType:s,query:n})=>{try{return t(e,{action:y.SEARCH_PAGES,data:{pageType:s,query:Array.isArray(n)&&n.length>0?n[0]:n}})||[]}catch(r){return console.error(r),[]}}})},Ws=({page:e,setDuplicatePage:t,setAddEditPage:s,setUnpublishPage:n,setDeletePage:r,setMarkAsTemplate:a,setUnmarkAsTemplate:o,children:l,isLanguagePage:c})=>{const{t:f}=he.useTranslation(),{hasPermission:d}=m.usePermissions(),{data:u}=me(),E=h.useMemo(()=>p.find(u,{key:e.pageType}),[u,e.pageType]),g=h.useMemo(()=>!!e.isTemplate,[e.isTemplate]),T=h.useMemo(()=>!!(E!=null&&E.hasSlug),[E==null?void 0:E.hasSlug]);return!d(se.EDIT_PAGE)&&!d(se.DELETE_PAGE)&&!d(se.UNPUBLISH_PAGE)||!e?null:i.jsxs(m.DropdownMenu,{children:[i.jsx(m.DropdownMenuTrigger,{asChild:!0,onClick:w=>w.stopPropagation(),children:l}),i.jsxs(m.DropdownMenuContent,{align:"center",className:"text-sm",children:[d(se.ADD_PAGE)&&!c&&i.jsxs(m.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:w=>{w.stopPropagation(),t(e)},children:[i.jsx(x.CopyPlusIcon,{className:"size-3"}),"Duplicate page"]}),d(se.EDIT_PAGE)&&i.jsxs(m.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:w=>{w.stopPropagation(),s({...e,global:!(E!=null&&E.hasSlug)})},children:[i.jsx(x.Pencil,{className:"size-3"}),"Edit"]}),(e==null?void 0:e.online)&&d(se.UNPUBLISH_PAGE)&&i.jsxs(m.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:w=>{w.stopPropagation(),n(e)},children:[i.jsx(x.Power,{className:"size-3"}),f("Unpublish")]}),d(se.DELETE_PAGE)&&i.jsxs(m.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:w=>{w.stopPropagation(),r(e)},children:[i.jsx(x.Trash,{className:"size-3"}),f("Delete")]}),d(se.MARK_AS_TEMPLATE)&&T&&!c&&i.jsx(i.Fragment,{children:g?i.jsxs(m.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:w=>{w.stopPropagation(),o(e)},children:[i.jsx(x.SquareLibrary,{className:"size-3"}),f("Unmark as template")]}):i.jsxs(m.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:w=>{w.stopPropagation(),a(e)},children:[i.jsx(x.SquareLibrary,{className:"size-3"}),f("Mark as template")]})})]})]})},Se=()=>{const e=N(),t=j();return S.useQuery({queryKey:[y.GET_WEBSITE_DRAFT_SETTINGS],staleTime:300*1e3,placeholderData:{languages:[],theme:{fontFamily:"",borderRadius:"",colors:{}},appKey:"",fallbackLang:"",designTokens:{}},queryFn:async()=>t(e,{action:y.GET_WEBSITE_DRAFT_SETTINGS,data:{draft:!0}})})},qt=()=>{const e=ie("currentUser"),t=ie("onLogout");return{isLoggedIn:!!e,user:e,logout:t}},J={LOCKED:"LOCKED",EDITING:"EDITING",CHECKING:"CHECKING",TAKE_OVER_REQUESTED:"TAKE_OVER_REQUESTED",ACTIVE_IN_ANOTHER_TAB:"ACTIVE_IN_ANOTHER_TAB",FORCE_TAKE_OVER:"FORCE_TAKE_OVER",CONNECTION_LOST:"CONNECTION_LOST"},X={FORCE_TAKE_OVER:"FORCE_TAKE_OVER",TAKE_OVER_REQUEST:"TAKE_OVER_REQUEST",TAKE_OVER_APPROVED:"TAKE_OVER_APPROVED",TAKE_OVER_REJECTED:"TAKE_OVER_REJECTED",FORCE_TAKE_OVER_REQUEST:"FORCE_TAKE_OVER_REQUEST",CONTINUE_EDITING_IN_THIS_CLIENT:"CONTINUE_EDITING_IN_THIS_CLIENT",CONTINUE_EDITING_IN_THIS_TAB_REQUEST:"CONTINUE_EDITING_IN_THIS_TAB_REQUEST"},Ir=["sync","join","leave"],Lr=[X.FORCE_TAKE_OVER,X.TAKE_OVER_REQUEST,X.TAKE_OVER_APPROVED,X.TAKE_OVER_REJECTED,X.FORCE_TAKE_OVER_REQUEST,X.CONTINUE_EDITING_IN_THIS_CLIENT,X.CONTINUE_EDITING_IN_THIS_TAB_REQUEST],Nr=H.atom({}),Ys=H.atom(null),jr=H.atom(J.CHECKING),Gr=H.atom({}),kr=e=>{const t={},s=p.groupBy(p.values(e).map(p.first).filter(Boolean),"pageId");return Object.entries(s).forEach(([n,r])=>t[n]=p.minBy(r,"onlineAt")),t},Or=e=>{const t=p.minBy(p.values(e).map(p.first).filter(Boolean),"onlineAt"),s=t==null?void 0:t.onlineAt;return s?s-100:+new Date-1e3*60*60*4},At=()=>{const{user:e}=qt();return e==null?void 0:e.id},Dr=()=>{const{data:e}=Se();return`WEBSITE:${e==null?void 0:e.appKey}`},St=()=>{const{data:e}=te();return e==null?void 0:e.id},we=crypto.randomUUID();let $t=null;const us=()=>{const[e,t]=H.useAtom(Nr);return{pageToUser:e,setPageToUser:t}},ne=()=>{const[e,t]=H.useAtom(jr),s=[J.LOCKED,J.ACTIVE_IN_ANOTHER_TAB].includes(e),n=[J.EDITING].includes(e);return{pageStatus:e,setPageStatus:t,isLocked:s,isEditing:n}},ds=()=>{const[e,t]=H.useAtom(Gr);return{pageLockMeta:e,setPageLockMeta:t}},Js=()=>{const e=St(),{pageToUser:t}=us();return h.useMemo(()=>t[e],[t,e])},fs=()=>{const e=Hs(),{setPageStatus:t}=ne(),[s]=H.useAtom(Ys);return h.useEffect(()=>{if(clearTimeout($t),!e)return $t=setTimeout(()=>{e||t(J.EDITING)},500),()=>clearTimeout($t)},[e,t]),s},Rr=()=>{const e=St(),t=At(),s=fs(),{setPageToUser:n}=us(),{setPageStatus:r,pageStatus:a}=ne(),o=h.useRef(e);return o.current=e,h.useCallback(l=>{const c=l||s;if(!c)return[];const f=c==null?void 0:c.presenceState(),d=kr(f);n(d);const u=d[o.current];if(!u)r(J.CHECKING);else if(!t)r(J.CHECKING);else if(u.userId===t&&u.clientId===we){if(a===J.TAKE_OVER_REQUESTED)return;r(J.EDITING)}else u.userId===t&&u.clientId!==we?r(J.ACTIVE_IN_ANOTHER_TAB):r(J.LOCKED)},[s,n,r,t,a])},Zs=()=>{const e=At(),t=St(),s=fs(),n=Js(),{setPageLockMeta:r}=ds(),a=h.useRef(t);return a.current=t,h.useCallback(async(o,l)=>{if(!s)return;const c=l||{};c.userId=e,c.pageId=a.current,c.senderClientId=we,c.receiverClientId=(l==null?void 0:l.requestingClientId)||(n==null?void 0:n.clientId),await s.send({event:o,payload:c,type:"broadcast"}),r({})},[s,e,n,r])},Mr=()=>{const e=At(),t=St(),s=fs(),{setPageStatus:n}=ne(),{setPageLockMeta:r}=ds(),a=Zs(),o=h.useRef(t),{savePageAsync:l}=m.useSavePage();return o.current=t,h.useCallback(c=>async({payload:f})=>{const d=f||{};if(!(!(d!=null&&d.pageId)||(d==null?void 0:d.pageId)!==o.current||(d==null?void 0:d.receiverClientId)!==we))switch(r({}),c){case X.FORCE_TAKE_OVER_REQUEST:case X.CONTINUE_EDITING_IN_THIS_TAB_REQUEST:{try{await l(!0)}catch(u){console.error("Failed to save page before releasing lock:",u)}await a(X.CONTINUE_EDITING_IN_THIS_CLIENT,{requestingClientId:d==null?void 0:d.senderClientId}),setTimeout(()=>r({type:c}),0);break}case X.TAKE_OVER_REQUEST:{r({requestingUserId:d==null?void 0:d.userId,requestingClientId:d==null?void 0:d.senderClientId}),n(J.TAKE_OVER_REQUESTED);break}case X.CONTINUE_EDITING_IN_THIS_CLIENT:{const u=Or(s==null?void 0:s.presenceState());n(J.CHECKING),await(s==null?void 0:s.track({onlineAt:u,pageId:o.current,userId:e,clientId:we}));break}case X.TAKE_OVER_REJECTED:{r({type:X.TAKE_OVER_REJECTED});break}}},[a,r,n,s,e,l])},Ur=()=>{const e=Hs(),t=At(),s=St(),n=Dr(),[r,a]=H.useAtom(Ys),o=Mr(),l=Rr(),c=h.useRef(o),f=h.useRef(l);h.useEffect(()=>{c.current=o,f.current=l},[o,l]),h.useEffect(()=>{if(!e||!t||!n||r&&r.topic===n)return;const d=e.channel(n,{config:{presence:{key:we}}});return Lr.forEach(u=>{d.on("broadcast",{event:u},E=>{c.current(u)(E)})}),Ir.forEach(u=>{d.on("presence",{event:u},()=>{f.current(d)})}),d.subscribe(async u=>{u==="SUBSCRIBED"?a(d):(u==="CHANNEL_ERROR"||u==="TIMED_OUT")&&console.log("Realtime connection failed",u)}),()=>{d.unsubscribe()}},[e,t,n,a]),h.useEffect(()=>(r&&s&&t&&r.track({pageId:s,userId:t,clientId:we,onlineAt:+new Date}),()=>{r&&s&&r.untrack()}),[r,s,t])},Kt=()=>{const{data:e}=Se();return h.useMemo(()=>(e==null?void 0:e.fallbackLang)||"en",[e])},hs=()=>{const e=j(),t=N();return S.useQuery({queryKey:[y.GET_WEBSITE_PAGES],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:y.GET_WEBSITE_PAGES})||[],placeholderData:s=>s||[]})},Br=e=>{const t=j(),s=N(),n=Kt();return S.useQuery({queryKey:[y.GET_WEBSITE_PAGES,e,n],staleTime:1e3*60*5,enabled:!!e,queryFn:async()=>{if(n===e)return{};const r=await t(s,{action:y.GET_WEBSITE_PAGES,data:{lang:e}})||[];return p.keyBy(p.map(r,a=>({...a,lang:e})),"primaryPage")},placeholderData:r=>r||{}})};function gs(e,t,s=!1){const n=e.toString()?`?${e.toString()}`:"/";s?window.history.replaceState(null,"",n):window.history.pushState({},"",n),t(e),window.dispatchEvent(new PopStateEvent("popstate"))}const Fr=h.lazy(()=>Promise.resolve().then(()=>require("./page-manager-new-Bn2QKjbf.cjs"))),Xs=({children:e})=>{const{t}=he.useTranslation(),[s,n]=le(),r=s.get("page"),{data:a,isFetching:o}=te(),{data:l,isFetching:c}=hs(),[f,d]=h.useState(!1),[u,E]=h.useState(!0),{savePage:g}=m.useSavePage(),T=!!r&&!p.isEmpty(a),{isLocked:_}=ne(),w=h.useMemo(()=>{if(!l||c)return!1;const I=l.find(q=>q.slug==="/");return I==null?void 0:I.id},[l,c]);h.useEffect(()=>{if(c||!w||l.some(G=>G.id===r))return;const q=new URLSearchParams({page:w});gs(q,n),!c&&l&&E(!1)},[r,c,l,w,n]);const M=!u&&!r,A=!u&&!o&&p.isEmpty(a),C=f||M||A;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center gap-x-1",children:i.jsx("div",{className:"relative",children:i.jsxs(m.Tooltip,{children:[i.jsx(m.TooltipTrigger,{asChild:!0,onClick:()=>{_||g(),d(!0)},children:e||i.jsx(L.Button,{variant:"outline",className:"flex w-full items-center space-x-2 py-1",children:i.jsx(x.LogsIcon,{className:"h-4 w-4"})},"template-viewer")}),i.jsx(m.TooltipContent,{side:"right",children:i.jsx("p",{children:t("Open pages manager")})})]})})}),i.jsx(m.Sheet,{open:C,onOpenChange:I=>!I&&T&&d(!1),children:i.jsxs(m.SheetContent,{side:"left","aria-describedby":"pages-manager-description",className:`z-50 !min-w-[50vh] !max-w-[800px] border-border p-0 ${T?"":"sheet-hide-close-btn"}`,children:[i.jsxs(m.SheetHeader,{className:"mb-3 px-4 pt-4",children:[i.jsxs(m.SheetTitle,{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:i.jsx(x.Folder,{className:"h-4 w-4"})}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-sm font-semibold",children:t("Pages")}),i.jsx("span",{id:"pages-manager-description",className:"text-xs font-normal text-muted-foreground",children:t("Manage your site structure")})]})]}),i.jsx(m.SheetDescription,{className:"sr-only",children:t("Manage your site structure")})]}),i.jsx("div",{className:"h-[calc(100vh-80px)] overflow-y-auto",children:C&&i.jsx(h.Suspense,{children:i.jsx(Fr,{close:()=>d(!1)})})})]})})]})},qr=h.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-BS9vPnFG.cjs"))),Kr=h.lazy(()=>Promise.resolve().then(()=>require("./delete-page-B7J3t0FN.cjs"))),Vr=h.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-Dw3U4wTT.cjs"))),Hr=h.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-CE6tRoQy.cjs"))),Qr=h.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-BYL5naYx.cjs"))),zr=h.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-B06iZEIO.cjs"))),$r=()=>{const[e,t]=h.useState(null),[s,n]=h.useState(null),[r,a]=h.useState(null),[o,l]=h.useState(null),[c,f]=h.useState(null),[d,u]=h.useState(null),{data:E,isFetching:g}=ge(),{selectedLang:T,fallbackLang:_}=m.useLanguages(),{data:w}=Ae(),M=w==null?void 0:w.find(G=>G.lang===T),{isLocked:A}=ne(),C=!(E!=null&&E.slug),I=H.useSetAtom(st);if(!E)return null;const q=G=>{T.length>0&&T!==_?I({edit:!0,id:G==null?void 0:G.id,primaryPage:G==null?void 0:G.primaryPage}):u(G)};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between rounded px-[2px] transition-colors duration-200",children:[i.jsx(Xs,{children:i.jsx(L.Button,{className:"flex h-7 max-w-[200px] cursor-pointer items-center truncate rounded px-1 text-xs font-medium",variant:"ghost",children:g?i.jsx(x.Loader,{className:"h-4 w-4 animate-spin text-slate-400"}):i.jsxs("span",{className:"flex w-full cursor-pointer items-end overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-xs font-medium",children:[C?i.jsx(x.Hash,{className:"mr-1 h-4 w-4"}):i.jsx(x.File,{className:"mr-1 h-4 w-4"}),p.get(M||E,"name")??""]})})}),A?i.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 cursor-not-allowed rounded opacity-50 hover:bg-transparent",children:i.jsx(x.MoreHorizontal,{className:"h-4 w-4"})}):i.jsx(Ws,{page:E,setDuplicatePage:G=>f(G),setAddEditPage:G=>q(G),setUnpublishPage:G=>n(G),setDeletePage:G=>t(G),setMarkAsTemplate:G=>a(G),setUnmarkAsTemplate:G=>l(G),isLanguagePage:T.length>0&&T!==_,children:i.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded",children:i.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})})]}),d&&i.jsx(h.Suspense,{children:i.jsx(qr,{closePanel:()=>u(null),editPage:()=>{},addEditPage:d,setAddEditPage:u})}),e&&i.jsx(h.Suspense,{children:i.jsx(Kr,{page:e,onClose:()=>t(null)})}),s&&i.jsx(h.Suspense,{children:i.jsx(zr,{page:s,onClose:()=>n(null)})}),r&&i.jsx(h.Suspense,{children:i.jsx(Hr,{page:r,onClose:()=>a(null)})}),o&&i.jsx(h.Suspense,{children:i.jsx(Qr,{page:o,onClose:()=>l(null)})}),c&&i.jsx(h.Suspense,{children:i.jsx(Vr,{page:c,onClose:()=>f(null),closePanel:()=>u(null)})})]})},ms=({children:e,className:t=""})=>i.jsx("div",{className:jt.cn("fixed bottom-0 left-0 right-0 top-[50px] z-[20] flex w-screen flex-col items-center justify-center bg-black/40 transition-all",t),children:e}),Wr=({hasDynamicPage:e})=>i.jsx(ms,{children:i.jsxs("div",{className:"flex min-w-[300px] max-w-[400px] flex-col items-center justify-center rounded-lg border bg-white p-4 shadow-lg",children:[i.jsx("h1",{className:"text-lg font-medium",children:e?"Select a page":"No pages found"}),i.jsx("p",{className:"pt-2 text-center text-sm font-light text-gray-600",children:e?"Please select a page from the list in the top header. This will enable you to edit the page.":"Please add a new page"})]})}),Ye={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"},Yr=h.lazy(()=>Promise.resolve().then(()=>require("./add-new-language-page-9AMizlES.cjs"))),Jr=()=>{const e=ie("topLeftCorner",null);return e?i.jsx("div",{className:"max-h-9 w-full overflow-hidden pr-2",children:h.createElement(e,{})}):null},en=({showAdd:e=!0,variant:t="ghost",goToDefaultLang:s=!1})=>{const{fallbackLang:n,languages:r,selectedLang:a,setSelectedLang:o}=m.useLanguages(),l=p.isEmpty(a)?n:a,[,c]=le(),{isLocked:f}=ne(),{t:d}=he.useTranslation();h.useEffect(()=>{const A=new URLSearchParams(window.location.search),C=A.get("lang");C&&(r.includes(C)?o(C):(A.delete("lang"),c(A),o("")))},[r,c,o]);const u=H.useSetAtom(st),{data:E}=te(),{data:g}=Se(),{data:T}=Ae(),_=h.useMemo(()=>{const A=p.compact(p.map(p.get(g,"languages"),C=>{const I=p.find(T,{lang:C});return{key:C,value:p.get(Ye,C,C),isLangPageAdded:!!I}})).filter(Boolean);return[{key:n,value:p.get(Ye,n),isLangPageAdded:!0},...A]},[n,T,g]),w=A=>{if(document.querySelector('[data-panel-id="seo"]')){const I=new CustomEvent("seo-language-switch-check",{detail:{fromLang:l,toLang:A,switchHandler:()=>M(A)}});window.dispatchEvent(I);return}M(A)},M=A=>{o(A);const C=new URLSearchParams(window.location.search);A===n?C.delete("lang"):C.set("lang",A),gs(C,c)};return p.isEmpty(r)?null:f?i.jsxs(L.Button,{variant:"ghost",size:"sm",className:"ml-px h-max cursor-not-allowed gap-2 py-1.5 opacity-50",children:[i.jsx(x.Languages,{className:"h-4 w-4"}),p.get(Ye,l,l),i.jsx(x.ChevronDown,{className:"h-4 w-4"})]}):s?i.jsx(L.Button,{onClick:()=>M(n),variant:"link",size:"sm",children:d("Switch to default language")}):i.jsx(i.Fragment,{children:i.jsxs(m.DropdownMenu,{children:[i.jsx(m.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:i.jsxs(L.Button,{disabled:!!f,variant:t,size:"sm",className:"ml-px h-max gap-2 py-1.5",children:[i.jsx(x.Languages,{className:"h-4 w-4"}),p.get(Ye,l,l),i.jsx(x.ChevronDown,{className:"h-4 w-4"})]})}),i.jsxs(m.DropdownMenuContent,{className:"space-y-1 border-border",children:[p.map(_.filter(A=>A.isLangPageAdded),A=>i.jsxs(m.DropdownMenuItem,{className:jt.cn("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",A.key===l&&"!bg-gray-200 text-gray-700"),onClick:()=>w(A.key),children:[i.jsx("div",{className:"text-slate-600",children:A.value}),A.key===n&&i.jsxs("small",{className:"flex items-center gap-x-1 text-[9px] leading-none text-orange-500",children:[i.jsx(x.Star,{fill:"orange",className:"h-2 w-2"}),"Primary"]})]},A.value)),e&&!p.isEmpty(_.filter(A=>!A.isLangPageAdded))&&i.jsxs(i.Fragment,{children:[i.jsx(m.Separator,{}),i.jsxs(L.Button,{size:"sm",variant:"ghost",onClick:()=>{E&&u({edit:!1,primaryPage:E.id})},className:"text-xs font-normal duration-200 hover:bg-slate-300 hover:text-slate-800",children:[i.jsx(x.Plus,{className:"mr-1 h-3 w-3"})," Add Language"]})]})]})]})})};function Zr(){const e=H.useAtomValue(st),t=H.useSetAtom(st);return i.jsxs("div",{className:"relative z-10 flex items-center justify-end gap-1",children:[i.jsx(Jr,{}),i.jsx(Xs,{}),e&&i.jsx(h.Suspense,{children:i.jsx(Yr,{isOpen:!0,id:e==null?void 0:e.id,edit:!!(e!=null&&e.id),primaryPage:e==null?void 0:e.primaryPage,preselectedLang:e==null?void 0:e.preselectedLang,onClose:()=>t(null)})})]})}function Xr(){return i.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((e,t)=>i.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx(m.Skeleton,{className:"h-4 w-3/4"}),i.jsx(m.Skeleton,{className:"h-3 w-1/2"}),i.jsx(m.Skeleton,{className:"mt-1 h-5 w-20"})]}),i.jsx(m.Skeleton,{className:"h-8 w-8 rounded-full"})]},t))})}const ea=Q.lazy(()=>Promise.resolve().then(()=>require("./page-revisions-content-CcLFI4YK.cjs")));function ta(){const[e,t]=Q.useState(!1);return i.jsx(m.TooltipProvider,{children:i.jsxs(m.Tooltip,{delayDuration:0,children:[i.jsxs(m.Sheet,{open:e,onOpenChange:t,children:[i.jsx(m.SheetTrigger,{asChild:!0,children:i.jsx(m.TooltipTrigger,{asChild:!0,children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsxs(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[i.jsx(x.History,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"View revision history"})]}),i.jsx("div",{className:"h-4 w-px bg-gray-200 dark:bg-gray-700"})]})})}),i.jsx(m.SheetContent,{className:"flex h-[100vh] flex-col",children:e&&i.jsx(h.Suspense,{fallback:i.jsx(Xr,{}),children:i.jsx(ea,{isOpen:e})})})]}),i.jsx(m.TooltipContent,{side:"bottom",children:i.jsx("p",{children:"Revision history"})})]})})}const Ct=({permission:e,permissions:t,children:s,fallback:n=null})=>{const{hasPermission:r}=m.usePermissions();return e&&!r(e)||t&&!t.some(a=>r(a))?n:s},sa={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},na=()=>{const e=N(),t=S.useQueryClient(),s=j(),{data:n}=me();return S.useMutation({mutationFn:async r=>await s(e,{action:y.CREATE_PAGE,data:r}),onSuccess:(r,a)=>{var l;a&&(a!=null&&a.primaryPage)?(t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}),t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES,a==null?void 0:a.lang]})):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]});const o=a.template?`Page created from "${a.template.name}" template`:a.hasSlug===!1?"New "+((l=p.find(n,{key:a.pageType}))==null?void 0:l.name)+" added successfully":"New page added successfully";F.toast.success(o)},onError:(r,a)=>{const o=p.find(n,{key:a.pageType});F.toast.error(`Failed to add new ${o!=null&&o.hasSlug?"page":o.name}.`,{description:p.get(sa,r.message,r.message)})}})},ra=()=>{const e=N(),t=S.useQueryClient(),s=j(),{data:n}=ge(),{data:r}=me();return S.useMutation({mutationFn:async a=>await s(e,{action:y.UPDATE_PAGE,data:a}),onSuccess:(a,o)=>{(n==null?void 0:n.id)===(o==null?void 0:o.id)&&t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES]}),o&&(o!=null&&o.primaryPage||o!=null&&o.seo)?(t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,o==null?void 0:o.primaryPage]}),t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})},onError:(a,o)=>{const l=p.find(r,{key:o.pageType});F.toast.error(`Failed to update ${l!=null&&l.hasSlug?"page":l.name}.`,{description:a.message})}})},aa=()=>{const e=N(),t=S.useQueryClient(),s=j(),{data:n}=me();return S.useMutation({mutationFn:async r=>s(e,{action:y.DELETE_PAGE,data:{id:r==null?void 0:r.id}}),onSuccess:(r,a)=>{if(r.code==="PAGE_LOCKED"){F.toast.error("Delete not allowed",{description:"Page is currently being edited by another user."});return}a&&(a!=null&&a.primaryPage)?(t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}),t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})},onError:(r,a)=>{const o=p.find(n,{key:a.pageType});F.toast.error(`Failed to delete ${o!=null&&o.hasSlug?"page":o.name}.`,{description:r.message})}})},ia=()=>{const e=N(),t=S.useQueryClient(),s=j(),{data:n}=me();return S.useMutation({mutationFn:async r=>s(e,{action:y.TAKE_OFFLINE,data:{id:r==null?void 0:r.id}}),onSuccess:(r,a)=>{a&&(a!=null&&a.primaryPage)?t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]});const o=p.find(n,{key:a.pageType});F.toast.success(o!=null&&o.hasSlug?"Page unpublished successfully.":"New "+o.name+" added successfully.")},onError:(r,a)=>{const o=p.find(n,{key:a.pageType});F.toast.error(`Failed to take offline ${o!=null&&o.hasSlug?"page":o.name}.`,{description:r.message})}})},Es=()=>{const e=N(),t=j(),s=S.useQueryClient(),{data:n}=te(),{savePageAsync:r}=m.useSavePage();return S.useMutation({mutationFn:async({ids:a})=>(await r(),t(e,{action:y.PUBLISH_CHANGES,data:{ids:a}})),onSuccess:()=>{s.invalidateQueries({queryKey:[y.GET_CHANGES]}),s.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),s.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,n==null?void 0:n.id]})},onError:a=>{console.log("##",a),F.toast.error("Failed to publish pages.")}})},oa=()=>{const e=N(),t=j(),s=S.useQueryClient();return S.useMutation({mutationFn:async n=>{var r;return t(e,{action:y.MARK_AS_TEMPLATE,data:{id:(r=n.page)==null?void 0:r.id,name:n.name,description:n.description,pageType:n.pageType,previewImage:n.previewImage}})},onSuccess:()=>{s.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),F.toast.success("Page marked as template successfully.")},onError:()=>{F.toast.error("Failed to mark page as template.")}})},la=()=>{const e=N(),t=j(),s=S.useQueryClient();return S.useMutation({mutationFn:async n=>t(e,{action:y.UNMARK_AS_TEMPLATE,data:{id:n==null?void 0:n.id}}),onSuccess:()=>{s.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),F.toast.success("Page unmarked as template successfully.")},onError:()=>{F.toast.error("Failed to unmark page as template.")}})},ca=()=>{const e=N(),t=j(),s=S.useQueryClient();return S.useMutation({mutationFn:async({id:n,slug:r})=>t(e,{action:y.CHANGE_SLUG,data:{id:n,slug:r}}),onSuccess:(n,{primaryPage:r})=>{F.toast.success("Slug changed successfully."),r?s.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,r]}):s.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})},onError:()=>{F.toast.error("Failed to change slug")}})},ua=h.lazy(()=>Promise.resolve().then(()=>require("./publish-pages-content-BzJDObqr.cjs")));function da({showModal:e=!1,onClose:t=()=>console.log("Cancelled")}){const{mutate:s,isPending:n}=Es();return i.jsx(m.Dialog,{open:e,onOpenChange:n?()=>{}:t,children:e&&i.jsx(h.Suspense,{fallback:i.jsx("div",{className:"h-96 w-96 animate-pulse bg-gray-100"}),children:i.jsx(ua,{onClose:t,isPending:n,publishPage:s})})})}const tn=e=>{const{fallbackLang:t}=m.useLanguages(),{data:s}=Se(),{data:n,isFetching:r}=Ae(),a=h.useMemo(()=>{const o={[t]:!0};return p.each(p.get(s,"languages"),l=>{const c=p.find(n,{lang:l});o[l]=!!c}),o},[t,n,s]);return r||p.isEmpty(e)||e&&a[e]},fa={particleCount:350,spread:120,origin:{y:.6},angle:90},ha={TOP_RIGHT:{angle:225,origin:{x:.9,y:0}},BOTTOM_RIGHT:{angle:100,origin:{x:.9,y:.9}}},ga=async()=>{const{default:e}=await import("canvas-confetti");return e},It=e=>{let t=ha[e];t||(t={});const s={...fa,...t};ga().then(n=>n(s))};function Vt({children:e,content:t,side:s="bottom",delayDuration:n=700,showTooltip:r=!0}){return r?i.jsx(m.TooltipProvider,{children:i.jsxs(m.Tooltip,{delayDuration:n,children:[i.jsx(m.TooltipTrigger,{asChild:!0,children:e}),i.jsx(m.TooltipContent,{side:s,sideOffset:10,children:i.jsx("p",{children:t})})]})}):e}const ma=h.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-B06iZEIO.cjs"))),Ea=h.lazy(()=>Promise.resolve().then(()=>require("./translation-warning-modal-DEt_ExQp.cjs"))),pa=()=>{const{t:e}=he.useTranslation(),{selectedLang:t,fallbackLang:s}=m.useLanguages(),n=ie("getPreviewUrl",async E=>E),[r,a]=h.useState(""),{data:o}=te(),{data:l}=Ae(),{data:c}=me(),f=h.useMemo(()=>{var E;return(E=l==null?void 0:l.find(g=>(g==null?void 0:g.lang)===t))==null?void 0:E.slug},[t,l]),d=h.useCallback(E=>{var g;return(g=p.find(c,{key:E}))==null?void 0:g.hasSlug},[c]),u=t===s?"":t;return h.useEffect(()=>{(async()=>{if(typeof n=="function"){const E=!d(o==null?void 0:o.pageType),g=await n(E?`${u!==""?u+"/":""}${o==null?void 0:o.id}`:f||"");a(g)}else a("")})()},[n,f,o==null?void 0:o.pageType,d,o==null?void 0:o.id,u]),i.jsx(i.Fragment,{children:i.jsx(Vt,{content:e("Open preview in new tab"),delayDuration:0,children:i.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:i.jsx(L.Button,{variant:"ghost",size:"sm",className:"gap-2",children:i.jsx(x.Play,{className:"h-4 w-4"})})})})})},ya=()=>{const{t:e}=he.useTranslation(),[t,s]=m.useRightPanel();return i.jsxs(i.Fragment,{children:[i.jsx(Vt,{content:e("Theme"),delayDuration:0,children:i.jsx(L.Button,{variant:t==="theme"?"outline":"ghost",size:"icon",className:"gap-2",onClick:()=>s(t==="theme"?"block":"theme"),children:i.jsx(x.Palette,{className:"h-4 w-4"})})}),i.jsx("div",{className:"h-4 w-px bg-gray-200 dark:bg-gray-700"})]})},Ta=()=>{const{t:e}=he.useTranslation(),[t,s]=h.useState(!1),{isLocked:n}=ne(),{savePageAsync:r,saveState:a}=m.useSavePage();h.useEffect(()=>{const d=u=>{a==="UNSAVED"&&(u.preventDefault(),u.returnValue=!1)};return a==="UNSAVED"&&window.addEventListener("beforeunload",d),()=>{window.removeEventListener("beforeunload",d)}},[a]);const o=h.useCallback(async()=>{t||(s(!0),await r(),s(!1))},[r,t]),{buttonIcon:l,buttonClass:c,tooltipContent:f}=h.useMemo(()=>{switch(a){case"UNSAVED":return{tooltipContent:e("Save draft"),buttonIcon:i.jsx(x.Save,{className:"h-4 w-4"}),buttonClass:"gap-x-1"};case"SAVING":return{tooltipContent:e("Saving"),buttonIcon:i.jsx(x.Loader,{className:"h-4 w-4 animate-spin text-sky-700"}),buttonClass:"gap-x-1"};case"SAVED":return{tooltipContent:e("Saved"),buttonIcon:i.jsx(x.CheckCircle,{className:"h-4 w-4"}),buttonClass:"text-green-500 gap-x-1"}}},[a,e]);return n?null:i.jsxs(L.Button,{size:"sm",variant:"ghost",onClick:o,className:`${c} w-24 max-w-24`,children:[l," ",f]})},Aa=()=>{const{t:e}=he.useTranslation(),{selectedLang:t}=m.useLanguages(),{data:s}=ge(),{data:n}=Ae(),[r,a]=h.useState(!1),[o,l]=h.useState(!1),[c,f]=h.useState(null),{savePageAsync:d}=m.useSavePage(),[u,E]=h.useState(!1),{data:g}=te(),{mutate:T,isPending:_}=Es(),{needTranslations:w}=m.useSavePage(),M=w(),{buttonText:A,buttonClassName:C,isPublished:I}=h.useMemo(()=>{const b=g&&(g==null?void 0:g.online);return{buttonClassName:b?"hover:bg-green-600 bg-green-500":"",isPublished:b,buttonText:e(b?"Published":"Publish")}},[g,e]),q=async()=>{if(M){E(!0);return}G()},G=()=>{const b=[s==null?void 0:s.id,s==null?void 0:s.primaryPage];T({ids:p.compact(b)},{onSuccess:()=>It("TOP_RIGHT")})},ce=()=>{E(!1),G()},ue=async()=>{E(!1),await d()},V=h.useMemo(()=>p.map(n??[],"id"),[n]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex",children:[i.jsxs(L.Button,{size:"sm",onClick:q,disabled:_||!(g!=null&&g.id),className:`relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${C}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[i.jsx("span",{className:`flex items-center transition-transform duration-300 ease-in-out ${o?"-translate-y-10":""}`,children:I?i.jsx(x.Send,{className:"h-4 w-4"}):i.jsx(x.Rocket,{className:"h-4 w-4"})}),i.jsx("span",{className:`absolute inset-0 left-3 flex items-center transition-transform duration-300 ease-in-out ${o?"":"translate-y-10"}`,children:I?i.jsx(x.Rocket,{className:"h-4 w-4"}):i.jsx(x.Send,{className:"h-4 w-4"})}),i.jsx("span",{children:A}),t?`(${p.upperCase(t)})`:""]}),i.jsxs(m.DropdownMenu,{children:[i.jsx(m.DropdownMenuTrigger,{asChild:!0,children:i.jsx(L.Button,{size:"sm",disabled:_||!(g!=null&&g.id),className:`rounded-l-none border-l border-white/50 px-2 text-white ${C}`,children:i.jsx(x.ChevronDown,{className:"h-4 w-4"})})}),i.jsxs(m.DropdownMenuContent,{align:"end",className:"w-52",children:[i.jsxs(m.DropdownMenuItem,{disabled:_,className:"cursor-pointer text-xs",onClick:()=>T({ids:V},{onSuccess:()=>It("TOP_RIGHT")}),children:[e("Publish")," with translation pages"]}),!I&&i.jsxs(m.DropdownMenuItem,{disabled:_,className:"cursor-pointer text-xs",onClick:()=>T({ids:[g==null?void 0:g.id]},{onSuccess:()=>It("TOP_RIGHT")}),children:[e("Publish")," page"]}),i.jsxs(m.DropdownMenuItem,{onClick:()=>a(!0),className:"cursor-pointer text-xs",children:[e("Open")," publish menu"]}),I&&i.jsxs(m.DropdownMenuItem,{onClick:()=>f(s),className:"cursor-pointer text-xs",children:[e("Unpublish")," page ",t?`(${p.upperCase(t)})`:""]})]})]})]}),i.jsx(da,{showModal:r,onClose:()=>a(!1)}),c&&i.jsx(h.Suspense,{children:i.jsx(ma,{page:c,onClose:()=>f(null)})}),u&&i.jsx(h.Suspense,{children:i.jsx(Ea,{isOpen:u,onClose:ue,onContinue:ce,isPending:_})})]})};function Sa(){const{isLocked:e}=ne(),[t]=le(),s=t.get("lang"),n=tn(s);return e||!n?i.jsx("div",{}):i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(ta,{}),i.jsx(Ct,{permission:se.EDIT_THEME,children:i.jsx(ya,{})}),i.jsx(pa,{}),i.jsx(Ct,{permission:se.SAVE_PAGE,children:i.jsx(Ta,{})}),i.jsx(Ct,{permission:se.PUBLISH_PAGE,children:i.jsx(Aa,{})})]})}const Pa=h.lazy(()=>Promise.resolve().then(()=>require("./dynamic-page-selector-CvBFyX2F.cjs"))),xa=()=>{const{dynamicPage:e,allLangPages:t,isFetching:s}=zs(),n=t.length>0;return s?null:i.jsxs("div",{className:"relative",children:[!e&&i.jsx(Wr,{hasDynamicPage:n}),i.jsx(h.Suspense,{children:i.jsx(Pa,{})})]})},_a=()=>{const{data:e,isFetching:t}=ge(),{data:s,isFetching:n}=te(),r=p.get(s,"dynamic",!1),a=ls(),o=L.useChaiFeatureFlag("dynamic-page-selector"),l=e==null?void 0:e.slug,c=!l,f=br(),d=t||n,E=(c?`Partial: ${e==null?void 0:e.name} `:`${l}${a}`).replace(window.location.host,"");return i.jsxs("div",{className:"relative flex items-center gap-x-1",children:[i.jsx("div",{className:jt.cn("flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",d&&"max-w-0 overflow-hidden opacity-0"),children:i.jsx($r,{})}),i.jsxs("div",{className:jt.cn("flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800"+(c?" pr-2":""),d&&"max-w-0 overflow-hidden opacity-0"),children:[i.jsx(en,{}),i.jsxs("div",{className:"flex w-full items-center overflow-hidden",children:[i.jsx("div",{className:`w-full max-w-[200px] overflow-hidden overflow-ellipsis whitespace-nowrap pl-1 text-xs ${c?"italic text-gray-400":"font-mono text-gray-500"}`,children:E==="/"?i.jsxs("span",{className:"text-gray-900",children:["/",i.jsx("span",{className:"text-[11px] font-light italic text-gray-400",children:"(Homepage)"})]}):E}),!c&&i.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",children:i.jsx("div",{className:"ml-2 mr-px flex-shrink-0 rounded-sm p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",children:i.jsx(x.ExternalLink,{className:"h-4 w-4",strokeWidth:1})})})]})]}),r&&o&&i.jsx(xa,{})]})},wa=()=>i.jsxs("div",{className:"flex h-full w-full items-center justify-between px-2",children:[i.jsx(Zr,{}),i.jsx(_a,{}),i.jsx(Sa,{})]}),sn=()=>{const e=S.useQueryClient(),{data:t}=S.useQuery({queryKey:[y.AI_CONTEXT],initialData:"",queryFn:()=>"",staleTime:0});return{setAiContext:h.useCallback(n=>{e.setQueryData([y.AI_CONTEXT],n)},[e]),aiContext:t}},va=()=>{const e=N(),{aiContext:t}=sn(),s=j();return h.useCallback(async(n,r,a,o)=>s(e,{action:y.ASK_AI,data:{type:n,prompt:r,blocks:a,context:t,lang:o}}),[e,t,s])},ba=(e,t)=>t.map(s=>{if(p.has(e,s._type)){const n=Vs.getDefaultBlockProps(s._type);return{...n,...p.pick(s,[...p.keys(n),"_type","_id","_name","_parent","_bindings"]),...p.pickBy(s,(r,a)=>p.endsWith(a,"_attrs")),...s}}return s}),Ca=e=>{const t=Vs.useRegisteredChaiBlocks();return h.useMemo(()=>{if(!e||p.isEmpty(e))return{blocks:[]};const s=p.filter(e,n=>!p.includes(n==null?void 0:n._type,"@chai/"));return{blocks:ba(t,s)}},[e,t])},Ia=()=>{const[e]=le(),t=e.get("page"),s=N(),{setAiContext:n}=sn(),[,r]=cs(),[,a]=vr(),[,o]=m.useIsPageLoaded(),l=j();return S.useQuery({queryKey:[y.GET_DRAFT_PAGE,t],staleTime:1/0,gcTime:0,queryFn:async()=>{o(!1);const c=await l(s,{action:y.GET_DRAFT_PAGE,data:{id:t,draft:!0}}),f=c.blocks??[],d=p.find(f,{_type:"@chai/ai-context"});return n(p.get(d,"_value","")||""),r(u=>({...u,lastSaved:c.lastSaved})),a(p.get(c,"metadata",{})),setTimeout(()=>o(!0),500),f},enabled:!!t})},nn=()=>{const{data:e}=te(),{data:t}=ge(),s=N(),n=j(),r=Kt(),a=ls();return S.useQuery({queryKey:[y.GET_BUILDER_PAGE_DATA,t==null?void 0:t.id,a],staleTime:1/0,gcTime:0,queryFn:async()=>n(s,{action:y.GET_BUILDER_PAGE_DATA,data:{pageType:e==null?void 0:e.pageType,lang:(t==null?void 0:t.lang)||r,dynamic:e==null?void 0:e.dynamic,pageProps:{slug:(t==null?void 0:t.slug)+a,searchParams:{},pageType:t==null?void 0:t.pageType,fallbackLang:r,lastSaved:t.lastSaved,pageId:e.id,primaryPageId:t.primaryPage||e.id,pageBaseSlug:t==null?void 0:t.slug,dynamic:e==null?void 0:e.dynamic,languagePageId:t.id,metadata:e.metadata||{}}}}),enabled:!!(e!=null&&e.pageType)&&!!t.id})},rn=()=>{const e=N(),t=S.useQueryClient(),s=j();return S.useMutation({mutationFn:async n=>s(e,{action:y.UPDATE_WEBSITE_SETTINGS,data:n}),onSuccess:(n,r)=>{var a;t.invalidateQueries({queryKey:[y.GET_WEBSITE_DRAFT_SETTINGS]}),(a=r==null?void 0:r.settings)!=null&&a.theme||F.toast.success("Website settings updated successfully.")},onError:n=>{F.toast.error("Failed to update website settings",{description:n.message})}})},La=()=>{const e=N(),t=S.useQueryClient(),s=j(),{selectedLang:n}=m.useLanguages();return S.useMutation({mutationFn:async r=>s(e,{action:y.ADD_GLOBAL_SCHEMA,data:{...r,lang:n}}),onSuccess:()=>{t.invalidateQueries({queryKey:[y.GET_GLOBAL_JSONLD_ITEMS]}),F.toast.success("Schema added successfully.")},onError:r=>{F.toast.error("Failed to add schema",{description:r.message})}})},Na=()=>{const e=N(),t=S.useQueryClient(),s=j(),{selectedLang:n}=m.useLanguages();return S.useMutation({mutationFn:async r=>s(e,{action:y.UPDATE_GLOBAL_SCHEMA,data:{...r,lang:n}}),onSuccess:()=>{t.invalidateQueries({queryKey:[y.GET_GLOBAL_JSONLD_ITEMS]}),F.toast.success("Schema updated successfully.")},onError:r=>{F.toast.error("Failed to update schema",{description:r.message})}})},ja=()=>{const e=N(),t=S.useQueryClient(),s=j();return S.useMutation({mutationFn:async n=>s(e,{action:y.DELETE_GLOBAL_SCHEMA,data:{id:n}}),onSuccess:()=>{t.invalidateQueries({queryKey:[y.GET_GLOBAL_JSONLD_ITEMS]}),F.toast.success("Schema deleted successfully.")},onError:n=>{F.toast.error("Failed to delete schema",{description:n.message})}})},Ga=()=>{const e=N(),t=j();return S.useMutation({mutationFn:async s=>t(e,{action:y.TOGGLE_PAGE_GLOBAL_SCHEMA,data:s}),onError:s=>{F.toast.error("Failed to toggle schema",{description:s.message})}})},ka=()=>{const e=N(),t=j();return S.useMutation({mutationFn:async s=>t(e,{action:y.APPLY_SCHEMA_TO_ALL_PAGES,data:{schemaId:s}}),onSuccess:s=>{F.toast.success(`Schema applied to ${s.count} page(s)`)},onError:s=>{F.toast.error("Failed to apply schema to all pages",{description:s.message})}})},Oa=()=>{const e=N(),t=j();return S.useMutation({mutationFn:async s=>t(e,{action:y.REMOVE_SCHEMA_FROM_ALL_PAGES,data:{schemaId:s}}),onSuccess:s=>{F.toast.success(`Schema removed from ${s.count} page(s)`)},onError:s=>{F.toast.error("Failed to remove schema from all pages",{description:s.message})}})},Ls={async getUILibraryBlock(e,t,s){const n=await t(s,{action:"GET_LIBRARY_ITEM",data:{id:e.id}}),r=p.get(n,"html",""),a=p.get(n,"blocks",[]);return p.isArray(a)?a:gr.getBlocksFromHTML(r)},async getUILibraryBlocks(e,t,s){try{return(await t(s,{action:"GET_LIBRARY_ITEMS",data:{id:e.id}})).map(r=>({...r}))}catch(n){return console.error(n),[]}}},Da=()=>{const e=N(),t=j();return S.useQuery({queryKey:["uiLibraries"],staleTime:"static",queryFn:async()=>{const n=(await t(e,{action:"GET_LIBRARIES"})).map(r=>({...r}));return n.forEach(r=>{L.registerChaiLibrary(r.id,{name:r.isSiteLibrary?r.name+" (Current Site) ":r.name,description:r.description,getBlocksList:a=>Ls.getUILibraryBlocks(a,t,e),getBlock:({block:a})=>Ls.getUILibraryBlock(a,t,e)})}),n}})},Ra=(e=300)=>{const t=N(),s=j();h.useEffect(()=>{const n=async()=>{await s(t,{action:"CHECK_USER_ACCESS"})};n();const r=setInterval(n,e*1e3);return()=>clearInterval(r)},[s,e,t])},an=()=>{const e=N(),t=j(),{user:s}=qt(),n=s==null?void 0:s.id;return S.useQuery({queryKey:[y.GET_ROLE_AND_PERMISSIONS,n],queryFn:()=>t(e,{action:y.GET_ROLE_AND_PERMISSIONS,data:{}}),enabled:!!n,staleTime:1/0})},Ma=()=>{const e=N(),t=j(),[,s]=cs();return{onSave:async({page:r,blocks:a,needTranslations:o})=>{try{const l=await t(e,{action:"UPDATE_PAGE",data:{id:r,blocks:a,needTranslations:o}});return l.code==="PAGE_LOCKED"?!0:(s(c=>({...c,lastSaved:new Date().toISOString()})),l)}catch(l){return console.error(l),new Error("Failed to save blocks")}}}},Ua=()=>{const{data:e}=hs(),t=N(),s=j();return{getPartialBlocks:h.useCallback(async()=>{const n={};for(const r of e??[])p.isEmpty(r==null?void 0:r.slug)&&(n[r.id]={type:r.pageType,name:p.startCase(r.name??r.slug),description:""});return n},[e]),getPartialBlockBlocks:h.useCallback(async n=>{if(!n)return[];try{const r=await s(t,{action:"GET_DRAFT_PAGE",data:{id:n,draft:!0,editor:!1}});return p.filter(r.blocks,a=>p.has(a,"_id"))}catch(r){return console.error(r),[]}},[s,t])}},Ba=h.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-content-PovaKJaj.cjs"))),on="chai-chat-panel",Fa=({className:e="h-full w-full"})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",version:"1.1",className:e,children:[i.jsx("title",{children:"ai"}),i.jsx("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:i.jsx("g",{id:"icon",fill:"currentColor",transform:"translate(64.000000, 64.000000)",children:i.jsx("path",{d:"M320,64 L320,320 L64,320 L64,64 L320,64 Z M171.749388,128 L146.817842,128 L99.4840387,256 L121.976629,256 L130.913039,230.977 L187.575039,230.977 L196.319607,256 L220.167172,256 L171.749388,128 Z M260.093778,128 L237.691519,128 L237.691519,256 L260.093778,256 L260.093778,128 Z M159.094727,149.47526 L181.409039,213.333 L137.135039,213.333 L159.094727,149.47526 Z M341.333333,256 L384,256 L384,298.666667 L341.333333,298.666667 L341.333333,256 Z M85.3333333,341.333333 L128,341.333333 L128,384 L85.3333333,384 L85.3333333,341.333333 Z M170.666667,341.333333 L213.333333,341.333333 L213.333333,384 L170.666667,384 L170.666667,341.333333 Z M85.3333333,0 L128,0 L128,42.6666667 L85.3333333,42.6666667 L85.3333333,0 Z M256,341.333333 L298.666667,341.333333 L298.666667,384 L256,384 L256,341.333333 Z M170.666667,0 L213.333333,0 L213.333333,42.6666667 L170.666667,42.6666667 L170.666667,0 Z M256,0 L298.666667,0 L298.666667,42.6666667 L256,42.6666667 L256,0 Z M341.333333,170.666667 L384,170.666667 L384,213.333333 L341.333333,213.333333 L341.333333,170.666667 Z M0,256 L42.6666667,256 L42.6666667,298.666667 L0,298.666667 L0,256 Z M341.333333,85.3333333 L384,85.3333333 L384,128 L341.333333,128 L341.333333,85.3333333 Z M0,170.666667 L42.6666667,170.666667 L42.6666667,213.333333 L0,213.333333 L0,170.666667 Z M0,85.3333333 L42.6666667,85.3333333 L42.6666667,128 L0,128 L0,85.3333333 Z",id:"Combined-Shape"})})})]}),qa=({isActive:e,show:t})=>i.jsx(L.Button,{size:"icon",className:"p-0 [&_svg]:size-6",onClick:t,variant:e?"default":"ghost",children:i.jsx(Fa,{className:e?"h-5 w-5 text-white":"h-5 w-5 text-primary"})}),Ka={id:on,label:"AI Assistant",button:qa,panel:Ba,position:"top"},Va=h.lazy(()=>Promise.resolve().then(()=>require("./lang-panel-AmEkoWid.cjs"))),Ha=({isActive:e,show:t})=>{const{data:s}=Se();return!p.has(s,"languages")||!p.get(s,"languages",[]).length?null:i.jsx(L.Button,{size:"sm",onClick:t,variant:e?"default":"ghost",children:i.jsx(x.LanguagesIcon,{className:"h-4 w-4"})})},ln="lang",Qa={id:ln,label:"Languages",position:"top",panel:Va,button:Ha,view:"modal",width:400},za=h.lazy(()=>Promise.resolve().then(()=>require("./seo-panel-_kGXE9MC.cjs"))),cn="seo",$a=({isActive:e,show:t})=>{const{data:s}=te(),n=$s(s==null?void 0:s.pageType);return!p.has(n,"hasSlug")||!n.hasSlug?null:i.jsx(L.Button,{size:"icon",className:"my-1 p-0",onClick:t,variant:e?"default":"ghost",children:i.jsxs("svg",{stroke:"currentColor",fill:"none",style:{height:"20px",width:"20px"},strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M7 8h-3a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-3"}),i.jsx("path",{d:"M14 16h-4v-8h4"}),i.jsx("path",{d:"M11 12h2"}),i.jsx("path",{d:"M17 8m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]})})},Wa={id:cn,label:"SEO",panel:za,button:$a,position:"top",width:600,view:"modal"},un="user-info",Ya=()=>{const{t:e}=he.useTranslation(),{user:t,logout:s}=qt(),n=ie("onLogout",p.noop);return t?i.jsxs(m.HoverCard,{children:[i.jsx(m.HoverCardTrigger,{asChild:!0,children:i.jsx(L.Button,{variant:"ghost",className:"text-sm font-medium",children:i.jsx(x.User,{className:"h-4 w-4"})})}),i.jsxs(m.HoverCardContent,{className:"w-auto space-y-2 p-4",children:[i.jsx("div",{className:"text-sm font-medium",children:t.name??t.email}),i.jsx("div",{className:"text-xs text-muted-foreground",children:t.email}),i.jsxs(m.AlertDialog,{children:[i.jsx(m.AlertDialogTrigger,{asChild:!0,children:i.jsx(L.Button,{variant:"outline",size:"sm",className:"w-full",children:e("Logout")})}),i.jsxs(m.AlertDialogContent,{children:[i.jsxs(m.AlertDialogHeader,{children:[i.jsx(m.AlertDialogTitle,{children:e("Are you sure you want to logout?")}),i.jsx(m.AlertDialogDescription,{children:e("You will be redirected to the login page.")})]}),i.jsxs(m.AlertDialogFooter,{children:[i.jsx(m.AlertDialogCancel,{children:e("Cancel")}),i.jsx(m.AlertDialogAction,{onClick:()=>{s(),p.isFunction(n)&&n()},children:e("Logout")})]})]})]})]})]}):null},Ja={id:un,label:"User Info",button:Ya,position:"bottom"},Za=()=>{L.registerChaiSidebarPanel(cn,Wa),L.registerChaiSidebarPanel(ln,Qa),L.registerChaiSidebarPanel(un,Ja),L.registerChaiSidebarPanel(on,Ka)};var v={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Ns(this.context.count)},getNextContextId(){return Ns(this.context.count++)}};function Ns(e){const t=String(e),s=t.length-1;return v.context.id+(s?String.fromCharCode(96+s):"")+t}function Je(e){v.context=e}var dn=!1,Xa=(e,t)=>e===t,Gt=Symbol("solid-proxy"),fn=typeof Proxy=="function",ps=Symbol("solid-track"),kt={equals:Xa},hn=Sn,Ee=1,Ot=2,gn={owned:null,cleanups:null,context:null,owner:null},Wt={},D=null,Yt=null,ei=null,U=null,Z=null,fe=null,Ht=0;function pe(e,t){const s=U,n=D,r=e.length===0,a=t===void 0?n:t,o=r?gn:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=r?e:()=>e(()=>Y(()=>nt(o)));D=o,U=null;try{return oe(l,!0)}finally{U=s,D=n}}function K(e,t){t=t?Object.assign({},kt,t):kt;const s={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=r=>(typeof r=="function"&&(r=r(s.value)),An(s,r));return[Tn.bind(s),n]}function mn(e,t,s){const n=Qt(e,t,!0,Ee);We(n)}function ye(e,t,s){const n=Qt(e,t,!1,Ee);We(n)}function ys(e,t,s){hn=hi;const n=Qt(e,t,!1,Ee);(!s||!s.render)&&(n.user=!0),fe?fe.push(n):We(n)}function $(e,t,s){s=s?Object.assign({},kt,s):kt;const n=Qt(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=s.equals||void 0,We(n),Tn.bind(n)}function ti(e){return e&&typeof e=="object"&&"then"in e}function si(e,t,s){let n,r,a;n=!0,r=e,a={};let o=null,l=Wt,c=null,f=!1,d="initialValue"in a,u=typeof n=="function"&&$(n);const E=new Set,[g,T]=(a.storage||K)(a.initialValue),[_,w]=K(void 0),[M,A]=K(void 0,{equals:!1}),[C,I]=K(d?"ready":"unresolved");v.context&&(c=v.getNextContextId(),a.ssrLoadFrom==="initial"?l=a.initialValue:v.load&&v.has(c)&&(l=v.load(c)));function q(b,k,W,z){return o===b&&(o=null,z!==void 0&&(d=!0),(b===l||k===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(z,{value:k})),l=Wt,G(k,W)),k}function G(b,k){oe(()=>{k===void 0&&T(()=>b),I(k!==void 0?"errored":d?"ready":"unresolved"),w(k);for(const W of E.keys())W.decrement();E.clear()},!1)}function ce(){const b=ui,k=g(),W=_();if(W!==void 0&&!o)throw W;return U&&U.user,k}function ue(b=!0){if(b!==!1&&f)return;f=!1;const k=u?u():n;if(k==null||k===!1){q(o,Y(g));return}let W;const z=l!==Wt?l:Y(()=>{try{return r(k,{value:g(),refetching:b})}catch(re){W=re}});if(W!==void 0){q(o,void 0,Lt(W),k);return}else if(!ti(z))return q(o,z,void 0,k),z;return o=z,"v"in z?(z.s===1?q(o,z.v,void 0,k):q(o,void 0,Lt(z.v),k),z):(f=!0,queueMicrotask(()=>f=!1),oe(()=>{I(d?"refreshing":"pending"),A()},!1),z.then(re=>q(z,re,void 0,k),re=>q(z,void 0,Lt(re),k)))}Object.defineProperties(ce,{state:{get:()=>C()},error:{get:()=>_()},loading:{get(){const b=C();return b==="pending"||b==="refreshing"}},latest:{get(){if(!d)return ce();const b=_();if(b&&!o)throw b;return g()}}});let V=D;return u?mn(()=>(V=D,ue(!1))):ue(!1),[ce,{refetch:b=>pn(V,()=>ue(b)),mutate:T}]}function ni(e){return oe(e,!1)}function Y(e){if(U===null)return e();const t=U;U=null;try{return e()}finally{U=t}}function ri(e,t,s){const n=Array.isArray(e);let r,a=s&&s.defer;return o=>{let l;if(n){l=Array(e.length);for(let f=0;f<e.length;f++)l[f]=e[f]()}else l=e();if(a)return a=!1,o;const c=Y(()=>t(l,r,o));return r=l,c}}function En(e){ys(()=>Y(e))}function ze(e){return D===null||(D.cleanups===null?D.cleanups=[e]:D.cleanups.push(e)),e}function js(){return D}function pn(e,t){const s=D,n=U;D=e,U=null;try{return oe(t,!0)}catch(r){Ts(r)}finally{D=s,U=n}}function ai(e){const t=U,s=D;return Promise.resolve().then(()=>{U=t,D=s;let n;return oe(e,!1),U=D=null,n?n.done:void 0})}var[ii,pl]=K(!1);function oi(){return[ii,ai]}function li(e,t){const s=Symbol("context");return{id:s,Provider:gi(s),defaultValue:e}}function ci(e){let t;return D&&D.context&&(t=D.context[e.id])!==void 0?t:e.defaultValue}function yn(e){const t=$(e),s=$(()=>Xt(t()));return s.toArray=()=>{const n=s();return Array.isArray(n)?n:n!=null?[n]:[]},s}var ui;function Tn(){if(this.sources&&this.state)if(this.state===Ee)We(this);else{const e=Z;Z=null,oe(()=>Rt(this),!1),Z=e}if(U){const e=this.observers?this.observers.length:0;U.sources?(U.sources.push(this),U.sourceSlots.push(e)):(U.sources=[this],U.sourceSlots=[e]),this.observers?(this.observers.push(U),this.observerSlots.push(U.sources.length-1)):(this.observers=[U],this.observerSlots=[U.sources.length-1])}return this.value}function An(e,t,s){let n=e.value;return(!e.comparator||!e.comparator(n,t))&&(e.value=t,e.observers&&e.observers.length&&oe(()=>{for(let r=0;r<e.observers.length;r+=1){const a=e.observers[r],o=Yt&&Yt.running;o&&Yt.disposed.has(a),(o?!a.tState:!a.state)&&(a.pure?Z.push(a):fe.push(a),a.observers&&Pn(a)),o||(a.state=Ee)}if(Z.length>1e6)throw Z=[],new Error},!1)),t}function We(e){if(!e.fn)return;nt(e);const t=Ht;di(e,e.value,t)}function di(e,t,s){let n;const r=D,a=U;U=D=e;try{n=e.fn(t)}catch(o){return e.pure&&(e.state=Ee,e.owned&&e.owned.forEach(nt),e.owned=null),e.updatedAt=s+1,Ts(o)}finally{U=a,D=r}(!e.updatedAt||e.updatedAt<=s)&&(e.updatedAt!=null&&"observers"in e?An(e,n):e.value=n,e.updatedAt=s)}function Qt(e,t,s,n=Ee,r){const a={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:D,context:D?D.context:null,pure:s};return D===null||D!==gn&&(D.owned?D.owned.push(a):D.owned=[a]),a}function Dt(e){if(e.state===0)return;if(e.state===Ot)return Rt(e);if(e.suspense&&Y(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Ht);)e.state&&t.push(e);for(let s=t.length-1;s>=0;s--)if(e=t[s],e.state===Ee)We(e);else if(e.state===Ot){const n=Z;Z=null,oe(()=>Rt(e,t[0]),!1),Z=n}}function oe(e,t){if(Z)return e();let s=!1;t||(Z=[]),fe?s=!0:fe=[],Ht++;try{const n=e();return fi(s),n}catch(n){s||(fe=null),Z=null,Ts(n)}}function fi(e){if(Z&&(Sn(Z),Z=null),e)return;const t=fe;fe=null,t.length&&oe(()=>hn(t),!1)}function Sn(e){for(let t=0;t<e.length;t++)Dt(e[t])}function hi(e){let t,s=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[s++]=n:Dt(n)}if(v.context){if(v.count){v.effects||(v.effects=[]),v.effects.push(...e.slice(0,s));return}Je()}for(v.effects&&(v.done||!v.count)&&(e=[...v.effects,...e],s+=v.effects.length,delete v.effects),t=0;t<s;t++)Dt(e[t])}function Rt(e,t){e.state=0;for(let s=0;s<e.sources.length;s+=1){const n=e.sources[s];if(n.sources){const r=n.state;r===Ee?n!==t&&(!n.updatedAt||n.updatedAt<Ht)&&Dt(n):r===Ot&&Rt(n,t)}}}function Pn(e){for(let t=0;t<e.observers.length;t+=1){const s=e.observers[t];s.state||(s.state=Ot,s.pure?Z.push(s):fe.push(s),s.observers&&Pn(s))}}function nt(e){let t;if(e.sources)for(;e.sources.length;){const s=e.sources.pop(),n=e.sourceSlots.pop(),r=s.observers;if(r&&r.length){const a=r.pop(),o=s.observerSlots.pop();n<r.length&&(a.sourceSlots[o]=n,r[n]=a,s.observerSlots[n]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)nt(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)nt(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 Lt(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Ts(e,t=D){throw Lt(e)}function Xt(e){if(typeof e=="function"&&!e.length)return Xt(e());if(Array.isArray(e)){const t=[];for(let s=0;s<e.length;s++){const n=Xt(e[s]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function gi(e,t){return function(n){let r;return ye(()=>r=Y(()=>(D.context={...D.context,[e]:n.value},yn(()=>n.children))),void 0),r}}var es=Symbol("fallback");function Mt(e){for(let t=0;t<e.length;t++)e[t]()}function mi(e,t,s={}){let n=[],r=[],a=[],o=0,l=t.length>1?[]:null;return ze(()=>Mt(a)),()=>{let c=e()||[],f=c.length,d,u;return c[ps],Y(()=>{let g,T,_,w,M,A,C,I,q;if(f===0)o!==0&&(Mt(a),a=[],n=[],r=[],o=0,l&&(l=[])),s.fallback&&(n=[es],r[0]=pe(G=>(a[0]=G,s.fallback())),o=1);else if(o===0){for(r=new Array(f),u=0;u<f;u++)n[u]=c[u],r[u]=pe(E);o=f}else{for(_=new Array(f),w=new Array(f),l&&(M=new Array(f)),A=0,C=Math.min(o,f);A<C&&n[A]===c[A];A++);for(C=o-1,I=f-1;C>=A&&I>=A&&n[C]===c[I];C--,I--)_[I]=r[C],w[I]=a[C],l&&(M[I]=l[C]);for(g=new Map,T=new Array(I+1),u=I;u>=A;u--)q=c[u],d=g.get(q),T[u]=d===void 0?-1:d,g.set(q,u);for(d=A;d<=C;d++)q=n[d],u=g.get(q),u!==void 0&&u!==-1?(_[u]=r[d],w[u]=a[d],l&&(M[u]=l[d]),u=T[u],g.set(q,u)):a[d]();for(u=A;u<f;u++)u in _?(r[u]=_[u],a[u]=w[u],l&&(l[u]=M[u],l[u](u))):r[u]=pe(E);r=r.slice(0,o=f),n=c.slice(0)}return r});function E(g){if(a[u]=g,l){const[T,_]=K(u);return l[u]=_,t(c[u],T)}return t(c[u])}}}function Ei(e,t,s={}){let n=[],r=[],a=[],o=[],l=0,c;return ze(()=>Mt(a)),()=>{const f=e()||[],d=f.length;return f[ps],Y(()=>{if(d===0)return l!==0&&(Mt(a),a=[],n=[],r=[],l=0,o=[]),s.fallback&&(n=[es],r[0]=pe(E=>(a[0]=E,s.fallback())),l=1),r;for(n[0]===es&&(a[0](),a=[],n=[],r=[],l=0),c=0;c<d;c++)c<n.length&&n[c]!==f[c]?o[c](()=>f[c]):c>=n.length&&(r[c]=pe(u));for(;c<n.length;c++)a[c]();return l=o.length=a.length=d,n=f.slice(0),r=r.slice(0,l)});function u(E){a[c]=E;const[g,T]=K(f[c]);return o[c]=T,t(g,c)}}}function As(e,t){return Y(()=>e(t||{}))}function wt(){return!0}var ts={get(e,t,s){return t===Gt?s:e.get(t)},has(e,t){return t===Gt?!0:e.has(t)},set:wt,deleteProperty:wt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:wt,deleteProperty:wt}},ownKeys(e){return e.keys()}};function Jt(e){return(e=typeof e=="function"?e():e)?e:{}}function pi(){for(let e=0,t=this.length;e<t;++e){const s=this[e]();if(s!==void 0)return s}}function Ss(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Gt in l,e[o]=typeof l=="function"?(t=!0,$(l)):l}if(fn&&t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const c=Jt(e[l])[o];if(c!==void 0)return c}},has(o){for(let l=e.length-1;l>=0;l--)if(o in Jt(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(Jt(e[l])));return[...new Set(o)]}},ts);const s={},n=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 f=c.length-1;f>=0;f--){const d=c[f];if(d==="__proto__"||d==="constructor")continue;const u=Object.getOwnPropertyDescriptor(l,d);if(!n[d])n[d]=u.get?{enumerable:!0,configurable:!0,get:pi.bind(s[d]=[u.get.bind(l)])}:u.value!==void 0?u:void 0;else{const E=s[d];E&&(u.get?E.push(u.get.bind(l)):u.value!==void 0&&E.push(()=>u.value))}}}const r={},a=Object.keys(n);for(let o=a.length-1;o>=0;o--){const l=a[o],c=n[l];c&&c.get?Object.defineProperty(r,l,c):r[l]=c?c.value:void 0}return r}function xn(e,...t){if(fn&&Gt in e){const r=new Set(t.length>1?t.flat():t[0]),a=t.map(o=>new Proxy({get(l){return o.includes(l)?e[l]:void 0},has(l){return o.includes(l)&&l in e},keys(){return o.filter(l=>l in e)}},ts));return a.push(new Proxy({get(o){return r.has(o)?void 0:e[o]},has(o){return r.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!r.has(o))}},ts)),a}const s={},n=t.map(()=>({}));for(const r of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,r),o=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let l=!1,c=0;for(const f of t)f.includes(r)&&(l=!0,o?n[c][r]=a.value:Object.defineProperty(n[c],r,a)),++c;l||(o?s[r]=a.value:Object.defineProperty(s,r,a))}return[...n,s]}function _n(e){let t,s;const n=r=>{const a=v.context;if(a){const[l,c]=K();v.count||(v.count=0),v.count++,(s||(s=e())).then(f=>{!v.done&&Je(a),v.count--,c(()=>f.default),Je()}),t=l}else if(!t){const[l]=si(()=>(s||(s=e())).then(c=>c.default));t=l}let o;return $(()=>(o=t())?Y(()=>{if(!a||v.done)return o(r);const l=v.context;Je(a);const c=o(r);return Je(l),c}):"")};return n.preload=()=>s||((s=e()).then(r=>t=()=>r.default),s),n}var yi=0;function Ti(){return v.context?v.getNextContextId():`cl-${yi++}`}var wn=e=>`Stale read from <${e}>.`;function Ai(e){const t="fallback"in e&&{fallback:()=>e.fallback};return $(mi(()=>e.each,e.children,t||void 0))}function Si(e){const t="fallback"in e&&{fallback:()=>e.fallback};return $(Ei(()=>e.each,e.children,t||void 0))}function Pi(e){const t=e.keyed,s=$(()=>e.when,void 0,void 0),n=t?s:$(s,void 0,{equals:(r,a)=>!r==!a});return $(()=>{const r=n();if(r){const a=e.children;return typeof a=="function"&&a.length>0?Y(()=>a(t?r:()=>{if(!Y(n))throw wn("Show");return s()})):a}return e.fallback},void 0,void 0)}function xi(e){const t=yn(()=>e.children),s=$(()=>{const n=t(),r=Array.isArray(n)?n:[n];let a=()=>{};for(let o=0;o<r.length;o++){const l=o,c=r[o],f=a,d=$(()=>f()?void 0:c.when,void 0,void 0),u=c.keyed?d:$(d,void 0,{equals:(E,g)=>!E==!g});a=()=>f()||(u()?[l,d,c]:void 0)}return a});return $(()=>{const n=s()();if(!n)return e.fallback;const[r,a,o]=n,l=o.children;return typeof l=="function"&&l.length>0?Y(()=>l(o.keyed?a():()=>{var f;if(((f=Y(s)())==null?void 0:f[0])!==r)throw wn("Match");return a()})):l},void 0,void 0)}function _i(e){return e}var wi=["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"],vi=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline",...wi]),bi=new Set(["innerHTML","textContent","innerText","children"]),Ci=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Ii=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},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 Li(e,t){const s=Ii[e];return typeof s=="object"?s[t]?s.$:void 0:s}var Ni=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),ji=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"]),Gi={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},ki=e=>$(()=>e());function Oi(e,t,s){let n=s.length,r=t.length,a=n,o=0,l=0,c=t[r-1].nextSibling,f=null;for(;o<r||l<a;){if(t[o]===s[l]){o++,l++;continue}for(;t[r-1]===s[a-1];)r--,a--;if(r===o){const d=a<n?l?s[l-1].nextSibling:s[a-l]:c;for(;l<a;)e.insertBefore(s[l++],d)}else if(a===l)for(;o<r;)(!f||!f.has(t[o]))&&t[o].remove(),o++;else if(t[o]===s[a-1]&&s[l]===t[r-1]){const d=t[--r].nextSibling;e.insertBefore(s[l++],t[o++].nextSibling),e.insertBefore(s[--a],d),t[r]=s[a]}else{if(!f){f=new Map;let u=l;for(;u<a;)f.set(s[u],u++)}const d=f.get(t[o]);if(d!=null)if(l<d&&d<a){let u=o,E=1,g;for(;++u<r&&u<a&&!((g=f.get(t[u]))==null||g!==d+E);)E++;if(E>d-l){const T=t[o];for(;l<d;)e.insertBefore(s[l++],T)}else e.replaceChild(s[l++],t[o++])}else o++;else t[o++].remove()}}}var et="_$DX_DELEGATE";function vn(e,t,s,n={}){let r;return pe(a=>{r=a,t===document?e():Bt(t,e(),t.firstChild?null:void 0,s)},n.owner),()=>{r(),t.textContent=""}}function Di(e,t,s,n){let r;const a=()=>{const l=document.createElement("template");return l.innerHTML=e,l.content.firstChild},o=()=>(r||(r=a())).cloneNode(!0);return o.cloneNode=o,o}function bn(e,t=window.document){const s=t[et]||(t[et]=new Set);for(let n=0,r=e.length;n<r;n++){const a=e[n];s.has(a)||(s.add(a),t.addEventListener(a,jn))}}function Ri(e=window.document){if(e[et]){for(let t of e[et].keys())e.removeEventListener(t,jn);delete e[et]}}function Ut(e,t,s){ve(e)||(s==null?e.removeAttribute(t):e.setAttribute(t,s))}function Mi(e,t,s,n){ve(e)||(n==null?e.removeAttributeNS(t,s):e.setAttributeNS(t,s,n))}function Ui(e,t,s){ve(e)||(s?e.setAttribute(t,""):e.removeAttribute(t))}function Cn(e,t){ve(e)||(t==null?e.removeAttribute("class"):e.className=t)}function In(e,t,s,n){if(n)Array.isArray(s)?(e[`$$${t}`]=s[0],e[`$$${t}Data`]=s[1]):e[`$$${t}`]=s;else if(Array.isArray(s)){const r=s[0];e.addEventListener(t,s[0]=a=>r.call(e,s[1],a))}else e.addEventListener(t,s,typeof s!="function"&&s)}function Bi(e,t,s={}){const n=Object.keys(t||{}),r=Object.keys(s);let a,o;for(a=0,o=r.length;a<o;a++){const l=r[a];!l||l==="undefined"||t[l]||(Gs(e,l,!1),delete s[l])}for(a=0,o=n.length;a<o;a++){const l=n[a],c=!!t[l];!l||l==="undefined"||s[l]===c||!c||(Gs(e,l,!0),s[l]=c)}return s}function Fi(e,t,s){if(!t)return s?Ut(e,"style"):t;const n=e.style;if(typeof t=="string")return n.cssText=t;typeof s=="string"&&(n.cssText=s=void 0),s||(s={}),t||(t={});let r,a;for(a in s)t[a]==null&&n.removeProperty(a),delete s[a];for(a in t)r=t[a],r!==s[a]&&(n.setProperty(a,r),s[a]=r);return s}function Ln(e,t={},s,n){const r={};return n||ye(()=>r.children=rt(e,t.children,r.children)),ye(()=>typeof t.ref=="function"&&Nn(t.ref,e)),ye(()=>qi(e,t,s,!0,r,!0)),r}function Nn(e,t,s){return Y(()=>e(t,s))}function Bt(e,t,s,n){if(s!==void 0&&!n&&(n=[]),typeof t!="function")return rt(e,t,n,s);ye(r=>rt(e,t(),r,s),n)}function qi(e,t,s,n,r={},a=!1){t||(t={});for(const o in r)if(!(o in t)){if(o==="children")continue;r[o]=ks(e,o,null,r[o],s,a,t)}for(const o in t){if(o==="children")continue;const l=t[o];r[o]=ks(e,o,l,r[o],s,a,t)}}function Ki(e){let t,s;return!ve()||!(t=v.registry.get(s=Hi()))?e():(v.completed&&v.completed.add(t),v.registry.delete(s),t)}function ve(e){return!!v.context&&!v.done&&(!e||e.isConnected)}function Vi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,s)=>s.toUpperCase())}function Gs(e,t,s){const n=t.trim().split(/\s+/);for(let r=0,a=n.length;r<a;r++)e.classList.toggle(n[r],s)}function ks(e,t,s,n,r,a,o){let l,c,f,d,u;if(t==="style")return Fi(e,s,n);if(t==="classList")return Bi(e,s,n);if(s===n)return n;if(t==="ref")a||s(e);else if(t.slice(0,3)==="on:"){const E=t.slice(3);n&&e.removeEventListener(E,n,typeof n!="function"&&n),s&&e.addEventListener(E,s,typeof s!="function"&&s)}else if(t.slice(0,10)==="oncapture:"){const E=t.slice(10);n&&e.removeEventListener(E,n,!0),s&&e.addEventListener(E,s,!0)}else if(t.slice(0,2)==="on"){const E=t.slice(2).toLowerCase(),g=Ni.has(E);if(!g&&n){const T=Array.isArray(n)?n[0]:n;e.removeEventListener(E,T)}(g||s)&&(In(e,E,s,g),g&&bn([E]))}else if(t.slice(0,5)==="attr:")Ut(e,t.slice(5),s);else if(t.slice(0,5)==="bool:")Ui(e,t.slice(5),s);else if((u=t.slice(0,5)==="prop:")||(f=bi.has(t))||!r&&((d=Li(t,e.tagName))||(c=vi.has(t)))||(l=e.nodeName.includes("-")||"is"in o)){if(u)t=t.slice(5),c=!0;else if(ve(e))return s;t==="class"||t==="className"?Cn(e,s):l&&!c&&!f?e[Vi(t)]=s:e[d||t]=s}else{const E=r&&t.indexOf(":")>-1&&Gi[t.split(":")[0]];E?Mi(e,E,t,s):Ut(e,Ci[t]||t,s)}return s}function jn(e){if(v.registry&&v.events&&v.events.find(([c,f])=>f===e))return;let t=e.target;const s=`$$${e.type}`,n=e.target,r=e.currentTarget,a=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),o=()=>{const c=t[s];if(c&&!t.disabled){const f=t[`${s}Data`];if(f!==void 0?c.call(t,f,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},l=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),v.registry&&!v.done&&(v.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();a(c[0]);for(let f=0;f<c.length-2&&(t=c[f],!!o());f++){if(t._$host){t=t._$host,l();break}if(t.parentNode===r)break}}else l();a(n)}function rt(e,t,s,n,r){const a=ve(e);if(a){!s&&(s=[...e.childNodes]);let c=[];for(let f=0;f<s.length;f++){const d=s[f];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():c.push(d)}s=c}for(;typeof s=="function";)s=s();if(t===s)return s;const o=typeof t,l=n!==void 0;if(e=l&&s[0]&&s[0].parentNode||e,o==="string"||o==="number"){if(a||o==="number"&&(t=t.toString(),t===s))return s;if(l){let c=s[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),s=Ce(e,s,n,c)}else s!==""&&typeof s=="string"?s=e.firstChild.data=t:s=e.textContent=t}else if(t==null||o==="boolean"){if(a)return s;s=Ce(e,s,n)}else{if(o==="function")return ye(()=>{let c=t();for(;typeof c=="function";)c=c();s=rt(e,c,s,n)}),()=>s;if(Array.isArray(t)){const c=[],f=s&&Array.isArray(s);if(ss(c,t,s,r))return ye(()=>s=rt(e,c,s,n,!0)),()=>s;if(a){if(!c.length)return s;if(n===void 0)return s=[...e.childNodes];let d=c[0];if(d.parentNode!==e)return s;const u=[d];for(;(d=d.nextSibling)!==n;)u.push(d);return s=u}if(c.length===0){if(s=Ce(e,s,n),l)return s}else f?s.length===0?Os(e,c,n):Oi(e,s,c):(s&&Ce(e),Os(e,c));s=c}else if(t.nodeType){if(a&&t.parentNode)return s=l?[t]:t;if(Array.isArray(s)){if(l)return s=Ce(e,s,n,t);Ce(e,s,null,t)}else s==null||s===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);s=t}}return s}function ss(e,t,s,n){let r=!1;for(let a=0,o=t.length;a<o;a++){let l=t[a],c=s&&s[e.length],f;if(!(l==null||l===!0||l===!1))if((f=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))r=ss(e,l,c)||r;else if(f==="function")if(n){for(;typeof l=="function";)l=l();r=ss(e,Array.isArray(l)?l:[l],Array.isArray(c)?c:[c])||r}else e.push(l),r=!0;else{const d=String(l);c&&c.nodeType===3&&c.data===d?e.push(c):e.push(document.createTextNode(d))}}return r}function Os(e,t,s=null){for(let n=0,r=t.length;n<r;n++)e.insertBefore(t[n],s)}function Ce(e,t,s,n){if(s===void 0)return e.textContent="";const r=n||document.createTextNode("");if(t.length){let a=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(r!==l){const c=l.parentNode===e;!a&&!o?c?e.replaceChild(r,l):e.insertBefore(r,s):c&&l.remove()}else a=!0}}else e.insertBefore(r,s);return[r]}function Hi(){return v.getNextContextId()}var Qi="http://www.w3.org/2000/svg";function Gn(e,t=!1){return t?document.createElementNS(Qi,e):document.createElement(e)}function zi(e){const{useShadow:t}=e,s=document.createTextNode(""),n=()=>e.mount||document.body,r=js();let a,o=!!v.context;return ys(()=>{o&&(js().user=o=!1),a||(a=pn(r,()=>$(()=>e.children)));const l=n();if(l instanceof HTMLHeadElement){const[c,f]=K(!1),d=()=>f(!0);pe(u=>Bt(l,()=>c()?u():a(),null)),ze(d)}else{const c=Gn(e.isSVG?"g":"div",e.isSVG),f=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return s.parentNode},configurable:!0}),Bt(f,a),l.appendChild(c),e.ref&&e.ref(c),ze(()=>l.removeChild(c))}},void 0,{render:!o}),s}function $i(e,t){const s=$(e);return $(()=>{const n=s();switch(typeof n){case"function":return Y(()=>n(t));case"string":const r=ji.has(n),a=v.context?Ki():Gn(n,r);return Ln(a,t,r),a}})}function Wi(e){const[,t]=xn(e,["component"]);return $i(()=>e.component,t)}var Yi=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()}},kn=class{constructor(e){this.generateIdentifier=e,this.kv=new Yi}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)}},Ji=class extends kn{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 Zi(e){if("values"in Object)return Object.values(e);const t=[];for(const s in e)e.hasOwnProperty(s)&&t.push(e[s]);return t}function Xi(e,t){const s=Zi(e);if("find"in s)return s.find(t);const n=s;for(let r=0;r<n.length;r++){const a=n[r];if(t(a))return a}}function $e(e,t){Object.entries(e).forEach(([s,n])=>t(n,s))}function Nt(e,t){return e.indexOf(t)!==-1}function Ds(e,t){for(let s=0;s<e.length;s++){const n=e[s];if(t(n))return n}}var eo=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Xi(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},to=e=>Object.prototype.toString.call(e).slice(8,-1),On=e=>typeof e>"u",so=e=>e===null,at=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,ns=e=>at(e)&&Object.keys(e).length===0,Te=e=>Array.isArray(e),no=e=>typeof e=="string",ro=e=>typeof e=="number"&&!isNaN(e),ao=e=>typeof e=="boolean",io=e=>e instanceof RegExp,it=e=>e instanceof Map,ot=e=>e instanceof Set,Dn=e=>to(e)==="Symbol",oo=e=>e instanceof Date&&!isNaN(e.valueOf()),lo=e=>e instanceof Error,Rs=e=>typeof e=="number"&&isNaN(e),co=e=>ao(e)||so(e)||On(e)||ro(e)||no(e)||Dn(e),uo=e=>typeof e=="bigint",fo=e=>e===1/0||e===-1/0,ho=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),go=e=>e instanceof URL,Rn=e=>e.replace(/\./g,"\\."),Zt=e=>e.map(String).map(Rn).join("."),tt=e=>{const t=[];let s="";for(let r=0;r<e.length;r++){let a=e.charAt(r);if(a==="\\"&&e.charAt(r+1)==="."){s+=".",r++;continue}if(a==="."){t.push(s),s="";continue}s+=a}const n=s;return t.push(n),t};function ae(e,t,s,n){return{isApplicable:e,annotation:t,transform:s,untransform:n}}var Mn=[ae(On,"undefined",()=>null,()=>{}),ae(uo,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),ae(oo,"Date",e=>e.toISOString(),e=>new Date(e)),ae(lo,"Error",(e,t)=>{const s={name:e.name,message:e.message};return t.allowedErrorProps.forEach(n=>{s[n]=e[n]}),s},(e,t)=>{const s=new Error(e.message);return s.name=e.name,s.stack=e.stack,t.allowedErrorProps.forEach(n=>{s[n]=e[n]}),s}),ae(io,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),s=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,s)}),ae(ot,"set",e=>[...e.values()],e=>new Set(e)),ae(it,"map",e=>[...e.entries()],e=>new Map(e)),ae(e=>Rs(e)||fo(e),"number",e=>Rs(e)?"NaN":e>0?"Infinity":"-Infinity",Number),ae(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),ae(go,"URL",e=>e.toString(),e=>new URL(e))];function zt(e,t,s,n){return{isApplicable:e,annotation:t,transform:s,untransform:n}}var Un=zt((e,t)=>Dn(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,s)=>{const n=s.symbolRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),mo=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Bn=zt(ho,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const s=mo[t[1]];if(!s)throw new Error("Trying to deserialize unknown typed array");return new s(e)});function Fn(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var qn=zt(Fn,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const s=t.classRegistry.getAllowedProps(e.constructor);if(!s)return{...e};const n={};return s.forEach(r=>{n[r]=e[r]}),n},(e,t,s)=>{const n=s.classRegistry.getValue(t[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),e)}),Kn=zt((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,s)=>{const n=s.customTransformerRegistry.findByName(t[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),Eo=[qn,Un,Kn,Bn],Ms=(e,t)=>{const s=Ds(Eo,r=>r.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation(e,t)};const n=Ds(Mn,r=>r.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},Vn={};Mn.forEach(e=>{Vn[e.annotation]=e});var po=(e,t,s)=>{if(Te(t))switch(t[0]){case"symbol":return Un.untransform(e,t,s);case"class":return qn.untransform(e,t,s);case"custom":return Kn.untransform(e,t,s);case"typed-array":return Bn.untransform(e,t,s);default:throw new Error("Unknown transformation: "+t)}else{const n=Vn[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,s)}},Ie=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const s=e.keys();for(;t>0;)s.next(),t--;return s.next().value};function Hn(e){if(Nt(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Nt(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Nt(e,"constructor"))throw new Error("constructor is not allowed as a property")}var yo=(e,t)=>{Hn(t);for(let s=0;s<t.length;s++){const n=t[s];if(ot(e))e=Ie(e,+n);else if(it(e)){const r=+n,a=+t[++s]==0?"key":"value",o=Ie(e,r);switch(a){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[n]}return e},rs=(e,t,s)=>{if(Hn(t),t.length===0)return s(e);let n=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(Te(n)){const l=+o;n=n[l]}else if(at(n))n=n[o];else if(ot(n)){const l=+o;n=Ie(n,l)}else if(it(n)){if(a===t.length-2)break;const c=+o,f=+t[++a]==0?"key":"value",d=Ie(n,c);switch(f){case"key":n=d;break;case"value":n=n.get(d);break}}}const r=t[t.length-1];if(Te(n)?n[+r]=s(n[+r]):at(n)&&(n[r]=s(n[r])),ot(n)){const a=Ie(n,+r),o=s(a);a!==o&&(n.delete(a),n.add(o))}if(it(n)){const a=+t[t.length-2],o=Ie(n,a);switch(+r==0?"key":"value"){case"key":{const c=s(o);n.set(c,n.get(o)),c!==o&&n.delete(o);break}case"value":{n.set(o,s(n.get(o)));break}}}return e};function as(e,t,s=[]){if(!e)return;if(!Te(e)){$e(e,(a,o)=>as(a,t,[...s,...tt(o)]));return}const[n,r]=e;r&&$e(r,(a,o)=>{as(a,t,[...s,...tt(o)])}),t(n,s)}function To(e,t,s){return as(t,(n,r)=>{e=rs(e,r,a=>po(a,n,s))}),e}function Ao(e,t){function s(n,r){const a=yo(e,tt(r));n.map(tt).forEach(o=>{e=rs(e,o,()=>a)})}if(Te(t)){const[n,r]=t;n.forEach(a=>{e=rs(e,tt(a),()=>e)}),r&&$e(r,s)}else $e(t,s);return e}var So=(e,t)=>at(e)||Te(e)||it(e)||ot(e)||Fn(e,t);function Po(e,t,s){const n=s.get(e);n?n.push(t):s.set(e,[t])}function xo(e,t){const s={};let n;return e.forEach(r=>{if(r.length<=1)return;t||(r=r.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[a,...o]=r;a.length===0?n=o.map(Zt):s[Zt(a)]=o.map(Zt)}),n?ns(s)?[n]:[n,s]:ns(s)?void 0:s}var Qn=(e,t,s,n,r=[],a=[],o=new Map)=>{const l=co(e);if(!l){Po(e,r,t);const g=o.get(e);if(g)return n?{transformedValue:null}:g}if(!So(e,s)){const g=Ms(e,s),T=g?{transformedValue:g.value,annotations:[g.type]}:{transformedValue:e};return l||o.set(e,T),T}if(Nt(a,e))return{transformedValue:null};const c=Ms(e,s),f=(c==null?void 0:c.value)??e,d=Te(f)?[]:{},u={};$e(f,(g,T)=>{if(T==="__proto__"||T==="constructor"||T==="prototype")throw new Error(`Detected property ${T}. This is a prototype pollution risk, please remove it from your object.`);const _=Qn(g,t,s,n,[...r,T],[...a,e],o);d[T]=_.transformedValue,Te(_.annotations)?u[T]=_.annotations:at(_.annotations)&&$e(_.annotations,(w,M)=>{u[Rn(T)+"."+M]=w})});const E=ns(u)?{transformedValue:d,annotations:c?[c.type]:void 0}:{transformedValue:d,annotations:c?[c.type,u]:u};return l||o.set(e,E),E};function zn(e){return Object.prototype.toString.call(e).slice(8,-1)}function Us(e){return zn(e)==="Array"}function _o(e){if(zn(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function wo(e,t,s,n,r){const a={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=s),r&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:s,enumerable:!1,writable:!0,configurable:!0})}function is(e,t={}){if(Us(e))return e.map(r=>is(r,t));if(!_o(e))return e;const s=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...s,...n].reduce((r,a)=>{if(Us(t.props)&&!t.props.includes(a))return r;const o=e[a],l=is(o,t);return wo(r,a,l,e,t.nonenumerable),r},{})}var B=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Ji,this.symbolRegistry=new kn(t=>t.description??""),this.customTransformerRegistry=new eo,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,s=Qn(e,t,this,this.dedupe),n={json:s.transformedValue};s.annotations&&(n.meta={...n.meta,values:s.annotations});const r=xo(t,this.dedupe);return r&&(n.meta={...n.meta,referentialEqualities:r}),n}deserialize(e){const{json:t,meta:s}=e;let n=is(t);return s!=null&&s.values&&(n=To(n,s.values,this)),s!=null&&s.referentialEqualities&&(n=Ao(n,s.referentialEqualities)),n}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)}};B.defaultInstance=new B;B.serialize=B.defaultInstance.serialize.bind(B.defaultInstance);B.deserialize=B.defaultInstance.deserialize.bind(B.defaultInstance);B.stringify=B.defaultInstance.stringify.bind(B.defaultInstance);B.parse=B.defaultInstance.parse.bind(B.defaultInstance);B.registerClass=B.defaultInstance.registerClass.bind(B.defaultInstance);B.registerSymbol=B.defaultInstance.registerSymbol.bind(B.defaultInstance);B.registerCustom=B.defaultInstance.registerCustom.bind(B.defaultInstance);B.allowErrorProps=B.defaultInstance.allowErrorProps.bind(B.defaultInstance);var $n=B.serialize,vo=B.stringify;function bo(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Co(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Io({queryState:e,observerCount:t,isStale:s}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":s?"yellow":"green":"gray"}function Lo({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function No(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var jo=(e,t=!1)=>{const{json:s}=$n(e);return JSON.stringify(s,null,t?2:void 0)},vt=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,Go=(e,t)=>e.queryHash.localeCompare(t.queryHash),Wn=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,ko=(e,t)=>vt(e)===vt(t)?Wn(e,t):vt(e)>vt(t)?1:-1,Oo={status:ko,"query hash":Go,"last updated":Wn},bt=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Yn=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,Do=(e,t)=>bt(e)===bt(t)?Yn(e,t):bt(e)>bt(t)?1:-1,Ro={status:Do,"last updated":Yn},Mo=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),Uo=()=>{const[e,t]=K("dark");return En(()=>{const s=window.matchMedia("(prefers-color-scheme: dark)");t(s.matches?"dark":"light");const n=r=>{t(r.matches?"dark":"light")};s.addEventListener("change",n),ze(()=>s.removeEventListener("change",n))}),e},Ze=(e,t,s)=>{if(t.length===0)return s;if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.set(t[0],s),n;const[r,...a]=t;return n.set(r,Ze(n.get(r),a,s)),n}if(e instanceof Set){const n=Ze(Array.from(e),t,s);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n[t[0]]=s,n;const[r,...a]=t;return n[r]=Ze(n[r],a,s),n}if(e instanceof Object){const n={...e};if(t.length===1)return n[t[0]]=s,n;const[r,...a]=t;return n[r]=Ze(n[r],a,s),n}return e},Xe=(e,t)=>{if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.delete(t[0]),s;const[n,...r]=t;return s.set(n,Xe(s.get(n),r)),s}if(e instanceof Set){const s=Xe(Array.from(e),t);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s.filter((a,o)=>o.toString()!==t[0]);const[n,...r]=t;return s[n]=Xe(s[n],r),s}if(e instanceof Object){const s={...e};if(t.length===1)return delete s[t[0]],s;const[n,...r]=t;return s[n]=Xe(s[n],r),s}return e},Jn=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const n=document.createElement("style"),r=document.createTextNode("");n.appendChild(r),n.id="_goober",n.setAttribute("nonce",e),t?t.appendChild(n):document.head.appendChild(n)},Le,lt,ct,ut,xe,dt,Ne,je,Ge,ke,Oe,ft,De,Re,ht,qs,Bo=(qs=class{constructor(e){R(this,Le);R(this,lt);R(this,ct);R(this,ut);R(this,xe,!1);R(this,dt);R(this,Ne);R(this,je);R(this,Ge);R(this,ke);R(this,Oe);R(this,ft);R(this,De);R(this,Re);R(this,ht);const{client:t,queryFlavor:s,version:n,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:c,styleNonce:f,shadowDOMTarget:d,hideDisabledQueries:u,theme:E}=e;O(this,Le,K(t)),O(this,ct,s),O(this,ut,n),O(this,lt,r),O(this,dt,f),O(this,Ne,d),O(this,je,K(a)),O(this,Ge,K(o)),O(this,ke,K(l)),O(this,Oe,K(c)),O(this,ft,K(u)),O(this,Re,K(E))}setButtonPosition(e){P(this,je)[1](e)}setPosition(e){P(this,Ge)[1](e)}setInitialIsOpen(e){P(this,ke)[1](e)}setErrorTypes(e){P(this,Oe)[1](e)}setClient(e){P(this,Le)[1](e)}setTheme(e){P(this,Re)[1](e)}mount(e){if(P(this,xe))throw new Error("Devtools is already mounted");const t=vn(()=>{const s=this,[n]=P(this,je),[r]=P(this,Ge),[a]=P(this,ke),[o]=P(this,Oe),[l]=P(this,ft),[c]=P(this,Le),[f]=P(this,Re);let d;return P(this,De)?d=P(this,De):(d=_n(()=>Promise.resolve().then(()=>require("./WDYDFRGG-BTj8AXV6.cjs"))),O(this,De,d)),Jn(P(this,dt),P(this,Ne)),As(d,Ss({get queryFlavor(){return P(s,ct)},get version(){return P(s,ut)},get onlineManager(){return P(s,lt)},get shadowDOMTarget(){return P(s,Ne)}},{get client(){return c()},get buttonPosition(){return n()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()},get hideDisabledQueries(){return l()},get theme(){return f()}}))},e);O(this,xe,!0),O(this,ht,t)}unmount(){var e;if(!P(this,xe))throw new Error("Devtools is not mounted");(e=P(this,ht))==null||e.call(this),O(this,xe,!1)}},Le=new WeakMap,lt=new WeakMap,ct=new WeakMap,ut=new WeakMap,xe=new WeakMap,dt=new WeakMap,Ne=new WeakMap,je=new WeakMap,Ge=new WeakMap,ke=new WeakMap,Oe=new WeakMap,ft=new WeakMap,De=new WeakMap,Re=new WeakMap,ht=new WeakMap,qs),Me,gt,mt,Et,_e,pt,Ue,Be,Fe,qe,Ke,yt,Ve,He,Qe,Tt,Ks,Fo=(Ks=class{constructor(e){R(this,Me);R(this,gt);R(this,mt);R(this,Et);R(this,_e,!1);R(this,pt);R(this,Ue);R(this,Be);R(this,Fe);R(this,qe);R(this,Ke);R(this,yt);R(this,Ve);R(this,He);R(this,Qe);R(this,Tt);const{client:t,queryFlavor:s,version:n,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:c,styleNonce:f,shadowDOMTarget:d,onClose:u,hideDisabledQueries:E,theme:g}=e;O(this,Me,K(t)),O(this,mt,s),O(this,Et,n),O(this,gt,r),O(this,pt,f),O(this,Ue,d),O(this,Be,K(a)),O(this,Fe,K(o)),O(this,qe,K(l)),O(this,Ke,K(c)),O(this,yt,K(E)),O(this,Ve,K(u)),O(this,Qe,K(g))}setButtonPosition(e){P(this,Be)[1](e)}setPosition(e){P(this,Fe)[1](e)}setInitialIsOpen(e){P(this,qe)[1](e)}setErrorTypes(e){P(this,Ke)[1](e)}setClient(e){P(this,Me)[1](e)}setOnClose(e){P(this,Ve)[1](()=>e)}setTheme(e){P(this,Qe)[1](e)}mount(e){if(P(this,_e))throw new Error("Devtools is already mounted");const t=vn(()=>{const s=this,[n]=P(this,Be),[r]=P(this,Fe),[a]=P(this,qe),[o]=P(this,Ke),[l]=P(this,yt),[c]=P(this,Me),[f]=P(this,Ve),[d]=P(this,Qe);let u;return P(this,He)?u=P(this,He):(u=_n(()=>Promise.resolve().then(()=>require("./2SSKDMRQ-DDOgISWg.cjs"))),O(this,He,u)),Jn(P(this,pt),P(this,Ue)),As(u,Ss({get queryFlavor(){return P(s,mt)},get version(){return P(s,Et)},get onlineManager(){return P(s,gt)},get shadowDOMTarget(){return P(s,Ue)}},{get client(){return c()},get buttonPosition(){return n()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()},get hideDisabledQueries(){return l()},get onClose(){return f()},get theme(){return d()}}))},e);O(this,_e,!0),O(this,Tt,t)}unmount(){var e;if(!P(this,_e))throw new Error("Devtools is not mounted");(e=P(this,Tt))==null||e.call(this),O(this,_e,!1)}},Me=new WeakMap,gt=new WeakMap,mt=new WeakMap,Et=new WeakMap,_e=new WeakMap,pt=new WeakMap,Ue=new WeakMap,Be=new WeakMap,Fe=new WeakMap,qe=new WeakMap,Ke=new WeakMap,yt=new WeakMap,Ve=new WeakMap,He=new WeakMap,Qe=new WeakMap,Tt=new WeakMap,Ks);function qo(e){const t=S.useQueryClient(e.client),s=Q.useRef(null),{buttonPosition:n,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:c,hideDisabledQueries:f,theme:d}=e,[u]=Q.useState(new Bo({client:t,queryFlavor:"React Query",version:"5",onlineManager:S.onlineManager,buttonPosition:n,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:c,hideDisabledQueries:f,theme:d}));return Q.useEffect(()=>{u.setClient(t)},[t,u]),Q.useEffect(()=>{n&&u.setButtonPosition(n)},[n,u]),Q.useEffect(()=>{r&&u.setPosition(r)},[r,u]),Q.useEffect(()=>{u.setInitialIsOpen(a||!1)},[a,u]),Q.useEffect(()=>{u.setErrorTypes(o||[])},[o,u]),Q.useEffect(()=>{u.setTheme(d)},[d,u]),Q.useEffect(()=>(s.current&&u.mount(s.current),()=>{u.unmount()}),[u]),i.jsx("div",{dir:"ltr",className:"tsqd-parent-container",ref:s})}function Ko(e){const t=S.useQueryClient(e.client),s=Q.useRef(null),{errorTypes:n,styleNonce:r,shadowDOMTarget:a,hideDisabledQueries:o,theme:l}=e,[c]=Q.useState(new Fo({client:t,queryFlavor:"React Query",version:"5",onlineManager:S.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:n,styleNonce:r,shadowDOMTarget:a,onClose:e.onClose,hideDisabledQueries:o,theme:l}));return Q.useEffect(()=>{c.setClient(t)},[t,c]),Q.useEffect(()=>{c.setOnClose(e.onClose??(()=>{}))},[e.onClose,c]),Q.useEffect(()=>{c.setErrorTypes(n||[])},[n,c]),Q.useEffect(()=>{c.setTheme(l)},[l,c]),Q.useEffect(()=>(s.current&&c.mount(s.current),()=>{c.unmount()}),[c]),i.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:s})}var Bs=process.env.NODE_ENV!=="development"?function(){return null}:qo;process.env.NODE_ENV;const Zn=H.atom(""),Vo=()=>{L.registerChaiFeatureFlag("dynamic-page-selector",{description:"Dynamic page selector"}),L.registerChaiFeatureFlag("enable-add-page-dropdown",{description:"Enable add page dropdown"})},Ho=()=>{const e=N(),t=j();return S.useQuery({queryKey:[y.GET_COLLECTIONS],staleTime:1/0,queryFn:async()=>t(e,{action:y.GET_COLLECTIONS})})},Qo=()=>{const{data:e}=te(),{data:t}=ge(),{data:s}=Se(),n=N(),r=j(),a=h.useMemo(()=>(s==null?void 0:s.fallbackLang)||"en",[s==null?void 0:s.fallbackLang]),o=h.useRef(new Map);return S.useMutation({mutationFn:async({block:l})=>{const c=l._id,f=(t==null?void 0:t.lang)||a,d=`${c}:${f}`;if(o.current.has(d))return o.current.get(d);const u=r(n,{action:y.GET_BLOCK_ASYNC_PROPS,data:{block:l,lang:f,pageProps:{slug:t==null?void 0:t.slug,searchParams:{},pageType:t==null?void 0:t.pageType,fallbackLang:a,lastSaved:t.lastSaved,pageId:e.id,primaryPageId:t.primaryPage||e.id,pageBaseSlug:t==null?void 0:t.slug,dynamic:e==null?void 0:e.dynamic,languagePageId:t.id}}});return o.current.set(d,u),u.finally(()=>{o.current.delete(d)}),u}})},Xn=()=>{const[,e]=le();return h.useCallback((t,s)=>{const r=new URLSearchParams(window.location.search).get("lang"),a=new URLSearchParams({page:t});r&&a.set("lang",r),window.history.pushState({},"",`?${a.toString()}`),e(a),window.dispatchEvent(new PopStateEvent("popstate")),s==null||s()},[e])},er=()=>{const e=Xn();return h.useCallback(({pageId:t})=>{e(t)},[e])},zo={SITE_WIDE_USAGE:"SITE_WIDE_USAGE"},$o=e=>{const t=j(),s=N();return S.useQuery({queryKey:[zo.SITE_WIDE_USAGE],queryFn:async()=>e?t(s,{action:"GET_SITE_WIDE_USAGE"}):{},retry:!1})},Wo=h.lazy(()=>Promise.resolve().then(()=>require("./page-lock-D2iFZDUK.cjs"))),Yo=h.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-dialog-BC8NHzK2.cjs"))),Jo=h.lazy(()=>Promise.resolve().then(()=>require("./digital-asset-manager-DDk2ucTE.cjs"))),Zo=h.lazy(()=>Promise.resolve().then(()=>require("./save-to-lib-DGAdSa-0.cjs"))),Xo=h.lazy(()=>Promise.resolve().then(()=>require("./theme-panel-footer-CWZ0qs13.cjs"))),el=h.lazy(()=>Promise.resolve().then(()=>require("./web-preview-wRgRY3Tv.cjs")));Vo();mr.loadWebBlocks();L.registerChaiTopBar(wa);Za();L.registerChaiMediaManager(Jo);L.registerChaiSaveToLibrary(Zo);const tl={role:"",permissions:null},Fs=e=>{var _s;const{data:t}=Da(),s=Kt(),{data:n=tl,isFetching:r}=an(),{data:a,isFetching:o}=me(),{data:l,isFetching:c}=Ho(),{data:f,isFetching:d}=Se(),u=r||o||c||d;Ra();const[E]=le(),g=E.get("page"),{data:T}=te(),{data:_,isFetching:w}=Ia(),{blocks:M}=Ca(_),{data:A,isFetching:C}=nn(),{pageStatus:I}=ne(),q=va(),{onSave:G}=Ma(),{mutateAsync:ce}=Qo(),{getPartialBlocks:ue,getPartialBlockBlocks:V}=Ua(),{mutateAsync:b}=Cr(),{mutateAsync:k}=rn(),{data:W}=$o(((_s=e.flags)==null?void 0:_s.designTokens)??!1),z=er(),[re,Pt]=h.useState(!1),de=h.useRef([]),be=h.useMemo(()=>p.get(f,"theme",{})||{},[f]),Pe=I===J.EDITING,sr=I===J.CHECKING,Ps=w||sr||C;de.current=M;const[nr]=H.useAtom(Zn);h.useEffect(()=>{const ee=()=>{document.hidden?Pt(!0):Pt(!1)};return window.addEventListener("visibilitychange",ee),()=>window.removeEventListener("visibilitychange",ee)},[]);const rr=h.useMemo(()=>{const ee={};return n&&(ee.permissions=p.get(n,"permissions",null),ee.role=p.get(n,"role","user")),ee},[n]),xs=h.useMemo(()=>t==null?void 0:t.some(ee=>ee.isSiteLibrary),[t]),ar=h.useCallback(async(ee,xt)=>await b({pageType:ee,query:xt}),[b]);return i.jsxs(i.Fragment,{children:[Ps&&i.jsx(ms,{className:u?"fixed inset-0 bg-white":"bg-white/75",children:i.jsx(x.Loader,{className:`animate-spin text-primary ${u?"h-6 w-6":"h-5 w-5"}`})}),nr&&i.jsx(h.Suspense,{fallback:i.jsx("div",{className:"absolute inset-0 z-[999999] flex min-h-screen w-screen items-center justify-center bg-gray-100",children:i.jsx(x.Loader,{className:"h-6 w-6 animate-spin text-primary"})}),children:i.jsx(el,{})}),i.jsx(m.ChaiBuilderEditor,{siteWideUsage:W??{},flags:e.flags?{...e.flags,librarySite:xs}:{librarySite:xs},gotoPage:z,collections:l??[],getBlockAsyncProps:ce,pageExternalData:A,themePresets:e.themePresets??[],pageId:T==null?void 0:T.id,loading:w,fallbackLang:s,languages:(f==null?void 0:f.languages)||[],brandingOptions:(f==null?void 0:f.theme)||{},designTokens:(f==null?void 0:f.designTokens)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSave:!re&&Pe&&(e.autoSave??!0),autoSaveActionsCount:e.autoSaveActionsCount??10,onError:e.onError||console.error,getPartialBlockBlocks:V,getPartialBlocks:ue,blocks:w?[]:M,theme:p.cloneDeep(be),pageTypes:a,searchPageTypeItems:ar,askAiCallBack:q,onSave:async({blocks:ee,theme:xt,needTranslations:ir,designTokens:ws})=>{if(!g)return!0;de.current=ee;const vs=[...ee];await G({page:g,blocks:vs,needTranslations:ir}),de.current=vs;const _t={};return p.isEqual(xt,be)||(_t.theme=xt),p.isEqual(ws,f==null?void 0:f.designTokens)||(_t.designTokens=ws),p.isEmpty(_t)||await k({settings:_t}),!0},themePanelComponent:Xo,...rr,children:i.jsx(Wo,{isFetchingPageData:Ps})}),i.jsx("div",{children:i.jsx(Yo,{})})]})},sl=new S.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1,refetchOnMount:!1}}}),nl=e=>{const[,t]=Ft(),[s,n]=h.useState(!1);return h.useEffect(()=>(t(p.pick(e,["apiUrl","usersApiUrl","assetsApiUrl","getPreviewUrl","getLiveUrl","topLeftCorner","onLogout","getAccessToken","websocket","getLoggedInUser","features","currentUser"])),setTimeout(()=>{n(!0)},200),()=>{n(!1),t({})}),[e,t]),s?p.get(e,"hasReactQueryProvider",!1)===!0?i.jsxs(i.Fragment,{children:[i.jsx(Fs,{...e}),i.jsx(Bs,{})]}):i.jsxs(S.QueryClientProvider,{client:sl,children:[i.jsx(Fs,{...e}),i.jsx(Bs,{})]}):i.jsx("div",{})},rl=Q.lazy(()=>Promise.resolve().then(()=>require("./nested-path-selector-content-SmfjElr-.cjs")));function tr({data:e,onSelect:t,dataType:s="value",disabled:n=!1}){const[r,a]=Q.useState(!1);return i.jsxs(m.Popover,{open:r,onOpenChange:a,children:[i.jsxs(m.Tooltip,{children:[i.jsx(m.TooltipTrigger,{asChild:!0,children:i.jsx(m.PopoverTrigger,{asChild:!0,children:i.jsx(L.Button,{size:"sm",variant:"outline",className:"h-6 w-6 px-1 py-0 text-[9px] text-muted-foreground",role:"combobox","aria-expanded":r,disabled:n,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24px",height:"24px",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M9.5 5H9C7.89543 5 7 5.89543 7 7V9C7 10 6.4 12 4 12C5 12 7 12.6 7 15V17.0002C7 18.1048 7.89543 19 9 19H9.5M14.5 5H15C16.1046 5 17 5.89543 17 7V9C17 10 17.6 12 20 12C19 12 17 12.6 17 15V17.0002C17 18.1048 16.1046 19 15 19H14.5",stroke:"#000000",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})})})}),i.jsx(m.TooltipContent,{children:"Add field"})]}),r&&i.jsx(Q.Suspense,{children:i.jsx(rl,{data:e,onSelect:t,dataType:s,open:r,setOpen:a})})]})}const al=()=>{const{savePageAsync:e}=m.useSavePage(),t=S.useQueryClient(),{isLocked:s}=ne();return h.useCallback(async()=>{s||await e(),t.invalidateQueries({queryKey:[y.GET_DRAFT_PAGE]}),t.invalidateQueries({queryKey:[y.GET_BUILDER_PAGE_DATA]})},[e,t,s])},il=()=>{const e=S.useQueryClient();return h.useCallback(()=>{e.clear()},[e])},ol=()=>{const e=N(),t=j(),{data:s}=ge(),n=S.useQueryClient();return S.useMutation({mutationFn:async r=>{if(!(s!=null&&s.id))throw new Error("No active page found");return await t(`${e}`,{action:y.UPDATE_PAGE_METADATA,data:{id:s.id,metadata:r}})},onSuccess:()=>{n.invalidateQueries({queryKey:[y.GET_BUILDER_PAGE_DATA]}),n.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES]})},onError:()=>{console.error("Failed to update metadata")}})},ll=h.lazy(()=>Promise.resolve().then(()=>require("./digital-asset-manager-DDk2ucTE.cjs"))),cl=({assetId:e,assetUrl:t,onChange:s,className:n="",placeholder:r="Select an image",disabled:a=!1})=>{const{t:o}=he.useTranslation(),[l,c]=h.useState(!1),f=()=>{a||c(!0)},d=()=>{c(!1)},u=T=>{const _=Array.isArray(T)?T[0]:T;_!=null&&_.url&&s(p.pick(_,["url","id"])),c(!1)},E=()=>{s({url:"",id:""})},g=(t==null?void 0:t.startsWith("{{"))&&(t==null?void 0:t.endsWith("}}"));return i.jsxs("div",{className:`w-full ${n}`,children:[t?i.jsxs("div",{className:"relative overflow-hidden rounded-md border",children:[g?i.jsx("div",{className:"flex h-12 items-center bg-gray-100 px-4",children:i.jsx("p",{className:"text-xs text-gray-500",children:t})}):i.jsx("img",{onClick:f,src:t,alt:o("Selected image"),className:"h-auto max-h-[100px] w-full bg-gray-100 object-contain"}),i.jsxs("div",{className:"absolute right-2 top-2 flex gap-2",children:[i.jsx(L.Button,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 rounded-full bg-white text-red-500",onClick:E,disabled:a,children:g?i.jsx(x.X,{className:"h-4 w-4"}):i.jsx(x.Trash2,{className:"h-4 w-4"})}),!g&&i.jsx(L.Button,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 rounded-full bg-white/80 hover:bg-white/90",onClick:f,disabled:a,children:i.jsx(x.ImageIcon,{className:"h-4 w-4"})})]})]}):i.jsx("div",{className:`flex cursor-pointer items-center justify-center rounded-md border border-dashed p-6 ${a?"cursor-not-allowed opacity-50":"hover:border-gray-400"}`,onClick:f,children:i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx(x.ImageIcon,{className:"h-10 w-10 text-gray-400"}),i.jsx("p",{className:"text-sm text-gray-500",children:r})]})}),i.jsx(m.Dialog,{open:l,onOpenChange:c,children:i.jsxs(m.DialogContent,{className:"h-fit w-full max-w-7xl overflow-hidden p-0",children:[i.jsxs(m.DialogHeader,{className:"hidden border-b px-4 py-2",children:[i.jsx(m.DialogTitle,{children:o("Select Image")}),i.jsx(L.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-4 top-2",onClick:d,children:i.jsx(x.X,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"h-full flex-1 p-4",children:i.jsx(h.Suspense,{children:i.jsx(ll,{close:d,onSelect:u,mode:"image",assetId:e})})})]})})]})},ul=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),os=e=>{if(!e.trim())return{isValid:!1,parsed:null,placeholders:[],error:{message:"JSON is empty"}};try{return{isValid:!0,parsed:JSON.parse(e),error:null,placeholders:[]}}catch{}const t=/{{([^{}]+)}}/g,s=[];let n=e,r;for(;(r=t.exec(e))!==null;){const a=r[0],o=r.index,l=`"__placeholder_${s.length}__"`;s.push({original:a,replaced:l,position:o}),n=n.replace(a,l)}try{return{isValid:!0,parsed:JSON.parse(n),error:null,placeholders:s}}catch(a){const o=a,l=o.message.match(/position (\d+)/),c=l?parseInt(l[1]):void 0;let f,d;if(c!==void 0){const u=n.substring(0,c).split(`
|
|
2
|
-
`);f=u.length,d=u[u.length-1].length+1}return{isValid:!1,parsed:null,placeholders:s,error:{message:o.message,line:f,column:d,position:c}}}},dl=(e,t)=>{let n=JSON.stringify(e,null,2);return t.forEach(({original:r},a)=>{const o=`"__placeholder_${a}__"`,l=new RegExp(ul(o),"g");n=n.replace(l,r)}),n},fl=(e,t)=>{if(!e)return"";let s=JSON.stringify(e,null,2);const n=/{{([^{}]+)}}/g;let r;for(;(r=n.exec(s))!==null;){const a=r[1],o=p.get(t,a,null);s=s.replace(r[0],o)}return s},hl=h.lazy(()=>Promise.resolve().then(()=>require("./shared-json-ld-DoRgzDPC.cjs"))),gl=({value:e,onChange:t,disabled:s=!1,readOnly:n=!1,placeholder:r="Enter JSON",rows:a=6,id:o="json-input",pageData:l={},handleFieldInsert:c,hasJsonLdForSelectedLang:f,copyJsonLDFromDefaultPage:d})=>{const[u,E]=h.useState("edit"),[g,T]=h.useState(null),[_,w]=h.useState(""),M=h.useRef(null),[A]=Ft(),C=o==="jsonLD"&&p.get(A,"features.sharedJsonLD",!1),I=o==="jsonLD"&&!f&&!!d;h.useEffect(()=>{e.trim()===""&&t("{}")},[e,t]);const q=V=>{if(n)return;const b=V.target.value;t(b)},G=V=>{if(V.key==="Tab"){V.preventDefault();const b=V.currentTarget,k=b.selectionStart,W=b.selectionEnd;if(k!==W){const re=e.substring(k,W).split(`
|
|
3
|
-
`);if(V.shiftKey){const de=re.map(Pe=>Pe.startsWith(" ")?Pe.substring(2):Pe).join(`
|
|
4
|
-
`),be=e.substring(0,k)+de+e.substring(W);t(be),setTimeout(()=>{b.selectionStart=k,b.selectionEnd=k+de.length},0)}else{const de=re.map(Pe=>` ${Pe}`).join(`
|
|
5
|
-
`),be=e.substring(0,k)+de+e.substring(W);t(be),setTimeout(()=>{b.selectionStart=k,b.selectionEnd=k+de.length},0)}}else{const z=e.substring(0,k)+" "+e.substring(W);t(z),setTimeout(()=>{b.selectionStart=b.selectionEnd=k+2},0)}}};h.useEffect(()=>{const V=os(e);V.isValid?h.startTransition(()=>{if(T(null),V.parsed){const b=fl(V.parsed,l);w(b)}else w("")}):h.startTransition(()=>{T(V.error),w("")})},[e,l]);const ce=()=>{const V=os(e);if(V.isValid&&V.parsed){const b=dl(V.parsed,V.placeholders);t(b)}},ue=()=>{g!=null&&g.position&&M.current&&(M.current.focus(),M.current.setSelectionRange(g.position,g.position+1))};return i.jsx(Er.ErrorBoundary,{fallback:i.jsx("div",{children:"Some error"}),children:i.jsx("div",{className:"space-y-2",children:i.jsxs(m.Tabs,{value:u,onValueChange:E,className:"w-full",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsxs(m.TabsList,{className:"w-max",children:[i.jsxs(m.TabsTrigger,{value:"edit",className:"flex items-center gap-1",children:[i.jsx(x.Code,{className:"h-4 w-4"}),i.jsx("span",{children:"Edit"})]}),i.jsxs(m.TabsTrigger,{value:"preview",className:"flex items-center gap-1",disabled:!e.trim()||g!==null||I,children:[i.jsx(x.Eye,{className:"h-4 w-4"}),i.jsx("span",{children:"Preview"})]}),C&&i.jsxs(m.TabsTrigger,{value:"shared",className:"flex items-center gap-1",disabled:!e.trim()||g!==null,children:[i.jsx(x.Share2,{className:"h-4 w-4"}),i.jsx("span",{children:"Shared"})]})]}),I?null:u==="edit"&&!n&&i.jsx("div",{className:"flex items-center gap-2",children:i.jsx(tr,{dataType:"value",data:l??{},onSelect:V=>c&&c(V,o)})})]}),i.jsxs(m.TabsContent,{value:"edit",className:"relative mt-0",children:[!I&&u==="edit"&&i.jsx(Vt,{content:"Format JSON",side:"right",showTooltip:!s&&!g,children:i.jsx(L.Button,{type:"button",variant:"outline",size:"icon",onClick:ce,className:"absolute right-1 top-1 h-6 w-6 p-1",disabled:!e.trim()||s||g!==null,children:i.jsx(x.FileCode2,{})})}),I?i.jsx("div",{className:"flex h-40 items-center justify-center rounded-md bg-black/20",children:i.jsxs("div",{className:"flex max-w-[400px] flex-col items-center gap-2 rounded-md bg-white p-4 shadow-lg",children:[i.jsx("div",{className:"max-w-xl text-center text-xs text-gray-500",children:"JSON-LD for is not added for selected language. JSON LD will be used from default language."}),i.jsxs(L.Button,{type:"button",variant:"default",size:"sm",onClick:d,children:[i.jsx(x.Plus,{}),"Copy & Edit from default language"]})]})}):i.jsx(m.Textarea,{ref:M,id:o,name:o,className:`rounded-md border border-input text-xs ${g?"border-red-500":""}`,onChange:q,onKeyDown:G,value:e,placeholder:r,rows:a,disabled:s,readOnly:n}),g&&i.jsxs(L.Alert,{variant:"destructive",className:"mt-2",children:[i.jsx(x.AlertTriangle,{className:"h-4 w-4"}),i.jsxs(L.AlertDescription,{className:"flex flex-col",children:[i.jsx("span",{className:"font-medium",children:"Invalid JSON"}),i.jsx("span",{className:"text-sm",children:g.message}),g.line&&g.column&&i.jsxs("span",{className:"text-sm",children:["Error at line ",g.line,", column ",g.column]}),i.jsx(L.Button,{type:"button",variant:"link",size:"sm",className:"mt-1 h-auto self-start p-0 text-sm",onClick:ue,children:"Show position"})]})]})]}),i.jsxs(m.TabsContent,{value:"preview",className:"mt-0",children:[i.jsx(m.Textarea,{rows:a,value:_,readOnly:!0,className:"cursor-default bg-muted font-mono text-sm"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This is how the JSON will look after placeholder substitution."})]}),C&&i.jsx(m.TabsContent,{value:"shared",className:"mt-0",children:i.jsx(h.Suspense,{children:i.jsx(hl,{})})})]})})})},ml=e=>{const t=N(),s=j();return S.useQuery({queryKey:[y.GET_CHAI_USER,e],queryFn:async()=>{const r=await s(t,{action:y.GET_CHAI_USER,data:{userId:e}});return{...r,name:r.name||r.email}},enabled:!p.isEmpty(e),staleTime:"static"})};if(typeof window>"u")throw new Error("@chaibuilder/pages is not available on the server");exports.$TRACK=ps;exports.ACTIONS=y;exports.BlurContainer=ms;exports.ChaiWebsiteBuilder=nl;exports.Dynamic=Wi;exports.EVENT=X;exports.For=Ai;exports.ImagePicker=cl;exports.Index=Si;exports.LANGUAGES=Ye;exports.LanguageSwitcher=en;exports.Match=_i;exports.NestedPathSelector=tr;exports.PAGES_PERMISSIONS=se;exports.PAGE_STATUS=J;exports.PageActionsDropdown=Ws;exports.PermissionChecker=Ct;exports.Portal=zi;exports.Show=Pi;exports.SmartJsonInput=gl;exports.Switch=xi;exports.Tooltip=Vt;exports.addEventListener=In;exports.addNewLangAtom=st;exports.batch=ni;exports.className=Cn;exports.clearDelegatedEvents=Ri;exports.convertRemToPixels=Mo;exports.createComponent=As;exports.createComputed=mn;exports.createContext=li;exports.createEffect=ys;exports.createMemo=$;exports.createRenderEffect=ye;exports.createRoot=pe;exports.createSignal=K;exports.createUniqueId=Ti;exports.delegateEvents=bn;exports.deleteNestedDataByPath=Xe;exports.displayValue=jo;exports.getMutationStatusColor=Lo;exports.getPreferredColorScheme=Uo;exports.getQueryStatusColor=Io;exports.getQueryStatusColorByLabel=No;exports.getQueryStatusLabel=bo;exports.getSidedProp=Co;exports.insert=Bt;exports.memo=ki;exports.mergeProps=Ss;exports.mutationSortFns=Ro;exports.navigateToPage=gs;exports.on=ri;exports.onCleanup=ze;exports.onMount=En;exports.parseJSONWithPlaceholders=os;exports.previewUrlAtom=Zn;exports.serialize=$n;exports.setAttribute=Ut;exports.sortFns=Oo;exports.splitProps=xn;exports.spread=Ln;exports.stringify=vo;exports.template=Di;exports.throwConfetti=It;exports.untrack=Y;exports.updateNestedDataByPath=Ze;exports.use=Nn;exports.useActivePage=ge;exports.useAddGlobalSchema=La;exports.useApiUrl=N;exports.useApplySchemaToAllPages=ka;exports.useBuilderFetch=Ar;exports.useBuilderPageData=nn;exports.useChaiAuth=qt;exports.useChaiCurrentPage=te;exports.useChaiUserInfo=ml;exports.useChaibuilderRealtime=Ur;exports.useChangePage=Xn;exports.useChangeSlug=ca;exports.useClearAll=il;exports.useContext=ci;exports.useCreatePage=na;exports.useCurrentPageOwner=Js;exports.useDeleteGlobalSchema=ja;exports.useDeletePage=aa;exports.useDynamicPageSelector=zs;exports.useFallbackLang=Kt;exports.useFetch=j;exports.useGotoPage=er;exports.useIsLanguagePageCreated=tn;exports.useLanguagePages=Ae;exports.useMarkAsTemplate=oa;exports.usePageEditInfo=cs;exports.usePageLockMeta=ds;exports.usePageLockStatus=ne;exports.usePageToUser=us;exports.usePageType=$s;exports.usePageTypes=me;exports.usePagesProps=Ft;exports.usePublishPages=Es;exports.useReloadPage=al;exports.useRemoveSchemaFromAllPages=Oa;exports.useSearchParams=le;exports.useSendRealtimeEvent=Zs;exports.useTogglePageGlobalSchema=Ga;exports.useTransition=oi;exports.useUnmarkAsTemplate=la;exports.useUnpublishPage=ia;exports.useUpdateActivePageMetadata=ol;exports.useUpdateGlobalSchema=Na;exports.useUpdatePage=ra;exports.useUpdateWebsiteSettings=rn;exports.useUserId=At;exports.useUserRoleAndPermissions=an;exports.useWebsiteLanguagePages=Br;exports.useWebsitePages=hs;exports.useWebsiteSetting=Se;
|
package/dist/index-Dxfyt4d4.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { keys as c, intersection as t, get as d, each as g, isEmpty as l, omit as h } from "lodash-es";
|
|
2
|
-
const i = "#styles:", y = (e) => {
|
|
3
|
-
const n = ["_type", "_id", "_parent", "_bindings", "_name"], o = ["$loading", "blockProps", "inBuilder", "lang", "draft", "pageProps", "pageData", "children"], r = c(e.properties);
|
|
4
|
-
if (t(r, n).length > 0)
|
|
5
|
-
throw new Error(`Reserved props are not allowed: ${t(r, n).join(", ")}`);
|
|
6
|
-
if (t(r, o).length > 0)
|
|
7
|
-
throw new Error(`Runtime props are not allowed in schema: ${t(r, o).join(", ")}`);
|
|
8
|
-
const s = d(e, "properties", {}), u = {};
|
|
9
|
-
return g(s, (a, p) => {
|
|
10
|
-
l(a.ui) || (u[p] = { ...a.ui }, delete s[p].ui);
|
|
11
|
-
}), {
|
|
12
|
-
schema: l(s) ? {} : { ...h(e, ["ui"]) },
|
|
13
|
-
uiSchema: { ...d(e, "ui", {}), ...u }
|
|
14
|
-
};
|
|
15
|
-
}, P = (e = "") => ({
|
|
16
|
-
type: "string",
|
|
17
|
-
styles: !0,
|
|
18
|
-
default: `${i},${e}`,
|
|
19
|
-
ui: { "ui:widget": "hidden" }
|
|
20
|
-
}), w = (e = "") => ({
|
|
21
|
-
type: "string",
|
|
22
|
-
styles: !0,
|
|
23
|
-
default: `${i},${e}`,
|
|
24
|
-
ui: { "ui:widget": "hidden" }
|
|
25
|
-
}), $ = (e) => (console.warn("runtimeProp is deprecated, use builderProp instead"), {
|
|
26
|
-
runtime: !0,
|
|
27
|
-
...e
|
|
28
|
-
}), f = (e) => ({
|
|
29
|
-
builderProp: !0,
|
|
30
|
-
...e
|
|
31
|
-
}), _ = (e) => `${i},${e}`;
|
|
32
|
-
export {
|
|
33
|
-
P as S,
|
|
34
|
-
$ as a,
|
|
35
|
-
f as b,
|
|
36
|
-
_ as d,
|
|
37
|
-
y as r,
|
|
38
|
-
w as s
|
|
39
|
-
};
|