@chaibuilder/sdk 1.2.20 → 1.2.22

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 (63) hide show
  1. package/dist/{AddBlocks-X9eh8OWJ.cjs → AddBlocks-157fSrJX.cjs} +1 -1
  2. package/dist/{AddBlocks-VIWJkaHJ.js → AddBlocks-WgpssWmQ.js} +2 -2
  3. package/dist/{BrandingOptions-5ss0k1nb.js → BrandingOptions-4961TxX2.js} +2 -2
  4. package/dist/{BrandingOptions-PzPdafIT.cjs → BrandingOptions-nwXR9TMl.cjs} +1 -1
  5. package/dist/{CanvasArea-TTGqlBKO.js → CanvasArea-MajWGr9z.js} +3 -3
  6. package/dist/{CanvasArea-hoyr4dfb.cjs → CanvasArea-MmTlc5Vb.cjs} +1 -1
  7. package/dist/{CurrentPage-EddxgHU-.cjs → CurrentPage-LpLr0lDI.cjs} +1 -1
  8. package/dist/{CurrentPage-a3T2uy8Q.js → CurrentPage-oPZN6Gwj.js} +3 -3
  9. package/dist/ListTree-dvxHTXs4.js +167 -0
  10. package/dist/ListTree-gTmusfso.cjs +1 -0
  11. package/dist/{Outline-rNFJGkap.js → Outline-2OxsXs1-.js} +3 -3
  12. package/dist/{Outline-3IHYlOzF.cjs → Outline-7CCnnzmK.cjs} +1 -1
  13. package/dist/{PagesPanel-B33hWN11.cjs → PagesPanel-8536oBWB.cjs} +1 -1
  14. package/dist/{PagesPanel-0bL28ofN.js → PagesPanel-pRKHw-AZ.js} +4 -4
  15. package/dist/{ProjectPanel-sBRkUXnY.js → ProjectPanel-iU6DY-Yp.js} +4 -4
  16. package/dist/{ProjectPanel-qtRTXNOP.cjs → ProjectPanel-oILsUWOH.cjs} +1 -1
  17. package/dist/{Settings-HgGe1ANj.js → Settings-BhSrj-cE.js} +552 -532
  18. package/dist/Settings-jHiYmt0y.cjs +1 -0
  19. package/dist/{SidePanels-R_g9rSjP.js → SidePanels-OLOUpKn4.js} +45 -45
  20. package/dist/{SidePanels-aAm-2A3s.cjs → SidePanels-bcJJocSq.cjs} +1 -1
  21. package/dist/{Topbar-cXtxVswU.cjs → Topbar-NMvzqQHW.cjs} +1 -1
  22. package/dist/{Topbar-AUTKpVHO.js → Topbar-Ny9T-7Zb.js} +1 -1
  23. package/dist/{UnsplashImages-p34UJJWJ.cjs → UnsplashImages-6tZv1q2_.cjs} +1 -1
  24. package/dist/{UnsplashImages-1RFHZIte.js → UnsplashImages-Y8RGFVSh.js} +1 -1
  25. package/dist/{UploadImages-CLfyNo1i.cjs → UploadImages-VLlVg9Ur.cjs} +1 -1
  26. package/dist/{UploadImages-G2orrhmZ.js → UploadImages-dd8LfyFr.js} +1 -1
  27. package/dist/{add-page-modal-KCy_Khfe.cjs → add-page-modal-IsqDdK7X.cjs} +1 -1
  28. package/dist/{add-page-modal-DUthvJNJ.js → add-page-modal-Jni6CY1x.js} +4 -4
  29. package/dist/{confirm-alert-T8vimDRx.cjs → confirm-alert-f26zJ7Js.cjs} +1 -1
  30. package/dist/{confirm-alert-nk2WQHud.js → confirm-alert-sc8RaWvD.js} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.js +2 -2
  33. package/dist/{delete-page-modal-WvWRQUgU.js → delete-page-modal-0WiMZFxr.js} +3 -3
  34. package/dist/{delete-page-modal-_pFjWLJn.cjs → delete-page-modal-c3b-GCap.cjs} +1 -1
  35. package/dist/email.cjs +1 -1
  36. package/dist/email.js +2 -2
  37. package/dist/{form-kXQX4L2W.js → form-Nj6Kdn3g.js} +1 -1
  38. package/dist/{form-YnnWtUGk.cjs → form-n1Q6u16z.cjs} +1 -1
  39. package/dist/{index-e5cgISUO.cjs → index-0bwkNnA0.cjs} +2 -2
  40. package/dist/index-9PHdn80L.cjs +1 -0
  41. package/dist/{index-la4rqGKN.js → index-IPJAbzzO.js} +965 -928
  42. package/dist/{index-QIbDWoML.js → index-UP_4awU9.js} +2 -2
  43. package/dist/{index--Pt4B5bv.js → index-_VPpjzJu.js} +3 -3
  44. package/dist/{index-JqRQZLN5.cjs → index-nwAgi0aD.cjs} +1 -1
  45. package/dist/{page-viewer-s_lHBVfx.js → page-viewer-L1Dmgj-c.js} +4 -4
  46. package/dist/{page-viewer-6phtctz6.cjs → page-viewer-TnxHhq7S.cjs} +1 -1
  47. package/dist/{project-general-setting-SaNOMXEl.cjs → project-general-setting-1Ot1RU43.cjs} +1 -1
  48. package/dist/{project-general-setting-gj4A0X5W.js → project-general-setting-sUP7JqWK.js} +4 -4
  49. package/dist/{project-seo-setting-bMDdgKRZ.cjs → project-seo-setting-3-vBkx2v.cjs} +1 -1
  50. package/dist/{project-seo-setting-aCPg-IIc.js → project-seo-setting-NNvAGt4T.js} +2 -2
  51. package/dist/{single-page-detail-TP-cxVIT.js → single-page-detail-FXg_NebW.js} +5 -5
  52. package/dist/{single-page-detail-er8i2FIF.cjs → single-page-detail-btEKYXjE.cjs} +1 -1
  53. package/dist/studio.cjs +1 -1
  54. package/dist/studio.js +3 -3
  55. package/dist/ui.cjs +1 -1
  56. package/dist/ui.js +1 -1
  57. package/dist/{useAddBlockByDrop-_vczk5o_.js → useAddBlockByDrop-V8xo-PNQ.js} +1 -1
  58. package/dist/{useAddBlockByDrop-LSV8adwE.cjs → useAddBlockByDrop-qRHgy8_0.cjs} +1 -1
  59. package/package.json +24 -25
  60. package/dist/ListTree-kergCZrw.js +0 -126
  61. package/dist/ListTree-tADrgsqZ.cjs +0 -1
  62. package/dist/Settings-rXxS3RGM.cjs +0 -1
  63. package/dist/index-DeHH1q_1.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("react"),Z=require("@react-hookz/web"),t=require("lodash-es"),A=require("react-i18next"),d=require("@radix-ui/react-icons"),o=require("./index-9PHdn80L.cjs"),pe=require("./controls-KK2oLIa8.cjs"),W=require("lucide-react"),$=require("@chaibuilder/runtime"),F=require("./index-0bwkNnA0.cjs"),z=require("./index-gi1LIOCw.cjs"),ue=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),ce=require("react-autosuggest"),xe=require("fuse.js"),D=require("./Class-MmCxz2Ay.cjs"),me=require("./MODIFIERS-9EwxLM8V.cjs"),N=require("lodash");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("jotai");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");function ge(s){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(i,r,n.get?n:{enumerable:!0,get:()=>s[r]})}}return i.default=s,Object.freeze(i)}const O=ge(g);function he(s){const i=[],r={};function n(l,u){t.forEach(u,(a,m)=>{const p=l?`${l}.${m}`:m,c=t.isArray(a)?"list":typeof a;i.push(p),r[p]=c==="string"?"text":c==="object"?"model":c,c==="object"&&!t.isArray(a)&&n(p,a)})}return n("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:i,pathsType:r}}const U=({data:s,fullView:i})=>{if(!s)return null;const r=typeof s;return i?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(z.JsonView,{data:s,shouldExpandNode:z.allExpanded,style:{...z.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})})},J=({type:s,value:i="",setValue:r,data:n,onChange:l,dataType:u,appliedBindings:a})=>{const{paths:m,pathsType:p}=he(n),c=s==="PROP"?$.getBlockComponent(n==null?void 0:n._type):{},b=s==="PROP",[x,f]=g.useState(!1),y=g.useMemo(()=>s==="PROP"?m.filter(h=>!t.includes(a,h)&&t.get(c,`props.${t.first(t.split(h,"."))}.binding`)):m.filter(h=>u===t.get(p,h,"")),[s,m,a,u,c]);return g.useEffect(()=>{i&&l(i)},[i,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(o.Popover,{open:x,onOpenChange:f,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(i)?"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:i?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[b&&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(u)}),i]}),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(o.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(s)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(y,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${b?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:v=>{r(t.find(y,E=>E===v)||null),f(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(W.Check,{className:`h-4 w-4 text-green-500 ${i===h?"":"opacity-0"}`}),h]}),b?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(p,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(U,{data:t.get(n,h)})})]},h))})]})]})})]})]}),!b&&!t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(U,{data:t.get(n,i,""),fullView:!0})})]})},ye=({appliedBindings:s=[],onAddBinding:i,editMode:r,item:n})=>{const[l,u]=g.useState(r?n.key:""),[a,m]=g.useState(r?n.value:""),p=o.useSelectedBlock(),[c]=F.useChaiExternalData(),b=g.useCallback((y,h)=>{if(t.isEmpty(y))return"";{const v=t.get(h==="PROP"?p:c,y,"");if(t.isArray(v))return"list";const E=typeof v;return E==="string"?"text":E==="object"?"model":E}},[p,c]),[x,f]=g.useState(r?b(n.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.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(J,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:l,setValue:u,onChange:y=>{const h=b(y,"PROP");u(y),x!==h&&m(""),f(h)},data:p,dataType:x,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(J,{type:"PATH",isDisabled:t.isEmpty(l),placeholder:"Enter data path",value:a,setValue:m,onChange:y=>{const h=b(y,"PATH");m(x===h?y:"")},data:c,dataType:x,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(l)&&t.isEmpty(a),onClick:()=>i({key:l,value:a}),children:"Save"})})]})},re=({disabled:s,children:i,onAddBinding:r,appliedBindings:n,editMode:l=!0,item:u={}})=>{const[a,m]=g.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>m(!0),children:i}),a&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(ye,{item:u,editMode:l,appliedBindings:n,onAddBinding:p=>{r(p),m(!1)}})})]})},be=({item:s,onAddBinding:i,onRemove:r,selectedBlock:n,dataProvider:l,appliedBindings:u})=>{const[a,m]=g.useState("string"),p=(c,b)=>{if(t.isEmpty(c))return"";{const x=t.get(b==="PROP"?n:l,c,"");if(t.isArray(x))return"list";const f=typeof x;return f==="string"?"text":f==="object"?"model":f}};return g.useEffect(()=>m(()=>p(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(U,{data:t.get(l,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(re,{editMode:!0,onAddBinding:i,appliedBindings:u,item:s,children:e.jsxRuntimeExports.jsx(W.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(W.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(a)&&!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(a)})]})},fe=({bindingData:s,onChange:i})=>{const r=o.useSelectedBlock(),[n]=F.useChaiExternalData(),l=$.getChaiDataProviders(),[u,a]=g.useState(t.map(s,(x,f)=>({key:f,value:x})));g.useEffect(()=>{a(t.map(s,(x,f)=>({key:f,value:x})))},[r==null?void 0:r._id,s]);const m=g.useMemo(()=>{if(t.isEmpty(n))return!0;if(t.isEmpty(u))return!1;const x=t.last(u);return t.isEmpty(x==null?void 0:x.key)||t.isEmpty(x==null?void 0:x.value)},[n,u]),p=x=>{const f=t.filter(u,y=>y.key!==x.key);a([...f,x]),b([...f,x])},c=x=>{const f=t.filter(u,(y,h)=>x!==h);b([...f])},b=g.useCallback((x=[])=>{if(a(x),t.isEmpty(x)){i({});return}const f={};t.forEach(x,y=>{!t.isEmpty(y==null?void 0:y.key)&&!t.isEmpty(y==null?void 0:y.value)&&t.set(f,y.key,y.value)}),i(f)},[i]);return t.isEmpty(l)?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(u,(x,f)=>e.jsxRuntimeExports.jsx(be,{item:x,onAddBinding:p,onRemove:()=>c(f),selectedBlock:r,dataProvider:n,appliedBindings:t.map(u,"key")},x.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(n),className:"w-full",children:e.jsxRuntimeExports.jsx(re,{disabled:m,appliedBindings:t.map(u,"key"),onAddBinding:p,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${m?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(n)?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"})})}),m&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(n)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},je=()=>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"}),Y=g.memo(({id:s,properties:i,formData:r,onChange:n})=>{const[l,u]=g.useState(r),a={type:"object",properties:{}},m={};return Object.keys(i).forEach(p=>{const c=i[p];if(t.includes(["slot","styles"],c.type))return;const b=p;a.properties[b]=o.getBlockJSONFromSchemas(c),m[b]=o.getBlockJSONFromUISchemas(c)}),g.useEffect(()=>{u(r)},[s]),e.jsxRuntimeExports.jsx(ue,{widgets:{binding:je,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:de,uiSchema:m,schema:a,formData:l,onChange:({formData:p},c)=>{c&&(u(p),n({formData:p},c))}})});function ve(){const s=o.useSelectedBlock(),i=o.useUpdateBlocksPropsRealtime(),r=o.useUpdateBlocksProps(),n=$.getBlockComponent(s._type),l={...s},[u,a]=g.useState(l),m=o.useBuilderProp("dataBindingSupport",!1),p=({formData:h},v,E)=>{if(v&&(u==null?void 0:u._id)===s._id){const T=v.replace("root.","");r([s._id],{[T]:t.get(h,T)},E)}},c=g.useCallback(t.debounce(({formData:h},v,E)=>{p({formData:h},v,E),a(h)},1500),[s==null?void 0:s._id]),b=({formData:h},v)=>{if(v){const E=v.replace("root.","");i([s._id],{[E]:t.get(h,E)}),c({formData:h},v,{[E]:t.get(u,E)})}},x={_name:pe.u({title:"Name",default:t.get(s,"_name",s._type)})},f=t.keys(t.get(l,"_bindings",{})),y=g.useMemo(()=>{const h=t.cloneDeep(t.get(n,"props",{}));return m&&t.each(f,v=>delete h[v]),h},[n,f,m]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(Y,{id:s==null?void 0:s._id,onChange:b,formData:l,properties:x}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),m?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.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(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(fe,{bindingData:t.get(s,"_bindings",{}),onChange:h=>{p({formData:{_bindings:h}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.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(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(f)?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(f,t.capitalize).join(", ")})," ",f.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(Y,{id:s==null?void 0:s._id,onChange:b,formData:l,properties:y})]})]})]}):e.jsxRuntimeExports.jsx(Y,{id:s==null?void 0:s._id,onChange:b,formData:l,properties:y}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const Q=new xe(D.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Re(){var T;const[s]=o.useSelectedStylingBlocks(),i=o.useSelectedBlock(),r=o.useAddClassesToBlocks(),n=o.useRemoveClassesFromBlocks(),[l]=o.useSelectedBlockIds(),[u,a]=g.useState(""),m=(T=t.first(s))==null?void 0:T.prop,p=t.reject((t.get(i,m,"").replace(me.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),c=()=>{const w=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(l,w,!0),a("")},[b,x]=g.useState([]),f=({value:w})=>{const _=w.trim().toLowerCase(),H=_.match(/.+:/g);let C=[];if(H&&H.length>0){const[I]=H,B=_.replace(I,"");C=Q.search(B).map(j=>({...j,item:{...j.item,name:I+j.item.name}}))}else C=Q.search(_);x(t.map(C,"item"))},y=()=>{x([])},h=w=>w.name,v=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:u,onKeyDown:w=>{w.key==="Enter"&&u.trim()!==""&&c()},onChange:(w,{newValue:_})=>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 ${b.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(o.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:b,onSuggestionsFetchRequested:f,onSuggestionsClearRequested:y,getSuggestionValue:h,renderSuggestion:v,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(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:c,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(p)&&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"}),O.Children.toArray(p.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(d.Cross2Icon,{onClick:()=>n(l,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const S=["px","%","em","rem","ch","vh","vw"],Ee={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:S,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"}]},we={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"}]},Ce=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:S.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:S.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...S,"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:S.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:S.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:S.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:S.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:S},{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:S},{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:S},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:S.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:Re}]}],oe={"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:d.EyeOpenIcon,invisible:d.EyeClosedIcon,hidden:d.EyeClosedIcon,gap:d.BorderAllIcon,gapX:d.WidthIcon,gapY:d.HeightIcon,spaceX:d.WidthIcon,spaceY:d.HeightIcon,overscroll:d.BorderAllIcon,overscrollX:d.WidthIcon,overscrollY:d.HeightIcon,overflow:d.BorderAllIcon,overflowX:d.WidthIcon,overflowY:d.HeightIcon,top:d.ArrowUpIcon,right:d.ArrowRightIcon,bottom:d.ArrowDownIcon,left:d.ArrowLeftIcon,inset:d.BorderAllIcon,insetX:d.WidthIcon,insetY:d.HeightIcon,border:d.BorderAllIcon,borderX:d.WidthIcon,borderY:d.HeightIcon,borderTop:d.ArrowUpIcon,borderRight:d.ArrowRightIcon,borderBottom:d.ArrowDownIcon,borderLeft:d.ArrowLeftIcon,borderRadius:d.BorderAllIcon,borderRadiusX:d.WidthIcon,borderRadiusY:d.HeightIcon,borderRadiusTop:d.ArrowUpIcon,borderRadiusRight:d.ArrowRightIcon,borderRadiusBottom:d.ArrowDownIcon,borderRadiusLeft:d.ArrowLeftIcon,borderRadiusTopLeft:d.ArrowTopLeftIcon,borderRadiusTopRight:d.ArrowTopRightIcon,borderRadiusBottomRight:d.ArrowBottomRightIcon,borderRadiusBottomLeft:d.ArrowBottomLeftIcon,divideXWidth:d.WidthIcon,divideYWidth:d.HeightIcon,scale:d.BorderAllIcon,scaleX:d.WidthIcon,scaleY:d.HeightIcon,skewX:d.WidthIcon,skewY:d.HeightIcon,translateX:d.WidthIcon,translateY:d.HeightIcon,padding:d.BorderAllIcon,paddingX:d.WidthIcon,paddingY:d.HeightIcon,paddingTop:d.ArrowUpIcon,paddingRight:d.ArrowRightIcon,paddingBottom:d.ArrowDownIcon,paddingLeft:d.ArrowLeftIcon,margin:d.BorderAllIcon,marginX:d.WidthIcon,marginY:d.HeightIcon,marginTop:d.ArrowUpIcon,marginRight:d.ArrowRightIcon,marginBottom:d.ArrowDownIcon,marginLeft:d.ArrowLeftIcon,textLeft:d.AlignLeftIcon,textCenter:d.AlignCenterHorizontallyIcon,textRight:d.AlignRightIcon,textJustify:d.StretchHorizontallyIcon,italic:d.FontItalicIcon,underline:d.UnderlineIcon,overline:d.OverlineIcon,uppercase:d.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":d.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:d.Cross1Icon},L=g.createContext({canReset:!1,canChange:!0}),ke=({children:s,canReset:i=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:i,canChange:r},children:s}),ne=({label:s,property:i,onChange:r})=>{const n=g.useMemo(()=>t.get(D.CLASSES_LIST,`${i}.classes`,[""]),[i]),l=q(i),u=g.useMemo(()=>t.get(l,"cls",""),[l]),{canChange:a}=g.useContext(L),m=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded":"grow",children:m?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.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(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(G,{rounded:s,onChange:p=>r(p,i),selected:u,options:n,disabled:!a})})};function G({selected:s,onChange:i,rounded:r=!1,options:n,disabled:l=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:a,redo:m}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||l,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:p=>i(p.target.value),onKeyDown:p=>{p.ctrlKey&&(p.key==="z"&&a(),p.key==="y"&&m())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),g.Children.toArray(n.map(p=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:p,children:p})))]})}const Ne=({property:s,onChange:i})=>{const{canReset:r,canChange:n}=g.useContext(L),l=q(s),u=g.useMemo(()=>t.get(l,"cls",""),[l]),a=g.useMemo(()=>t.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),m=a.indexOf(u)>-1?a.indexOf(u):0,p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:p?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):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:!n&&(!r||m-1<0),onClick:()=>i(t.nth(a,m-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.MinusIcon,{className:!n&&(!r||m-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(ne,{label:!1,property:s,onChange:i})}),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:!n&&(!r||m+1>=a.length),onClick:()=>i(t.nth(a,m+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{className:!n&&(!r||m+1>=a.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Se=({property:s,onChange:i})=>{const r=g.useMemo(()=>t.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=g.useContext(L),l=q(s),u=g.useMemo(()=>t.get(l,"cls",""),[l]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,a=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>i(a,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===a?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:g.createElement(t.get(oe,a,d.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(a))})]}))})},Te={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ie=({property:s,onChange:i})=>{const r=q(s),n=g.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:l}=g.useContext(L),[u,a]=g.useState([]),[m,p]=g.useState({color:"",shade:""}),c=n.split("-"),b=t.get(c,"1",""),x=t.get(c,"2",""),f=g.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(a([]),p({color:h})):(a(["50","100","200","300","400","500","600","700","800","900"]),p(v=>({...v,color:h,shade:v.shade?v.shade:"500"})))},[a,p]);g.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(b))return a([]);a(["50","100","200","300","400","500","600","700","800","900"])},[b]);const y=g.useCallback(h=>{p({color:b,shade:h})},[b]);return g.useEffect(()=>{p({color:"",shade:""})},[r]),g.useEffect(()=>{const v=`${t.get(Te,s,"")}-${m.color}${m.shade?`-${m.shade}`:""}`;v.match(new RegExp(t.get(D.CLASSES_LIST,`${s}.regExp`,"")))&&i(v,s)},[m,i,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(G,{disabled:!l,rounded:!0,selected:b,onChange:f,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(G,{rounded:!0,selected:x,disabled:!b||!l,onChange:y,options:u})})]})},ee=(s,i)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&i.includes(r))return{value:"",unit:r};const n=i.length?new RegExp(i.join("|"),"g"):/XXXXXX/g;r=r.replace(n,"");const l=s.match(n),u=l&&l.length>1,a=!t.isEmpty(r)&&Number.isNaN(Number(r));return u||a?{error:"Invalid value"}:l&&(l[0]==="auto"||l[0]==="none")?{value:l[0],unit:""}:{value:r,unit:l?l[0]:""}};const _e=s=>{const i=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:`${i}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${i}${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:`${i}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${i}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[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[n,l]=t.map(r.split("/"),u=>parseInt(u,10));return{value:i+(n/l*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${i+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}};const He=s=>{if(t.isEmpty(s))return{value:"",unit:""};const i=s.match(/\[.*\]/g);if(i===null)return Ve(s);const r=t.get(i,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",l=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${n}${l}`,unit:r.replace(l,"")}},Ve=s=>t.isEmpty(s)?{value:"",unit:""}:_e(s),ie=g.createContext({setDragData:()=>{}}),Be=({unit:s,currentValue:i,onDrag:r,onDragEnd:n,onDragStart:l,negative:u,cssProperty:a})=>{const{setDragData:m}=g.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:p=>{const c={onDrag:r,onDragEnd:n,dragging:!0,dragStartY:p.pageY,dragStartValue:`${i}`,dragUnit:s,negative:u,cssProperty:a};l(c),m(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(d.RowSpacingIcon,{})})},Ae=({onSelect:s,current:i,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(n=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:i===n?"primary":void 0,size:"sm",onClick:l=>{l.stopPropagation(),s(n)},children:n},n))}),te=50,De=s=>{const[i,r]=g.useState(!1),[n,l]=g.useState(""),{currentClass:u,onChange:a,classPrefix:m,cssProperty:p,units:c,negative:b}=s,[x,f]=g.useState(p!=null&&p.toLowerCase().includes("width")?"%":c[0]),[y,h]=g.useState(!1),[v,E]=g.useState(""),[T,w]=g.useState(!1),[_,H]=g.useState(!1);g.useEffect(()=>{const{value:j,unit:R}=He(u);if(R===""){l(j),f(p!=null&&p.toLowerCase().includes("width")?"%":t.first(c));return}f(R),l(R==="class"||t.isEmpty(j)?"":j)},[u,p,c]);const C=Z.useThrottledCallback(j=>a(j),[a],te),I=Z.useThrottledCallback(j=>a(j,!1),[a],te),B=g.useCallback((j=!1)=>{const R=ee(`${n}`,c);if(t.get(R,"error",!1)){h(!0);return}const k=t.get(R,"unit")!==""?t.get(R,"unit"):x;if(k==="auto"||k==="none"){C(`${m}${k}`);return}if(t.get(R,"value")==="")return;const M=`${t.get(R,"value","").startsWith("-")?"-":""}${m}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;j?I(M):C(M)},[C,I,n,x,m,c]),P=g.useCallback(j=>{const R=ee(`${n}`,c);if(t.get(R,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){C(`${m}${j}`);return}if(t.get(R,"value")==="")return;const k=t.get(R,"unit")!==""?t.get(R,"unit"):j,M=`${t.get(R,"value","").startsWith("-")?"-":""}${m}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;C(M)},[C,n,m,c]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:x==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.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(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${T?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(x)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:x==="class",onKeyPress:j=>{j.key==="Enter"&&B()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),H(!0);const R=t.parseInt(j.target.value);let k=t.isNaN(R)?0:R;j.keyCode===38&&(k+=1),j.keyCode===40&&(k-=1);const V=`${k}`,ae=`${V.startsWith("-")?"-":""}${m}[${V.replace("-","")}${x==="-"?"":x}]`;I(ae)},onKeyUp:j=>{_&&(j.preventDefault(),H(!1))},onBlur:()=>B(),onChange:j=>{h(!1),l(j.target.value)},onClick:j=>{var R;(R=j==null?void 0:j.target)==null||R.select(),r(!1)},value:T?v:n,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",y?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:i,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!i),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:x}),c.length>1?e.jsxRuntimeExports.jsx(d.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ae,{units:c,current:x,onSelect:j=>{r(!1),f(j),P(j)}})})})]})]}),["none","auto"].indexOf(x)!==-1||T?null:e.jsxRuntimeExports.jsx(Be,{onDragStart:()=>w(!0),onDragEnd:j=>{if(E(()=>""),w(!1),t.isEmpty(j))return;const R=`${j}`,V=`${R.startsWith("-")?"-":""}${m}[${R.replace("-","")}${x==="-"?"":x}]`;C(V)},onDrag:j=>{if(t.isEmpty(j))return;E(j);const R=`${j}`,V=`${R.startsWith("-")?"-":""}${m}[${R.replace("-","")}${x==="-"?"":x}]`;I(V)},currentValue:n,unit:x,negative:b,cssProperty:p})]})})})},q=s=>{const i=o.useSelectedBlockCurrentClasses();return t.findLast(i,{property:s})},Pe=(s,i)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[i]},Me={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-"},se={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},$e=s=>`${s.toUpperCase()} ${se[s]?`(${se[s]} & up)`:""}`,K=s=>{const{t:i}=A.useTranslation(),{type:r="icons",label:n,property:l,onEmitChange:u=()=>{},units:a,negative:m=!1}=s,[p]=o.useDarkMode(),[c]=o.useStylingState(),[,b]=o.useCanvasWidth(),x=q(l),f=o.useAddClassesToBlocks(),y=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),v=g.useMemo(()=>t.get(x,"fullCls",""),[x]),E=g.useCallback((I,B=!0)=>{const P={dark:p,mq:b,mod:c,cls:I,property:l,fullCls:""};(p||c!=="")&&(P.mq="xs");const j=D.generateFullClsName(P);f(h,[j],B)},[h,p,b,c,l,f]),T=g.useCallback(()=>{y(h,[v])},[h,v,y]),w=g.useMemo(()=>Pe(x,b),[x,b]);g.useEffect(()=>{u(w,x)},[w,u,x]);const[,,_]=o.useCanvasWidth(),H=g.useCallback(I=>{_({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[I])},[_]),C=t.get(x,"dark",null)===p&&t.get(x,"mod",null)===c&&t.get(x,"mq",null)===b;return e.jsxRuntimeExports.jsx(ke,{canChange:w,canReset:x&&C,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] ${x&&!C?"text-foreground":""}`,children:i(n)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[r==="arbitrary"?e.jsxRuntimeExports.jsx(De,{currentClass:t.get(x,"cls",""),classPrefix:t.get(Me,l,""),units:a||[],onChange:E,negative:m,cssProperty:l}):null,r==="icons"&&e.jsxRuntimeExports.jsx(Se,{property:l,onChange:E}),r==="range"&&e.jsxRuntimeExports.jsx(Ne,{property:l,onChange:E}),r==="color"&&e.jsxRuntimeExports.jsx(Ie,{property:l,onChange:E}),r==="dropdown"&&e.jsxRuntimeExports.jsx(ne,{label:n,property:l,onChange:E})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${v?"visible":"invisible"}`,children:C?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>T(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(d.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):w&&x?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.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(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.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:[$e(t.get(x,"mq")),p&&!x.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>H(t.get(x,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(x,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Le=["px","%","em","rem","ch","vh","vw"],le=({label:s,options:i,borderB:r=!1,borderT:n=!1,type:l="arbitrary",units:u=Le,negative:a=!1})=>{const{t:m}=A.useTranslation(),[p,c]=g.useState(i[0].key),b=o.useSelectedBlockCurrentClasses(),x=g.useCallback(f=>t.map(b,"property").includes(f),[b]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${n?"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:m(s)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:g.Children.toArray(i.map(({label:f,key:y})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>c(y),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${y===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[g.createElement("div",{className:x(y)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),g.createElement(t.get(oe,y,d.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(f))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(K,{type:l,units:[...u],label:"",property:p,negative:a})})]})},qe=({heading:s,items:i})=>{const{t:r}=A.useTranslation(),n=o.useSelectedBlockCurrentClasses(),l=g.useMemo(()=>{const u=p=>t.flatten(p.map(c=>c.styleType==="multiple"?t.map(c.options,"key"):c.property)),a=t.flatten(i.map(p=>p.styleType==="accordion"?u(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),m=t.map(n,"property");return t.intersection(a,m).length>0},[n,i]);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),l?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${l?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:i.map(u=>u.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...u},u.label):e.jsxRuntimeExports.jsx(K,{...u},u.label))})]})},Oe=g.createContext({}),X=({section:s})=>{const{t:i}=A.useTranslation(),r=o.useSelectedBlockCurrentClasses(),n=g.useCallback((a=[])=>{const m={};for(let c=0;c<r.length;c++)m[r[c].property]=r[c].cls;let p=!0;for(const c in a)if(!t.has(m,c)||m[c]!==a[c]){p=!1;break}return p},[r]),l=g.useMemo(()=>{if(r.length>0&&s.heading==="classes.heading")return!0;const a=c=>t.flatten(c.map(b=>b.styleType==="multiple"?t.flatten(t.map(b.options,"key")):b.property)),m=t.flatten(s.items.map(c=>c.styleType==="accordion"?a(c.items):c.styleType==="multiple"?t.flatten(t.map(c.options,"key")):c.property)),p=t.map(r,"property");return t.intersection(m,p).length>0},[r,s.heading,s.items]),u=g.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Oe.Provider,{value:u,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.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 ${l?"bg-blue-500":"bg-gray-300"}`}),i(s.heading)]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:g.Children.toArray(s.items.map(a=>t.has(a,"component")?g.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...a},a.label):a.styleType==="accordion"&&n(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(qe,{...a},a.label):null:e.jsxRuntimeExports.jsx(K,{...a},a.label)))})]})})},We=({item:s,index:i,canDelete:r,onChange:n,onRemove:l})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:u=>n(u,i),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:u=>t.isEmpty(s.key)?{}:n(u,i),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(d.TrashIcon,{onClick:l,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),Fe=({section:s})=>{var f;const{setSyncState:i}=o.useSavePage(),r=o.useSelectedBlock(),[n,l]=g.useState([]),[u]=o.useSelectedStylingBlocks(),a=o.useUpdateBlocksPropsRealtime(),m=`${t.get(u,"0.prop")}_attrs`;O.useEffect(()=>{const y=t.map(t.get(r,m),(h,v)=>({key:v,value:h}));t.isEmpty(y)?l([]):l(y)},[t.get(r,m)]);const p=()=>l([...n,{key:"",value:""}]),c=y=>{const h=t.filter(n,(v,E)=>y!==E);x(h)},b=(y,h)=>{const v=[...n];v[h][y.target.name]=y.target.value,x(v)},x=O.useCallback((y=[])=>{const h={};t.forEach(y,v=>{t.isEmpty(v.key)||t.set(h,v.key,v.value)}),a([t.get(r,"_id")],{[m]:h}),i("UNSAVED")},[r,i,a,m]);return e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.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 ${t.isEmpty(t.get(r,m))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(o.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(n)&&t.isEmpty((f=t.last(n))==null?void 0:f.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var y;!t.isEmpty(n)&&t.isEmpty((y=t.last(n))==null?void 0:y.key)||p()},children:[e.jsxRuntimeExports.jsx(d.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),O.Children.toArray(t.map(n,(y,h)=>{const v=n.length>0&&h<n.length-1;return e.jsxRuntimeExports.jsx(We,{item:y,index:h,canDelete:v,onChange:b,onRemove:()=>c(h)})}))]})]})})]})},ze=()=>{const s=o.useSelectedBlock(),[i]=o.useSelectedStylingBlocks(),{t:r}=A.useTranslation(),n=$.useGlobalStylingPresets(),l=o.useAddClassesToBlocks(),u=$.getBlockComponent(s._type),a=N.get(N.first(i),"prop"),m=N.get(u.props,`${a}.presets`,{});if(N.isEmpty(n)&&(!N.has(u,"props")||N.isEmpty(m)))return null;const p=c=>{const b=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");l([s._id],b,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"w-full",size:"sm",children:[r("Apply Presets"),e.jsxRuntimeExports.jsx(d.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[N.isEmpty(m)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[u.type," ",r("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:N.keys(m).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(m[c]),children:[N.capitalize(N.startCase(r(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]}),N.isEmpty(n)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:r("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:N.keys(n).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(n[c]),children:[N.capitalize(N.startCase(r(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]})]})})]})})};function Ye(){const[s,i]=o.useStylingState(),{flexChild:r,gridChild:n}=o.useSelectedBlocksDisplayChild(),{t:l}=A.useTranslation(),[u]=o.useSelectedStylingBlocks();return t.isEmpty(u)?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(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:l("no_styling_block_selected")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(ze,{}),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(o.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(o.Select,{defaultValue:s,onValueChange:a=>i(a),children:[e.jsxRuntimeExports.jsx(o.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(o.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(o.SelectContent,{children:[e.jsxRuntimeExports.jsx(o.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(o.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(W.BrushIcon,{className:"w-3"}),e.jsxRuntimeExports.jsx("span",{children:l(`Styles will be applied for (:${s}) state`)})]}):null,e.jsxRuntimeExports.jsx(o.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(o.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(X,{section:Ee}),n?e.jsxRuntimeExports.jsx(X,{section:we}):null,Ce.map(a=>e.jsxRuntimeExports.jsx(X,{section:a},a.heading)),e.jsxRuntimeExports.jsx(Fe,{section:{heading:"Attributes"}})]})})]})}const Xe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ze=()=>{const s=o.useSelectedBlock(),{t:i}=A.useTranslation(),[r,n]=g.useState(""),[l,u]=g.useState({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),a=Z.useThrottledCallback(p=>{const c=!t.get(l,"negative",!1),b=t.get(l,"cssProperty","");let x=parseFloat(l.dragStartValue);x=t.isNaN(x)?0:x;let f=Xe[l.dragUnit];(t.startsWith(b,"scale")||b==="opacity")&&(f=10);let h=(l.dragStartY-p.pageY)/f+x;c&&h<0&&(h=0),b==="opacity"&&h>1&&(h=1),l.onDrag(`${h}`),n(`${h}`)},[l],50),m=g.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${r}`),100),u({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,r,u]);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(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:u},children:[l.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:a,onMouseUp:()=>m(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(o.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(o.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"settings",children:i("settings")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:i("styling")})]}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"settings",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden pb-5",children:e.jsxRuntimeExports.jsx(ve,{})})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ye,{})})]})]})})};exports.default=Ze;
