@chaibuilder/sdk 1.1.18 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddBlocks-57-vroWk.cjs +1 -0
- package/dist/AddBlocks-QvCc-oag.js +225 -0
- package/dist/BrandingOptions-arKT1zCy.cjs +1 -0
- package/dist/{BrandingOptions-zFJ28xmJ.js → BrandingOptions-mZXO7thQ.js} +27 -25
- package/dist/{CanvasArea-vTV3O27-.js → CanvasArea-59Gm0EZx.js} +581 -598
- package/dist/CanvasArea-jRg53jrS.cjs +59 -0
- package/dist/CurrentPage-MLObvs0K.cjs +1 -0
- package/dist/{CurrentPage-Ay7X9h9y.js → CurrentPage-YPI5QTjk.js} +17 -14
- package/dist/Functions-7jnEwJyw.js +15 -0
- package/dist/Functions-N3yhPYKY.cjs +1 -0
- package/dist/{Layers-CWnzKXMo.js → Layers-no2keK4N.js} +149 -146
- package/dist/Layers-x_mWeT_q.cjs +1 -0
- package/dist/MODIFIERS-2FeVfZQ9.cjs +1 -0
- package/dist/{MODIFIERS-MLfpKQY1.js → MODIFIERS-RiXS5Mn1.js} +7 -13
- package/dist/MarkAsGlobalBlock-S2BhHTsK.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-uhj0kGZo.js → MarkAsGlobalBlock-SPWd6Flk.js} +9 -7
- package/dist/{PagesPanel-ALbBHaO3.js → PagesPanel-Q08uN4X3.js} +12 -9
- package/dist/PagesPanel-pOIuFPOA.cjs +1 -0
- package/dist/ProjectPanel-4bN_GyNm.cjs +1 -0
- package/dist/{ProjectPanel-tIDarI9R.js → ProjectPanel-zzYV9yrV.js} +25 -22
- package/dist/{Settings-5uDMY9SU.js → Settings-28A7R61i.js} +334 -331
- package/dist/Settings-KlTtgu3w.cjs +1 -0
- package/dist/{SidePanels-D6U95ur1.js → SidePanels--ZK6Iqou.js} +80 -77
- package/dist/SidePanels-eJBA_cUu.cjs +1 -0
- package/dist/{Topbar-_-1HX-EE.js → Topbar-ks1ckGLz.js} +15 -13
- package/dist/Topbar-u5XKdWgQ.cjs +1 -0
- package/dist/{UnsplashImages-mqK09h8E.js → UnsplashImages-8vJPuqrF.js} +25 -23
- package/dist/UnsplashImages-V8oKEHfi.cjs +1 -0
- package/dist/{UploadImages-IDkkRuhx.js → UploadImages-6N6UrjLo.js} +26 -24
- package/dist/UploadImages-eHYxwWAp.cjs +1 -0
- package/dist/_commonjsHelpers-UyOWmZb0.js +8 -0
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +1 -0
- package/dist/{add-page-modal-C1UGoRkw.js → add-page-modal-EHIYTW4T.js} +27 -24
- package/dist/add-page-modal-OvNXLGf0.cjs +1 -0
- package/dist/{confirm-alert-ea5xpncD.js → confirm-alert-biqvaLT-.js} +9 -7
- package/dist/confirm-alert-f3DYO5Hj.cjs +1 -0
- package/dist/controls-Dy1qa8Dc.cjs +1 -0
- package/dist/controls-XPXGHKht.js +182 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +10 -1
- package/dist/core.js +60 -57
- package/dist/delete-page-modal-U4yiuhx0.cjs +1 -0
- package/dist/{delete-page-modal-0GxR128b.js → delete-page-modal-qZJCk_JH.js} +15 -12
- package/dist/email-blocks.cjs +1 -0
- package/dist/email-blocks.d.ts +3 -0
- package/dist/email-blocks.js +35 -0
- package/dist/{form-irY39wvJ.js → form-Moz_psOw.js} +16 -16
- package/dist/form-lJhy9DEC.cjs +1 -0
- package/dist/functions-Ox_svtKm.cjs +1 -0
- package/dist/functions-xIebp8Aw.js +23 -0
- package/dist/html-to-json-dfALTAdG.cjs +1 -0
- package/dist/{html-to-json-wmbV9eZP.js → html-to-json-xKBERAI1.js} +47 -46
- package/dist/index-IIJ_o44s.cjs +1 -0
- package/dist/{index-qEix1meh.js → index-QEchoZ98.js} +8 -8
- package/dist/{index-0OqmBgqo.js → index-_OgCuSUz.js} +528 -533
- package/dist/{index-npVo1wi3.cjs → index-hMoPNZVn.cjs} +2 -2
- package/dist/{jsx-runtime-NV737rRe.js → jsx-runtime-WbnYoNE9.js} +1 -1
- package/dist/{jsx-runtime-WUGKV8jN.cjs → jsx-runtime-Z_BpKhVy.cjs} +7 -7
- package/dist/lib.cjs +2 -2
- package/dist/lib.d.ts +1 -1
- package/dist/lib.js +47 -44
- package/dist/page-viewer-WhM1FSU0.cjs +1 -0
- package/dist/{page-viewer-mgnZt6nO.js → page-viewer-zFLkUu2I.js} +17 -14
- package/dist/{project-general-setting-M52W-vUp.js → project-general-setting-MWGOOurD.js} +16 -13
- package/dist/project-general-setting-y8daY7V9.cjs +1 -0
- package/dist/project-seo-setting-9JGBPzcA.cjs +1 -0
- package/dist/{project-seo-setting-EhqUcTKy.js → project-seo-setting-dXclexQW.js} +15 -13
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js +50 -49
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +11 -11
- package/dist/single-page-detail--xPv74bX.cjs +1 -0
- package/dist/{single-page-detail-61UDUgWG.js → single-page-detail-C48IPzbd.js} +77 -74
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +11 -8
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +144 -142
- package/dist/useAddBlockByDrop-_nd8yZBa.cjs +1 -0
- package/dist/useAddBlockByDrop-uPXvrg4G.js +20 -0
- package/dist/{utils-XsPKXMVo.js → utils-AvyFzbPC.js} +26 -35
- package/dist/utils-PTxFk6qT.cjs +1 -0
- package/dist/web-blocks.cjs +9 -0
- package/dist/web-blocks.d.ts +3 -0
- package/dist/web-blocks.js +1033 -0
- package/package.json +5 -2
- package/dist/AddBlocks-sKF4ti68.js +0 -222
- package/dist/AddBlocks-yPovJXtD.cjs +0 -1
- package/dist/BrandingOptions-TRVyCvVq.cjs +0 -1
- package/dist/CanvasArea-xxqOiENt.cjs +0 -59
- package/dist/CurrentPage-ju6otPNk.cjs +0 -1
- package/dist/Layers-d9OU0HRE.cjs +0 -1
- package/dist/MODIFIERS-WFzDQfiT.cjs +0 -1
- package/dist/MarkAsGlobalBlock-CDmEHNx7.cjs +0 -1
- package/dist/PagesPanel-F9Cdi4Pf.cjs +0 -1
- package/dist/ProjectPanel-T49RUDyt.cjs +0 -1
- package/dist/Settings-eZnusNbR.cjs +0 -1
- package/dist/SidePanels-BVM5JwGC.cjs +0 -1
- package/dist/Topbar-gQxbcPtG.cjs +0 -1
- package/dist/UnsplashImages-PNp5fYCc.cjs +0 -1
- package/dist/UploadImages-BoSSsLtD.cjs +0 -1
- package/dist/add-page-modal-HP1yv9yJ.cjs +0 -1
- package/dist/confirm-alert-dHRDZrA1.cjs +0 -1
- package/dist/controls-QnyBNkXG.cjs +0 -36
- package/dist/controls-kEuiMMDf.js +0 -4600
- package/dist/delete-page-modal-yOgfPcHr.cjs +0 -1
- package/dist/form-6qGAOYI3.cjs +0 -1
- package/dist/functions-86L6n983.js +0 -23
- package/dist/functions-Jr7gX_RX.cjs +0 -1
- package/dist/html-to-json-AqLy6ye-.cjs +0 -1
- package/dist/index-d55M5MRz.cjs +0 -1
- package/dist/lodash-2us0VT8I.cjs +0 -36
- package/dist/lodash-3gkdNK5u.js +0 -4538
- package/dist/page-viewer-G2YIKVSt.cjs +0 -1
- package/dist/project-general-setting-sinIiBKe.cjs +0 -1
- package/dist/project-seo-setting-N0OnBCvh.cjs +0 -1
- package/dist/single-page-detail-oa-yTXhQ.cjs +0 -1
- package/dist/useAddBlockByDrop-5QW86HjG.js +0 -20
- package/dist/useAddBlockByDrop-Ckzuvu-s.cjs +0 -1
- package/dist/utils-37UXq2O5.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ae=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var xe=(s,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of ue(n))!ce.call(s,i)&&i!==r&&K(s,i,{get:()=>n[i],enumerable:!(l=pe(n,i))||l.enumerable});return s};var me=(s,n,r)=>(r=s!=null?ae(de(s)):{},xe(n||!s||!s.__esModule?K(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),m=require("react"),z=require("@react-hookz/web"),t=require("lodash-es"),A=require("react-i18next"),d=require("@radix-ui/react-icons"),o=require("./index-IIJ_o44s.cjs"),ge=require("./controls-Dy1qa8Dc.cjs"),Y=require("lucide-react"),Z=require("@chaibuilder/runtime"),q=require("./index-hMoPNZVn.cjs"),ye=require("@rjsf/core"),he=require("@rjsf/validator-ajv8"),be=require("jotai"),fe=require("react-autosuggest"),je=require("fuse.js"),B=require("./utils-PTxFk6qT.cjs"),ve=require("./MODIFIERS-2FeVfZQ9.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("redux-undo");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-dfALTAdG.cjs");require("himalaya");require("lodash");function Re(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(n,r,l.get?l:{enumerable:!0,get:()=>s[r]})}}return n.default=s,Object.freeze(n)}const M=Re(m),Ee=m.lazy(()=>import("react-json-view"));function we(s){const n=[],r={};function l(i,c){t.forEach(c,(a,x)=>{const u=i?`${i}.${x}`:x,g=t.isArray(a)?"list":typeof a;n.push(u),r[u]=g==="string"?"text":g==="object"?"model":g,g==="object"&&!t.isArray(a)&&l(u,a)})}return l("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:r}}const F=({data:s,fullView:n})=>{if(!s)return null;const r=typeof s;return n?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(q.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Ee,{style:{maxHeight:"40vh",overflowY:"auto"},name:"Content",enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:s,collapsed:!0})})]}):e.jsxRuntimeExports.jsxs("div",{className:"text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},G=({type:s,value:n="",setValue:r,data:l,onChange:i,dataType:c,appliedBindings:a})=>{const{paths:x,pathsType:u}=we(l),g=s==="PROP"?Z.getBlockComponent(l==null?void 0:l._type):{},f=s==="PROP",[p,b]=m.useState(!1),h=m.useMemo(()=>s==="PROP"?x.filter(y=>!t.includes(a,y)&&t.get(g,`props.${t.first(t.split(y,"."))}.binding`)):x.filter(y=>c===t.get(u,y,"")),[s,x,a,c,g]);return m.useEffect(()=>{n&&i(n)},[n,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:p,onOpenChange:b,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(n)?"bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center":"min-w-[350px] justify-between items-center"}`,children:n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-sm pr-8",children:[f&&e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full",children:t.startCase(c)}),n]}),e.jsxRuntimeExports.jsx("span",{className:"text-[9px] text-blue-400 underline cursor-pointer 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:"p-0 z-[999] min-w-[300px]",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(h,y=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:y,className:`cursor-pointer ${f?"flex justify-between items-center":"flex flex-col items-start justify-start"}`,onSelect:v=>{r(t.find(h,w=>w===v)||null),b(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(Y.Check,{className:`w-4 h-4 text-green-500 ${n===y?"":"opacity-0"}`}),y]}),f?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full",children:t.startCase(t.get(u,y,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(F,{data:t.get(l,y)})})]},y))})]})]})})]})]}),!f&&!t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(F,{data:t.get(l,n,""),fullView:!0})})]})},Ce=({appliedBindings:s=[],onAddBinding:n,editMode:r,item:l})=>{const[i,c]=m.useState(r?l.key:""),[a,x]=m.useState(r?l.value:""),u=o.useSelectedBlock(),[g]=q.useChaiExternalData(),f=m.useCallback((h,y)=>{if(t.isEmpty(h))return"";{const v=t.get(y==="PROP"?u:g,h,"");if(t.isArray(v))return"list";const w=typeof v;return w==="string"?"text":w==="object"?"model":w}},[u,g]),[p,b]=m.useState(r?f(l.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:"flex flex-col gap-1 relative",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:c,onChange:h=>{const y=f(h,"PROP");c(h),p!==y&&x(""),b(y)},data:u,dataType:p,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:a,setValue:x,onChange:h=>{const y=f(h,"PATH");x(p===y?h:"")},data:g,dataType:p,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(a),onClick:()=>n({key:i,value:a}),children:"Save"})})]})},re=({disabled:s,children:n,onAddBinding:r,appliedBindings:l,editMode:i=!0,item:c={}})=>{const[a,x]=m.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>x(!0),children:n}),a&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(Ce,{item:c,editMode:i,appliedBindings:l,onAddBinding:u=>{r(u),x(!1)}})})]})},ke=({item:s,onAddBinding:n,onRemove:r,selectedBlock:l,dataProvider:i,appliedBindings:c})=>{const[a,x]=m.useState("string"),u=(g,f)=>{if(t.isEmpty(g))return"";{const p=t.get(f==="PROP"?l:i,g,"");if(t.isArray(p))return"list";const b=typeof p;return b==="string"?"text":b==="object"?"model":b}};return m.useEffect(()=>x(()=>u(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col border border-gray-200 relative rounded-md p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-gray-500 font-normal text-sm",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(F,{data:t.get(i,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(re,{editMode:!0,onAddBinding:n,appliedBindings:c,item:s,children:e.jsxRuntimeExports.jsx(Y.EditIcon,{className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200"})}),e.jsxRuntimeExports.jsx(Y.TrashIcon,{onClick:()=>r(),className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]}),!t.isEmpty(a)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(a)})]})},Ne=({bindingData:s,onChange:n})=>{const r=o.useSelectedBlock(),[l]=q.useChaiExternalData(),i=Z.getChaiDataProviders(),[c,a]=m.useState(t.map(s,(p,b)=>({key:b,value:p})));m.useEffect(()=>{a(t.map(s,(p,b)=>({key:b,value:p})))},[r==null?void 0:r._id]);const x=m.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(c))return!1;const p=t.last(c);return t.isEmpty(p==null?void 0:p.key)||t.isEmpty(p==null?void 0:p.value)},[l,c]),u=p=>{const b=t.filter(c,h=>h.key!==p.key);a([...b,p]),f([...b,p])},g=p=>{const b=t.filter(c,(h,y)=>p!==y);f([...b])},f=m.useCallback((p=[])=>{if(a(p),t.isEmpty(p)){n({});return}const b={};t.forEach(p,h=>{!t.isEmpty(h==null?void 0:h.key)&&!t.isEmpty(h==null?void 0:h.value)&&t.set(b,h.key,h.value)}),n(b)},[n]);return t.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",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(c,(p,b)=>e.jsxRuntimeExports.jsx(ke,{item:p,onAddBinding:u,onRemove:()=>g(b),selectedBlock:r,dataProvider:l,appliedBindings:t.map(c,"key")},p.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(re,{disabled:x,appliedBindings:t.map(c,"key"),onAddBinding:u,children:e.jsxRuntimeExports.jsx("span",{className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${x?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(l)?e.jsxRuntimeExports.jsx("small",{className:"text-gray-500 text-[9.5px]",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),x&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(l)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},Se=()=>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"}),O=m.memo(({createHistorySnapshot:s,properties:n,formData:r,onChange:l})=>{const i={type:"object",properties:{}},c={};return Object.keys(n).forEach(a=>{const x=n[a];if(t.includes(["slot","styles"],x.type))return;const u=a;i.properties[u]=o.getBlockJSONFromSchemas(x),c[u]=o.getBlockJSONFromUISchemas(x)}),e.jsxRuntimeExports.jsx(ye,{widgets:{binding:Se,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:he,uiSchema:c,onBlur:s,schema:i,formData:r,onChange:l})});function Te(){const s=o.useSelectedBlock(),{createSnapshot:n}=o.useCanvasHistory(),r=o.useUpdateBlocksPropsRealtime(),l=Z.getBlockComponent(s._type),i={...s},c=o.useBuilderProp("dataBindingSupport",!1),a=()=>n(),x=({formData:p},b)=>{if(b){const h=b.replace("root.","");r([s._id],{[h]:t.get(p,h)})}},u={_name:ge.u({title:"Name",default:t.get(s,"_name",s._type)})},g=t.keys(t.get(i,"_bindings",{})),f=m.useMemo(()=>{const p=t.cloneDeep(t.get(l,"props",{}));return c&&t.each(g,b=>delete p[b]),p},[l,g,c]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(O,{onChange:x,createHistorySnapshot:a,formData:i,properties:u}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),c?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:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",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:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Ne,{bindingData:t.get(i,"_bindings",{}),onChange:p=>{x({formData:{...i,_bindings:p}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",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(g)?null:e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(g,t.capitalize).join(", ")})," ",g.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(O,{onChange:x,createHistorySnapshot:a,formData:i,properties:f})]})]})]}):e.jsxRuntimeExports.jsx(O,{onChange:x,createHistorySnapshot:a,formData:i,properties:f}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const J=new je(B.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Ie(){var I;const[s]=o.useSelectedStylingBlocks(),n=o.useSelectedBlock(),r=o.useAddClassesToBlocks(),l=o.useRemoveClassesFromBlocks(),[i]=o.useSelectedBlockIds(),[c,a]=m.useState(""),x=(I=t.first(s))==null?void 0:I.prop,u=t.reject((t.get(n,x,"").replace(ve.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),g=()=>{const E=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(i,E,!0),a("")},[f,p]=m.useState([]),b=({value:E})=>{const T=E.trim().toLowerCase(),_=T.match(/.+:/g);let C=[];if(_&&_.length>0){const[S]=_,V=T.replace(S,"");C=J.search(V).map(j=>({...j,item:{...j.item,name:S+j.item.name}}))}else C=J.search(T);p(t.map(C,"item"))},h=()=>{p([])},y=E=>E.name,v=E=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:E.name}),w={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:c,onKeyDown:E=>{E.key==="Enter"&&c.trim()!==""&&g()},onChange:(E,{newValue:T})=>a(T),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 ${f.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(fe,{suggestions:f,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:h,getSuggestionValue:y,renderSuggestion:v,inputProps:w,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:g,disabled:c.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(u)&&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"}),M.Children.toArray(u.map(E=>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:[E,e.jsxRuntimeExports.jsx(d.Cross2Icon,{onClick:()=>l(i,[E]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},E)))]})]})}const N=["px","%","em","rem","ch","vh","vw"],_e={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:N,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"}]},He={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"}]},Ve=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:N.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...N,"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:N.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:N.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:N.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:N.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:N},{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:N},{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:"typography.font",label:"typography.font"},{type:"arbitrary",property:"typography.size",label:"typography.size",units:N},{type:"arbitrary",property:"typography.height",label:"typography.height",units:N.concat("-")},{type:"range",property:"typography.weight",label:"typography.weight"},{type:"color",property:"typography.color",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"typography.align",label:"typography.align"},{type:"dropdown",property:"typography.valign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"typography.spacing",label:"typography.spacing"},{type:"dropdown",property:"typography.decoration",label:"typography.decoration"},{type:"range",property:"typography.thickness",label:"typography.thickness"},{type:"dropdown",property:"typography.transform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"typography.whitespace",label:"typography.whitespace"},{type:"dropdown",property:"typography.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:Ie}]}],se={"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},$=m.createContext({canReset:!1,canChange:!0}),Ae=({children:s,canReset:n=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx($.Provider,{value:{canReset:n,canChange:r},children:s}),oe=({label:s,property:n,onChange:r})=>{const l=m.useMemo(()=>t.get(B.CLASSES_LIST,`${n}.classes`,[""]),[n]),i=L(n),c=m.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:a}=m.useContext($),x=/\[.*\]/g.test(c);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:x?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:c}),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(X,{rounded:s,onChange:u=>r(u,n),selected:c,options:l,disabled:!a})})};function X({selected:s,onChange:n,rounded:r=!1,options:l,disabled:i=!1}){const c=s.replace(/.*:/g,"").trim(),{undo:a,redo:x}=o.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||i,className:`${r?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:u=>n(u.target.value),onKeyDown:u=>{u.ctrlKey&&(u.key==="z"&&a(),u.key==="y"&&x())},value:c,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),m.Children.toArray(l.map(u=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:u,children:u})))]})}const Be=({property:s,onChange:n})=>{const{canReset:r,canChange:l}=m.useContext($),i=L(s),c=m.useMemo(()=>t.get(i,"cls",""),[i]),a=m.useMemo(()=>t.get(B.CLASSES_LIST,`${s}.classes`,[""]),[s]),x=a.indexOf(c)>-1?a.indexOf(c):0,u=/\[.*\]/g.test(c);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:u?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:c}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||x-1<0),onClick:()=>n(t.nth(a,x-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.MinusIcon,{className:!l&&(!r||x-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(oe,{label:!1,property:s,onChange:n})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||x+1>=a.length),onClick:()=>n(t.nth(a,x+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{className:!l&&(!r||x+1>=a.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},De=({property:s,onChange:n})=>{const r=m.useMemo(()=>t.get(B.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:l}=m.useContext($),i=L(s),c=m.useMemo(()=>t.get(i,"cls",""),[i]);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:!l,onClick:()=>n(a,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${c===a?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:m.createElement(t.get(se,a,d.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(a))})]}))})},Pe={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},$e=({property:s,onChange:n})=>{const r=L(s),l=m.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:i}=m.useContext($),[c,a]=m.useState([]),[x,u]=m.useState({color:"",shade:""}),g=l.split("-"),f=t.get(g,"1",""),p=t.get(g,"2",""),b=m.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(a([]),u({color:y})):(a(["50","100","200","300","400","500","600","700","800","900"]),u(v=>({...v,color:y,shade:v.shade?v.shade:"500"})))},[a,u]);m.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(f))return a([]);a(["50","100","200","300","400","500","600","700","800","900"])},[f]);const h=m.useCallback(y=>{u({color:f,shade:y})},[f]);return m.useEffect(()=>{u({color:"",shade:""})},[r]),m.useEffect(()=>{const v=`${t.get(Pe,s,"")}-${x.color}${x.shade?`-${x.shade}`:""}`;v.match(new RegExp(t.get(B.CLASSES_LIST,`${s}.regExp`,"")))&&n(v,s)},[x,n,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(X,{disabled:!i,rounded:!0,selected:f,onChange:b,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(X,{rounded:!0,selected:p,disabled:!f||!i,onChange:h,options:c})})]})},Q=(s,n)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&n.includes(r))return{value:"",unit:r};const l=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;r=r.replace(l,"");const i=s.match(l),c=i&&i.length>1,a=!t.isEmpty(r)&&Number.isNaN(Number(r));return c||a?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:r,unit:i?i[0]:""}};const Le=s=>{const n=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:`${n}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${n}${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:`${n}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${n}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const l=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[l,i]=t.map(r.split("/"),c=>parseInt(c,10));return{value:n+(l/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${n+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}};const Me=s=>{if(t.isEmpty(s))return{value:"",unit:""};const n=s.match(/\[.*\]/g);if(n===null)return qe(s);const r=t.get(n,"0","").replace(/\[|\]/g,""),l=s.startsWith("-")?"-":"",i=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${l}${i}`,unit:r.replace(i,"")}},qe=s=>t.isEmpty(s)?{value:"",unit:""}:Le(s),ne=m.createContext({setDragData:()=>{}}),Oe=({unit:s,currentValue:n,onDrag:r,onDragEnd:l,onDragStart:i,negative:c,cssProperty:a})=>{const{setDragData:x}=m.useContext(ne);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:u=>{const g={onDrag:r,onDragEnd:l,dragging:!0,dragStartY:u.pageY,dragStartValue:`${n}`,dragUnit:s,negative:c,cssProperty:a};i(g),x(g)},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,{})})},We=({onSelect:s,current:n,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(l=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===l?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(l)},children:l},l))}),ee=50,ze=s=>{const[n,r]=m.useState(!1),[l,i]=m.useState(""),{currentClass:c,onChange:a,classPrefix:x,cssProperty:u,units:g,negative:f}=s,[p,b]=m.useState(u!=null&&u.toLowerCase().includes("width")?"%":g[0]),[h,y]=m.useState(!1),[v,w]=m.useState(""),[I,E]=m.useState(!1),[T,_]=m.useState(!1);m.useEffect(()=>{const{value:j,unit:R}=Me(c);if(R===""){i(j),b(u!=null&&u.toLowerCase().includes("width")?"%":t.first(g));return}b(R),i(R==="class"||t.isEmpty(j)?"":j)},[c,u,g]);const C=z.useThrottledCallback(j=>a(j),[a],ee),S=z.useThrottledCallback(j=>a(j,!1),[a],ee),V=m.useCallback((j=!1)=>{const R=Q(`${l}`,g);if(t.get(R,"error",!1)){y(!0);return}const k=t.get(R,"unit")!==""?t.get(R,"unit"):p;if(k==="auto"||k==="none"){C(`${x}${k}`);return}if(t.get(R,"value")==="")return;const P=`${t.get(R,"value","").startsWith("-")?"-":""}${x}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;j?S(P):C(P)},[C,S,l,p,x,g]),D=m.useCallback(j=>{const R=Q(`${l}`,g);if(t.get(R,"error",!1)){y(!0);return}if(j==="auto"||j==="none"){C(`${x}${j}`);return}if(t.get(R,"value")==="")return;const k=t.get(R,"unit")!==""?t.get(R,"unit"):j,P=`${t.get(R,"value","").startsWith("-")?"-":""}${x}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;C(P)},[C,l,x,g]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:p==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:c}),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 ${I?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(p)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:p==="class",onKeyPress:j=>{j.key==="Enter"&&V()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),_(!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 H=`${k}`,le=`${H.startsWith("-")?"-":""}${x}[${H.replace("-","")}${p==="-"?"":p}]`;S(le)},onKeyUp:j=>{T&&(j.preventDefault(),_(!1))},onBlur:()=>V(),onChange:j=>{y(!1),i(j.target.value)},onClick:j=>{var R;(R=j==null?void 0:j.target)==null||R.select(),r(!1)},value:I?v:l,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",h?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:n,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!n),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 ${g.length===1?"px-2 font-semibold":""}`,children:p}),g.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(We,{units:g,current:p,onSelect:j=>{r(!1),b(j),D(j)}})})})]})]}),["none","auto"].indexOf(p)!==-1||I?null:e.jsxRuntimeExports.jsx(Oe,{onDragStart:()=>E(!0),onDragEnd:j=>{if(w(()=>""),E(!1),t.isEmpty(j))return;const R=`${j}`,H=`${R.startsWith("-")?"-":""}${x}[${R.replace("-","")}${p==="-"?"":p}]`;C(H)},onDrag:j=>{if(t.isEmpty(j))return;w(j);const R=`${j}`,H=`${R.startsWith("-")?"-":""}${x}[${R.replace("-","")}${p==="-"?"":p}]`;S(H)},currentValue:l,unit:p,negative:f,cssProperty:u})]})})})},L=s=>{const n=o.useSelectedBlockCurrentClasses();return t.findLast(n,{property:s})},Ye=(s,n)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[n]},Fe={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-"},te={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Xe=s=>`${s.toUpperCase()} ${te[s]?`(${te[s]} & up)`:""}`,U=s=>{const{t:n}=A.useTranslation(),{type:r="icons",label:l,property:i,onEmitChange:c=()=>{},units:a,negative:x=!1}=s,[u]=o.useDarkMode(),[g]=o.useStylingState(),[,f]=o.useCanvasWidth(),p=L(i),b=o.useAddClassesToBlocks(),h=o.useRemoveClassesFromBlocks(),[y]=o.useSelectedBlockIds(),v=m.useMemo(()=>t.get(p,"fullCls",""),[p]),w=m.useCallback((S,V=!0)=>{const D={dark:u,mq:f,mod:g,cls:S,property:i,fullCls:""};(u||g!=="")&&(D.mq="xs");const j=B.generateFullClsName(D);b(y,[j],V)},[y,u,f,g,i,b]),I=m.useCallback(()=>{h(y,[v])},[y,v,h]),E=m.useMemo(()=>Ye(p,f),[p,f]);m.useEffect(()=>{c(E,p)},[E,c,p]);const[,,T]=o.useCanvasWidth(),_=m.useCallback(S=>{T({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[S])},[T]),C=t.get(p,"dark",null)===u&&t.get(p,"mod",null)===g&&t.get(p,"mq",null)===f;return e.jsxRuntimeExports.jsx(Ae,{canChange:E,canReset:p&&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] ${p&&!C?"text-foreground":""}`,children:n(l)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[r==="arbitrary"?e.jsxRuntimeExports.jsx(ze,{currentClass:t.get(p,"cls",""),classPrefix:t.get(Fe,i,""),units:a||[],onChange:w,negative:x,cssProperty:i}):null,r==="icons"&&e.jsxRuntimeExports.jsx(De,{property:i,onChange:w}),r==="range"&&e.jsxRuntimeExports.jsx(Be,{property:i,onChange:w}),r==="color"&&e.jsxRuntimeExports.jsx($e,{property:i,onChange:w}),r==="dropdown"&&e.jsxRuntimeExports.jsx(oe,{label:l,property:i,onChange:w})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${v?"visible":"invisible"}`,children:C?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>I(),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"})}):E&&p?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:[Xe(t.get(p,"mq")),u&&!p.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>_(t.get(p,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(p,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Ze=["px","%","em","rem","ch","vh","vw"],ie=({label:s,options:n,borderB:r=!1,borderT:l=!1,type:i="arbitrary",units:c=Ze,negative:a=!1})=>{const{t:x}=A.useTranslation(),[u,g]=m.useState(n[0].key),f=o.useSelectedBlockCurrentClasses(),p=m.useCallback(b=>t.map(f,"property").includes(b),[f]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:x(s)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:m.Children.toArray(n.map(({label:b,key:h})=>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:()=>g(h),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${h===u?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[m.createElement("div",{className:p(h)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),m.createElement(t.get(se,h,d.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(b))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(U,{type:i,units:[...c],label:"",property:u,negative:a})})]})},Ue=({heading:s,items:n})=>{const{t:r}=A.useTranslation(),l=o.useSelectedBlockCurrentClasses(),i=m.useMemo(()=>{const c=u=>t.flatten(u.map(g=>g.styleType==="multiple"?t.map(g.options,"key"):g.property)),a=t.flatten(n.map(u=>u.styleType==="accordion"?c(u.items):u.styleType==="multiple"?t.map(u.options,"key"):u.property)),x=t.map(l,"property");return t.intersection(a,x).length>0},[l,n]);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),i?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(c=>c.styleType==="multiple"?e.jsxRuntimeExports.jsx(ie,{...c},c.label):e.jsxRuntimeExports.jsx(U,{...c},c.label))})]})},Ke=m.createContext({}),W=({section:s})=>{const{t:n}=A.useTranslation(),r=o.useSelectedBlockCurrentClasses(),l=m.useCallback((a=[])=>{const x={};for(let g=0;g<r.length;g++)x[r[g].property]=r[g].cls;let u=!0;for(const g in a)if(!t.has(x,g)||x[g]!==a[g]){u=!1;break}return u},[r]),i=m.useMemo(()=>{if(r.length>0&&s.heading==="classes.heading")return!0;const a=g=>t.flatten(g.map(f=>f.styleType==="multiple"?t.flatten(t.map(f.options,"key")):f.property)),x=t.flatten(s.items.map(g=>g.styleType==="accordion"?a(g.items):g.styleType==="multiple"?t.flatten(t.map(g.options,"key")):g.property)),u=t.map(r,"property");return t.intersection(x,u).length>0},[r,s.heading,s.items]),c=m.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Ke.Provider,{value:c,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 ${i?"bg-blue-500":"bg-gray-300"}`}),n(s.heading)]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:m.Children.toArray(s.items.map(a=>t.has(a,"component")?m.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(ie,{...a},a.label):a.styleType==="accordion"&&l(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(Ue,{...a},a.label):null:e.jsxRuntimeExports.jsx(U,{...a},a.label)))})]})})},Ge=({item:s,index:n,canDelete:r,onChange:l,onRemove:i})=>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:c=>l(c,n),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:c=>t.isEmpty(s.key)?{}:l(c,n),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:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),Je=({section:s})=>{var b;const{setSyncState:n}=o.useSavePage(),r=o.useSelectedBlock(),[l,i]=m.useState([]),[c]=o.useSelectedStylingBlocks(),a=o.useUpdateBlocksPropsRealtime(),x=`${t.get(c,"0.prop")}_attrs`;M.useEffect(()=>{const h=t.map(t.get(r,x),(y,v)=>({key:v,value:y}));t.isEmpty(h)?i([]):i(h)},[t.get(r,x)]);const u=()=>i([...l,{key:"",value:""}]),g=h=>{const y=t.filter(l,(v,w)=>h!==w);p(y)},f=(h,y)=>{const v=[...l];v[y][h.target.name]=h.target.value,p(v)},p=M.useCallback((h=[])=>{const y={};t.forEach(h,v=>{t.isEmpty(v.key)||t.set(y,v.key,v.value)}),a([t.get(r,"_id")],{[x]:y}),n("UNSAVED")},[r,n,a,x]);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,x))?"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(l)&&t.isEmpty((b=t.last(l))==null?void 0:b.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 h;!t.isEmpty(l)&&t.isEmpty((h=t.last(l))==null?void 0:h.key)||u()},children:[e.jsxRuntimeExports.jsx(d.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(l)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),M.Children.toArray(t.map(l,(h,y)=>{const v=l.length>0&&y<l.length-1;return e.jsxRuntimeExports.jsx(Ge,{item:h,index:y,canDelete:v,onChange:f,onRemove:()=>g(y)})}))]})]})})]})};function Qe(){const[s,n]=o.useStylingState(),{flexChild:r,gridChild:l}=o.useSelectedBlocksDisplayChild(),[,i]=be.useAtom(o.advanceStylingOpenAtom),{t:c}=A.useTranslation(),[a]=o.useSelectedStylingBlocks();return t.isEmpty(a)?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:c("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>i(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b h-12 border-border 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:x=>n(x),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"})]})]})]})}),e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar -mx-1 flex-1 max-h-full overflow-y-hidden overflow-x-hidden",children:e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(W,{section:_e}),l?e.jsxRuntimeExports.jsx(W,{section:He}):null,Ve.map(x=>e.jsxRuntimeExports.jsx(W,{section:x},x.heading)),e.jsxRuntimeExports.jsx(Je,{section:{heading:"Attributes"}})]})})]})}const et={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},tt=()=>{const s=o.useSelectedBlock(),{t:n}=A.useTranslation(),[r,l]=m.useState(""),[i,c]=m.useState({onDrag:u=>u,onDragEnd:u=>u,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),a=z.useThrottledCallback(u=>{const g=!t.get(i,"negative",!1),f=t.get(i,"cssProperty","");let p=parseFloat(i.dragStartValue);p=t.isNaN(p)?0:p;let b=et[i.dragUnit];(t.startsWith(f,"scale")||f==="opacity")&&(b=10);let y=(i.dragStartY-u.pageY)/b+p;g&&y<0&&(y=0),f==="opacity"&&y>1&&(y=1),i.onDrag(`${y}`),l(`${y}`)},[i],50),x=m.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${r}`),100),c({onDrag:u=>u,onDragEnd:u=>u,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,r,c]);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:n("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(q.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ne.Provider,{value:{setDragData:c},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:a,onMouseUp:()=>x(),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:n("settings")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:n("styling")})]}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar -mx-1 pb-5 flex-1 max-h-full overflow-y-hidden overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Te,{})})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"flex-1 h-full overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Qe,{})})]})]})})};exports.default=tt;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-
|
|
2
|
-
import { PlusIcon as V, Half2Icon as
|
|
3
|
-
import
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import {
|
|
6
|
-
import { ak as U, al as $, am as q, an as G, ao as Y, D as Z, E as Q, F as W, G as X, H as ee, I as se, J as re, K as ae, ap as le, s as ie, t as te, aq as oe, ar as ne, as as ce, at as de, au as
|
|
7
|
-
import { ListTreeIcon as
|
|
8
|
-
import { getChaiDataProviders as
|
|
9
|
-
import { useTranslation as
|
|
10
|
-
import { E as
|
|
11
|
-
import {
|
|
12
|
-
import "./
|
|
1
|
+
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import { PlusIcon as V, Half2Icon as H } from "@radix-ui/react-icons";
|
|
3
|
+
import x, { useState as p, useEffect as I, useMemo as L, lazy as y, Suspense as j } from "react";
|
|
4
|
+
import { useAtom as E } from "jotai";
|
|
5
|
+
import { filter as g, map as P, isNull as M, find as F, isEmpty as O, each as R, get as J } from "lodash-es";
|
|
6
|
+
import { ak as U, al as $, am as q, an as G, ao as Y, D as Z, E as Q, F as W, G as X, H as ee, I as se, J as re, K as ae, ap as le, s as ie, t as te, aq as oe, ar as ne, as as ce, at as de, au as S, i as k, av as me, B as b, S as T, aw as xe, ax as pe, ay as _, az as z } from "./index-_OgCuSUz.js";
|
|
7
|
+
import { ListTreeIcon as C, DatabaseIcon as ue } from "lucide-react";
|
|
8
|
+
import { getChaiDataProviders as he } from "@chaibuilder/runtime";
|
|
9
|
+
import { useTranslation as A } from "react-i18next";
|
|
10
|
+
import { E as fe } from "./index-QEchoZ98.js";
|
|
11
|
+
import { c as ve } from "./Functions-7jnEwJyw.js";
|
|
12
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
13
13
|
import "@radix-ui/react-toggle";
|
|
14
14
|
import "class-variance-authority";
|
|
15
|
+
import "./utils-AvyFzbPC.js";
|
|
16
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
17
|
+
import "clsx";
|
|
18
|
+
import "tailwind-merge";
|
|
15
19
|
import "@radix-ui/react-switch";
|
|
16
20
|
import "@radix-ui/react-slot";
|
|
17
21
|
import "@radix-ui/react-accordion";
|
|
@@ -37,7 +41,6 @@ import "flat-to-nested";
|
|
|
37
41
|
import "redux-undo";
|
|
38
42
|
import "@react-hookz/web";
|
|
39
43
|
import "i18next";
|
|
40
|
-
import "clsx";
|
|
41
44
|
import "@floating-ui/react-dom";
|
|
42
45
|
import "react-textarea-autosize";
|
|
43
46
|
import "flagged";
|
|
@@ -45,14 +48,14 @@ import "react-dnd";
|
|
|
45
48
|
import "@minoru/react-dnd-treeview";
|
|
46
49
|
import "react-hotkeys-hook";
|
|
47
50
|
import "sonner";
|
|
48
|
-
import "./html-to-json-
|
|
51
|
+
import "./html-to-json-xKBERAI1.js";
|
|
49
52
|
import "himalaya";
|
|
50
|
-
import "
|
|
51
|
-
const
|
|
52
|
-
const { t: a } =
|
|
53
|
-
return
|
|
54
|
-
r && (r.mockFn ? r.mockFn : r.dataFn)().then((
|
|
55
|
-
}, [r]), r ? /* @__PURE__ */ e.jsx(U, { onOpenChange: (
|
|
53
|
+
import "lodash";
|
|
54
|
+
const je = x.lazy(() => import("react-json-view")), ge = ({ provider: r, onClose: t }) => {
|
|
55
|
+
const { t: a } = A(), [i, u] = p(null);
|
|
56
|
+
return I(() => {
|
|
57
|
+
r && (r.mockFn ? r.mockFn : r.dataFn)().then((o) => u(o));
|
|
58
|
+
}, [r]), r ? /* @__PURE__ */ e.jsx(U, { onOpenChange: (n) => n ? "" : t(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs($, { children: [
|
|
56
59
|
/* @__PURE__ */ e.jsxs(q, { children: [
|
|
57
60
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
58
61
|
a("data_provider"),
|
|
@@ -61,8 +64,8 @@ const ge = p.lazy(() => import("react-json-view")), be = ({ provider: r, onClose
|
|
|
61
64
|
] }),
|
|
62
65
|
/* @__PURE__ */ e.jsx(Y, { children: r.description })
|
|
63
66
|
] }),
|
|
64
|
-
/* @__PURE__ */ e.jsx(
|
|
65
|
-
|
|
67
|
+
/* @__PURE__ */ e.jsx(fe, { children: /* @__PURE__ */ e.jsx(
|
|
68
|
+
je,
|
|
66
69
|
{
|
|
67
70
|
style: { maxHeight: "80vh", overflowY: "auto" },
|
|
68
71
|
name: r.providerKey,
|
|
@@ -74,12 +77,12 @@ const ge = p.lazy(() => import("react-json-view")), be = ({ provider: r, onClose
|
|
|
74
77
|
) })
|
|
75
78
|
] }) }) : null;
|
|
76
79
|
};
|
|
77
|
-
function
|
|
80
|
+
function be({
|
|
78
81
|
children: r,
|
|
79
82
|
name: t,
|
|
80
83
|
onRemove: a
|
|
81
84
|
}) {
|
|
82
|
-
const { t: i } =
|
|
85
|
+
const { t: i } = A();
|
|
83
86
|
return /* @__PURE__ */ e.jsxs(Z, { children: [
|
|
84
87
|
/* @__PURE__ */ e.jsx(Q, { asChild: !0, children: r }),
|
|
85
88
|
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
@@ -94,18 +97,18 @@ function ye({
|
|
|
94
97
|
] })
|
|
95
98
|
] });
|
|
96
99
|
}
|
|
97
|
-
const
|
|
98
|
-
const { t: r } =
|
|
99
|
-
g(t, (s) =>
|
|
100
|
-
), [w, f] =
|
|
101
|
-
t.map((s) =>
|
|
102
|
-
(s) => !
|
|
103
|
-
),
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
},
|
|
100
|
+
const ye = () => {
|
|
101
|
+
const { t: r } = A(), t = L(() => he(), []), [a, i] = ie(), [, u] = E(te), [n, o] = p(
|
|
102
|
+
g(t, (s) => P(a, "providerKey").includes(s.providerKey))
|
|
103
|
+
), [w, f] = p(""), [c, v] = p(null), N = g(
|
|
104
|
+
t.map((s) => P(n, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
105
|
+
(s) => !M(s)
|
|
106
|
+
), l = (s) => {
|
|
107
|
+
const m = F(t, { providerKey: s });
|
|
108
|
+
o((d) => [...d, m]), i((d) => [...d, { providerKey: m.providerKey, args: {} }]), f(""), u("UNSAVED");
|
|
109
|
+
}, h = (s) => {
|
|
110
|
+
o((m) => g(m, (d) => d.providerKey !== s.providerKey)), i((m) => g(m, (d) => d.providerKey !== s.providerKey)), u("UNSAVED");
|
|
111
|
+
}, B = (s) => v(s);
|
|
109
112
|
return O(t) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "text-gray-500 mb-1.5 text-xs p-4", children: [
|
|
110
113
|
r("no_data_providers"),
|
|
111
114
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -113,20 +116,20 @@ const we = () => {
|
|
|
113
116
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
114
117
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
115
118
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 mb-1.5 text-xs", children: r("add_data_providers") }) }),
|
|
116
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) =>
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) => l(s), children: [
|
|
117
120
|
/* @__PURE__ */ e.jsx(ne, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: r("select_provider") }) }),
|
|
118
121
|
/* @__PURE__ */ e.jsxs(de, { children: [
|
|
119
|
-
/* @__PURE__ */ e.jsx(
|
|
120
|
-
N.map((s) => /* @__PURE__ */ e.jsx(
|
|
122
|
+
/* @__PURE__ */ e.jsx(S, { value: "", children: r("choose") }),
|
|
123
|
+
N.map((s) => /* @__PURE__ */ e.jsx(S, { value: s.value, children: s.label }, s.value))
|
|
121
124
|
] })
|
|
122
125
|
] }) }),
|
|
123
126
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
124
|
-
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${
|
|
127
|
+
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${n.length ? "block" : "hidden"}`, children: [
|
|
125
128
|
/* @__PURE__ */ e.jsxs("p", { className: "text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium", children: [
|
|
126
129
|
r("page_data_providers"),
|
|
127
130
|
":"
|
|
128
131
|
] }),
|
|
129
|
-
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children:
|
|
132
|
+
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: n.map((s) => /* @__PURE__ */ e.jsxs(
|
|
130
133
|
"div",
|
|
131
134
|
{
|
|
132
135
|
className: "rounded-lg border bg-card text-card-foreground shadow-sm w-full",
|
|
@@ -140,7 +143,7 @@ const we = () => {
|
|
|
140
143
|
/* @__PURE__ */ e.jsxs(
|
|
141
144
|
"button",
|
|
142
145
|
{
|
|
143
|
-
onClick: () =>
|
|
146
|
+
onClick: () => B(s),
|
|
144
147
|
className: "inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",
|
|
145
148
|
children: [
|
|
146
149
|
/* @__PURE__ */ e.jsxs(
|
|
@@ -166,7 +169,7 @@ const we = () => {
|
|
|
166
169
|
]
|
|
167
170
|
}
|
|
168
171
|
),
|
|
169
|
-
/* @__PURE__ */ e.jsx(
|
|
172
|
+
/* @__PURE__ */ e.jsx(be, { onRemove: () => h(s), name: s.name, children: /* @__PURE__ */ e.jsxs("button", { className: "inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500", children: [
|
|
170
173
|
/* @__PURE__ */ e.jsxs(
|
|
171
174
|
"svg",
|
|
172
175
|
{
|
|
@@ -194,27 +197,27 @@ const we = () => {
|
|
|
194
197
|
},
|
|
195
198
|
s.providerKey
|
|
196
199
|
)) }),
|
|
197
|
-
/* @__PURE__ */ e.jsx(
|
|
200
|
+
/* @__PURE__ */ e.jsx(ge, { onClose: () => v(null), provider: c })
|
|
198
201
|
] })
|
|
199
202
|
] });
|
|
200
|
-
},
|
|
201
|
-
let
|
|
202
|
-
const
|
|
203
|
-
const r =
|
|
204
|
-
"add-blocks":
|
|
205
|
-
layers:
|
|
206
|
-
"branding-options":
|
|
207
|
-
images:
|
|
203
|
+
}, we = y(() => import("./AddBlocks-QvCc-oag.js")), D = y(() => import("./Layers-no2keK4N.js")), Ne = y(() => import("./BrandingOptions-mZXO7thQ.js")), ke = y(() => import("./index-_OgCuSUz.js").then((r) => r.cw));
|
|
204
|
+
let K = null;
|
|
205
|
+
const ks = () => {
|
|
206
|
+
const r = k("sideBarComponents.top", []), t = k("sideBarComponents.bottom", []), [a, i] = E(me), [u, n] = p(a), [o, w] = p(null), f = {
|
|
207
|
+
"add-blocks": we,
|
|
208
|
+
layers: D,
|
|
209
|
+
"branding-options": Ne,
|
|
210
|
+
images: ke
|
|
208
211
|
};
|
|
209
212
|
R(r, ({ name: l, panel: h }) => {
|
|
210
213
|
f[l] = h;
|
|
211
214
|
});
|
|
212
215
|
const c = (l) => {
|
|
213
|
-
clearTimeout(
|
|
214
|
-
},
|
|
215
|
-
function
|
|
216
|
+
clearTimeout(K), a !== "layers" && l === "layers" ? K = setTimeout(() => i("layers"), 500) : n(l), i(l);
|
|
217
|
+
}, v = k("dataBindingSupport", !1);
|
|
218
|
+
function N() {
|
|
216
219
|
const l = setTimeout(() => {
|
|
217
|
-
|
|
220
|
+
o && (c("layers"), clearTimeout(o));
|
|
218
221
|
}, 500);
|
|
219
222
|
w(l);
|
|
220
223
|
}
|
|
@@ -222,7 +225,7 @@ const ws = () => {
|
|
|
222
225
|
a !== "layers" ? /* @__PURE__ */ e.jsx(
|
|
223
226
|
"div",
|
|
224
227
|
{
|
|
225
|
-
onMouseEnter:
|
|
228
|
+
onMouseEnter: N,
|
|
226
229
|
onClick: () => c("layers"),
|
|
227
230
|
className: "fixed inset-0 bg-black/20 z-[50]"
|
|
228
231
|
}
|
|
@@ -246,7 +249,7 @@ const ws = () => {
|
|
|
246
249
|
onClick: () => c("layers"),
|
|
247
250
|
size: "sm",
|
|
248
251
|
variant: a === "layers" ? "default" : "outline",
|
|
249
|
-
children: /* @__PURE__ */ e.jsx(
|
|
252
|
+
children: /* @__PURE__ */ e.jsx(C, { className: "w-4" })
|
|
250
253
|
}
|
|
251
254
|
),
|
|
252
255
|
/* @__PURE__ */ e.jsx(
|
|
@@ -255,11 +258,11 @@ const ws = () => {
|
|
|
255
258
|
onClick: () => c("branding-options"),
|
|
256
259
|
size: "sm",
|
|
257
260
|
variant: a === "branding-options" ? "default" : "outline",
|
|
258
|
-
children: /* @__PURE__ */ e.jsx(
|
|
261
|
+
children: /* @__PURE__ */ e.jsx(H, { className: "w-4 max-w-[40px] text-xs" })
|
|
259
262
|
}
|
|
260
263
|
),
|
|
261
|
-
|
|
262
|
-
r.map(({ name: l, icon: h }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(
|
|
264
|
+
x.Children.toArray(
|
|
265
|
+
r.map(({ name: l, icon: h }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(T, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
263
266
|
b,
|
|
264
267
|
{
|
|
265
268
|
onClick: () => c(l),
|
|
@@ -271,8 +274,8 @@ const ws = () => {
|
|
|
271
274
|
) }))
|
|
272
275
|
)
|
|
273
276
|
] }),
|
|
274
|
-
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children:
|
|
275
|
-
t.map((l) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(
|
|
277
|
+
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: x.Children.toArray(
|
|
278
|
+
t.map((l) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(T, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(l, {}) }))
|
|
276
279
|
) })
|
|
277
280
|
] }),
|
|
278
281
|
/* @__PURE__ */ e.jsx(
|
|
@@ -290,14 +293,14 @@ const ws = () => {
|
|
|
290
293
|
children: /* @__PURE__ */ e.jsx(
|
|
291
294
|
"div",
|
|
292
295
|
{
|
|
293
|
-
className:
|
|
296
|
+
className: ve(
|
|
294
297
|
"relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",
|
|
295
298
|
a === "layers" ? "" : "z-[100]"
|
|
296
299
|
),
|
|
297
300
|
onMouseEnter: () => {
|
|
298
|
-
|
|
301
|
+
o && clearTimeout(o);
|
|
299
302
|
},
|
|
300
|
-
children:
|
|
303
|
+
children: x.createElement(J(f, a, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
301
304
|
}
|
|
302
305
|
)
|
|
303
306
|
}
|
|
@@ -312,30 +315,30 @@ const ws = () => {
|
|
|
312
315
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
313
316
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
314
317
|
] }),
|
|
315
|
-
children:
|
|
316
|
-
/* @__PURE__ */ e.jsxs(
|
|
317
|
-
/* @__PURE__ */ e.jsxs(
|
|
318
|
-
/* @__PURE__ */ e.jsx(
|
|
318
|
+
children: v ? /* @__PURE__ */ e.jsxs(xe, { defaultValue: "layers", className: "flex h-full w-full flex-col py-1", children: [
|
|
319
|
+
/* @__PURE__ */ e.jsxs(pe, { className: "mx-1 h-10 grid grid-cols-2", children: [
|
|
320
|
+
/* @__PURE__ */ e.jsxs(_, { value: "layers", children: [
|
|
321
|
+
/* @__PURE__ */ e.jsx(C, { className: "h-3 mr-2" }),
|
|
319
322
|
" Layers"
|
|
320
323
|
] }),
|
|
321
|
-
/* @__PURE__ */ e.jsxs(
|
|
322
|
-
/* @__PURE__ */ e.jsx(
|
|
324
|
+
/* @__PURE__ */ e.jsxs(_, { value: "data-provider", children: [
|
|
325
|
+
/* @__PURE__ */ e.jsx(ue, { className: "w-3 mr-2" }),
|
|
323
326
|
"Data"
|
|
324
327
|
] })
|
|
325
328
|
] }),
|
|
326
|
-
/* @__PURE__ */ e.jsx(
|
|
327
|
-
/* @__PURE__ */ e.jsx(
|
|
329
|
+
/* @__PURE__ */ e.jsx(z, { value: "layers", className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: x.createElement(D) }),
|
|
330
|
+
/* @__PURE__ */ e.jsx(z, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ye, {}) })
|
|
328
331
|
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
329
332
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center bg-gray-200 rounded-md py-1", children: [
|
|
330
|
-
/* @__PURE__ */ e.jsx(
|
|
333
|
+
/* @__PURE__ */ e.jsx(C, { className: "h-4 mr-2 ml-2" }),
|
|
331
334
|
" Layers"
|
|
332
335
|
] }),
|
|
333
|
-
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children:
|
|
336
|
+
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: x.createElement(D) })
|
|
334
337
|
] })
|
|
335
338
|
}
|
|
336
339
|
) })
|
|
337
340
|
] });
|
|
338
341
|
};
|
|
339
342
|
export {
|
|
340
|
-
|
|
343
|
+
ks as default
|
|
341
344
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var S=Object.create;var q=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var z=(r,o,i,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let x of T(o))!A.call(r,x)&&x!==i&&q(r,x,{get:()=>o[x],enumerable:!(l=P(o,x))||l.enumerable});return r};var _=(r,o,i)=>(i=r!=null?S(D(r)):{},z(o||!r||!r.__esModule?q(i,"default",{value:r,enumerable:!0}):i,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("@radix-ui/react-icons"),n=require("react"),k=require("jotai"),u=require("lodash-es"),s=require("./index-IIJ_o44s.cjs"),E=require("lucide-react"),B=require("@chaibuilder/runtime"),y=require("react-i18next"),K=require("./index-hMoPNZVn.cjs"),I=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-dfALTAdG.cjs");require("himalaya");require("lodash");const V=n.lazy(()=>import("react-json-view")),L=({provider:r,onClose:o})=>{const{t:i}=y.useTranslation(),[l,x]=n.useState(null);return n.useEffect(()=>{r&&(r.mockFn?r.mockFn:r.dataFn)().then(c=>x(c))},[r]),r?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:d=>d?"":o(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[i("data_provider"),": ",r.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:r.description})]}),e.jsxRuntimeExports.jsx(K.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(V,{style:{maxHeight:"80vh",overflowY:"auto"},name:r.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:l})})]})}):null};function M({children:r,name:o,onRemove:i}){const{t:l}=y.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:r}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{children:l("remove_provider_confirmation",{name:o})}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:i,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const F=()=>{const{t:r}=y.useTranslation(),o=n.useMemo(()=>B.getChaiDataProviders(),[]),[i,l]=s.usePageDataProviders(),[,x]=k.useAtom(s.pageSyncStateAtom),[d,c]=n.useState(u.filter(o,t=>u.map(i,"providerKey").includes(t.providerKey))),[g,v]=n.useState(""),[m,f]=n.useState(null),R=u.filter(o.map(t=>u.map(d,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!u.isNull(t)),a=t=>{const p=u.find(o,{providerKey:t});c(j=>[...j,p]),l(j=>[...j,{providerKey:p.providerKey,args:{}}]),v(""),x("UNSAVED")},h=t=>{c(p=>u.filter(p,j=>j.providerKey!==t.providerKey)),l(p=>u.filter(p,j=>j.providerKey!==t.providerKey)),x("UNSAVED")},C=t=>f(t);return u.isEmpty(o)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",children:[r("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:r("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:r("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:g,onValueChange:t=>a(t),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:r("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:r("choose")}),R.map(t=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${d.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:[r("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:d.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","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 justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>C(t),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",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:"w-4 h-4 mr-2",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"})]}),r("view_data")]}),e.jsxRuntimeExports.jsx(M,{onRemove:()=>h(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",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:"w-4 h-4 mr-2",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"})]}),r("remove")]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(L,{onClose:()=>f(null),provider:m})]})]})},H=n.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-57-vroWk.cjs"))),b=n.lazy(()=>Promise.resolve().then(()=>require("./Layers-x_mWeT_q.cjs"))),O=n.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-arKT1zCy.cjs"))),U=n.lazy(()=>Promise.resolve().then(()=>require("./index-IIJ_o44s.cjs")).then(r=>r.ImagesPanel));let N=null;const $=()=>{const r=s.useBuilderProp("sideBarComponents.top",[]),o=s.useBuilderProp("sideBarComponents.bottom",[]),[i,l]=k.useAtom(s.activePanelAtom),[x,d]=n.useState(i),[c,g]=n.useState(null),v={"add-blocks":H,layers:b,"branding-options":O,images:U};u.each(r,({name:a,panel:h})=>{v[a]=h});const m=a=>{clearTimeout(N),i!=="layers"&&a==="layers"?N=setTimeout(()=>l("layers"),500):d(a),l(a)},f=s.useBuilderProp("dataBindingSupport",!1);function R(){const a=setTimeout(()=>{c&&(m("layers"),clearTimeout(c))},500);g(a)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex ",children:[i!=="layers"?e.jsxRuntimeExports.jsx("div",{onMouseEnter:R,onClick:()=>m("layers"),className:"fixed inset-0 bg-black/20 z-[50]"}):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:i==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m("layers"),size:"sm",variant:i==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m("branding-options"),size:"sm",variant:i==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),n.Children.toArray(r.map(({name:a,icon:h})=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>m(a),size:"sm",className:"w-10",variant:i===a?"default":"outline",children:e.jsxRuntimeExports.jsx(h,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:n.Children.toArray(o.map(a=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(a,{})})))})]}),e.jsxRuntimeExports.jsx("div",{className:`absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${i!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(n.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",i==="layers"?"":"z-[100]"),onMouseEnter:()=>{c&&clearTimeout(c)},children:n.createElement(u.get(v,i,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(n.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:f?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"layers",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:n.createElement(b)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(F,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center bg-gray-200 rounded-md py-1",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"h-4 mr-2 ml-2"})," Layers"]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:n.createElement(b)})]})})})]})};exports.default=$;
|