@chaibuilder/sdk 1.2.25 → 1.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/AddBlocks-l1JENNvq.js +206 -0
  2. package/dist/AddBlocks-zPPKkeKs.cjs +1 -0
  3. package/dist/BrandingOptions-DkpqGARR.cjs +1 -0
  4. package/dist/{BrandingOptions-iTyWpwTs.js → BrandingOptions-udtH5yJs.js} +54 -40
  5. package/dist/{CanvasArea-dZjng782.js → CanvasArea-h0W-Tyha.js} +324 -340
  6. package/dist/CanvasArea-zme1r3Zi.cjs +55 -0
  7. package/dist/Class-PoYusiA5.cjs +1 -0
  8. package/dist/{Class-ahc3NIbq.js → Class-lGzsNBOK.js} +29 -26
  9. package/dist/CurrentPage-Hl52iub_.cjs +1 -0
  10. package/dist/{CurrentPage-Kmfp-kFk.js → CurrentPage-tJUjXWdb.js} +54 -40
  11. package/dist/Functions-7jnEwJyw.js +15 -0
  12. package/dist/Functions-N3yhPYKY.cjs +1 -0
  13. package/dist/ListTree-WvTjY5rr.cjs +1 -0
  14. package/dist/{ListTree-N3jeD790.js → ListTree-cZ-Ihlt3.js} +96 -86
  15. package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
  16. package/dist/{MODIFIERS-CNqNUapY.js → MODIFIERS-dytZ-osO.js} +4 -10
  17. package/dist/PagesPanel-6rrLXEO-.js +64 -0
  18. package/dist/PagesPanel-WzCocl6u.cjs +1 -0
  19. package/dist/ProjectPanel-o7gdcwPn.cjs +1 -0
  20. package/dist/ProjectPanel-tz3bjdXy.js +85 -0
  21. package/dist/{STRINGS-b432aBJJ.js → STRINGS--j49GZJP.js} +2 -2
  22. package/dist/{Settings-jCcd-VE6.js → Settings-4s2LUVmC.js} +401 -407
  23. package/dist/Settings-AqoKwR92.cjs +1 -0
  24. package/dist/SidePanels-3o6Okmvu.cjs +1 -0
  25. package/dist/{SidePanels-pHMYprpW.js → SidePanels-bugFfInz.js} +118 -108
  26. package/dist/Topbar-CqW7G360.cjs +1 -0
  27. package/dist/Topbar-pWzBEOed.js +132 -0
  28. package/dist/UnsplashImages-NGskB93R.cjs +1 -0
  29. package/dist/{UnsplashImages-L7x_3RQf.js → UnsplashImages-qvwFbV-E.js} +63 -50
  30. package/dist/{UploadImages-zdEJRLD8.js → UploadImages-9NapgXBq.js} +60 -37
  31. package/dist/UploadImages-Oh7Glr9A.cjs +1 -0
  32. package/dist/_commonjsHelpers-UyOWmZb0.js +8 -0
  33. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +1 -0
  34. package/dist/add-page-modal--6TTBRYa.cjs +1 -0
  35. package/dist/add-page-modal-k2Kb92HS.js +104 -0
  36. package/dist/confirm-alert-C4M9eF-o.cjs +1 -0
  37. package/dist/confirm-alert-GUhZ_G8w.js +60 -0
  38. package/dist/controls-KK2oLIa8.cjs +1 -0
  39. package/dist/{controls-IS5qnRce.js → controls-OfJWSEqC.js} +85 -20
  40. package/dist/core.cjs +1 -1
  41. package/dist/core.js +75 -150
  42. package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
  43. package/dist/{defaultTheme-4kA60XdB.js → defaultTheme-D8B4-wHO.js} +8 -6
  44. package/dist/delete-page-modal-cFoL-wdo.cjs +1 -0
  45. package/dist/delete-page-modal-zONvdebd.js +83 -0
  46. package/dist/email-blocks.cjs +1 -1
  47. package/dist/email-blocks.js +292 -3
  48. package/dist/email.cjs +1 -1
  49. package/dist/email.js +37 -18
  50. package/dist/empty-slot-ZBlsQi6m.js +15 -0
  51. package/dist/empty-slot-nzYOgZuS.cjs +1 -0
  52. package/dist/{form-0_RLz2TB.js → form-STUz-6nE.js} +12 -12
  53. package/dist/form-lBQ_76Uw.cjs +1 -0
  54. package/dist/{html-to-json-uSnxl72F.cjs → html-to-json-efmv1pCj.cjs} +1 -1
  55. package/dist/{html-to-json-2xtb7520.js → html-to-json-ngX9ef2u.js} +41 -41
  56. package/dist/index-Gk6sASBd.js +3080 -0
  57. package/dist/index-OB199Izc.cjs +206 -0
  58. package/dist/index-SkyM3d6Q.js +39503 -0
  59. package/dist/index-YpnaudSM.js +63 -0
  60. package/dist/index-e0c8PmRQ.js +205 -0
  61. package/dist/index-ecnGWzh9.cjs +1 -0
  62. package/dist/index-gi1LIOCw.cjs +1 -0
  63. package/dist/index-h-hd6EvN.cjs +1 -0
  64. package/dist/index-llTXLDGE.js +2201 -0
  65. package/dist/index-mbyqq81O.cjs +1 -0
  66. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-WbnYoNE9.js} +109 -106
  67. package/dist/jsx-runtime-Z_BpKhVy.cjs +27 -0
  68. package/dist/lib.cjs +2 -2
  69. package/dist/lib.js +66 -62
  70. package/dist/page-viewer-2kwnKM6v.cjs +1 -0
  71. package/dist/{page-viewer-NnOwmAmu.js → page-viewer-Pdg9F5Hv.js} +57 -43
  72. package/dist/project-general-setting-CnNL98NM.cjs +1 -0
  73. package/dist/{project-general-setting-9ju3TDju.js → project-general-setting-f8Ebsn6K.js} +43 -35
  74. package/dist/project-seo-setting-mlxL_e2_.cjs +1 -0
  75. package/dist/{project-seo-setting-36CdUszM.js → project-seo-setting-pX34Qsym.js} +40 -23
  76. package/dist/render.cjs +1 -1
  77. package/dist/render.js +14 -13
  78. package/dist/single-page-detail-XfzrGlzA.cjs +1 -0
  79. package/dist/{single-page-detail-hD1jKZ8k.js → single-page-detail-dpe5LT0M.js} +74 -66
  80. package/dist/studio.cjs +1 -1
  81. package/dist/studio.js +40 -24
  82. package/dist/ui.cjs +1 -1
  83. package/dist/ui.js +160 -365
  84. package/dist/web-blocks.cjs +6 -1
  85. package/dist/web-blocks.js +1153 -3
  86. package/package.json +1 -1
  87. package/dist/AddBlocks-Ol3iIVKa.js +0 -207
  88. package/dist/AddBlocks-a1c-7Ewz.cjs +0 -1
  89. package/dist/BrandingOptions-6rnt0UaA.cjs +0 -1
  90. package/dist/CanvasArea-R4ogF9AT.cjs +0 -55
  91. package/dist/ChaiBuilderEditor-m30yoOgJ.cjs +0 -163
  92. package/dist/ChaiBuilderEditor-vP4at00I.js +0 -27974
  93. package/dist/Class-eieto7e-.cjs +0 -1
  94. package/dist/Controls-3Cc1XYXg.js +0 -105
  95. package/dist/Controls-ky25Ebo3.cjs +0 -1
  96. package/dist/CurrentPage-3gQTH0Zt.cjs +0 -1
  97. package/dist/Functions-Hvon6AMZ.cjs +0 -1
  98. package/dist/Functions-NzT2Six_.js +0 -15
  99. package/dist/ImagesPanel-J1RlG7xG.cjs +0 -1
  100. package/dist/ImagesPanel-Wb0GF_NA.js +0 -29
  101. package/dist/ListTree-CZ-mtjZ9.cjs +0 -1
  102. package/dist/MODIFIERS-o1p3VnpS.cjs +0 -1
  103. package/dist/PagesPanel-Gi0z6gaf.cjs +0 -1
  104. package/dist/PagesPanel-u1IB-nRr.js +0 -48
  105. package/dist/ProjectPanel-EydGZmMW.js +0 -71
  106. package/dist/ProjectPanel-kiiljG4H.cjs +0 -1
  107. package/dist/Settings-8ilCSH8b.cjs +0 -1
  108. package/dist/SidePanels-T36C6Lhc.cjs +0 -1
  109. package/dist/Topbar-CvWQuspR.cjs +0 -1
  110. package/dist/Topbar-pbIDUE_B.js +0 -122
  111. package/dist/UnsplashImages-KBZPd9dv.cjs +0 -1
  112. package/dist/UploadImages-GkkJVAgG.cjs +0 -1
  113. package/dist/accordion-oPUeqPCZ.js +0 -42
  114. package/dist/accordion-ynvFtV_p.cjs +0 -1
  115. package/dist/add-page-modal-9SGv2hgc.cjs +0 -1
  116. package/dist/add-page-modal-JCDXZIPW.js +0 -95
  117. package/dist/alert-dialog-P9xMMB6C.cjs +0 -1
  118. package/dist/alert-dialog-rypfO5ly.js +0 -64
  119. package/dist/badge-E-S7CqUt.cjs +0 -1
  120. package/dist/badge-tEwO7C51.js +0 -23
  121. package/dist/block-helpers-OKHmRRol.cjs +0 -1
  122. package/dist/block-helpers-oSFpSsGz.js +0 -23
  123. package/dist/command-BxR6jaCI.cjs +0 -1
  124. package/dist/command-Pn3HKDuV.js +0 -97
  125. package/dist/confirm-alert-uNm0lZ0y.cjs +0 -1
  126. package/dist/confirm-alert-wR5_VJ1l.js +0 -36
  127. package/dist/context-menu-8dC9uGXj.js +0 -122
  128. package/dist/context-menu-IgLbIuth.cjs +0 -1
  129. package/dist/controls-L7DPvB0m.cjs +0 -1
  130. package/dist/defaultTheme-mrkeGFGI.cjs +0 -1
  131. package/dist/delete-page-modal-7KmP1elv.js +0 -67
  132. package/dist/delete-page-modal-SgfwvfNu.cjs +0 -1
  133. package/dist/dropdown-menu-El86_9Uo.js +0 -124
  134. package/dist/dropdown-menu-SiHzqWwZ.cjs +0 -1
  135. package/dist/form-W58AVUdf.cjs +0 -1
  136. package/dist/hover-card-KUwpDkW8.cjs +0 -1
  137. package/dist/hover-card-q138xxXR.js +0 -45
  138. package/dist/iconBase-gbUAAO2L.cjs +0 -1
  139. package/dist/iconBase-h4DuR_XT.js +0 -63
  140. package/dist/index-9MmykVSc.cjs +0 -1
  141. package/dist/index-hElOGcFr.js +0 -2200
  142. package/dist/index-lDTsQp7h.js +0 -188
  143. package/dist/index-rq5Y9ZDy.cjs +0 -1
  144. package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
  145. package/dist/label-KaP7MRrs.js +0 -10
  146. package/dist/label-tFm8HZdb.cjs +0 -1
  147. package/dist/link-WbcKdQ9k.cjs +0 -1
  148. package/dist/link-xuhP-4dN.js +0 -196
  149. package/dist/page-viewer-Hx5hxHKm.cjs +0 -1
  150. package/dist/popover-a84pbVhQ.js +0 -23
  151. package/dist/popover-fKjgcRUx.cjs +0 -1
  152. package/dist/project-general-setting-FxkwjvJz.cjs +0 -1
  153. package/dist/project-seo-setting-RU7qiXxb.cjs +0 -1
  154. package/dist/scroll-area-FiHvy-TZ.cjs +0 -1
  155. package/dist/scroll-area-ewXbxc3n.js +0 -30
  156. package/dist/select-7bjg-rr9.cjs +0 -1
  157. package/dist/select-POGdEDHT.js +0 -75
  158. package/dist/separator-3Civ-6hb.cjs +0 -1
  159. package/dist/separator-SctTn0Qi.js +0 -18
  160. package/dist/single-page-detail-beY0MT1b.cjs +0 -1
  161. package/dist/skeleton-STeL9VrJ.cjs +0 -1
  162. package/dist/skeleton-lu8e7q2y.js +0 -239
  163. package/dist/tabs-_4WbA1cc.cjs +0 -1
  164. package/dist/tabs-yQ3oGziM.js +0 -106
  165. package/dist/textarea-1kZEh7ki.cjs +0 -1
  166. package/dist/textarea-b2QvVhrK.js +0 -73
  167. package/dist/useAddBlock-8pxOEYIl.cjs +0 -1
  168. package/dist/useAddBlock-FEKFJNwQ.js +0 -69
  169. package/dist/useChaiExternalData-fkFgoS80.js +0 -6
  170. package/dist/useChaiExternalData-rwoAZ6uU.cjs +0 -1
  171. package/dist/useDarkMode-7i57segK.cjs +0 -1
  172. package/dist/useDarkMode-8VHJlYyE.js +0 -23
  173. package/dist/useSelectedBreakpoints-6NK5qd7T.js +0 -10
  174. package/dist/useSelectedBreakpoints-7ONXb-vN.cjs +0 -1
  175. package/dist/useStylingState-Iuj84yvc.js +0 -186
  176. package/dist/useStylingState-OIvJMV6p.cjs +0 -1
  177. package/dist/useUiLibraries-nCdauJ4N.cjs +0 -1
  178. package/dist/useUiLibraries-psyWFbNc.js +0 -12
  179. package/dist/useUpdateBlocksProps-Unn8lUyj.cjs +0 -1
  180. package/dist/useUpdateBlocksProps-vWcDp-P9.js +0 -23
  181. package/dist/utils-dze1SGvB.js +0 -6
  182. package/dist/utils-qK_SjzzV.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),m=require("react"),re=require("@react-hookz/web"),t=require("lodash-es"),M=require("react-i18next"),u=require("@radix-ui/react-icons"),ie=require("./scroll-area-FiHvy-TZ.cjs"),S=require("./tabs-_4WbA1cc.cjs"),C=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),K=require("./useUpdateBlocksProps-Unn8lUyj.cjs"),f=require("./skeleton-STeL9VrJ.cjs"),ve=require("./controls-L7DPvB0m.cjs"),F=require("lucide-react"),J=require("./popover-fKjgcRUx.cjs"),P=require("./command-BxR6jaCI.cjs"),Y=require("@chaibuilder/runtime"),me=require("./useChaiExternalData-rwoAZ6uU.cjs"),Q=require("./index-rq5Y9ZDy.cjs"),V=require("./accordion-ynvFtV_p.cjs"),ae=require("./Controls-ky25Ebo3.cjs"),Ee=require("@rjsf/core"),we=require("@rjsf/validator-ajv8"),U=require("./link-WbcKdQ9k.cjs"),D=require("./useStylingState-OIvJMV6p.cjs"),Ce=require("react-autosuggest"),ke=require("fuse.js"),O=require("./Class-eieto7e-.cjs"),ge=require("./label-tFm8HZdb.cjs"),Ne=require("./STRINGS-gPz7CUOk.cjs"),ee=require("./useDarkMode-7i57segK.cjs"),k=require("./select-7bjg-rr9.cjs"),I=require("./dropdown-menu-SiHzqWwZ.cjs");require("@radix-ui/react-scroll-area");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("./MODIFIERS-o1p3VnpS.cjs");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-popover");require("cmdk");require("@radix-ui/react-accordion");require("react-icons-picker");require("./ImagesPanel-J1RlG7xG.cjs");require("react-quill");require("@radix-ui/react-label");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");function Se(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(o,r,l.get?l:{enumerable:!0,get:()=>s[r]})}}return o.default=s,Object.freeze(o)}const G=Se(m);function Te(s){const o=[],r={};function l(n,p){t.forEach(p,(i,x)=>{const d=n?`${n}.${x}`:x,c=t.isArray(i)?"list":typeof i;o.push(d),r[d]=c==="string"?"text":c==="object"?"model":c,c==="object"&&!t.isArray(i)&&l(d,i)})}return l("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:r}}const oe=({data:s,fullView:o})=>{if(!s)return null;const r=typeof s;return o?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(C.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Q.JsonView,{data:s,shouldExpandNode:Q.allExpanded,style:{...Q.defaultStyles,container:"max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]}):e.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},pe=({type:s,value:o="",setValue:r,data:l,onChange:n,dataType:p,appliedBindings:i})=>{const{paths:x,pathsType:d}=Te(l),c=s==="PROP"?Y.getBlockComponent(l==null?void 0:l._type):{},y=s==="PROP",[a,h]=m.useState(!1),j=m.useMemo(()=>s==="PROP"?x.filter(g=>!t.includes(i,g)&&t.get(c,`props.${t.first(t.split(g,"."))}.binding`)):x.filter(g=>p===t.get(d,g,"")),[s,x,i,p,c]);return m.useEffect(()=>{o&&n(o)},[o,s]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(s))}),e.jsxRuntimeExports.jsxs(J.Popover,{open:a,onOpenChange:h,children:[e.jsxRuntimeExports.jsx(J.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(f.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(o)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[y&&e.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(p)}),o]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(J.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(P.Command,{children:[e.jsxRuntimeExports.jsx(P.CommandInput,{placeholder:`Choose ${t.toLower(s)}...`}),e.jsxRuntimeExports.jsxs(P.CommandList,{children:[e.jsxRuntimeExports.jsx(P.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(P.CommandGroup,{children:t.map(j,g=>e.jsxRuntimeExports.jsxs(P.CommandItem,{value:g,className:`cursor-pointer ${y?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:R=>{r(t.find(j,E=>E===R)||null),h(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(F.Check,{className:`h-4 w-4 text-green-500 ${o===g?"":"opacity-0"}`}),g]}),y?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(t.get(d,g,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(oe,{data:t.get(l,g)})})]},g))})]})]})})]})]}),!y&&!t.isEmpty(o)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(oe,{data:t.get(l,o,""),fullView:!0})})]})},Ie=({appliedBindings:s=[],onAddBinding:o,editMode:r,item:l})=>{const[n,p]=m.useState(r?l.key:""),[i,x]=m.useState(r?l.value:""),d=C.useSelectedBlock(),[c]=me.useChaiExternalData(),y=m.useCallback((j,g)=>{if(t.isEmpty(j))return"";{const R=t.get(g==="PROP"?d:c,j,"");if(t.isArray(R))return"list";const E=typeof R;return E==="string"?"text":E==="object"?"model":E}},[d,c]),[a,h]=m.useState(r?y(l.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(S.DialogHeader,{children:[e.jsxRuntimeExports.jsx(S.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(S.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(pe,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:n,setValue:p,onChange:j=>{const g=y(j,"PROP");p(j),a!==g&&x(""),h(g)},data:d,dataType:a,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(pe,{type:"PATH",isDisabled:t.isEmpty(n),placeholder:"Enter data path",value:i,setValue:x,onChange:j=>{const g=y(j,"PATH");x(a===g?j:"")},data:c,dataType:a,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(S.DialogFooter,{children:e.jsxRuntimeExports.jsx(f.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(n)&&t.isEmpty(i),onClick:()=>o({key:n,value:i}),children:"Save"})})]})},he=({disabled:s,children:o,onAddBinding:r,appliedBindings:l,editMode:n=!0,item:p={}})=>{const[i,x]=m.useState(!1);return e.jsxRuntimeExports.jsxs(S.Dialog,{children:[e.jsxRuntimeExports.jsx(S.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>x(!0),children:o}),i&&e.jsxRuntimeExports.jsx(S.DialogContent,{children:e.jsxRuntimeExports.jsx(Ie,{item:p,editMode:n,appliedBindings:l,onAddBinding:d=>{r(d),x(!1)}})})]})},_e=({item:s,onAddBinding:o,onRemove:r,selectedBlock:l,dataProvider:n,appliedBindings:p})=>{const[i,x]=m.useState("string"),d=(c,y)=>{if(t.isEmpty(c))return"";{const a=t.get(y==="PROP"?l:n,c,"");if(t.isArray(a))return"list";const h=typeof a;return h==="string"?"text":h==="object"?"model":h}};return m.useEffect(()=>x(()=>d(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-gray-200 p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(oe,{data:t.get(n,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(he,{editMode:!0,onAddBinding:o,appliedBindings:p,item:s,children:e.jsxRuntimeExports.jsx(F.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),e.jsxRuntimeExports.jsx(F.TrashIcon,{onClick:()=>r(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!t.isEmpty(i)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:t.startCase(i)})]})},Be=({bindingData:s,onChange:o})=>{const r=C.useSelectedBlock(),[l]=me.useChaiExternalData(),n=Y.getChaiDataProviders(),[p,i]=m.useState(t.map(s,(a,h)=>({key:h,value:a})));m.useEffect(()=>{i(t.map(s,(a,h)=>({key:h,value:a})))},[r==null?void 0:r._id,s]);const x=m.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(p))return!1;const a=t.last(p);return t.isEmpty(a==null?void 0:a.key)||t.isEmpty(a==null?void 0:a.value)},[l,p]),d=a=>{const h=t.filter(p,j=>j.key!==a.key);i([...h,a]),y([...h,a])},c=a=>{const h=t.filter(p,(j,g)=>a!==g);y([...h])},y=m.useCallback((a=[])=>{if(i(a),t.isEmpty(a)){o({});return}const h={};t.forEach(a,j=>{!t.isEmpty(j==null?void 0:j.key)&&!t.isEmpty(j==null?void 0:j.value)&&t.set(h,j.key,j.value)}),o(h)},[o]);return t.isEmpty(n)?e.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(p,(a,h)=>e.jsxRuntimeExports.jsx(_e,{item:a,onAddBinding:d,onRemove:()=>c(h),selectedBlock:r,dataProvider:l,appliedBindings:t.map(p,"key")},a.key)),e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{disabled:t.isEmpty(l),className:"w-full",children:e.jsxRuntimeExports.jsx(he,{disabled:x,appliedBindings:t.map(p,"key"),onAddBinding:d,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${x?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(l)?e.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),x&&e.jsxRuntimeExports.jsx(f.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(l)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},He=Be,Ve=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),te=m.memo(({id:s,properties:o,formData:r,onChange:l})=>{const[n,p]=m.useState(r),i={type:"object",properties:{}},x={};return Object.keys(o).forEach(d=>{const c=o[d];if(t.includes(["slot","styles"],c.type))return;const y=d;i.properties[y]=ae.getBlockJSONFromSchemas(c),x[y]=ae.getBlockJSONFromUISchemas(c)}),m.useEffect(()=>{p(r)},[s]),e.jsxRuntimeExports.jsx(Ee,{widgets:{binding:Ve,richtext:U.RichTextEditorField,icon:U.IconPickerField,image:U.ImagePickerField},fields:{link:U.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:we,uiSchema:x,schema:i,formData:n,onChange:({formData:d},c)=>{c&&(p(d),l({formData:d},c))}})});function De(){const s=C.useSelectedBlock(),o=K.useUpdateBlocksPropsRealtime(),r=K.useUpdateBlocksProps(),l=Y.getBlockComponent(s._type),n={...s},[p,i]=m.useState(n),x=f.useBuilderProp("dataBindingSupport",!1),d=({formData:g},R,E)=>{if(R&&(p==null?void 0:p._id)===s._id){const B=R.replace("root.","");r([s._id],{[B]:t.get(g,B)},E)}},c=m.useCallback(t.debounce(({formData:g},R,E)=>{d({formData:g},R,E),i(g)},1500),[s==null?void 0:s._id]),y=({formData:g},R)=>{if(R){const E=R.replace("root.","");o([s._id],{[E]:t.get(g,E)}),c({formData:g},R,{[E]:t.get(p,E)})}},a={_name:ve.u({title:"Name",default:t.get(s,"_name",s._type)})},h=t.keys(t.get(n,"_bindings",{})),j=m.useMemo(()=>{const g=t.cloneDeep(t.get(l,"props",{}));return x&&t.each(h,R=>delete g[R]),g},[l,h,x]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(te,{id:s==null?void 0:s._id,onChange:y,formData:n,properties:a}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),x?e.jsxRuntimeExports.jsxs(V.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(V.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(V.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(V.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(He,{bindingData:t.get(s,"_bindings",{}),onChange:g=>{d({formData:{_bindings:g}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(V.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(V.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(V.AccordionContent,{className:"pt-4",children:[t.isEmpty(h)?null:e.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(h,t.capitalize).join(", ")})," ",h.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(te,{id:s==null?void 0:s._id,onChange:y,formData:n,properties:j})]})]})]}):e.jsxRuntimeExports.jsx(te,{id:s==null?void 0:s._id,onChange:y,formData:n,properties:j}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const de=new ke(O.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Ae(){var B;const[s]=C.useSelectedStylingBlocks(),o=C.useSelectedBlock(),r=D.useAddClassesToBlocks(),l=D.useRemoveClassesFromBlocks(),[n]=C.useSelectedBlockIds(),[p,i]=m.useState(""),x=(B=t.first(s))==null?void 0:B.prop,d=t.reject((t.get(o,x,"").replace(Ne.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),c=()=>{const w=p.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(n,w,!0),i("")},[y,a]=m.useState([]),h=({value:w})=>{const A=w.trim().toLowerCase(),$=A.match(/.+:/g);let N=[];if($&&$.length>0){const[H]=$,q=A.replace(H,"");N=de.search(q).map(b=>({...b,item:{...b.item,name:H+b.item.name}}))}else N=de.search(A);a(t.map(N,"item"))},j=()=>{a([])},g=w=>w.name,R=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),E={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:p,onKeyDown:w=>{w.key==="Enter"&&p.trim()!==""&&c()},onChange:(w,{newValue:A})=>i(A),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${y.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsx(ge.Label,{className:"mt-2",children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(Ce,{suggestions:y,onSuggestionsFetchRequested:h,onSuggestionsClearRequested:j,getSuggestionValue:g,renderSuggestion:R,inputProps:E,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(f.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:c,disabled:p.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(d)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),G.Children.toArray(d.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>l(n,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const _=["px","%","em","rem","ch","vh","vw"],Pe={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:_,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},Me={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},$e=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:_.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:_.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[..._,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"multiple",label:"layout.space_bt",options:[{key:"spaceX",label:"layout.space_lr"},{key:"spaceY",label:"layout.space_tb"}]}]},{heading:"size.heading",items:[{styleType:"accordion",heading:"size.min_width_height",items:[{type:"arbitrary",label:"size.min_width",units:_.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:_.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:_.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:_.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"size.object_options_aspect_ratio",items:[{type:"dropdown",label:"size.aspect",property:"aspectRatio"},{type:"dropdown",label:"size.fit",property:"objectFit"},{type:"dropdown",label:"size.position",property:"objectPosition"}]}]},{heading:"display.heading",items:[{type:"dropdown",label:"display.display",property:"display",units:_},{styleType:"accordion",heading:"display.flex_options",items:[{type:"dropdown",label:"display.flex_direction",property:"flexDirection"},{type:"dropdown",label:"display.flex_wrap",property:"flexWrap"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"display.grid_options",items:[{type:"range",label:"display.grid_columns",property:"gridColumns"},{type:"range",label:"display.grid_rows",property:"gridRows"},{type:"dropdown",label:"display.grid_auto_flow",property:"gridAutoFlow"},{type:"dropdown",label:"display.grid_auto_cols",property:"gridAutoColumns"},{type:"dropdown",label:"display.grid_auto_rows",property:"gridAutoRows"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",units:["px","rem"],options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"display.visibility_opacity",items:[{type:"dropdown",label:"display.visibility",property:"visibility",units:_},{type:"arbitrary",label:"display.opacity",property:"opacity",units:["-"]}]}]},{heading:"position.heading",items:[{type:"icons",label:"position.position",property:"position"},{styleType:"accordion",heading:"position.options",items:[{styleType:"multiple",label:"position.direction",options:[{key:"top",label:"position.top"},{key:"right",label:"position.right"},{key:"bottom",label:"position.bottom"},{key:"left",label:"position.left"}]},{styleType:"multiple",label:"position.inset",options:[{key:"inset",label:"position.all"},{key:"insetX",label:"position.lr"},{key:"insetY",label:"position.tb"}]},{type:"arbitrary",label:"position.z_index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"position.float_clear",items:[{type:"icons",label:"position.float",property:"float"},{type:"dropdown",label:"position.clear",property:"clear"}]},{styleType:"accordion",heading:"position.overflow_overscroll",items:[{styleType:"multiple",type:"dropdown",label:"position.overflow",options:[{key:"overflow",label:"position.all"},{key:"overflowX",label:"position.lr"},{key:"overflowY",label:"position.tb"}]},{styleType:"multiple",type:"dropdown",label:"position.overscroll",options:[{key:"overscroll",label:"position.all"},{key:"overscrollX",label:"position.lr"},{key:"overscrollY",label:"position.tb"}]}]}]},{heading:"typography.heading",items:[{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:_},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:_.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"verticalAlign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"letterSpacing",label:"typography.spacing"},{type:"dropdown",property:"textDecoration",label:"typography.decoration"},{type:"range",property:"textDecorationThickness",label:"typography.thickness"},{type:"dropdown",property:"textTransform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"whitespace",label:"typography.whitespace"},{type:"dropdown",property:"wordbreak",label:"typography.wordbreak"}]}]},{heading:"background.heading",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{styleType:"accordion",heading:"background.position_size_more",items:[{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]},{type:"dropdown",label:"background.gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"background.gradient_colors",items:[{type:"color",label:"background.from_color",property:"fromColor"},{type:"color",label:"background.via_color",property:"viaColor"},{type:"color",label:"background.to_color",property:"toColor"}]}]},{heading:"border.heading",items:[{styleType:"multiple",type:"dropdown",label:"border.width",options:[{key:"border",label:"border.all"},{key:"borderX",label:"border.lr"},{key:"borderY",label:"border.tb"},{key:"borderTop",label:"border.top"},{key:"borderRight",label:"border.right"},{key:"borderBottom",label:"border.bottom"},{key:"borderLeft",label:"border.left"}]},{styleType:"multiple",type:"dropdown",label:"border.corners",options:[{key:"borderRadius",label:"border.all"},{key:"borderRadiusTop",label:"border.top"},{key:"borderRadiusRight",label:"border.right"},{key:"borderRadiusBottom",label:"border.bottom"},{key:"borderRadiusLeft",label:"border.left"},{key:"borderRadiusTopLeft",label:"border.top_left"},{key:"borderRadiusTopRight",label:"border.top_right"},{key:"borderRadiusBottomRight",label:"border.bottom_right"},{key:"borderRadiusBottomLeft",label:"border.bottom_left"}]},{type:"color",label:"border.color",property:"borderColor"},{type:"dropdown",label:"border.style",property:"borderStyle"},{styleType:"accordion",heading:"border.divide_options",items:[{styleType:"multiple",type:"range",label:"border.width",options:[{key:"divideXWidth",label:"border.lr"},{key:"divideYWidth",label:"border.tb"}]},{type:"color",label:"border.divide_color",property:"divideColor"},{type:"dropdown",label:"border.divide_style",property:"divideStyle"}]},{styleType:"accordion",heading:"border.outline_styling",items:[{type:"range",label:"border.outline_width",property:"outlineWidth"},{type:"range",label:"border.outline_offset",property:"outlineOffset"},{type:"dropdown",label:"border.outline_style",property:"outlineStyle"}]},{styleType:"accordion",heading:"border.ring_options",items:[{type:"range",label:"border.ring_width",property:"ringWidth"},{type:"color",label:"border.ring_color",property:"ringColor"},{type:"range",label:"border.ring_offset_width",property:"ringOffsetWidth"},{type:"color",label:"border.ring_offset_color",property:"ringOffsetColor"}]}]},{heading:"effect.heading",items:[{type:"range",label:"effect.shadow",property:"boxShadow"},{type:"color",label:"effect.color",property:"boxShadowColor"},{type:"dropdown",label:"effect.cursor",property:"cursor"},{styleType:"accordion",heading:"effect.blend_cursor",items:[{type:"dropdown",label:"effect.mix_blend",property:"mixBlendMode"},{type:"dropdown",label:"effect.bg_blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"effect.transform",items:[{type:"dropdown",label:"effect.origin",property:"transformOrigin"},{styleType:"multiple",label:"effect.scale",units:["-"],options:[{key:"scale",label:"effect.all"},{key:"scaleX",label:"effect.lr"},{key:"scaleY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.skew",units:["deg"],options:[{key:"skewX",label:"effect.lr"},{key:"skewY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.translate",negative:!0,options:[{key:"translateX",label:"effect.lr"},{key:"translateY",label:"effect.tb"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"effect.rotate",property:"rotate"}]},{styleType:"accordion",heading:"effect.animation",items:[{type:"dropdown",label:"effect.animation",property:"animation"},{type:"dropdown",label:"effect.transition",property:"transition"},{type:"dropdown",label:"effect.easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"effect.duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"effect.delay",property:"delay"}]}]},{heading:"classes.heading",items:[{component:Ae}]}],ye={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:u.EyeOpenIcon,invisible:u.EyeClosedIcon,hidden:u.EyeClosedIcon,gap:u.BorderAllIcon,gapX:u.WidthIcon,gapY:u.HeightIcon,spaceX:u.WidthIcon,spaceY:u.HeightIcon,overscroll:u.BorderAllIcon,overscrollX:u.WidthIcon,overscrollY:u.HeightIcon,overflow:u.BorderAllIcon,overflowX:u.WidthIcon,overflowY:u.HeightIcon,top:u.ArrowUpIcon,right:u.ArrowRightIcon,bottom:u.ArrowDownIcon,left:u.ArrowLeftIcon,inset:u.BorderAllIcon,insetX:u.WidthIcon,insetY:u.HeightIcon,border:u.BorderAllIcon,borderX:u.WidthIcon,borderY:u.HeightIcon,borderTop:u.ArrowUpIcon,borderRight:u.ArrowRightIcon,borderBottom:u.ArrowDownIcon,borderLeft:u.ArrowLeftIcon,borderRadius:u.BorderAllIcon,borderRadiusX:u.WidthIcon,borderRadiusY:u.HeightIcon,borderRadiusTop:u.ArrowUpIcon,borderRadiusRight:u.ArrowRightIcon,borderRadiusBottom:u.ArrowDownIcon,borderRadiusLeft:u.ArrowLeftIcon,borderRadiusTopLeft:u.ArrowTopLeftIcon,borderRadiusTopRight:u.ArrowTopRightIcon,borderRadiusBottomRight:u.ArrowBottomRightIcon,borderRadiusBottomLeft:u.ArrowBottomLeftIcon,divideXWidth:u.WidthIcon,divideYWidth:u.HeightIcon,scale:u.BorderAllIcon,scaleX:u.WidthIcon,scaleY:u.HeightIcon,skewX:u.WidthIcon,skewY:u.HeightIcon,translateX:u.WidthIcon,translateY:u.HeightIcon,padding:u.BorderAllIcon,paddingX:u.WidthIcon,paddingY:u.HeightIcon,paddingTop:u.ArrowUpIcon,paddingRight:u.ArrowRightIcon,paddingBottom:u.ArrowDownIcon,paddingLeft:u.ArrowLeftIcon,margin:u.BorderAllIcon,marginX:u.WidthIcon,marginY:u.HeightIcon,marginTop:u.ArrowUpIcon,marginRight:u.ArrowRightIcon,marginBottom:u.ArrowDownIcon,marginLeft:u.ArrowLeftIcon,textLeft:u.AlignLeftIcon,textCenter:u.AlignCenterHorizontallyIcon,textRight:u.AlignRightIcon,textJustify:u.StretchHorizontallyIcon,italic:u.FontItalicIcon,underline:u.UnderlineIcon,overline:u.OverlineIcon,uppercase:u.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":u.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:u.Cross1Icon},X=m.createContext({canReset:!1,canChange:!0}),Le=({children:s,canReset:o=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(X.Provider,{value:{canReset:o,canChange:r},children:s}),je=({label:s,property:o,onChange:r})=>{const l=m.useMemo(()=>t.get(O.CLASSES_LIST,`${o}.classes`,[""]),[o]),n=Z(o),p=m.useMemo(()=>t.get(n,"cls",""),[n]),{canChange:i}=m.useContext(X),x=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded":"grow",children:x?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(P.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(ne,{rounded:s,onChange:d=>r(d,o),selected:p,options:l,disabled:!i})})};function ne({selected:s,onChange:o,rounded:r=!1,options:l,disabled:n=!1}){const p=s.replace(/.*:/g,"").trim(),{undo:i,redo:x}=C.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||n,className:`${r?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:d=>o(d.target.value),onKeyDown:d=>{d.ctrlKey&&(d.key==="z"&&i(),d.key==="y"&&x())},value:p,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),m.Children.toArray(l.map(d=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:d,children:d})))]})}const qe=({property:s,onChange:o})=>{const{canReset:r,canChange:l}=m.useContext(X),n=Z(s),p=m.useMemo(()=>t.get(n,"cls",""),[n]),i=m.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),x=i.indexOf(p)>-1?i.indexOf(p):0,d=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:d?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:p}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||x-1<0),onClick:()=>o(t.nth(i,x-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!l&&(!r||x-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(je,{label:!1,property:s,onChange:o})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||x+1>=i.length),onClick:()=>o(t.nth(i,x+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!l&&(!r||x+1>=i.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Oe=({property:s,onChange:o})=>{const r=m.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:l}=m.useContext(X),n=Z(s),p=m.useMemo(()=>t.get(n,"cls",""),[n]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,i=>e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!l,onClick:()=>o(i,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${p===i?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:m.createElement(t.get(ye,i,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:t.startCase(t.toLower(i))})]}))})},ze={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},We=({property:s,onChange:o})=>{const r=Z(s),l=m.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:n}=m.useContext(X),[p,i]=m.useState([]),[x,d]=m.useState({color:"",shade:""}),c=l.split("-"),y=t.get(c,"1",""),a=t.get(c,"2",""),h=m.useCallback(g=>{["current","inherit","transparent","black","white"].includes(g)?(i([]),d({color:g})):(i(["50","100","200","300","400","500","600","700","800","900"]),d(R=>({...R,color:g,shade:R.shade?R.shade:"500"})))},[i,d]);m.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(y))return i([]);i(["50","100","200","300","400","500","600","700","800","900"])},[y]);const j=m.useCallback(g=>{d({color:y,shade:g})},[y]);return m.useEffect(()=>{d({color:"",shade:""})},[r]),m.useEffect(()=>{const R=`${t.get(ze,s,"")}-${x.color}${x.shade?`-${x.shade}`:""}`;R.match(new RegExp(t.get(O.CLASSES_LIST,`${s}.regExp`,"")))&&o(R,s)},[x,o,s]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(ne,{disabled:!n,rounded:!0,selected:y,onChange:h,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(ne,{rounded:!0,selected:a,disabled:!y||!n,onChange:j,options:p})})]})},ue=(s,o)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&o.includes(r))return{value:"",unit:r};const l=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;r=r.replace(l,"");const n=s.match(l),p=n&&n.length>1,i=!t.isEmpty(r)&&Number.isNaN(Number(r));return p||i?{error:"Invalid value"}:n&&(n[0]==="auto"||n[0]==="none")?{value:n[0],unit:""}:{value:r,unit:n?n[0]:""}},Fe=s=>{const o=s.startsWith("-")?"-":"",r=s.split("-").pop();if(["auto","none"].includes(r))return{value:"",unit:r};if(r==="px")return{value:"1",unit:"px"};if(r==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(r==="full")return{value:"100",unit:"%"};if(t.includes(s,"skew-"))return{value:`${o}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${o}${r}`,unit:"deg"};if(t.includes(s,"opacity-"))return{value:`${r/100}`,unit:"-"};if(t.includes(s,"duration-")||t.includes(s,"delay-"))return{value:`${r}`,unit:"ms"};if(t.includes(s,"translate-")&&!r.includes("/"))return{value:`${o}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${o}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const l=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[l,n]=t.map(r.split("/"),p=>parseInt(p,10));return{value:o+(l/n*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${o+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}},Ye=s=>{if(t.isEmpty(s))return{value:"",unit:""};const o=s.match(/\[.*\]/g);if(o===null)return Xe(s);const r=t.get(o,"0","").replace(/\[|\]/g,""),l=s.startsWith("-")?"-":"",n=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${l}${n}`,unit:r.replace(n,"")}},Xe=s=>t.isEmpty(s)?{value:"",unit:""}:Fe(s),be=m.createContext({setDragData:()=>{}}),Ze=({unit:s,currentValue:o,onDrag:r,onDragEnd:l,onDragStart:n,negative:p,cssProperty:i})=>{const{setDragData:x}=m.useContext(be);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:d=>{const c={onDrag:r,onDragEnd:l,dragging:!0,dragStartY:d.pageY,dragStartValue:`${o}`,dragUnit:s,negative:p,cssProperty:i};n(c),x(c)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(u.RowSpacingIcon,{})})},Ue=({onSelect:s,current:o,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(l=>e.jsxRuntimeExports.jsx(f.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===l?"primary":void 0,size:"sm",onClick:n=>{n.stopPropagation(),s(l)},children:l},l))}),ce=50,Ge=s=>{const[o,r]=m.useState(!1),[l,n]=m.useState(""),{currentClass:p,onChange:i,classPrefix:x,cssProperty:d,units:c,negative:y}=s,[a,h]=m.useState(d!=null&&d.toLowerCase().includes("width")?"%":c[0]),[j,g]=m.useState(!1),[R,E]=m.useState(""),[B,w]=m.useState(!1),[A,$]=m.useState(!1);m.useEffect(()=>{const{value:b,unit:v}=Ye(p);if(v===""){n(b),h(d!=null&&d.toLowerCase().includes("width")?"%":t.first(c));return}h(v),n(v==="class"||t.isEmpty(b)?"":b)},[p,d,c]);const N=re.useThrottledCallback(b=>i(b),[i],ce),H=re.useThrottledCallback(b=>i(b,!1),[i],ce),q=m.useCallback((b=!1)=>{const v=ue(`${l}`,c);if(t.get(v,"error",!1)){g(!0);return}const T=t.get(v,"unit")!==""?t.get(v,"unit"):a;if(T==="auto"||T==="none"){N(`${x}${T}`);return}if(t.get(v,"value")==="")return;const W=`${t.get(v,"value","").startsWith("-")?"-":""}${x}[${t.get(v,"value","").replace("-","")}${T==="-"?"":T}]`;b?H(W):N(W)},[N,H,l,a,x,c]),z=m.useCallback(b=>{const v=ue(`${l}`,c);if(t.get(v,"error",!1)){g(!0);return}if(b==="auto"||b==="none"){N(`${x}${b}`);return}if(t.get(v,"value")==="")return;const T=t.get(v,"unit")!==""?t.get(v,"unit"):b,W=`${t.get(v,"value","").startsWith("-")?"-":""}${x}[${t.get(v,"value","").replace("-","")}${T==="-"?"":T}]`;N(W)},[N,l,x,c]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:a==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${B?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(a)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:a==="class",onKeyPress:b=>{b.key==="Enter"&&q()},onKeyDown:b=>{if(b.keyCode!==38&&b.keyCode!==40)return;b.preventDefault(),$(!0);const v=t.parseInt(b.target.value);let T=t.isNaN(v)?0:v;b.keyCode===38&&(T+=1),b.keyCode===40&&(T-=1);const L=`${T}`,Re=`${L.startsWith("-")?"-":""}${x}[${L.replace("-","")}${a==="-"?"":a}]`;H(Re)},onKeyUp:b=>{A&&(b.preventDefault(),$(!1))},onBlur:()=>q(),onChange:b=>{g(!1),n(b.target.value)},onClick:b=>{var v;(v=b==null?void 0:b.target)==null||v.select(),r(!1)},value:B?R:l,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",j?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(f.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!o),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${c.length===1?"px-2 font-semibold":""}`,children:a}),c.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(f.TooltipPortal,{children:e.jsxRuntimeExports.jsx(f.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ue,{units:c,current:a,onSelect:b=>{r(!1),h(b),z(b)}})})})]})]}),["none","auto"].indexOf(a)!==-1||B?null:e.jsxRuntimeExports.jsx(Ze,{onDragStart:()=>w(!0),onDragEnd:b=>{if(E(()=>""),w(!1),t.isEmpty(b))return;const v=`${b}`,L=`${v.startsWith("-")?"-":""}${x}[${v.replace("-","")}${a==="-"?"":a}]`;N(L)},onDrag:b=>{if(t.isEmpty(b))return;E(b);const v=`${b}`,L=`${v.startsWith("-")?"-":""}${x}[${v.replace("-","")}${a==="-"?"":a}]`;H(L)},currentValue:l,unit:a,negative:y,cssProperty:d})]})})})},Z=s=>{const o=D.useSelectedBlockCurrentClasses();return t.findLast(o,{property:s})},Ke=(s,o)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[o]},Je={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},xe={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Qe=s=>`${s.toUpperCase()} ${xe[s]?`(${xe[s]} & up)`:""}`,le=s=>{const{t:o}=M.useTranslation(),{type:r="icons",label:l,property:n,onEmitChange:p=()=>{},units:i,negative:x=!1}=s,[d]=ee.useDarkMode(),[c]=D.useStylingState(),[,y]=ee.useCanvasWidth(),a=Z(n),h=D.useAddClassesToBlocks(),j=D.useRemoveClassesFromBlocks(),[g]=C.useSelectedBlockIds(),R=m.useMemo(()=>t.get(a,"fullCls",""),[a]),E=m.useCallback((H,q=!0)=>{const z={dark:d,mq:y,mod:c,cls:H,property:n,fullCls:""};(d||c!=="")&&(z.mq="xs");const b=O.generateFullClsName(z);h(g,[b],q)},[g,d,y,c,n,h]),B=m.useCallback(()=>{j(g,[R])},[g,R,j]),w=m.useMemo(()=>Ke(a,y),[a,y]);m.useEffect(()=>{p(w,a)},[w,p,a]);const[,,A]=ee.useCanvasWidth(),$=m.useCallback(H=>{A({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[H])},[A]),N=t.get(a,"dark",null)===d&&t.get(a,"mod",null)===c&&t.get(a,"mq",null)===y;return e.jsxRuntimeExports.jsx(Le,{canChange:w,canReset:a&&N,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${a&&!N?"text-foreground":""}`,children:o(l)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[r==="arbitrary"?e.jsxRuntimeExports.jsx(Ge,{currentClass:t.get(a,"cls",""),classPrefix:t.get(Je,n,""),units:i||[],onChange:E,negative:x,cssProperty:n}):null,r==="icons"&&e.jsxRuntimeExports.jsx(Oe,{property:n,onChange:E}),r==="range"&&e.jsxRuntimeExports.jsx(qe,{property:n,onChange:E}),r==="color"&&e.jsxRuntimeExports.jsx(We,{property:n,onChange:E}),r==="dropdown"&&e.jsxRuntimeExports.jsx(je,{label:l,property:n,onChange:E})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${R?"visible":"invisible"}`,children:N?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>B(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(u.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):w&&a?e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at  ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[Qe(t.get(a,"mq")),d&&!a.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>$(t.get(a,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(a,"mq").toUpperCase()]})]})})})]}):null})]})]})})},et=["px","%","em","rem","ch","vh","vw"],fe=({label:s,options:o,borderB:r=!1,borderT:l=!1,type:n="arbitrary",units:p=et,negative:i=!1})=>{const{t:x}=M.useTranslation(),[d,c]=m.useState(o[0].key),y=D.useSelectedBlockCurrentClasses(),a=m.useCallback(h=>t.map(y,"property").includes(h),[y]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:x(s)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:m.Children.toArray(o.map(({label:h,key:j})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>c(j),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${j===d?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[m.createElement("div",{className:a(j)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),m.createElement(t.get(ye,j,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:t.startCase(t.toLower(h))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(le,{type:n,units:[...p],label:"",property:d,negative:i})})]})},tt=({heading:s,items:o})=>{const{t:r}=M.useTranslation(),l=D.useSelectedBlockCurrentClasses(),n=m.useMemo(()=>{const p=d=>t.flatten(d.map(c=>c.styleType==="multiple"?t.map(c.options,"key"):c.property)),i=t.flatten(o.map(d=>d.styleType==="accordion"?p(d.items):d.styleType==="multiple"?t.map(d.options,"key"):d.property)),x=t.map(l,"property");return t.intersection(i,x).length>0},[l,o]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[r(s),n?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:o.map(p=>p.styleType==="multiple"?e.jsxRuntimeExports.jsx(fe,{...p},p.label):e.jsxRuntimeExports.jsx(le,{...p},p.label))})]})},st=m.createContext({}),se=({section:s})=>{const{t:o}=M.useTranslation(),r=D.useSelectedBlockCurrentClasses(),l=m.useCallback((i=[])=>{const x={};for(let c=0;c<r.length;c++)x[r[c].property]=r[c].cls;let d=!0;for(const c in i)if(!t.has(x,c)||x[c]!==i[c]){d=!1;break}return d},[r]),n=m.useMemo(()=>{if(r.length>0&&s.heading==="classes.heading")return!0;const i=c=>t.flatten(c.map(y=>y.styleType==="multiple"?t.flatten(t.map(y.options,"key")):y.property)),x=t.flatten(s.items.map(c=>c.styleType==="accordion"?i(c.items):c.styleType==="multiple"?t.flatten(t.map(c.options,"key")):c.property)),d=t.map(r,"property");return t.intersection(x,d).length>0},[r,s.heading,s.items]),p=m.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(st.Provider,{value:p,children:e.jsxRuntimeExports.jsxs(V.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(V.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}),o(s.heading)]})}),e.jsxRuntimeExports.jsx(V.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:m.Children.toArray(s.items.map(i=>t.has(i,"component")?m.createElement(i.component,{key:i.label}):t.has(i,"styleType")?i.styleType==="multiple"?e.jsxRuntimeExports.jsx(fe,{...i},i.label):i.styleType==="accordion"&&l(i==null?void 0:i.conditions)?e.jsxRuntimeExports.jsx(tt,{...i},i.label):null:e.jsxRuntimeExports.jsx(le,{...i},i.label)))})]})})},rt=()=>{const s=C.useSelectedBlock(),[o]=C.useSelectedStylingBlocks(),{t:r}=M.useTranslation(),l=Y.useGlobalStylingPresets(),n=D.useAddClassesToBlocks(),p=Y.getBlockComponent(s._type),i=t.get(t.first(o),"prop"),x=t.get(p.props,`${i}.presets`,{});if(t.isEmpty(l)&&(!t.has(p,"props")||t.isEmpty(x)))return null;const d=c=>{const y=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");n([s._id],y,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(I.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(I.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(f.Button,{variant:"default",className:"w-full",size:"sm",children:[r("Apply Presets"),e.jsxRuntimeExports.jsx(u.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(I.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(ie.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(x)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(I.DropdownMenuLabel,{children:[p.type," ",r("presets")]}),e.jsxRuntimeExports.jsx(I.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(I.DropdownMenuGroup,{children:t.keys(x).map(c=>e.jsxRuntimeExports.jsxs(I.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(x[c]),children:[t.capitalize(t.startCase(r(c))),e.jsxRuntimeExports.jsx(I.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]}),t.isEmpty(l)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(I.DropdownMenuLabel,{children:r("Global presets")}),e.jsxRuntimeExports.jsx(I.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(I.DropdownMenuGroup,{children:t.keys(l).map(c=>e.jsxRuntimeExports.jsxs(I.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(l[c]),children:[t.capitalize(t.startCase(r(c))),e.jsxRuntimeExports.jsx(I.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]})]})})]})})};function ot(){const[s,o]=D.useStylingState(),{flexChild:r,gridChild:l}=C.useSelectedBlocksDisplayChild(),{t:n}=M.useTranslation(),[p]=C.useSelectedStylingBlocks();return t.isEmpty(p)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_styling_block_selected")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(rt,{}),e.jsxRuntimeExports.jsx("div",{className:"flex h-12 flex-col space-x-4 px-4 py-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(ge.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(k.Select,{defaultValue:s,onValueChange:i=>o(i),children:[e.jsxRuntimeExports.jsx(k.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(k.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(k.SelectContent,{children:[e.jsxRuntimeExports.jsx(k.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),s!==""?e.jsxRuntimeExports.jsxs("div",{className:"m-1 flex items-center space-x-1 rounded border border-orange-500 bg-orange-200 p-px px-2 text-xs text-orange-900",children:[e.jsxRuntimeExports.jsx(F.BrushIcon,{className:"w-3"}),e.jsxRuntimeExports.jsx("span",{children:n(`Styles will be applied for (:${s}) state`)})]}):null,e.jsxRuntimeExports.jsx(ie.ScrollArea,{className:"no-scrollbar -mx-1 max-h-full flex-1 overflow-x-hidden overflow-y-hidden border-t border-border",children:e.jsxRuntimeExports.jsxs(V.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(se,{section:Pe}),l?e.jsxRuntimeExports.jsx(se,{section:Me}):null,$e.map(i=>e.jsxRuntimeExports.jsx(se,{section:i},i.heading))]})})]})}const nt=({onAdd:s})=>{const{t:o}=M.useTranslation(),[r,l]=m.useState({key:"",value:""}),n=()=>{t.isEmpty(r.key)||(s({...r,key:t.kebabCase(r.key)}),l({key:"",value:""}))};return e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border-gray-200 px-1",children:[e.jsxRuntimeExports.jsx(P.Input,{name:"key",onChange:p=>l({...r,key:p.target.value}),value:r.key,placeholder:o("Name"),autoComplete:"off",autoCapitalize:"off",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),t.isEmpty(r.key)||n())}}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-1.5",children:e.jsxRuntimeExports.jsx(P.Input,{name:"value",onChange:p=>l({...r,value:p.target.value}),value:r.value,placeholder:o("Value"),autoComplete:"off",autoCapitalize:"off",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),t.isEmpty(r.key)||n())}})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsxs(f.Button,{disabled:t.isEmpty(r.key),onClick:n,size:"sm",className:"flex items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[o("Add")," "]}),e.jsxRuntimeExports.jsx(u.PlusIcon,{})]}),t.isEmpty(r.key)?null:e.jsxRuntimeExports.jsx(f.Button,{variant:"ghost",onClick:()=>l({key:"",value:""}),children:o("Cancel")})]})]})},it=()=>{const s=C.useSelectedBlock(),[o,r]=m.useState([]),[l]=C.useSelectedStylingBlocks(),n=K.useUpdateBlocksPropsRealtime(),p=K.useUpdateBlocksProps(),{t:i}=M.useTranslation(),x=`${t.get(l,"0.prop")}_attrs`;G.useEffect(()=>{const a=t.map(t.get(s,x),(h,j)=>({key:j,value:h}));t.isEmpty(a)?r([]):r(a)},[t.get(s,x)]);const d=a=>{const h=t.filter(o,(j,g)=>a!==g);y(h)},c=a=>{const h=[...o,a];y(h)},y=G.useCallback((a=[])=>{const h={};t.forEach(a,j=>{t.isEmpty(j.key)||t.set(h,j.key,j.value)}),p([t.get(s,"_id")],{[x]:h})},[s,n,x]);return e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("ul",{className:"overflow-hidden rounded-md bg-gray-100 p-2 text-xs text-gray-700",children:[t.isEmpty(o)?e.jsxRuntimeExports.jsx("li",{className:"flex h-16 items-center justify-center",children:e.jsxRuntimeExports.jsx("p",{children:i("No custom attributes added yet")})}):e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("span",{className:"font-bold",children:i("Custom attributes")})}),G.Children.toArray(t.map(o,a=>e.jsxRuntimeExports.jsxs("li",{className:"group flex max-w-full items-center justify-between",children:[e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:1e3,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"w-[90%] cursor-default truncate px-1 hover:bg-gray-200",children:[a.key," ",e.jsxRuntimeExports.jsx("span",{className:"font-bold text-orange-500",children:"="})," ",a.value]})}),e.jsxRuntimeExports.jsxs(f.TooltipContent,{className:"max-w-[200px]",children:[e.jsxRuntimeExports.jsxs("div",{children:[i("Name"),": ",a.key]}),e.jsxRuntimeExports.jsxs("div",{children:[i("Value"),": ",a.value]})]})]}),e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{className:"invisible group-hover:visible",onClick:()=>d(o.indexOf(a)),children:e.jsxRuntimeExports.jsx(F.DeleteIcon,{className:"w-4 text-gray-500"})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{className:"max-w-[200px]",children:i("Remove attribute")})]})]})))]})}),e.jsxRuntimeExports.jsx("div",{className:"py-2"}),e.jsxRuntimeExports.jsx(nt,{onAdd:a=>c(a)})]})})})},lt={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},at=()=>{const s=C.useSelectedBlock(),{t:o}=M.useTranslation(),[r,l]=m.useState(""),[n,p]=m.useState({onDrag:d=>d,onDragEnd:d=>d,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),i=re.useThrottledCallback(d=>{const c=!t.get(n,"negative",!1),y=t.get(n,"cssProperty","");let a=parseFloat(n.dragStartValue);a=t.isNaN(a)?0:a;let h=lt[n.dragUnit];(t.startsWith(y,"scale")||y==="opacity")&&(h=10);let g=(n.dragStartY-d.pageY)/h+a;c&&g<0&&(g=0),y==="opacity"&&g>1&&(g=1),n.onDrag(`${g}`),l(`${g}`)},[n],50),x=m.useCallback(()=>{setTimeout(()=>n.onDragEnd(`${r}`),100),p({onDrag:d=>d,onDragEnd:d=>d,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[n,r,p]);return t.isNull(s)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:o("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(C.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(be.Provider,{value:{setDragData:p},children:[n.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:i,onMouseUp:()=>x(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(S.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1 text-xs",children:[e.jsxRuntimeExports.jsxs(S.TabsList,{className:"mx-1 grid grid-cols-3",children:[e.jsxRuntimeExports.jsx(S.TabsTrigger,{value:"settings",children:o("settings")}),e.jsxRuntimeExports.jsx(S.TabsTrigger,{value:"styling",children:o("styling")}),e.jsxRuntimeExports.jsx(S.TabsTrigger,{value:"attrs",children:o("Attributes")})]}),e.jsxRuntimeExports.jsx(S.TabsContent,{value:"settings",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ie.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden pb-5",children:e.jsxRuntimeExports.jsx(De,{})})}),e.jsxRuntimeExports.jsx(S.TabsContent,{value:"styling",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ot,{})}),e.jsxRuntimeExports.jsx(S.TabsContent,{value:"attrs",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(it,{})})]})]})})};exports.default=at;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),_=require("@radix-ui/react-icons"),r=require("react"),I=require("jotai"),u=require("lodash-es"),c=require("./skeleton-STeL9VrJ.cjs"),n=require("./tabs-_4WbA1cc.cjs"),w=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),b=require("react-i18next"),y=require("lucide-react"),L=require("@chaibuilder/runtime"),j=require("./alert-dialog-P9xMMB6C.cjs"),v=require("./select-7bjg-rr9.cjs"),D=require("./index-rq5Y9ZDy.cjs"),l=require("./STRINGS-gPz7CUOk.cjs"),C=require("./badge-E-S7CqUt.cjs"),P=require("./Functions-Hvon6AMZ.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("./MODIFIERS-o1p3VnpS.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-hotkeys-hook");require("@react-hookz/web");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-select");const O=({provider:s,onClose:a})=>{const{t:o}=b.useTranslation(),[i,f]=r.useState(null);return r.useEffect(()=>{s&&(s.mockFn?s.mockFn:s.dataFn)().then(d=>f(d))},[s]),s?e.jsxRuntimeExports.jsx(n.Dialog,{onOpenChange:p=>p?"":a(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(n.DialogContent,{children:[e.jsxRuntimeExports.jsxs(n.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(n.DialogTitle,{children:[o("data_provider"),": ",s.name]}),e.jsxRuntimeExports.jsx(n.DialogDescription,{children:s.description})]}),e.jsxRuntimeExports.jsx(w.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(D.JsonView,{data:i,shouldExpandNode:D.allExpanded,style:{...D.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function A({children:s,name:a,onRemove:o}){const{t:i}=b.useTranslation();return e.jsxRuntimeExports.jsxs(j.AlertDialog,{children:[e.jsxRuntimeExports.jsx(j.AlertDialogTrigger,{asChild:!0,children:s}),e.jsxRuntimeExports.jsxs(j.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(j.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(j.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:i("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(j.AlertDialogDescription,{children:i("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(j.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(j.AlertDialogCancel,{children:i("cancel")}),e.jsxRuntimeExports.jsx(j.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:i("remove")})]})]})]})}const B=()=>{const{t:s}=b.useTranslation(),a=r.useMemo(()=>L.getChaiDataProviders(),[]),[o,i]=w.usePageDataProviders(),[,f]=I.useAtom(w.builderSaveStateAtom),[p,d]=r.useState(u.filter(a,t=>u.map(o,"providerKey").includes(t.providerKey))),[T,g]=r.useState(""),[N,m]=r.useState(null),k=u.filter(a.map(t=>u.map(p,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!u.isNull(t)),q=t=>{const E=u.find(a,{providerKey:t});d(h=>[...h,E]),i(h=>[...h,{providerKey:E.providerKey,args:{}}]),g(""),f("UNSAVED")},x=t=>{d(E=>u.filter(E,h=>h.providerKey!==t.providerKey)),i(E=>u.filter(E,h=>h.providerKey!==t.providerKey)),f("UNSAVED")},R=t=>m(t);return u.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[s("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:s("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:s("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(v.Select,{value:T,onValueChange:t=>q(t),children:[e.jsxRuntimeExports.jsx(v.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(v.SelectValue,{placeholder:s("select_provider")})}),e.jsxRuntimeExports.jsxs(v.SelectContent,{children:[e.jsxRuntimeExports.jsx(v.SelectItem,{value:"",children:s("choose")}),k.map(t=>e.jsxRuntimeExports.jsx(v.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${p.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[s("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:p.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>R(t),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),s("view_data")]}),e.jsxRuntimeExports.jsx(A,{onRemove:()=>x(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),s("remove")]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(O,{onClose:()=>m(null),provider:N})]})]})},U=()=>{const{t:s}=b.useTranslation(),a={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(n.Dialog,{children:[e.jsxRuntimeExports.jsx(n.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(c.Tooltip,{children:[e.jsxRuntimeExports.jsx(c.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(c.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(_.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(c.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:s("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(n.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(n.DialogHeader,{children:e.jsxRuntimeExports.jsx(n.DialogTitle,{children:s("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(a).map(i=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(C.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:s(i)}),e.jsxRuntimeExports.jsx("div",{children:s(a[i])})]},i))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(i=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(C.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:s(i)}),e.jsxRuntimeExports.jsx("div",{children:s(o[i])})]},i))})]})})]})]})},Y=r.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-a1c-7Ewz.cjs"))),S=r.lazy(()=>Promise.resolve().then(()=>require("./ListTree-CZ-mtjZ9.cjs"))),z=r.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-6rnt0UaA.cjs"))),V=r.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-J1RlG7xG.cjs")));let K=null;const M=()=>{const s=c.useBuilderProp("sideBarComponents.top",[]),a=c.useBuilderProp("sideBarComponents.bottom",[]),[o,i]=I.useAtom(w.activePanelAtom),[f,p]=r.useState(o),[d,T]=r.useState(null),{t:g}=b.useTranslation(),N={"add-blocks":Y,[l.OUTLINE_KEY]:S,"branding-options":z,images:V};u.each(s,({name:x,panel:R})=>{N[x]=R});const m=x=>{clearTimeout(K),o!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?K=setTimeout(()=>i(l.OUTLINE_KEY),500):p(x),i(x)},k=c.useBuilderProp("dataBindingSupport",!1);function q(){const x=setTimeout(()=>{d&&(m(l.OUTLINE_KEY),clearTimeout(d))},500);T(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:q,onClick:()=>m(l.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>{m("add-blocks")},size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(_.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>m(l.OUTLINE_KEY),size:"sm",variant:o===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(y.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>m("branding-options"),size:"sm",variant:o==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(_.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),r.Children.toArray(s.map(({name:x,icon:R})=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(c.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(c.Button,{onClick:()=>m(x),size:"sm",className:"w-10",variant:o===x?"default":"outline",children:e.jsxRuntimeExports.jsx(R,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(U,{}),r.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(c.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(x,{})})))]})]}),o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-full w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:P.cn("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),onMouseEnter:()=>{d&&clearTimeout(d)},children:r.createElement(u.get(N,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:k?e.jsxRuntimeExports.jsxs(n.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(n.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(n.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(y.ListTreeIcon,{className:"mr-2 h-3"})," ",g("Outline")]}),e.jsxRuntimeExports.jsxs(n.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(y.DatabaseIcon,{className:"mr-2 w-3"}),g("Data")]})]}),e.jsxRuntimeExports.jsx(n.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:r.createElement(S)}),e.jsxRuntimeExports.jsx(n.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(B,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(n.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(n.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(n.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(y.ListTreeIcon,{className:"mr-2 h-3"})," ",g("Outline")]})}),e.jsxRuntimeExports.jsx(n.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:r.createElement(S)})]})})})})]})};exports.default=M;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),a=require("react"),l=require("@radix-ui/react-icons"),t=require("./select-7bjg-rr9.cjs"),s=require("./skeleton-STeL9VrJ.cjs"),j=require("./separator-3Civ-6hb.cjs"),o=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),c=require("react-i18next"),d=require("./iconBase-gbUAAO2L.cjs");require("@radix-ui/react-select");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("jotai");require("lodash-es");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-separator");require("./MODIFIERS-o1p3VnpS.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@react-hookz/web");require("@chaibuilder/runtime");const h=()=>s.useBuilderProp("languages",["en"]),E=()=>h().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(t.Select,{children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(l.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(t.SelectContent,{children:e.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[e.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})});function g(i){return d.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(i)}const R=()=>{const{savePage:i,saveState:r}=o.useSavePage(),{t:u}=c.useTranslation(),x=s.useBuilderProp("hideSaveButton",!1),n=a.useMemo(()=>{switch(r){case"SAVING":return"animate-pulse bg-gray-300 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[r]);if(x)return null;const p=e.jsxRuntimeExports.jsxs(s.Button,{disabled:r==="SAVING",onClick:m=>{m.preventDefault(),i()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${n}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(g,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:r==="SAVING"?"Saving...":u(r==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:p})},v=function(){const r=s.useBuilderProp("previewComponent"),[,u]=o.usePreviewMode(),{t:x}=c.useTranslation();return r?e.jsxRuntimeExports.jsxs(s.Button,{onClick:n=>{n.preventDefault(),u(!0)},className:"flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(l.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:x("Preview")})]}):null},f=()=>{const i=s.useBuilderProp("topBarComponents.left",[]),r=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]),x=s.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:a.Children.toArray(i.map(n=>e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:a.Children.toArray(r.map(n=>e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(E,{}),e.jsxRuntimeExports.jsx(v,{}),e.jsxRuntimeExports.jsx(j.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(R,{}):null,a.Children.toArray(u.map(n=>e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=f;
@@ -1,122 +0,0 @@
1
- import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
- import o, { useMemo as h, Suspense as c } from "react";
3
- import { FontFamilyIcon as f, EyeOpenIcon as j } from "@radix-ui/react-icons";
4
- import { S as g, c as v, b as S, d as b, a as N, e as w, f as i } from "./select-POGdEDHT.js";
5
- import { u as a, B as p, S as m } from "./skeleton-lu8e7q2y.js";
6
- import { S as y } from "./separator-SctTn0Qi.js";
7
- import { m as C, g as B } from "./ChaiBuilderEditor-vP4at00I.js";
8
- import { useTranslation as x } from "react-i18next";
9
- import { G as A } from "./iconBase-h4DuR_XT.js";
10
- import "@radix-ui/react-select";
11
- import "./utils-dze1SGvB.js";
12
- import "clsx";
13
- import "tailwind-merge";
14
- import "jotai";
15
- import "lodash-es";
16
- import "@radix-ui/react-slot";
17
- import "class-variance-authority";
18
- import "@radix-ui/react-tooltip";
19
- import "@radix-ui/react-toast";
20
- import "@radix-ui/react-separator";
21
- import "./MODIFIERS-CNqNUapY.js";
22
- import "@radix-ui/react-scroll-area";
23
- import "react-dom";
24
- import "@floating-ui/react-dom";
25
- import "i18next";
26
- import "flagged";
27
- import "./Functions-NzT2Six_.js";
28
- import "react-hotkeys-hook";
29
- import "@react-hookz/web";
30
- import "@chaibuilder/runtime";
31
- const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
32
- /* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
33
- S,
34
- {
35
- placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
36
- /* @__PURE__ */ e.jsx(f, { className: "h-4 w-4" }),
37
- " English(US)"
38
- ] })
39
- }
40
- ) }),
41
- /* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsxs(N, { children: [
42
- /* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
43
- /* @__PURE__ */ e.jsx(i, { value: "apple", children: "Apple" }),
44
- /* @__PURE__ */ e.jsx(i, { value: "banana", children: "Banana" }),
45
- /* @__PURE__ */ e.jsx(i, { value: "blueberry", children: "Blueberry" }),
46
- /* @__PURE__ */ e.jsx(i, { value: "grapes", children: "Grapes" }),
47
- /* @__PURE__ */ e.jsx(i, { value: "pineapple", children: "Pineapple" })
48
- ] }) })
49
- ] }) });
50
- function G(r) {
51
- return A({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z" } }] })(r);
52
- }
53
- const I = () => {
54
- const { savePage: r, saveState: t } = C(), { t: n } = x(), l = a("hideSaveButton", !1), s = h(() => {
55
- switch (t) {
56
- case "SAVING":
57
- return "animate-pulse bg-gray-300 text-gray-900";
58
- case "SAVED":
59
- return "bg-green-500 text-white hover:bg-green-600 hover:text-white";
60
- default:
61
- return "bg-gray-200 text-gray-500 hover:bg-gray-100";
62
- }
63
- }, [t]);
64
- if (l)
65
- return null;
66
- const u = /* @__PURE__ */ e.jsxs(
67
- p,
68
- {
69
- disabled: t === "SAVING",
70
- onClick: (d) => {
71
- d.preventDefault(), r();
72
- },
73
- className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${s}`,
74
- size: "sm",
75
- variant: "outline",
76
- children: [
77
- /* @__PURE__ */ e.jsx(G, { className: "text-lg" }),
78
- /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : n(t === "SAVED" ? "Saved" : "Unsaved") })
79
- ]
80
- }
81
- );
82
- return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
83
- }, V = function() {
84
- const t = a("previewComponent"), [, n] = B(), { t: l } = x();
85
- return t ? /* @__PURE__ */ e.jsxs(
86
- p,
87
- {
88
- onClick: (s) => {
89
- s.preventDefault(), n(!0);
90
- },
91
- className: "flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",
92
- size: "sm",
93
- variant: "outline",
94
- children: [
95
- /* @__PURE__ */ e.jsx(j, { className: "text-xs" }),
96
- /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: l("Preview") })
97
- ]
98
- }
99
- ) : null;
100
- }, ce = () => {
101
- const r = a("topBarComponents.left", []), t = a("topBarComponents.center", []), n = a("topBarComponents.right", []), l = a("editable", !0);
102
- return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
103
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: o.Children.toArray(
104
- r.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
105
- ) }) }),
106
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: o.Children.toArray(
107
- t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
108
- ) }),
109
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
110
- /* @__PURE__ */ e.jsx(k, {}),
111
- /* @__PURE__ */ e.jsx(V, {}),
112
- /* @__PURE__ */ e.jsx(y, { orientation: "vertical" }),
113
- l ? /* @__PURE__ */ e.jsx(I, {}) : null,
114
- o.Children.toArray(
115
- n.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
116
- )
117
- ] })
118
- ] });
119
- };
120
- export {
121
- ce as default
122
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),o=require("react"),l=require("lodash-es"),A=require("@radix-ui/react-icons"),T=require("unsplash-js"),b=require("./skeleton-STeL9VrJ.cjs"),z=require("./command-BxR6jaCI.cjs"),_=require("./scroll-area-FiHvy-TZ.cjs"),g=require("./popover-fKjgcRUx.cjs"),t=require("./select-7bjg-rr9.cjs");require("react-i18next");const D=require("@react-hookz/web"),L=require("lucide-react");require("jotai");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("cmdk");require("./tabs-_4WbA1cc.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("@radix-ui/react-scroll-area");require("@radix-ui/react-popover");require("@radix-ui/react-select");const R=async(d,E)=>new Promise((i,a)=>{T.createApi({accessKey:E}).search.getPhotos(d).then(c=>{i(c)}).catch(c=>a(c))}),V=({isModalView:d,onSelect:E})=>{const i=b.useBuilderProp("unsplashAccessKey",""),[a,f]=o.useState([]),[c,y]=o.useState(0),[x,I]=o.useState(),[u,w]=o.useState(),[P,v]=o.useState(0),[j,C]=D.useDebouncedState("",1e3),[h,m]=o.useState(!1),k=async s=>{if(l.isEmpty(j))return;let n=c+1;s&&(s.preventDefault(),n=1),m(!0),y(n);const p={query:j,page:n};x&&(p.orientation=x),u&&(p.color=u),R(p,i).then(r=>{var q,N,S;f(n===1?((q=r==null?void 0:r.response)==null?void 0:q.results)||[]:[...a,...((N=r==null?void 0:r.response)==null?void 0:N.results)||[]]),v((S=r==null?void 0:r.response)==null?void 0:S.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(j)&&i){m(!0);const s={query:j,page:1};x&&(s.orientation=x),u&&(s.color=u),y(1),R(s,i).then(n=>{var p,r;f(((p=n==null?void 0:n.response)==null?void 0:p.results)||[]),v((r=n==null?void 0:n.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[x,u,j,i]),l.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"underline px-1 hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(z.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>C(s.target.value)}),e.jsxRuntimeExports.jsxs(g.Popover,{children:[e.jsxRuntimeExports.jsx(g.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(A.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(g.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>I(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>w(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(_.ScrollArea,{className:`h-full ${d&&!l.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(a)&&!h&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):a.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(L.Loader,{className:"animate-spin w-6 h-6"}),"  Loading..."]}),!l.isEmpty(a)&&c<P&&!h&&e.jsxRuntimeExports.jsx(b.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>k(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=V;exports.fetchImage=R;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),t=require("react"),i=require("lodash-es"),m=require("@radix-ui/react-icons"),R=require("jotai"),q=require("./scroll-area-FiHvy-TZ.cjs");require("react-i18next");const E=require("./skeleton-STeL9VrJ.cjs");require("@radix-ui/react-scroll-area");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const I=R.atom([]),w=({isModalView:r,onSelect:a})=>{const p=E.useBuilderProp("uploadMediaCallback"),u=E.useBuilderProp("fetchMediaCallback"),[n,c]=R.useAtom(I),[o,j]=t.useState(!1),[f,h]=t.useState(!1),[x,d]=t.useState(),[g,v]=t.useState("");t.useEffect(()=>{(async()=>{if(!u)return;h(!0);const s=await u();c(s||[]),h(!1)})()},[]);const y=s=>{var l,b;s&&((b=(l=s==null?void 0:s.target)==null?void 0:l.files)==null?void 0:b.length)>0&&d(s.target.files[0])},N=async()=>{if(p){j(!0);try{const{url:s}=await p(x);a(s),d(void 0);const l=await u();c(l)}catch(s){c([]),v((s==null?void 0:s.message)||"Something went wrong.")}j(!1)}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(x),alt:"",className:"h-auto max-h-96 w-full max-w-sm rounded-md object-contain"}),g&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:g}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:N,disabled:o,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[o?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"}),"  ",o?"Uploading...":"Upload"]}),!o&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{}),"  Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:r?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:r?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:y})]}),e.jsxRuntimeExports.jsxs(q.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[i.isEmpty(n)&&f&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),i.isEmpty(n)&&!f&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),r?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:i.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):i.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=w;
@@ -1,42 +0,0 @@
1
- import { j as a } from "./jsx-runtime-Sp0orL4X.js";
2
- import * as n from "react";
3
- import * as e from "@radix-ui/react-accordion";
4
- import { ChevronDownIcon as c } from "@radix-ui/react-icons";
5
- import { c as i } from "./utils-dze1SGvB.js";
6
- const N = e.Root, m = n.forwardRef(({ className: o, ...t }, r) => /* @__PURE__ */ a.jsx(e.Item, { ref: r, className: i("border-b", o), ...t }));
7
- m.displayName = "AccordionItem";
8
- const d = n.forwardRef(({ className: o, children: t, ...r }, s) => /* @__PURE__ */ a.jsx(e.Header, { className: "flex", children: /* @__PURE__ */ a.jsxs(
9
- e.Trigger,
10
- {
11
- ref: s,
12
- className: i(
13
- "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
14
- o
15
- ),
16
- ...r,
17
- children: [
18
- t,
19
- /* @__PURE__ */ a.jsx(c, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" })
20
- ]
21
- }
22
- ) }));
23
- d.displayName = e.Trigger.displayName;
24
- const l = n.forwardRef(({ className: o, children: t, ...r }, s) => /* @__PURE__ */ a.jsx(
25
- e.Content,
26
- {
27
- ref: s,
28
- className: i(
29
- "text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
30
- o
31
- ),
32
- ...r,
33
- children: /* @__PURE__ */ a.jsx("div", { className: "pb-4 pt-0", children: t })
34
- }
35
- ));
36
- l.displayName = e.Content.displayName;
37
- export {
38
- N as A,
39
- m as a,
40
- d as b,
41
- l as c
42
- };
@@ -1 +0,0 @@
1
- "use strict";const s=require("./jsx-runtime-JYMCiFoE.cjs"),u=require("react"),x=require("@radix-ui/react-accordion"),p=require("@radix-ui/react-icons"),c=require("./utils-qK_SjzzV.cjs");function a(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const i=a(u),o=a(x),f=o.Root,d=i.forwardRef(({className:e,...n},t)=>s.jsxRuntimeExports.jsx(o.Item,{ref:t,className:c.cn("border-b",e),...n}));d.displayName="AccordionItem";const m=i.forwardRef(({className:e,children:n,...t},r)=>s.jsxRuntimeExports.jsx(o.Header,{className:"flex",children:s.jsxRuntimeExports.jsxs(o.Trigger,{ref:r,className:c.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...t,children:[n,s.jsxRuntimeExports.jsx(p.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));m.displayName=o.Trigger.displayName;const l=i.forwardRef(({className:e,children:n,...t},r)=>s.jsxRuntimeExports.jsx(o.Content,{ref:r,className:c.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...t,children:s.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:n})}));l.displayName=o.Content.displayName;exports.Accordion=f;exports.AccordionContent=l;exports.AccordionItem=d;exports.AccordionTrigger=m;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),g=require("react"),R=require("lodash-es"),x=require("./skeleton-STeL9VrJ.cjs"),a=require("./tabs-_4WbA1cc.cjs"),c=require("./controls-L7DPvB0m.cjs"),b=require("./form-W58AVUdf.cjs"),f=require("./index-9MmykVSc.cjs");require("jotai");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-WbcKdQ9k.cjs");require("react-icons-picker");require("react-dom");require("./ImagesPanel-J1RlG7xG.cjs");require("react-quill");require("react-i18next");require("./ChaiBuilderEditor-m30yoOgJ.cjs");require("./MODIFIERS-o1p3VnpS.cjs");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@react-hookz/web");require("@chaibuilder/runtime");require("sonner");require("./html-to-json-uSnxl72F.cjs");require("himalaya");require("./STRINGS-gPz7CUOk.cjs");require("lucide-react");require("./iconBase-gbUAAO2L.cjs");require("./alert-dialog-P9xMMB6C.cjs");require("@radix-ui/react-alert-dialog");const E=({closeModal:s})=>{var l,o;const t=f.useAddPage(),[r,m]=g.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{},template:""}),p=()=>{t.mutate(r,{onSuccess:()=>s()})},j=({formData:u},i)=>{m(P=>{var d,q;const n={[i]:u[i]};return i==="name"?n.slug=R.kebabCase((d=u[i])==null?void 0:d.replace(/\d/g,"")):i==="slug"&&(n.slug=(q=u[i])==null?void 0:q.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...P,...n}})},h={name:c.u({title:"Page Name",default:r.name}),slug:c.u({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(a.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(b.Form,{formData:r,properties:h,onChange:j,disabled:t.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(x.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((o=r.slug)==null?void 0:o.length)<2||t.isPending,onClick:p,children:"Add Page"})})]})},C=()=>{const[s,t]=g.useState(!1);return e.jsxRuntimeExports.jsxs(a.Dialog,{open:s,onOpenChange:()=>t(!s),children:[e.jsxRuntimeExports.jsx(a.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(x.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>t(!s),children:"+ New Page"})}),s&&e.jsxRuntimeExports.jsx(E,{closeModal:()=>t(!s)})]})};exports.default=C;
@@ -1,95 +0,0 @@
1
- import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
- import { useState as g } from "react";
3
- import { kebabCase as j } from "lodash-es";
4
- import { B as c } from "./skeleton-lu8e7q2y.js";
5
- import { D as b, a as C, b as A } from "./tabs-yQ3oGziM.js";
6
- import { u as d } from "./controls-IS5qnRce.js";
7
- import { F as D } from "./form-0_RLz2TB.js";
8
- import { e as N } from "./index-hElOGcFr.js";
9
- import "jotai";
10
- import "@radix-ui/react-slot";
11
- import "class-variance-authority";
12
- import "./utils-dze1SGvB.js";
13
- import "clsx";
14
- import "tailwind-merge";
15
- import "@radix-ui/react-tooltip";
16
- import "@radix-ui/react-icons";
17
- import "@radix-ui/react-toast";
18
- import "@radix-ui/react-dialog";
19
- import "@radix-ui/react-tabs";
20
- import "@rjsf/core";
21
- import "@rjsf/validator-ajv8";
22
- import "./link-xuhP-4dN.js";
23
- import "react-icons-picker";
24
- import "react-dom";
25
- import "./ImagesPanel-Wb0GF_NA.js";
26
- import "react-quill";
27
- import "react-i18next";
28
- import "./ChaiBuilderEditor-vP4at00I.js";
29
- import "./MODIFIERS-CNqNUapY.js";
30
- import "@radix-ui/react-scroll-area";
31
- import "@floating-ui/react-dom";
32
- import "i18next";
33
- import "flagged";
34
- import "./Functions-NzT2Six_.js";
35
- import "react-hotkeys-hook";
36
- import "@react-hookz/web";
37
- import "@chaibuilder/runtime";
38
- import "sonner";
39
- import "./html-to-json-2xtb7520.js";
40
- import "himalaya";
41
- import "./STRINGS-b432aBJJ.js";
42
- import "lucide-react";
43
- import "./iconBase-h4DuR_XT.js";
44
- import "./alert-dialog-rypfO5ly.js";
45
- import "@radix-ui/react-alert-dialog";
46
- const S = ({ closeModal: o }) => {
47
- var s, p;
48
- const i = N(), [e, u] = g({
49
- name: "",
50
- slug: "",
51
- blocks: [],
52
- type: "STATIC",
53
- seoData: {},
54
- template: ""
55
- }), f = () => {
56
- i.mutate(e, { onSuccess: () => o() });
57
- }, x = ({ formData: a }, r) => {
58
- u((P) => {
59
- var n, l;
60
- const m = { [r]: a[r] };
61
- return r === "name" ? m.slug = j((n = a[r]) == null ? void 0 : n.replace(/\d/g, "")) : r === "slug" && (m.slug = (l = a[r]) == null ? void 0 : l.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_")), {
62
- ...P,
63
- ...m
64
- };
65
- });
66
- }, h = {
67
- name: d({
68
- title: "Page Name",
69
- default: e.name
70
- }),
71
- slug: d({ title: "Page Slug", default: e.slug })
72
- };
73
- return /* @__PURE__ */ t.jsxs(A, { children: [
74
- /* @__PURE__ */ t.jsx("div", { className: "px-1 font-bold", children: "Add Page" }),
75
- /* @__PURE__ */ t.jsx(D, { formData: e, properties: h, onChange: x, disabled: i.isPending }),
76
- /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ t.jsx(
77
- c,
78
- {
79
- type: "submit",
80
- disabled: !e.name || !e.slug || ((s = e.name) == null ? void 0 : s.length) < 2 || ((p = e.slug) == null ? void 0 : p.length) < 2 || i.isPending,
81
- onClick: f,
82
- children: "Add Page"
83
- }
84
- ) })
85
- ] });
86
- }, ht = () => {
87
- const [o, i] = g(!1);
88
- return /* @__PURE__ */ t.jsxs(b, { open: o, onOpenChange: () => i(!o), children: [
89
- /* @__PURE__ */ t.jsx(C, { asChild: !0, children: /* @__PURE__ */ t.jsx(c, { size: "sm", variant: "link", className: "text-blue-500", onClick: () => i(!o), children: "+ New Page" }) }),
90
- o && /* @__PURE__ */ t.jsx(S, { closeModal: () => i(!o) })
91
- ] });
92
- };
93
- export {
94
- ht as default
95
- };
@@ -1 +0,0 @@
1
- "use strict";const o=require("./jsx-runtime-JYMCiFoE.cjs"),A=require("react"),N=require("@radix-ui/react-alert-dialog"),l=require("./utils-qK_SjzzV.cjs"),n=require("./skeleton-STeL9VrJ.cjs");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const i=c(A),s=c(N),y=s.Root,R=s.Trigger,d=({className:e,...t})=>o.jsxRuntimeExports.jsx(s.Portal,{className:l.cn(e),...t});d.displayName=s.Portal.displayName;const m=i.forwardRef(({className:e,...t},a)=>o.jsxRuntimeExports.jsx(s.Overlay,{className:l.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:a}));m.displayName=s.Overlay.displayName;const p=i.forwardRef(({className:e,...t},a)=>o.jsxRuntimeExports.jsxs(d,{children:[o.jsxRuntimeExports.jsx(m,{}),o.jsxRuntimeExports.jsx(s.Content,{ref:a,className:l.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...t})]}));p.displayName=s.Content.displayName;const u=({className:e,...t})=>o.jsxRuntimeExports.jsx("div",{className:l.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});u.displayName="AlertDialogHeader";const x=({className:e,...t})=>o.jsxRuntimeExports.jsx("div",{className:l.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});x.displayName="AlertDialogFooter";const g=i.forwardRef(({className:e,...t},a)=>o.jsxRuntimeExports.jsx(s.Title,{ref:a,className:l.cn("text-lg font-semibold",e),...t}));g.displayName=s.Title.displayName;const f=i.forwardRef(({className:e,...t},a)=>o.jsxRuntimeExports.jsx(s.Description,{ref:a,className:l.cn("text-sm text-muted-foreground",e),...t}));f.displayName=s.Description.displayName;const D=i.forwardRef(({className:e,...t},a)=>o.jsxRuntimeExports.jsx(s.Action,{ref:a,className:l.cn(n.buttonVariants(),e),...t}));D.displayName=s.Action.displayName;const j=i.forwardRef(({className:e,...t},a)=>o.jsxRuntimeExports.jsx(s.Cancel,{ref:a,className:l.cn(n.buttonVariants({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));j.displayName=s.Cancel.displayName;exports.AlertDialog=y;exports.AlertDialogAction=D;exports.AlertDialogCancel=j;exports.AlertDialogContent=p;exports.AlertDialogDescription=f;exports.AlertDialogFooter=x;exports.AlertDialogHeader=u;exports.AlertDialogTitle=g;exports.AlertDialogTrigger=R;