@@ -1,14 +1,14 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import { KeyboardIcon as J, PlusIcon as q, Half2Icon as Y } from "@radix-ui/react-icons";
3
- import v, { useState as p, useEffect as Z, useMemo as $, lazy as b, Suspense as N } from "react";
3
+ import v, { useState as p, useEffect as Z, useMemo as $, lazy as b, Suspense as y } from "react";
4
4
  import { useAtom as H } from "jotai";
5
5
  import { filter as w, map as E, isNull as G, find as Q, isEmpty as W, each as X, get as ee } from "lodash-es";
6
- import { ad as F, ae as L, af as R, ag as U, ah as se, A as re, a as ae, b as le, c as ie, d as te, e as oe, f as ne, g as ce, ai as de, y as me, C as xe, aj as pe, ak as he, al as ue, am as fe, an as B, ao as je, ap as ve, aq as ge, B as g, ar as be, as as z, h as T, at as ye, S as V, au as O, av as I, aw as A, ax as S } from "./index-la4rqGKN.js";
7
- import { ListTreeIcon as _, DatabaseIcon as Ne } from "lucide-react";
6
+ import { ad as F, ae as L, af as R, ag as U, ah as se, A as re, a as ae, b as le, c as ie, d as te, e as oe, f as ne, g as ce, ai as de, y as me, C as xe, aj as pe, ak as he, al as ue, am as fe, an as B, ao as je, ap as ve, aq as ge, B as g, ar as be, as as z, h as T, at as Ne, S as V, au as O, av as I, aw as A, ax as S } from "./index-IPJAbzzO.js";
7
+ import { ListTreeIcon as _, DatabaseIcon as ye } from "lucide-react";
8
8
  import { getChaiDataProviders as we } from "@chaibuilder/runtime";
