@chaibuilder/sdk 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-bebc8e38.cjs → AddBlocks-34209fc6.cjs} +1 -1
- package/dist/{AddBlocks-94cf46d7.js → AddBlocks-788a1feb.js} +1 -1
- package/dist/{BrandingOptions-703e2c8b.cjs → BrandingOptions-049505cb.cjs} +1 -1
- package/dist/{BrandingOptions-c22ad026.js → BrandingOptions-3bbb19f0.js} +1 -1
- package/dist/{CanvasArea-cd4da772.cjs → CanvasArea-0eee4dd1.cjs} +2 -2
- package/dist/{CanvasArea-90b0f63d.js → CanvasArea-ef1a4dcd.js} +2 -2
- package/dist/{CurrentPage-7a6d4643.cjs → CurrentPage-0c812168.cjs} +1 -1
- package/dist/{CurrentPage-aa4de22f.js → CurrentPage-6c4a6a2d.js} +1 -1
- package/dist/{Layers-cff22f39.js → Layers-e0ac56d5.js} +2 -2
- package/dist/{Layers-94260926.cjs → Layers-fad860a5.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-d9bcd24a.js → MarkAsGlobalBlock-981cb7fe.js} +1 -1
- package/dist/{MarkAsGlobalBlock-4f1e20b0.cjs → MarkAsGlobalBlock-cf4c307c.cjs} +1 -1
- package/dist/{PagesPanel-53b0eff4.cjs → PagesPanel-4dcdc316.cjs} +1 -1
- package/dist/{PagesPanel-bb740126.js → PagesPanel-805d98b6.js} +2 -2
- package/dist/{ProjectPanel-c0f6a656.cjs → ProjectPanel-35dcc456.cjs} +1 -1
- package/dist/{ProjectPanel-7dab69b4.js → ProjectPanel-636b6557.js} +2 -2
- package/dist/{Settings-f4f20456.cjs → Settings-10a6a944.cjs} +1 -1
- package/dist/{Settings-00337fa2.js → Settings-7f7e04f7.js} +1 -1
- package/dist/{SidePanels-ef5cf825.js → SidePanels-2eeb83be.js} +2 -2
- package/dist/{SidePanels-b3e85d16.cjs → SidePanels-47ee2ffc.cjs} +1 -1
- package/dist/{Topbar-58a2d4b3.cjs → Topbar-01491209.cjs} +1 -1
- package/dist/{Topbar-3c249ffe.js → Topbar-bc9054ff.js} +1 -1
- package/dist/{add-page-modal-7f75bbb5.cjs → add-page-modal-6e30a762.cjs} +1 -1
- package/dist/{add-page-modal-7ccb5b8e.js → add-page-modal-c90cbdf2.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-a88a20fd.cjs → delete-page-modal-db9ceae1.cjs} +1 -1
- package/dist/{delete-page-modal-4af2dc82.js → delete-page-modal-ff19917a.js} +1 -1
- package/dist/{index-11d42656.js → index-41ba78a6.js} +1589 -1589
- package/dist/{index-b7e3f3cb.cjs → index-ef6fb010.cjs} +30 -30
- package/dist/{page-viewer-f4770b77.js → page-viewer-5e200beb.js} +2 -2
- package/dist/{page-viewer-2936d827.cjs → page-viewer-68e74178.cjs} +1 -1
- package/dist/{project-general-setting-61e24f3d.js → project-general-setting-1ec54448.js} +1 -1
- package/dist/{project-general-setting-6f0e0138.cjs → project-general-setting-5f3c1efc.cjs} +1 -1
- package/dist/{single-page-detail-515b1f19.js → single-page-detail-8d824bc8.js} +2 -2
- package/dist/{single-page-detail-abca8ffb.cjs → single-page-detail-ea470eb4.cjs} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var he=Object.create;var se=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var je=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var Re=(s,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of be(o))!fe.call(s,i)&&i!==r&&se(s,i,{get:()=>o[i],enumerable:!(n=ye(o,i))||n.enumerable});return s};var ve=(s,o,r)=>(r=s!=null?he(je(s)):{},Re(o||!s||!s.__esModule?se(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),x=require("react"),G=require("@react-hookz/web"),t=require("lodash"),ae=require("react-i18next"),u=require("@radix-ui/react-icons"),M=require("./tabs-860e37aa.cjs"),Ee=require("@rjsf/core"),we=require("@rjsf/validator-ajv8"),f=require("./index-b7e3f3cb.cjs"),z=require("@chaibuilder/blocks"),K=require("lucide-react"),pe=require("./useChaiExternalData-a90e8aac.cjs"),E=require("./useBuilderProp-adacf42f.cjs"),$=require("./dialog-170eaad9.cjs"),Z=require("./popover-7cb9079b.cjs"),P=require("./command-b1103666.cjs"),T=require("./accordion-0afd8143.cjs"),Y=require("./link-24679521.cjs"),Ce=require("jotai"),ke=require("react-autosuggest"),Ne=require("fuse.js"),O=require("./html-to-json-aadcbf66.cjs"),ee=require("./label-167415e5.cjs"),Se=require("./MODIFIERS-4716c669.cjs"),Te=require("./scroll-area-bb343b86.cjs"),C=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("sonner");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-dialog");require("@radix-ui/react-popover");require("cmdk");require("@radix-ui/react-accordion");require("react-icons-picker");require("./ImagesPanel-8b7a989d.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-label");require("@radix-ui/react-select");function Ie(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(o,r,n.get?n:{enumerable:!0,get:()=>s[r]})}}return o.default=s,Object.freeze(o)}const X=Ie(x),Be=x.lazy(()=>import("react-json-view"));function Ae(s){const o=[],r={};function n(i,a){t.forEach(a,(d,p)=>{const l=i?`${i}.${p}`:p,m=t.isArray(d)?"list":typeof d;o.push(l),r[l]=m==="string"?"text":m==="object"?"model":m,m==="object"&&!t.isArray(d)&&n(l,d)})}return n("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:r}}const J=({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(f.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Be,{style:{maxHeight:"40vh",overflowY:"auto"},name:"Content",enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:s,collapsed:!0})})]}):e.jsxRuntimeExports.jsxs("div",{className:"text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},re=({type:s,value:o="",setValue:r,data:n,onChange:i,dataType:a,appliedBindings:d})=>{const{paths:p,pathsType:l}=Ae(n),m=s==="PROP"?z.getBlockComponent(n==null?void 0:n._type):{},g=s==="PROP",[c,b]=x.useState(!1),y=x.useMemo(()=>s==="PROP"?p.filter(h=>!t.includes(d,h)&&t.get(m,`props.${t.first(t.split(h,"."))}.binding`)):p.filter(h=>a===t.get(l,h,"")),[s,p,d,a,m]);return x.useEffect(()=>{o&&i(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(Z.Popover,{open:c,onOpenChange:b,children:[e.jsxRuntimeExports.jsx(Z.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(E.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(o)?"bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center":"min-w-[350px] justify-between items-center"}`,children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-sm pr-8",children:[g&&e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full",children:t.startCase(a)}),o]}),e.jsxRuntimeExports.jsx("span",{className:"text-[9px] text-blue-400 underline cursor-pointer hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(Z.PopoverContent,{className:"p-0 z-[999] min-w-[300px]",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(y,h=>e.jsxRuntimeExports.jsxs(P.CommandItem,{value:h,className:`cursor-pointer ${g?"flex justify-between items-center":"flex flex-col items-start justify-start"}`,onSelect:R=>{r(t.find(y,N=>N===R)||null),b(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(K.Check,{className:`w-4 h-4 text-green-500 ${o===h?"":"opacity-0"}`}),h]}),g?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full",children:t.startCase(t.get(l,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(J,{data:t.get(n,h)})})]},h))})]})]})})]})]}),!g&&!t.isEmpty(o)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(J,{data:t.get(n,o,""),fullView:!0})})]})},He=({appliedBindings:s=[],onAddBinding:o,editMode:r,item:n})=>{const[i,a]=x.useState(r?n.key:""),[d,p]=x.useState(r?n.value:""),l=f.useSelectedBlock(),[m]=pe.useChaiExternalData(),g=x.useCallback((y,h)=>{if(t.isEmpty(y))return"";{const R=t.get(h==="PROP"?l:m,y,"");if(t.isArray(R))return"list";const N=typeof R;return N==="string"?"text":N==="object"?"model":N}},[l,m]),[c,b]=x.useState(r?g(n.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs($.DialogHeader,{children:[e.jsxRuntimeExports.jsx($.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx($.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 relative",children:[e.jsxRuntimeExports.jsx(re,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:a,onChange:y=>{const h=g(y,"PROP");a(y),c!==h&&p(""),b(h)},data:l,dataType:c,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(re,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:d,setValue:p,onChange:y=>{const h=g(y,"PATH");p(c===h?y:"")},data:m,dataType:c,appliedBindings:s})]}),e.jsxRuntimeExports.jsx($.DialogFooter,{children:e.jsxRuntimeExports.jsx(E.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(d),onClick:()=>o({key:i,value:d}),children:"Save"})})]})},ue=({children:s,onAddBinding:o,appliedBindings:r,editMode:n=!0,item:i={}})=>{const[a,d]=x.useState(!1);return e.jsxRuntimeExports.jsxs($.Dialog,{children:[e.jsxRuntimeExports.jsx($.DialogTrigger,{asChild:!0,onClick:()=>d(!0),children:s}),a&&e.jsxRuntimeExports.jsx($.DialogContent,{children:e.jsxRuntimeExports.jsx(He,{item:i,editMode:n,appliedBindings:r,onAddBinding:p=>{o(p),d(!1)}})})]})},Ve=({item:s,onAddBinding:o,onRemove:r,selectedBlock:n,dataProvider:i,appliedBindings:a})=>{const[d,p]=x.useState("string"),l=(m,g)=>{if(t.isEmpty(m))return"";{const c=t.get(g==="PROP"?n:i,m,"");if(t.isArray(c))return"list";const b=typeof c;return b==="string"?"text":b==="object"?"model":b}};return x.useEffect(()=>p(()=>l(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col border border-gray-200 relative rounded-md p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-gray-500 font-normal text-sm",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(J,{data:t.get(i,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(ue,{editMode:!0,onAddBinding:o,appliedBindings:a,item:s,children:e.jsxRuntimeExports.jsx(K.EditIcon,{className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200"})}),e.jsxRuntimeExports.jsx(K.TrashIcon,{onClick:()=>r(),className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]}),!t.isEmpty(d)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(d)})]})},De=({bindingData:s,onChange:o})=>{const r=f.useSelectedBlock(),[n]=pe.useChaiExternalData(),i=z.getChaiDataProviders(),[a,d]=x.useState(t.map(s,(c,b)=>({key:b,value:c})));x.useEffect(()=>{d(t.map(s,(c,b)=>({key:b,value:c})))},[r==null?void 0:r._id]);const p=x.useMemo(()=>{if(t.isEmpty(n))return!0;if(t.isEmpty(a))return!1;const c=t.last(a);return t.isEmpty(c==null?void 0:c.key)||t.isEmpty(c==null?void 0:c.value)},[n,a]),l=c=>{const b=t.filter(a,y=>y.key!==c.key);d([...b,c]),g([...b,c])},m=c=>{const b=t.filter(a,(y,h)=>c!==h);g([...b])},g=x.useCallback((c=[])=>{if(d(c),t.isEmpty(c)){o({});return}const b={};t.forEach(c,y=>{!t.isEmpty(y==null?void 0:y.key)&&!t.isEmpty(y==null?void 0:y.value)&&t.set(b,y.key,y.value)}),o(b)},[r]);return t.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(a,(c,b)=>e.jsxRuntimeExports.jsx(Ve,{item:c,onAddBinding:l,onRemove:()=>m(b),selectedBlock:r,dataProvider:n,appliedBindings:t.map(a,"key")},c.key)),e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(ue,{appliedBindings:t.map(a,"key"),onAddBinding:l,children:e.jsxRuntimeExports.jsx("button",{disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${p?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(n)?e.jsxRuntimeExports.jsx("small",{className:"text-gray-500 text-[9.5px]",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),p&&e.jsxRuntimeExports.jsx(E.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(n)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},Le=De,Pe=()=>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"}),oe=({createHistorySnapshot:s,properties:o,formData:r,onChange:n})=>{const[i]=f.useActiveLanguage(),a={type:"object",properties:{}},d={};return Object.keys(o).forEach(p=>{const l=o[p];if(t.includes(["slot","styles"],l.type))return;const m=t.get(l,"i18n",!1)?`${p}-${i}`:p;a.properties[m]=f.getBlockJSONFromSchemas(l,i),d[m]=f.getBlockJSONFromUISchemas(l,i)}),e.jsxRuntimeExports.jsx(Ee,{widgets:{binding:Pe,richtext:Y.RichTextEditorField,icon:Y.IconPickerField,image:Y.ImagePickerField},fields:{link:Y.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:we,uiSchema:d,onBlur:s,schema:a,formData:r,onChange:n})};function $e(){const s=f.useSelectedBlock(),{createSnapshot:o}=f.useCanvasHistory(),r=f.useUpdateBlocksPropsRealtime(),n=z.getBlockComponent(s._type),i={...s},a=()=>o(),d=({formData:g},c)=>{if(c){const b=c.replace("root.","");r([s._id],{[b]:t.get(g,b)})}},p={_name:z.SingleLineText({title:"Name",default:t.get(s,"_name",s._type)})},l=t.keys(t.get(i,"_bindings",{})),m=x.useMemo(()=>{const g=t.cloneDeep(t.get(n,"props",{}));return t.each(l,c=>{delete g[c]}),g},[n,l]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(oe,{onChange:d,createHistorySnapshot:a,formData:i,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Le,{bindingData:t.get(i,"_bindings",{}),onChange:g=>{d({formData:{...i,_bindings:g}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(T.AccordionContent,{className:"pt-4",children:[t.isEmpty(l)?"":e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(l,t.capitalize).join(", ")})," ",l.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(oe,{onChange:d,createHistorySnapshot:a,formData:i,properties:m})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const ne=new Ne(O.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Me(){var B;const[s]=f.useSelectedStylingBlocks(),o=f.useSelectedBlock(),r=f.useAddClassesToBlocks(),n=f.useRemoveClassesFromBlocks(),[i]=f.useSelectedBlockIds(),[a,d]=x.useState(""),p=(B=t.first(s))==null?void 0:B.prop,l=t.reject((t.get(o,p,"").replace(Se.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),m=()=>{const w=a.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(i,w,!0),d("")},[g,c]=x.useState([]),b=({value:w})=>{const V=w.trim().toLowerCase(),A=V.match(/.+:/g);let k=[];if(A&&A.length>0){const[H]=A,L=V.replace(H,"");k=ne.search(L).map(j=>({...j,item:{...j.item,name:H+j.item.name}}))}else k=ne.search(V);c(t.map(k,"item"))},y=()=>{c([])},h=w=>w.name,R=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),N={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:a,onKeyDown:w=>{w.key==="Enter"&&a.trim()!==""&&m()},onChange:(w,{newValue:V})=>d(V),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 ${g.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(ee.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(ke,{suggestions:g,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:y,getSuggestionValue:h,renderSuggestion:R,inputProps:N,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(E.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:m,disabled:a.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(l)&&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"}),X.Children.toArray(l.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:()=>n(i,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const I=["px","%","em","rem","ch","vh","vw"],Oe={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:I,property:"flexBasis"},{type:"range",label:"Order",property:"order"},{type:"dropdown",label:"Flex",property:"flexGrowShrink"},{type:"dropdown",label:"Grow",property:"flexGrow"},{type:"dropdown",label:"Shrink",property:"flexShrink"}]},qe={heading:"Grid Child",items:[{type:"range",label:"Col Span",property:"gridColSpan"},{type:"range",label:"Col Start",property:"gridColStart"},{type:"range",label:"Col End",property:"gridColEnd"},{type:"range",label:"Row Span",property:"gridRowSpan"},{type:"range",label:"Row Start",property:"gridRowStart"},{type:"range",label:"Row End",property:"gridRowEnd"},{type:"range",label:"Order",property:"order"}]},_e=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:I},{styleType:"accordion",heading:"Flex options",items:[{type:"dropdown",label:"Direction",property:"flexDirection"},{type:"dropdown",label:"Wrap",property:"flexWrap"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"Grid options",items:[{type:"range",label:"Columns",property:"gridColumns"},{type:"range",label:"Rows",property:"gridRows"},{type:"dropdown",label:"Auto Flow",property:"gridAutoFlow"},{type:"dropdown",label:"Auto Cols",property:"gridAutoColumns"},{type:"dropdown",label:"Auto Rows",property:"gridAutoRows"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",units:["px","rem"],options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"Visibility & Opacity",items:[{type:"dropdown",label:"Visibility",property:"visibility",units:I},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...I,"auto"],options:[{key:"margin",label:"All"},{key:"marginX",label:"Left-Right"},{key:"marginY",label:"Top-Bottom"},{key:"marginTop",label:"Top"},{key:"marginRight",label:"Right"},{key:"marginBottom",label:"Bottom"},{key:"marginLeft",label:"Left"}]},{styleType:"multiple",label:"Padding",options:[{key:"padding",label:"All"},{key:"paddingX",label:"Left-Right"},{key:"paddingY",label:"Top-Bottom"},{key:"paddingTop",label:"Top"},{key:"paddingRight",label:"Right"},{key:"paddingBottom",label:"Bottom"},{key:"paddingLeft",label:"Left"}]},{styleType:"multiple",label:"Space Between",options:[{key:"spaceX",label:"Left-Right"},{key:"spaceY",label:"Top-Bottom"}]}]},{heading:"Size",items:[{type:"arbitrary",label:"Width",units:I.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:I.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:I.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:I.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:I.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:I.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"Object options & aspect ratio",items:[{type:"dropdown",label:"Aspect",property:"aspectRatio"},{type:"dropdown",label:"Fit",property:"objectFit"},{type:"dropdown",label:"Position",property:"objectPosition"}]}]},{heading:"Position",items:[{type:"icons",label:"Position",property:"position"},{styleType:"accordion",heading:"Position options",items:[{styleType:"multiple",label:"Direction",options:[{key:"top",label:"Top"},{key:"right",label:"Right"},{key:"bottom",label:"Bottom"},{key:"left",label:"Left"}]},{styleType:"multiple",label:"Inset",options:[{key:"inset",label:"All"},{key:"insetX",label:"Left Right"},{key:"insetY",label:"Top Bottom"}]},{type:"arbitrary",label:"Z-Chai",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"Float & Clear",items:[{type:"icons",label:"Float",property:"float"},{type:"dropdown",label:"Clear",property:"clear"}]},{styleType:"accordion",heading:"Overflow & Overscroll",items:[{styleType:"multiple",type:"dropdown",label:"Overflow",options:[{key:"overflow",label:"All"},{key:"overflowX",label:"Left-Right"},{key:"overflowY",label:"Top-Bottom"}]},{styleType:"multiple",type:"dropdown",label:"Overscroll",options:[{key:"overscroll",label:"All"},{key:"overscrollX",label:"Left-Right"},{key:"overscrollY",label:"Top-Bottom"}]}]}]},{heading:"Typography",items:[{type:"dropdown",property:"fontFamily",label:"Font"},{type:"arbitrary",property:"fontSize",label:"Size",units:I},{type:"arbitrary",property:"lineHeight",label:"Height",units:I.concat("-")},{type:"range",property:"fontWeight",label:"Weight"},{type:"color",property:"textColor",label:"Color"},{styleType:"accordion",heading:"Alignments",items:[{type:"dropdown",property:"textAlign",label:"Align"},{type:"dropdown",property:"verticalAlign",label:"V. Align"}]},{styleType:"accordion",heading:"Spacing, decoration & more",items:[{type:"dropdown",property:"letterSpacing",label:"Spacing"},{type:"dropdown",property:"textDecoration",label:"Decoration"},{type:"range",property:"textDecorationThickness",label:"Thickness"},{type:"dropdown",property:"textTransform",label:"Transform"}]},{styleType:"accordion",heading:"White space & breaks",items:[{type:"dropdown",property:"whitespace",label:"Whitespace"},{type:"dropdown",property:"wordBreak",label:"Wordbreak"}]}]},{heading:"Background",items:[{type:"color",label:"Bg. Color",property:"backgroundColor"},{styleType:"accordion",heading:"Position, Size & more",items:[{type:"dropdown",label:"Attachment",property:"backgroundAttachment"},{type:"dropdown",label:"Clipping",property:"backgroundClip"},{type:"dropdown",label:"Origin",property:"backgroundOrigin"},{type:"dropdown",label:"Position",property:"backgroundPosition"},{type:"dropdown",label:"Repeat",property:"backgroundRepeat"},{type:"dropdown",label:"Size",property:"backgroundSize"}]},{type:"dropdown",label:"Gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"Gradient colors",items:[{type:"color",label:"From",property:"fromColor"},{type:"color",label:"Via",property:"viaColor"},{type:"color",label:"To",property:"toColor"}]}]},{heading:"Border & Outline",items:[{styleType:"multiple",type:"dropdown",label:"Width",options:[{key:"border",label:"All"},{key:"borderX",label:"Left Right"},{key:"borderY",label:"Top bottom"},{key:"borderTop",label:"Top"},{key:"borderRight",label:"Right"},{key:"borderBottom",label:"Bottom"},{key:"borderLeft",label:"Left"}]},{styleType:"multiple",type:"dropdown",label:"Corners",options:[{key:"borderRadius",label:"All"},{key:"borderRadiusTop",label:"Top"},{key:"borderRadiusRight",label:"Right"},{key:"borderRadiusBottom",label:"Bottom"},{key:"borderRadiusLeft",label:"Left"},{key:"borderRadiusTopLeft",label:"Top Left"},{key:"borderRadiusTopRight",label:"Top right"},{key:"borderRadiusBottomRight",label:"Bottom right"},{key:"borderRadiusBottomLeft",label:"Bottom left"}]},{type:"color",label:"Color",property:"borderColor"},{type:"dropdown",label:"Style",property:"borderStyle"},{styleType:"accordion",heading:"Divide options",items:[{styleType:"multiple",type:"range",label:"Width",options:[{key:"divideXWidth",label:"Left Right"},{key:"divideYWidth",label:"Top Bottom"}]},{type:"color",label:"Color",property:"divideColor"},{type:"dropdown",label:"Style",property:"divideStyle"}]},{styleType:"accordion",heading:"Outline styling",items:[{type:"range",label:"Width",property:"outlineWidth"},{type:"range",label:"Offset",property:"outlineOffset"},{type:"dropdown",label:"Style",property:"outlineStyle"}]},{styleType:"accordion",heading:"Ring options",items:[{type:"range",label:"Width",property:"ringWidth"},{type:"color",label:"Color",property:"ringColor"},{type:"range",label:"Offset",property:"ringOffsetWidth"},{type:"color",label:"Off. color",property:"ringOffsetColor"}]}]},{heading:"Effect & Animation",items:[{type:"range",label:"Shadow",property:"boxShadow"},{type:"color",label:"Color",property:"boxShadowColor"},{type:"dropdown",label:"Cursor",property:"cursor"},{styleType:"accordion",heading:"Blend & Cursor",items:[{type:"dropdown",label:"Mix Blend",property:"mixBlendMode"},{type:"dropdown",label:"Bg. Blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"Transform",items:[{type:"dropdown",label:"Origin",property:"transformOrigin"},{styleType:"multiple",label:"Scale",units:["-"],options:[{key:"scale",label:"All"},{key:"scaleX",label:"Left-Right"},{key:"scaleY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Skew",units:["deg"],options:[{key:"skewX",label:"Left-Right"},{key:"skewY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Translate",negative:!0,options:[{key:"translateX",label:"Left-Right"},{key:"translateY",label:"Top-Bottom"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"Rotate",property:"rotate"}]},{styleType:"accordion",heading:"Animation",items:[{type:"dropdown",label:"Animation",property:"animation"},{type:"dropdown",label:"Transition",property:"transition"},{type:"dropdown",label:"Easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"Duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"Delay",property:"delay"}]}]},{heading:"Classes",items:[{component:Me}]}],de={"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.createContext({canReset:!1,canChange:!0}),We=({children:s,canReset:o=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(_.Provider,{value:{canReset:o,canChange:r},children:s}),ce=({label:s,property:o,onChange:r})=>{const n=x.useMemo(()=>t.get(O.CLASSES_LIST,`${o}.classes`,[""]),[o]),i=W(o),a=x.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:d}=x.useContext(_),p=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(P.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.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(E.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Q,{rounded:s,onChange:l=>r(l,o),selected:a,options:n,disabled:!d})})};function Q({selected:s,onChange:o,rounded:r=!1,options:n,disabled:i=!1}){const a=s.replace(/.*:/g,"").trim(),{undo:d,redo:p}=f.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||i,className:`${r?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:l=>o(l.target.value),onKeyDown:l=>{l.ctrlKey&&(l.key==="z"&&d(),l.key==="y"&&p())},value:a,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),x.Children.toArray(n.map(l=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:l,children:l})))]})}const Fe=({property:s,onChange:o})=>{const{canReset:r,canChange:n}=x.useContext(_),i=W(s),a=x.useMemo(()=>t.get(i,"cls",""),[i]),d=x.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=d.indexOf(a)>-1?d.indexOf(a):0,l=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:l?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:a}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!r||p-1<0),onClick:()=>o(t.nth(d,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!n&&(!r||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ce,{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:!n&&(!r||p+1>=d.length),onClick:()=>o(t.nth(d,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!n&&(!r||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},Ye=({property:s,onChange:o})=>{const r=x.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=x.useContext(_),i=W(s),a=x.useMemo(()=>t.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,d=>e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>o(d,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${a===d?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:x.createElement(t.get(de,d,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},Xe={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},ze=({property:s,onChange:o})=>{const r=W(s),n=x.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:i}=x.useContext(_),[a,d]=x.useState([]),[p,l]=x.useState({color:"",shade:""}),m=n.split("-"),g=t.get(m,"1",""),c=t.get(m,"2",""),b=x.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),l({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),l(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[d,l]);x.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(g))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[g]);const y=x.useCallback(h=>{l({color:g,shade:h})},[g]);return x.useEffect(()=>{l({color:"",shade:""})},[r]),x.useEffect(()=>{const R=`${t.get(Xe,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;R.match(new RegExp(t.get(O.CLASSES_LIST,`${s}.regExp`,"")))&&o(R,s)},[p,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(Q,{disabled:!i,rounded:!0,selected:g,onChange:b,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(Q,{rounded:!0,selected:c,disabled:!g||!i,onChange:y,options:a})})]})},ie=(s,o)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&o.includes(r))return{value:"",unit:r};const n=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;r=r.replace(n,"");const i=s.match(n),a=i&&i.length>1,d=!t.isEmpty(r)&&Number.isNaN(Number(r));return a||d?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:r,unit:i?i[0]:""}},Ze=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 n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[n,i]=t.map(r.split("/"),a=>parseInt(a,10));return{value:o+(n/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${o+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}},Ue=s=>{if(t.isEmpty(s))return{value:"",unit:""};const o=s.match(/\[.*\]/g);if(o===null)return Ge(s);const r=t.get(o,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",i=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${n}${i}`,unit:r.replace(i,"")}},Ge=s=>t.isEmpty(s)?{value:"",unit:""}:Ze(s),xe=x.createContext({setDragData:()=>{}}),Ke=({unit:s,currentValue:o,onDrag:r,onDragEnd:n,onDragStart:i,negative:a,cssProperty:d})=>{const{setDragData:p}=x.useContext(xe);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:l=>{const m={onDrag:r,onDragEnd:n,dragging:!0,dragStartY:l.pageY,dragStartValue:`${o}`,dragUnit:s,negative:a,cssProperty:d};i(m),p(m)},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,{})})},Je=({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(n=>e.jsxRuntimeExports.jsx(E.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===n?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(n)},children:n},n))}),Qe=s=>{const[o,r]=x.useState(!1),[n,i]=x.useState(""),{currentClass:a,onChange:d,classPrefix:p,cssProperty:l,units:m,negative:g}=s,[c,b]=x.useState(l!=null&&l.toLowerCase().includes("width")?"%":m[0]),[y,h]=x.useState(!1),[R,N]=x.useState(""),[B,w]=x.useState(!1),[V,A]=x.useState(!1);x.useEffect(()=>{const{value:j,unit:v}=Ue(a);if(v===""){i(j),b(l!=null&&l.toLowerCase().includes("width")?"%":m[0]);return}b(v),i(v==="class"||t.isEmpty(j)?"":j)},[a,l,m]);const k=G.useThrottledCallback(j=>{d(j)},[d],200),H=G.useThrottledCallback(j=>{d(j,!1)},[d],200),L=x.useCallback((j=!1)=>{const v=ie(`${n}`,m);if(t.get(v,"error",!1)){h(!0);return}const S=t.get(v,"unit")!==""?t.get(v,"unit"):c;if(S==="auto"||S==="none"){k(`${p}${S}`);return}if(t.get(v,"value")==="")return;const q=`${t.get(v,"value","").startsWith("-")?"-":""}${p}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;j?H(q):k(q)},[k,H,n,c,p,m]),F=x.useCallback(j=>{const v=ie(`${n}`,m);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){k(`${p}${j}`);return}if(t.get(v,"value")==="")return;const S=t.get(v,"unit")!==""?t.get(v,"unit"):j,q=`${t.get(v,"value","").startsWith("-")?"-":""}${p}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(q)},[k,n,p,m]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:c==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.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(E.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(c)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:c==="class",onKeyPress:j=>{j.key==="Enter"&&L()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),A(!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 D=`${S}`,ge=`${D.startsWith("-")?"-":""}${p}[${D.replace("-","")}${c==="-"?"":c}]`;H(ge)},onKeyUp:j=>{V&&(j.preventDefault(),A(!1))},onBlur:()=>L(),onChange:j=>{h(!1),i(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),r(!1)},value:B?R:n,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",y?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(E.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.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 ${m.length===1?"px-2 font-semibold":""}`,children:c}),m.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(E.TooltipPortal,{children:e.jsxRuntimeExports.jsx(E.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Je,{units:m,current:c,onSelect:j=>{r(!1),b(j),F(j)}})})})]})]}),["none","auto"].indexOf(c)!==-1||B?null:e.jsxRuntimeExports.jsx(Ke,{onDragStart:()=>w(!0),onDragEnd:j=>{if(N(()=>""),w(!1),t.isEmpty(j))return;const v=`${j}`,D=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${c==="-"?"":c}]`;k(D)},onDrag:j=>{if(t.isEmpty(j))return;N(j);const v=`${j}`,D=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${c==="-"?"":c}]`;H(D)},currentValue:n,unit:c,negative:g,cssProperty:l})]})})})},W=s=>{const o=f.useSelectedBlockCurrentClasses();return t.findLast(o,{property:s})},et=(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]},tt={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-"},le={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},st=s=>`${s.toUpperCase()} ${le[s]?`(${le[s]} & up)`:""}`,te=s=>{const{type:o="icons",label:r,property:n,onEmitChange:i=()=>{},units:a,negative:d=!1}=s,[p]=f.useDarkMode(),[l]=f.useStylingState(),[,m]=f.useCanvasWidth(),g=W(n),c=f.useAddClassesToBlocks(),b=f.useRemoveClassesFromBlocks(),[y]=f.useSelectedBlockIds(),h=x.useMemo(()=>t.get(g,"fullCls",""),[g]),R=x.useCallback((k,H=!0)=>{const L={dark:p,mq:m,mod:l,cls:k,property:n,fullCls:""};(p||l!=="")&&(L.mq="xs");const F=O.generateFullClsName(L);c(y,[F],H)},[y,p,m,l,n,c]),N=x.useCallback(()=>{b(y,[h])},[y,h,b]),B=x.useMemo(()=>et(g,m),[g,m]);x.useEffect(()=>{i(B,g)},[B,i,g]);const[,,w]=f.useCanvasWidth(),V=x.useCallback(k=>{w({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[k])},[w]),A=t.get(g,"dark",null)===p&&t.get(g,"mod",null)===l&&t.get(g,"mq",null)===m;return e.jsxRuntimeExports.jsx(We,{canChange:B,canReset:g&&A,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] ${g&&!A?"text-foreground":""}`,children:r})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?e.jsxRuntimeExports.jsx(Qe,{currentClass:t.get(g,"cls",""),classPrefix:t.get(tt,n,""),units:a||[],onChange:R,negative:d,cssProperty:n}):null,o==="icons"&&e.jsxRuntimeExports.jsx(Ye,{property:n,onChange:R}),o==="range"&&e.jsxRuntimeExports.jsx(Fe,{property:n,onChange:R}),o==="color"&&e.jsxRuntimeExports.jsx(ze,{property:n,onChange:R}),o==="dropdown"&&e.jsxRuntimeExports.jsx(ce,{label:r,property:n,onChange:R})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>N(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(u.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):B&&g?e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.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(E.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:[st(t.get(g,"mq")),p&&!g.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>V(t.get(g,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(g,"mq").toUpperCase()]})]})})})]}):null})]})]})})},rt=["px","%","em","rem","ch","vh","vw"],me=({label:s,options:o,borderB:r=!1,borderT:n=!1,type:i="arbitrary",units:a=rt,negative:d=!1})=>{const[p,l]=x.useState(o[0].key),m=f.useSelectedBlockCurrentClasses(),g=x.useCallback(c=>t.map(m,"property").includes(c),[m]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:x.Children.toArray(o.map(({label:c,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>l(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[x.createElement("div",{className:g(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),x.createElement(t.get(de,b,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:t.startCase(t.toLower(c))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(te,{type:i,units:[...a],label:"",property:p,negative:d})})]})},ot=({heading:s,items:o})=>{const r=f.useSelectedBlockCurrentClasses(),n=x.useMemo(()=>{const i=p=>t.flatten(p.map(l=>l.styleType==="multiple"?t.map(l.options,"key"):l.property)),a=t.flatten(o.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(r,"property");return t.intersection(a,d).length>0},[r,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:[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(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(me,{...i},i.label):e.jsxRuntimeExports.jsx(te,{...i},i.label))})]})},nt=x.createContext({}),U=({section:s})=>{const o=f.useSelectedBlockCurrentClasses(),r=x.useCallback((a=[])=>{const d={};for(let l=0;l<o.length;l++)d[o[l].property]=o[l].cls;let p=!0;for(const l in a)if(!t.has(d,l)||d[l]!==a[l]){p=!1;break}return p},[o]),n=x.useMemo(()=>{if(o.length>0&&s.heading==="Classes")return!0;const a=l=>t.flatten(l.map(m=>m.styleType==="multiple"?t.flatten(t.map(m.options,"key")):m.property)),d=t.flatten(s.items.map(l=>l.styleType==="accordion"?a(l.items):l.styleType==="multiple"?t.flatten(t.map(l.options,"key")):l.property)),p=t.map(o,"property");return t.intersection(d,p).length>0},[o,s.heading,s.items]),i=x.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(nt.Provider,{value:i,children:e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(T.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"}`}),s.heading]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:x.Children.toArray(s.items.map(a=>t.has(a,"component")?x.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(me,{...a},a.label):a.styleType==="accordion"&&r(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(ot,{...a},a.label):null:e.jsxRuntimeExports.jsx(te,{...a},a.label)))})]})})},it=({item:s,index:o,canDelete:r,onChange:n,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:a=>n(a,o),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:a=>t.isEmpty(s.key)?{}:n(a,o),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(u.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),lt=({section:s})=>{var b;const{setSyncState:o}=f.useSavePage(),r=f.useSelectedBlock(),[n,i]=x.useState([]),[a]=f.useSelectedStylingBlocks(),d=f.useUpdateBlocksPropsRealtime(),p=`${t.get(a,"0.prop")}_attrs`;X.useEffect(()=>{const y=t.map(t.get(r,p),(h,R)=>({key:R,value:h}));t.isEmpty(y)?i([]):i(y)},[t.get(r,p)]);const l=()=>i([...n,{key:"",value:""}]),m=y=>{const h=t.filter(n,(R,N)=>y!==N);c(h)},g=(y,h)=>{const R=[...n];R[h][y.target.name]=y.target.value,c(R)},c=X.useCallback((y=[])=>{const h={};t.forEach(y,R=>{t.isEmpty(R.key)||t.set(h,R.key,R.value)}),d([t.get(r,"_id")],{[p]:h}),o("UNSAVED")},[r,o,d,p]);return e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(ee.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(n)&&t.isEmpty((b=t.last(n))==null?void 0:b.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var y;!t.isEmpty(n)&&t.isEmpty((y=t.last(n))==null?void 0:y.key)||l()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),X.Children.toArray(t.map(n,(y,h)=>{const R=n.length>0&&h<n.length-1;return e.jsxRuntimeExports.jsx(it,{item:y,index:h,canDelete:R,onChange:g,onRemove:()=>m(h)})}))]})]})})]})};function at(){const[s,o]=f.useStylingState(),{flexChild:r,gridChild:n}=f.useSelectedBlocksDisplayChild(),[,i]=Ce.useAtom(f.advanceStylingOpenAtom),{t:a}=ae.useTranslation(),[d]=f.useSelectedStylingBlocks();return t.isEmpty(d)?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:a("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>i(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b border-border px-4 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(ee.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(C.Select,{defaultValue:s,onValueChange:p=>o(p),children:[e.jsxRuntimeExports.jsx(C.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(C.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(C.SelectContent,{children:[e.jsxRuntimeExports.jsx(C.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(Te.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",className:"h-full w-full",children:[r&&e.jsxRuntimeExports.jsx(U,{section:Oe}),n?e.jsxRuntimeExports.jsx(U,{section:qe}):null,_e.map(p=>e.jsxRuntimeExports.jsx(U,{section:p},p.heading)),e.jsxRuntimeExports.jsx(lt,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const pt={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},ut=()=>{const s=f.useSelectedBlock(),{t:o}=ae.useTranslation(),[r,n]=x.useState(""),[i,a]=x.useState({onDrag:l=>l,onDragEnd:l=>l,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=G.useThrottledCallback(l=>{const m=!t.get(i,"negative",!1),g=t.get(i,"cssProperty","");let c=parseFloat(i.dragStartValue);c=t.isNaN(c)?0:c;let b=pt[i.dragUnit];(t.startsWith(g,"scale")||g==="opacity")&&(b=10);let h=(i.dragStartY-l.pageY)/b+c;m&&h<0&&(h=0),g==="opacity"&&h>1&&(h=1),i.onDrag(`${h}`),n(`${h}`)},[i],50),p=x.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${r}`),100),a({onDrag:l=>l,onDragEnd:l=>l,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,r,a]);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.jsxs(xe.Provider,{value:{setDragData:a},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:d,onMouseUp:()=>p(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(M.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(M.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx($e,{})}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(at,{})})]})]})};exports.default=ut;
|
|
1
|
+
"use strict";var he=Object.create;var se=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var je=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var Re=(s,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of be(o))!fe.call(s,i)&&i!==r&&se(s,i,{get:()=>o[i],enumerable:!(n=ye(o,i))||n.enumerable});return s};var ve=(s,o,r)=>(r=s!=null?he(je(s)):{},Re(o||!s||!s.__esModule?se(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),x=require("react"),G=require("@react-hookz/web"),t=require("lodash"),ae=require("react-i18next"),u=require("@radix-ui/react-icons"),M=require("./tabs-860e37aa.cjs"),Ee=require("@rjsf/core"),we=require("@rjsf/validator-ajv8"),f=require("./index-ef6fb010.cjs"),z=require("@chaibuilder/blocks"),K=require("lucide-react"),pe=require("./useChaiExternalData-a90e8aac.cjs"),E=require("./useBuilderProp-adacf42f.cjs"),$=require("./dialog-170eaad9.cjs"),Z=require("./popover-7cb9079b.cjs"),P=require("./command-b1103666.cjs"),T=require("./accordion-0afd8143.cjs"),Y=require("./link-24679521.cjs"),Ce=require("jotai"),ke=require("react-autosuggest"),Ne=require("fuse.js"),O=require("./html-to-json-aadcbf66.cjs"),ee=require("./label-167415e5.cjs"),Se=require("./MODIFIERS-4716c669.cjs"),Te=require("./scroll-area-bb343b86.cjs"),C=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("sonner");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-dialog");require("@radix-ui/react-popover");require("cmdk");require("@radix-ui/react-accordion");require("react-icons-picker");require("./ImagesPanel-8b7a989d.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-label");require("@radix-ui/react-select");function Ie(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(o,r,n.get?n:{enumerable:!0,get:()=>s[r]})}}return o.default=s,Object.freeze(o)}const X=Ie(x),Be=x.lazy(()=>import("react-json-view"));function Ae(s){const o=[],r={};function n(i,a){t.forEach(a,(d,p)=>{const l=i?`${i}.${p}`:p,m=t.isArray(d)?"list":typeof d;o.push(l),r[l]=m==="string"?"text":m==="object"?"model":m,m==="object"&&!t.isArray(d)&&n(l,d)})}return n("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:r}}const J=({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(f.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Be,{style:{maxHeight:"40vh",overflowY:"auto"},name:"Content",enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:s,collapsed:!0})})]}):e.jsxRuntimeExports.jsxs("div",{className:"text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},re=({type:s,value:o="",setValue:r,data:n,onChange:i,dataType:a,appliedBindings:d})=>{const{paths:p,pathsType:l}=Ae(n),m=s==="PROP"?z.getBlockComponent(n==null?void 0:n._type):{},g=s==="PROP",[c,b]=x.useState(!1),y=x.useMemo(()=>s==="PROP"?p.filter(h=>!t.includes(d,h)&&t.get(m,`props.${t.first(t.split(h,"."))}.binding`)):p.filter(h=>a===t.get(l,h,"")),[s,p,d,a,m]);return x.useEffect(()=>{o&&i(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(Z.Popover,{open:c,onOpenChange:b,children:[e.jsxRuntimeExports.jsx(Z.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(E.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(o)?"bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center":"min-w-[350px] justify-between items-center"}`,children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-sm pr-8",children:[g&&e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full",children:t.startCase(a)}),o]}),e.jsxRuntimeExports.jsx("span",{className:"text-[9px] text-blue-400 underline cursor-pointer hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(Z.PopoverContent,{className:"p-0 z-[999] min-w-[300px]",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(y,h=>e.jsxRuntimeExports.jsxs(P.CommandItem,{value:h,className:`cursor-pointer ${g?"flex justify-between items-center":"flex flex-col items-start justify-start"}`,onSelect:R=>{r(t.find(y,N=>N===R)||null),b(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(K.Check,{className:`w-4 h-4 text-green-500 ${o===h?"":"opacity-0"}`}),h]}),g?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full",children:t.startCase(t.get(l,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(J,{data:t.get(n,h)})})]},h))})]})]})})]})]}),!g&&!t.isEmpty(o)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(J,{data:t.get(n,o,""),fullView:!0})})]})},He=({appliedBindings:s=[],onAddBinding:o,editMode:r,item:n})=>{const[i,a]=x.useState(r?n.key:""),[d,p]=x.useState(r?n.value:""),l=f.useSelectedBlock(),[m]=pe.useChaiExternalData(),g=x.useCallback((y,h)=>{if(t.isEmpty(y))return"";{const R=t.get(h==="PROP"?l:m,y,"");if(t.isArray(R))return"list";const N=typeof R;return N==="string"?"text":N==="object"?"model":N}},[l,m]),[c,b]=x.useState(r?g(n.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs($.DialogHeader,{children:[e.jsxRuntimeExports.jsx($.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx($.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 relative",children:[e.jsxRuntimeExports.jsx(re,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:a,onChange:y=>{const h=g(y,"PROP");a(y),c!==h&&p(""),b(h)},data:l,dataType:c,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(re,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:d,setValue:p,onChange:y=>{const h=g(y,"PATH");p(c===h?y:"")},data:m,dataType:c,appliedBindings:s})]}),e.jsxRuntimeExports.jsx($.DialogFooter,{children:e.jsxRuntimeExports.jsx(E.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(d),onClick:()=>o({key:i,value:d}),children:"Save"})})]})},ue=({children:s,onAddBinding:o,appliedBindings:r,editMode:n=!0,item:i={}})=>{const[a,d]=x.useState(!1);return e.jsxRuntimeExports.jsxs($.Dialog,{children:[e.jsxRuntimeExports.jsx($.DialogTrigger,{asChild:!0,onClick:()=>d(!0),children:s}),a&&e.jsxRuntimeExports.jsx($.DialogContent,{children:e.jsxRuntimeExports.jsx(He,{item:i,editMode:n,appliedBindings:r,onAddBinding:p=>{o(p),d(!1)}})})]})},Ve=({item:s,onAddBinding:o,onRemove:r,selectedBlock:n,dataProvider:i,appliedBindings:a})=>{const[d,p]=x.useState("string"),l=(m,g)=>{if(t.isEmpty(m))return"";{const c=t.get(g==="PROP"?n:i,m,"");if(t.isArray(c))return"list";const b=typeof c;return b==="string"?"text":b==="object"?"model":b}};return x.useEffect(()=>p(()=>l(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col border border-gray-200 relative rounded-md p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-gray-500 font-normal text-sm",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(J,{data:t.get(i,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(ue,{editMode:!0,onAddBinding:o,appliedBindings:a,item:s,children:e.jsxRuntimeExports.jsx(K.EditIcon,{className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200"})}),e.jsxRuntimeExports.jsx(K.TrashIcon,{onClick:()=>r(),className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]}),!t.isEmpty(d)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(d)})]})},De=({bindingData:s,onChange:o})=>{const r=f.useSelectedBlock(),[n]=pe.useChaiExternalData(),i=z.getChaiDataProviders(),[a,d]=x.useState(t.map(s,(c,b)=>({key:b,value:c})));x.useEffect(()=>{d(t.map(s,(c,b)=>({key:b,value:c})))},[r==null?void 0:r._id]);const p=x.useMemo(()=>{if(t.isEmpty(n))return!0;if(t.isEmpty(a))return!1;const c=t.last(a);return t.isEmpty(c==null?void 0:c.key)||t.isEmpty(c==null?void 0:c.value)},[n,a]),l=c=>{const b=t.filter(a,y=>y.key!==c.key);d([...b,c]),g([...b,c])},m=c=>{const b=t.filter(a,(y,h)=>c!==h);g([...b])},g=x.useCallback((c=[])=>{if(d(c),t.isEmpty(c)){o({});return}const b={};t.forEach(c,y=>{!t.isEmpty(y==null?void 0:y.key)&&!t.isEmpty(y==null?void 0:y.value)&&t.set(b,y.key,y.value)}),o(b)},[r]);return t.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(a,(c,b)=>e.jsxRuntimeExports.jsx(Ve,{item:c,onAddBinding:l,onRemove:()=>m(b),selectedBlock:r,dataProvider:n,appliedBindings:t.map(a,"key")},c.key)),e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(ue,{appliedBindings:t.map(a,"key"),onAddBinding:l,children:e.jsxRuntimeExports.jsx("button",{disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${p?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(n)?e.jsxRuntimeExports.jsx("small",{className:"text-gray-500 text-[9.5px]",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),p&&e.jsxRuntimeExports.jsx(E.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(n)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},Le=De,Pe=()=>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"}),oe=({createHistorySnapshot:s,properties:o,formData:r,onChange:n})=>{const[i]=f.useActiveLanguage(),a={type:"object",properties:{}},d={};return Object.keys(o).forEach(p=>{const l=o[p];if(t.includes(["slot","styles"],l.type))return;const m=t.get(l,"i18n",!1)?`${p}-${i}`:p;a.properties[m]=f.getBlockJSONFromSchemas(l,i),d[m]=f.getBlockJSONFromUISchemas(l,i)}),e.jsxRuntimeExports.jsx(Ee,{widgets:{binding:Pe,richtext:Y.RichTextEditorField,icon:Y.IconPickerField,image:Y.ImagePickerField},fields:{link:Y.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:we,uiSchema:d,onBlur:s,schema:a,formData:r,onChange:n})};function $e(){const s=f.useSelectedBlock(),{createSnapshot:o}=f.useCanvasHistory(),r=f.useUpdateBlocksPropsRealtime(),n=z.getBlockComponent(s._type),i={...s},a=()=>o(),d=({formData:g},c)=>{if(c){const b=c.replace("root.","");r([s._id],{[b]:t.get(g,b)})}},p={_name:z.SingleLineText({title:"Name",default:t.get(s,"_name",s._type)})},l=t.keys(t.get(i,"_bindings",{})),m=x.useMemo(()=>{const g=t.cloneDeep(t.get(n,"props",{}));return t.each(l,c=>{delete g[c]}),g},[n,l]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(oe,{onChange:d,createHistorySnapshot:a,formData:i,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Le,{bindingData:t.get(i,"_bindings",{}),onChange:g=>{d({formData:{...i,_bindings:g}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(T.AccordionContent,{className:"pt-4",children:[t.isEmpty(l)?"":e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(l,t.capitalize).join(", ")})," ",l.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(oe,{onChange:d,createHistorySnapshot:a,formData:i,properties:m})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const ne=new Ne(O.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Me(){var B;const[s]=f.useSelectedStylingBlocks(),o=f.useSelectedBlock(),r=f.useAddClassesToBlocks(),n=f.useRemoveClassesFromBlocks(),[i]=f.useSelectedBlockIds(),[a,d]=x.useState(""),p=(B=t.first(s))==null?void 0:B.prop,l=t.reject((t.get(o,p,"").replace(Se.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),m=()=>{const w=a.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(i,w,!0),d("")},[g,c]=x.useState([]),b=({value:w})=>{const V=w.trim().toLowerCase(),A=V.match(/.+:/g);let k=[];if(A&&A.length>0){const[H]=A,L=V.replace(H,"");k=ne.search(L).map(j=>({...j,item:{...j.item,name:H+j.item.name}}))}else k=ne.search(V);c(t.map(k,"item"))},y=()=>{c([])},h=w=>w.name,R=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),N={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:a,onKeyDown:w=>{w.key==="Enter"&&a.trim()!==""&&m()},onChange:(w,{newValue:V})=>d(V),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 ${g.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(ee.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(ke,{suggestions:g,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:y,getSuggestionValue:h,renderSuggestion:R,inputProps:N,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(E.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:m,disabled:a.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(l)&&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"}),X.Children.toArray(l.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:()=>n(i,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const I=["px","%","em","rem","ch","vh","vw"],Oe={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:I,property:"flexBasis"},{type:"range",label:"Order",property:"order"},{type:"dropdown",label:"Flex",property:"flexGrowShrink"},{type:"dropdown",label:"Grow",property:"flexGrow"},{type:"dropdown",label:"Shrink",property:"flexShrink"}]},qe={heading:"Grid Child",items:[{type:"range",label:"Col Span",property:"gridColSpan"},{type:"range",label:"Col Start",property:"gridColStart"},{type:"range",label:"Col End",property:"gridColEnd"},{type:"range",label:"Row Span",property:"gridRowSpan"},{type:"range",label:"Row Start",property:"gridRowStart"},{type:"range",label:"Row End",property:"gridRowEnd"},{type:"range",label:"Order",property:"order"}]},_e=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:I},{styleType:"accordion",heading:"Flex options",items:[{type:"dropdown",label:"Direction",property:"flexDirection"},{type:"dropdown",label:"Wrap",property:"flexWrap"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"Grid options",items:[{type:"range",label:"Columns",property:"gridColumns"},{type:"range",label:"Rows",property:"gridRows"},{type:"dropdown",label:"Auto Flow",property:"gridAutoFlow"},{type:"dropdown",label:"Auto Cols",property:"gridAutoColumns"},{type:"dropdown",label:"Auto Rows",property:"gridAutoRows"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",units:["px","rem"],options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"Visibility & Opacity",items:[{type:"dropdown",label:"Visibility",property:"visibility",units:I},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...I,"auto"],options:[{key:"margin",label:"All"},{key:"marginX",label:"Left-Right"},{key:"marginY",label:"Top-Bottom"},{key:"marginTop",label:"Top"},{key:"marginRight",label:"Right"},{key:"marginBottom",label:"Bottom"},{key:"marginLeft",label:"Left"}]},{styleType:"multiple",label:"Padding",options:[{key:"padding",label:"All"},{key:"paddingX",label:"Left-Right"},{key:"paddingY",label:"Top-Bottom"},{key:"paddingTop",label:"Top"},{key:"paddingRight",label:"Right"},{key:"paddingBottom",label:"Bottom"},{key:"paddingLeft",label:"Left"}]},{styleType:"multiple",label:"Space Between",options:[{key:"spaceX",label:"Left-Right"},{key:"spaceY",label:"Top-Bottom"}]}]},{heading:"Size",items:[{type:"arbitrary",label:"Width",units:I.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:I.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:I.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:I.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:I.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:I.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"Object options & aspect ratio",items:[{type:"dropdown",label:"Aspect",property:"aspectRatio"},{type:"dropdown",label:"Fit",property:"objectFit"},{type:"dropdown",label:"Position",property:"objectPosition"}]}]},{heading:"Position",items:[{type:"icons",label:"Position",property:"position"},{styleType:"accordion",heading:"Position options",items:[{styleType:"multiple",label:"Direction",options:[{key:"top",label:"Top"},{key:"right",label:"Right"},{key:"bottom",label:"Bottom"},{key:"left",label:"Left"}]},{styleType:"multiple",label:"Inset",options:[{key:"inset",label:"All"},{key:"insetX",label:"Left Right"},{key:"insetY",label:"Top Bottom"}]},{type:"arbitrary",label:"Z-Chai",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"Float & Clear",items:[{type:"icons",label:"Float",property:"float"},{type:"dropdown",label:"Clear",property:"clear"}]},{styleType:"accordion",heading:"Overflow & Overscroll",items:[{styleType:"multiple",type:"dropdown",label:"Overflow",options:[{key:"overflow",label:"All"},{key:"overflowX",label:"Left-Right"},{key:"overflowY",label:"Top-Bottom"}]},{styleType:"multiple",type:"dropdown",label:"Overscroll",options:[{key:"overscroll",label:"All"},{key:"overscrollX",label:"Left-Right"},{key:"overscrollY",label:"Top-Bottom"}]}]}]},{heading:"Typography",items:[{type:"dropdown",property:"fontFamily",label:"Font"},{type:"arbitrary",property:"fontSize",label:"Size",units:I},{type:"arbitrary",property:"lineHeight",label:"Height",units:I.concat("-")},{type:"range",property:"fontWeight",label:"Weight"},{type:"color",property:"textColor",label:"Color"},{styleType:"accordion",heading:"Alignments",items:[{type:"dropdown",property:"textAlign",label:"Align"},{type:"dropdown",property:"verticalAlign",label:"V. Align"}]},{styleType:"accordion",heading:"Spacing, decoration & more",items:[{type:"dropdown",property:"letterSpacing",label:"Spacing"},{type:"dropdown",property:"textDecoration",label:"Decoration"},{type:"range",property:"textDecorationThickness",label:"Thickness"},{type:"dropdown",property:"textTransform",label:"Transform"}]},{styleType:"accordion",heading:"White space & breaks",items:[{type:"dropdown",property:"whitespace",label:"Whitespace"},{type:"dropdown",property:"wordBreak",label:"Wordbreak"}]}]},{heading:"Background",items:[{type:"color",label:"Bg. Color",property:"backgroundColor"},{styleType:"accordion",heading:"Position, Size & more",items:[{type:"dropdown",label:"Attachment",property:"backgroundAttachment"},{type:"dropdown",label:"Clipping",property:"backgroundClip"},{type:"dropdown",label:"Origin",property:"backgroundOrigin"},{type:"dropdown",label:"Position",property:"backgroundPosition"},{type:"dropdown",label:"Repeat",property:"backgroundRepeat"},{type:"dropdown",label:"Size",property:"backgroundSize"}]},{type:"dropdown",label:"Gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"Gradient colors",items:[{type:"color",label:"From",property:"fromColor"},{type:"color",label:"Via",property:"viaColor"},{type:"color",label:"To",property:"toColor"}]}]},{heading:"Border & Outline",items:[{styleType:"multiple",type:"dropdown",label:"Width",options:[{key:"border",label:"All"},{key:"borderX",label:"Left Right"},{key:"borderY",label:"Top bottom"},{key:"borderTop",label:"Top"},{key:"borderRight",label:"Right"},{key:"borderBottom",label:"Bottom"},{key:"borderLeft",label:"Left"}]},{styleType:"multiple",type:"dropdown",label:"Corners",options:[{key:"borderRadius",label:"All"},{key:"borderRadiusTop",label:"Top"},{key:"borderRadiusRight",label:"Right"},{key:"borderRadiusBottom",label:"Bottom"},{key:"borderRadiusLeft",label:"Left"},{key:"borderRadiusTopLeft",label:"Top Left"},{key:"borderRadiusTopRight",label:"Top right"},{key:"borderRadiusBottomRight",label:"Bottom right"},{key:"borderRadiusBottomLeft",label:"Bottom left"}]},{type:"color",label:"Color",property:"borderColor"},{type:"dropdown",label:"Style",property:"borderStyle"},{styleType:"accordion",heading:"Divide options",items:[{styleType:"multiple",type:"range",label:"Width",options:[{key:"divideXWidth",label:"Left Right"},{key:"divideYWidth",label:"Top Bottom"}]},{type:"color",label:"Color",property:"divideColor"},{type:"dropdown",label:"Style",property:"divideStyle"}]},{styleType:"accordion",heading:"Outline styling",items:[{type:"range",label:"Width",property:"outlineWidth"},{type:"range",label:"Offset",property:"outlineOffset"},{type:"dropdown",label:"Style",property:"outlineStyle"}]},{styleType:"accordion",heading:"Ring options",items:[{type:"range",label:"Width",property:"ringWidth"},{type:"color",label:"Color",property:"ringColor"},{type:"range",label:"Offset",property:"ringOffsetWidth"},{type:"color",label:"Off. color",property:"ringOffsetColor"}]}]},{heading:"Effect & Animation",items:[{type:"range",label:"Shadow",property:"boxShadow"},{type:"color",label:"Color",property:"boxShadowColor"},{type:"dropdown",label:"Cursor",property:"cursor"},{styleType:"accordion",heading:"Blend & Cursor",items:[{type:"dropdown",label:"Mix Blend",property:"mixBlendMode"},{type:"dropdown",label:"Bg. Blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"Transform",items:[{type:"dropdown",label:"Origin",property:"transformOrigin"},{styleType:"multiple",label:"Scale",units:["-"],options:[{key:"scale",label:"All"},{key:"scaleX",label:"Left-Right"},{key:"scaleY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Skew",units:["deg"],options:[{key:"skewX",label:"Left-Right"},{key:"skewY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Translate",negative:!0,options:[{key:"translateX",label:"Left-Right"},{key:"translateY",label:"Top-Bottom"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"Rotate",property:"rotate"}]},{styleType:"accordion",heading:"Animation",items:[{type:"dropdown",label:"Animation",property:"animation"},{type:"dropdown",label:"Transition",property:"transition"},{type:"dropdown",label:"Easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"Duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"Delay",property:"delay"}]}]},{heading:"Classes",items:[{component:Me}]}],de={"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.createContext({canReset:!1,canChange:!0}),We=({children:s,canReset:o=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(_.Provider,{value:{canReset:o,canChange:r},children:s}),ce=({label:s,property:o,onChange:r})=>{const n=x.useMemo(()=>t.get(O.CLASSES_LIST,`${o}.classes`,[""]),[o]),i=W(o),a=x.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:d}=x.useContext(_),p=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(P.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.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(E.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Q,{rounded:s,onChange:l=>r(l,o),selected:a,options:n,disabled:!d})})};function Q({selected:s,onChange:o,rounded:r=!1,options:n,disabled:i=!1}){const a=s.replace(/.*:/g,"").trim(),{undo:d,redo:p}=f.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||i,className:`${r?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:l=>o(l.target.value),onKeyDown:l=>{l.ctrlKey&&(l.key==="z"&&d(),l.key==="y"&&p())},value:a,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),x.Children.toArray(n.map(l=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:l,children:l})))]})}const Fe=({property:s,onChange:o})=>{const{canReset:r,canChange:n}=x.useContext(_),i=W(s),a=x.useMemo(()=>t.get(i,"cls",""),[i]),d=x.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=d.indexOf(a)>-1?d.indexOf(a):0,l=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:l?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:a}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!r||p-1<0),onClick:()=>o(t.nth(d,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!n&&(!r||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ce,{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:!n&&(!r||p+1>=d.length),onClick:()=>o(t.nth(d,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!n&&(!r||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},Ye=({property:s,onChange:o})=>{const r=x.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=x.useContext(_),i=W(s),a=x.useMemo(()=>t.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,d=>e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>o(d,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${a===d?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:x.createElement(t.get(de,d,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},Xe={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},ze=({property:s,onChange:o})=>{const r=W(s),n=x.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:i}=x.useContext(_),[a,d]=x.useState([]),[p,l]=x.useState({color:"",shade:""}),m=n.split("-"),g=t.get(m,"1",""),c=t.get(m,"2",""),b=x.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),l({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),l(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[d,l]);x.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(g))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[g]);const y=x.useCallback(h=>{l({color:g,shade:h})},[g]);return x.useEffect(()=>{l({color:"",shade:""})},[r]),x.useEffect(()=>{const R=`${t.get(Xe,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;R.match(new RegExp(t.get(O.CLASSES_LIST,`${s}.regExp`,"")))&&o(R,s)},[p,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(Q,{disabled:!i,rounded:!0,selected:g,onChange:b,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(Q,{rounded:!0,selected:c,disabled:!g||!i,onChange:y,options:a})})]})},ie=(s,o)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&o.includes(r))return{value:"",unit:r};const n=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;r=r.replace(n,"");const i=s.match(n),a=i&&i.length>1,d=!t.isEmpty(r)&&Number.isNaN(Number(r));return a||d?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:r,unit:i?i[0]:""}},Ze=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 n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[n,i]=t.map(r.split("/"),a=>parseInt(a,10));return{value:o+(n/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${o+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}},Ue=s=>{if(t.isEmpty(s))return{value:"",unit:""};const o=s.match(/\[.*\]/g);if(o===null)return Ge(s);const r=t.get(o,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",i=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${n}${i}`,unit:r.replace(i,"")}},Ge=s=>t.isEmpty(s)?{value:"",unit:""}:Ze(s),xe=x.createContext({setDragData:()=>{}}),Ke=({unit:s,currentValue:o,onDrag:r,onDragEnd:n,onDragStart:i,negative:a,cssProperty:d})=>{const{setDragData:p}=x.useContext(xe);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:l=>{const m={onDrag:r,onDragEnd:n,dragging:!0,dragStartY:l.pageY,dragStartValue:`${o}`,dragUnit:s,negative:a,cssProperty:d};i(m),p(m)},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,{})})},Je=({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(n=>e.jsxRuntimeExports.jsx(E.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===n?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(n)},children:n},n))}),Qe=s=>{const[o,r]=x.useState(!1),[n,i]=x.useState(""),{currentClass:a,onChange:d,classPrefix:p,cssProperty:l,units:m,negative:g}=s,[c,b]=x.useState(l!=null&&l.toLowerCase().includes("width")?"%":m[0]),[y,h]=x.useState(!1),[R,N]=x.useState(""),[B,w]=x.useState(!1),[V,A]=x.useState(!1);x.useEffect(()=>{const{value:j,unit:v}=Ue(a);if(v===""){i(j),b(l!=null&&l.toLowerCase().includes("width")?"%":m[0]);return}b(v),i(v==="class"||t.isEmpty(j)?"":j)},[a,l,m]);const k=G.useThrottledCallback(j=>{d(j)},[d],200),H=G.useThrottledCallback(j=>{d(j,!1)},[d],200),L=x.useCallback((j=!1)=>{const v=ie(`${n}`,m);if(t.get(v,"error",!1)){h(!0);return}const S=t.get(v,"unit")!==""?t.get(v,"unit"):c;if(S==="auto"||S==="none"){k(`${p}${S}`);return}if(t.get(v,"value")==="")return;const q=`${t.get(v,"value","").startsWith("-")?"-":""}${p}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;j?H(q):k(q)},[k,H,n,c,p,m]),F=x.useCallback(j=>{const v=ie(`${n}`,m);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){k(`${p}${j}`);return}if(t.get(v,"value")==="")return;const S=t.get(v,"unit")!==""?t.get(v,"unit"):j,q=`${t.get(v,"value","").startsWith("-")?"-":""}${p}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(q)},[k,n,p,m]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:c==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.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(E.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(c)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:c==="class",onKeyPress:j=>{j.key==="Enter"&&L()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),A(!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 D=`${S}`,ge=`${D.startsWith("-")?"-":""}${p}[${D.replace("-","")}${c==="-"?"":c}]`;H(ge)},onKeyUp:j=>{V&&(j.preventDefault(),A(!1))},onBlur:()=>L(),onChange:j=>{h(!1),i(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),r(!1)},value:B?R:n,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",y?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(E.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.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 ${m.length===1?"px-2 font-semibold":""}`,children:c}),m.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(E.TooltipPortal,{children:e.jsxRuntimeExports.jsx(E.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Je,{units:m,current:c,onSelect:j=>{r(!1),b(j),F(j)}})})})]})]}),["none","auto"].indexOf(c)!==-1||B?null:e.jsxRuntimeExports.jsx(Ke,{onDragStart:()=>w(!0),onDragEnd:j=>{if(N(()=>""),w(!1),t.isEmpty(j))return;const v=`${j}`,D=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${c==="-"?"":c}]`;k(D)},onDrag:j=>{if(t.isEmpty(j))return;N(j);const v=`${j}`,D=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${c==="-"?"":c}]`;H(D)},currentValue:n,unit:c,negative:g,cssProperty:l})]})})})},W=s=>{const o=f.useSelectedBlockCurrentClasses();return t.findLast(o,{property:s})},et=(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]},tt={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-"},le={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},st=s=>`${s.toUpperCase()} ${le[s]?`(${le[s]} & up)`:""}`,te=s=>{const{type:o="icons",label:r,property:n,onEmitChange:i=()=>{},units:a,negative:d=!1}=s,[p]=f.useDarkMode(),[l]=f.useStylingState(),[,m]=f.useCanvasWidth(),g=W(n),c=f.useAddClassesToBlocks(),b=f.useRemoveClassesFromBlocks(),[y]=f.useSelectedBlockIds(),h=x.useMemo(()=>t.get(g,"fullCls",""),[g]),R=x.useCallback((k,H=!0)=>{const L={dark:p,mq:m,mod:l,cls:k,property:n,fullCls:""};(p||l!=="")&&(L.mq="xs");const F=O.generateFullClsName(L);c(y,[F],H)},[y,p,m,l,n,c]),N=x.useCallback(()=>{b(y,[h])},[y,h,b]),B=x.useMemo(()=>et(g,m),[g,m]);x.useEffect(()=>{i(B,g)},[B,i,g]);const[,,w]=f.useCanvasWidth(),V=x.useCallback(k=>{w({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[k])},[w]),A=t.get(g,"dark",null)===p&&t.get(g,"mod",null)===l&&t.get(g,"mq",null)===m;return e.jsxRuntimeExports.jsx(We,{canChange:B,canReset:g&&A,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] ${g&&!A?"text-foreground":""}`,children:r})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?e.jsxRuntimeExports.jsx(Qe,{currentClass:t.get(g,"cls",""),classPrefix:t.get(tt,n,""),units:a||[],onChange:R,negative:d,cssProperty:n}):null,o==="icons"&&e.jsxRuntimeExports.jsx(Ye,{property:n,onChange:R}),o==="range"&&e.jsxRuntimeExports.jsx(Fe,{property:n,onChange:R}),o==="color"&&e.jsxRuntimeExports.jsx(ze,{property:n,onChange:R}),o==="dropdown"&&e.jsxRuntimeExports.jsx(ce,{label:r,property:n,onChange:R})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>N(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(u.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):B&&g?e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.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(E.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:[st(t.get(g,"mq")),p&&!g.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>V(t.get(g,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(g,"mq").toUpperCase()]})]})})})]}):null})]})]})})},rt=["px","%","em","rem","ch","vh","vw"],me=({label:s,options:o,borderB:r=!1,borderT:n=!1,type:i="arbitrary",units:a=rt,negative:d=!1})=>{const[p,l]=x.useState(o[0].key),m=f.useSelectedBlockCurrentClasses(),g=x.useCallback(c=>t.map(m,"property").includes(c),[m]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:x.Children.toArray(o.map(({label:c,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>l(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[x.createElement("div",{className:g(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),x.createElement(t.get(de,b,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:t.startCase(t.toLower(c))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(te,{type:i,units:[...a],label:"",property:p,negative:d})})]})},ot=({heading:s,items:o})=>{const r=f.useSelectedBlockCurrentClasses(),n=x.useMemo(()=>{const i=p=>t.flatten(p.map(l=>l.styleType==="multiple"?t.map(l.options,"key"):l.property)),a=t.flatten(o.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(r,"property");return t.intersection(a,d).length>0},[r,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:[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(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(me,{...i},i.label):e.jsxRuntimeExports.jsx(te,{...i},i.label))})]})},nt=x.createContext({}),U=({section:s})=>{const o=f.useSelectedBlockCurrentClasses(),r=x.useCallback((a=[])=>{const d={};for(let l=0;l<o.length;l++)d[o[l].property]=o[l].cls;let p=!0;for(const l in a)if(!t.has(d,l)||d[l]!==a[l]){p=!1;break}return p},[o]),n=x.useMemo(()=>{if(o.length>0&&s.heading==="Classes")return!0;const a=l=>t.flatten(l.map(m=>m.styleType==="multiple"?t.flatten(t.map(m.options,"key")):m.property)),d=t.flatten(s.items.map(l=>l.styleType==="accordion"?a(l.items):l.styleType==="multiple"?t.flatten(t.map(l.options,"key")):l.property)),p=t.map(o,"property");return t.intersection(d,p).length>0},[o,s.heading,s.items]),i=x.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(nt.Provider,{value:i,children:e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(T.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"}`}),s.heading]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:x.Children.toArray(s.items.map(a=>t.has(a,"component")?x.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(me,{...a},a.label):a.styleType==="accordion"&&r(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(ot,{...a},a.label):null:e.jsxRuntimeExports.jsx(te,{...a},a.label)))})]})})},it=({item:s,index:o,canDelete:r,onChange:n,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:a=>n(a,o),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:a=>t.isEmpty(s.key)?{}:n(a,o),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(u.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),lt=({section:s})=>{var b;const{setSyncState:o}=f.useSavePage(),r=f.useSelectedBlock(),[n,i]=x.useState([]),[a]=f.useSelectedStylingBlocks(),d=f.useUpdateBlocksPropsRealtime(),p=`${t.get(a,"0.prop")}_attrs`;X.useEffect(()=>{const y=t.map(t.get(r,p),(h,R)=>({key:R,value:h}));t.isEmpty(y)?i([]):i(y)},[t.get(r,p)]);const l=()=>i([...n,{key:"",value:""}]),m=y=>{const h=t.filter(n,(R,N)=>y!==N);c(h)},g=(y,h)=>{const R=[...n];R[h][y.target.name]=y.target.value,c(R)},c=X.useCallback((y=[])=>{const h={};t.forEach(y,R=>{t.isEmpty(R.key)||t.set(h,R.key,R.value)}),d([t.get(r,"_id")],{[p]:h}),o("UNSAVED")},[r,o,d,p]);return e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(ee.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(n)&&t.isEmpty((b=t.last(n))==null?void 0:b.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var y;!t.isEmpty(n)&&t.isEmpty((y=t.last(n))==null?void 0:y.key)||l()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),X.Children.toArray(t.map(n,(y,h)=>{const R=n.length>0&&h<n.length-1;return e.jsxRuntimeExports.jsx(it,{item:y,index:h,canDelete:R,onChange:g,onRemove:()=>m(h)})}))]})]})})]})};function at(){const[s,o]=f.useStylingState(),{flexChild:r,gridChild:n}=f.useSelectedBlocksDisplayChild(),[,i]=Ce.useAtom(f.advanceStylingOpenAtom),{t:a}=ae.useTranslation(),[d]=f.useSelectedStylingBlocks();return t.isEmpty(d)?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:a("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>i(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b border-border px-4 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(ee.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(C.Select,{defaultValue:s,onValueChange:p=>o(p),children:[e.jsxRuntimeExports.jsx(C.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(C.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(C.SelectContent,{children:[e.jsxRuntimeExports.jsx(C.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(Te.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",className:"h-full w-full",children:[r&&e.jsxRuntimeExports.jsx(U,{section:Oe}),n?e.jsxRuntimeExports.jsx(U,{section:qe}):null,_e.map(p=>e.jsxRuntimeExports.jsx(U,{section:p},p.heading)),e.jsxRuntimeExports.jsx(lt,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const pt={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},ut=()=>{const s=f.useSelectedBlock(),{t:o}=ae.useTranslation(),[r,n]=x.useState(""),[i,a]=x.useState({onDrag:l=>l,onDragEnd:l=>l,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=G.useThrottledCallback(l=>{const m=!t.get(i,"negative",!1),g=t.get(i,"cssProperty","");let c=parseFloat(i.dragStartValue);c=t.isNaN(c)?0:c;let b=pt[i.dragUnit];(t.startsWith(g,"scale")||g==="opacity")&&(b=10);let h=(i.dragStartY-l.pageY)/b+c;m&&h<0&&(h=0),g==="opacity"&&h>1&&(h=1),i.onDrag(`${h}`),n(`${h}`)},[i],50),p=x.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${r}`),100),a({onDrag:l=>l,onDragEnd:l=>l,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,r,a]);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.jsxs(xe.Provider,{value:{setDragData:a},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:d,onMouseUp:()=>p(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(M.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(M.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx($e,{})}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(at,{})})]})]})};exports.default=ut;
|
|
@@ -8,7 +8,7 @@ import { PlusIcon as Ce, Cross2Icon as Ye, EyeOpenIcon as jt, EyeClosedIcon as V
|
|
|
8
8
|
import { T as Ot, a as Mt, b as He, c as Be } from "./tabs-85caa1e8.js";
|
|
9
9
|
import _t from "@rjsf/core";
|
|
10
10
|
import Et from "@rjsf/validator-ajv8";
|
|
11
|
-
import { D as G, E as Ft, d as ze, G as Ue, H as Yt, I as Xt, J as Wt, j as ke, K as Ge, L as Ke, i as qe, e as Zt, M as Je, f as Ae, N as pe, c as zt, O as Ut, P as Gt } from "./index-
|
|
11
|
+
import { D as G, E as Ft, d as ze, G as Ue, H as Yt, I as Xt, J as Wt, j as ke, K as Ge, L as Ke, i as qe, e as Zt, M as Je, f as Ae, N as pe, c as zt, O as Ut, P as Gt } from "./index-41ba78a6.js";
|
|
12
12
|
import { getChaiDataProviders as Kt, getBlockComponent as Qe, SingleLineText as qt } from "@chaibuilder/blocks";
|
|
13
13
|
import { EditIcon as Jt, TrashIcon as Qt, Check as er } from "lucide-react";
|
|
14
14
|
import { u as et } from "./useChaiExternalData-192c7896.js";
|
|
@@ -5,7 +5,7 @@ import { useAtom as w } from "jotai";
|
|
|
5
5
|
import { filter as g, map as k, isNull as H, isEmpty as I, find as R, each as _, get as F } from "lodash";
|
|
6
6
|
import { A as O, b as Y, d as U, e as $, f as J, g as Z, h as q, i as G, k as Q, u as C, B as b, S as D } from "./useBuilderProp-21feb2da.js";
|
|
7
7
|
import { T as W, a as X, b as A, c as P } from "./tabs-85caa1e8.js";
|
|
8
|
-
import { u as ee, p as se, E as re, a as ae, b as le } from "./index-
|
|
8
|
+
import { u as ee, p as se, E as re, a as ae, b as le } from "./index-41ba78a6.js";
|
|
9
9
|
import "react-i18next";
|
|
10
10
|
import { c as ie } from "./utils-ac68b2c8.js";
|
|
11
11
|
import { ListTreeIcon as S, DatabaseIcon as te } from "lucide-react";
|
|
@@ -185,7 +185,7 @@ const be = () => {
|
|
|
185
185
|
/* @__PURE__ */ e.jsx(je, { onClose: () => t(null), provider: f })
|
|
186
186
|
] })
|
|
187
187
|
] });
|
|
188
|
-
}, z = N(() => import("./Layers-
|
|
188
|
+
}, z = N(() => import("./Layers-e0ac56d5.js")), ye = N(() => import("./BrandingOptions-3bbb19f0.js")), we = N(() => import("./ImagesPanel-47ac13c3.js"));
|
|
189
189
|
let K = null;
|
|
190
190
|
const ns = () => {
|
|
191
191
|
const r = C("sideBarComponents.top", []), o = C("sideBarComponents.bottom", []), [a, n] = w(ae), [i, c] = u(a), [m, y] = u(null), f = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=Object.create;var q=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var K=(s,o,r,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of T(o))!B.call(s,l)&&l!==r&&q(s,l,{get:()=>o[l],enumerable:!(u=A(o,l))||u.enumerable});return s};var V=(s,o,r)=>(r=s!=null?P(z(s)):{},K(o||!s||!s.__esModule?q(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),k=require("@radix-ui/react-icons"),i=require("react"),N=require("jotai"),x=require("lodash"),n=require("./useBuilderProp-adacf42f.cjs"),h=require("./tabs-860e37aa.cjs"),E=require("./index-b7e3f3cb.cjs");require("react-i18next");const I=require("./utils-3c452dd0.cjs"),w=require("lucide-react"),L=require("@chaibuilder/blocks"),g=require("./dialog-170eaad9.cjs"),v=require("./select-0e32300c.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-tabs");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("sonner");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-select");const M=i.lazy(()=>import("react-json-view")),H=({provider:s,onClose:o})=>{const[r,u]=i.useState(null);return i.useEffect(()=>{s&&(s.mockFn?s.mockFn:s.dataFn)().then(d=>u(d))},[s]),s?e.jsxRuntimeExports.jsx(g.Dialog,{onOpenChange:l=>l?"":o(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(g.DialogContent,{children:[e.jsxRuntimeExports.jsxs(g.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(g.DialogTitle,{children:["Data Provider: ",s.name]}),e.jsxRuntimeExports.jsx(g.DialogDescription,{children:s.description})]}),e.jsxRuntimeExports.jsx(E.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(M,{style:{maxHeight:"80vh",overflowY:"auto"},name:s.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:r})})]})}):null};function O({children:s,name:o,onRemove:r}){return e.jsxRuntimeExports.jsxs(n.AlertDialog,{children:[e.jsxRuntimeExports.jsx(n.AlertDialogTrigger,{asChild:!0,children:s}),e.jsxRuntimeExports.jsxs(n.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(n.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsxs(n.AlertDialogTitle,{children:["Are you sure, you want to remove ",e.jsxRuntimeExports.jsx("span",{className:"text-blue-500",children:o})," provider?"]}),e.jsxRuntimeExports.jsx(n.AlertDialogDescription,{children:"Your data provider will be removed from this page and all added data binding will be not visible on blocks."})]}),e.jsxRuntimeExports.jsxs(n.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(n.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(n.AlertDialogAction,{onClick:r,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})}const F=()=>{const s=i.useMemo(()=>L.getChaiDataProviders(),[]),[o,r]=E.usePageDataProviders(),[,u]=N.useAtom(E.pageSyncStateAtom),[l,d]=i.useState(x.filter(s,t=>x.map(o,"providerKey").includes(t.providerKey))),[j,y]=i.useState(""),[R,c]=i.useState(null),b=x.filter(s.map(t=>x.map(l,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!x.isNull(t)),a=t=>{const p=x.find(s,{providerKey:t});d(m=>[...m,p]),r(m=>[...m,{providerKey:p.providerKey,args:{}}]),y(""),u("UNSAVED")},f=t=>{d(p=>x.filter(p,m=>m.providerKey!==t.providerKey)),r(p=>x.filter(p,m=>m.providerKey!==t.providerKey)),u("UNSAVED")},D=t=>c(t);return x.isEmpty(s)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",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:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Add data providers:"})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(v.Select,{value:j,onValueChange:t=>a(t),children:[e.jsxRuntimeExports.jsx(v.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(v.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(v.SelectContent,{children:[e.jsxRuntimeExports.jsx(v.SelectItem,{value:"",children:"Choose"}),b.map(t=>e.jsxRuntimeExports.jsx(v.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${l.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:"Page data providers:"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:l.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>D(t),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Data"]}),e.jsxRuntimeExports.jsx(O,{onRemove:()=>f(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),"Remove"]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(H,{onClose:()=>c(null),provider:R})]})]})},C=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-94260926.cjs"))),Y=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-703e2c8b.cjs"))),_=i.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-8b7a989d.cjs")));let S=null;const U=()=>{const s=n.useBuilderProp("sideBarComponents.top",[]),o=n.useBuilderProp("sideBarComponents.bottom",[]),[r,u]=N.useAtom(E.activePanelAtom),[l,d]=i.useState(r),[j,y]=i.useState(null),R={layers:C,"branding-options":Y,images:_};x.each(s,({name:a,panel:f})=>{R[a]=f});const c=a=>{clearTimeout(S),b(!1),r!=="layers"&&a==="layers"?S=setTimeout(()=>d("layers"),500):d(a),u(a)},[,b]=N.useAtom(E.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{b(!0),u("layers")},size:"sm",variant:r==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>c("layers"),size:"sm",variant:r==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>c("branding-options"),size:"sm",variant:r==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(s.map(({name:a,icon:f})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>c(a),size:"sm",className:"w-10",variant:r===a?"default":"outline",children:e.jsxRuntimeExports.jsx(f,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:i.Children.toArray(o.map(a=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(a,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{c("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(r==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${r!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:I.cn("relative h-full max-h-[93%] bg-background p-1",r==="layers"?"":"z-[100]"),onMouseEnter:()=>{j&&clearTimeout(j)},onMouseLeave:()=>{const a=setTimeout(()=>{j&&(c("layers"),clearTimeout(j))},1e3);y(a)},children:i.createElement(x.get(R,l,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsxs(h.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(h.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(h.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(w.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(h.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(w.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(h.TabsContent,{value:"layers",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(C)}),e.jsxRuntimeExports.jsx(h.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(F,{})})]})})})]})};exports.default=U;
|
|
1
|
+
"use strict";var P=Object.create;var q=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var K=(s,o,r,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of T(o))!B.call(s,l)&&l!==r&&q(s,l,{get:()=>o[l],enumerable:!(u=A(o,l))||u.enumerable});return s};var V=(s,o,r)=>(r=s!=null?P(z(s)):{},K(o||!s||!s.__esModule?q(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),k=require("@radix-ui/react-icons"),i=require("react"),N=require("jotai"),x=require("lodash"),n=require("./useBuilderProp-adacf42f.cjs"),h=require("./tabs-860e37aa.cjs"),E=require("./index-ef6fb010.cjs");require("react-i18next");const I=require("./utils-3c452dd0.cjs"),w=require("lucide-react"),L=require("@chaibuilder/blocks"),g=require("./dialog-170eaad9.cjs"),v=require("./select-0e32300c.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-tabs");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("sonner");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-select");const M=i.lazy(()=>import("react-json-view")),H=({provider:s,onClose:o})=>{const[r,u]=i.useState(null);return i.useEffect(()=>{s&&(s.mockFn?s.mockFn:s.dataFn)().then(d=>u(d))},[s]),s?e.jsxRuntimeExports.jsx(g.Dialog,{onOpenChange:l=>l?"":o(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(g.DialogContent,{children:[e.jsxRuntimeExports.jsxs(g.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(g.DialogTitle,{children:["Data Provider: ",s.name]}),e.jsxRuntimeExports.jsx(g.DialogDescription,{children:s.description})]}),e.jsxRuntimeExports.jsx(E.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(M,{style:{maxHeight:"80vh",overflowY:"auto"},name:s.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:r})})]})}):null};function O({children:s,name:o,onRemove:r}){return e.jsxRuntimeExports.jsxs(n.AlertDialog,{children:[e.jsxRuntimeExports.jsx(n.AlertDialogTrigger,{asChild:!0,children:s}),e.jsxRuntimeExports.jsxs(n.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(n.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsxs(n.AlertDialogTitle,{children:["Are you sure, you want to remove ",e.jsxRuntimeExports.jsx("span",{className:"text-blue-500",children:o})," provider?"]}),e.jsxRuntimeExports.jsx(n.AlertDialogDescription,{children:"Your data provider will be removed from this page and all added data binding will be not visible on blocks."})]}),e.jsxRuntimeExports.jsxs(n.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(n.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(n.AlertDialogAction,{onClick:r,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})}const F=()=>{const s=i.useMemo(()=>L.getChaiDataProviders(),[]),[o,r]=E.usePageDataProviders(),[,u]=N.useAtom(E.pageSyncStateAtom),[l,d]=i.useState(x.filter(s,t=>x.map(o,"providerKey").includes(t.providerKey))),[j,y]=i.useState(""),[R,c]=i.useState(null),b=x.filter(s.map(t=>x.map(l,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!x.isNull(t)),a=t=>{const p=x.find(s,{providerKey:t});d(m=>[...m,p]),r(m=>[...m,{providerKey:p.providerKey,args:{}}]),y(""),u("UNSAVED")},f=t=>{d(p=>x.filter(p,m=>m.providerKey!==t.providerKey)),r(p=>x.filter(p,m=>m.providerKey!==t.providerKey)),u("UNSAVED")},D=t=>c(t);return x.isEmpty(s)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",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:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Add data providers:"})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(v.Select,{value:j,onValueChange:t=>a(t),children:[e.jsxRuntimeExports.jsx(v.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(v.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(v.SelectContent,{children:[e.jsxRuntimeExports.jsx(v.SelectItem,{value:"",children:"Choose"}),b.map(t=>e.jsxRuntimeExports.jsx(v.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${l.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:"Page data providers:"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:l.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>D(t),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Data"]}),e.jsxRuntimeExports.jsx(O,{onRemove:()=>f(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),"Remove"]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(H,{onClose:()=>c(null),provider:R})]})]})},C=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-fad860a5.cjs"))),Y=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-049505cb.cjs"))),_=i.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-8b7a989d.cjs")));let S=null;const U=()=>{const s=n.useBuilderProp("sideBarComponents.top",[]),o=n.useBuilderProp("sideBarComponents.bottom",[]),[r,u]=N.useAtom(E.activePanelAtom),[l,d]=i.useState(r),[j,y]=i.useState(null),R={layers:C,"branding-options":Y,images:_};x.each(s,({name:a,panel:f})=>{R[a]=f});const c=a=>{clearTimeout(S),b(!1),r!=="layers"&&a==="layers"?S=setTimeout(()=>d("layers"),500):d(a),u(a)},[,b]=N.useAtom(E.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{b(!0),u("layers")},size:"sm",variant:r==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>c("layers"),size:"sm",variant:r==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>c("branding-options"),size:"sm",variant:r==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(k.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(s.map(({name:a,icon:f})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>c(a),size:"sm",className:"w-10",variant:r===a?"default":"outline",children:e.jsxRuntimeExports.jsx(f,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:i.Children.toArray(o.map(a=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(n.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(a,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{c("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(r==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${r!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:I.cn("relative h-full max-h-[93%] bg-background p-1",r==="layers"?"":"z-[100]"),onMouseEnter:()=>{j&&clearTimeout(j)},onMouseLeave:()=>{const a=setTimeout(()=>{j&&(c("layers"),clearTimeout(j))},1e3);y(a)},children:i.createElement(x.get(R,l,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsxs(h.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(h.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(h.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(w.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(h.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(w.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(h.TabsContent,{value:"layers",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(C)}),e.jsxRuntimeExports.jsx(h.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(F,{})})]})})})]})};exports.default=U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),o=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-adacf42f.cjs"),a=require("./separator-a597dba7.cjs"),c=require("./toggle-b90fed97.cjs"),p=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),o=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-adacf42f.cjs"),a=require("./separator-a597dba7.cjs"),c=require("./toggle-b90fed97.cjs"),p=require("./index-ef6fb010.cjs"),m=require("react-i18next");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-separator");require("@radix-ui/react-toggle");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const j=()=>s.useBuilderProp("languages",["en"]),d=()=>j().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),h=()=>{const{savePage:x,syncState:t}=p.useSavePage(),{t:u}=m.useTranslation(),l=n.useMemo(()=>{switch(t){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(c.Toggle,{onClick:()=>x(),className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${l}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),t==="SAVING"?"Saving...":t==="SAVED"?u("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t==="SAVING"?"Saving...":t==="SAVED"?"Saved":"Save changes"})})]})})},g=()=>{const x=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]),l=s.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(x.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(t.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(a.Separator,{orientation:"vertical"}),l?e.jsxRuntimeExports.jsx(h,{}):null,n.Children.toArray(u.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))]})]})};exports.default=g;
|
|
@@ -5,7 +5,7 @@ import { S as d, c as h, b as u, d as g, a as j, e as f, f as t } from "./select
|
|
|
5
5
|
import { u as a, l as v, m as S, n as b, S as m } from "./useBuilderProp-21feb2da.js";
|
|
6
6
|
import { S as N } from "./separator-a80d065b.js";
|
|
7
7
|
import { T as C } from "./toggle-00c9d11e.js";
|
|
8
|
-
import { c as w } from "./index-
|
|
8
|
+
import { c as w } from "./index-41ba78a6.js";
|
|
9
9
|
import { useTranslation as y } from "react-i18next";
|
|
10
10
|
import "@radix-ui/react-select";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-adacf42f.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-ea21db6c.cjs"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-adacf42f.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-ea21db6c.cjs"),f=require("./index-ef6fb010.cjs");require("@radix-ui/react-alert-dialog");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-dialog");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-24679521.cjs");require("react-icons-picker");require("react-dom");require("./ImagesPanel-8b7a989d.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("sonner");require("lucide-react");const E=({closeModal:i})=>{var l,o;const s=f.useAddPage(),[r,m]=g.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{}}),p=()=>{s.mutate(r,{onSuccess:()=>i()})},j=({formData:u},t)=>{m(h=>{var d,c;const n={[t]:u[t]};return t==="name"?n.slug=R.kebabCase((d=u[t])==null?void 0:d.replace(/\d/g,"")):t==="slug"&&(n.slug=(c=u[t])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...h,...n}})},P={name:q.SingleLineText({title:"Page Name",default:r.name}),slug:q.SingleLineText({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(a.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(b.Form,{formData:r,properties:P,onChange:j,disabled:s.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(x.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((o=r.slug)==null?void 0:o.length)<2||s.isPending,onClick:p,children:"Add Page"})})]})},S=()=>{const[i,s]=g.useState(!1);return e.jsxRuntimeExports.jsxs(a.Dialog,{open:i,onOpenChange:()=>s(!i),children:[e.jsxRuntimeExports.jsx(a.DialogTrigger,{children:e.jsxRuntimeExports.jsx(x.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>s(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(E,{closeModal:()=>s(!i)})]})};exports.default=S;
|
|
@@ -5,7 +5,7 @@ import { B as c } from "./useBuilderProp-21feb2da.js";
|
|
|
5
5
|
import { D as b, a as C, b as A } from "./dialog-18207bef.js";
|
|
6
6
|
import { SingleLineText as d } from "@chaibuilder/blocks";
|
|
7
7
|
import { F as D } from "./form-25e1af37.js";
|
|
8
|
-
import { a0 as N } from "./index-
|
|
8
|
+
import { a0 as N } from "./index-41ba78a6.js";
|
|
9
9
|
import "@radix-ui/react-alert-dialog";
|
|
10
10
|
import "./utils-ac68b2c8.js";
|
|
11
11
|
import "clsx";
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ef6fb010.cjs"),s=require("./useBuilderProp-adacf42f.cjs"),u=require("react-i18next");require("./jsx-runtime-5c3ac4f7.cjs");require("react");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("@radix-ui/react-icons");require("sonner");require("lucide-react");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiBuilderStudio=e.ChaiBuilderStudio;exports.useActiveLanguage=e.useActiveLanguage;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlockContentByLanguage=e.useBlockContentByLanguage;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderReset=e.useBuilderReset;exports.useBuildingBlocks=e.useBuildingBlocks;exports.useCanvasHistory=e.useCanvasHistory;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCurrentPage=e.useCurrentPage$1;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDeveloperPreviewMode=e.useDeveloperPreviewMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useFeatureSupport=e.useFeatureSupport;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useMarkAsGlobalBlock=e.useMarkAsGlobalBlock;exports.useMoveBlocks=e.useMoveBlocks;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.usePrimaryLanguage=e.usePrimaryLanguage;exports.useProject=e.useProject$1;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSetAllBlocks=e.useSetAllBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTranslations=e.useTranslations;exports.useTreeData=e.useTreeData;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useBuilderProp=s.useBuilderProp;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});
|