@chaibuilder/sdk 1.2.63 → 1.2.65
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/CanvasArea-fSdH_RiN.cjs +1 -0
- package/dist/{CanvasArea-DvfLxy0w.js → CanvasArea-ut5yknzX.js} +58 -54
- package/dist/{CodeEditor-QPwyZNgA.js → CodeEditor-Qff4q7sx.js} +1 -1
- package/dist/{CurrentPage-rOUX01kk.js → CurrentPage-jHSVy3hq.js} +38 -26
- package/dist/CurrentPage-p_AM4lrF.cjs +1 -0
- package/dist/{PagesPanel-6P4VkMP-.js → PagesPanel-U3InJ9Db.js} +20 -8
- package/dist/PagesPanel-wqDb4D-x.cjs +1 -0
- package/dist/{ProjectPanel-Cn3teDRW.js → ProjectPanel-XODJTO4J.js} +36 -24
- package/dist/ProjectPanel-fWESzHr6.cjs +1 -0
- package/dist/{SidePanels-_Im6sF4f.js → SidePanels-ijaUKSek.js} +84 -70
- package/dist/SidePanels-lrMQqc0h.cjs +1 -0
- package/dist/Topbar-RrCDxd0i.cjs +1 -0
- package/dist/{Topbar-SuY-S0im.js → Topbar-vHlnfxPs.js} +45 -30
- package/dist/UILibrariesPanel-7btHgBD0.cjs +1 -0
- package/dist/{UILibrariesPanel-RI9mo293.js → UILibrariesPanel-NVUMUPUj.js} +83 -63
- package/dist/{UnsplashImages-dasLGrBn.js → UnsplashImages-UkHihhA5.js} +16 -16
- package/dist/{UploadImages-Gh2AQpk1.js → UploadImages-HtuJZJlo.js} +7 -7
- package/dist/add-page-modal-RwIj1FxH.cjs +1 -0
- package/dist/{add-page-modal-zCiyvKEa.js → add-page-modal-TOfMfmPA.js} +32 -23
- package/dist/{confirm-alert-9XYi0a4k.js → confirm-alert-eIp2cAkc.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +10 -7
- package/dist/core.js +74 -59
- package/dist/{delete-page-modal-pzagU_6y.js → delete-page-modal-4bxjpVBD.js} +33 -21
- package/dist/delete-page-modal-qYDZmpgT.cjs +1 -0
- package/dist/email.cjs +1 -1
- package/dist/email.js +20 -5
- package/dist/{form-EjiQiiEY.js → form-NAzFjGs0.js} +9 -9
- package/dist/html-to-json-NqRjgFqp.cjs +1 -0
- package/dist/html-to-json-l_mw5y-e.js +243 -0
- package/dist/{index-DzAuS11k.cjs → index--k2M8kzI.cjs} +1 -1
- package/dist/{index-BbW1Uw_k.cjs → index-5XyNUAjc.cjs} +81 -22
- package/dist/{index-bscJUvUx.js → index-C7mB4XFm.js} +117 -117
- package/dist/{index-qSbpzIA4.js → index-YZhtVcj_.js} +4 -4
- package/dist/{index-EEcKvBh3.js → index-lFgDm1oa.js} +48587 -45055
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +22 -22
- package/dist/page-viewer-4wrnWnK0.js +124 -0
- package/dist/page-viewer-ra0GLx1p.cjs +1 -0
- package/dist/{project-general-setting-5B7s5swF.js → project-general-setting-IwZUkYF3.js} +18 -9
- package/dist/project-general-setting-lFjTUhHD.cjs +1 -0
- package/dist/{project-seo-setting-aAGnwBrw.js → project-seo-setting-e1fTqVsd.js} +2 -2
- package/dist/{single-page-detail-Yr0EbBJJ.js → single-page-detail-ZNWFKqLW.js} +69 -60
- package/dist/single-page-detail-g55Anu7R.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +18 -6
- package/dist/style.css +2 -2
- package/dist/ui.js +67 -67
- package/package.json +1 -1
- package/dist/AddBlocks-4wpxOF2K.cjs +0 -1
- package/dist/AddBlocks-ChNxwRrx.js +0 -142
- package/dist/CanvasArea-hGLbDJlM.cjs +0 -1
- package/dist/CurrentPage-fMCaBGwl.cjs +0 -1
- package/dist/PagesPanel-ZCZjs7Bi.cjs +0 -1
- package/dist/ProjectPanel-XSVWRr6v.cjs +0 -1
- package/dist/Settings-Amh8Mtm7.cjs +0 -1
- package/dist/Settings-dbB2VPAj.js +0 -2378
- package/dist/SidePanels-5adH7U3T.cjs +0 -1
- package/dist/StaticCanvas-fDhBK35X.cjs +0 -60
- package/dist/StaticCanvas-goU42OMU.js +0 -749
- package/dist/ThemeConfigPanel-N6l317II.cjs +0 -1
- package/dist/ThemeConfigPanel-aEN4tTYi.js +0 -191
- package/dist/Topbar-ag6qdgbe.cjs +0 -1
- package/dist/UILibrariesPanel-03Y3F3A_.cjs +0 -1
- package/dist/add-page-modal-80cVOM7i.cjs +0 -1
- package/dist/atoms-KQpaDRnF.cjs +0 -1
- package/dist/atoms-Oomqut88.js +0 -6
- package/dist/delete-page-modal-foPRP--l.cjs +0 -1
- package/dist/html-to-json-_01DXd-a.js +0 -192
- package/dist/html-to-json-ndxaXRT8.cjs +0 -1
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/page-viewer-XFTCHu_2.cjs +0 -1
- package/dist/page-viewer-Z1wXyzzc.js +0 -112
- package/dist/plugin-2hf9pCRy.cjs +0 -1
- package/dist/plugin-wDnsBVPp.js +0 -54
- package/dist/project-general-setting-HV3X_wHI.cjs +0 -1
- package/dist/single-page-detail-6C1WP3s5.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),W=require("@react-hookz/web"),t=require("lodash-es"),I=require("react-i18next"),g=require("@radix-ui/react-icons"),o=require("./index-aeDphKpP.cjs"),P=require("lucide-react"),L=require("@chaibuilder/runtime"),M=require("./index-BbW1Uw_k.cjs"),F=require("./index-gi1LIOCw.cjs"),ue=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),ce=require("jotai"),xe=require("react-autosuggest"),me=require("fuse.js"),$=require("./utils-D_vtk3zK.cjs"),ge=require("./MODIFIERS-mVmfEGgo.cjs"),X=require("lodash");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("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("tree-model");require("i18next");require("react-arborist");require("./index--mLLy7QQ.cjs");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");function ye(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:()=>r[s]})}}return i.default=r,Object.freeze(i)}const z=ye(c);function he(r){const i=[],s={};function l(a,p){t.forEach(p,(x,m)=>{const n=a?`${a}.${m}`:m,d=t.isArray(x)?"list":typeof x;i.push(n),s[n]=d==="string"?"text":d==="object"?"model":d,d==="object"&&!t.isArray(x)&&l(n,x)})}return l("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:i,pathsType:s}}const Z=({data:r,fullView:i})=>{if(!r)return null;const s=typeof r;return i?typeof r=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(M.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(F.JsonView,{data:r,shouldExpandNode:F.allExpanded,style:{...F.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: "}),r]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(s==="object"?JSON.stringify(r):r,{length:40})})},G=({type:r,value:i="",setValue:s,data:l,onChange:a,dataType:p,appliedBindings:x})=>{const{paths:m,pathsType:n}=he(l),d=r==="PROP"?L.getBlockComponent(l==null?void 0:l._type):{},y=r==="PROP",[u,f]=c.useState(!1),b=c.useMemo(()=>r==="PROP"?m.filter(h=>!t.includes(x,h)&&t.get(d,`props.${t.first(t.split(h,"."))}.binding`)):m.filter(h=>p===t.get(n,h,"")),[r,m,x,p,d]);return c.useEffect(()=>{i&&a(i)},[i,r]),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(r))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:u,onOpenChange:f,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(i)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:i?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[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)}),i]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(r))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(r)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(b,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${y?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:R=>{s(t.find(b,C=>C===R)||null),f(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(P.Check,{className:`h-4 w-4 text-green-500 ${i===h?"":"opacity-0"}`}),h]}),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(n,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(Z,{data:t.get(l,h)})})]},h))})]})]})})]})]}),!y&&!t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(Z,{data:t.get(l,i,""),fullView:!0})})]})},be=({appliedBindings:r=[],onAddBinding:i,editMode:s,item:l})=>{const[a,p]=c.useState(s?l.key:""),[x,m]=c.useState(s?l.value:""),n=o.useSelectedBlock(),[d]=M.useChaiExternalData(),y=c.useCallback((b,h)=>{if(t.isEmpty(b))return"";{const R=t.get(h==="PROP"?n:d,b,"");if(t.isArray(R))return"list";const C=typeof R;return C==="string"?"text":C==="object"?"model":C}},[n,d]),[u,f]=c.useState(s?y(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:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:a,setValue:p,onChange:b=>{const h=y(b,"PROP");p(b),u!==h&&m(""),f(h)},data:n,dataType:u,appliedBindings:r}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(a),placeholder:"Enter data path",value:x,setValue:m,onChange:b=>{const h=y(b,"PATH");m(u===h?b:"")},data:d,dataType:u,appliedBindings:r})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(a)&&t.isEmpty(x),onClick:()=>i({key:a,value:x}),children:"Save"})})]})},re=({disabled:r,children:i,onAddBinding:s,appliedBindings:l,editMode:a=!0,item:p={}})=>{const[x,m]=c.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>m(!0),children:i}),x&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(be,{item:p,editMode:a,appliedBindings:l,onAddBinding:n=>{s(n),m(!1)}})})]})},fe=({item:r,onAddBinding:i,onRemove:s,selectedBlock:l,dataProvider:a,appliedBindings:p})=>{const[x,m]=c.useState("string"),n=(d,y)=>{if(t.isEmpty(d))return"";{const u=t.get(y==="PROP"?l:a,d,"");if(t.isArray(u))return"list";const f=typeof u;return f==="string"?"text":f==="object"?"model":f}};return c.useEffect(()=>m(()=>n(r.key,"PROP")),[r.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:r.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),e.jsxRuntimeExports.jsx(Z,{data:t.get(a,r.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(re,{editMode:!0,onAddBinding:i,appliedBindings:p,item:r,children:e.jsxRuntimeExports.jsx(P.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(P.TrashIcon,{onClick:()=>s(),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(x)&&!t.isEmpty(r.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(x)})]})},je=({bindingData:r,onChange:i})=>{const s=o.useSelectedBlock(),[l]=M.useChaiExternalData(),a=L.getChaiDataProviders(),[p,x]=c.useState(t.map(r,(u,f)=>({key:f,value:u})));c.useEffect(()=>{x(t.map(r,(u,f)=>({key:f,value:u})))},[s==null?void 0:s._id,r]);const m=c.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(p))return!1;const u=t.last(p);return t.isEmpty(u==null?void 0:u.key)||t.isEmpty(u==null?void 0:u.value)},[l,p]),n=u=>{const f=t.filter(p,b=>b.key!==u.key);x([...f,u]),y([...f,u])},d=u=>{const f=t.filter(p,(b,h)=>u!==h);y([...f])},y=c.useCallback((u=[])=>{if(x(u),t.isEmpty(u)){i({});return}const f={};t.forEach(u,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(f,b.key,b.value)}),i(f)},[i]);return t.isEmpty(a)?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,(u,f)=>e.jsxRuntimeExports.jsx(fe,{item:u,onAddBinding:n,onRemove:()=>d(f),selectedBlock:s,dataProvider:l,appliedBindings:t.map(p,"key")},u.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(l),className:"w-full",children:e.jsxRuntimeExports.jsx(re,{disabled:m,appliedBindings:t.map(p,"key"),onAddBinding:n,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${m?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(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"})})}),m&&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"})]})]})},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"}),Re=({id:r,placeholder:i})=>{const{t:s}=I.useTranslation(),[,l]=o.useCodeEditor(),a=o.useSelectedBlock();if(typeof window>"u")return null;const p=r.replace("root.",""),x=t.get(a,p,""),m=()=>{const n=a==null?void 0:a._id;l({blockId:n,blockProp:p,placeholder:i,initialCode:t.get(a,p,x)})};return e.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-col gap-y-1",children:[e.jsxRuntimeExports.jsx("button",{onClick:m,className:"text-pretty w-[90%] max-w-full cursor-default truncate rounded border bg-white p-2 text-left text-[10px]",children:x.trim().length>0?x.substring(0,46):i||"Eg: <script>console.log('Hello, world!');<\/script>"}),e.jsxRuntimeExports.jsx(o.Button,{onClick:m,size:"sm",variant:"outline",className:"w-fit",children:s("Open code editor")})]})},J=c.memo(({id:r,properties:i,formData:s,onChange:l})=>{const[a,p]=c.useState(s),x={type:"object",properties:{}},m={};Object.keys(i).forEach(d=>{const y=i[d];if(t.includes(["slot","styles"],y.type))return;const u=d;x.properties[u]=o.getBlockJSONFromSchemas(y),m[u]=o.getBlockJSONFromUISchemas(y)}),c.useEffect(()=>{p(s)},[r]);const n=W.useThrottledCallback(async({formData:d},y)=>{l({formData:d},y)},[l],1e3);return e.jsxRuntimeExports.jsx(ue,{widgets:{binding:ve,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField,code:Re},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:de,uiSchema:m,schema:x,formData:a,onChange:({formData:d},y)=>{y&&(p(d),n({formData:d},y))}})}),Ee=()=>{const[r,i]=ce.useAtom(o.xShowBlocksAtom),s=o.useSelectedBlock(),[,l]=o.useSelectedBlockIds(),{t:a}=I.useTranslation(),p=c.useMemo(()=>(s?JSON.stringify(s):"").includes('"x-show"'),[s]);if(!s||!p)return null;const x=r.includes(s._id);return e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-xs hover:no-underline",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border bg-gray-200 px-4 py-2 font-normal",children:[s._name||s._type," ",a("visibility settings")]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 px-2 pt-2",children:[e.jsxRuntimeExports.jsx(o.Switch,{id:"show-on-canvas",checked:x,onCheckedChange:m=>{m?(i(n=>[...n,s._id]),l([s._id])):i(n=>n.filter(d=>d!==s._id))}}),e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"show-on-canvas",children:a("Show on canvas")})]})]})};function we(){const r=o.useSelectedBlock(),i=o.useUpdateBlocksPropsRealtime(),s=o.useUpdateBlocksProps(),l=L.getBlockComponent(r._type),a={...r},[p,x]=c.useState(a),m=o.useBuilderProp("dataBindingSupport",!1),n=({formData:b},h,R)=>{if(h&&(p==null?void 0:p._id)===r._id){const C=h.replace("root.","");s([r._id],{[C]:t.get(b,C)},R)}},d=c.useCallback(t.debounce(({formData:b},h,R)=>{n({formData:b},h,R),x(b)},1500),[r==null?void 0:r._id]),y=({formData:b},h)=>{if(h){const R=h.replace("root.","");i([r._id],o.convertDotNotationToObject(R,t.get(b,R.split(".")))),d({formData:b},h,{[R]:t.get(p,R)})}},u=t.keys(t.get(a,"_bindings",{})),f=c.useMemo(()=>{const b=t.cloneDeep(t.get(l,"props",{}));return m&&t.each(u,h=>delete b[h]),b},[l,u,m]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[m?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(je,{bindingData:t.get(r,"_bindings",{}),onChange:b=>{n({formData:{_bindings:b}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(u)?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(u,t.capitalize).join(", ")})," ",u.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(J,{id:r==null?void 0:r._id,onChange:y,formData:a,properties:f})]})]})]}):e.jsxRuntimeExports.jsx(J,{id:r==null?void 0:r._id,onChange:y,formData:a,properties:f}),e.jsxRuntimeExports.jsx(Ee,{})]})}const Ce=({blockId:r})=>{const{t:i}=I.useTranslation(),{askAi:s,loading:l,error:a}=M.useAskAi(),[p,x]=c.useState(""),m=c.useRef(null);c.useEffect(()=>{var d;(d=m.current)==null||d.focus()},[]);const n=()=>{a||x("")};return e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:i("Ask AI")}),e.jsxRuntimeExports.jsx(o.Textarea,{ref:m,value:p,onChange:d=>x(d.target.value),placeholder:i("Ask AI to edit styles"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),s("styles",r,p,n))}}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 my-2",children:[l?null:e.jsxRuntimeExports.jsx(o.Button,{disabled:p.trim().length<5||l,onClick:()=>s("styles",r,p,n),variant:"default",className:"w-fit",size:"sm",children:l?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.Loader,{className:"w-5 h-5 animate-spin"}),i("Generating... Please wait")]}):i("Edit with AI")}),l?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxRuntimeExports.jsxs(o.Skeleton,{className:"flex items-center w-full px-4 py-1 pl-2 space-x-1",children:[e.jsxRuntimeExports.jsx(M.FaSpinner,{className:"w-4 h-4 text-gray-500 animate-spin"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i("Generating... Please wait")})]}),e.jsxRuntimeExports.jsx(o.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:i("Stop")})]}):null]}),e.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:a&&e.jsxRuntimeExports.jsx("p",{className:"p-1 text-xs text-red-500 break-words bg-red-100 border border-red-500 rounded",children:a.message})})]})},Q=new me($.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function oe(){var k;const{t:r}=I.useTranslation(),[i]=o.useSelectedStylingBlocks(),s=o.useSelectedBlock(),l=o.useAddClassesToBlocks(),a=o.useRemoveClassesFromBlocks(),[p]=o.useSelectedBlockIds(),x=o.useBuilderProp("askAiCallBack",null),[m,n]=c.useState(""),{toast:d}=o.useToast(),y=(k=t.first(i))==null?void 0:k.prop,u=t.reject((t.get(s,y,"").replace(ge.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),f=()=>{const w=m.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");l(p,w,!0),n("")},[b,h]=c.useState([]),R=({value:w})=>{const T=w.trim().toLowerCase(),D=T.match(/.+:/g);let j=[];if(D&&D.length>0){const[v]=D,S=T.replace(v,"");j=Q.search(S).map(H=>({...H,item:{...H.item,name:v+H.item.name}}))}else j=Q.search(T);return h(t.map(j,"item"))},C=()=>{h([])},B=w=>w.name,_=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),V={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:r("Enter classes separated by space"),value:m,onKeyDown:w=>{w.key==="Enter"&&m.trim()!==""&&f()},onChange:(w,{newValue:T})=>n(T),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},E=()=>{if(navigator.clipboard===void 0){d({title:"Clipboard not supported",description:"Please use Chrome, Firefox or Safari",variant:"destructive"});return}navigator.clipboard.writeText(u.join(" ")),d({title:"Copied",description:"Classes copied to clipboard"})};return e.jsxRuntimeExports.jsxs("div",{className:`flex ${b.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto border-b-2 bg-gray-100 pb-4`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:r("Classes")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(g.CopyIcon,{onClick:E,className:"cursor-pointer"})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:r("Copy classes to clipboard")})})]})]}),x?e.jsxRuntimeExports.jsxs(o.Popover,{children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"h-6 w-fit",size:"sm",children:[e.jsxRuntimeExports.jsx(P.SparklesIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2",children:r("Ask AI")})]})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"left",className:"p-2",children:e.jsxRuntimeExports.jsx(Ce,{blockId:s==null?void 0:s._id})})]}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"relative 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(xe,{suggestions:b,onSuggestionsFetchRequested:R,onSuggestionsClearRequested:C,getSuggestionValue:B,renderSuggestion:_,inputProps:V,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"!bg-gray-300 ",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:f,disabled:m.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-wrap gap-2 overflow-x-hidden",children:z.Children.toArray(u.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-gray-300 bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300",children:[w,e.jsxRuntimeExports.jsx(g.Cross2Icon,{onClick:()=>a(p,[w]),className:"invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))})]})}const ke=c.memo(function({preloadedAttributes:i=[],onAttributesChange:s}){const[l,a]=c.useState([]),[p,x]=c.useState(""),[m,n]=c.useState(""),[d,y]=c.useState(null),[u,f]=c.useState(""),b=c.useRef(null),h=c.useRef(null);c.useEffect(()=>{b.current&&b.current.focus()},[l]),c.useEffect(()=>{a(i)},[i]);const R=()=>{if(p.startsWith("@")){f("Attribute keys cannot start with '@'");return}if(p){const E=[...l,{key:p,value:m}];s(E),a(l),x(""),n(""),f("")}},C=E=>{const k=l.filter((w,T)=>T!==E);s(k),a(k)},B=E=>{y(E),x(l[E].key),n(l[E].value)},_=()=>{if(p.startsWith("@")){f("Attribute keys cannot start with '@'");return}if(d!==null&&p){const E=[...l];E[d]={key:p,value:m},s(E),a(E),y(null),x(""),n(""),f("")}},V=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),d!==null?_():R())};return e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsxs("form",{onSubmit:E=>{E.preventDefault(),d!==null?_():R()},className:"space-y-3",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"attrKey",className:"text-xs",children:"Key"}),e.jsxRuntimeExports.jsx(o.Input,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrKey",ref:b,value:p,onChange:E=>x(E.target.value),placeholder:"Key",className:"h-8 text-sm"})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"attrValue",className:"text-xs",children:"Value"}),e.jsxRuntimeExports.jsx(o.Textarea,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrValue",rows:2,ref:h,value:m,onChange:E=>n(E.target.value),onKeyDown:V,placeholder:"Value",className:"bg-background text-sm"})]})]}),e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"h-8 w-full text-sm",children:d!==null?"Save":"Add"}),u&&e.jsxRuntimeExports.jsx("p",{className:"text-xs text-red-500",children:u})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-4 space-y-1 overflow-y-auto",children:l.map((E,k)=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded bg-muted p-1.5 text-sm",children:[e.jsxRuntimeExports.jsxs("div",{className:"mr-2 flex flex-col",children:[e.jsxRuntimeExports.jsx("span",{className:"truncate font-semibold",children:E.key}),e.jsxRuntimeExports.jsx("span",{className:"text-wrap max-w-[200px] text-muted-foreground",children:E.value.toString()})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex-shrink-0",children:[e.jsxRuntimeExports.jsxs(o.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>B(k),children:[e.jsxRuntimeExports.jsx(P.Edit2,{className:"h-3 w-3"}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Edit attribute"})]}),e.jsxRuntimeExports.jsxs(o.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>C(k),children:[e.jsxRuntimeExports.jsx(P.X,{className:"h-3 w-3"}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Remove attribute"})]})]})]},k))})]})}),Ne=z.memo(()=>{const r=o.useSelectedBlock(),[i,s]=c.useState([]),[l]=o.useSelectedStylingBlocks(),a=o.useUpdateBlocksPropsRealtime(),p=o.useUpdateBlocksProps(),x=`${t.get(l,"0.prop")}_attrs`;z.useEffect(()=>{const n=t.map(t.get(r,x),(d,y)=>({key:y,value:d}));t.isEmpty(n)?s([]):s(n)},[t.get(r,x)]);const m=z.useCallback((n=[])=>{const d={};t.forEach(n,y=>{t.isEmpty(y.key)||t.set(d,y.key,y.value)}),p([t.get(r,"_id")],{[x]:d})},[r,a,x]);return e.jsxRuntimeExports.jsx("div",{className:"mb-20 flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(ke,{preloadedAttributes:i,onAttributesChange:m})})})})}),N=["px","%","em","rem","ch","vh","vw"],Se={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"}]},Te={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:"Styles",items:[{component:oe},{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:"accordion",heading:"Typography",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:N},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:N.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"}]},{styleType:"accordion",heading:"Background",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{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"}]}]},{heading:"Attributes",items:[{component:Ne}]}],Je=[{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:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:N},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:N.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:oe}]}],ne={"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:g.EyeOpenIcon,invisible:g.EyeClosedIcon,hidden:g.EyeClosedIcon,gap:g.BorderAllIcon,gapX:g.WidthIcon,gapY:g.HeightIcon,spaceX:g.WidthIcon,spaceY:g.HeightIcon,overscroll:g.BorderAllIcon,overscrollX:g.WidthIcon,overscrollY:g.HeightIcon,overflow:g.BorderAllIcon,overflowX:g.WidthIcon,overflowY:g.HeightIcon,top:g.ArrowUpIcon,right:g.ArrowRightIcon,bottom:g.ArrowDownIcon,left:g.ArrowLeftIcon,inset:g.BorderAllIcon,insetX:g.WidthIcon,insetY:g.HeightIcon,border:g.BorderAllIcon,borderX:g.WidthIcon,borderY:g.HeightIcon,borderTop:g.ArrowUpIcon,borderRight:g.ArrowRightIcon,borderBottom:g.ArrowDownIcon,borderLeft:g.ArrowLeftIcon,borderRadius:g.BorderAllIcon,borderRadiusX:g.WidthIcon,borderRadiusY:g.HeightIcon,borderRadiusTop:g.ArrowUpIcon,borderRadiusRight:g.ArrowRightIcon,borderRadiusBottom:g.ArrowDownIcon,borderRadiusLeft:g.ArrowLeftIcon,borderRadiusTopLeft:g.ArrowTopLeftIcon,borderRadiusTopRight:g.ArrowTopRightIcon,borderRadiusBottomRight:g.ArrowBottomRightIcon,borderRadiusBottomLeft:g.ArrowBottomLeftIcon,divideXWidth:g.WidthIcon,divideYWidth:g.HeightIcon,scale:g.BorderAllIcon,scaleX:g.WidthIcon,scaleY:g.HeightIcon,skewX:g.WidthIcon,skewY:g.HeightIcon,translateX:g.WidthIcon,translateY:g.HeightIcon,padding:g.BorderAllIcon,paddingX:g.WidthIcon,paddingY:g.HeightIcon,paddingTop:g.ArrowUpIcon,paddingRight:g.ArrowRightIcon,paddingBottom:g.ArrowDownIcon,paddingLeft:g.ArrowLeftIcon,margin:g.BorderAllIcon,marginX:g.WidthIcon,marginY:g.HeightIcon,marginTop:g.ArrowUpIcon,marginRight:g.ArrowRightIcon,marginBottom:g.ArrowDownIcon,marginLeft:g.ArrowLeftIcon,textLeft:g.AlignLeftIcon,textCenter:g.AlignCenterHorizontallyIcon,textRight:g.AlignRightIcon,textJustify:g.StretchHorizontallyIcon,italic:g.FontItalicIcon,underline:g.UnderlineIcon,overline:g.OverlineIcon,uppercase:g.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":g.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:g.Cross1Icon},O=c.createContext({canReset:!1,canChange:!0}),Ie=({children:r,canReset:i=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:i,canChange:s},children:r}),ie=({label:r,property:i,onChange:s})=>{const l=c.useMemo(()=>t.get($.CLASSES_LIST,`${i}.classes`,[""]),[i]),a=q(i),p=c.useMemo(()=>t.get(a,"cls",""),[a]),{canChange:x}=c.useContext(O),m=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:m?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value: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 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(U,{rounded:r,onChange:n=>s(n,i),selected:p,options:l,disabled:!x})})};function U({selected:r,onChange:i,rounded:s=!1,options:l,disabled:a=!1}){const p=r.replace(/.*:/g,"").trim(),{undo:x,redo:m}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||a,className:`${s?"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:n=>i(n.target.value),onKeyDown:n=>{n.ctrlKey&&(n.key==="z"&&x(),n.key==="y"&&m())},value:p,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(l.map(n=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:n,children:n})))]})}const Be=({property:r,onChange:i})=>{const{canReset:s,canChange:l}=c.useContext(O),a=q(r),p=c.useMemo(()=>t.get(a,"cls",""),[a]),x=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),m=x.indexOf(p)>-1?x.indexOf(p):0,n=/\[.*\]/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:n?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&&(!s||m-1<0),onClick:()=>i(t.nth(x,m-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(g.MinusIcon,{className:!l&&(!s||m-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ie,{label:!1,property:r,onChange:i})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!s||m+1>=x.length),onClick:()=>i(t.nth(x,m+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{className:!l&&(!s||m+1>=x.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Ae=({property:r,onChange:i})=>{const s=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:l}=c.useContext(O),a=q(r),p=c.useMemo(()=>t.get(a,"cls",""),[a]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,x=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!l,onClick:()=>i(x,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${p===x?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:c.createElement(t.get(ne,x,g.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(x))})]}))})},He={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ve=({property:r,onChange:i})=>{const s=q(r),l=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:a}=c.useContext(O),[p,x]=c.useState([]),[m,n]=c.useState({color:"",shade:""}),d=l.split("-"),y=t.get(d,"1",""),u=t.get(d,"2",""),f=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(x([]),n({color:h})):(x(["50","100","200","300","400","500","600","700","800","900"]),n(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[x,n]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(y))return x([]);x(["50","100","200","300","400","500","600","700","800","900"])},[y]);const b=c.useCallback(h=>{n({color:y,shade:h})},[y]);return c.useEffect(()=>{n({color:"",shade:""})},[s]),c.useEffect(()=>{const R=`${t.get(He,r,"")}-${m.color}${m.shade?`-${m.shade}`:""}`;R.match(new RegExp(t.get($.CLASSES_LIST,`${r}.regExp`,"")))&&i(R,r)},[m,i,r]),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(U,{disabled:!a,rounded:!0,selected:y,onChange:f,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(U,{rounded:!0,selected:u,disabled:!y||!a,onChange:b,options:p})})]})},ee=(r,i)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&i.includes(s))return{value:"",unit:s};const l=i.length?new RegExp(i.join("|"),"g"):/XXXXXX/g;s=s.replace(l,"");const a=r.match(l),p=a&&a.length>1,x=!t.isEmpty(s)&&Number.isNaN(Number(s));return p||x?{error:"Invalid value"}:a&&(a[0]==="auto"||a[0]==="none")?{value:a[0],unit:""}:{value:s,unit:a?a[0]:""}};const De=r=>{const i=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${i}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${i}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const l=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[l,a]=t.map(s.split("/"),p=>parseInt(p,10));return{value:i+(l/a*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${i+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}};const Pe=r=>{if(t.isEmpty(r))return{value:"",unit:""};const i=r.match(/\[.*\]/g);if(i===null)return Me(r);const s=t.get(i,"0","").replace(/\[|\]/g,""),l=r.startsWith("-")?"-":"",a=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${l}${a}`,unit:s.replace(a,"")}},Me=r=>t.isEmpty(r)?{value:"",unit:""}:De(r),le=c.createContext({setDragData:()=>{}}),$e=({unit:r,currentValue:i,onDrag:s,onDragEnd:l,onDragStart:a,negative:p,cssProperty:x})=>{const{setDragData:m}=c.useContext(le);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:n=>{const d={onDrag:s,onDragEnd:l,dragging:!0,dragStartY:n.pageY,dragStartValue:`${i}`,dragUnit:r,negative:p,cssProperty:x};a(d),m(d)},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(g.RowSpacingIcon,{})})},Le=({onSelect:r,current:i,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.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:i===l?"primary":void 0,size:"sm",onClick:a=>{a.stopPropagation(),r(l)},children:l},l))}),te=50,Oe=r=>{const[i,s]=c.useState(!1),[l,a]=c.useState(""),{currentClass:p,onChange:x,classPrefix:m,cssProperty:n,units:d,negative:y}=r,[u,f]=c.useState(n!=null&&n.toLowerCase().includes("width")?"%":d[0]),[b,h]=c.useState(!1),[R,C]=c.useState(""),[B,_]=c.useState(!1),[V,E]=c.useState(!1);c.useEffect(()=>{const{value:j,unit:v}=Pe(p);if(v===""){a(j),f(n!=null&&n.toLowerCase().includes("width")?"%":t.first(d));return}f(v),a(v==="class"||t.isEmpty(j)?"":j)},[p,n,d]);const k=W.useThrottledCallback(j=>x(j),[x],te),w=W.useThrottledCallback(j=>x(j,!1),[x],te),T=c.useCallback((j=!1)=>{const v=ee(`${l}`,d);if(t.get(v,"error",!1)){h(!0);return}const S=t.get(v,"unit")!==""?t.get(v,"unit"):u;if(S==="auto"||S==="none"){k(`${m}${S}`);return}if(t.get(v,"value")==="")return;const H=`${t.get(v,"value","").startsWith("-")?"-":""}${m}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;j?w(H):k(H)},[k,w,l,u,m,d]),D=c.useCallback(j=>{const v=ee(`${l}`,d);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){k(`${m}${j}`);return}if(t.get(v,"value")==="")return;const S=t.get(v,"unit")!==""?t.get(v,"unit"):j,H=`${t.get(v,"value","").startsWith("-")?"-":""}${m}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(H)},[k,l,m,d]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:u==="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(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(g.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 ${B?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(u)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:u==="class",onKeyPress:j=>{j.key==="Enter"&&T()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),E(!0);const v=t.parseInt(j.target.value);let S=t.isNaN(v)?0:v;j.keyCode===38&&(S+=1),j.keyCode===40&&(S-=1);const A=`${S}`,pe=`${A.startsWith("-")?"-":""}${m}[${A.replace("-","")}${u==="-"?"":u}]`;w(pe)},onKeyUp:j=>{V&&(j.preventDefault(),E(!1))},onBlur:()=>T(),onChange:j=>{h(!1),a(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),s(!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(" ",b?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:i,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!i),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${d.length===1?"px-2 font-semibold":""}`,children:u}),d.length>1?e.jsxRuntimeExports.jsx(g.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Le,{units:d,current:u,onSelect:j=>{s(!1),f(j),D(j)}})})})]})]}),["none","auto"].indexOf(u)!==-1||B?null:e.jsxRuntimeExports.jsx($e,{onDragStart:()=>_(!0),onDragEnd:j=>{if(C(()=>""),_(!1),t.isEmpty(j))return;const v=`${j}`,A=`${v.startsWith("-")?"-":""}${m}[${v.replace("-","")}${u==="-"?"":u}]`;k(A)},onDrag:j=>{if(t.isEmpty(j))return;C(j);const v=`${j}`,A=`${v.startsWith("-")?"-":""}${m}[${v.replace("-","")}${u==="-"?"":u}]`;w(A)},currentValue:l,unit:u,negative:y,cssProperty:n})]})})})},q=r=>{const i=o.useSelectedBlockCurrentClasses();return t.findLast(i,{property:r})},qe=(r,i)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[i]},ze={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},se={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},We=r=>`${r.toUpperCase()} ${se[r]?`(${se[r]} & up)`:""}`,K=r=>{const{t:i}=I.useTranslation(),{type:s="icons",label:l,property:a,onEmitChange:p=()=>{},units:x,negative:m=!1}=r,[n]=o.useDarkMode(),[d]=o.useStylingState(),[,y]=o.useCanvasWidth(),u=q(a),f=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),R=c.useMemo(()=>t.get(u,"fullCls",""),[u]),C=c.useCallback((w,T=!0)=>{const D={dark:n,mq:y,mod:d,cls:w,property:a,fullCls:""};(n||d!=="")&&(D.mq="xs");const j=$.generateFullClsName(D);f(h,[j],T)},[h,n,y,d,a,f]),B=c.useCallback(()=>{b(h,[R])},[h,R,b]),_=c.useMemo(()=>qe(u,y),[u,y]);c.useEffect(()=>{p(_,u)},[_,p,u]);const[,,V]=o.useCanvasWidth(),E=c.useCallback(w=>{V({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[w])},[V]),k=t.get(u,"dark",null)===n&&t.get(u,"mod",null)===d&&t.get(u,"mq",null)===y;return e.jsxRuntimeExports.jsx(Ie,{canChange:_,canReset:u&&k,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] ${u&&!k?"text-foreground":""}`,children:i(l)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[s==="arbitrary"?e.jsxRuntimeExports.jsx(Oe,{currentClass:t.get(u,"cls",""),classPrefix:t.get(ze,a,""),units:x||[],onChange:C,negative:m,cssProperty:a}):null,s==="icons"&&e.jsxRuntimeExports.jsx(Ae,{property:a,onChange:C}),s==="range"&&e.jsxRuntimeExports.jsx(Be,{property:a,onChange:C}),s==="color"&&e.jsxRuntimeExports.jsx(Ve,{property:a,onChange:C}),s==="dropdown"&&e.jsxRuntimeExports.jsx(ie,{label:l,property:a,onChange:C})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${R?"visible":"invisible"}`,children:k?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>B(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(g.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):_&&u?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(g.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:[We(t.get(u,"mq")),n&&!u.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>E(t.get(u,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(u,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Fe=["px","%","em","rem","ch","vh","vw"],ae=({label:r,options:i,borderB:s=!1,borderT:l=!1,type:a="arbitrary",units:p=Fe,negative:x=!1})=>{const{t:m}=I.useTranslation(),[n,d]=c.useState(i[0].key),y=o.useSelectedBlockCurrentClasses(),u=c.useCallback(f=>t.map(y,"property").includes(f),[y]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:m(r)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:c.Children.toArray(i.map(({label:f,key:b})=>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:()=>d(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===n?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[c.createElement("div",{className:u(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),c.createElement(t.get(ne,b,g.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(f))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(K,{type:a,units:[...p],label:"",property:n,negative:x})})]})},Xe=({heading:r,items:i})=>{const{t:s}=I.useTranslation(),l=o.useSelectedBlockCurrentClasses(),a=c.useMemo(()=>{const p=n=>t.flatten(n.map(d=>d.styleType==="multiple"?t.map(d.options,"key"):d.property)),x=t.flatten(i.map(n=>n.styleType==="accordion"?p(n.items):n.styleType==="multiple"?t.map(n.options,"key"):n.property)),m=t.map(l,"property");return t.intersection(x,m).length>0},[l,i]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s(r),a?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${a?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:i.map(p=>p.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...p},p.label):e.jsxRuntimeExports.jsx(K,{...p},p.label))})]})},Ye=c.createContext({}),Y=({section:r})=>{const{t:i}=I.useTranslation(),s=o.useSelectedBlockCurrentClasses(),l=o.useSelectedBlock(),a=c.useCallback((n=[])=>{const d={};for(let u=0;u<s.length;u++)d[s[u].property]=s[u].cls;let y=!0;for(const u in n)if(!t.has(d,u)||d[u]!==n[u]){y=!1;break}return y},[s]),p=c.useMemo(()=>({}),[]),[x]=o.useSelectedStylingBlocks(),m=c.useMemo(()=>{const n=`${X.get(x,"0.prop")}_attrs`;return!X.isEmpty(X.get(l,n,{}))},[x]);return e.jsxRuntimeExports.jsx(Ye.Provider,{value:p,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"border-b border-gray-300 bg-gray-200 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.heading==="Attributes"&&m?e.jsxRuntimeExports.jsx("span",{className:"mr-2 inline-block h-[8px] w-[8px] rounded-full bg-blue-600"}):null,e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-2",children:i(r.heading)})]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(n=>t.has(n,"component")?c.createElement(n.component,{key:n.label}):t.has(n,"styleType")?n.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...n},n.label):n.styleType==="accordion"&&a(n==null?void 0:n.conditions)?e.jsxRuntimeExports.jsx(Xe,{...n},n.label):null:e.jsxRuntimeExports.jsx(K,{...n},n.label)))})]})})},Ze=()=>{const r=o.useSelectedBlock(),[i]=o.useSelectedStylingBlocks(),{t:s}=I.useTranslation(),l=L.useGlobalStylingPresets(),a=o.useAddClassesToBlocks(),p=L.getBlockComponent(r._type),x=t.get(t.first(i),"prop"),m=t.get(p.props,`${x}.presets`,{});if(t.isEmpty(l)&&(!t.has(p,"props")||t.isEmpty(m)))return null;const n=d=>{const y=d.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");a([r._id],y,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"w-full",size:"sm",children:[s("Apply Presets"),e.jsxRuntimeExports.jsx(g.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(m)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[p.type," ",s("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(m).map(d=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>n(m[d]),children:[t.capitalize(t.startCase(s(d))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]}),t.isEmpty(l)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:s("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(l).map(d=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>n(l[d]),children:[t.capitalize(t.startCase(s(d))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]})]})})]})})};function Ue(){const{flexChild:r,gridChild:i}=o.useSelectedBlocksDisplayChild(),[s]=o.useSelectedStylingBlocks();return t.isEmpty(s)?null:e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(Ze,{}),e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Styles"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(Y,{section:Se}),i?e.jsxRuntimeExports.jsx(Y,{section:Te}):null,_e.map(l=>e.jsxRuntimeExports.jsx(Y,{section:l},l.heading))]})]})}const Ke={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ge=()=>{const r=o.useSelectedBlock(),{t:i}=I.useTranslation(),[s,l]=c.useState(""),[a,p]=c.useState({onDrag:n=>n,onDragEnd:n=>n,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),x=W.useThrottledCallback(n=>{const d=!t.get(a,"negative",!1),y=t.get(a,"cssProperty","");let u=parseFloat(a.dragStartValue);u=t.isNaN(u)?0:u;let f=Ke[a.dragUnit];(t.startsWith(y,"scale")||y==="opacity")&&(f=10);let h=(a.dragStartY-n.pageY)/f+u;d&&h<0&&(h=0),y==="opacity"&&h>1&&(h=1),a.onDrag(`${h}`),l(`${h}`)},[a],50),m=c.useCallback(()=>{setTimeout(()=>a.onDragEnd(`${s}`),100),p({onDrag:n=>n,onDragEnd:n=>n,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[a,s,p]);return t.isNull(r)?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(g.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(M.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(le.Provider,{value:{setDragData:p},children:[a.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:x,onMouseUp:()=>m(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsx(we,{}),e.jsxRuntimeExports.jsx(Ue,{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})})};exports.default=Ge;
|