9
- import { useTranslation as y } from "react-i18next";
9
+ import { useTranslation as N } from "react-i18next";
10
10
  import { J as ke, a as Ce, d as De } from "./index-e0c8PmRQ.js";
11
- import { E as Te } from "./index-QIbDWoML.js";
11
+ import { E as Te } from "./index-UP_4awU9.js";
12
12
  import { c as Ae } from "./Functions-7jnEwJyw.js";
13
13
  import { O as i } from "./MODIFIERS-WQdaNvb8.js";
14
14
  import { useFeature as Se } from "flagged";
@@ -46,13 +46,13 @@ import "react-dnd";
46
46
  import "@minoru/react-dnd-treeview";
47
47
  import "react-hotkeys-hook";
48
48
  const _e = ({ provider: s, onClose: o }) => {
49
- const { t: a } = y(), [l, h] = p(null);
49
+ const { t: l } = N(), [a, h] = p(null);
50
50
  return Z(() => {
51
51
  s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => h(n));
52
52
  }, [s]), s ? /* @__PURE__ */ e.jsx(F, { onOpenChange: (c) => c ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(L, { children: [
53
53
  /* @__PURE__ */ e.jsxs(R, { children: [
54
54
  /* @__PURE__ */ e.jsxs(U, { children: [
55
- a("data_provider"),
55
+ l("data_provider"),
56
56
  ": ",
57
57
  s.name
58
58
  ] }),
@@ -61,7 +61,7 @@ const _e = ({ provider: s, onClose: o }) => {
61
61
  /* @__PURE__ */ e.jsx(Te, { children: /* @__PURE__ */ e.jsx(
62
62
  ke,
63
63
  {
64
- data: l,
64
+ data: a,
65
65
  shouldExpandNode: Ce,
66
66
  style: {
67
67
  ...De,
@@ -76,9 +76,9 @@ const _e = ({ provider: s, onClose: o }) => {
76
76
  function Pe({
77
77
  children: s,
78
78
  name: o,
79
- onRemove: a
79
+ onRemove: l
80
80
  }) {
81
- const { t: l } = y();
81
+ const { t: a } = N();
82
82
  return /* @__PURE__ */ e.jsxs(re, { children: [
83
83
  /* @__PURE__ */ e.jsx(ae, { asChild: !0, children: s }),
84
84
  /* @__PURE__ */ e.jsxs(le, { children: [
@@ -86,29 +86,29 @@ function Pe({
86
86
  /* @__PURE__ */ e.jsx(
87
87
  te,
88
88
  {
89
- dangerouslySetInnerHTML: { __html: l("remove_provider_confirmation").replace("{name}", o) }
89
+ dangerouslySetInnerHTML: { __html: a("remove_provider_confirmation").replace("{name}", o) }
90
90
  }
91
91
  ),
92
- /* @__PURE__ */ e.jsx(oe, { children: l("remove_provider_warning") })
92
+ /* @__PURE__ */ e.jsx(oe, { children: a("remove_provider_warning") })
93
93
  ] }),
94
94
  /* @__PURE__ */ e.jsxs(ne, { children: [
95
- /* @__PURE__ */ e.jsx(ce, { children: l("cancel") }),
96
- /* @__PURE__ */ e.jsx(de, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: l("remove") })
95
+ /* @__PURE__ */ e.jsx(ce, { children: a("cancel") }),
96
+ /* @__PURE__ */ e.jsx(de, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: a("remove") })
97
97
  ] })
98
98
  ] })
99
99
  ] });
100
100
  }
101
101
  const Ke = () => {
102
- const { t: s } = y(), o = $(() => we(), []), [a, l] = me(), [, h] = H(xe), [c, n] = p(
103
- w(o, (r) => E(a, "providerKey").includes(r.providerKey))
102
+ const { t: s } = N(), o = $(() => we(), []), [l, a] = me(), [, h] = H(xe), [c, n] = p(
103
+ w(o, (r) => E(l, "providerKey").includes(r.providerKey))
104
104
  ), [k, u] = p(""), [f, j] = p(null), d = w(
105
105
  o.map((r) => E(c, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
106
106
  (r) => !G(r)
107
107
  ), C = (r) => {
108
108
  const x = Q(o, { providerKey: r });
109
- n((m) => [...m, x]), l((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), h("UNSAVED");
109
+ n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), h("UNSAVED");
110
110
  }, D = (r) => {
111
- n((x) => w(x, (m) => m.providerKey !== r.providerKey)), l((x) => w(x, (m) => m.providerKey !== r.providerKey)), h("UNSAVED");
111
+ n((x) => w(x, (m) => m.providerKey !== r.providerKey)), a((x) => w(x, (m) => m.providerKey !== r.providerKey)), h("UNSAVED");
112
112
  }, t = (r) => j(r);
113
113
  return W(o) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
114
114
  s("no_data_providers"),
@@ -202,11 +202,11 @@ const Ke = () => {
202
202
  ] })
203
203
  ] });
204
204
  }, Ee = () => {
205
- const { t: s } = y(), o = {
205
+ const { t: s } = N(), o = {
206
206
  "ctrl + Z": "Undo",
207
207
  "ctrl + Y": "Redo",
208
208
  "ctrl + D": "Duplicate"
209
- }, a = {
209
+ }, l = {
210
210
  // "ctrl + /": "Rename block",
211
211
  "ctrl + S": "Save page",
212
212
  esc: "Deselect blocks",
@@ -220,21 +220,21 @@ const Ke = () => {
220
220
  /* @__PURE__ */ e.jsxs(L, { className: "sm:max-w-[525px]", children: [
221
221
  /* @__PURE__ */ e.jsx(R, { children: /* @__PURE__ */ e.jsx(U, { children: s("Keyboard shortcuts") }) }),
222
222
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
223
- /* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(o).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
224
- /* @__PURE__ */ e.jsx(z, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
225
- /* @__PURE__ */ e.jsx("div", { children: s(o[l]) })
226
- ] }, l)) }),
227
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(a).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
228
- /* @__PURE__ */ e.jsx(z, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
229
- /* @__PURE__ */ e.jsx("div", { children: s(a[l]) })
230
- ] })) })
223
+ /* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(o).map((a) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
224
+ /* @__PURE__ */ e.jsx(z, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(a) }),
225
+ /* @__PURE__ */ e.jsx("div", { children: s(o[a]) })
226
+ ] }, a)) }),
227
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(l).map((a) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
228
+ /* @__PURE__ */ e.jsx(z, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(a) }),
229
+ /* @__PURE__ */ e.jsx("div", { children: s(l[a]) })
230
+ ] }, a)) })
231
231
  ] }) })
