@chaibuilder/sdk 1.2.23 → 1.2.25
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/README.md +6 -5
- package/dist/AddBlocks-Ol3iIVKa.js +207 -0
- package/dist/AddBlocks-a1c-7Ewz.cjs +1 -0
- package/dist/BrandingOptions-6rnt0UaA.cjs +1 -0
- package/dist/{BrandingOptions-eUSoIgjj.js → BrandingOptions-iTyWpwTs.js} +40 -54
- package/dist/CanvasArea-R4ogF9AT.cjs +55 -0
- package/dist/{CanvasArea-ulUy_rmB.js → CanvasArea-dZjng782.js} +340 -324
- package/dist/ChaiBuilderEditor-m30yoOgJ.cjs +163 -0
- package/dist/ChaiBuilderEditor-vP4at00I.js +27974 -0
- package/dist/{Class-lGzsNBOK.js → Class-ahc3NIbq.js} +26 -29
- package/dist/Class-eieto7e-.cjs +1 -0
- package/dist/Controls-3Cc1XYXg.js +105 -0
- package/dist/Controls-ky25Ebo3.cjs +1 -0
- package/dist/CurrentPage-3gQTH0Zt.cjs +1 -0
- package/dist/{CurrentPage-SFhXzQMy.js → CurrentPage-Kmfp-kFk.js} +41 -55
- package/dist/Functions-Hvon6AMZ.cjs +1 -0
- package/dist/Functions-NzT2Six_.js +15 -0
- package/dist/ImagesPanel-J1RlG7xG.cjs +1 -0
- package/dist/ImagesPanel-Wb0GF_NA.js +29 -0
- package/dist/ListTree-CZ-mtjZ9.cjs +1 -0
- package/dist/{ListTree-ZeVWczTF.js → ListTree-N3jeD790.js} +92 -102
- package/dist/{MODIFIERS-dytZ-osO.js → MODIFIERS-CNqNUapY.js} +10 -4
- package/dist/MODIFIERS-o1p3VnpS.cjs +1 -0
- package/dist/PagesPanel-Gi0z6gaf.cjs +1 -0
- package/dist/PagesPanel-u1IB-nRr.js +48 -0
- package/dist/ProjectPanel-EydGZmMW.js +71 -0
- package/dist/ProjectPanel-kiiljG4H.cjs +1 -0
- package/dist/{STRINGS--j49GZJP.js → STRINGS-b432aBJJ.js} +2 -2
- package/dist/Settings-8ilCSH8b.cjs +1 -0
- package/dist/{Settings-FZWm8Fc3.js → Settings-jCcd-VE6.js} +407 -401
- package/dist/SidePanels-T36C6Lhc.cjs +1 -0
- package/dist/{SidePanels-wrkkpcGE.js → SidePanels-pHMYprpW.js} +107 -117
- package/dist/Topbar-CvWQuspR.cjs +1 -0
- package/dist/Topbar-pbIDUE_B.js +122 -0
- package/dist/UnsplashImages-KBZPd9dv.cjs +1 -0
- package/dist/{UnsplashImages-eZedbK2J.js → UnsplashImages-L7x_3RQf.js} +50 -63
- package/dist/UploadImages-GkkJVAgG.cjs +1 -0
- package/dist/{UploadImages-71QziLbr.js → UploadImages-zdEJRLD8.js} +37 -60
- package/dist/accordion-oPUeqPCZ.js +42 -0
- package/dist/accordion-ynvFtV_p.cjs +1 -0
- package/dist/add-page-modal-9SGv2hgc.cjs +1 -0
- package/dist/add-page-modal-JCDXZIPW.js +95 -0
- package/dist/alert-dialog-P9xMMB6C.cjs +1 -0
- package/dist/alert-dialog-rypfO5ly.js +64 -0
- package/dist/badge-E-S7CqUt.cjs +1 -0
- package/dist/badge-tEwO7C51.js +23 -0
- package/dist/block-helpers-OKHmRRol.cjs +1 -0
- package/dist/block-helpers-oSFpSsGz.js +23 -0
- package/dist/command-BxR6jaCI.cjs +1 -0
- package/dist/command-Pn3HKDuV.js +97 -0
- package/dist/confirm-alert-uNm0lZ0y.cjs +1 -0
- package/dist/confirm-alert-wR5_VJ1l.js +36 -0
- package/dist/context-menu-8dC9uGXj.js +122 -0
- package/dist/context-menu-IgLbIuth.cjs +1 -0
- package/dist/{controls-OfJWSEqC.js → controls-IS5qnRce.js} +20 -85
- package/dist/controls-L7DPvB0m.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +7 -4
- package/dist/core.js +150 -75
- package/dist/{defaultTheme-D8B4-wHO.js → defaultTheme-4kA60XdB.js} +6 -8
- package/dist/defaultTheme-mrkeGFGI.cjs +1 -0
- package/dist/delete-page-modal-7KmP1elv.js +67 -0
- package/dist/delete-page-modal-SgfwvfNu.cjs +1 -0
- package/dist/dropdown-menu-El86_9Uo.js +124 -0
- package/dist/dropdown-menu-SiHzqWwZ.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +3 -292
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +5 -2
- package/dist/email.js +18 -37
- package/dist/{form-zKUMQFuB.js → form-0_RLz2TB.js} +12 -12
- package/dist/form-W58AVUdf.cjs +1 -0
- package/dist/hover-card-KUwpDkW8.cjs +1 -0
- package/dist/hover-card-q138xxXR.js +45 -0
- package/dist/{html-to-json-ngX9ef2u.js → html-to-json-2xtb7520.js} +41 -41
- package/dist/{html-to-json-efmv1pCj.cjs → html-to-json-uSnxl72F.cjs} +1 -1
- package/dist/iconBase-gbUAAO2L.cjs +1 -0
- package/dist/iconBase-h4DuR_XT.js +63 -0
- package/dist/index-9MmykVSc.cjs +1 -0
- package/dist/index-hElOGcFr.js +2200 -0
- package/dist/index-lDTsQp7h.js +188 -0
- package/dist/index-rq5Y9ZDy.cjs +1 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/label-KaP7MRrs.js +10 -0
- package/dist/label-tFm8HZdb.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +62 -66
- package/dist/link-WbcKdQ9k.cjs +1 -0
- package/dist/link-xuhP-4dN.js +196 -0
- package/dist/page-viewer-Hx5hxHKm.cjs +1 -0
- package/dist/{page-viewer-7AwzWRtB.js → page-viewer-NnOwmAmu.js} +44 -58
- package/dist/popover-a84pbVhQ.js +23 -0
- package/dist/popover-fKjgcRUx.cjs +1 -0
- package/dist/{project-general-setting-pYPoqvqd.js → project-general-setting-9ju3TDju.js} +35 -43
- package/dist/project-general-setting-FxkwjvJz.cjs +1 -0
- package/dist/{project-seo-setting-zXKOcjep.js → project-seo-setting-36CdUszM.js} +23 -40
- package/dist/project-seo-setting-RU7qiXxb.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +13 -14
- package/dist/scroll-area-FiHvy-TZ.cjs +1 -0
- package/dist/scroll-area-ewXbxc3n.js +30 -0
- package/dist/select-7bjg-rr9.cjs +1 -0
- package/dist/select-POGdEDHT.js +75 -0
- package/dist/separator-3Civ-6hb.cjs +1 -0
- package/dist/separator-SctTn0Qi.js +18 -0
- package/dist/single-page-detail-beY0MT1b.cjs +1 -0
- package/dist/{single-page-detail-q2TDxN-P.js → single-page-detail-hD1jKZ8k.js} +65 -73
- package/dist/skeleton-STeL9VrJ.cjs +1 -0
- package/dist/skeleton-lu8e7q2y.js +239 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +5 -2
- package/dist/studio.js +24 -40
- package/dist/tabs-_4WbA1cc.cjs +1 -0
- package/dist/tabs-yQ3oGziM.js +106 -0
- package/dist/textarea-1kZEh7ki.cjs +1 -0
- package/dist/textarea-b2QvVhrK.js +73 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +364 -159
- package/dist/useAddBlock-8pxOEYIl.cjs +1 -0
- package/dist/useAddBlock-FEKFJNwQ.js +69 -0
- package/dist/useChaiExternalData-fkFgoS80.js +6 -0
- package/dist/useChaiExternalData-rwoAZ6uU.cjs +1 -0
- package/dist/useDarkMode-7i57segK.cjs +1 -0
- package/dist/useDarkMode-8VHJlYyE.js +23 -0
- package/dist/useSelectedBreakpoints-6NK5qd7T.js +10 -0
- package/dist/useSelectedBreakpoints-7ONXb-vN.cjs +1 -0
- package/dist/useStylingState-Iuj84yvc.js +186 -0
- package/dist/useStylingState-OIvJMV6p.cjs +1 -0
- package/dist/useUiLibraries-nCdauJ4N.cjs +1 -0
- package/dist/useUiLibraries-psyWFbNc.js +12 -0
- package/dist/useUpdateBlocksProps-Unn8lUyj.cjs +1 -0
- package/dist/useUpdateBlocksProps-vWcDp-P9.js +23 -0
- package/dist/utils-dze1SGvB.js +6 -0
- package/dist/utils-qK_SjzzV.cjs +1 -0
- package/dist/web-blocks.cjs +1 -6
- package/dist/web-blocks.js +3 -1153
- package/package.json +1 -1
- package/dist/AddBlocks-b0Vk6eqO.js +0 -206
- package/dist/AddBlocks-bgu08YJC.cjs +0 -1
- package/dist/BrandingOptions-AljW1cXz.cjs +0 -1
- package/dist/CanvasArea-dp1tzDkK.cjs +0 -55
- package/dist/Class-PoYusiA5.cjs +0 -1
- package/dist/CurrentPage-rWHgPomd.cjs +0 -1
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/ListTree-5n8U4-IF.cjs +0 -1
- package/dist/MODIFIERS-0g14w5RS.cjs +0 -1
- package/dist/PagesPanel-IkZjy0Gn.js +0 -64
- package/dist/PagesPanel-sBN51kKZ.cjs +0 -1
- package/dist/ProjectPanel-e98TJLfI.js +0 -85
- package/dist/ProjectPanel-lbQH31jc.cjs +0 -1
- package/dist/Settings-qytQoyTv.cjs +0 -1
- package/dist/SidePanels-YRIM1IPq.cjs +0 -1
- package/dist/Topbar-LUyDFBkK.js +0 -129
- package/dist/Topbar-NOSnWo7V.cjs +0 -1
- package/dist/UnsplashImages-f-ObKOC-.cjs +0 -1
- package/dist/UploadImages-oOnccvT9.cjs +0 -1
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-g3fd00P5.cjs +0 -1
- package/dist/add-page-modal-yQ6qL6Ui.js +0 -104
- package/dist/confirm-alert-3flAvzWH.js +0 -60
- package/dist/confirm-alert-LQsGNYz8.cjs +0 -1
- package/dist/controls-KK2oLIa8.cjs +0 -1
- package/dist/defaultTheme-7VqqhOcp.cjs +0 -1
- package/dist/delete-page-modal-iMmkPec0.js +0 -83
- package/dist/delete-page-modal-tzZmqGzE.cjs +0 -1
- package/dist/empty-slot-ZBlsQi6m.js +0 -15
- package/dist/empty-slot-nzYOgZuS.cjs +0 -1
- package/dist/form-LBHtTduy.cjs +0 -1
- package/dist/index--dUsFH1I.cjs +0 -1
- package/dist/index-HD1UKc4P.js +0 -3079
- package/dist/index-YpnaudSM.js +0 -63
- package/dist/index-bOWwCMRF.cjs +0 -206
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-ecnGWzh9.cjs +0 -1
- package/dist/index-fvMaxES9.cjs +0 -1
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/index-m4WGov7e.js +0 -2202
- package/dist/index-uLtBNl55.js +0 -39503
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/page-viewer-5gTszT-n.cjs +0 -1
- package/dist/project-general-setting-52CTYL_w.cjs +0 -1
- package/dist/project-seo-setting-jTweI1DX.cjs +0 -1
- package/dist/single-page-detail-jy2SPcp1.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),m=require("react"),re=require("@react-hookz/web"),t=require("lodash-es"),M=require("react-i18next"),u=require("@radix-ui/react-icons"),ie=require("./scroll-area-FiHvy-TZ.cjs"),S=require("./tabs-_4WbA1cc.cjs"),C=require("./ChaiBuilderEditor-m30yoOgJ.cjs"),K=require("./useUpdateBlocksProps-Unn8lUyj.cjs"),f=require("./skeleton-STeL9VrJ.cjs"),ve=require("./controls-L7DPvB0m.cjs"),F=require("lucide-react"),J=require("./popover-fKjgcRUx.cjs"),P=require("./command-BxR6jaCI.cjs"),Y=require("@chaibuilder/runtime"),me=require("./useChaiExternalData-rwoAZ6uU.cjs"),Q=require("./index-rq5Y9ZDy.cjs"),V=require("./accordion-ynvFtV_p.cjs"),ae=require("./Controls-ky25Ebo3.cjs"),Ee=require("@rjsf/core"),we=require("@rjsf/validator-ajv8"),U=require("./link-WbcKdQ9k.cjs"),D=require("./useStylingState-OIvJMV6p.cjs"),Ce=require("react-autosuggest"),ke=require("fuse.js"),O=require("./Class-eieto7e-.cjs"),ge=require("./label-tFm8HZdb.cjs"),Ne=require("./STRINGS-gPz7CUOk.cjs"),ee=require("./useDarkMode-7i57segK.cjs"),k=require("./select-7bjg-rr9.cjs"),I=require("./dropdown-menu-SiHzqWwZ.cjs");require("@radix-ui/react-scroll-area");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-tabs");require("./MODIFIERS-o1p3VnpS.cjs");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./Functions-Hvon6AMZ.cjs");require("react-hotkeys-hook");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-popover");require("cmdk");require("@radix-ui/react-accordion");require("react-icons-picker");require("./ImagesPanel-J1RlG7xG.cjs");require("react-quill");require("@radix-ui/react-label");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");function Se(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(o,r,l.get?l:{enumerable:!0,get:()=>s[r]})}}return o.default=s,Object.freeze(o)}const G=Se(m);function Te(s){const o=[],r={};function l(n,p){t.forEach(p,(i,x)=>{const d=n?`${n}.${x}`:x,c=t.isArray(i)?"list":typeof i;o.push(d),r[d]=c==="string"?"text":c==="object"?"model":c,c==="object"&&!t.isArray(i)&&l(d,i)})}return l("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:r}}const oe=({data:s,fullView:o})=>{if(!s)return null;const r=typeof s;return o?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(C.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Q.JsonView,{data:s,shouldExpandNode:Q.allExpanded,style:{...Q.defaultStyles,container:"max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]}):e.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},pe=({type:s,value:o="",setValue:r,data:l,onChange:n,dataType:p,appliedBindings:i})=>{const{paths:x,pathsType:d}=Te(l),c=s==="PROP"?Y.getBlockComponent(l==null?void 0:l._type):{},y=s==="PROP",[a,h]=m.useState(!1),j=m.useMemo(()=>s==="PROP"?x.filter(g=>!t.includes(i,g)&&t.get(c,`props.${t.first(t.split(g,"."))}.binding`)):x.filter(g=>p===t.get(d,g,"")),[s,x,i,p,c]);return m.useEffect(()=>{o&&n(o)},[o,s]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(s))}),e.jsxRuntimeExports.jsxs(J.Popover,{open:a,onOpenChange:h,children:[e.jsxRuntimeExports.jsx(J.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(f.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(o)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[y&&e.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(p)}),o]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(J.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(P.Command,{children:[e.jsxRuntimeExports.jsx(P.CommandInput,{placeholder:`Choose ${t.toLower(s)}...`}),e.jsxRuntimeExports.jsxs(P.CommandList,{children:[e.jsxRuntimeExports.jsx(P.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(P.CommandGroup,{children:t.map(j,g=>e.jsxRuntimeExports.jsxs(P.CommandItem,{value:g,className:`cursor-pointer ${y?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:R=>{r(t.find(j,E=>E===R)||null),h(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(F.Check,{className:`h-4 w-4 text-green-500 ${o===g?"":"opacity-0"}`}),g]}),y?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(t.get(d,g,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(oe,{data:t.get(l,g)})})]},g))})]})]})})]})]}),!y&&!t.isEmpty(o)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(oe,{data:t.get(l,o,""),fullView:!0})})]})},Ie=({appliedBindings:s=[],onAddBinding:o,editMode:r,item:l})=>{const[n,p]=m.useState(r?l.key:""),[i,x]=m.useState(r?l.value:""),d=C.useSelectedBlock(),[c]=me.useChaiExternalData(),y=m.useCallback((j,g)=>{if(t.isEmpty(j))return"";{const R=t.get(g==="PROP"?d:c,j,"");if(t.isArray(R))return"list";const E=typeof R;return E==="string"?"text":E==="object"?"model":E}},[d,c]),[a,h]=m.useState(r?y(l.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(S.DialogHeader,{children:[e.jsxRuntimeExports.jsx(S.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(S.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(pe,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:n,setValue:p,onChange:j=>{const g=y(j,"PROP");p(j),a!==g&&x(""),h(g)},data:d,dataType:a,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(pe,{type:"PATH",isDisabled:t.isEmpty(n),placeholder:"Enter data path",value:i,setValue:x,onChange:j=>{const g=y(j,"PATH");x(a===g?j:"")},data:c,dataType:a,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(S.DialogFooter,{children:e.jsxRuntimeExports.jsx(f.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(n)&&t.isEmpty(i),onClick:()=>o({key:n,value:i}),children:"Save"})})]})},he=({disabled:s,children:o,onAddBinding:r,appliedBindings:l,editMode:n=!0,item:p={}})=>{const[i,x]=m.useState(!1);return e.jsxRuntimeExports.jsxs(S.Dialog,{children:[e.jsxRuntimeExports.jsx(S.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>x(!0),children:o}),i&&e.jsxRuntimeExports.jsx(S.DialogContent,{children:e.jsxRuntimeExports.jsx(Ie,{item:p,editMode:n,appliedBindings:l,onAddBinding:d=>{r(d),x(!1)}})})]})},_e=({item:s,onAddBinding:o,onRemove:r,selectedBlock:l,dataProvider:n,appliedBindings:p})=>{const[i,x]=m.useState("string"),d=(c,y)=>{if(t.isEmpty(c))return"";{const a=t.get(y==="PROP"?l:n,c,"");if(t.isArray(a))return"list";const h=typeof a;return h==="string"?"text":h==="object"?"model":h}};return m.useEffect(()=>x(()=>d(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-gray-200 p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(oe,{data:t.get(n,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(he,{editMode:!0,onAddBinding:o,appliedBindings:p,item:s,children:e.jsxRuntimeExports.jsx(F.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),e.jsxRuntimeExports.jsx(F.TrashIcon,{onClick:()=>r(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!t.isEmpty(i)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:t.startCase(i)})]})},Be=({bindingData:s,onChange:o})=>{const r=C.useSelectedBlock(),[l]=me.useChaiExternalData(),n=Y.getChaiDataProviders(),[p,i]=m.useState(t.map(s,(a,h)=>({key:h,value:a})));m.useEffect(()=>{i(t.map(s,(a,h)=>({key:h,value:a})))},[r==null?void 0:r._id,s]);const x=m.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(p))return!1;const a=t.last(p);return t.isEmpty(a==null?void 0:a.key)||t.isEmpty(a==null?void 0:a.value)},[l,p]),d=a=>{const h=t.filter(p,j=>j.key!==a.key);i([...h,a]),y([...h,a])},c=a=>{const h=t.filter(p,(j,g)=>a!==g);y([...h])},y=m.useCallback((a=[])=>{if(i(a),t.isEmpty(a)){o({});return}const h={};t.forEach(a,j=>{!t.isEmpty(j==null?void 0:j.key)&&!t.isEmpty(j==null?void 0:j.value)&&t.set(h,j.key,j.value)}),o(h)},[o]);return t.isEmpty(n)?e.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(p,(a,h)=>e.jsxRuntimeExports.jsx(_e,{item:a,onAddBinding:d,onRemove:()=>c(h),selectedBlock:r,dataProvider:l,appliedBindings:t.map(p,"key")},a.key)),e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{disabled:t.isEmpty(l),className:"w-full",children:e.jsxRuntimeExports.jsx(he,{disabled:x,appliedBindings:t.map(p,"key"),onAddBinding:d,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${x?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(l)?e.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),x&&e.jsxRuntimeExports.jsx(f.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(l)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},He=Be,Ve=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),te=m.memo(({id:s,properties:o,formData:r,onChange:l})=>{const[n,p]=m.useState(r),i={type:"object",properties:{}},x={};return Object.keys(o).forEach(d=>{const c=o[d];if(t.includes(["slot","styles"],c.type))return;const y=d;i.properties[y]=ae.getBlockJSONFromSchemas(c),x[y]=ae.getBlockJSONFromUISchemas(c)}),m.useEffect(()=>{p(r)},[s]),e.jsxRuntimeExports.jsx(Ee,{widgets:{binding:Ve,richtext:U.RichTextEditorField,icon:U.IconPickerField,image:U.ImagePickerField},fields:{link:U.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:we,uiSchema:x,schema:i,formData:n,onChange:({formData:d},c)=>{c&&(p(d),l({formData:d},c))}})});function De(){const s=C.useSelectedBlock(),o=K.useUpdateBlocksPropsRealtime(),r=K.useUpdateBlocksProps(),l=Y.getBlockComponent(s._type),n={...s},[p,i]=m.useState(n),x=f.useBuilderProp("dataBindingSupport",!1),d=({formData:g},R,E)=>{if(R&&(p==null?void 0:p._id)===s._id){const B=R.replace("root.","");r([s._id],{[B]:t.get(g,B)},E)}},c=m.useCallback(t.debounce(({formData:g},R,E)=>{d({formData:g},R,E),i(g)},1500),[s==null?void 0:s._id]),y=({formData:g},R)=>{if(R){const E=R.replace("root.","");o([s._id],{[E]:t.get(g,E)}),c({formData:g},R,{[E]:t.get(p,E)})}},a={_name:ve.u({title:"Name",default:t.get(s,"_name",s._type)})},h=t.keys(t.get(n,"_bindings",{})),j=m.useMemo(()=>{const g=t.cloneDeep(t.get(l,"props",{}));return x&&t.each(h,R=>delete g[R]),g},[l,h,x]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(te,{id:s==null?void 0:s._id,onChange:y,formData:n,properties:a}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),x?e.jsxRuntimeExports.jsxs(V.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(V.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(V.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(V.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(He,{bindingData:t.get(s,"_bindings",{}),onChange:g=>{d({formData:{_bindings:g}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(V.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(V.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(V.AccordionContent,{className:"pt-4",children:[t.isEmpty(h)?null:e.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(h,t.capitalize).join(", ")})," ",h.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(te,{id:s==null?void 0:s._id,onChange:y,formData:n,properties:j})]})]})]}):e.jsxRuntimeExports.jsx(te,{id:s==null?void 0:s._id,onChange:y,formData:n,properties:j}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const de=new ke(O.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Ae(){var B;const[s]=C.useSelectedStylingBlocks(),o=C.useSelectedBlock(),r=D.useAddClassesToBlocks(),l=D.useRemoveClassesFromBlocks(),[n]=C.useSelectedBlockIds(),[p,i]=m.useState(""),x=(B=t.first(s))==null?void 0:B.prop,d=t.reject((t.get(o,x,"").replace(Ne.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),c=()=>{const w=p.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(n,w,!0),i("")},[y,a]=m.useState([]),h=({value:w})=>{const A=w.trim().toLowerCase(),$=A.match(/.+:/g);let N=[];if($&&$.length>0){const[H]=$,q=A.replace(H,"");N=de.search(q).map(b=>({...b,item:{...b.item,name:H+b.item.name}}))}else N=de.search(A);a(t.map(N,"item"))},j=()=>{a([])},g=w=>w.name,R=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),E={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:p,onKeyDown:w=>{w.key==="Enter"&&p.trim()!==""&&c()},onChange:(w,{newValue:A})=>i(A),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${y.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsx(ge.Label,{className:"mt-2",children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(Ce,{suggestions:y,onSuggestionsFetchRequested:h,onSuggestionsClearRequested:j,getSuggestionValue:g,renderSuggestion:R,inputProps:E,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(f.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:c,disabled:p.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(d)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),G.Children.toArray(d.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>l(n,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const _=["px","%","em","rem","ch","vh","vw"],Pe={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:_,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},Me={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},$e=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:_.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:_.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[..._,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"multiple",label:"layout.space_bt",options:[{key:"spaceX",label:"layout.space_lr"},{key:"spaceY",label:"layout.space_tb"}]}]},{heading:"size.heading",items:[{styleType:"accordion",heading:"size.min_width_height",items:[{type:"arbitrary",label:"size.min_width",units:_.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:_.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:_.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:_.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"size.object_options_aspect_ratio",items:[{type:"dropdown",label:"size.aspect",property:"aspectRatio"},{type:"dropdown",label:"size.fit",property:"objectFit"},{type:"dropdown",label:"size.position",property:"objectPosition"}]}]},{heading:"display.heading",items:[{type:"dropdown",label:"display.display",property:"display",units:_},{styleType:"accordion",heading:"display.flex_options",items:[{type:"dropdown",label:"display.flex_direction",property:"flexDirection"},{type:"dropdown",label:"display.flex_wrap",property:"flexWrap"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"display.grid_options",items:[{type:"range",label:"display.grid_columns",property:"gridColumns"},{type:"range",label:"display.grid_rows",property:"gridRows"},{type:"dropdown",label:"display.grid_auto_flow",property:"gridAutoFlow"},{type:"dropdown",label:"display.grid_auto_cols",property:"gridAutoColumns"},{type:"dropdown",label:"display.grid_auto_rows",property:"gridAutoRows"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",units:["px","rem"],options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"display.visibility_opacity",items:[{type:"dropdown",label:"display.visibility",property:"visibility",units:_},{type:"arbitrary",label:"display.opacity",property:"opacity",units:["-"]}]}]},{heading:"position.heading",items:[{type:"icons",label:"position.position",property:"position"},{styleType:"accordion",heading:"position.options",items:[{styleType:"multiple",label:"position.direction",options:[{key:"top",label:"position.top"},{key:"right",label:"position.right"},{key:"bottom",label:"position.bottom"},{key:"left",label:"position.left"}]},{styleType:"multiple",label:"position.inset",options:[{key:"inset",label:"position.all"},{key:"insetX",label:"position.lr"},{key:"insetY",label:"position.tb"}]},{type:"arbitrary",label:"position.z_index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"position.float_clear",items:[{type:"icons",label:"position.float",property:"float"},{type:"dropdown",label:"position.clear",property:"clear"}]},{styleType:"accordion",heading:"position.overflow_overscroll",items:[{styleType:"multiple",type:"dropdown",label:"position.overflow",options:[{key:"overflow",label:"position.all"},{key:"overflowX",label:"position.lr"},{key:"overflowY",label:"position.tb"}]},{styleType:"multiple",type:"dropdown",label:"position.overscroll",options:[{key:"overscroll",label:"position.all"},{key:"overscrollX",label:"position.lr"},{key:"overscrollY",label:"position.tb"}]}]}]},{heading:"typography.heading",items:[{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:_},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:_.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"verticalAlign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"letterSpacing",label:"typography.spacing"},{type:"dropdown",property:"textDecoration",label:"typography.decoration"},{type:"range",property:"textDecorationThickness",label:"typography.thickness"},{type:"dropdown",property:"textTransform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"whitespace",label:"typography.whitespace"},{type:"dropdown",property:"wordbreak",label:"typography.wordbreak"}]}]},{heading:"background.heading",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{styleType:"accordion",heading:"background.position_size_more",items:[{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]},{type:"dropdown",label:"background.gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"background.gradient_colors",items:[{type:"color",label:"background.from_color",property:"fromColor"},{type:"color",label:"background.via_color",property:"viaColor"},{type:"color",label:"background.to_color",property:"toColor"}]}]},{heading:"border.heading",items:[{styleType:"multiple",type:"dropdown",label:"border.width",options:[{key:"border",label:"border.all"},{key:"borderX",label:"border.lr"},{key:"borderY",label:"border.tb"},{key:"borderTop",label:"border.top"},{key:"borderRight",label:"border.right"},{key:"borderBottom",label:"border.bottom"},{key:"borderLeft",label:"border.left"}]},{styleType:"multiple",type:"dropdown",label:"border.corners",options:[{key:"borderRadius",label:"border.all"},{key:"borderRadiusTop",label:"border.top"},{key:"borderRadiusRight",label:"border.right"},{key:"borderRadiusBottom",label:"border.bottom"},{key:"borderRadiusLeft",label:"border.left"},{key:"borderRadiusTopLeft",label:"border.top_left"},{key:"borderRadiusTopRight",label:"border.top_right"},{key:"borderRadiusBottomRight",label:"border.bottom_right"},{key:"borderRadiusBottomLeft",label:"border.bottom_left"}]},{type:"color",label:"border.color",property:"borderColor"},{type:"dropdown",label:"border.style",property:"borderStyle"},{styleType:"accordion",heading:"border.divide_options",items:[{styleType:"multiple",type:"range",label:"border.width",options:[{key:"divideXWidth",label:"border.lr"},{key:"divideYWidth",label:"border.tb"}]},{type:"color",label:"border.divide_color",property:"divideColor"},{type:"dropdown",label:"border.divide_style",property:"divideStyle"}]},{styleType:"accordion",heading:"border.outline_styling",items:[{type:"range",label:"border.outline_width",property:"outlineWidth"},{type:"range",label:"border.outline_offset",property:"outlineOffset"},{type:"dropdown",label:"border.outline_style",property:"outlineStyle"}]},{styleType:"accordion",heading:"border.ring_options",items:[{type:"range",label:"border.ring_width",property:"ringWidth"},{type:"color",label:"border.ring_color",property:"ringColor"},{type:"range",label:"border.ring_offset_width",property:"ringOffsetWidth"},{type:"color",label:"border.ring_offset_color",property:"ringOffsetColor"}]}]},{heading:"effect.heading",items:[{type:"range",label:"effect.shadow",property:"boxShadow"},{type:"color",label:"effect.color",property:"boxShadowColor"},{type:"dropdown",label:"effect.cursor",property:"cursor"},{styleType:"accordion",heading:"effect.blend_cursor",items:[{type:"dropdown",label:"effect.mix_blend",property:"mixBlendMode"},{type:"dropdown",label:"effect.bg_blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"effect.transform",items:[{type:"dropdown",label:"effect.origin",property:"transformOrigin"},{styleType:"multiple",label:"effect.scale",units:["-"],options:[{key:"scale",label:"effect.all"},{key:"scaleX",label:"effect.lr"},{key:"scaleY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.skew",units:["deg"],options:[{key:"skewX",label:"effect.lr"},{key:"skewY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.translate",negative:!0,options:[{key:"translateX",label:"effect.lr"},{key:"translateY",label:"effect.tb"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"effect.rotate",property:"rotate"}]},{styleType:"accordion",heading:"effect.animation",items:[{type:"dropdown",label:"effect.animation",property:"animation"},{type:"dropdown",label:"effect.transition",property:"transition"},{type:"dropdown",label:"effect.easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"effect.duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"effect.delay",property:"delay"}]}]},{heading:"classes.heading",items:[{component:Ae}]}],ye={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:u.EyeOpenIcon,invisible:u.EyeClosedIcon,hidden:u.EyeClosedIcon,gap:u.BorderAllIcon,gapX:u.WidthIcon,gapY:u.HeightIcon,spaceX:u.WidthIcon,spaceY:u.HeightIcon,overscroll:u.BorderAllIcon,overscrollX:u.WidthIcon,overscrollY:u.HeightIcon,overflow:u.BorderAllIcon,overflowX:u.WidthIcon,overflowY:u.HeightIcon,top:u.ArrowUpIcon,right:u.ArrowRightIcon,bottom:u.ArrowDownIcon,left:u.ArrowLeftIcon,inset:u.BorderAllIcon,insetX:u.WidthIcon,insetY:u.HeightIcon,border:u.BorderAllIcon,borderX:u.WidthIcon,borderY:u.HeightIcon,borderTop:u.ArrowUpIcon,borderRight:u.ArrowRightIcon,borderBottom:u.ArrowDownIcon,borderLeft:u.ArrowLeftIcon,borderRadius:u.BorderAllIcon,borderRadiusX:u.WidthIcon,borderRadiusY:u.HeightIcon,borderRadiusTop:u.ArrowUpIcon,borderRadiusRight:u.ArrowRightIcon,borderRadiusBottom:u.ArrowDownIcon,borderRadiusLeft:u.ArrowLeftIcon,borderRadiusTopLeft:u.ArrowTopLeftIcon,borderRadiusTopRight:u.ArrowTopRightIcon,borderRadiusBottomRight:u.ArrowBottomRightIcon,borderRadiusBottomLeft:u.ArrowBottomLeftIcon,divideXWidth:u.WidthIcon,divideYWidth:u.HeightIcon,scale:u.BorderAllIcon,scaleX:u.WidthIcon,scaleY:u.HeightIcon,skewX:u.WidthIcon,skewY:u.HeightIcon,translateX:u.WidthIcon,translateY:u.HeightIcon,padding:u.BorderAllIcon,paddingX:u.WidthIcon,paddingY:u.HeightIcon,paddingTop:u.ArrowUpIcon,paddingRight:u.ArrowRightIcon,paddingBottom:u.ArrowDownIcon,paddingLeft:u.ArrowLeftIcon,margin:u.BorderAllIcon,marginX:u.WidthIcon,marginY:u.HeightIcon,marginTop:u.ArrowUpIcon,marginRight:u.ArrowRightIcon,marginBottom:u.ArrowDownIcon,marginLeft:u.ArrowLeftIcon,textLeft:u.AlignLeftIcon,textCenter:u.AlignCenterHorizontallyIcon,textRight:u.AlignRightIcon,textJustify:u.StretchHorizontallyIcon,italic:u.FontItalicIcon,underline:u.UnderlineIcon,overline:u.OverlineIcon,uppercase:u.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":u.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:u.Cross1Icon},X=m.createContext({canReset:!1,canChange:!0}),Le=({children:s,canReset:o=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(X.Provider,{value:{canReset:o,canChange:r},children:s}),je=({label:s,property:o,onChange:r})=>{const l=m.useMemo(()=>t.get(O.CLASSES_LIST,`${o}.classes`,[""]),[o]),n=Z(o),p=m.useMemo(()=>t.get(n,"cls",""),[n]),{canChange:i}=m.useContext(X),x=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded":"grow",children:x?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(P.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(ne,{rounded:s,onChange:d=>r(d,o),selected:p,options:l,disabled:!i})})};function ne({selected:s,onChange:o,rounded:r=!1,options:l,disabled:n=!1}){const p=s.replace(/.*:/g,"").trim(),{undo:i,redo:x}=C.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||n,className:`${r?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:d=>o(d.target.value),onKeyDown:d=>{d.ctrlKey&&(d.key==="z"&&i(),d.key==="y"&&x())},value:p,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),m.Children.toArray(l.map(d=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:d,children:d})))]})}const qe=({property:s,onChange:o})=>{const{canReset:r,canChange:l}=m.useContext(X),n=Z(s),p=m.useMemo(()=>t.get(n,"cls",""),[n]),i=m.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),x=i.indexOf(p)>-1?i.indexOf(p):0,d=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:d?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:p}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||x-1<0),onClick:()=>o(t.nth(i,x-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!l&&(!r||x-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(je,{label:!1,property:s,onChange:o})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||x+1>=i.length),onClick:()=>o(t.nth(i,x+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!l&&(!r||x+1>=i.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Oe=({property:s,onChange:o})=>{const r=m.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:l}=m.useContext(X),n=Z(s),p=m.useMemo(()=>t.get(n,"cls",""),[n]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,i=>e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!l,onClick:()=>o(i,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${p===i?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:m.createElement(t.get(ye,i,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:t.startCase(t.toLower(i))})]}))})},ze={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},We=({property:s,onChange:o})=>{const r=Z(s),l=m.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:n}=m.useContext(X),[p,i]=m.useState([]),[x,d]=m.useState({color:"",shade:""}),c=l.split("-"),y=t.get(c,"1",""),a=t.get(c,"2",""),h=m.useCallback(g=>{["current","inherit","transparent","black","white"].includes(g)?(i([]),d({color:g})):(i(["50","100","200","300","400","500","600","700","800","900"]),d(R=>({...R,color:g,shade:R.shade?R.shade:"500"})))},[i,d]);m.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(y))return i([]);i(["50","100","200","300","400","500","600","700","800","900"])},[y]);const j=m.useCallback(g=>{d({color:y,shade:g})},[y]);return m.useEffect(()=>{d({color:"",shade:""})},[r]),m.useEffect(()=>{const R=`${t.get(ze,s,"")}-${x.color}${x.shade?`-${x.shade}`:""}`;R.match(new RegExp(t.get(O.CLASSES_LIST,`${s}.regExp`,"")))&&o(R,s)},[x,o,s]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(ne,{disabled:!n,rounded:!0,selected:y,onChange:h,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(ne,{rounded:!0,selected:a,disabled:!y||!n,onChange:j,options:p})})]})},ue=(s,o)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&o.includes(r))return{value:"",unit:r};const l=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;r=r.replace(l,"");const n=s.match(l),p=n&&n.length>1,i=!t.isEmpty(r)&&Number.isNaN(Number(r));return p||i?{error:"Invalid value"}:n&&(n[0]==="auto"||n[0]==="none")?{value:n[0],unit:""}:{value:r,unit:n?n[0]:""}},Fe=s=>{const o=s.startsWith("-")?"-":"",r=s.split("-").pop();if(["auto","none"].includes(r))return{value:"",unit:r};if(r==="px")return{value:"1",unit:"px"};if(r==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(r==="full")return{value:"100",unit:"%"};if(t.includes(s,"skew-"))return{value:`${o}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${o}${r}`,unit:"deg"};if(t.includes(s,"opacity-"))return{value:`${r/100}`,unit:"-"};if(t.includes(s,"duration-")||t.includes(s,"delay-"))return{value:`${r}`,unit:"ms"};if(t.includes(s,"translate-")&&!r.includes("/"))return{value:`${o}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${o}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const l=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[l,n]=t.map(r.split("/"),p=>parseInt(p,10));return{value:o+(l/n*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${o+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}},Ye=s=>{if(t.isEmpty(s))return{value:"",unit:""};const o=s.match(/\[.*\]/g);if(o===null)return Xe(s);const r=t.get(o,"0","").replace(/\[|\]/g,""),l=s.startsWith("-")?"-":"",n=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${l}${n}`,unit:r.replace(n,"")}},Xe=s=>t.isEmpty(s)?{value:"",unit:""}:Fe(s),be=m.createContext({setDragData:()=>{}}),Ze=({unit:s,currentValue:o,onDrag:r,onDragEnd:l,onDragStart:n,negative:p,cssProperty:i})=>{const{setDragData:x}=m.useContext(be);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:d=>{const c={onDrag:r,onDragEnd:l,dragging:!0,dragStartY:d.pageY,dragStartValue:`${o}`,dragUnit:s,negative:p,cssProperty:i};n(c),x(c)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(u.RowSpacingIcon,{})})},Ue=({onSelect:s,current:o,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(l=>e.jsxRuntimeExports.jsx(f.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===l?"primary":void 0,size:"sm",onClick:n=>{n.stopPropagation(),s(l)},children:l},l))}),ce=50,Ge=s=>{const[o,r]=m.useState(!1),[l,n]=m.useState(""),{currentClass:p,onChange:i,classPrefix:x,cssProperty:d,units:c,negative:y}=s,[a,h]=m.useState(d!=null&&d.toLowerCase().includes("width")?"%":c[0]),[j,g]=m.useState(!1),[R,E]=m.useState(""),[B,w]=m.useState(!1),[A,$]=m.useState(!1);m.useEffect(()=>{const{value:b,unit:v}=Ye(p);if(v===""){n(b),h(d!=null&&d.toLowerCase().includes("width")?"%":t.first(c));return}h(v),n(v==="class"||t.isEmpty(b)?"":b)},[p,d,c]);const N=re.useThrottledCallback(b=>i(b),[i],ce),H=re.useThrottledCallback(b=>i(b,!1),[i],ce),q=m.useCallback((b=!1)=>{const v=ue(`${l}`,c);if(t.get(v,"error",!1)){g(!0);return}const T=t.get(v,"unit")!==""?t.get(v,"unit"):a;if(T==="auto"||T==="none"){N(`${x}${T}`);return}if(t.get(v,"value")==="")return;const W=`${t.get(v,"value","").startsWith("-")?"-":""}${x}[${t.get(v,"value","").replace("-","")}${T==="-"?"":T}]`;b?H(W):N(W)},[N,H,l,a,x,c]),z=m.useCallback(b=>{const v=ue(`${l}`,c);if(t.get(v,"error",!1)){g(!0);return}if(b==="auto"||b==="none"){N(`${x}${b}`);return}if(t.get(v,"value")==="")return;const T=t.get(v,"unit")!==""?t.get(v,"unit"):b,W=`${t.get(v,"value","").startsWith("-")?"-":""}${x}[${t.get(v,"value","").replace("-","")}${T==="-"?"":T}]`;N(W)},[N,l,x,c]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:a==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${B?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(a)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:a==="class",onKeyPress:b=>{b.key==="Enter"&&q()},onKeyDown:b=>{if(b.keyCode!==38&&b.keyCode!==40)return;b.preventDefault(),$(!0);const v=t.parseInt(b.target.value);let T=t.isNaN(v)?0:v;b.keyCode===38&&(T+=1),b.keyCode===40&&(T-=1);const L=`${T}`,Re=`${L.startsWith("-")?"-":""}${x}[${L.replace("-","")}${a==="-"?"":a}]`;H(Re)},onKeyUp:b=>{A&&(b.preventDefault(),$(!1))},onBlur:()=>q(),onChange:b=>{g(!1),n(b.target.value)},onClick:b=>{var v;(v=b==null?void 0:b.target)==null||v.select(),r(!1)},value:B?R:l,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",j?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(f.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!o),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${c.length===1?"px-2 font-semibold":""}`,children:a}),c.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(f.TooltipPortal,{children:e.jsxRuntimeExports.jsx(f.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ue,{units:c,current:a,onSelect:b=>{r(!1),h(b),z(b)}})})})]})]}),["none","auto"].indexOf(a)!==-1||B?null:e.jsxRuntimeExports.jsx(Ze,{onDragStart:()=>w(!0),onDragEnd:b=>{if(E(()=>""),w(!1),t.isEmpty(b))return;const v=`${b}`,L=`${v.startsWith("-")?"-":""}${x}[${v.replace("-","")}${a==="-"?"":a}]`;N(L)},onDrag:b=>{if(t.isEmpty(b))return;E(b);const v=`${b}`,L=`${v.startsWith("-")?"-":""}${x}[${v.replace("-","")}${a==="-"?"":a}]`;H(L)},currentValue:l,unit:a,negative:y,cssProperty:d})]})})})},Z=s=>{const o=D.useSelectedBlockCurrentClasses();return t.findLast(o,{property:s})},Ke=(s,o)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[o]},Je={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},xe={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Qe=s=>`${s.toUpperCase()} ${xe[s]?`(${xe[s]} & up)`:""}`,le=s=>{const{t:o}=M.useTranslation(),{type:r="icons",label:l,property:n,onEmitChange:p=()=>{},units:i,negative:x=!1}=s,[d]=ee.useDarkMode(),[c]=D.useStylingState(),[,y]=ee.useCanvasWidth(),a=Z(n),h=D.useAddClassesToBlocks(),j=D.useRemoveClassesFromBlocks(),[g]=C.useSelectedBlockIds(),R=m.useMemo(()=>t.get(a,"fullCls",""),[a]),E=m.useCallback((H,q=!0)=>{const z={dark:d,mq:y,mod:c,cls:H,property:n,fullCls:""};(d||c!=="")&&(z.mq="xs");const b=O.generateFullClsName(z);h(g,[b],q)},[g,d,y,c,n,h]),B=m.useCallback(()=>{j(g,[R])},[g,R,j]),w=m.useMemo(()=>Ke(a,y),[a,y]);m.useEffect(()=>{p(w,a)},[w,p,a]);const[,,A]=ee.useCanvasWidth(),$=m.useCallback(H=>{A({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[H])},[A]),N=t.get(a,"dark",null)===d&&t.get(a,"mod",null)===c&&t.get(a,"mq",null)===y;return e.jsxRuntimeExports.jsx(Le,{canChange:w,canReset:a&&N,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${a&&!N?"text-foreground":""}`,children:o(l)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[r==="arbitrary"?e.jsxRuntimeExports.jsx(Ge,{currentClass:t.get(a,"cls",""),classPrefix:t.get(Je,n,""),units:i||[],onChange:E,negative:x,cssProperty:n}):null,r==="icons"&&e.jsxRuntimeExports.jsx(Oe,{property:n,onChange:E}),r==="range"&&e.jsxRuntimeExports.jsx(qe,{property:n,onChange:E}),r==="color"&&e.jsxRuntimeExports.jsx(We,{property:n,onChange:E}),r==="dropdown"&&e.jsxRuntimeExports.jsx(je,{label:l,property:n,onChange:E})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${R?"visible":"invisible"}`,children:N?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>B(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(u.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):w&&a?e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[Qe(t.get(a,"mq")),d&&!a.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>$(t.get(a,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(a,"mq").toUpperCase()]})]})})})]}):null})]})]})})},et=["px","%","em","rem","ch","vh","vw"],fe=({label:s,options:o,borderB:r=!1,borderT:l=!1,type:n="arbitrary",units:p=et,negative:i=!1})=>{const{t:x}=M.useTranslation(),[d,c]=m.useState(o[0].key),y=D.useSelectedBlockCurrentClasses(),a=m.useCallback(h=>t.map(y,"property").includes(h),[y]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:x(s)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:m.Children.toArray(o.map(({label:h,key:j})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>c(j),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${j===d?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[m.createElement("div",{className:a(j)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),m.createElement(t.get(ye,j,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{children:t.startCase(t.toLower(h))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(le,{type:n,units:[...p],label:"",property:d,negative:i})})]})},tt=({heading:s,items:o})=>{const{t:r}=M.useTranslation(),l=D.useSelectedBlockCurrentClasses(),n=m.useMemo(()=>{const p=d=>t.flatten(d.map(c=>c.styleType==="multiple"?t.map(c.options,"key"):c.property)),i=t.flatten(o.map(d=>d.styleType==="accordion"?p(d.items):d.styleType==="multiple"?t.map(d.options,"key"):d.property)),x=t.map(l,"property");return t.intersection(i,x).length>0},[l,o]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[r(s),n?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:o.map(p=>p.styleType==="multiple"?e.jsxRuntimeExports.jsx(fe,{...p},p.label):e.jsxRuntimeExports.jsx(le,{...p},p.label))})]})},st=m.createContext({}),se=({section:s})=>{const{t:o}=M.useTranslation(),r=D.useSelectedBlockCurrentClasses(),l=m.useCallback((i=[])=>{const x={};for(let c=0;c<r.length;c++)x[r[c].property]=r[c].cls;let d=!0;for(const c in i)if(!t.has(x,c)||x[c]!==i[c]){d=!1;break}return d},[r]),n=m.useMemo(()=>{if(r.length>0&&s.heading==="classes.heading")return!0;const i=c=>t.flatten(c.map(y=>y.styleType==="multiple"?t.flatten(t.map(y.options,"key")):y.property)),x=t.flatten(s.items.map(c=>c.styleType==="accordion"?i(c.items):c.styleType==="multiple"?t.flatten(t.map(c.options,"key")):c.property)),d=t.map(r,"property");return t.intersection(x,d).length>0},[r,s.heading,s.items]),p=m.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(st.Provider,{value:p,children:e.jsxRuntimeExports.jsxs(V.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(V.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}),o(s.heading)]})}),e.jsxRuntimeExports.jsx(V.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:m.Children.toArray(s.items.map(i=>t.has(i,"component")?m.createElement(i.component,{key:i.label}):t.has(i,"styleType")?i.styleType==="multiple"?e.jsxRuntimeExports.jsx(fe,{...i},i.label):i.styleType==="accordion"&&l(i==null?void 0:i.conditions)?e.jsxRuntimeExports.jsx(tt,{...i},i.label):null:e.jsxRuntimeExports.jsx(le,{...i},i.label)))})]})})},rt=()=>{const s=C.useSelectedBlock(),[o]=C.useSelectedStylingBlocks(),{t:r}=M.useTranslation(),l=Y.useGlobalStylingPresets(),n=D.useAddClassesToBlocks(),p=Y.getBlockComponent(s._type),i=t.get(t.first(o),"prop"),x=t.get(p.props,`${i}.presets`,{});if(t.isEmpty(l)&&(!t.has(p,"props")||t.isEmpty(x)))return null;const d=c=>{const y=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");n([s._id],y,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(I.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(I.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(f.Button,{variant:"default",className:"w-full",size:"sm",children:[r("Apply Presets"),e.jsxRuntimeExports.jsx(u.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(I.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(ie.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(x)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(I.DropdownMenuLabel,{children:[p.type," ",r("presets")]}),e.jsxRuntimeExports.jsx(I.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(I.DropdownMenuGroup,{children:t.keys(x).map(c=>e.jsxRuntimeExports.jsxs(I.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(x[c]),children:[t.capitalize(t.startCase(r(c))),e.jsxRuntimeExports.jsx(I.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]}),t.isEmpty(l)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(I.DropdownMenuLabel,{children:r("Global presets")}),e.jsxRuntimeExports.jsx(I.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(I.DropdownMenuGroup,{children:t.keys(l).map(c=>e.jsxRuntimeExports.jsxs(I.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(l[c]),children:[t.capitalize(t.startCase(r(c))),e.jsxRuntimeExports.jsx(I.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]})]})})]})})};function ot(){const[s,o]=D.useStylingState(),{flexChild:r,gridChild:l}=C.useSelectedBlocksDisplayChild(),{t:n}=M.useTranslation(),[p]=C.useSelectedStylingBlocks();return t.isEmpty(p)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_styling_block_selected")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(rt,{}),e.jsxRuntimeExports.jsx("div",{className:"flex h-12 flex-col space-x-4 px-4 py-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(ge.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(k.Select,{defaultValue:s,onValueChange:i=>o(i),children:[e.jsxRuntimeExports.jsx(k.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(k.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(k.SelectContent,{children:[e.jsxRuntimeExports.jsx(k.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),s!==""?e.jsxRuntimeExports.jsxs("div",{className:"m-1 flex items-center space-x-1 rounded border border-orange-500 bg-orange-200 p-px px-2 text-xs text-orange-900",children:[e.jsxRuntimeExports.jsx(F.BrushIcon,{className:"w-3"}),e.jsxRuntimeExports.jsx("span",{children:n(`Styles will be applied for (:${s}) state`)})]}):null,e.jsxRuntimeExports.jsx(ie.ScrollArea,{className:"no-scrollbar -mx-1 max-h-full flex-1 overflow-x-hidden overflow-y-hidden border-t border-border",children:e.jsxRuntimeExports.jsxs(V.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(se,{section:Pe}),l?e.jsxRuntimeExports.jsx(se,{section:Me}):null,$e.map(i=>e.jsxRuntimeExports.jsx(se,{section:i},i.heading))]})})]})}const nt=({onAdd:s})=>{const{t:o}=M.useTranslation(),[r,l]=m.useState({key:"",value:""}),n=()=>{t.isEmpty(r.key)||(s({...r,key:t.kebabCase(r.key)}),l({key:"",value:""}))};return e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border-gray-200 px-1",children:[e.jsxRuntimeExports.jsx(P.Input,{name:"key",onChange:p=>l({...r,key:p.target.value}),value:r.key,placeholder:o("Name"),autoComplete:"off",autoCapitalize:"off",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),t.isEmpty(r.key)||n())}}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-1.5",children:e.jsxRuntimeExports.jsx(P.Input,{name:"value",onChange:p=>l({...r,value:p.target.value}),value:r.value,placeholder:o("Value"),autoComplete:"off",autoCapitalize:"off",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),t.isEmpty(r.key)||n())}})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsxs(f.Button,{disabled:t.isEmpty(r.key),onClick:n,size:"sm",className:"flex items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[o("Add")," "]}),e.jsxRuntimeExports.jsx(u.PlusIcon,{})]}),t.isEmpty(r.key)?null:e.jsxRuntimeExports.jsx(f.Button,{variant:"ghost",onClick:()=>l({key:"",value:""}),children:o("Cancel")})]})]})},it=()=>{const s=C.useSelectedBlock(),[o,r]=m.useState([]),[l]=C.useSelectedStylingBlocks(),n=K.useUpdateBlocksPropsRealtime(),p=K.useUpdateBlocksProps(),{t:i}=M.useTranslation(),x=`${t.get(l,"0.prop")}_attrs`;G.useEffect(()=>{const a=t.map(t.get(s,x),(h,j)=>({key:j,value:h}));t.isEmpty(a)?r([]):r(a)},[t.get(s,x)]);const d=a=>{const h=t.filter(o,(j,g)=>a!==g);y(h)},c=a=>{const h=[...o,a];y(h)},y=G.useCallback((a=[])=>{const h={};t.forEach(a,j=>{t.isEmpty(j.key)||t.set(h,j.key,j.value)}),p([t.get(s,"_id")],{[x]:h})},[s,n,x]);return e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("ul",{className:"overflow-hidden rounded-md bg-gray-100 p-2 text-xs text-gray-700",children:[t.isEmpty(o)?e.jsxRuntimeExports.jsx("li",{className:"flex h-16 items-center justify-center",children:e.jsxRuntimeExports.jsx("p",{children:i("No custom attributes added yet")})}):e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("span",{className:"font-bold",children:i("Custom attributes")})}),G.Children.toArray(t.map(o,a=>e.jsxRuntimeExports.jsxs("li",{className:"group flex max-w-full items-center justify-between",children:[e.jsxRuntimeExports.jsxs(f.Tooltip,{delayDuration:1e3,children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"w-[90%] cursor-default truncate px-1 hover:bg-gray-200",children:[a.key," ",e.jsxRuntimeExports.jsx("span",{className:"font-bold text-orange-500",children:"="})," ",a.value]})}),e.jsxRuntimeExports.jsxs(f.TooltipContent,{className:"max-w-[200px]",children:[e.jsxRuntimeExports.jsxs("div",{children:[i("Name"),": ",a.key]}),e.jsxRuntimeExports.jsxs("div",{children:[i("Value"),": ",a.value]})]})]}),e.jsxRuntimeExports.jsxs(f.Tooltip,{children:[e.jsxRuntimeExports.jsx(f.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{className:"invisible group-hover:visible",onClick:()=>d(o.indexOf(a)),children:e.jsxRuntimeExports.jsx(F.DeleteIcon,{className:"w-4 text-gray-500"})})}),e.jsxRuntimeExports.jsx(f.TooltipContent,{className:"max-w-[200px]",children:i("Remove attribute")})]})]})))]})}),e.jsxRuntimeExports.jsx("div",{className:"py-2"}),e.jsxRuntimeExports.jsx(nt,{onAdd:a=>c(a)})]})})})},lt={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},at=()=>{const s=C.useSelectedBlock(),{t:o}=M.useTranslation(),[r,l]=m.useState(""),[n,p]=m.useState({onDrag:d=>d,onDragEnd:d=>d,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),i=re.useThrottledCallback(d=>{const c=!t.get(n,"negative",!1),y=t.get(n,"cssProperty","");let a=parseFloat(n.dragStartValue);a=t.isNaN(a)?0:a;let h=lt[n.dragUnit];(t.startsWith(y,"scale")||y==="opacity")&&(h=10);let g=(n.dragStartY-d.pageY)/h+a;c&&g<0&&(g=0),y==="opacity"&&g>1&&(g=1),n.onDrag(`${g}`),l(`${g}`)},[n],50),x=m.useCallback(()=>{setTimeout(()=>n.onDragEnd(`${r}`),100),p({onDrag:d=>d,onDragEnd:d=>d,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[n,r,p]);return t.isNull(s)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:o("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(C.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(be.Provider,{value:{setDragData:p},children:[n.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:i,onMouseUp:()=>x(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(S.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1 text-xs",children:[e.jsxRuntimeExports.jsxs(S.TabsList,{className:"mx-1 grid grid-cols-3",children:[e.jsxRuntimeExports.jsx(S.TabsTrigger,{value:"settings",children:o("settings")}),e.jsxRuntimeExports.jsx(S.TabsTrigger,{value:"styling",children:o("styling")}),e.jsxRuntimeExports.jsx(S.TabsTrigger,{value:"attrs",children:o("Attributes")})]}),e.jsxRuntimeExports.jsx(S.TabsContent,{value:"settings",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ie.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden pb-5",children:e.jsxRuntimeExports.jsx(De,{})})}),e.jsxRuntimeExports.jsx(S.TabsContent,{value:"styling",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ot,{})}),e.jsxRuntimeExports.jsx(S.TabsContent,{value:"attrs",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(it,{})})]})]})})};exports.default=at;
|