@chaibuilder/sdk 1.2.25 → 1.2.26

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.
Files changed (182) hide show
  1. package/dist/AddBlocks-l1JENNvq.js +206 -0
  2. package/dist/AddBlocks-zPPKkeKs.cjs +1 -0
  3. package/dist/BrandingOptions-DkpqGARR.cjs +1 -0
  4. package/dist/{BrandingOptions-iTyWpwTs.js → BrandingOptions-udtH5yJs.js} +54 -40
  5. package/dist/{CanvasArea-dZjng782.js → CanvasArea-h0W-Tyha.js} +324 -340
  6. package/dist/CanvasArea-zme1r3Zi.cjs +55 -0
  7. package/dist/Class-PoYusiA5.cjs +1 -0
  8. package/dist/{Class-ahc3NIbq.js → Class-lGzsNBOK.js} +29 -26
  9. package/dist/CurrentPage-Hl52iub_.cjs +1 -0
  10. package/dist/{CurrentPage-Kmfp-kFk.js → CurrentPage-tJUjXWdb.js} +54 -40
  11. package/dist/Functions-7jnEwJyw.js +15 -0
  12. package/dist/Functions-N3yhPYKY.cjs +1 -0
  13. package/dist/ListTree-WvTjY5rr.cjs +1 -0
  14. package/dist/{ListTree-N3jeD790.js → ListTree-cZ-Ihlt3.js} +96 -86
  15. package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
  16. package/dist/{MODIFIERS-CNqNUapY.js → MODIFIERS-dytZ-osO.js} +4 -10
  17. package/dist/PagesPanel-6rrLXEO-.js +64 -0
  18. package/dist/PagesPanel-WzCocl6u.cjs +1 -0
  19. package/dist/ProjectPanel-o7gdcwPn.cjs +1 -0
  20. package/dist/ProjectPanel-tz3bjdXy.js +85 -0
  21. package/dist/{STRINGS-b432aBJJ.js → STRINGS--j49GZJP.js} +2 -2
  22. package/dist/{Settings-jCcd-VE6.js → Settings-4s2LUVmC.js} +401 -407
  23. package/dist/Settings-AqoKwR92.cjs +1 -0
  24. package/dist/SidePanels-3o6Okmvu.cjs +1 -0
  25. package/dist/{SidePanels-pHMYprpW.js → SidePanels-bugFfInz.js} +118 -108
  26. package/dist/Topbar-CqW7G360.cjs +1 -0
  27. package/dist/Topbar-pWzBEOed.js +132 -0
  28. package/dist/UnsplashImages-NGskB93R.cjs +1 -0
  29. package/dist/{UnsplashImages-L7x_3RQf.js → UnsplashImages-qvwFbV-E.js} +63 -50
  30. package/dist/{UploadImages-zdEJRLD8.js → UploadImages-9NapgXBq.js} +60 -37
  31. package/dist/UploadImages-Oh7Glr9A.cjs +1 -0
  32. package/dist/_commonjsHelpers-UyOWmZb0.js +8 -0
  33. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +1 -0
  34. package/dist/add-page-modal--6TTBRYa.cjs +1 -0
  35. package/dist/add-page-modal-k2Kb92HS.js +104 -0
  36. package/dist/confirm-alert-C4M9eF-o.cjs +1 -0
  37. package/dist/confirm-alert-GUhZ_G8w.js +60 -0
  38. package/dist/controls-KK2oLIa8.cjs +1 -0
  39. package/dist/{controls-IS5qnRce.js → controls-OfJWSEqC.js} +85 -20
  40. package/dist/core.cjs +1 -1
  41. package/dist/core.js +75 -150
  42. package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
  43. package/dist/{defaultTheme-4kA60XdB.js → defaultTheme-D8B4-wHO.js} +8 -6
  44. package/dist/delete-page-modal-cFoL-wdo.cjs +1 -0
  45. package/dist/delete-page-modal-zONvdebd.js +83 -0
  46. package/dist/email-blocks.cjs +1 -1
  47. package/dist/email-blocks.js +292 -3
  48. package/dist/email.cjs +1 -1
  49. package/dist/email.js +37 -18
  50. package/dist/empty-slot-ZBlsQi6m.js +15 -0
  51. package/dist/empty-slot-nzYOgZuS.cjs +1 -0
  52. package/dist/{form-0_RLz2TB.js → form-STUz-6nE.js} +12 -12
  53. package/dist/form-lBQ_76Uw.cjs +1 -0
  54. package/dist/{html-to-json-uSnxl72F.cjs → html-to-json-efmv1pCj.cjs} +1 -1
  55. package/dist/{html-to-json-2xtb7520.js → html-to-json-ngX9ef2u.js} +41 -41
  56. package/dist/index-Gk6sASBd.js +3080 -0
  57. package/dist/index-OB199Izc.cjs +206 -0
  58. package/dist/index-SkyM3d6Q.js +39503 -0
  59. package/dist/index-YpnaudSM.js +63 -0
  60. package/dist/index-e0c8PmRQ.js +205 -0
  61. package/dist/index-ecnGWzh9.cjs +1 -0
  62. package/dist/index-gi1LIOCw.cjs +1 -0
  63. package/dist/index-h-hd6EvN.cjs +1 -0
  64. package/dist/index-llTXLDGE.js +2201 -0
  65. package/dist/index-mbyqq81O.cjs +1 -0
  66. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-WbnYoNE9.js} +109 -106
  67. package/dist/jsx-runtime-Z_BpKhVy.cjs +27 -0
  68. package/dist/lib.cjs +2 -2
  69. package/dist/lib.js +66 -62
  70. package/dist/page-viewer-2kwnKM6v.cjs +1 -0
  71. package/dist/{page-viewer-NnOwmAmu.js → page-viewer-Pdg9F5Hv.js} +57 -43
  72. package/dist/project-general-setting-CnNL98NM.cjs +1 -0
  73. package/dist/{project-general-setting-9ju3TDju.js → project-general-setting-f8Ebsn6K.js} +43 -35
  74. package/dist/project-seo-setting-mlxL_e2_.cjs +1 -0
  75. package/dist/{project-seo-setting-36CdUszM.js → project-seo-setting-pX34Qsym.js} +40 -23
  76. package/dist/render.cjs +1 -1
  77. package/dist/render.js +14 -13
  78. package/dist/single-page-detail-XfzrGlzA.cjs +1 -0
  79. package/dist/{single-page-detail-hD1jKZ8k.js → single-page-detail-dpe5LT0M.js} +74 -66
  80. package/dist/studio.cjs +1 -1
  81. package/dist/studio.js +40 -24
  82. package/dist/ui.cjs +1 -1
  83. package/dist/ui.js +160 -365
  84. package/dist/web-blocks.cjs +6 -1
  85. package/dist/web-blocks.js +1153 -3
  86. package/package.json +1 -1
  87. package/dist/AddBlocks-Ol3iIVKa.js +0 -207
  88. package/dist/AddBlocks-a1c-7Ewz.cjs +0 -1
  89. package/dist/BrandingOptions-6rnt0UaA.cjs +0 -1
  90. package/dist/CanvasArea-R4ogF9AT.cjs +0 -55
  91. package/dist/ChaiBuilderEditor-m30yoOgJ.cjs +0 -163
  92. package/dist/ChaiBuilderEditor-vP4at00I.js +0 -27974
  93. package/dist/Class-eieto7e-.cjs +0 -1
  94. package/dist/Controls-3Cc1XYXg.js +0 -105
  95. package/dist/Controls-ky25Ebo3.cjs +0 -1
  96. package/dist/CurrentPage-3gQTH0Zt.cjs +0 -1
  97. package/dist/Functions-Hvon6AMZ.cjs +0 -1
  98. package/dist/Functions-NzT2Six_.js +0 -15
  99. package/dist/ImagesPanel-J1RlG7xG.cjs +0 -1
  100. package/dist/ImagesPanel-Wb0GF_NA.js +0 -29
  101. package/dist/ListTree-CZ-mtjZ9.cjs +0 -1
  102. package/dist/MODIFIERS-o1p3VnpS.cjs +0 -1
  103. package/dist/PagesPanel-Gi0z6gaf.cjs +0 -1
  104. package/dist/PagesPanel-u1IB-nRr.js +0 -48
  105. package/dist/ProjectPanel-EydGZmMW.js +0 -71
  106. package/dist/ProjectPanel-kiiljG4H.cjs +0 -1
  107. package/dist/Settings-8ilCSH8b.cjs +0 -1
  108. package/dist/SidePanels-T36C6Lhc.cjs +0 -1
  109. package/dist/Topbar-CvWQuspR.cjs +0 -1
  110. package/dist/Topbar-pbIDUE_B.js +0 -122
  111. package/dist/UnsplashImages-KBZPd9dv.cjs +0 -1
  112. package/dist/UploadImages-GkkJVAgG.cjs +0 -1
  113. package/dist/accordion-oPUeqPCZ.js +0 -42
  114. package/dist/accordion-ynvFtV_p.cjs +0 -1
  115. package/dist/add-page-modal-9SGv2hgc.cjs +0 -1
  116. package/dist/add-page-modal-JCDXZIPW.js +0 -95
  117. package/dist/alert-dialog-P9xMMB6C.cjs +0 -1
  118. package/dist/alert-dialog-rypfO5ly.js +0 -64
  119. package/dist/badge-E-S7CqUt.cjs +0 -1
  120. package/dist/badge-tEwO7C51.js +0 -23
  121. package/dist/block-helpers-OKHmRRol.cjs +0 -1
  122. package/dist/block-helpers-oSFpSsGz.js +0 -23
  123. package/dist/command-BxR6jaCI.cjs +0 -1
  124. package/dist/command-Pn3HKDuV.js +0 -97
  125. package/dist/confirm-alert-uNm0lZ0y.cjs +0 -1
  126. package/dist/confirm-alert-wR5_VJ1l.js +0 -36
  127. package/dist/context-menu-8dC9uGXj.js +0 -122
  128. package/dist/context-menu-IgLbIuth.cjs +0 -1
  129. package/dist/controls-L7DPvB0m.cjs +0 -1
  130. package/dist/defaultTheme-mrkeGFGI.cjs +0 -1
  131. package/dist/delete-page-modal-7KmP1elv.js +0 -67
  132. package/dist/delete-page-modal-SgfwvfNu.cjs +0 -1
  133. package/dist/dropdown-menu-El86_9Uo.js +0 -124
  134. package/dist/dropdown-menu-SiHzqWwZ.cjs +0 -1
  135. package/dist/form-W58AVUdf.cjs +0 -1
  136. package/dist/hover-card-KUwpDkW8.cjs +0 -1
  137. package/dist/hover-card-q138xxXR.js +0 -45
  138. package/dist/iconBase-gbUAAO2L.cjs +0 -1
  139. package/dist/iconBase-h4DuR_XT.js +0 -63
  140. package/dist/index-9MmykVSc.cjs +0 -1
  141. package/dist/index-hElOGcFr.js +0 -2200
  142. package/dist/index-lDTsQp7h.js +0 -188
  143. package/dist/index-rq5Y9ZDy.cjs +0 -1
  144. package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
  145. package/dist/label-KaP7MRrs.js +0 -10
  146. package/dist/label-tFm8HZdb.cjs +0 -1
  147. package/dist/link-WbcKdQ9k.cjs +0 -1
  148. package/dist/link-xuhP-4dN.js +0 -196
  149. package/dist/page-viewer-Hx5hxHKm.cjs +0 -1
  150. package/dist/popover-a84pbVhQ.js +0 -23
  151. package/dist/popover-fKjgcRUx.cjs +0 -1
  152. package/dist/project-general-setting-FxkwjvJz.cjs +0 -1
  153. package/dist/project-seo-setting-RU7qiXxb.cjs +0 -1
  154. package/dist/scroll-area-FiHvy-TZ.cjs +0 -1
  155. package/dist/scroll-area-ewXbxc3n.js +0 -30
  156. package/dist/select-7bjg-rr9.cjs +0 -1
  157. package/dist/select-POGdEDHT.js +0 -75
  158. package/dist/separator-3Civ-6hb.cjs +0 -1
  159. package/dist/separator-SctTn0Qi.js +0 -18
  160. package/dist/single-page-detail-beY0MT1b.cjs +0 -1
  161. package/dist/skeleton-STeL9VrJ.cjs +0 -1
  162. package/dist/skeleton-lu8e7q2y.js +0 -239
  163. package/dist/tabs-_4WbA1cc.cjs +0 -1
  164. package/dist/tabs-yQ3oGziM.js +0 -106
  165. package/dist/textarea-1kZEh7ki.cjs +0 -1
  166. package/dist/textarea-b2QvVhrK.js +0 -73
  167. package/dist/useAddBlock-8pxOEYIl.cjs +0 -1
  168. package/dist/useAddBlock-FEKFJNwQ.js +0 -69
  169. package/dist/useChaiExternalData-fkFgoS80.js +0 -6
  170. package/dist/useChaiExternalData-rwoAZ6uU.cjs +0 -1
  171. package/dist/useDarkMode-7i57segK.cjs +0 -1
  172. package/dist/useDarkMode-8VHJlYyE.js +0 -23
  173. package/dist/useSelectedBreakpoints-6NK5qd7T.js +0 -10
  174. package/dist/useSelectedBreakpoints-7ONXb-vN.cjs +0 -1
  175. package/dist/useStylingState-Iuj84yvc.js +0 -186
  176. package/dist/useStylingState-OIvJMV6p.cjs +0 -1
  177. package/dist/useUiLibraries-nCdauJ4N.cjs +0 -1
  178. package/dist/useUiLibraries-psyWFbNc.js +0 -12
  179. package/dist/useUpdateBlocksProps-Unn8lUyj.cjs +0 -1
  180. package/dist/useUpdateBlocksProps-vWcDp-P9.js +0 -23
  181. package/dist/utils-dze1SGvB.js +0 -6
  182. package/dist/utils-qK_SjzzV.cjs +0 -1