232
232
  ] })
233
233
  ] });
234
- }, Be = b(() => import("./AddBlocks-VIWJkaHJ.js")), P = b(() => import("./Outline-rNFJGkap.js")), K = b(() => import("./ListTree-kergCZrw.js")), ze = b(() => import("./BrandingOptions-5ss0k1nb.js")), Ve = b(() => import("./index-la4rqGKN.js").then((s) => s.cq));
234
+ }, Be = b(() => import("./AddBlocks-WgpssWmQ.js")), P = b(() => import("./Outline-2OxsXs1-.js")), K = b(() => import("./ListTree-dvxHTXs4.js")), ze = b(() => import("./BrandingOptions-4961TxX2.js")), Ve = b(() => import("./index-IPJAbzzO.js").then((s) => s.cq));
235
235
  let M = null;
236
236
  const _s = () => {
237
- const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [a, l] = H(ye), [h, c] = p(a), [n, k] = p(null), { t: u } = y(), f = Se("arborist"), j = {
237
+ const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = H(Ne), [h, c] = p(l), [n, k] = p(null), { t: u } = N(), f = Se("arborist"), j = {
238
238
  "add-blocks": Be,
239
239
  [i]: f ? K : P,
240
240
  "branding-options": ze,
@@ -244,7 +244,7 @@ const _s = () => {
244
244
  j[t] = r;
245
245
  });
246
246
  const d = (t) => {
247
- clearTimeout(M), a !== i && t === i ? M = setTimeout(() => l(i), 500) : c(t), l(t);
247
+ clearTimeout(M), l !== i && t === i ? M = setTimeout(() => a(i), 500) : c(t), a(t);
248
248
  }, C = T("dataBindingSupport", !1);
249
249
  function D() {
250
250
  const t = setTimeout(() => {
@@ -253,7 +253,7 @@ const _s = () => {
253
253
  k(t);
254
254
  }
255
255
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
256
- a !== i ? /* @__PURE__ */ e.jsx(
256
+ l !== i ? /* @__PURE__ */ e.jsx(
257
257
  "div",
258
258
  {
259
259
  onMouseEnter: D,
@@ -270,7 +270,7 @@ const _s = () => {
270
270
  d("add-blocks");
271
271
  },
272
272
  size: "sm",
273
- variant: a === "add-blocks" ? "default" : "outline",
273
+ variant: l === "add-blocks" ? "default" : "outline",
274
274
  children: /* @__PURE__ */ e.jsx(q, { className: "text-xl" })
275
275
  }
276
276
  ),
@@ -279,7 +279,7 @@ const _s = () => {
279
279
  {
280
280
  onClick: () => d(i),
281
281
  size: "sm",
282
- variant: a === i ? "default" : "outline",
282
+ variant: l === i ? "default" : "outline",
283
283
  children: /* @__PURE__ */ e.jsx(_, { className: "w-4" })
284
284
  }
285
285
  ),
@@ -288,18 +288,18 @@ const _s = () => {
288
288
  {
289
289
  onClick: () => d("branding-options"),
290
290
  size: "sm",
291
- variant: a === "branding-options" ? "default" : "outline",
291
+ variant: l === "branding-options" ? "default" : "outline",
292
292
  children: /* @__PURE__ */ e.jsx(Y, { className: "w-4 max-w-[40px] text-xs" })
293
293
  }
294
294
  ),
295
295
  v.Children.toArray(
296
- s.map(({ name: t, icon: r }) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(V, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
296
+ s.map(({ name: t, icon: r }) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(V, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
297
297
  g,
298
298
  {
299
299
  onClick: () => d(t),
300
300
  size: "sm",
301
301
  className: "w-10",
302
- variant: a === t ? "default" : "outline",
302
+ variant: l === t ? "default" : "outline",
303
303
  children: /* @__PURE__ */ e.jsx(r, {})
304
304
  }
305
305
  ) }))
@@ -308,16 +308,16 @@ const _s = () => {
308
308
  /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
309
309
  /* @__PURE__ */ e.jsx(Ee, {}),
310
310
  v.Children.toArray(
311
- o.map((t) => /* @__PURE__ */ e.jsx(N, { fallback: /* @__PURE__ */ e.jsx(V, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
311
+ o.map((t) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(V, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
312
312
  )
313
313
  ] })
314
314
  ] }),
315
315
  /* @__PURE__ */ e.jsx(
316
316
  "div",
317
317
  {
318
- className: `absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${a !== i ? "translate-x-0" : "-translate-x-full"}`,
318
+ className: `absolute left-14 z-[50] h-full w-fit min-w-[200px] border-r bg-background duration-500 ease-in-out ${l !== i ? "translate-x-0" : "-translate-x-full"}`,
319
319
  children: /* @__PURE__ */ e.jsx(
320
- N,
320
+ y,
321
321
  {
322
322
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
323
323
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
@@ -328,13 +328,13 @@ const _s = () => {
328
328
  "div",
329
329
  {
330
330
  className: Ae(
331
- "relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",
332
- a === i ? "" : "z-[100]"
331
+ "relative h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1",
332
+ l === i ? "" : "z-[100]"
333
333
  ),
334
334
  onMouseEnter: () => {
335
335
  n && clearTimeout(n);
336
336
  },
337
- children: v.createElement(ee(j, a, () => /* @__PURE__ */ e.jsx("div", {})))
337
+ children: v.createElement(ee(j, l, () => /* @__PURE__ */ e.jsx("div", {})))
338
338
  }
339
339
  )
340
340
  }
@@ -342,7 +342,7 @@ const _s = () => {
342
342
  }
343
343
  ),
344
344
  /* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
345
- N,
345
+ y,
346
346
  {
347
347
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
348
348
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
@@ -357,7 +357,7 @@ const _s = () => {
357
357
  u("Outline")
358
358
  ] }),
359
359
  /* @__PURE__ */ e.jsxs(A, { value: "data-provider", children: [
360
- /* @__PURE__ */ e.jsx(Ne, { className: "mr-2 w-3" }),
360
+ /* @__PURE__ */ e.jsx(ye, { className: "mr-2 w-3" }),
361
361
  u("Data")
362
362
  ] })
363
363
  ] }),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),k=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),u=require("lodash-es"),s=require("./index-DeHH1q_1.cjs"),R=require("lucide-react"),K=require("@chaibuilder/runtime"),g=require("react-i18next"),w=require("./index-gi1LIOCw.cjs"),S=require("./index-e5cgISUO.cjs"),I=require("./Functions-N3yhPYKY.cjs"),l=require("./MODIFIERS-9EwxLM8V.cjs"),C=require("flagged");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("i18next");require("@floating-ui/react-dom");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");const P=({provider:t,onClose:a})=>{const{t:n}=g.useTranslation(),[o,h]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(c=>h(c))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:d=>d?"":a(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[n("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(S.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(w.JsonView,{data:o,shouldExpandNode:w.allExpanded,style:{...w.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 O({children:t,name:a,onRemove:n}){const{t:o}=g.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:o("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:o("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:o("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:n,className:"bg-red-600 hover:bg-red-700",children:o("remove")})]})]})]})}const L=()=>{const{t}=g.useTranslation(),a=i.useMemo(()=>K.getChaiDataProviders(),[]),[n,o]=s.usePageDataProviders(),[,h]=D.useAtom(s.pageSyncStateAtom),[d,c]=i.useState(u.filter(a,r=>u.map(n,"providerKey").includes(r.providerKey))),[b,E]=i.useState(""),[v,f]=i.useState(null),m=u.filter(a.map(r=>u.map(d,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),N=r=>{const p=u.find(a,{providerKey:r});c(j=>[...j,p]),o(j=>[...j,{providerKey:p.providerKey,args:{}}]),E(""),h("UNSAVED")},y=r=>{c(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),o(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),h("UNSAVED")},x=r=>f(r);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:[t("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:t("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:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>N(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),m.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${d.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:d.map(r=>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:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>x(r),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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"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"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(O,{onRemove:()=>y(r),name:r.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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"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"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(P,{onClose:()=>f(null),provider:v})]})]})},A=()=>{const{t}=g.useTranslation(),a={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},n={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(s.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(k.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("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(o=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(o)}),e.jsxRuntimeExports.jsx("div",{children:t(a[o])})]},o))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(n).map(o=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(o)}),e.jsxRuntimeExports.jsx("div",{children:t(n[o])})]}))})]})})]})]})},U=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-X9eh8OWJ.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./Outline-3IHYlOzF.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-tADrgsqZ.cjs"))),B=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-PzPdafIT.cjs"))),Y=i.lazy(()=>Promise.resolve().then(()=>require("./index-DeHH1q_1.cjs")).then(t=>t.ImagesPanel));let _=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[n,o]=D.useAtom(s.activePanelAtom),[h,d]=i.useState(n),[c,b]=i.useState(null),{t:E}=g.useTranslation(),v=C.useFeature("arborist"),f={"add-blocks":U,[l.OUTLINE_KEY]:v?q:T,"branding-options":B,images:Y};u.each(t,({name:x,panel:r})=>{f[x]=r});const m=x=>{clearTimeout(_),n!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?_=setTimeout(()=>o(l.OUTLINE_KEY),500):d(x),o(x)},N=s.useBuilderProp("dataBindingSupport",!1);function y(){const x=setTimeout(()=>{c&&(m(l.OUTLINE_KEY),clearTimeout(c))},500);b(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[n!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:y,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(s.Button,{onClick:()=>{m("add-blocks")},size:"sm",variant:n==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m(l.OUTLINE_KEY),size:"sm",variant:n===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m("branding-options"),size:"sm",variant:n==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:x,icon:r})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m(x),size:"sm",className:"w-10",variant:n===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(A,{}),i.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(x,{})})))]})]}),e.jsxRuntimeExports.jsx("div",{className:`absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${n!==l.OUTLINE_KEY?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.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:I.cn("relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",n===l.OUTLINE_KEY?"":"z-[100]"),onMouseEnter:()=>{c&&clearTimeout(c)},children:i.createElement(u.get(f,n,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.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:N?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(R.DatabaseIcon,{className:"mr-2 w-3"}),E("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(v?q:T)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(L,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(s.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]})}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(v?q:T)})]})})})})]})};exports.default=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),k=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),u=require("lodash-es"),s=require("./index-9PHdn80L.cjs"),R=require("lucide-react"),K=require("@chaibuilder/runtime"),g=require("react-i18next"),w=require("./index-gi1LIOCw.cjs"),S=require("./index-0bwkNnA0.cjs"),I=require("./Functions-N3yhPYKY.cjs"),l=require("./MODIFIERS-9EwxLM8V.cjs"),C=require("flagged");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("i18next");require("@floating-ui/react-dom");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");const P=({provider:t,onClose:a})=>{const{t:o}=g.useTranslation(),[n,h]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(c=>h(c))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:d=>d?"":a(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(S.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(w.JsonView,{data:n,shouldExpandNode:w.allExpanded,style:{...w.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 O({children:t,name:a,onRemove:o}){const{t:n}=g.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:n("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:n("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:n("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:n("remove")})]})]})]})}const L=()=>{const{t}=g.useTranslation(),a=i.useMemo(()=>K.getChaiDataProviders(),[]),[o,n]=s.usePageDataProviders(),[,h]=D.useAtom(s.pageSyncStateAtom),[d,c]=i.useState(u.filter(a,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,E]=i.useState(""),[v,f]=i.useState(null),m=u.filter(a.map(r=>u.map(d,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),N=r=>{const p=u.find(a,{providerKey:r});c(j=>[...j,p]),n(j=>[...j,{providerKey:p.providerKey,args:{}}]),E(""),h("UNSAVED")},y=r=>{c(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),n(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),h("UNSAVED")},x=r=>f(r);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:[t("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:t("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:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>N(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),m.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${d.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:d.map(r=>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:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>x(r),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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"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"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(O,{onRemove:()=>y(r),name:r.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","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"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"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(P,{onClose:()=>f(null),provider:v})]})]})},A=()=>{const{t}=g.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(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(s.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(k.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("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(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(n)}),e.jsxRuntimeExports.jsx("div",{children:t(a[n])})]},n))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(n)}),e.jsxRuntimeExports.jsx("div",{children:t(o[n])})]},n))})]})})]})]})},U=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-157fSrJX.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./Outline-7CCnnzmK.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-gTmusfso.cjs"))),B=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-nwXR9TMl.cjs"))),Y=i.lazy(()=>Promise.resolve().then(()=>require("./index-9PHdn80L.cjs")).then(t=>t.ImagesPanel));let _=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[o,n]=D.useAtom(s.activePanelAtom),[h,d]=i.useState(o),[c,b]=i.useState(null),{t:E}=g.useTranslation(),v=C.useFeature("arborist"),f={"add-blocks":U,[l.OUTLINE_KEY]:v?q:T,"branding-options":B,images:Y};u.each(t,({name:x,panel:r})=>{f[x]=r});const m=x=>{clearTimeout(_),o!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?_=setTimeout(()=>n(l.OUTLINE_KEY),500):d(x),n(x)},N=s.useBuilderProp("dataBindingSupport",!1);function y(){const x=setTimeout(()=>{c&&(m(l.OUTLINE_KEY),clearTimeout(c))},500);b(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:y,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(s.Button,{onClick:()=>{m("add-blocks")},size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m(l.OUTLINE_KEY),size:"sm",variant:o===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m("branding-options"),size:"sm",variant:o==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:x,icon:r})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.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(A,{}),i.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(x,{})})))]})]}),e.jsxRuntimeExports.jsx("div",{className:`absolute left-14 z-[50] h-full w-fit min-w-[200px] border-r bg-background duration-500 ease-in-out ${o!==l.OUTLINE_KEY?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.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:I.cn("relative h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1",o===l.OUTLINE_KEY?"":"z-[100]"),onMouseEnter:()=>{c&&clearTimeout(c)},children:i.createElement(u.get(f,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.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:N?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(R.DatabaseIcon,{className:"mr-2 w-3"}),E("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(v?q:T)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(L,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(s.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]})}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(v?q:T)})]})})})})]})};exports.default=z;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),h=require("@radix-ui/react-icons"),t=require("./index-DeHH1q_1.cjs"),z=require("./index-ecnGWzh9.cjs"),i=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");const v=()=>t.useBuilderProp("languages",["en"]),g=()=>v().length===1?null:c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:c.jsxRuntimeExports.jsxs(t.Select,{children:[c.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"w-[150px] border-0",children:c.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:c.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[c.jsxRuntimeExports.jsx(h.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),c.jsxRuntimeExports.jsx(t.SelectContent,{children:c.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[c.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Fruits"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"apple",children:"Apple"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"banana",children:"Banana"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"blueberry",children:"Blueberry"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"grapes",children:"Grapes"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})});function H(l){return z.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"}}]})(l)}const V=()=>{const{savePage:l,syncState:a}=t.useSavePage(),{t:s}=i.useTranslation(),e=r.useMemo(()=>{switch(a){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"}},[a]),n=c.jsxRuntimeExports.jsxs(t.Button,{disabled:a==="SAVING",onClick:o=>{o.preventDefault(),l()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${e}`,size:"sm",variant:"outline",children:[c.jsxRuntimeExports.jsx(H,{className:"text-lg"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:a==="SAVING"?"Saving...":s(a==="SAVED"?"Saved":"Unsaved")})]});return c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:n})},M=function(){const a=t.useBuilderProp("previewComponent"),[,s]=t.usePreviewMode(),{t:e}=i.useTranslation();return a?c.jsxRuntimeExports.jsxs(t.Button,{onClick:n=>{n.preventDefault(),s(!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:[c.jsxRuntimeExports.jsx(h.EyeOpenIcon,{className:"text-xs"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:e("Preview")})]}):null},u=()=>{const l=t.useBuilderProp("topBarComponents.left",[]),a=t.useBuilderProp("topBarComponents.center",[]),s=t.useBuilderProp("topBarComponents.right",[]),e=t.useBuilderProp("editable",!0);return c.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:r.Children.toArray(l.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))})}),c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:r.Children.toArray(a.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))}),c.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsxRuntimeExports.jsx(g,{}),c.jsxRuntimeExports.jsx(M,{}),c.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical"}),e?c.jsxRuntimeExports.jsx(V,{}):null,r.Children.toArray(s.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),h=require("@radix-ui/react-icons"),t=require("./index-9PHdn80L.cjs"),z=require("./index-ecnGWzh9.cjs"),i=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");const v=()=>t.useBuilderProp("languages",["en"]),g=()=>v().length===1?null:c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:c.jsxRuntimeExports.jsxs(t.Select,{children:[c.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"w-[150px] border-0",children:c.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:c.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[c.jsxRuntimeExports.jsx(h.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),c.jsxRuntimeExports.jsx(t.SelectContent,{children:c.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[c.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Fruits"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"apple",children:"Apple"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"banana",children:"Banana"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"blueberry",children:"Blueberry"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"grapes",children:"Grapes"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})});function H(l){return z.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"}}]})(l)}const V=()=>{const{savePage:l,syncState:a}=t.useSavePage(),{t:s}=i.useTranslation(),e=r.useMemo(()=>{switch(a){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"}},[a]),n=c.jsxRuntimeExports.jsxs(t.Button,{disabled:a==="SAVING",onClick:o=>{o.preventDefault(),l()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${e}`,size:"sm",variant:"outline",children:[c.jsxRuntimeExports.jsx(H,{className:"text-lg"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:a==="SAVING"?"Saving...":s(a==="SAVED"?"Saved":"Unsaved")})]});return c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:n})},M=function(){const a=t.useBuilderProp("previewComponent"),[,s]=t.usePreviewMode(),{t:e}=i.useTranslation();return a?c.jsxRuntimeExports.jsxs(t.Button,{onClick:n=>{n.preventDefault(),s(!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:[c.jsxRuntimeExports.jsx(h.EyeOpenIcon,{className:"text-xs"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:e("Preview")})]}):null},u=()=>{const l=t.useBuilderProp("topBarComponents.left",[]),a=t.useBuilderProp("topBarComponents.center",[]),s=t.useBuilderProp("topBarComponents.right",[]),e=t.useBuilderProp("editable",!0);return c.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:r.Children.toArray(l.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))})}),c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:r.Children.toArray(a.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))}),c.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsxRuntimeExports.jsx(g,{}),c.jsxRuntimeExports.jsx(M,{}),c.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical"}),e?c.jsxRuntimeExports.jsx(V,{}):null,r.Children.toArray(s.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=u;
@@ -1,7 +1,7 @@
1
1
  import { j as c } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import z, { useMemo as V, Suspense as n } from "react";
3
3
  import { FontFamilyIcon as o, EyeOpenIcon as M } from "@radix-ui/react-icons";
4
- import { h as s, aj as u, ak as d, al as C, am as L, ay as m, az as p, an as i, z as F, B as g, q as w, S as v, aA as B } from "./index-la4rqGKN.js";
4
+ import { h as s, aj as u, ak as d, al as C, am as L, ay as m, az as p, an as i, z as F, B as g, q as w, S as v, aA as B } from "./index-IPJAbzzO.js";
5
5
  import { G as f } from "./index-YpnaudSM.js";
6
6
  import { useTranslation as e } from "react-i18next";
7
7
  import "./_commonjsHelpers-UyOWmZb0.js";