@chaibuilder/sdk 1.2.49 → 1.2.50

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 (108) hide show
  1. package/dist/{AddBlocks-JCSA6hLF.js → AddBlocks-IX7HKzSe.js} +18 -18
  2. package/dist/AddBlocks-zwZ63DdP.cjs +1 -0
  3. package/dist/CanvasArea-URgoG1jc.cjs +56 -0
  4. package/dist/{CanvasArea-c3xbVSoY.js → CanvasArea-ehmBje_E.js} +279 -263
  5. package/dist/{ChaiBuilderEditor-F2yUJQdt.js → ChaiBuilderEditor-3xIN-AP_.js} +8548 -8606
  6. package/dist/{ChaiBuilderEditor-lqHQcnh3.cjs → ChaiBuilderEditor-ZRHqW7Gd.cjs} +50 -50
  7. package/dist/CodeEditor-0F7Dz3AB.js +97 -0
  8. package/dist/CodeEditor-1vu-qNgT.cjs +1 -0
  9. package/dist/CurrentPage-HOPNdQZ-.cjs +1 -0
  10. package/dist/{CurrentPage--lDu6fB9.js → CurrentPage-qhBjm7th.js} +10 -10
  11. package/dist/ListTree-DkbFFDXB.cjs +1 -0
  12. package/dist/{ListTree-7DWSal1i.js → ListTree-sTwXvXST.js} +6 -6
  13. package/dist/{MODIFIERS-cBT31iqE.js → MODIFIERS-fd5XOmum.js} +8 -4
  14. package/dist/MODIFIERS-mVmfEGgo.cjs +1 -0
  15. package/dist/{PagesPanel-D1TOGyVE.js → PagesPanel-5iVsbDP1.js} +7 -7
  16. package/dist/PagesPanel-kdl4A0IN.cjs +1 -0
  17. package/dist/{ProjectPanel-PdvQsrbk.js → ProjectPanel-c8oTzhQd.js} +7 -7
  18. package/dist/ProjectPanel-mXPBI-TU.cjs +1 -0
  19. package/dist/{Settings-aEcWAB0x.js → Settings-0uSGoECC.js} +463 -446
  20. package/dist/Settings-3kBSStO6.cjs +1 -0
  21. package/dist/{SidePanels-uym8wfA0.js → SidePanels-YLWdBer9.js} +40 -40
  22. package/dist/SidePanels-kKram02Q.cjs +1 -0
  23. package/dist/ThemeConfiguration-8W1CM4tW.cjs +1 -0
  24. package/dist/{ThemeConfiguration-7J_Qt53c.js → ThemeConfiguration-AAGFJieC.js} +9 -9
  25. package/dist/Topbar-CLNUPx7K.cjs +1 -0
  26. package/dist/{Topbar-DkbE0ccQ.js → Topbar-nX9Muoem.js} +8 -8
  27. package/dist/UILibrariesPanel-cp0Mkaq_.cjs +1 -0
  28. package/dist/{UILibrariesPanel-3cSqwsMi.js → UILibrariesPanel-fKn2nlgI.js} +8 -8
  29. package/dist/UnsplashImages-56HoW_ZA.cjs +1 -0
  30. package/dist/{UnsplashImages-owPv8UfV.js → UnsplashImages-zTZa3LjG.js} +6 -6
  31. package/dist/{UploadImages-zGp0fN1z.js → UploadImages-SnfaTrlz.js} +4 -4
  32. package/dist/UploadImages-okNGjkXb.cjs +1 -0
  33. package/dist/add-page-modal-Y2RY3x01.cjs +1 -0
  34. package/dist/{add-page-modal-pOnhQNMH.js → add-page-modal-uDoO0zws.js} +12 -12
  35. package/dist/{confirm-alert-lbkop3bB.js → confirm-alert-9XiVxCc0.js} +4 -4
  36. package/dist/confirm-alert-aD7AMK_6.cjs +1 -0
  37. package/dist/controls-rRZhz0vu.cjs +1 -0
  38. package/dist/{controls-VTdJhdSz.js → controls-yjgoZzB6.js} +31 -18
  39. package/dist/core.cjs +1 -1
  40. package/dist/core.js +6 -6
  41. package/dist/{delete-page-modal-3OWHRhV4.js → delete-page-modal-7sfoFf9r.js} +6 -6
  42. package/dist/delete-page-modal-ieJ367JA.cjs +1 -0
  43. package/dist/email-blocks.cjs +1 -1
  44. package/dist/email-blocks.js +1 -1
  45. package/dist/email.cjs +1 -1
  46. package/dist/email.js +4 -4
  47. package/dist/{form-Rqiu0P7V.cjs → form-KWYHDVIf.cjs} +1 -1
  48. package/dist/{form-CetbKOxf.js → form-PQSmqcIl.js} +5 -5
  49. package/dist/{functions-WB3m-mfN.js → functions-JO0EW8GX.js} +1 -1
  50. package/dist/functions-ZZVUnIjD.cjs +1 -0
  51. package/dist/{html-to-json-Z6R2o_fA.js → html-to-json-GJ6RioQf.js} +1 -1
  52. package/dist/html-to-json-O1OpqICe.cjs +1 -0
  53. package/dist/index-VOrp9ZpX.cjs +1 -0
  54. package/dist/index-YpnaudSM.js +63 -0
  55. package/dist/index-ecnGWzh9.cjs +1 -0
  56. package/dist/{index-Mzvi8sMV.js → index-i2kgLkjC.js} +15 -14
  57. package/dist/lib.cjs +2 -2
  58. package/dist/lib.js +19 -20
  59. package/dist/page-viewer-aoro5JxT.cjs +1 -0
  60. package/dist/{page-viewer-7iyxGntn.js → page-viewer-qkwZJ6e-.js} +12 -12
  61. package/dist/{project-general-setting-tHdsXTwH.js → project-general-setting-3gkaXq1F.js} +12 -12
  62. package/dist/project-general-setting-arXitV5_.cjs +1 -0
  63. package/dist/{project-seo-setting-zEBZ91Xk.js → project-seo-setting-X8pykTmc.js} +6 -6
  64. package/dist/project-seo-setting-kjtUt-er.cjs +1 -0
  65. package/dist/render.cjs +1 -1
  66. package/dist/render.js +44 -45
  67. package/dist/single-page-detail-UsWG0gfh.cjs +1 -0
  68. package/dist/{single-page-detail-RBfdbTs3.js → single-page-detail-ZXZX6Xmw.js} +21 -21
  69. package/dist/studio.cjs +1 -1
  70. package/dist/studio.js +6 -6
  71. package/dist/ui.cjs +1 -1
  72. package/dist/ui.js +100 -100
  73. package/dist/useCodeEditor-CtjbxWLf.cjs +1 -0
  74. package/dist/useCodeEditor-yl5V3Hte.js +7 -0
  75. package/dist/{utils-K3Zk762G.cjs → utils-D_vtk3zK.cjs} +1 -1
  76. package/dist/{utils-iMv3T4WT.js → utils-VpVqnC9m.js} +1 -1
  77. package/dist/web-blocks.cjs +1 -33
  78. package/dist/web-blocks.js +468 -616
  79. package/package.json +4 -2
  80. package/dist/AddBlocks-JiIeMTE-.cjs +0 -1
  81. package/dist/CanvasArea-K_d6ORTZ.cjs +0 -55
  82. package/dist/CurrentPage-DnQKF1wT.cjs +0 -1
  83. package/dist/ListTree-HVFqaM0-.cjs +0 -1
  84. package/dist/MODIFIERS-YPHRtwrM.cjs +0 -1
  85. package/dist/PagesPanel-pIFhxLGC.cjs +0 -1
  86. package/dist/ProjectPanel-t7s3-URx.cjs +0 -1
  87. package/dist/STRINGS--j49GZJP.js +0 -7
  88. package/dist/STRINGS-gPz7CUOk.cjs +0 -1
  89. package/dist/Settings-WevLeOpk.cjs +0 -1
  90. package/dist/SidePanels-mavyE3q_.cjs +0 -1
  91. package/dist/ThemeConfiguration-F-_ieF8J.cjs +0 -1
  92. package/dist/Topbar-FjX_5927.cjs +0 -1
  93. package/dist/UILibrariesPanel-qsjCsv10.cjs +0 -1
  94. package/dist/UnsplashImages-5skIflMr.cjs +0 -1
  95. package/dist/UploadImages-olCKp-66.cjs +0 -1
  96. package/dist/add-page-modal-JE2NTOKQ.cjs +0 -1
  97. package/dist/confirm-alert-GTawvuT8.cjs +0 -1
  98. package/dist/controls-jWJDao88.cjs +0 -1
  99. package/dist/delete-page-modal-S42VXCGh.cjs +0 -1
  100. package/dist/functions-fujiWLsg.cjs +0 -1
  101. package/dist/html-to-json-VPWiWWGH.cjs +0 -1
  102. package/dist/index-SZn6KcOd.cjs +0 -1
  103. package/dist/page-viewer-fFmRhZs3.cjs +0 -1
  104. package/dist/project-general-setting-0HJ_qyW3.cjs +0 -1
  105. package/dist/project-seo-setting-Ln9aX7b5.cjs +0 -1
  106. package/dist/single-page-detail-H0heOB33.cjs +0 -1
  107. package/dist/useCanvasSettings-2YhM5XKu.js +0 -6
  108. package/dist/useCanvasSettings-tDzAqXUt.cjs +0 -1
@@ -1,6 +1,6 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { A as p, a as l, b as n, d, e as a, g as c, B as u } from "./ChaiBuilderEditor-F2yUJQdt.js";
3
- import { h } from "./index-Mzvi8sMV.js";
2
+ import { A as p, a as l, b as n, d, e as a, g as c, B as u } from "./ChaiBuilderEditor-3xIN-AP_.js";
3
+ import { h } from "./index-i2kgLkjC.js";
4
4
  import { TrashIcon as x } from "@radix-ui/react-icons";
5
5
  import "./_commonjsHelpers-UyOWmZb0.js";
6
6
  import "react";
@@ -13,14 +13,13 @@ import "i18next";
13
13
  import "react-i18next";
14
14
  import "flagged";
15
15
  import "lodash-es";
16
- import "./STRINGS--j49GZJP.js";
16
+ import "./MODIFIERS-fd5XOmum.js";
17
17
  import "./Functions-7jnEwJyw.js";
18
18
  import "tailwind-merge";
19
19
  import "@chaibuilder/runtime";
20
20
  import "@react-hookz/web";
21
- import "./MODIFIERS-cBT31iqE.js";
22
21
  import "tree-model";
23
- import "./utils-iMv3T4WT.js";
22
+ import "./utils-VpVqnC9m.js";
24
23
  import "@radix-ui/react-toggle";
25
24
  import "class-variance-authority";
26
25
  import "@radix-ui/react-switch";
@@ -44,9 +43,10 @@ import "react-icons-picker";
44
43
  import "react-quill";
45
44
  import "react-hotkeys-hook";
46
45
  import "lucide-react";
46
+ import "./index-YpnaudSM.js";
47
47
  import "./core.js";
48
48
  import "sonner";
49
- import "./html-to-json-Z6R2o_fA.js";
49
+ import "./html-to-json-GJ6RioQf.js";
50
50
  import "himalaya";