@@ -1,124 +0,0 @@
1
- import { j as a } from "./jsx-runtime-Sp0orL4X.js";
2
- import * as r from "react";
3
- import * as e from "@radix-ui/react-dropdown-menu";
4
- import { ChevronRightIcon as l, CheckIcon as c, DotFilledIcon as m } from "@radix-ui/react-icons";
5
- import { c as d } from "./utils-dze1SGvB.js";
6
- const M = e.Root, R = e.Trigger, I = e.Group, v = e.Portal, S = e.Sub, C = e.RadioGroup, p = r.forwardRef(({ className: t, inset: o, children: s, ...n }, i) => /* @__PURE__ */ a.jsxs(
7
- e.SubTrigger,
8
- {
9
- ref: i,
10
- className: d(
11
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
12
- o && "pl-8",
13
- t
14
- ),
15
- ...n,
16
- children: [
17
- s,
18
- /* @__PURE__ */ a.jsx(l, { className: "ml-auto h-4 w-4" })
19
- ]
20
- }
21
- ));
22
- p.displayName = e.SubTrigger.displayName;
23
- const u = r.forwardRef(({ className: t, ...o }, s) => /* @__PURE__ */ a.jsx(
24
- e.SubContent,
25
- {
26
- ref: s,
27
- className: d(
28
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
29
- t
30
- ),
31
- ...o
32
- }
33
- ));
34
- u.displayName = e.SubContent.displayName;
35
- const f = r.forwardRef(({ className: t, sideOffset: o = 4, ...s }, n) => /* @__PURE__ */ a.jsx(e.Portal, { children: /* @__PURE__ */ a.jsx(
36
- e.Content,
37
- {
38
- ref: n,
39
- sideOffset: o,
40
- className: d(
41
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
42
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
43
- t
44
- ),
45
- ...s
46
- }
47
- ) }));
48
- f.displayName = e.Content.displayName;
49
- const x = r.forwardRef(({ className: t, inset: o, ...s }, n) => /* @__PURE__ */ a.jsx(
50
- e.Item,
51
- {
52
- ref: n,
53
- className: d(
54
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
55
- o && "pl-8",
56
- t
57
- ),
58
- ...s
59
- }
60
- ));
61
- x.displayName = e.Item.displayName;
62
- const b = r.forwardRef(({ className: t, children: o, checked: s, ...n }, i) => /* @__PURE__ */ a.jsxs(
63
- e.CheckboxItem,
64
- {
65
- ref: i,
66
- className: d(
67
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
68
- t
69
- ),
70
- checked: s,
71
- ...n,
72
- children: [
73
- /* @__PURE__ */ a.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a.jsx(e.ItemIndicator, { children: /* @__PURE__ */ a.jsx(c, { className: "h-4 w-4" }) }) }),
74
- o
75
- ]
76
- }
77
- ));
78
- b.displayName = e.CheckboxItem.displayName;
79
- const w = r.forwardRef(({ className: t, children: o, ...s }, n) => /* @__PURE__ */ a.jsxs(
80
- e.RadioItem,
81
- {
82
- ref: n,
83
- className: d(
84
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
85
- t
86
- ),
87
- ...s,
88
- children: [
89
- /* @__PURE__ */ a.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ a.jsx(e.ItemIndicator, { children: /* @__PURE__ */ a.jsx(m, { className: "h-4 w-4 fill-current" }) }) }),
90
- o
91
- ]
92
- }
93
- ));
94
- w.displayName = e.RadioItem.displayName;
95
- const g = r.forwardRef(({ className: t, inset: o, ...s }, n) => /* @__PURE__ */ a.jsx(
96
- e.Label,
97
- {
98
- ref: n,
99
- className: d("px-2 py-1.5 text-sm font-semibold", o && "pl-8", t),
100
- ...s
101
- }
102
- ));
103
- g.displayName = e.Label.displayName;
104
- const h = r.forwardRef(({ className: t, ...o }, s) => /* @__PURE__ */ a.jsx(e.Separator, { ref: s, className: d("-mx-1 my-1 h-px bg-muted", t), ...o }));
105
- h.displayName = e.Separator.displayName;
106
- const N = ({ className: t, ...o }) => /* @__PURE__ */ a.jsx("span", { className: d("ml-auto text-xs tracking-widest opacity-60", t), ...o });
107
- N.displayName = "DropdownMenuShortcut";
108
- export {
109
- M as D,
110
- R as a,
111
- f as b,
112
- x as c,
113
- b as d,
114
- w as e,
115
- g as f,
116
- h as g,
117
- N as h,
118
- I as i,
119
- v as j,
120
- S as k,
121
- u as l,
122
- p as m,
123
- C as n
124
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("./jsx-runtime-JYMCiFoE.cjs"),R=require("react"),D=require("@radix-ui/react-dropdown-menu"),c=require("@radix-ui/react-icons"),r=require("./utils-qK_SjzzV.cjs");function u(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(o,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return o.default=t,Object.freeze(o)}const d=u(R),e=u(D),M=e.Root,h=e.Trigger,y=e.Group,N=e.Portal,I=e.Sub,S=e.RadioGroup,p=d.forwardRef(({className:t,inset:o,children:n,...s},i)=>a.jsxRuntimeExports.jsxs(e.SubTrigger,{ref:i,className:r.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",o&&"pl-8",t),...s,children:[n,a.jsxRuntimeExports.jsx(c.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));p.displayName=e.SubTrigger.displayName;const l=d.forwardRef(({className:t,...o},n)=>a.jsxRuntimeExports.jsx(e.SubContent,{ref:n,className:r.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o}));l.displayName=e.SubContent.displayName;const m=d.forwardRef(({className:t,sideOffset:o=4,...n},s)=>a.jsxRuntimeExports.jsx(e.Portal,{children:a.jsxRuntimeExports.jsx(e.Content,{ref:s,sideOffset:o,className:r.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));m.displayName=e.Content.displayName;const x=d.forwardRef(({className:t,inset:o,...n},s)=>a.jsxRuntimeExports.jsx(e.Item,{ref:s,className:r.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o&&"pl-8",t),...n}));x.displayName=e.Item.displayName;const f=d.forwardRef(({className:t,children:o,checked:n,...s},i)=>a.jsxRuntimeExports.jsxs(e.CheckboxItem,{ref:i,className:r.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...s,children:[a.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsxRuntimeExports.jsx(e.ItemIndicator,{children:a.jsxRuntimeExports.jsx(c.CheckIcon,{className:"h-4 w-4"})})}),o]}));f.displayName=e.CheckboxItem.displayName;const w=d.forwardRef(({className:t,children:o,...n},s)=>a.jsxRuntimeExports.jsxs(e.RadioItem,{ref:s,className:r.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsxRuntimeExports.jsx(e.ItemIndicator,{children:a.jsxRuntimeExports.jsx(c.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),o]}));w.displayName=e.RadioItem.displayName;const b=d.forwardRef(({className:t,inset:o,...n},s)=>a.jsxRuntimeExports.jsx(e.Label,{ref:s,className:r.cn("px-2 py-1.5 text-sm font-semibold",o&&"pl-8",t),...n}));b.displayName=e.Label.displayName;const j=d.forwardRef(({className:t,...o},n)=>a.jsxRuntimeExports.jsx(e.Separator,{ref:n,className:r.cn("-mx-1 my-1 h-px bg-muted",t),...o}));j.displayName=e.Separator.displayName;const g=({className:t,...o})=>a.jsxRuntimeExports.jsx("span",{className:r.cn("ml-auto text-xs tracking-widest opacity-60",t),...o});g.displayName="DropdownMenuShortcut";exports.DropdownMenu=M;exports.DropdownMenuCheckboxItem=f;exports.DropdownMenuContent=m;exports.DropdownMenuGroup=y;exports.DropdownMenuItem=x;exports.DropdownMenuLabel=b;exports.DropdownMenuPortal=N;exports.DropdownMenuRadioGroup=S;exports.DropdownMenuRadioItem=w;exports.DropdownMenuSeparator=j;exports.DropdownMenuShortcut=g;exports.DropdownMenuSub=I;exports.DropdownMenuSubContent=l;exports.DropdownMenuSubTrigger=p;exports.DropdownMenuTrigger=h;
@@ -1 +0,0 @@
1
- "use strict";const f=require("./jsx-runtime-JYMCiFoE.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./link-WbcKdQ9k.cjs"),h=(n,c="")=>{switch(n.type){case"singular":return n.uiSchema;case"model":const{properties:p}=n,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${c}`:r;u[o]=h(e,c)}),u;case"list":const{itemProperties:m}=n,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${c}`:r;l.items[o]=h(e,c)}),l;default:return{}}},x=(n,c="")=>{switch(n.type){case"singular":return n.schema;case"model":const{properties:p,title:u}=n,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${c}`:o;m.properties[s]=x(t,c)}),m;case"list":const{itemProperties:l,title:r}=n,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${c}`:o;e.items.properties[s]=x(t,c),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:n,properties:c={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(c).forEach(t=>{const s=c[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[n&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:n}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
@@ -1 +0,0 @@
1
- "use strict";const s=require("./jsx-runtime-JYMCiFoE.cjs"),m=require("@radix-ui/react-switch"),p=require("react"),i=require("./utils-qK_SjzzV.cjs"),b=require("@radix-ui/react-hover-card");function d(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const n=d(m),c=d(p),r=d(b),l=c.forwardRef(({className:e,...a},t)=>s.jsxRuntimeExports.jsx(n.Root,{className:i.cn("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",e),...a,ref:t,children:s.jsxRuntimeExports.jsx(n.Thumb,{className:i.cn("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));l.displayName=n.Root.displayName;const g=r.Root,v=r.Trigger,u=c.forwardRef(({className:e,align:a="center",sideOffset:t=4,...o},f)=>s.jsxRuntimeExports.jsx(r.Content,{ref:f,align:a,sideOffset:t,className:i.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o}));u.displayName=r.Content.displayName;exports.HoverCard=g;exports.HoverCardContent=u;exports.HoverCardTrigger=v;exports.Switch=l;
@@ -1,45 +0,0 @@
1
- import { j as s } from "./jsx-runtime-Sp0orL4X.js";
2
- import * as r from "@radix-ui/react-switch";
3
- import * as d from "react";
4
- import { c as i } from "./utils-dze1SGvB.js";
5
- import * as e from "@radix-ui/react-hover-card";
6
- const c = d.forwardRef(({ className: t, ...a }, o) => /* @__PURE__ */ s.jsx(
7
- r.Root,
8
- {
9
- className: i(
10
- "peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",
11
- t
12
- ),
13
- ...a,
14
- ref: o,
15
- children: /* @__PURE__ */ s.jsx(
16
- r.Thumb,
17
- {
18
- className: i(
19
- "pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950"
20
- )
21
- }
22
- )
23
- }
24
- ));
25
- c.displayName = r.Root.displayName;
26
- const u = e.Root, b = e.Trigger, f = d.forwardRef(({ className: t, align: a = "center", sideOffset: o = 4, ...n }, l) => /* @__PURE__ */ s.jsx(
27
- e.Content,
28
- {
29
- ref: l,
30
- align: a,
31
- sideOffset: o,
32
- className: i(
33
- "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
34
- t
35
- ),
36
- ...n
37
- }
38
- ));
39
- f.displayName = e.Content.displayName;
40
- export {
41
- u as H,
42
- c as S,
43
- b as a,
44
- f as b
45
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("react");var f={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},s=i.createContext&&i.createContext(f),l=function(){return l=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++){n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},l.apply(this,arguments)},y=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)n.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(t[r[a]]=e[r[a]]);return t};function d(e){return e&&e.map(function(n,t){return i.createElement(n.tag,l({key:t},n.attr),d(n.child))})}function g(e){return function(n){return i.createElement(v,l({attr:l({},e.attr)},n),d(e.child))}}function v(e){var n=function(t){var r=e.attr,a=e.size,u=e.title,m=y(e,["attr","size","title"]),o=a||t.size||"1em",c;return t.className&&(c=t.className),e.className&&(c=(c?c+" ":"")+e.className),i.createElement("svg",l({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,m,{className:c,style:l(l({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),u&&i.createElement("title",null,u),e.children)};return s!==void 0?i.createElement(s.Consumer,null,function(t){return n(t)}):n(f)}exports.GenIcon=g;
@@ -1,63 +0,0 @@
1
- import i from "react";
2
- var s = {
3
- color: void 0,
4
- size: void 0,
5
- className: void 0,
6
- style: void 0,
7
- attr: void 0
8
- }, f = i.createContext && i.createContext(s), l = function() {
9
- return l = Object.assign || function(e) {
10
- for (var n, t = 1, r = arguments.length; t < r; t++) {
11
- n = arguments[t];
12
- for (var a in n)
13
- Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
14
- }
15
- return e;
16
- }, l.apply(this, arguments);
17
- }, y = function(e, n) {
18
- var t = {};
19
- for (var r in e)
20
- Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]);
21
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
22
- for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
23
- n.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (t[r[a]] = e[r[a]]);
24
- return t;
25
- };
26
- function m(e) {
27
- return e && e.map(function(n, t) {
28
- return i.createElement(n.tag, l({
29
- key: t
30
- }, n.attr), m(n.child));
31
- });
32
- }
33
- function h(e) {
34
- return function(n) {
35
- return i.createElement(g, l({
36
- attr: l({}, e.attr)
37
- }, n), m(e.child));
38
- };
39
- }
40
- function g(e) {
41
- var n = function(t) {
42
- var r = e.attr, a = e.size, c = e.title, d = y(e, ["attr", "size", "title"]), o = a || t.size || "1em", u;
43
- return t.className && (u = t.className), e.className && (u = (u ? u + " " : "") + e.className), i.createElement("svg", l({
44
- stroke: "currentColor",
45
- fill: "currentColor",
46
- strokeWidth: "0"
47
- }, t.attr, r, d, {
48
- className: u,
49
- style: l(l({
50
- color: e.color || t.color
51
- }, t.style), e.style),
52
- height: o,
53
- width: o,
54
- xmlns: "http://www.w3.org/2000/svg"
55
- }), c && i.createElement("title", null, c), e.children);
56
- };
57
- return f !== void 0 ? i.createElement(f.Consumer, null, function(t) {
58
- return n(t);
59
- }) : n(s);
60
- }
61
- export {
62
- h as G
63
- };
@@ -1 +0,0 @@
1
- "use strict";var yt=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var i=(t,e,s)=>(yt(t,e,"read from private field"),s?s.call(t):e.get(t)),l=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},o=(t,e,s,r)=>(yt(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s);var at=(t,e,s,r)=>({set _(n){o(t,e,n,s)},get _(){return i(t,e,r)}}),p=(t,e,s)=>(yt(t,e,"access private method"),s);const u=require("./jsx-runtime-JYMCiFoE.cjs"),L=require("react"),ts=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),bs=require("react-i18next"),gt=require("./skeleton-STeL9VrJ.cjs"),ct=require("@radix-ui/react-icons"),ee=require("sonner"),te=require("lodash-es"),vs=require("./html-to-json-uSnxl72F.cjs"),At=require("lucide-react"),ss=require("./iconBase-gbUAAO2L.cjs"),ne=require("./alert-dialog-P9xMMB6C.cjs");function js(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const A=js(L);var Ke=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Be=typeof window>"u"||"Deno"in window;function z(){}function ws(t,e){return typeof t=="function"?t(e):t}function xt(t){return typeof t=="number"&&t>=0&&t!==1/0}function rs(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Qt(t,e){const{type:s="all",exact:r,fetchStatus:n,predicate:a,queryKey:c,stale:d}=t;if(c){if(r){if(e.queryHash!==Mt(c,e.options))return!1}else if(!He(e.queryKey,c))return!1}if(s!=="all"){const g=e.isActive();if(s==="active"&&!g||s==="inactive"&&g)return!1}return!(typeof d=="boolean"&&e.isStale()!==d||typeof n<"u"&&n!==e.state.fetchStatus||a&&!a(e))}function Nt(t,e){const{exact:s,status:r,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if($e(e.options.mutationKey)!==$e(a))return!1}else if(!He(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||n&&!n(e))}function Mt(t,e){return((e==null?void 0:e.queryKeyHashFn)||$e)(t)}function $e(t){return JSON.stringify(t,(e,s)=>bt(s)?Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{}):s)}function He(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(s=>!He(t[s],e[s])):!1}function is(t,e){if(t===e)return t;const s=Tt(t)&&Tt(e);if(s||bt(t)&&bt(e)){const r=s?t.length:Object.keys(t).length,n=s?e:Object.keys(e),a=n.length,c=s?[]:{};let d=0;for(let g=0;g<a;g++){const x=s?g:n[g];c[x]=is(t[x],e[x]),c[x]===t[x]&&d++}return r===a&&d===r?t:c}return e}function lt(t,e){if(t&&!e||e&&!t)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function Tt(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function bt(t){if(!It(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const s=e.prototype;return!(!It(s)||!s.hasOwnProperty("isPrototypeOf"))}function It(t){return Object.prototype.toString.call(t)==="[object Object]"}function ns(t){return new Promise(e=>{setTimeout(e,t)})}function Lt(t){ns(0).then(t)}function vt(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?is(t,e):e}function Es(t,e,s=0){const r=[...t,e];return s&&r.length>s?r.slice(1):r}function Rs(t,e,s=0){const r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var me,oe,Pe,Ht,Ps=(Ht=class extends Ke{constructor(){super();l(this,me,void 0);l(this,oe,void 0);l(this,Pe,void 0);o(this,Pe,e=>{if(!Be&&window.addEventListener){const s=()=>e();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,oe)||this.setEventListener(i(this,Pe))}onUnsubscribe(){var e;this.hasListeners()||((e=i(this,oe))==null||e.call(this),o(this,oe,void 0))}setEventListener(e){var s;o(this,Pe,e),(s=i(this,oe))==null||s.call(this),o(this,oe,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){i(this,me)!==e&&(o(this,me,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof i(this,me)=="boolean"?i(this,me):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},me=new WeakMap,oe=new WeakMap,Pe=new WeakMap,Ht),ht=new Ps,Ce,ue,Oe,Gt,Cs=(Gt=class extends Ke{constructor(){super();l(this,Ce,!0);l(this,ue,void 0);l(this,Oe,void 0);o(this,Oe,e=>{if(!Be&&window.addEventListener){const s=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,ue)||this.setEventListener(i(this,Oe))}onUnsubscribe(){var e;this.hasListeners()||((e=i(this,ue))==null||e.call(this),o(this,ue,void 0))}setEventListener(e){var s;o(this,Oe,e),(s=i(this,ue))==null||s.call(this),o(this,ue,e(this.setOnline.bind(this)))}setOnline(e){i(this,Ce)!==e&&(o(this,Ce,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return i(this,Ce)}},Ce=new WeakMap,ue=new WeakMap,Oe=new WeakMap,Gt),dt=new Cs;function Os(t){return Math.min(1e3*2**t,3e4)}function pt(t){return(t??"online")==="online"?dt.isOnline():!0}var as=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function mt(t){return t instanceof as}function os(t){let e=!1,s=0,r=!1,n,a,c;const d=new Promise((f,m)=>{a=f,c=m}),g=f=>{var m;r||(y(new as(f)),(m=t.abort)==null||m.call(t))},x=()=>{e=!0},h=()=>{e=!1},E=()=>!ht.isFocused()||t.networkMode!=="always"&&!dt.isOnline(),U=f=>{var m;r||(r=!0,(m=t.onSuccess)==null||m.call(t,f),n==null||n(),a(f))},y=f=>{var m;r||(r=!0,(m=t.onError)==null||m.call(t,f),n==null||n(),c(f))},b=()=>new Promise(f=>{var m;n=O=>{const v=r||!E();return v&&f(O),v},(m=t.onPause)==null||m.call(t)}).then(()=>{var f;n=void 0,r||(f=t.onContinue)==null||f.call(t)}),P=()=>{if(r)return;let f;try{f=t.fn()}catch(m){f=Promise.reject(m)}Promise.resolve(f).then(U).catch(m=>{var Q;if(r)return;const O=t.retry??(Be?0:3),v=t.retryDelay??Os,j=typeof v=="function"?v(s,m):v,M=O===!0||typeof O=="number"&&s<O||typeof O=="function"&&O(s,m);if(e||!M){y(m);return}s++,(Q=t.onFail)==null||Q.call(t,s,m),ns(j).then(()=>{if(E())return b()}).then(()=>{e?y(m):P()})})};return pt(t.networkMode)?P():b().then(P),{promise:d,cancel:g,continue:()=>(n==null?void 0:n())?d:Promise.resolve(),cancelRetry:x,continueRetry:h}}function Ss(){let t=[],e=0,s=h=>{h()},r=h=>{h()};const n=h=>{let E;e++;try{E=h()}finally{e--,e||d()}return E},a=h=>{e?t.push(h):Lt(()=>{s(h)})},c=h=>(...E)=>{a(()=>{h(...E)})},d=()=>{const h=t;t=[],h.length&&Lt(()=>{r(()=>{h.forEach(E=>{s(E)})})})};return{batch:n,batchCalls:c,schedule:a,setNotifyFunction:h=>{s=h},setBatchNotifyFunction:h=>{r=h}}}var F=Ss(),ge,zt,us=(zt=class{constructor(){l(this,ge,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xt(this.gcTime)&&o(this,ge,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Be?1/0:5*60*1e3))}clearGcTimeout(){i(this,ge)&&(clearTimeout(i(this,ge)),o(this,ge,void 0))}},ge=new WeakMap,zt),Se,Fe,_,ce,$,q,Ge,xe,qe,ot,V,re,Vt,Fs=(Vt=class extends us{constructor(e){super();l(this,qe);l(this,V);l(this,Se,void 0);l(this,Fe,void 0);l(this,_,void 0);l(this,ce,void 0);l(this,$,void 0);l(this,q,void 0);l(this,Ge,void 0);l(this,xe,void 0);o(this,xe,!1),o(this,Ge,e.defaultOptions),p(this,qe,ot).call(this,e.options),o(this,q,[]),o(this,_,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,o(this,Se,e.state||qs(this.options)),this.state=i(this,Se),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!i(this,q).length&&this.state.fetchStatus==="idle"&&i(this,_).remove(this)}setData(e,s){const r=vt(this.state.data,e,this.options);return p(this,V,re).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(e,s){p(this,V,re).call(this,{type:"setState",state:e,setStateOptions:s})}cancel(e){var r;const s=i(this,ce);return(r=i(this,$))==null||r.cancel(e),s?s.then(z).catch(z):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(i(this,Se))}isActive(){return i(this,q).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||i(this,q).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!rs(this.state.dataUpdatedAt,e)}onFocus(){var s;const e=i(this,q).find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(s=i(this,$))==null||s.continue()}onOnline(){var s;const e=i(this,q).find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(s=i(this,$))==null||s.continue()}addObserver(e){i(this,q).includes(e)||(i(this,q).push(e),this.clearGcTimeout(),i(this,_).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){i(this,q).includes(e)&&(o(this,q,i(this,q).filter(s=>s!==e)),i(this,q).length||(i(this,$)&&(i(this,xe)?i(this,$).cancel({revert:!0}):i(this,$).cancelRetry()),this.scheduleGc()),i(this,_).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return i(this,q).length}invalidate(){this.state.isInvalidated||p(this,V,re).call(this,{type:"invalidate"})}fetch(e,s){var x,h,E,U;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(i(this,ce))return(x=i(this,$))==null||x.continueRetry(),i(this,ce)}if(e&&p(this,qe,ot).call(this,e),!this.options.queryFn){const y=i(this,q).find(b=>b.options.queryFn);y&&p(this,qe,ot).call(this,y.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n={queryKey:this.queryKey,meta:this.meta},a=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(o(this,xe,!0),r.signal)})};a(n);const c=()=>this.options.queryFn?(o(this,xe,!1),this.options.persister?this.options.persister(this.options.queryFn,n,this):this.options.queryFn(n)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),d={fetchOptions:s,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:c};a(d),(h=this.options.behavior)==null||h.onFetch(d,this),o(this,Fe,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((E=d.fetchOptions)==null?void 0:E.meta))&&p(this,V,re).call(this,{type:"fetch",meta:(U=d.fetchOptions)==null?void 0:U.meta});const g=y=>{var b,P,f,m;mt(y)&&y.silent||p(this,V,re).call(this,{type:"error",error:y}),mt(y)||((P=(b=i(this,_).config).onError)==null||P.call(b,y,this),(m=(f=i(this,_).config).onSettled)==null||m.call(f,this.state.data,y,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return o(this,$,os({fn:d.fetchFn,abort:r.abort.bind(r),onSuccess:y=>{var b,P,f,m;if(typeof y>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),g(new Error(`${this.queryHash} data is undefined`));return}this.setData(y),(P=(b=i(this,_).config).onSuccess)==null||P.call(b,y,this),(m=(f=i(this,_).config).onSettled)==null||m.call(f,y,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:g,onFail:(y,b)=>{p(this,V,re).call(this,{type:"failed",failureCount:y,error:b})},onPause:()=>{p(this,V,re).call(this,{type:"pause"})},onContinue:()=>{p(this,V,re).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode})),o(this,ce,i(this,$).promise),i(this,ce)}},Se=new WeakMap,Fe=new WeakMap,_=new WeakMap,ce=new WeakMap,$=new WeakMap,q=new WeakMap,Ge=new WeakMap,xe=new WeakMap,qe=new WeakSet,ot=function(e){this.options={...i(this,Ge),...e},this.updateGcTime(this.options.gcTime)},V=new WeakSet,re=function(e){const s=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:pt(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return mt(n)&&n.revert&&i(this,Fe)?{...i(this,Fe),fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=s(this.state),F.batch(()=>{i(this,q).forEach(r=>{r.onQueryUpdate()}),i(this,_).notify({query:this,type:"updated",action:e})})},Vt);function qs(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=typeof e<"u",r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var W,Jt,As=(Jt=class extends Ke{constructor(e={}){super();l(this,W,void 0);this.config=e,o(this,W,new Map)}build(e,s,r){const n=s.queryKey,a=s.queryHash??Mt(n,s);let c=this.get(a);return c||(c=new Fs({cache:this,queryKey:n,queryHash:a,options:e.defaultQueryOptions(s),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(c)),c}add(e){i(this,W).has(e.queryHash)||(i(this,W).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const s=i(this,W).get(e.queryHash);s&&(e.destroy(),s===e&&i(this,W).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return i(this,W).get(e)}getAll(){return[...i(this,W).values()]}find(e){const s={exact:!0,...e};return this.getAll().find(r=>Qt(s,r))}findAll(e={}){const s=this.getAll();return Object.keys(e).length>0?s.filter(r=>Qt(e,r)):s}notify(e){F.batch(()=>{this.listeners.forEach(s=>{s(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},W=new WeakMap,Jt),Y,ze,I,Ae,X,ae,Wt,Ms=(Wt=class extends us{constructor(e){super();l(this,X);l(this,Y,void 0);l(this,ze,void 0);l(this,I,void 0);l(this,Ae,void 0);this.mutationId=e.mutationId,o(this,ze,e.defaultOptions),o(this,I,e.mutationCache),o(this,Y,[]),this.state=e.state||cs(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...i(this,ze),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){i(this,Y).includes(e)||(i(this,Y).push(e),this.clearGcTimeout(),i(this,I).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){o(this,Y,i(this,Y).filter(s=>s!==e)),this.scheduleGc(),i(this,I).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){i(this,Y).length||(this.state.status==="pending"?this.scheduleGc():i(this,I).remove(this))}continue(){var e;return((e=i(this,Ae))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var n,a,c,d,g,x,h,E,U,y,b,P,f,m,O,v,j,M,Q,C;const s=()=>(o(this,Ae,os({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(R,se)=>{p(this,X,ae).call(this,{type:"failed",failureCount:R,error:se})},onPause:()=>{p(this,X,ae).call(this,{type:"pause"})},onContinue:()=>{p(this,X,ae).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),i(this,Ae).promise),r=this.state.status==="pending";try{if(!r){p(this,X,ae).call(this,{type:"pending",variables:e}),await((a=(n=i(this,I).config).onMutate)==null?void 0:a.call(n,e,this));const se=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,e));se!==this.state.context&&p(this,X,ae).call(this,{type:"pending",context:se,variables:e})}const R=await s();return await((x=(g=i(this,I).config).onSuccess)==null?void 0:x.call(g,R,e,this.state.context,this)),await((E=(h=this.options).onSuccess)==null?void 0:E.call(h,R,e,this.state.context)),await((y=(U=i(this,I).config).onSettled)==null?void 0:y.call(U,R,null,this.state.variables,this.state.context,this)),await((P=(b=this.options).onSettled)==null?void 0:P.call(b,R,null,e,this.state.context)),p(this,X,ae).call(this,{type:"success",data:R}),R}catch(R){try{throw await((m=(f=i(this,I).config).onError)==null?void 0:m.call(f,R,e,this.state.context,this)),await((v=(O=this.options).onError)==null?void 0:v.call(O,R,e,this.state.context)),await((M=(j=i(this,I).config).onSettled)==null?void 0:M.call(j,void 0,R,this.state.variables,this.state.context,this)),await((C=(Q=this.options).onSettled)==null?void 0:C.call(Q,void 0,R,e,this.state.context)),R}finally{p(this,X,ae).call(this,{type:"error",error:R})}}}},Y=new WeakMap,ze=new WeakMap,I=new WeakMap,Ae=new WeakMap,X=new WeakSet,ae=function(e){const s=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!pt(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=s(this.state),F.batch(()=>{i(this,Y).forEach(r=>{r.onMutationUpdate(e)}),i(this,I).notify({mutation:this,type:"updated",action:e})})},Wt);function cs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var H,Ve,be,Yt,Us=(Yt=class extends Ke{constructor(e={}){super();l(this,H,void 0);l(this,Ve,void 0);l(this,be,void 0);this.config=e,o(this,H,[]),o(this,Ve,0)}build(e,s,r){const n=new Ms({mutationCache:this,mutationId:++at(this,Ve)._,options:e.defaultMutationOptions(s),state:r});return this.add(n),n}add(e){i(this,H).push(e),this.notify({type:"added",mutation:e})}remove(e){o(this,H,i(this,H).filter(s=>s!==e)),this.notify({type:"removed",mutation:e})}clear(){F.batch(()=>{i(this,H).forEach(e=>{this.remove(e)})})}getAll(){return i(this,H)}find(e){const s={exact:!0,...e};return i(this,H).find(r=>Nt(s,r))}findAll(e={}){return i(this,H).filter(s=>Nt(e,s))}notify(e){F.batch(()=>{this.listeners.forEach(s=>{s(e)})})}resumePausedMutations(){return o(this,be,(i(this,be)??Promise.resolve()).then(()=>{const e=i(this,H).filter(s=>s.state.isPaused);return F.batch(()=>e.reduce((s,r)=>s.then(()=>r.continue().catch(z)),Promise.resolve()))}).then(()=>{o(this,be,void 0)})),i(this,be)}},H=new WeakMap,Ve=new WeakMap,be=new WeakMap,Yt);function ks(t){return{onFetch:(e,s)=>{const r=async()=>{var b,P,f,m,O;const n=e.options,a=(f=(P=(b=e.fetchOptions)==null?void 0:b.meta)==null?void 0:P.fetchMore)==null?void 0:f.direction,c=((m=e.state.data)==null?void 0:m.pages)||[],d=((O=e.state.data)==null?void 0:O.pageParams)||[],g={pages:[],pageParams:[]};let x=!1;const h=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(e.signal.aborted?x=!0:e.signal.addEventListener("abort",()=>{x=!0}),e.signal)})},E=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),U=async(v,j,M)=>{if(x)return Promise.reject();if(j==null&&v.pages.length)return Promise.resolve(v);const Q={queryKey:e.queryKey,pageParam:j,direction:M?"backward":"forward",meta:e.options.meta};h(Q);const C=await E(Q),{maxPages:R}=e.options,se=M?Rs:Es;return{pages:se(v.pages,C,R),pageParams:se(v.pageParams,j,R)}};let y;if(a&&c.length){const v=a==="backward",j=v?Ds:Bt,M={pages:c,pageParams:d},Q=j(n,M);y=await U(M,Q,v)}else{y=await U(g,d[0]??n.initialPageParam);const v=t??c.length;for(let j=1;j<v;j++){const M=Bt(n,y);y=await U(y,M)}}return y};e.options.persister?e.fetchFn=()=>{var n,a;return(a=(n=e.options).persister)==null?void 0:a.call(n,r,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s)}:e.fetchFn=r}}}function Bt(t,{pages:e,pageParams:s}){const r=e.length-1;return t.getNextPageParam(e[r],e,s[r],s)}function Ds(t,{pages:e,pageParams:s}){var r;return(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,s[0],s)}var S,le,he,Me,Ue,de,ke,De,Xt,Qs=(Xt=class{constructor(t={}){l(this,S,void 0);l(this,le,void 0);l(this,he,void 0);l(this,Me,void 0);l(this,Ue,void 0);l(this,de,void 0);l(this,ke,void 0);l(this,De,void 0);o(this,S,t.queryCache||new As),o(this,le,t.mutationCache||new Us),o(this,he,t.defaultOptions||{}),o(this,Me,new Map),o(this,Ue,new Map),o(this,de,0)}mount(){at(this,de)._++,i(this,de)===1&&(o(this,ke,ht.subscribe(()=>{ht.isFocused()&&(this.resumePausedMutations(),i(this,S).onFocus())})),o(this,De,dt.subscribe(()=>{dt.isOnline()&&(this.resumePausedMutations(),i(this,S).onOnline())})))}unmount(){var t,e;at(this,de)._--,i(this,de)===0&&((t=i(this,ke))==null||t.call(this),o(this,ke,void 0),(e=i(this,De))==null||e.call(this),o(this,De,void 0))}isFetching(t){return i(this,S).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return i(this,le).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=i(this,S).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e!==void 0?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:s})=>{const r=s.data;return[e,r]})}setQueryData(t,e,s){const r=i(this,S).find({queryKey:t}),n=r==null?void 0:r.state.data,a=ws(e,n);if(typeof a>"u")return;const c=this.defaultQueryOptions({queryKey:t});return i(this,S).build(this,c).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return F.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){var e;return(e=i(this,S).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=i(this,S);F.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=i(this,S),r={type:"active",...t};return F.batch(()=>(s.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const s={revert:!0,...e},r=F.batch(()=>i(this,S).findAll(t).map(n=>n.cancel(s)));return Promise.all(r).then(z).catch(z)}invalidateQueries(t={},e={}){return F.batch(()=>{if(i(this,S).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const s={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(s,e)})}refetchQueries(t={},e){const s={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=F.batch(()=>i(this,S).findAll(t).filter(n=>!n.isDisabled()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(z)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(z)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const s=i(this,S).build(this,e);return s.isStaleByTime(e.staleTime)?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(z).catch(z)}fetchInfiniteQuery(t){return t.behavior=ks(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(z).catch(z)}resumePausedMutations(){return i(this,le).resumePausedMutations()}getQueryCache(){return i(this,S)}getMutationCache(){return i(this,le)}getDefaultOptions(){return i(this,he)}setDefaultOptions(t){o(this,he,t)}setQueryDefaults(t,e){i(this,Me).set($e(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...i(this,Me).values()];let s={};return e.forEach(r=>{He(t,r.queryKey)&&(s={...s,...r.defaultOptions})}),s}setMutationDefaults(t,e){i(this,Ue).set($e(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...i(this,Ue).values()];let s={};return e.forEach(r=>{He(t,r.mutationKey)&&(s={...s,...r.defaultOptions})}),s}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...i(this,he).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Mt(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...i(this,he).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){i(this,S).clear(),i(this,le).clear()}},S=new WeakMap,le=new WeakMap,he=new WeakMap,Me=new WeakMap,Ue=new WeakMap,de=new WeakMap,ke=new WeakMap,De=new WeakMap,Xt),T,w,Qe,k,ve,Ne,Z,Je,Te,Ie,je,we,fe,Ee,Re,_e,We,jt,Ye,wt,Xe,Et,Ze,Rt,et,Pt,tt,Ct,st,Ot,ft,ls,Zt,Ns=(Zt=class extends Ke{constructor(e,s){super();l(this,Re);l(this,We);l(this,Ye);l(this,Xe);l(this,Ze);l(this,et);l(this,tt);l(this,st);l(this,ft);l(this,T,void 0);l(this,w,void 0);l(this,Qe,void 0);l(this,k,void 0);l(this,ve,void 0);l(this,Ne,void 0);l(this,Z,void 0);l(this,Je,void 0);l(this,Te,void 0);l(this,Ie,void 0);l(this,je,void 0);l(this,we,void 0);l(this,fe,void 0);l(this,Ee,void 0);o(this,w,void 0),o(this,Qe,void 0),o(this,k,void 0),o(this,Ee,new Set),o(this,T,e),this.options=s,o(this,Z,null),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,w).addObserver(this),Kt(i(this,w),this.options)?p(this,Re,_e).call(this):this.updateResult(),p(this,Ze,Rt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return St(i(this,w),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return St(i(this,w),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,et,Pt).call(this),p(this,tt,Ct).call(this),i(this,w).removeObserver(this)}setOptions(e,s){const r=this.options,n=i(this,w);if(this.options=i(this,T).defaultQueryOptions(e),lt(r,this.options)||i(this,T).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,w),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),p(this,st,Ot).call(this);const a=this.hasListeners();a&&_t(i(this,w),n,this.options,r)&&p(this,Re,_e).call(this),this.updateResult(s),a&&(i(this,w)!==n||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&p(this,We,jt).call(this);const c=p(this,Ye,wt).call(this);a&&(i(this,w)!==n||this.options.enabled!==r.enabled||c!==i(this,fe))&&p(this,Xe,Et).call(this,c)}getOptimisticResult(e){const s=i(this,T).getQueryCache().build(i(this,T),e),r=this.createResult(s,e);return Is(this,r)&&(o(this,k,r),o(this,Ne,this.options),o(this,ve,i(this,w).state)),r}getCurrentResult(){return i(this,k)}trackResult(e){const s={};return Object.keys(e).forEach(r=>{Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:()=>(i(this,Ee).add(r),e[r])})}),s}getCurrentQuery(){return i(this,w)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const s=i(this,T).defaultQueryOptions(e),r=i(this,T).getQueryCache().build(i(this,T),s);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,s))}fetch(e){return p(this,Re,_e).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,k)))}createResult(e,s){var Q;const r=i(this,w),n=this.options,a=i(this,k),c=i(this,ve),d=i(this,Ne),x=e!==r?e.state:i(this,Qe),{state:h}=e;let{error:E,errorUpdatedAt:U,fetchStatus:y,status:b}=h,P=!1,f;if(s._optimisticResults){const C=this.hasListeners(),R=!C&&Kt(e,s),se=C&&_t(e,r,s,n);(R||se)&&(y=pt(e.options.networkMode)?"fetching":"paused",h.dataUpdatedAt||(b="pending")),s._optimisticResults==="isRestoring"&&(y="idle")}if(s.select&&typeof h.data<"u")if(a&&h.data===(c==null?void 0:c.data)&&s.select===i(this,Je))f=i(this,Te);else try{o(this,Je,s.select),f=s.select(h.data),f=vt(a==null?void 0:a.data,f,s),o(this,Te,f),o(this,Z,null)}catch(C){o(this,Z,C)}else f=h.data;if(typeof s.placeholderData<"u"&&typeof f>"u"&&b==="pending"){let C;if(a!=null&&a.isPlaceholderData&&s.placeholderData===(d==null?void 0:d.placeholderData))C=a.data;else if(C=typeof s.placeholderData=="function"?s.placeholderData((Q=i(this,Ie))==null?void 0:Q.state.data,i(this,Ie)):s.placeholderData,s.select&&typeof C<"u")try{C=s.select(C),o(this,Z,null)}catch(R){o(this,Z,R)}typeof C<"u"&&(b="success",f=vt(a==null?void 0:a.data,C,s),P=!0)}i(this,Z)&&(E=i(this,Z),f=i(this,Te),U=Date.now(),b="error");const m=y==="fetching",O=b==="pending",v=b==="error",j=O&&m;return{status:b,fetchStatus:y,isPending:O,isSuccess:b==="success",isError:v,isInitialLoading:j,isLoading:j,data:f,dataUpdatedAt:h.dataUpdatedAt,error:E,errorUpdatedAt:U,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>x.dataUpdateCount||h.errorUpdateCount>x.errorUpdateCount,isFetching:m,isRefetching:m&&!O,isLoadingError:v&&h.dataUpdatedAt===0,isPaused:y==="paused",isPlaceholderData:P,isRefetchError:v&&h.dataUpdatedAt!==0,isStale:Ut(e,s),refetch:this.refetch}}updateResult(e){const s=i(this,k),r=this.createResult(i(this,w),this.options);if(o(this,ve,i(this,w).state),o(this,Ne,this.options),i(this,ve).data!==void 0&&o(this,Ie,i(this,w)),lt(r,s))return;o(this,k,r);const n={},a=()=>{if(!s)return!0;const{notifyOnChangeProps:c}=this.options,d=typeof c=="function"?c():c;if(d==="all"||!d&&!i(this,Ee).size)return!0;const g=new Set(d??i(this,Ee));return this.options.throwOnError&&g.add("error"),Object.keys(i(this,k)).some(x=>{const h=x;return i(this,k)[h]!==s[h]&&g.has(h)})};(e==null?void 0:e.listeners)!==!1&&a()&&(n.listeners=!0),p(this,ft,ls).call(this,{...n,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,Ze,Rt).call(this)}},T=new WeakMap,w=new WeakMap,Qe=new WeakMap,k=new WeakMap,ve=new WeakMap,Ne=new WeakMap,Z=new WeakMap,Je=new WeakMap,Te=new WeakMap,Ie=new WeakMap,je=new WeakMap,we=new WeakMap,fe=new WeakMap,Ee=new WeakMap,Re=new WeakSet,_e=function(e){p(this,st,Ot).call(this);let s=i(this,w).fetch(this.options,e);return e!=null&&e.throwOnError||(s=s.catch(z)),s},We=new WeakSet,jt=function(){if(p(this,et,Pt).call(this),Be||i(this,k).isStale||!xt(this.options.staleTime))return;const s=rs(i(this,k).dataUpdatedAt,this.options.staleTime)+1;o(this,je,setTimeout(()=>{i(this,k).isStale||this.updateResult()},s))},Ye=new WeakSet,wt=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,w)):this.options.refetchInterval)??!1},Xe=new WeakSet,Et=function(e){p(this,tt,Ct).call(this),o(this,fe,e),!(Be||this.options.enabled===!1||!xt(i(this,fe))||i(this,fe)===0)&&o(this,we,setInterval(()=>{(this.options.refetchIntervalInBackground||ht.isFocused())&&p(this,Re,_e).call(this)},i(this,fe)))},Ze=new WeakSet,Rt=function(){p(this,We,jt).call(this),p(this,Xe,Et).call(this,p(this,Ye,wt).call(this))},et=new WeakSet,Pt=function(){i(this,je)&&(clearTimeout(i(this,je)),o(this,je,void 0))},tt=new WeakSet,Ct=function(){i(this,we)&&(clearInterval(i(this,we)),o(this,we,void 0))},st=new WeakSet,Ot=function(){const e=i(this,T).getQueryCache().build(i(this,T),this.options);if(e===i(this,w))return;const s=i(this,w);o(this,w,e),o(this,Qe,e.state),this.hasListeners()&&(s==null||s.removeObserver(this),e.addObserver(this))},ft=new WeakSet,ls=function(e){F.batch(()=>{e.listeners&&this.listeners.forEach(s=>{s(i(this,k))}),i(this,T).getQueryCache().notify({query:i(this,w),type:"observerResultsUpdated"})})},Zt);function Ts(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Kt(t,e){return Ts(t,e)||t.state.dataUpdatedAt>0&&St(t,e,e.refetchOnMount)}function St(t,e,s){if(e.enabled!==!1){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Ut(t,e)}return!1}function _t(t,e,s,r){return s.enabled!==!1&&(t!==e||r.enabled===!1)&&(!s.suspense||t.state.status!=="error")&&Ut(t,s)}function Ut(t,e){return t.isStaleByTime(e.staleTime)}function Is(t,e){return!lt(t.getCurrentResult(),e)}var pe,N,G,ie,Le,ut,rt,Ft,es,Ls=(es=class extends Ke{constructor(e,s){super();l(this,Le);l(this,rt);l(this,pe,void 0);l(this,N,void 0);l(this,G,void 0);l(this,ie,void 0);o(this,N,void 0),o(this,pe,e),this.setOptions(s),this.bindMethods(),p(this,Le,ut).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var r;const s=this.options;this.options=i(this,pe).defaultMutationOptions(e),lt(s,this.options)||i(this,pe).getMutationCache().notify({type:"observerOptionsUpdated",mutation:i(this,G),observer:this}),(r=i(this,G))==null||r.setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=i(this,G))==null||e.removeObserver(this)}onMutationUpdate(e){p(this,Le,ut).call(this),p(this,rt,Ft).call(this,e)}getCurrentResult(){return i(this,N)}reset(){o(this,G,void 0),p(this,Le,ut).call(this),p(this,rt,Ft).call(this)}mutate(e,s){var r;return o(this,ie,s),(r=i(this,G))==null||r.removeObserver(this),o(this,G,i(this,pe).getMutationCache().build(i(this,pe),this.options)),i(this,G).addObserver(this),i(this,G).execute(e)}},pe=new WeakMap,N=new WeakMap,G=new WeakMap,ie=new WeakMap,Le=new WeakSet,ut=function(){var s;const e=((s=i(this,G))==null?void 0:s.state)??cs();o(this,N,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},rt=new WeakSet,Ft=function(e){F.batch(()=>{var s,r,n,a,c,d,g,x;i(this,ie)&&this.hasListeners()&&((e==null?void 0:e.type)==="success"?((r=(s=i(this,ie)).onSuccess)==null||r.call(s,e.data,i(this,N).variables,i(this,N).context),(a=(n=i(this,ie)).onSettled)==null||a.call(n,e.data,null,i(this,N).variables,i(this,N).context)):(e==null?void 0:e.type)==="error"&&((d=(c=i(this,ie)).onError)==null||d.call(c,e.error,i(this,N).variables,i(this,N).context),(x=(g=i(this,ie)).onSettled)==null||x.call(g,void 0,e.error,i(this,N).variables,i(this,N).context))),this.listeners.forEach(h=>{h(i(this,N))})})},es),hs=A.createContext(void 0),B=t=>{const e=A.useContext(hs);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Bs=({client:t,children:e})=>(A.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),A.createElement(hs.Provider,{value:t},e)),ds=A.createContext(!1),Ks=()=>A.useContext(ds);ds.Provider;function _s(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var $s=A.createContext(_s()),Hs=()=>A.useContext($s);function fs(t,e){return typeof t=="function"?t(...e):!!t}var Gs=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},zs=t=>{A.useEffect(()=>{t.clearReset()},[t])},Vs=({result:t,errorResetBoundary:e,throwOnError:s,query:r})=>t.isError&&!e.isReset()&&!t.isFetching&&fs(s,[t.error,r]),Js=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)},Ws=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Ys=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function Xs(t,e,s){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=B(s),n=Ks(),a=Hs(),c=r.defaultQueryOptions(t);c._optimisticResults=n?"isRestoring":"optimistic",Js(c),Gs(c,a),zs(a);const[d]=A.useState(()=>new e(r,c)),g=d.getOptimisticResult(c);if(A.useSyncExternalStore(A.useCallback(x=>{const h=n?()=>{}:d.subscribe(F.batchCalls(x));return d.updateResult(),h},[d,n]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),A.useEffect(()=>{d.setOptions(c,{listeners:!1})},[c,d]),Ws(c,g))throw Ys(c,d,a);if(Vs({result:g,errorResetBoundary:a,throwOnError:c.throwOnError,query:d.getCurrentQuery()}))throw g.error;return c.notifyOnChangeProps?g:d.trackResult(g)}function it(t,e){return Xs(t,Ns,e)}function J(t,e){const s=B(e),[r]=A.useState(()=>new Ls(s,t));A.useEffect(()=>{r.setOptions(t)},[r,t]);const n=A.useSyncExternalStore(A.useCallback(c=>r.subscribe(F.batchCalls(c)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((c,d)=>{r.mutate(c,d).catch(Zs)},[r]);if(n.error&&fs(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}function Zs(){}function D(){return B().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const ye=()=>{const{data:t,refetch:e}=it({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[t,s=>{s&&(localStorage.setItem("currentPage",s||""),e())}]};let $t="";const nt=()=>($t=localStorage.getItem("__chai_at"),$t);function er(t){const e={method:"GET",headers:{"x-chai-access-token":nt()}};return fetch(t,e)}function tr(t,e){const s={method:"POST",headers:{"x-chai-access-token":nt()},body:JSON.stringify(e)};return fetch(t,s)}function sr(t,e){const s={method:"PUT",headers:{"x-chai-access-token":nt()},body:JSON.stringify(e)};return fetch(t,s)}function rr(t,e){const s={method:"DELETE",headers:{"x-chai-access-token":nt()},body:JSON.stringify(e)};return fetch(t,s)}const K={get:er,post:tr,put:sr,delete:rr},kt=()=>{const[t,e]=ye(),s=D();return it({queryKey:["project"],queryFn:async()=>{const{data:r}=await K.get(`${s}/project`).then(n=>n.json());if(!t&&r){const n=localStorage.getItem("currentPage");e(n||(r==null?void 0:r.homepage))}return r}})},Dt=()=>{const t=D();return it({queryKey:["pages"],queryFn:async()=>{const{data:e}=await K.get(`${t}/pages`).then(s=>s.json());return e||[]}})},ps=()=>{const[t]=ye(),e=D();return it({queryKey:["page_data",t],queryFn:async()=>{const{data:s}=await K.get(`${e}/page?uuid=${t}`).then(r=>r.json());return s},enabled:!!t,staleTime:3e3})},qt=()=>u.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:u.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[u.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),u.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),ys=(t="Project updated successfully.")=>{const e=B(),s=D();return J({mutationFn:async r=>await K.put(`${s}/project`,r).then(n=>n.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["project"]}),ee.toast.success(t)}})},ms=()=>{const[t]=["SAVED"],[e,s]=ye(),r=ts.useBuilderReset(),{t:n}=bs.useTranslation();return a=>t!=="SAVED"?(ee.toast.error(n("You have unsaved changes. Please save before changing the page.")),!1):e===a.uuid?!1:(r(),setTimeout(()=>s(a.uuid),100),!0)},ir=()=>{const t=B(),e=ms(),s=D();return J({mutationFn:async r=>K.post(`${s}/pages`,r).then(n=>n.json()),onSuccess:r=>{t.invalidateQueries({queryKey:["pages"]}),e({uuid:r.uuid,slug:r.slug}),ee.toast.success("Page added successfully.")}})},gs=()=>{const t=D(),[e]=ye(),s=B();return J({mutationFn:async r=>K.put(`${t}/page`,r).then(n=>n.json()),onSuccess:async r=>{var n;if(r.result==="error"&&((n=r.error)==null?void 0:n.code)=="PAGE_LOCKED"){s.invalidateQueries({queryKey:["page_data",e]});return}ee.toast.success("Page saved successfully.")}})},nr=()=>{const t=D(),{data:e}=Dt(),[s]=ye(),{data:r}=kt(),n=B();return J({mutationFn:async()=>{const a=e.find(c=>c.uuid===s).slug;return await K.post(`${t}/publish`,{slug:a,uuid:s,isHomepage:(r==null?void 0:r.homepage)===s}).then(c=>c.json())},onSuccess:async a=>{var c;if(a.result==="error"&&((c=a.error)==null?void 0:c.code)=="PAGE_LOCKED"){n.invalidateQueries({queryKey:["page_data",s]});return}ee.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},ar=()=>{const t=B(),e=D();return J({mutationFn:async s=>K.delete(`${e}/page`,s).then(r=>r.json()),onSuccess:()=>{ee.toast.success("Page deleted successfully."),t.invalidateQueries({queryKey:["pages"]})}})},or=()=>{const t=B(),e=D();return J({mutationFn:async s=>K.post(`${e}/take-control`,{uuid:s}).then(r=>r.json()),onSuccess:(s,r)=>{t.invalidateQueries({queryKey:["page_data",r]})}})},ur=()=>{const t=D();return J({mutationFn:async()=>{const{data:e}=await K.get(`${t}/library`).then(s=>s.json());return te.sortBy(te.filter(e,s=>!te.has(s,"hidden")),"group")}})},cr=()=>{const t=D();return J({mutationFn:async e=>{if(!e||!e.uuid)return[];try{const{data:s}=await K.get(`${t}/block?uuid=${e.uuid}&format=${e.format}`).then(async r=>e.format==="html"?vs.getBlocksFromHTML(await r.text()):await r.json());return te.set(s,"0._name",te.capitalize(e.group)),s||[]}catch{return[]}}})},lr=()=>{const t=D();return J({mutationFn:async e=>{const s=new FormData;s.append("file",e);const{data:r}=await fetch(`${t}/upload`,{method:"POST",headers:{"x-chai-access-token":nt()},body:s}).then(n=>n.json());return r}})};function xs(t){return ss.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"}}]})(t)}function hr(t){return ss.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}}]})(t)}const dr=()=>{const{mutate:t,isPending:e}=or(),[s]=ye(),{data:r}=ps(),n=te.get(r,"lockedBy.name",""),a=te.get(r,"lockedBy.email","");return u.jsxRuntimeExports.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg drop-shadow-2xl mx-auto p-10 space-y-4 text-center max-w-xl",children:[u.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),u.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",u.jsxRuntimeExports.jsx("br",{}),u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[u.jsxRuntimeExports.jsx(hr,{className:"w-4 h-4 text-gray-500"})," ",n]}),u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[u.jsxRuntimeExports.jsx(xs,{className:"w-4 h-4 text-gray-500"})," ",a]})]}),u.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",n," will be ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),u.jsxRuntimeExports.jsx(gt.Button,{disabled:e,onClick:()=>t(s),className:`w-36 ${e?"bg-transparent shadow-none hover:bg-transparent":""}`,children:e?u.jsxRuntimeExports.jsx(At.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},fr=()=>{const t=D(),e=B();return J({mutationFn:async s=>{const r=await fetch(`${t}/login`,{method:"POST",body:JSON.stringify(s)});if(r.ok)return await r.json();throw r.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:s=>{const{data:r}=s;if(!r.accessToken){ee.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",r.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(te.omit(r,["accessToken"]))),e.invalidateQueries({queryKey:["verify"]}),ee.toast.success("Logged in successfully.")},onError:()=>{ee.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},pr=()=>{const t=D();return it({queryKey:["verify"],queryFn:async()=>{const e=await K.get(`${t}/verify`);return e.ok?(await e.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},yr=()=>{const t=D(),e=B();return J({mutationFn:async()=>{const{result:s}=await K.post(`${t}/logout`).then(r=>r.json());if(s==="success")return localStorage.clear(),e.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},mr=({children:t})=>{const e=yr();return u.jsxRuntimeExports.jsxs(ne.AlertDialog,{children:[u.jsxRuntimeExports.jsx(ne.AlertDialogTrigger,{asChild:!0,children:t}),u.jsxRuntimeExports.jsxs(ne.AlertDialogContent,{children:[u.jsxRuntimeExports.jsxs(ne.AlertDialogHeader,{children:[u.jsxRuntimeExports.jsxs(ne.AlertDialogTitle,{children:["Are you sure, you want to ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),u.jsxRuntimeExports.jsx(ne.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),u.jsxRuntimeExports.jsxs(ne.AlertDialogFooter,{children:[u.jsxRuntimeExports.jsx(ne.AlertDialogCancel,{disabled:e.isPending,children:"Cancel"}),u.jsxRuntimeExports.jsxs("button",{disabled:e.isPending,onClick:()=>e.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[e.isPending&&u.jsxRuntimeExports.jsx(At.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},gr=()=>u.jsxRuntimeExports.jsx(mr,{children:u.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:u.jsxRuntimeExports.jsx(At.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),xr=gr,br=L.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-Gi0z6gaf.cjs"))),vr=L.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-kiiljG4H.cjs"))),jr=L.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-3gQTH0Zt.cjs"))),wr=()=>u.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),Er=()=>{const{mutate:t}=nr();return gt.useBuilderProp("editable",!0)?u.jsxRuntimeExports.jsx(gt.Button,{onClick:t,className:"bg-blue-600 text-white",children:"Publish"}):null},Rr=t=>{var v;const{data:e,isLoading:s}=kt(),{data:r,isLoading:n}=Dt(),{data:a}=ps(),{mutate:c}=ys(),{mutate:d}=gs(),[g]=ye(),x=lr(),h=ur(),E=cr(),U=D(),y=L.useCallback(async j=>await x.mutateAsync(j),[x]),b=L.useCallback(async()=>await h.mutateAsync(),[h]),P=L.useCallback(async j=>await E.mutateAsync(j),[E]),f=async(j=20,M=0)=>{const Q=`limit=${j}&offset=${M}`,C=await fetch(`${U}/assets?${Q}`).then(R=>R.json());return C.result==="success"?C.data:[]},{logo:m=wr}=t;if(s||!e)return u.jsxRuntimeExports.jsx(qt,{});if(n||!r)return u.jsxRuntimeExports.jsx(qt,{});const O={...t,editable:a!=null&&a.lockedBy?a==null?void 0:a.lockedBy.self:!0,nonEditableComponent:dr,blocks:(a==null?void 0:a.blocks)||[],brandingOptions:e.brandingOptions,darkMode:t.darkMode||!1,dataProviders:(a==null?void 0:a.providers)||[],onSavePage:async({blocks:j,providers:M})=>(await d({blocks:j,providers:M,uuid:g}),!0),onSaveBrandingOptions:async j=>(await c({brandingOptions:j}),!0),topBarComponents:{left:[m],center:[jr],right:[Er]},sideBarComponents:{top:[{icon:ct.FileTextIcon,name:"pages",panel:br},{icon:ct.GearIcon,name:"settings",panel:vr},...((v=t.sideBarComponents)==null?void 0:v.top)||[]],bottom:[xr]},uploadMediaCallback:y,fetchMediaCallback:f,getUILibraryBlocks:b,getExternalPredefinedBlock:P,getPages:()=>r};return u.jsxRuntimeExports.jsx(ts.ChaiBuilderEditor,{...O})},Pr=({logo:t})=>{const[e,s]=L.useState(!1),[r,n]=L.useState(""),[a,c]=L.useState(""),{mutate:d,isPending:g}=fr(),x=h=>{h.preventDefault(),d({email:r,password:a})};return u.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen flex items-center justify-center bg-[radial-gradient(#AAA,transparent_0.5px)] duration-300 [background-size:6px_6px]",children:u.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:u.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[u.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[u.jsxRuntimeExports.jsx(L.Suspense,{children:t?L.createElement(t):""}),u.jsxRuntimeExports.jsx("p",{className:"max-w-xl mx-auto text-base leading-relaxed text-gray-700 font-thin",children:"Enter your login credential to continue"})]}),u.jsxRuntimeExports.jsx("div",{className:"mt-8",children:u.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:x,className:"space-y-5",children:[u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[u.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:u.jsxRuntimeExports.jsx(xs,{})}),u.jsxRuntimeExports.jsx("input",{value:r,onChange:h=>n(h.target.value),type:"email",id:"email",placeholder:"Enter email",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"})]})}),u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[u.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:u.jsxRuntimeExports.jsx("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:u.jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"})})}),u.jsxRuntimeExports.jsx("input",{value:a,onChange:h=>c(h.target.value),type:e?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),u.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>s(!e),children:e?u.jsxRuntimeExports.jsx(ct.EyeClosedIcon,{}):u.jsxRuntimeExports.jsx(ct.EyeOpenIcon,{})})]})}),u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsx("button",{disabled:g||te.size(r)<2||te.size(a)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:g?"Signing in...":"Login"})})]})}),u.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:u.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},Cr=t=>{const{data:e,isLoading:s}=pr(),r=B();return L.useEffect(()=>{r.setQueryData(["apiBaseUrl"],t.apiBaseUrl||"/api/chaibuilder")},[t.apiBaseUrl,r]),s?u.jsxRuntimeExports.jsx(qt,{}):e!=null&&e.valid?u.jsxRuntimeExports.jsx(Rr,{...t}):u.jsxRuntimeExports.jsx(Pr,{logo:t.logo})},Or=new Qs,Sr=t=>u.jsxRuntimeExports.jsxs(Bs,{client:Or,children:[u.jsxRuntimeExports.jsx(ee.Toaster,{richColors:!0}),u.jsxRuntimeExports.jsx(Cr,{...t})]});exports.ChaiBuilderStudio=Sr;exports.useAddPage=ir;exports.useChangePage=ms;exports.useCurrentPage=ye;exports.useDeletePage=ar;exports.usePages=Dt;exports.useProject=kt;exports.useQueryClient=B;exports.useUpdatePage=gs;exports.useUpdateProject=ys;