51
51
  const ce = ({ pageData: r, projectData: i }) => {
52
52
  const m = {}, t = h(), o = r.uuid === i.homepage, s = () => {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),l=require("./index-VOrp9ZpX.cjs"),q=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index-ecnGWzh9.cjs");require("./core.cjs");require("sonner");require("./html-to-json-O1OpqICe.cjs");require("himalaya");const d=({pageData:i,projectData:t})=>{const n={},u=l.useDeletePage(),s=i.uuid===t.homepage,o=()=>{u.mutate(i,{onSuccess:()=>{n({uuid:t.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:s,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${s?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(q.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:u.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(r.Button,{variant:"destructive",onClick:o,disabled:u.isPending,children:"Yes, Delete"})]})]})]})};exports.default=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lodash-es"),i=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("@react-email/components"),c=require("@chaibuilder/runtime"),d=require("./empty-slot-Sy930lX6.cjs"),l=require("./controls-jWJDao88.cjs"),a=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");const m=({blockProps:e,styles:t,children:o,inBuilder:r})=>{let n=o;return o||(n=i.jsxRuntimeExports.jsx(d.EmptySlot,{inBuilder:r})),i.jsxRuntimeExports.jsx(s.Container,{...e,...t,children:n})};c.registerChaiBlock(m,{type:"Email/Container",label:"Container",group:"basic",category:"core",canAcceptBlock:()=>!0,canMove:()=>!0,canDelete:()=>!1,canDuplicate:()=>!1,canBeNested:e=>!e});const x=({blockProps:e,styles:t,children:o})=>i.jsxRuntimeExports.jsx(s.Section,{...e,...t,children:o});c.registerChaiBlock(x,{type:"Email/Section",label:"Section",group:"basic",category:"core",icon:a.ImageIcon,props:{align:l.y({title:"Align",default:"",options:[{value:"",title:"None"},{value:"left",title:"left"},{value:"center",title:"center"},{value:"right",title:"right"}]})},canAcceptBlock:()=>!0});const g=({blockProps:e,styles:t,children:o})=>i.jsxRuntimeExports.jsx(s.Row,{...e,...t,children:o});c.registerChaiBlock(g,{type:"Email/Row",label:"Row",group:"basic",category:"core",icon:a.ImageIcon,blocks:[{_type:"Email/Row",_id:"a"},{_type:"Email/Column",_id:"b",_parent:"a"}],props:{styles:l.S({default:""})},canAcceptBlock:e=>e==="Email/Column"});const h=({blockProps:e,styles:t,children:o,align:r})=>{let n=o;return o||(n=i.jsxRuntimeExports.jsx(d.EmptySlot,{})),i.jsxRuntimeExports.jsx(s.Column,{...e,...t,align:r,children:n})};c.registerChaiBlock(h,{type:"Email/Column",label:"Column",group:"basic",category:"core",icon:a.ImageIcon,props:{styles:l.S({default:""}),align:l.y({title:"Align",default:"",options:[{value:"",title:"None"},{value:"left",title:"left"},{value:"center",title:"center"},{value:"right",title:"right"}]})},canAcceptBlock:()=>!0,canBeNested:e=>e==="Email/Row"});const k=({level:e,blockProps:t,styles:o,content:r})=>i.jsxRuntimeExports.jsx(s.Heading,{as:e,...t,...o,children:r}),b=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx("h1",{...e,...t,children:o});c.registerChaiBlock(k,{type:"Email/Heading",label:"Heading",group:"basic",category:"core",icon:a.HeadingIcon,builderComponent:b,props:{content:l.l({title:"Content",default:"Enter your heading here..."}),styles:l.S({default:"text-xl"}),level:l.y({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]})},canAcceptBlock:e=>["Email/Link","Email/RawText"].includes(e)});const B=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx(s.Text,{...e,...t,children:o}),C=({content:e,blockProps:t,styles:o})=>i.jsxRuntimeExports.jsx("p",{...t,...o,children:e});c.registerChaiBlock(B,{type:"Email/Text",label:"Text",group:"basic",category:"core",icon:a.TextIcon,builderComponent:C,props:{content:l.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitor. Ut in nulla enim."}),styles:l.S({default:""})},canAcceptBlock:e=>["Email/Link","Email/RawText"].includes(e)});const j=({content:e})=>e,y=({content:e,blockProps:t})=>i.jsxRuntimeExports.jsx("span",{...t,children:e});c.registerChaiBlock(j,{type:"Email/RawText",label:"Raw Text",group:"basic",category:"core",icon:a.TextIcon,hidden:!0,builderComponent:y,props:{content:l.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. "})}});const E=({blockProps:e,styles:t,link:o,content:r})=>i.jsxRuntimeExports.jsx(s.Button,{...e,...t,href:o.href,children:r}),f=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx("button",{type:"button",...e,...t,children:o});c.registerChaiBlock(E,{type:"Email/Button",label:"Button",group:"basic",category:"core",builderComponent:f,props:{content:l.l({title:"Content",default:"Click me"}),link:l.T({title:"Link",default:{href:"https://chaibuilder.com",target:"_blank",type:"url"}}),styles:l.S({default:"bg-primary text-white px-4 py-2 rounded-md"})}});const R=({blockProps:e,styles:t,href:o,content:r,target:n,children:u})=>i.jsxRuntimeExports.jsx(s.Link,{...e,...t,href:o,target:n,children:u||r}),v=({blockProps:e,styles:t,content:o,children:r})=>{let n=r;return r||(n=i.jsxRuntimeExports.jsx(d.EmptySlot,{})),i.jsxRuntimeExports.jsx("span",{...e,...t,children:n||o})};c.registerChaiBlock(R,{type:"Email/Link",label:"Link",group:"basic",category:"core",icon:a.Link1Icon,blocks:[{_id:"a",_type:"Link"},{_id:"b",_parent:"a",_type:"RawText",content:"I am a link."}],builderComponent:v,props:{content:l.l({title:"Content",default:"I am a link."}),link:l.T({title:"Link",default:{href:"https://chaibuilder.com",target:"_blank",type:"url"}}),styles:l.S({default:"font-bold text-blue-500"})},canAcceptBlock:()=>!0});const w=({blockProps:e,styles:t,children:o})=>i.jsxRuntimeExports.jsx(s.Preview,{...e,...t,children:o}),I=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx("div",{...e,...t,children:o});c.registerChaiBlock(w,{type:"Email/Preview",label:"Preview",group:"basic",category:"core",builderComponent:I,canAcceptBlock:()=>!0,canDuplicate:()=>!1,props:{content:l.g({default:"Preview content",title:"Content"})}});const S=({blockProps:e,content:t})=>i.jsxRuntimeExports.jsx(s.Markdown,{children:t,...e});c.registerChaiBlock(S,{type:"Email/Markdown",label:"Markdown",group:"basic",category:"core",props:{content:l.g({default:"# This is a ~~strikethrough~~",title:"Markdown"})}});const T=({blockProps:e,styles:t,alt:o,image:r,width:n,height:u})=>i.jsxRuntimeExports.jsx(s.Img,{...e,...t,src:r,alt:o,width:n,height:u}),L=({blockProps:e,styles:t,alt:o,image:r,width:n,height:u})=>i.jsxRuntimeExports.jsx("img",{...e,...t,src:r,alt:o,width:n,height:u});c.registerChaiBlock(T,{type:"Email/Image",label:"Image",group:"basic",category:"core",icon:a.ImageIcon,builderComponent:L,props:{styles:l.S({default:"w-full"}),image:l.q({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.l({title:"Alt",default:""}),width:l.l({title:"Width",default:""}),height:l.l({title:"Height",default:""})}});const q=({blockProps:e,styles:t})=>i.jsxRuntimeExports.jsx(s.Hr,{...e,...t}),H=({blockProps:e,styles:t})=>i.jsxRuntimeExports.jsx("hr",{...e,...t});c.registerChaiBlock(q,{type:"Email/Divider",label:"Divider",group:"basic",category:"core",icon:a.DividerHorizontalIcon,builderComponent:H,props:{styles:l.S({default:"w-full h-2"})}});const _=({blockProps:e,styles:t,code:o,lineNumbers:r,theme:n,language:u})=>i.jsxRuntimeExports.jsx(s.CodeBlock,{...e,...t,code:o,linenumbers:r,theme:n,language:u}),A=({blockProps:e,styles:t,code:o})=>i.jsxRuntimeExports.jsx("div",{...e,...t,children:i.jsxRuntimeExports.jsx("code",{children:o})});c.registerChaiBlock(_,{type:"Email/CodeBlock",label:"Code Block",group:"basic",category:"core",hidden:!0,icon:a.CodeSandboxLogoIcon,builderComponent:A,props:{styles:l.S({default:""}),code:l.g({title:"Code",default:"console.log('Hello, world!');"}),theme:l.l({title:"Theme",default:"dracula"}),lineNumbers:l.r({title:"Line number",default:!1}),language:l.y({title:"Language",default:"javascript",binding:!1,options:[{value:"javascript",title:"JavaScript"},{value:"html",title:"HTML"},{value:"css",title:"CSS"}]})}});const D=({blockProps:e,styles:t,code:o})=>i.jsxRuntimeExports.jsx(s.CodeInline,{...e,...t,children:o}),M=({blockProps:e,styles:t,code:o})=>i.jsxRuntimeExports.jsx("code",{...e,...t,children:o});c.registerChaiBlock(D,{type:"Email/CodeInline",label:"Code Inline",group:"basic",category:"core",icon:a.CodeSandboxLogoIcon,builderComponent:M,props:{styles:l.S({default:""}),code:l.g({title:"Code",default:"console.log('Hello, world!');"})}});const N=p.noop;exports.loadEmailBlocks=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lodash-es"),i=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("@react-email/components"),c=require("@chaibuilder/runtime"),d=require("./empty-slot-Sy930lX6.cjs"),l=require("./controls-rRZhz0vu.cjs"),a=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");const m=({blockProps:e,styles:t,children:o,inBuilder:r})=>{let n=o;return o||(n=i.jsxRuntimeExports.jsx(d.EmptySlot,{inBuilder:r})),i.jsxRuntimeExports.jsx(s.Container,{...e,...t,children:n})};c.registerChaiBlock(m,{type:"Email/Container",label:"Container",group:"basic",category:"core",canAcceptBlock:()=>!0,canMove:()=>!0,canDelete:()=>!1,canDuplicate:()=>!1,canBeNested:e=>!e});const x=({blockProps:e,styles:t,children:o})=>i.jsxRuntimeExports.jsx(s.Section,{...e,...t,children:o});c.registerChaiBlock(x,{type:"Email/Section",label:"Section",group:"basic",category:"core",icon:a.ImageIcon,props:{align:l.f({title:"Align",default:"",options:[{value:"",title:"None"},{value:"left",title:"left"},{value:"center",title:"center"},{value:"right",title:"right"}]})},canAcceptBlock:()=>!0});const g=({blockProps:e,styles:t,children:o})=>i.jsxRuntimeExports.jsx(s.Row,{...e,...t,children:o});c.registerChaiBlock(g,{type:"Email/Row",label:"Row",group:"basic",category:"core",icon:a.ImageIcon,blocks:[{_type:"Email/Row",_id:"a"},{_type:"Email/Column",_id:"b",_parent:"a"}],props:{styles:l.o({default:""})},canAcceptBlock:e=>e==="Email/Column"});const h=({blockProps:e,styles:t,children:o,align:r})=>{let n=o;return o||(n=i.jsxRuntimeExports.jsx(d.EmptySlot,{})),i.jsxRuntimeExports.jsx(s.Column,{...e,...t,align:r,children:n})};c.registerChaiBlock(h,{type:"Email/Column",label:"Column",group:"basic",category:"core",icon:a.ImageIcon,props:{styles:l.o({default:""}),align:l.f({title:"Align",default:"",options:[{value:"",title:"None"},{value:"left",title:"left"},{value:"center",title:"center"},{value:"right",title:"right"}]})},canAcceptBlock:()=>!0,canBeNested:e=>e==="Email/Row"});const k=({level:e,blockProps:t,styles:o,content:r})=>i.jsxRuntimeExports.jsx(s.Heading,{as:e,...t,...o,children:r}),b=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx("h1",{...e,...t,children:o});c.registerChaiBlock(k,{type:"Email/Heading",label:"Heading",group:"basic",category:"core",icon:a.HeadingIcon,builderComponent:b,props:{content:l.g({title:"Content",default:"Enter your heading here..."}),styles:l.o({default:"text-xl"}),level:l.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]})},canAcceptBlock:e=>["Email/Link","Email/RawText"].includes(e)});const B=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx(s.Text,{...e,...t,children:o}),C=({content:e,blockProps:t,styles:o})=>i.jsxRuntimeExports.jsx("p",{...t,...o,children:e});c.registerChaiBlock(B,{type:"Email/Text",label:"Text",group:"basic",category:"core",icon:a.TextIcon,builderComponent:C,props:{content:l.r({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitor. Ut in nulla enim."}),styles:l.o({default:""})},canAcceptBlock:e=>["Email/Link","Email/RawText"].includes(e)});const j=({content:e})=>e,f=({content:e,blockProps:t})=>i.jsxRuntimeExports.jsx("span",{...t,children:e});c.registerChaiBlock(j,{type:"Email/RawText",label:"Raw Text",group:"basic",category:"core",icon:a.TextIcon,hidden:!0,builderComponent:f,props:{content:l.r({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. "})}});const E=({blockProps:e,styles:t,link:o,content:r})=>i.jsxRuntimeExports.jsx(s.Button,{...e,...t,href:o.href,children:r}),y=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx("button",{type:"button",...e,...t,children:o});c.registerChaiBlock(E,{type:"Email/Button",label:"Button",group:"basic",category:"core",builderComponent:y,props:{content:l.g({title:"Content",default:"Click me"}),link:l.q({title:"Link",default:{href:"https://chaibuilder.com",target:"_blank",type:"url"}}),styles:l.o({default:"bg-primary text-white px-4 py-2 rounded-md"})}});const v=({blockProps:e,styles:t,href:o,content:r,target:n,children:u})=>i.jsxRuntimeExports.jsx(s.Link,{...e,...t,href:o,target:n,children:u||r}),R=({blockProps:e,styles:t,content:o,children:r})=>{let n=r;return r||(n=i.jsxRuntimeExports.jsx(d.EmptySlot,{})),i.jsxRuntimeExports.jsx("span",{...e,...t,children:n||o})};c.registerChaiBlock(v,{type:"Email/Link",label:"Link",group:"basic",category:"core",icon:a.Link1Icon,blocks:[{_id:"a",_type:"Link"},{_id:"b",_parent:"a",_type:"RawText",content:"I am a link."}],builderComponent:R,props:{content:l.g({title:"Content",default:"I am a link."}),link:l.q({title:"Link",default:{href:"https://chaibuilder.com",target:"_blank",type:"url"}}),styles:l.o({default:"font-bold text-blue-500"})},canAcceptBlock:()=>!0});const w=({blockProps:e,styles:t,children:o})=>i.jsxRuntimeExports.jsx(s.Preview,{...e,...t,children:o}),I=({blockProps:e,styles:t,content:o})=>i.jsxRuntimeExports.jsx("div",{...e,...t,children:o});c.registerChaiBlock(w,{type:"Email/Preview",label:"Preview",group:"basic",category:"core",builderComponent:I,canAcceptBlock:()=>!0,canDuplicate:()=>!1,props:{content:l.r({default:"Preview content",title:"Content"})}});const L=({blockProps:e,content:t})=>i.jsxRuntimeExports.jsx(s.Markdown,{children:t,...e});c.registerChaiBlock(L,{type:"Email/Markdown",label:"Markdown",group:"basic",category:"core",props:{content:l.r({default:"# This is a ~~strikethrough~~",title:"Markdown"})}});const T=({blockProps:e,styles:t,alt:o,image:r,width:n,height:u})=>i.jsxRuntimeExports.jsx(s.Img,{...e,...t,src:r,alt:o,width:n,height:u}),S=({blockProps:e,styles:t,alt:o,image:r,width:n,height:u})=>i.jsxRuntimeExports.jsx("img",{...e,...t,src:r,alt:o,width:n,height:u});c.registerChaiBlock(T,{type:"Email/Image",label:"Image",group:"basic",category:"core",icon:a.ImageIcon,builderComponent:S,props:{styles:l.o({default:"w-full"}),image:l.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.g({title:"Alt",default:""}),width:l.g({title:"Width",default:""}),height:l.g({title:"Height",default:""})}});const q=({blockProps:e,styles:t})=>i.jsxRuntimeExports.jsx(s.Hr,{...e,...t}),H=({blockProps:e,styles:t})=>i.jsxRuntimeExports.jsx("hr",{...e,...t});c.registerChaiBlock(q,{type:"Email/Divider",label:"Divider",group:"basic",category:"core",icon:a.DividerHorizontalIcon,builderComponent:H,props:{styles:l.o({default:"w-full h-2"})}});const _=({blockProps:e,styles:t,code:o,lineNumbers:r,theme:n,language:u})=>i.jsxRuntimeExports.jsx(s.CodeBlock,{...e,...t,code:o,linenumbers:r,theme:n,language:u}),A=({blockProps:e,styles:t,code:o})=>i.jsxRuntimeExports.jsx("div",{...e,...t,children:i.jsxRuntimeExports.jsx("code",{children:o})});c.registerChaiBlock(_,{type:"Email/CodeBlock",label:"Code Block",group:"basic",category:"core",hidden:!0,icon:a.CodeSandboxLogoIcon,builderComponent:A,props:{styles:l.o({default:""}),code:l.r({title:"Code",default:"console.log('Hello, world!');"}),theme:l.g({title:"Theme",default:"dracula"}),lineNumbers:l.c({title:"Line number",default:!1}),language:l.f({title:"Language",default:"javascript",binding:!1,options:[{value:"javascript",title:"JavaScript"},{value:"html",title:"HTML"},{value:"css",title:"CSS"}]})}});const D=({blockProps:e,styles:t,code:o})=>i.jsxRuntimeExports.jsx(s.CodeInline,{...e,...t,children:o}),M=({blockProps:e,styles:t,code:o})=>i.jsxRuntimeExports.jsx("code",{...e,...t,children:o});c.registerChaiBlock(D,{type:"Email/CodeInline",label:"Code Inline",group:"basic",category:"core",icon:a.CodeSandboxLogoIcon,builderComponent:M,props:{styles:l.o({default:""}),code:l.r({title:"Code",default:"console.log('Hello, world!');"})}});const N=p.noop;exports.loadEmailBlocks=N;
@@ -3,7 +3,7 @@ import { j as o } from "./jsx-runtime-WbnYoNE9.js";
3
3
  import { Container as k, Section as x, Row as y, Column as B, Heading as C, Text as v, Button as j, Link as w, Preview as E, Markdown as I, Img as L, Hr as T, CodeBlock as H, CodeInline as R } from "@react-email/components";
4
4
  import { registerChaiBlock as r } from "@chaibuilder/runtime";
5
5
  import { E as m } from "./empty-slot-Lsxjts7Q.js";
6
- import { y as d, S as a, l as u, g as s, T as g, q as _, r as A } from "./controls-VTdJhdSz.js";
6
+ import { f as d, o as a, g as u, r as s, q as g, v as _, c as A } from "./controls-yjgoZzB6.js";
7
7
  import { ImageIcon as p, HeadingIcon as S, TextIcon as h, Link1Icon as D, DividerHorizontalIcon as M, CodeSandboxLogoIcon as b } from "@radix-ui/react-icons";
8
8
  import "./_commonjsHelpers-UyOWmZb0.js";
9
9
  import "react";
package/dist/email.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs");require("./core.cjs");const r=require("@radix-ui/react-icons"),q=require("lodash-es"),n=require("./ChaiBuilderEditor-lqHQcnh3.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("react-i18next");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("tree-model");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");const o=[{title:"Mobile",content:"Mobile email client",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{}),width:400},{title:"Email Client",content:"Content as seen inside an email client",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{className:"rotate-90"}),width:700}],s=i=>{const u={...i,filterChaiBlock:t=>q.includes(t.type,"Email/"),importHTMLSupport:!1,dataBindingSupport:!1,breakpoints:o};return e.jsxRuntimeExports.jsx(n.ChaiBuilderEditor,{...u})};exports.ChaiBuilderEmail=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs");require("./core.cjs");const r=require("@radix-ui/react-icons"),q=require("lodash-es"),n=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("react-i18next");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index-ecnGWzh9.cjs");const o=[{title:"Mobile",content:"Mobile email client",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{}),width:400},{title:"Email Client",content:"Content as seen inside an email client",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{className:"rotate-90"}),width:700}],s=i=>{const u={...i,filterChaiBlock:t=>q.includes(t.type,"Email/"),importHTMLSupport:!1,dataBindingSupport:!1,breakpoints:o};return e.jsxRuntimeExports.jsx(n.ChaiBuilderEditor,{...u})};exports.ChaiBuilderEmail=s;
package/dist/email.js CHANGED
@@ -2,7 +2,7 @@ import { j as i } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import "./core.js";
3
3
  import { MobileIcon as t } from "@radix-ui/react-icons";
4
4
  import { includes as p } from "lodash-es";
5
- import { C as e } from "./ChaiBuilderEditor-F2yUJQdt.js";
5
+ import { C as e } from "./ChaiBuilderEditor-3xIN-AP_.js";
6
6
  import "./_commonjsHelpers-UyOWmZb0.js";
7
7
  import "react";
8
8
  import "react-i18next";
@@ -13,14 +13,13 @@ import "@floating-ui/react-dom";
13
13
  import "jotai";
14
14
  import "i18next";
15
15
  import "flagged";
16
- import "./STRINGS--j49GZJP.js";
16
+ import "./MODIFIERS-fd5XOmum.js";
17
17
  import "./Functions-7jnEwJyw.js";
18
18
  import "tailwind-merge";
19
19
  import "@chaibuilder/runtime";
20
20
  import "@react-hookz/web";
21
- import "./MODIFIERS-cBT31iqE.js";
22
21
  import "tree-model";
23
- import "./utils-iMv3T4WT.js";
22
+ import "./utils-VpVqnC9m.js";
24
23
  import "@radix-ui/react-toggle";
25
24
  import "class-variance-authority";
26
25
  import "@radix-ui/react-switch";
@@ -44,6 +43,7 @@ import "react-icons-picker";
44
43
  import "react-quill";
45
44
  import "react-hotkeys-hook";
46
45
  import "lucide-react";
46
+ import "./index-YpnaudSM.js";
47
47
  const n = [
48
48
  {
49
49
  title: "Mobile",
@@ -1 +1 @@
1
- "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./ChaiBuilderEditor-lqHQcnh3.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,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}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,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}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,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}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,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}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[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:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),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
+ "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,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}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,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}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,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}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,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}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[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:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),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,8 +1,8 @@
1
1
  import { j as u } from "./jsx-runtime-WbnYoNE9.js";
2
- import b from "@rjsf/core";
3
- import x from "@rjsf/validator-ajv8";
2
+ import x from "@rjsf/core";
3
+ import b from "@rjsf/validator-ajv8";
4
4
  import { includes as h, get as a, set as $, first as F } from "lodash-es";
5
- import { b0 as P, b1 as E, b2 as O, b3 as S } from "./ChaiBuilderEditor-F2yUJQdt.js";
5
+ import { a$ as P, b0 as E, b1 as O, b2 as S } from "./ChaiBuilderEditor-3xIN-AP_.js";
6
6
  const d = (i, l = "") => {
7
7
  switch (i.type) {
8
8
  case "singular":
@@ -95,7 +95,7 @@ const d = (i, l = "") => {
95
95
  return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
96
96
  i && /* @__PURE__ */ u.jsx("h1", { className: "px-1 text-sm font-semibold underline", children: i }),
97
97
  /* @__PURE__ */ u.jsx("div", { className: "-mx-3", children: /* @__PURE__ */ u.jsx(
98
- b,
98
+ x,
99
99
  {
100
100
  widgets: {
101
101
  richtext: P,
@@ -113,7 +113,7 @@ const d = (i, l = "") => {
113
113
  uiSchema: e,
114
114
  schema: r,
115
115
  formData: c,
116
- validator: x,
116
+ validator: b,
117
117
  onChange: o,
118
118
  disabled: n
119
119
  }
@@ -1,5 +1,5 @@
1
1
  import { get as e, last as g, flattenDeep as $ } from "lodash-es";
2
- import { a as d } from "./STRINGS--j49GZJP.js";
2
+ import { a as d } from "./MODIFIERS-fd5XOmum.js";
3
3
  const b = (s, t = "") => {
4
4
  const c = e(s, "bodyTextLightColor", "#64748b"), o = e(s, "bodyTextDarkColor", "#94a3b8"), n = e(s, "bodyBgLightColor", "#FFFFFF"), l = e(s, "bodyBgDarkColor", "#0f172a");
5
5
  return `${t}font-body ${t}antialiased ${t}text-[${c}] ${t}bg-[${n}] dark:${t}text-[${o}] dark:${t}bg-[${l}]`;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("lodash-es"),g=require("./MODIFIERS-mVmfEGgo.cjs"),d=(t,s="")=>{const c=e.get(t,"bodyTextLightColor","#64748b"),o=e.get(t,"bodyTextDarkColor","#94a3b8"),n=e.get(t,"bodyBgLightColor","#FFFFFF"),l=e.get(t,"bodyBgDarkColor","#0f172a");return`${s}font-body ${s}antialiased ${s}text-[${c}] ${s}bg-[${n}] dark:${s}text-[${o}] dark:${s}bg-[${l}]`},u=(t,s="")=>{const o=t.replace(g.STYLES_KEY,"").split(",").map(n=>n.split(" ").map(r=>{if(r==="")return"";if(r.includes(":")){const a=r.split(":");return a[a.length-1]=s+e.last(a),a.join(":")}return`${s}${r}`}).join(" "));return e.flattenDeep(o).join(" ")},$=t=>{if(!t)return[];try{return JSON.parse(t)}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};exports.addPrefixToClasses=u;exports.convertToBlocks=$;exports.getBrandingClasses=d;
@@ -1,7 +1,7 @@
1
1
  import { stringify as b, parse as x } from "himalaya";
2
2
  import { g as w, c as N } from "./Functions-7jnEwJyw.js";
3
3
  import { isEmpty as m, includes as f, get as n, forEach as A, find as p, set as u, capitalize as C, flatMapDeep as L, filter as S, flatten as $ } from "lodash-es";
4
- import { a as y } from "./STRINGS--j49GZJP.js";
4
+ import { a as y } from "./MODIFIERS-fd5XOmum.js";
5
5
  const B = (t) => {
6
6
  const s = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, e = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
7
7
  return s.test(t) || e.test(t);
@@ -0,0 +1 @@
1
+ "use strict";const y=require("himalaya"),h=require("./Functions-N3yhPYKY.cjs"),a=require("lodash-es"),p=require("./MODIFIERS-mVmfEGgo.cjs"),v=t=>{const s=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,e=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return s.test(t)||e.test(t)},T=t=>{if(a.isEmpty(t))return t;const s=/<video[^>]+src=['"]([^'">]+)['"]/,e=/<iframe[^>]+src=['"]([^'">]+)['"]/,r=t.match(s),l=t.match(e),i=r?r[1]:l?l[1]:null,c=/(?: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 i&&(c.test(i)||n.test(i))?i:t},k={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"}},w=(t,s)=>t.children.length===1&&a.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],s._type),d=t=>t.map(s=>s.type==="text"?a.get(s,"content",""):a.isEmpty(s.children)?"":d(s.children)).join(""),m=t=>t===null?!0:t,f=t=>{if(t.tagName==="svg")return{};const s={},e=k[t.tagName]||{},r=t.attributes;return a.forEach(r,({key:l,value:i})=>{if(e[l]){if(t.tagName==="img"&&l==="src"&&!i.startsWith("http")){const c=a.find(t.attributes,{key:"width"}),n=a.find(t.attributes,{key:"height"});c&&n?i=`https://via.placeholder.com/${c==null?void 0:c.value}x${n==null?void 0:n.value}`:i="https://via.placeholder.com/150x150"}a.set(s,e[l],m(i))}else a.includes(["style","class","srcset"],l)||a.set(s,`styles_attrs.${l}`,m(i))}),delete s.class,s},x=(t,s="styles")=>{if(!t.attributes)return{[s]:`${p.STYLES_KEY},`};const e=a.find(t.attributes,{key:"class"});if(e){const r=e.value;return{[s]:`${p.STYLES_KEY},${r}`}}return{[s]:`${p.STYLES_KEY},`}},S=t=>{const s={"hs-collapse-toggle":"CollapseToggle","hs-collapse":"Collapse","hs-accordion-group":"AccordionGroup","hs-accordion":"Accordion","hs-accordion-toggle":"AccordionToggle","hs-accordion-content":"AccordionContent"},e={Accordion:"active",CollapseToggle:"open"},r=a.find(t.attributes,{key:"class"});if(r){const c=r.value.split(" ");for(const n of c)if(s[n]){const u=s[n],g=r.value.replace(n,"");return t.attributes=t.attributes.map(o=>o.key==="class"?{...o,value:g}:o),e[u]&&(t.attributes=t.attributes.map(o=>o.key==="class"?{...o,value:o.value.replace(e[u],"")}:o)),u}}const l={};for(const c in l)if(t.attributes.some(n=>n.key===c))return l[c];const i=a.find(t.attributes,{key:"role"});if(i){const c=`role="${i.value}"`;if(l[c])return l[c]}},N=t=>{const s=S(t);if(s)return{_type:s};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:"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 e=a.get(t,"children",[]).length>0?"Box":"EmptyBox";return{_type:e,tag:t.tagName,_name:e=="EmptyBox"||t.tagName==="div"?e:a.capitalize(t.tagName)}}},b=(t,s=null)=>a.flatMapDeep(t,e=>{var i;if(e.type==="comment")return[];let r={_id:h.generateUUID()};if(s&&(r._parent=s.block._id),e.type==="text")return a.isEmpty(a.get(e,"content",""))?[]:s&&w(s.node,s.block)?(a.set(s,"block.content",a.get(e,"content","")),[]):{...r,_type:"Text",content:a.get(e,"content","")};if(r={...r,...N(e),...f(e),...x(e)},r._type==="Input"){const c=r.inputType||"text";c==="checkbox"?a.set(r,"_type","Checkbox"):c==="radio"&&a.set(r,"_type","Radio")}else if(e.tagName==="video"||e.tagName==="iframe"){const c=y.stringify([e]);return v(c)&&(a.set(r,"_type","Video"),a.set(r,"url",T(c)),a.set(r,"styles",`${p.STYLES_KEY},absolute top-0 left-0 w-full h-full`),a.set(r,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),r.content=c,[r]}else if(e.tagName==="svg"){const c=a.find(e.attributes,{key:"height"}),n=a.find(e.attributes,{key:"width"}),u=a.get(c,"value")?`[${a.get(c,"value")}px]`:"24px",g=a.get(n,"value")?`[${a.get(n,"value")}px]`:"24px",o=a.get(a.find(e.attributes,{key:"class"}),"value","w-full h-full");return r.styles=`${p.STYLES_KEY}, ${h.cn(`w-${g} h-${u}`,o)}`.trim(),e.attributes=a.filter(e.attributes,_=>!a.includes(["style","width","height","class"],_.key)),r.icon=y.stringify([e]),[r]}else if(e.tagName=="option"&&s&&((i=s.block)==null?void 0:i._type)==="Select")return s.block.options.push({label:d(e.children),...f(e)}),[];const l=b(e.children,{block:r,node:e});return[r,...l]}),L=t=>{const s=t.match(/<body[^>]*>[\s\S]*?<\/body>/);return(s&&s.length>0?s[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):t).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},E=t=>{const s=y.parse(L(t));return a.isEmpty(t)?[]:a.flatten(b(s))};exports.getBlocksFromHTML=E;
@@ -0,0 +1 @@
1
+ "use strict";var H2=(a,t,h)=>{if(!t.has(a))throw TypeError("Cannot "+h)};var c=(a,t,h)=>(H2(a,t,"read from private field"),h?h.call(a):t.get(a)),o=(a,t,h)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,h)},e=(a,t,h,n)=>(H2(a,t,"write to private field"),n?n.call(a,h):t.set(a,h),h);var r2=(a,t,h,n)=>({set _(v){e(a,t,v,h)},get _(){return c(a,t,n)}}),M=(a,t,h)=>(H2(a,t,"access private method"),h);const l=require("./jsx-runtime-Z_BpKhVy.cjs"),N=require("react");require("./core.cjs");const i2=require("@radix-ui/react-icons"),T=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),a1=require("sonner"),s0=require("react-i18next"),h1=require("lodash-es"),p0=require("./html-to-json-O1OpqICe.cjs"),S2=require("lucide-react"),t0=require("./index-ecnGWzh9.cjs");function V0(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const h in a)if(h!=="default"){const n=Object.getOwnPropertyDescriptor(a,h);Object.defineProperty(t,h,n.get?n:{enumerable:!0,get:()=>a[h]})}}return t.default=a,Object.freeze(t)}const A=V0(N);var W1=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N1=typeof window>"u"||"Deno"in window;function _(){}function f0(a,t){return typeof a=="function"?a(t):a}function s2(a){return typeof a=="number"&&a>=0&&a!==1/0}function a0(a,t){return Math.max(a+(t||0)-Date.now(),0)}function R2(a,t){const{type:h="all",exact:n,fetchStatus:v,predicate:r,queryKey:i,stale:z}=a;if(i){if(n){if(t.queryHash!==A2(i,t.options))return!1}else if(!Q1(t.queryKey,i))return!1}if(h!=="all"){const s=t.isActive();if(h==="active"&&!s||h==="inactive"&&s)return!1}return!(typeof z=="boolean"&&t.isStale()!==z||typeof v<"u"&&v!==t.state.fetchStatus||r&&!r(t))}function F2(a,t){const{exact:h,status:n,predicate:v,mutationKey:r}=a;if(r){if(!t.options.mutationKey)return!1;if(h){if(U1(t.options.mutationKey)!==U1(r))return!1}else if(!Q1(t.options.mutationKey,r))return!1}return!(n&&t.state.status!==n||v&&!v(t))}function A2(a,t){return((t==null?void 0:t.queryKeyHashFn)||U1)(a)}function U1(a){return JSON.stringify(a,(t,h)=>p2(h)?Object.keys(h).sort().reduce((n,v)=>(n[v]=h[v],n),{}):h)}function Q1(a,t){return a===t?!0:typeof a!=typeof t?!1:a&&t&&typeof a=="object"&&typeof t=="object"?!Object.keys(t).some(h=>!Q1(a[h],t[h])):!1}function h0(a,t){if(a===t)return a;const h=D2(a)&&D2(t);if(h||p2(a)&&p2(t)){const n=h?a.length:Object.keys(a).length,v=h?t:Object.keys(t),r=v.length,i=h?[]:{};let z=0;for(let s=0;s<r;s++){const p=h?s:v[s];i[p]=h0(a[p],t[p]),i[p]===a[p]&&z++}return n===r&&z===n?a:i}return t}function o2(a,t){if(a&&!t||t&&!a)return!1;for(const h in a)if(a[h]!==t[h])return!1;return!0}function D2(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function p2(a){if(!k2(a))return!1;const t=a.constructor;if(typeof t>"u")return!0;const h=t.prototype;return!(!k2(h)||!h.hasOwnProperty("isPrototypeOf"))}function k2(a){return Object.prototype.toString.call(a)==="[object Object]"}function n0(a){return new Promise(t=>{setTimeout(t,a)})}function E2(a){n0(0).then(a)}function V2(a,t,h){return typeof h.structuralSharing=="function"?h.structuralSharing(a,t):h.structuralSharing!==!1?h0(a,t):t}function m0(a,t,h=0){const n=[...a,t];return h&&n.length>h?n.slice(1):n}function L0(a,t,h=0){const n=[t,...a];return h&&n.length>h?n.slice(0,-1):n}var u1,e1,B1,U2,x0=(U2=class extends W1{constructor(){super();o(this,u1,void 0);o(this,e1,void 0);o(this,B1,void 0);e(this,B1,t=>{if(!N1&&window.addEventListener){const h=()=>t();return window.addEventListener("visibilitychange",h,!1),()=>{window.removeEventListener("visibilitychange",h)}}})}onSubscribe(){c(this,e1)||this.setEventListener(c(this,B1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,e1))==null||t.call(this),e(this,e1,void 0))}setEventListener(t){var h;e(this,B1,t),(h=c(this,e1))==null||h.call(this),e(this,e1,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){c(this,u1)!==t&&(e(this,u1,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof c(this,u1)=="boolean"?c(this,u1):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},u1=new WeakMap,e1=new WeakMap,B1=new WeakMap,U2),d2=new x0,I1,l1,G1,Q2,w0=(Q2=class extends W1{constructor(){super();o(this,I1,!0);o(this,l1,void 0);o(this,G1,void 0);e(this,G1,t=>{if(!N1&&window.addEventListener){const h=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",h,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",h),window.removeEventListener("offline",n)}}})}onSubscribe(){c(this,l1)||this.setEventListener(c(this,G1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,l1))==null||t.call(this),e(this,l1,void 0))}setEventListener(t){var h;e(this,G1,t),(h=c(this,l1))==null||h.call(this),e(this,l1,t(this.setOnline.bind(this)))}setOnline(t){c(this,I1)!==t&&(e(this,I1,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return c(this,I1)}},I1=new WeakMap,l1=new WeakMap,G1=new WeakMap,Q2),z2=new w0;function B0(a){return Math.min(1e3*2**a,3e4)}function M2(a){return(a??"online")==="online"?z2.isOnline():!0}var c0=class{constructor(a){this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function u2(a){return a instanceof c0}function v0(a){let t=!1,h=0,n=!1,v,r,i;const z=new Promise((g,u)=>{r=g,i=u}),s=g=>{var u;n||(H(new c0(g)),(u=a.abort)==null||u.call(a))},p=()=>{t=!0},d=()=>{t=!1},x=()=>!d2.isFocused()||a.networkMode!=="always"&&!z2.isOnline(),b=g=>{var u;n||(n=!0,(u=a.onSuccess)==null||u.call(a,g),v==null||v(),r(g))},H=g=>{var u;n||(n=!0,(u=a.onError)==null||u.call(a,g),v==null||v(),i(g))},V=()=>new Promise(g=>{var u;v=G=>{const f=n||!x();return f&&g(G),f},(u=a.onPause)==null||u.call(a)}).then(()=>{var g;v=void 0,n||(g=a.onContinue)==null||g.call(a)}),B=()=>{if(n)return;let g;try{g=a.fn()}catch(u){g=Promise.reject(u)}Promise.resolve(g).then(b).catch(u=>{var F;if(n)return;const G=a.retry??(N1?0:3),f=a.retryDelay??B0,m=typeof f=="function"?f(h,u):f,y=G===!0||typeof G=="number"&&h<G||typeof G=="function"&&G(h,u);if(t||!y){H(u);return}h++,(F=a.onFail)==null||F.call(a,h,u),n0(m).then(()=>{if(x())return V()}).then(()=>{t?H(u):B()})})};return M2(a.networkMode)?B():V().then(B),{promise:z,cancel:s,continue:()=>(v==null?void 0:v())?z:Promise.resolve(),cancelRetry:p,continueRetry:d}}function I0(){let a=[],t=0,h=d=>{d()},n=d=>{d()};const v=d=>{let x;t++;try{x=d()}finally{t--,t||z()}return x},r=d=>{t?a.push(d):E2(()=>{h(d)})},i=d=>(...x)=>{r(()=>{d(...x)})},z=()=>{const d=a;a=[],d.length&&E2(()=>{n(()=>{d.forEach(x=>{h(x)})})})};return{batch:v,batchCalls:i,schedule:r,setNotifyFunction:d=>{h=d},setBatchNotifyFunction:d=>{n=d}}}var O=I0(),s1,K2,r0=(K2=class{constructor(){o(this,s1,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),s2(this.gcTime)&&e(this,s1,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(N1?1/0:5*60*1e3))}clearGcTimeout(){c(this,s1)&&(clearTimeout(c(this,s1)),e(this,s1,void 0))}},s1=new WeakMap,K2),C1,O1,U,i1,Q,S,K1,p1,S1,e2,$,c1,q2,G0=(q2=class extends r0{constructor(t){super();o(this,S1);o(this,$);o(this,C1,void 0);o(this,O1,void 0);o(this,U,void 0);o(this,i1,void 0);o(this,Q,void 0);o(this,S,void 0);o(this,K1,void 0);o(this,p1,void 0);e(this,p1,!1),e(this,K1,t.defaultOptions),M(this,S1,e2).call(this,t.options),e(this,S,[]),e(this,U,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,e(this,C1,t.state||C0(this.options)),this.state=c(this,C1),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!c(this,S).length&&this.state.fetchStatus==="idle"&&c(this,U).remove(this)}setData(t,h){const n=V2(this.state.data,t,this.options);return M(this,$,c1).call(this,{data:n,type:"success",dataUpdatedAt:h==null?void 0:h.updatedAt,manual:h==null?void 0:h.manual}),n}setState(t,h){M(this,$,c1).call(this,{type:"setState",state:t,setStateOptions:h})}cancel(t){var n;const h=c(this,i1);return(n=c(this,Q))==null||n.cancel(t),h?h.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(c(this,C1))}isActive(){return c(this,S).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||c(this,S).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!a0(this.state.dataUpdatedAt,t)}onFocus(){var h;const t=c(this,S).find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,Q))==null||h.continue()}onOnline(){var h;const t=c(this,S).find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,Q))==null||h.continue()}addObserver(t){c(this,S).includes(t)||(c(this,S).push(t),this.clearGcTimeout(),c(this,U).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){c(this,S).includes(t)&&(e(this,S,c(this,S).filter(h=>h!==t)),c(this,S).length||(c(this,Q)&&(c(this,p1)?c(this,Q).cancel({revert:!0}):c(this,Q).cancelRetry()),this.scheduleGc()),c(this,U).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return c(this,S).length}invalidate(){this.state.isInvalidated||M(this,$,c1).call(this,{type:"invalidate"})}fetch(t,h){var p,d,x,b;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(h!=null&&h.cancelRefetch))this.cancel({silent:!0});else if(c(this,i1))return(p=c(this,Q))==null||p.continueRetry(),c(this,i1)}if(t&&M(this,S1,e2).call(this,t),!this.options.queryFn){const H=c(this,S).find(V=>V.options.queryFn);H&&M(this,S1,e2).call(this,H.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 n=new AbortController,v={queryKey:this.queryKey,meta:this.meta},r=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(e(this,p1,!0),n.signal)})};r(v);const i=()=>this.options.queryFn?(e(this,p1,!1),this.options.persister?this.options.persister(this.options.queryFn,v,this):this.options.queryFn(v)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),z={fetchOptions:h,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};r(z),(d=this.options.behavior)==null||d.onFetch(z,this),e(this,O1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=z.fetchOptions)==null?void 0:x.meta))&&M(this,$,c1).call(this,{type:"fetch",meta:(b=z.fetchOptions)==null?void 0:b.meta});const s=H=>{var V,B,g,u;u2(H)&&H.silent||M(this,$,c1).call(this,{type:"error",error:H}),u2(H)||((B=(V=c(this,U).config).onError)==null||B.call(V,H,this),(u=(g=c(this,U).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return e(this,Q,v0({fn:z.fetchFn,abort:n.abort.bind(n),onSuccess:H=>{var V,B,g,u;if(typeof H>"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}`),s(new Error(`${this.queryHash} data is undefined`));return}this.setData(H),(B=(V=c(this,U).config).onSuccess)==null||B.call(V,H,this),(u=(g=c(this,U).config).onSettled)==null||u.call(g,H,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(H,V)=>{M(this,$,c1).call(this,{type:"failed",failureCount:H,error:V})},onPause:()=>{M(this,$,c1).call(this,{type:"pause"})},onContinue:()=>{M(this,$,c1).call(this,{type:"continue"})},retry:z.options.retry,retryDelay:z.options.retryDelay,networkMode:z.options.networkMode})),e(this,i1,c(this,Q).promise),c(this,i1)}},C1=new WeakMap,O1=new WeakMap,U=new WeakMap,i1=new WeakMap,Q=new WeakMap,S=new WeakMap,K1=new WeakMap,p1=new WeakMap,S1=new WeakSet,e2=function(t){this.options={...c(this,K1),...t},this.updateGcTime(this.options.gcTime)},$=new WeakSet,c1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:M2(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const v=t.error;return u2(v)&&v.revert&&c(this,O1)?{...c(this,O1),fetchStatus:"idle"}:{...n,error:v,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:v,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=h(this.state),O.batch(()=>{c(this,S).forEach(n=>{n.onQueryUpdate()}),c(this,U).notify({query:this,type:"updated",action:t})})},q2);function C0(a){const t=typeof a.initialData=="function"?a.initialData():a.initialData,h=typeof t<"u",n=h?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:h?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:h?"success":"pending",fetchStatus:"idle"}}var Z,_2,O0=(_2=class extends W1{constructor(t={}){super();o(this,Z,void 0);this.config=t,e(this,Z,new Map)}build(t,h,n){const v=h.queryKey,r=h.queryHash??A2(v,h);let i=this.get(r);return i||(i=new G0({cache:this,queryKey:v,queryHash:r,options:t.defaultQueryOptions(h),state:n,defaultOptions:t.getQueryDefaults(v)}),this.add(i)),i}add(t){c(this,Z).has(t.queryHash)||(c(this,Z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const h=c(this,Z).get(t.queryHash);h&&(t.destroy(),h===t&&c(this,Z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return c(this,Z).get(t)}getAll(){return[...c(this,Z).values()]}find(t){const h={exact:!0,...t};return this.getAll().find(n=>R2(h,n))}findAll(t={}){const h=this.getAll();return Object.keys(t).length>0?h.filter(n=>R2(t,n)):h}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Z=new WeakMap,_2),Y,q1,E,A1,X,r1,$2,S0=($2=class extends r0{constructor(t){super();o(this,X);o(this,Y,void 0);o(this,q1,void 0);o(this,E,void 0);o(this,A1,void 0);this.mutationId=t.mutationId,e(this,q1,t.defaultOptions),e(this,E,t.mutationCache),e(this,Y,[]),this.state=t.state||e0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...c(this,q1),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){c(this,Y).includes(t)||(c(this,Y).push(t),this.clearGcTimeout(),c(this,E).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){e(this,Y,c(this,Y).filter(h=>h!==t)),this.scheduleGc(),c(this,E).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){c(this,Y).length||(this.state.status==="pending"?this.scheduleGc():c(this,E).remove(this))}continue(){var t;return((t=c(this,A1))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var v,r,i,z,s,p,d,x,b,H,V,B,g,u,G,f,m,y,F,I;const h=()=>(e(this,A1,v0({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,n1)=>{M(this,X,r1).call(this,{type:"failed",failureCount:w,error:n1})},onPause:()=>{M(this,X,r1).call(this,{type:"pause"})},onContinue:()=>{M(this,X,r1).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),c(this,A1).promise),n=this.state.status==="pending";try{if(!n){M(this,X,r1).call(this,{type:"pending",variables:t}),await((r=(v=c(this,E).config).onMutate)==null?void 0:r.call(v,t,this));const n1=await((z=(i=this.options).onMutate)==null?void 0:z.call(i,t));n1!==this.state.context&&M(this,X,r1).call(this,{type:"pending",context:n1,variables:t})}const w=await h();return await((p=(s=c(this,E).config).onSuccess)==null?void 0:p.call(s,w,t,this.state.context,this)),await((x=(d=this.options).onSuccess)==null?void 0:x.call(d,w,t,this.state.context)),await((H=(b=c(this,E).config).onSettled)==null?void 0:H.call(b,w,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,w,null,t,this.state.context)),M(this,X,r1).call(this,{type:"success",data:w}),w}catch(w){try{throw await((u=(g=c(this,E).config).onError)==null?void 0:u.call(g,w,t,this.state.context,this)),await((f=(G=this.options).onError)==null?void 0:f.call(G,w,t,this.state.context)),await((y=(m=c(this,E).config).onSettled)==null?void 0:y.call(m,void 0,w,this.state.variables,this.state.context,this)),await((I=(F=this.options).onSettled)==null?void 0:I.call(F,void 0,w,t,this.state.context)),w}finally{M(this,X,r1).call(this,{type:"error",error:w})}}}},Y=new WeakMap,q1=new WeakMap,E=new WeakMap,A1=new WeakMap,X=new WeakSet,r1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!M2(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=h(this.state),O.batch(()=>{c(this,Y).forEach(n=>{n.onMutationUpdate(t)}),c(this,E).notify({mutation:this,type:"updated",action:t})})},$2);function e0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var K,_1,V1,J2,A0=(J2=class extends W1{constructor(t={}){super();o(this,K,void 0);o(this,_1,void 0);o(this,V1,void 0);this.config=t,e(this,K,[]),e(this,_1,0)}build(t,h,n){const v=new S0({mutationCache:this,mutationId:++r2(this,_1)._,options:t.defaultMutationOptions(h),state:n});return this.add(v),v}add(t){c(this,K).push(t),this.notify({type:"added",mutation:t})}remove(t){e(this,K,c(this,K).filter(h=>h!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{c(this,K).forEach(t=>{this.remove(t)})})}getAll(){return c(this,K)}find(t){const h={exact:!0,...t};return c(this,K).find(n=>F2(h,n))}findAll(t={}){return c(this,K).filter(h=>F2(t,h))}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}resumePausedMutations(){return e(this,V1,(c(this,V1)??Promise.resolve()).then(()=>{const t=c(this,K).filter(h=>h.state.isPaused);return O.batch(()=>t.reduce((h,n)=>h.then(()=>n.continue().catch(_)),Promise.resolve()))}).then(()=>{e(this,V1,void 0)})),c(this,V1)}},K=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function y0(a){return{onFetch:(t,h)=>{const n=async()=>{var V,B,g,u,G;const v=t.options,r=(g=(B=(V=t.fetchOptions)==null?void 0:V.meta)==null?void 0:B.fetchMore)==null?void 0:g.direction,i=((u=t.state.data)==null?void 0:u.pages)||[],z=((G=t.state.data)==null?void 0:G.pageParams)||[],s={pages:[],pageParams:[]};let p=!1;const d=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},x=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),b=async(f,m,y)=>{if(p)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const F={queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};d(F);const I=await x(F),{maxPages:w}=t.options,n1=y?L0:m0;return{pages:n1(f.pages,I,w),pageParams:n1(f.pageParams,m,w)}};let H;if(r&&i.length){const f=r==="backward",m=f?b0:T2,y={pages:i,pageParams:z},F=m(v,y);H=await b(y,F,f)}else{H=await b(s,z[0]??v.initialPageParam);const f=a??i.length;for(let m=1;m<f;m++){const y=T2(v,H);H=await b(H,y)}}return H};t.options.persister?t.fetchFn=()=>{var v,r;return(r=(v=t.options).persister)==null?void 0:r.call(v,n,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},h)}:t.fetchFn=n}}}function T2(a,{pages:t,pageParams:h}){const n=t.length-1;return a.getNextPageParam(t[n],t,h[n],h)}function b0(a,{pages:t,pageParams:h}){var n;return(n=a.getPreviousPageParam)==null?void 0:n.call(a,t[0],t,h[0],h)}var C,o1,d1,y1,b1,z1,P1,R1,Z2,P0=(Z2=class{constructor(a={}){o(this,C,void 0);o(this,o1,void 0);o(this,d1,void 0);o(this,y1,void 0);o(this,b1,void 0);o(this,z1,void 0);o(this,P1,void 0);o(this,R1,void 0);e(this,C,a.queryCache||new O0),e(this,o1,a.mutationCache||new A0),e(this,d1,a.defaultOptions||{}),e(this,y1,new Map),e(this,b1,new Map),e(this,z1,0)}mount(){r2(this,z1)._++,c(this,z1)===1&&(e(this,P1,d2.subscribe(()=>{d2.isFocused()&&(this.resumePausedMutations(),c(this,C).onFocus())})),e(this,R1,z2.subscribe(()=>{z2.isOnline()&&(this.resumePausedMutations(),c(this,C).onOnline())})))}unmount(){var a,t;r2(this,z1)._--,c(this,z1)===0&&((a=c(this,P1))==null||a.call(this),e(this,P1,void 0),(t=c(this,R1))==null||t.call(this),e(this,R1,void 0))}isFetching(a){return c(this,C).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return c(this,o1).findAll({...a,status:"pending"}).length}getQueryData(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state.data}ensureQueryData(a){const t=this.getQueryData(a.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(a)}getQueriesData(a){return this.getQueryCache().findAll(a).map(({queryKey:t,state:h})=>{const n=h.data;return[t,n]})}setQueryData(a,t,h){const n=c(this,C).find({queryKey:a}),v=n==null?void 0:n.state.data,r=f0(t,v);if(typeof r>"u")return;const i=this.defaultQueryOptions({queryKey:a});return c(this,C).build(this,i).setData(r,{...h,manual:!0})}setQueriesData(a,t,h){return O.batch(()=>this.getQueryCache().findAll(a).map(({queryKey:n})=>[n,this.setQueryData(n,t,h)]))}getQueryState(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state}removeQueries(a){const t=c(this,C);O.batch(()=>{t.findAll(a).forEach(h=>{t.remove(h)})})}resetQueries(a,t){const h=c(this,C),n={type:"active",...a};return O.batch(()=>(h.findAll(a).forEach(v=>{v.reset()}),this.refetchQueries(n,t)))}cancelQueries(a={},t={}){const h={revert:!0,...t},n=O.batch(()=>c(this,C).findAll(a).map(v=>v.cancel(h)));return Promise.all(n).then(_).catch(_)}invalidateQueries(a={},t={}){return O.batch(()=>{if(c(this,C).findAll(a).forEach(n=>{n.invalidate()}),a.refetchType==="none")return Promise.resolve();const h={...a,type:a.refetchType??a.type??"active"};return this.refetchQueries(h,t)})}refetchQueries(a={},t){const h={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},n=O.batch(()=>c(this,C).findAll(a).filter(v=>!v.isDisabled()).map(v=>{let r=v.fetch(void 0,h);return h.throwOnError||(r=r.catch(_)),v.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(n).then(_)}fetchQuery(a){const t=this.defaultQueryOptions(a);typeof t.retry>"u"&&(t.retry=!1);const h=c(this,C).build(this,t);return h.isStaleByTime(t.staleTime)?h.fetch(t):Promise.resolve(h.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(_).catch(_)}fetchInfiniteQuery(a){return a.behavior=y0(a.pages),this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(_).catch(_)}resumePausedMutations(){return c(this,o1).resumePausedMutations()}getQueryCache(){return c(this,C)}getMutationCache(){return c(this,o1)}getDefaultOptions(){return c(this,d1)}setDefaultOptions(a){e(this,d1,a)}setQueryDefaults(a,t){c(this,y1).set(U1(a),{queryKey:a,defaultOptions:t})}getQueryDefaults(a){const t=[...c(this,y1).values()];let h={};return t.forEach(n=>{Q1(a,n.queryKey)&&(h={...h,...n.defaultOptions})}),h}setMutationDefaults(a,t){c(this,b1).set(U1(a),{mutationKey:a,defaultOptions:t})}getMutationDefaults(a){const t=[...c(this,b1).values()];let h={};return t.forEach(n=>{Q1(a,n.mutationKey)&&(h={...h,...n.defaultOptions})}),h}defaultQueryOptions(a){if(a!=null&&a._defaulted)return a;const t={...c(this,d1).queries,...(a==null?void 0:a.queryKey)&&this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return t.queryHash||(t.queryHash=A2(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...c(this,d1).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){c(this,C).clear(),c(this,o1).clear()}},C=new WeakMap,o1=new WeakMap,d1=new WeakMap,y1=new WeakMap,b1=new WeakMap,z1=new WeakMap,P1=new WeakMap,R1=new WeakMap,Z2),k,L,F1,P,f1,D1,t1,$1,k1,E1,m1,L1,g1,x1,w1,j1,J1,f2,Z1,m2,Y1,L2,X1,x2,t2,w2,a2,B2,h2,I2,g2,l0,Y2,R0=(Y2=class extends W1{constructor(t,h){super();o(this,w1);o(this,J1);o(this,Z1);o(this,Y1);o(this,X1);o(this,t2);o(this,a2);o(this,h2);o(this,g2);o(this,k,void 0);o(this,L,void 0);o(this,F1,void 0);o(this,P,void 0);o(this,f1,void 0);o(this,D1,void 0);o(this,t1,void 0);o(this,$1,void 0);o(this,k1,void 0);o(this,E1,void 0);o(this,m1,void 0);o(this,L1,void 0);o(this,g1,void 0);o(this,x1,void 0);e(this,L,void 0),e(this,F1,void 0),e(this,P,void 0),e(this,x1,new Set),e(this,k,t),this.options=h,e(this,t1,null),this.bindMethods(),this.setOptions(h)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,L).addObserver(this),N2(c(this,L),this.options)?M(this,w1,j1).call(this):this.updateResult(),M(this,X1,x2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G2(c(this,L),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G2(c(this,L),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,M(this,t2,w2).call(this),M(this,a2,B2).call(this),c(this,L).removeObserver(this)}setOptions(t,h){const n=this.options,v=c(this,L);if(this.options=c(this,k).defaultQueryOptions(t),o2(n,this.options)||c(this,k).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,L),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=n.queryKey),M(this,h2,I2).call(this);const r=this.hasListeners();r&&W2(c(this,L),v,this.options,n)&&M(this,w1,j1).call(this),this.updateResult(h),r&&(c(this,L)!==v||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&M(this,J1,f2).call(this);const i=M(this,Z1,m2).call(this);r&&(c(this,L)!==v||this.options.enabled!==n.enabled||i!==c(this,g1))&&M(this,Y1,L2).call(this,i)}getOptimisticResult(t){const h=c(this,k).getQueryCache().build(c(this,k),t),n=this.createResult(h,t);return D0(this,n)&&(e(this,P,n),e(this,D1,this.options),e(this,f1,c(this,L).state)),n}getCurrentResult(){return c(this,P)}trackResult(t){const h={};return Object.keys(t).forEach(n=>{Object.defineProperty(h,n,{configurable:!1,enumerable:!0,get:()=>(c(this,x1).add(n),t[n])})}),h}getCurrentQuery(){return c(this,L)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const h=c(this,k).defaultQueryOptions(t),n=c(this,k).getQueryCache().build(c(this,k),h);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,h))}fetch(t){return M(this,w1,j1).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,P)))}createResult(t,h){var F;const n=c(this,L),v=this.options,r=c(this,P),i=c(this,f1),z=c(this,D1),p=t!==n?t.state:c(this,F1),{state:d}=t;let{error:x,errorUpdatedAt:b,fetchStatus:H,status:V}=d,B=!1,g;if(h._optimisticResults){const I=this.hasListeners(),w=!I&&N2(t,h),n1=I&&W2(t,n,h,v);(w||n1)&&(H=M2(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(V="pending")),h._optimisticResults==="isRestoring"&&(H="idle")}if(h.select&&typeof d.data<"u")if(r&&d.data===(i==null?void 0:i.data)&&h.select===c(this,$1))g=c(this,k1);else try{e(this,$1,h.select),g=h.select(d.data),g=V2(r==null?void 0:r.data,g,h),e(this,k1,g),e(this,t1,null)}catch(I){e(this,t1,I)}else g=d.data;if(typeof h.placeholderData<"u"&&typeof g>"u"&&V==="pending"){let I;if(r!=null&&r.isPlaceholderData&&h.placeholderData===(z==null?void 0:z.placeholderData))I=r.data;else if(I=typeof h.placeholderData=="function"?h.placeholderData((F=c(this,E1))==null?void 0:F.state.data,c(this,E1)):h.placeholderData,h.select&&typeof I<"u")try{I=h.select(I),e(this,t1,null)}catch(w){e(this,t1,w)}typeof I<"u"&&(V="success",g=V2(r==null?void 0:r.data,I,h),B=!0)}c(this,t1)&&(x=c(this,t1),g=c(this,k1),b=Date.now(),V="error");const u=H==="fetching",G=V==="pending",f=V==="error",m=G&&u;return{status:V,fetchStatus:H,isPending:G,isSuccess:V==="success",isError:f,isInitialLoading:m,isLoading:m,data:g,dataUpdatedAt:d.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:u,isRefetching:u&&!G,isLoadingError:f&&d.dataUpdatedAt===0,isPaused:H==="paused",isPlaceholderData:B,isRefetchError:f&&d.dataUpdatedAt!==0,isStale:y2(t,h),refetch:this.refetch}}updateResult(t){const h=c(this,P),n=this.createResult(c(this,L),this.options);if(e(this,f1,c(this,L).state),e(this,D1,this.options),c(this,f1).data!==void 0&&e(this,E1,c(this,L)),o2(n,h))return;e(this,P,n);const v={},r=()=>{if(!h)return!0;const{notifyOnChangeProps:i}=this.options,z=typeof i=="function"?i():i;if(z==="all"||!z&&!c(this,x1).size)return!0;const s=new Set(z??c(this,x1));return this.options.throwOnError&&s.add("error"),Object.keys(c(this,P)).some(p=>{const d=p;return c(this,P)[d]!==h[d]&&s.has(d)})};(t==null?void 0:t.listeners)!==!1&&r()&&(v.listeners=!0),M(this,g2,l0).call(this,{...v,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,x2).call(this)}},k=new WeakMap,L=new WeakMap,F1=new WeakMap,P=new WeakMap,f1=new WeakMap,D1=new WeakMap,t1=new WeakMap,$1=new WeakMap,k1=new WeakMap,E1=new WeakMap,m1=new WeakMap,L1=new WeakMap,g1=new WeakMap,x1=new WeakMap,w1=new WeakSet,j1=function(t){M(this,h2,I2).call(this);let h=c(this,L).fetch(this.options,t);return t!=null&&t.throwOnError||(h=h.catch(_)),h},J1=new WeakSet,f2=function(){if(M(this,t2,w2).call(this),N1||c(this,P).isStale||!s2(this.options.staleTime))return;const h=a0(c(this,P).dataUpdatedAt,this.options.staleTime)+1;e(this,m1,setTimeout(()=>{c(this,P).isStale||this.updateResult()},h))},Z1=new WeakSet,m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,L)):this.options.refetchInterval)??!1},Y1=new WeakSet,L2=function(t){M(this,a2,B2).call(this),e(this,g1,t),!(N1||this.options.enabled===!1||!s2(c(this,g1))||c(this,g1)===0)&&e(this,L1,setInterval(()=>{(this.options.refetchIntervalInBackground||d2.isFocused())&&M(this,w1,j1).call(this)},c(this,g1)))},X1=new WeakSet,x2=function(){M(this,J1,f2).call(this),M(this,Y1,L2).call(this,M(this,Z1,m2).call(this))},t2=new WeakSet,w2=function(){c(this,m1)&&(clearTimeout(c(this,m1)),e(this,m1,void 0))},a2=new WeakSet,B2=function(){c(this,L1)&&(clearInterval(c(this,L1)),e(this,L1,void 0))},h2=new WeakSet,I2=function(){const t=c(this,k).getQueryCache().build(c(this,k),this.options);if(t===c(this,L))return;const h=c(this,L);e(this,L,t),e(this,F1,t.state),this.hasListeners()&&(h==null||h.removeObserver(this),t.addObserver(this))},g2=new WeakSet,l0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(h=>{h(c(this,P))}),c(this,k).getQueryCache().notify({query:c(this,L),type:"observerResultsUpdated"})})},Y2);function F0(a,t){return t.enabled!==!1&&!a.state.dataUpdatedAt&&!(a.state.status==="error"&&t.retryOnMount===!1)}function N2(a,t){return F0(a,t)||a.state.dataUpdatedAt>0&&G2(a,t,t.refetchOnMount)}function G2(a,t,h){if(t.enabled!==!1){const n=typeof h=="function"?h(a):h;return n==="always"||n!==!1&&y2(a,t)}return!1}function W2(a,t,h,n){return h.enabled!==!1&&(a!==t||n.enabled===!1)&&(!h.suspense||a.state.status!=="error")&&y2(a,h)}function y2(a,t){return a.isStaleByTime(t.staleTime)}function D0(a,t){return!o2(a.getCurrentResult(),t)}var M1,D,q,v1,T1,l2,n2,C2,X2,k0=(X2=class extends W1{constructor(t,h){super();o(this,T1);o(this,n2);o(this,M1,void 0);o(this,D,void 0);o(this,q,void 0);o(this,v1,void 0);e(this,D,void 0),e(this,M1,t),this.setOptions(h),this.bindMethods(),M(this,T1,l2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const h=this.options;this.options=c(this,M1).defaultMutationOptions(t),o2(h,this.options)||c(this,M1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,q),observer:this}),(n=c(this,q))==null||n.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,q))==null||t.removeObserver(this)}onMutationUpdate(t){M(this,T1,l2).call(this),M(this,n2,C2).call(this,t)}getCurrentResult(){return c(this,D)}reset(){e(this,q,void 0),M(this,T1,l2).call(this),M(this,n2,C2).call(this)}mutate(t,h){var n;return e(this,v1,h),(n=c(this,q))==null||n.removeObserver(this),e(this,q,c(this,M1).getMutationCache().build(c(this,M1),this.options)),c(this,q).addObserver(this),c(this,q).execute(t)}},M1=new WeakMap,D=new WeakMap,q=new WeakMap,v1=new WeakMap,T1=new WeakSet,l2=function(){var h;const t=((h=c(this,q))==null?void 0:h.state)??e0();e(this,D,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},n2=new WeakSet,C2=function(t){O.batch(()=>{var h,n,v,r,i,z,s,p;c(this,v1)&&this.hasListeners()&&((t==null?void 0:t.type)==="success"?((n=(h=c(this,v1)).onSuccess)==null||n.call(h,t.data,c(this,D).variables,c(this,D).context),(r=(v=c(this,v1)).onSettled)==null||r.call(v,t.data,null,c(this,D).variables,c(this,D).context)):(t==null?void 0:t.type)==="error"&&((z=(i=c(this,v1)).onError)==null||z.call(i,t.error,c(this,D).variables,c(this,D).context),(p=(s=c(this,v1)).onSettled)==null||p.call(s,void 0,t.error,c(this,D).variables,c(this,D).context))),this.listeners.forEach(d=>{d(c(this,D))})})},X2);var i0=A.createContext(void 0),W=a=>{const t=A.useContext(i0);if(a)return a;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},E0=({client:a,children:t})=>(A.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),A.createElement(i0.Provider,{value:a},t)),o0=A.createContext(!1),T0=()=>A.useContext(o0),G4=o0.Provider;function N0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var W0=A.createContext(N0()),j0=()=>A.useContext(W0);function d0(a,t){return typeof a=="function"?a(...t):!!a}var U0=(a,t)=>{(a.suspense||a.throwOnError)&&(t.isReset()||(a.retryOnMount=!1))},Q0=a=>{A.useEffect(()=>{a.clearReset()},[a])},K0=({result:a,errorResetBoundary:t,throwOnError:h,query:n})=>a.isError&&!t.isReset()&&!a.isFetching&&d0(h,[a.error,n]);var q0=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)};var _0=(a,t)=>(a==null?void 0:a.suspense)&&t.isPending,$0=(a,t,h)=>t.fetchOptimistic(a).catch(()=>{h.clearReset()});function J0(a,t,h){if(process.env.NODE_ENV!=="production"&&(typeof a!="object"||Array.isArray(a)))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 n=W(h),v=T0(),r=j0(),i=n.defaultQueryOptions(a);i._optimisticResults=v?"isRestoring":"optimistic",q0(i),U0(i,r),Q0(r);const[z]=A.useState(()=>new t(n,i)),s=z.getOptimisticResult(i);if(A.useSyncExternalStore(A.useCallback(p=>{const d=v?()=>{}:z.subscribe(O.batchCalls(p));return z.updateResult(),d},[z,v]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),A.useEffect(()=>{z.setOptions(i,{listeners:!1})},[i,z]),_0(i,s))throw $0(i,z,r);if(K0({result:s,errorResetBoundary:r,throwOnError:i.throwOnError,query:z.getCurrentQuery()}))throw s.error;return i.notifyOnChangeProps?s:z.trackResult(s)}function c2(a,t){return J0(a,R0,t)}function J(a,t){const h=W(t),[n]=A.useState(()=>new k0(h,a));A.useEffect(()=>{n.setOptions(a)},[n,a]);const v=A.useSyncExternalStore(A.useCallback(i=>n.subscribe(O.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),r=A.useCallback((i,z)=>{n.mutate(i,z).catch(Z0)},[n]);if(v.error&&d0(n.options.throwOnError,[v.error]))throw v.error;return{...v,mutate:r,mutateAsync:v.mutate}}function Z0(){}function R(){return W().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const H1=()=>{const{data:a,refetch:t}=c2({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[a,h=>{h&&(localStorage.setItem("currentPage",h||""),t())}]};let j2="";const v2=()=>(j2=localStorage.getItem("__chai_at"),j2);function Y0(a){const t={method:"GET",headers:{"x-chai-access-token":v2()}};return fetch(a,t)}function X0(a,t){const h={method:"POST",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function t4(a,t){const h={method:"PUT",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function a4(a,t){const h={method:"DELETE",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}const j={get:Y0,post:X0,put:t4,delete:a4},b2=()=>{const[a,t]=H1(),h=R();return c2({queryKey:["project"],queryFn:async()=>{const{data:n}=await j.get(`${h}/project`).then(v=>v.json());if(!a&&n){const v=localStorage.getItem("currentPage");t(v||(n==null?void 0:n.homepage))}return n}})},P2=()=>{const a=R();return c2({queryKey:["pages"],queryFn:async()=>{const{data:t}=await j.get(`${a}/pages`).then(h=>h.json());return t||[]}})},z0=()=>{const[a]=H1(),t=R();return c2({queryKey:["page_data",a],queryFn:async()=>{const{data:h}=await j.get(`${t}/page?uuid=${a}`).then(n=>n.json());return h},enabled:!!a,staleTime:3e3})},O2=()=>l.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:l.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),l.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),g0=(a="Project updated successfully.")=>{const t=W(),h=R();return J({mutationFn:async n=>await j.put(`${h}/project`,n).then(v=>v.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),a1.toast.success(a)}})},M0=()=>{const[a]=["SAVED"],[t,h]=H1(),n=T.useBuilderReset(),{t:v}=s0.useTranslation();return r=>a!=="SAVED"?(a1.toast.error(v("You have unsaved changes. Please save before changing the page.")),!1):t===r.uuid?!1:(n(),setTimeout(()=>h(r.uuid),100),!0)},h4=()=>{const a=W(),t=M0(),h=R();return J({mutationFn:async n=>j.post(`${h}/pages`,n).then(v=>v.json()),onSuccess:n=>{a.invalidateQueries({queryKey:["pages"]}),t({uuid:n.uuid,slug:n.slug}),a1.toast.success("Page added successfully.")}})},H0=()=>{const a=R(),[t]=H1(),h=W();return J({mutationFn:async n=>j.put(`${a}/page`,n).then(v=>v.json()),onSuccess:async n=>{var v;if(n.result==="error"&&((v=n.error)==null?void 0:v.code)=="PAGE_LOCKED"){h.invalidateQueries({queryKey:["page_data",t]});return}a1.toast.success("Page saved successfully.")}})},n4=()=>{const a=R(),{data:t}=P2(),[h]=H1(),{data:n}=b2(),v=W();return J({mutationFn:async()=>{const r=t.find(i=>i.uuid===h).slug;return await j.post(`${a}/publish`,{slug:r,uuid:h,isHomepage:(n==null?void 0:n.homepage)===h}).then(i=>i.json())},onSuccess:async r=>{var i;if(r.result==="error"&&((i=r.error)==null?void 0:i.code)=="PAGE_LOCKED"){v.invalidateQueries({queryKey:["page_data",h]});return}a1.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},c4=()=>{const a=W(),t=R();return J({mutationFn:async h=>j.delete(`${t}/page`,h).then(n=>n.json()),onSuccess:()=>{a1.toast.success("Page deleted successfully."),a.invalidateQueries({queryKey:["pages"]})}})},v4=()=>{const a=W(),t=R();return J({mutationFn:async h=>j.post(`${t}/take-control`,{uuid:h}).then(n=>n.json()),onSuccess:(h,n)=>{a.invalidateQueries({queryKey:["page_data",n]})}})},r4=()=>{const a=R();return J({mutationFn:async()=>{const{data:t}=await j.get(`${a}/library`).then(h=>h.json());return h1.sortBy(h1.filter(t,h=>!h1.has(h,"hidden")),"group")}})},e4=()=>{const a=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:h}=await j.get(`${a}/block?uuid=${t.uuid}&format=${t.format}`).then(async n=>t.format==="html"?p0.getBlocksFromHTML(await n.text()):await n.json());return h1.set(h,"0._name",h1.capitalize(t.group)),h||[]}catch{return[]}}})},l4=()=>{const a=R();return J({mutationFn:async t=>{const h=new FormData;h.append("file",t);const{data:n}=await fetch(`${a}/upload`,{method:"POST",headers:{"x-chai-access-token":v2()},body:h}).then(v=>v.json());return n}})};function u0(a){return t0.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"}}]})(a)}function i4(a){return t0.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"}}]})(a)}const o4=()=>{const{mutate:a,isPending:t}=v4(),[h]=H1(),{data:n}=z0(),v=h1.get(n,"lockedBy.name",""),r=h1.get(n,"lockedBy.email","");return l.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:[l.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),l.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",l.jsxRuntimeExports.jsx("br",{}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[l.jsxRuntimeExports.jsx(i4,{className:"w-4 h-4 text-gray-500"})," ",v]}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[l.jsxRuntimeExports.jsx(u0,{className:"w-4 h-4 text-gray-500"})," ",r]})]}),l.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",v," will be ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),l.jsxRuntimeExports.jsx(T.Button,{disabled:t,onClick:()=>a(h),className:`w-36 ${t?"bg-transparent shadow-none hover:bg-transparent":""}`,children:t?l.jsxRuntimeExports.jsx(S2.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},d4=()=>{const a=R(),t=W();return J({mutationFn:async h=>{const n=await fetch(`${a}/login`,{method:"POST",body:JSON.stringify(h)});if(n.ok)return await n.json();throw n.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:h=>{const{data:n}=h;if(!n.accessToken){a1.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",n.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(h1.omit(n,["accessToken"]))),t.invalidateQueries({queryKey:["verify"]}),a1.toast.success("Logged in successfully.")},onError:()=>{a1.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},z4=()=>{const a=R();return c2({queryKey:["verify"],queryFn:async()=>{const t=await j.get(`${a}/verify`);return t.ok?(await t.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},g4=()=>{const a=R(),t=W();return J({mutationFn:async()=>{const{result:h}=await j.post(`${a}/logout`).then(n=>n.json());if(h==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},M4=({children:a})=>{const t=g4();return l.jsxRuntimeExports.jsxs(T.AlertDialog,{children:[l.jsxRuntimeExports.jsx(T.AlertDialogTrigger,{asChild:!0,children:a}),l.jsxRuntimeExports.jsxs(T.AlertDialogContent,{children:[l.jsxRuntimeExports.jsxs(T.AlertDialogHeader,{children:[l.jsxRuntimeExports.jsxs(T.AlertDialogTitle,{children:["Are you sure, you want to ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),l.jsxRuntimeExports.jsx(T.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"})]}),l.jsxRuntimeExports.jsxs(T.AlertDialogFooter,{children:[l.jsxRuntimeExports.jsx(T.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),l.jsxRuntimeExports.jsxs("button",{disabled:t.isPending,onClick:()=>t.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:[t.isPending&&l.jsxRuntimeExports.jsx(S2.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},H4=()=>l.jsxRuntimeExports.jsx(M4,{children:l.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:l.jsxRuntimeExports.jsx(S2.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),u4=N.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-kdl4A0IN.cjs"))),s4=N.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-mXPBI-TU.cjs"))),p4=N.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-HOPNdQZ-.cjs"))),V4=()=>l.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),f4=()=>{const{mutate:a}=n4();return T.useBuilderProp("editable",!0)?l.jsxRuntimeExports.jsx(T.Button,{onClick:a,className:"bg-blue-600 text-white",children:"Publish"}):null},m4=a=>{var f;const{data:t,isLoading:h}=b2(),{data:n,isLoading:v}=P2(),{data:r}=z0(),{mutate:i}=g0(),{mutate:z}=H0(),[s]=H1(),p=l4(),d=r4(),x=e4(),b=R(),H=N.useCallback(async m=>await p.mutateAsync(m),[p]),V=N.useCallback(async()=>await d.mutateAsync(),[d]),B=N.useCallback(async m=>await x.mutateAsync(m),[x]),g=async(m=20,y=0)=>{const F=`limit=${m}&offset=${y}`,I=await fetch(`${b}/assets?${F}`).then(w=>w.json());return I.result==="success"?I.data:[]},{logo:u=V4}=a;if(h||!t)return l.jsxRuntimeExports.jsx(O2,{});if(v||!n)return l.jsxRuntimeExports.jsx(O2,{});const G={...a,editable:r!=null&&r.lockedBy?r==null?void 0:r.lockedBy.self:!0,nonEditableComponent:o4,blocks:(r==null?void 0:r.blocks)||[],brandingOptions:t.brandingOptions,darkMode:a.darkMode||!1,dataProviders:(r==null?void 0:r.providers)||[],onSavePage:async({blocks:m,providers:y})=>(await z({blocks:m,providers:y,uuid:s}),!0),onSaveBrandingOptions:async m=>(await i({brandingOptions:m}),!0),topBarComponents:{left:[u],center:[p4],right:[f4]},sideBarComponents:{top:[{icon:i2.FileTextIcon,name:"pages",panel:u4},{icon:i2.GearIcon,name:"settings",panel:s4},...((f=a.sideBarComponents)==null?void 0:f.top)||[]],bottom:[H4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>n};return l.jsxRuntimeExports.jsx(T.ChaiBuilderEditor,{...G})},L4=({logo:a})=>{const[t,h]=N.useState(!1),[n,v]=N.useState(""),[r,i]=N.useState(""),{mutate:z,isPending:s}=d4(),p=d=>{d.preventDefault(),z({email:n,password:r})};return l.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:l.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:l.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[l.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[l.jsxRuntimeExports.jsx(N.Suspense,{children:a?N.createElement(a):""}),l.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"})]}),l.jsxRuntimeExports.jsx("div",{className:"mt-8",children:l.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:p,className:"space-y-5",children:[l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx(u0,{})}),l.jsxRuntimeExports.jsx("input",{value:n,onChange:d=>v(d.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"})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.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:l.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"})})}),l.jsxRuntimeExports.jsx("input",{value:r,onChange:d=>i(d.target.value),type:t?"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"}),l.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>h(!t),children:t?l.jsxRuntimeExports.jsx(i2.EyeClosedIcon,{}):l.jsxRuntimeExports.jsx(i2.EyeOpenIcon,{})})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsx("button",{disabled:s||h1.size(n)<2||h1.size(r)<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:s?"Signing in...":"Login"})})]})}),l.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:l.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},x4=a=>{const{data:t,isLoading:h}=z4(),n=W();return N.useEffect(()=>{n.setQueryData(["apiBaseUrl"],a.apiBaseUrl||"/api/chaibuilder")},[a.apiBaseUrl,n]),h?l.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?l.jsxRuntimeExports.jsx(m4,{...a}):l.jsxRuntimeExports.jsx(L4,{logo:a.logo})},w4=new P0,B4=a=>l.jsxRuntimeExports.jsxs(E0,{client:w4,children:[l.jsxRuntimeExports.jsx(a1.Toaster,{richColors:!0}),l.jsxRuntimeExports.jsx(x4,{...a})]});exports.ChaiBuilderStudio=B4;exports.useAddPage=h4;exports.useChangePage=M0;exports.useCurrentPage=H1;exports.useDeletePage=c4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=W;exports.useUpdatePage=H0;exports.useUpdateProject=g0;
@@ -0,0 +1,63 @@
1
+ import o from "react";
2
+ var h = {
3
+ color: void 0,
4
+ size: void 0,
5
+ className: void 0,
6
+ style: void 0,
7
+ attr: void 0
8
+ }, m = o.createContext && o.createContext(h), c = function() {
9
+ return c = Object.assign || function(e) {
10
+ for (var i, t = 1, s = arguments.length; t < s; t++) {
11
+ i = arguments[t];
12
+ for (var n in i)
13
+ Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
14
+ }
15
+ return e;
16
+ }, c.apply(this, arguments);
17
+ }, g = function(e, i) {
18
+ var t = {};
19
+ for (var s in e)
20
+ Object.prototype.hasOwnProperty.call(e, s) && i.indexOf(s) < 0 && (t[s] = e[s]);
21
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
22
+ for (var n = 0, s = Object.getOwnPropertySymbols(e); n < s.length; n++)
23
+ i.indexOf(s[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, s[n]) && (t[s[n]] = e[s[n]]);
24
+ return t;
25
+ };
26
+ function p(e) {
27
+ return e && e.map(function(i, t) {
28
+ return o.createElement(i.tag, c({
29
+ key: t
30
+ }, i.attr), p(i.child));
31
+ });
32
+ }
33
+ function I(e) {
34
+ return function(i) {
35
+ return o.createElement(b, c({
36
+ attr: c({}, e.attr)
37
+ }, i), p(e.child));
38
+ };
39
+ }
40
+ function b(e) {
41
+ var i = function(t) {
42
+ var s = e.attr, n = e.size, l = e.title, u = g(e, ["attr", "size", "title"]), a = n || t.size || "1em", r;
43
+ return t.className && (r = t.className), e.className && (r = (r ? r + " " : "") + e.className), o.createElement("svg", c({
44
+ stroke: "currentColor",
45
+ fill: "currentColor",
46
+ strokeWidth: "0"
47
+ }, t.attr, s, u, {
48
+ className: r,
49
+ style: c(c({
50
+ color: e.color || t.color
51
+ }, t.style), e.style),
52
+ height: a,
53
+ width: a,
54
+ xmlns: "http://www.w3.org/2000/svg"
55
+ }), l && o.createElement("title", null, l), e.children);
56
+ };
57
+ return m !== void 0 ? o.createElement(m.Consumer, null, function(t) {
58
+ return i(t);
59
+ }) : i(h);
60
+ }
61
+ export {
62
+ I as G
63
+ };
@@ -0,0 +1 @@
1
+ "use strict";const o=require("react");var h={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},m=o.createContext&&o.createContext(h),c=function(){return c=Object.assign||function(e){for(var i,t=1,s=arguments.length;t<s;t++){i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},c.apply(this,arguments)},g=function(e,i){var t={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.indexOf(s)<0&&(t[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)i.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(t[s[n]]=e[s[n]]);return t};function p(e){return e&&e.map(function(i,t){return o.createElement(i.tag,c({key:t},i.attr),p(i.child))})}function b(e){return function(i){return o.createElement(d,c({attr:c({},e.attr)},i),p(e.child))}}function d(e){var i=function(t){var s=e.attr,n=e.size,l=e.title,u=g(e,["attr","size","title"]),a=n||t.size||"1em",r;return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),o.createElement("svg",c({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,s,u,{className:r,style:c(c({color:e.color||t.color},t.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&o.createElement("title",null,l),e.children)};return m!==void 0?o.createElement(m.Consumer,null,function(t){return i(t)}):i(h)}exports.GenIcon=b;
@@ -20,12 +20,13 @@ import * as b from "react";
20
20
  import H0, { lazy as A2, useCallback as g2, useState as M2, Suspense as u0, useEffect as s0 } from "react";
21
21
  import "./core.js";
22
22
  import { FileTextIcon as p0, GearIcon as V0, EyeClosedIcon as f0, EyeOpenIcon as m0 } from "@radix-ui/react-icons";
23
- import { u as L0, G as Y2, B as X2, A as x0, a as w0, b as B0, c as C0, d as O0, e as A0, f as S0, g as y0, h as b0, C as P0 } from "./ChaiBuilderEditor-F2yUJQdt.js";
23
+ import { u as L0, B as Y2, A as x0, a as w0, b as B0, c as C0, d as O0, e as A0, f as S0, g as y0, h as b0, C as P0 } from "./ChaiBuilderEditor-3xIN-AP_.js";
24
24
  import { toast as h1, Toaster as F0 } from "sonner";
25
25
  import { useTranslation as D0 } from "react-i18next";
26
26
  import { sortBy as R0, filter as k0, has as T0, set as E0, capitalize as N0, get as b2, omit as I0, size as P2 } from "lodash-es";
27
- import { g as W0 } from "./html-to-json-Z6R2o_fA.js";
27
+ import { g as W0 } from "./html-to-json-GJ6RioQf.js";
28
28
  import { Loader as U0, Loader2 as j0, LogOutIcon as Q0 } from "lucide-react";
29
+ import { G as X2 } from "./index-YpnaudSM.js";
29
30
  var N1 = class {
30
31
  constructor() {
31
32
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
@@ -1618,7 +1619,7 @@ var i0 = b.createContext(
1618
1619
  children: t
1619
1620
  }) => (b.useEffect(() => (a.mount(), () => {
1620
1621
  a.unmount();
1621
- }), [a]), /* @__PURE__ */ b.createElement(i0.Provider, { value: a }, t)), e0 = b.createContext(!1), z4 = () => b.useContext(e0), it = e0.Provider;
1622
+ }), [a]), /* @__PURE__ */ b.createElement(i0.Provider, { value: a }, t)), e0 = b.createContext(!1), z4 = () => b.useContext(e0), et = e0.Provider;
1622
1623
  function g4() {
1623
1624
  let a = !1;
1624
1625
  return {
@@ -1827,7 +1828,7 @@ const I = {
1827
1828
  }, A4 = () => {
1828
1829
  const [a] = ["SAVED"], [t, h] = m1(), v = L0(), { t: r } = D0();
1829
1830
  return (n) => a !== "SAVED" ? (h1.error(r("You have unsaved changes. Please save before changing the page.")), !1) : t === n.uuid ? !1 : (v(), setTimeout(() => h(n.uuid), 100), !0);
1830
- }, et = () => {
1831
+ }, dt = () => {
1831
1832
  const a = G(), t = A4(), h = R();
1832
1833
  return _({
1833
1834
  mutationFn: async (v) => I.post(`${h}/pages`, v).then((r) => r.json()),
@@ -1871,7 +1872,7 @@ const I = {
1871
1872
  });
1872
1873
  }
1873
1874
  });
1874
- }, dt = () => {
1875
+ }, zt = () => {
1875
1876
  const a = G(), t = R();
1876
1877
  return _({
1877
1878
  mutationFn: async (h) => I.delete(`${t}/page`, h).then((v) => v.json()),
@@ -1928,10 +1929,10 @@ const I = {
1928
1929
  });
1929
1930
  };
1930
1931
  function o0(a) {
1931
- return Y2({ 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" } }] })(a);
1932
+ return X2({ 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" } }] })(a);
1932
1933
  }
1933
1934
  function R4(a) {
1934
- return Y2({ 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" } }] })(a);
1935
+ return X2({ 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" } }] })(a);
1935
1936
  }
1936
1937
  const k4 = () => {
1937
1938
  const { mutate: a, isPending: t } = b4(), [h] = m1(), { data: v } = M0(), r = b2(v, "lockedBy.name", ""), n = b2(v, "lockedBy.email", "");
@@ -1964,7 +1965,7 @@ const k4 = () => {
1964
1965
  ] })
1965
1966
  ] }),
1966
1967
  /* @__PURE__ */ i.jsx(
1967
- X2,
1968
+ Y2,
1968
1969
  {
1969
1970
  disabled: t,
1970
1971
  onClick: () => a(h),
@@ -2043,9 +2044,9 @@ const k4 = () => {
2043
2044
  ] })
2044
2045
  ] })
2045
2046
  ] });
2046
- }, W4 = () => /* @__PURE__ */ i.jsx(I4, { children: /* @__PURE__ */ i.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ i.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-D1TOGyVE.js")), j4 = A2(() => import("./ProjectPanel-PdvQsrbk.js")), Q4 = A2(() => import("./CurrentPage--lDu6fB9.js")), K4 = () => /* @__PURE__ */ i.jsx("h2", { children: "Your Logo" }), G4 = () => {
2047
+ }, W4 = () => /* @__PURE__ */ i.jsx(I4, { children: /* @__PURE__ */ i.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ i.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-5iVsbDP1.js")), j4 = A2(() => import("./ProjectPanel-c8oTzhQd.js")), Q4 = A2(() => import("./CurrentPage-qhBjm7th.js")), K4 = () => /* @__PURE__ */ i.jsx("h2", { children: "Your Logo" }), G4 = () => {
2047
2048
  const { mutate: a } = y4();
2048
- return b0("editable", !0) ? /* @__PURE__ */ i.jsx(X2, { onClick: a, className: "bg-blue-600 text-white", children: "Publish" }) : null;
2049
+ return b0("editable", !0) ? /* @__PURE__ */ i.jsx(Y2, { onClick: a, className: "bg-blue-600 text-white", children: "Publish" }) : null;
2049
2050
  }, q4 = (a) => {
2050
2051
  var f;
2051
2052
  const { data: t, isLoading: h } = z0(), { data: v, isLoading: r } = g0(), { data: n } = M0(), { mutate: e } = O4(), { mutate: g } = S4(), [s] = m1(), p = D4(), z = P4(), x = F4(), F = R(), H = g2(
@@ -2182,19 +2183,19 @@ const k4 = () => {
2182
2183
  return s0(() => {
2183
2184
  v.setQueryData(["apiBaseUrl"], a.apiBaseUrl || "/api/chaibuilder");
2184
2185
  }, [a.apiBaseUrl, v]), h ? /* @__PURE__ */ i.jsx(O2, {}) : t != null && t.valid ? /* @__PURE__ */ i.jsx(q4, { ...a }) : /* @__PURE__ */ i.jsx(_4, { logo: a.logo });
2185
- }, J4 = new r4(), zt = (a) => /* @__PURE__ */ i.jsxs(d4, { client: J4, children: [
2186
+ }, J4 = new r4(), gt = (a) => /* @__PURE__ */ i.jsxs(d4, { client: J4, children: [
2186
2187
  /* @__PURE__ */ i.jsx(F0, { richColors: !0 }),
2187
2188
  /* @__PURE__ */ i.jsx($4, { ...a })
2188
2189
  ] });
2189
2190
  export {
2190
- zt as C,
2191
+ gt as C,
2191
2192
  z0 as a,
2192
2193
  O4 as b,
2193
2194
  A4 as c,
2194
2195
  m1 as d,
2195
- et as e,
2196
+ dt as e,
2196
2197
  G as f,
2197
2198
  S4 as g,
2198
- dt as h,
2199
+ zt as h,
2199
2200
  g0 as u
2200
2201
  };