@chaibuilder/sdk 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/AddBlocks-2e763e41.cjs +3 -0
  2. package/dist/{AddBlocks-189ba69a.js → AddBlocks-340542cc.js} +13 -14
  3. package/dist/{BrandingOptions-e659a7bf.cjs → BrandingOptions-93298418.cjs} +1 -1
  4. package/dist/{BrandingOptions-c01e08fc.js → BrandingOptions-da602397.js} +1 -1
  5. package/dist/{CanvasArea-9106ecb5.js → CanvasArea-0ba49a92.js} +2 -2
  6. package/dist/{CanvasArea-933848fb.cjs → CanvasArea-20982a8b.cjs} +2 -2
  7. package/dist/{CurrentPage-37d2f495.js → CurrentPage-41e66713.js} +1 -1
  8. package/dist/{CurrentPage-92d8bfe0.cjs → CurrentPage-7c0e986b.cjs} +1 -1
  9. package/dist/{Layers-c08aa961.js → Layers-15b9cf48.js} +2 -2
  10. package/dist/{Layers-94aeb9f0.cjs → Layers-cc22fb98.cjs} +1 -1
  11. package/dist/{MarkAsGlobalBlock-10422d13.js → MarkAsGlobalBlock-143a204d.js} +1 -1
  12. package/dist/{MarkAsGlobalBlock-07cb6760.cjs → MarkAsGlobalBlock-4f9dad50.cjs} +1 -1
  13. package/dist/{PagesPanel-be499af0.js → PagesPanel-29e8ff05.js} +2 -2
  14. package/dist/{PagesPanel-e4807890.cjs → PagesPanel-6dbcc705.cjs} +1 -1
  15. package/dist/{ProjectPanel-fd948934.js → ProjectPanel-0cf59dff.js} +2 -2
  16. package/dist/{ProjectPanel-0478c85b.cjs → ProjectPanel-e3ecad42.cjs} +1 -1
  17. package/dist/{Settings-94b79852.js → Settings-5df6bc31.js} +450 -449
  18. package/dist/Settings-ae8b67c5.cjs +1 -0
  19. package/dist/SidePanels-7c31e973.js +329 -0
  20. package/dist/SidePanels-fbf3d99d.cjs +1 -0
  21. package/dist/{Topbar-d6382110.cjs → Topbar-506281be.cjs} +1 -1
  22. package/dist/{Topbar-0542b5f4.js → Topbar-f6d0676d.js} +1 -1
  23. package/dist/{add-page-modal-6132fdff.cjs → add-page-modal-87e921d2.cjs} +1 -1
  24. package/dist/{add-page-modal-36a6b406.js → add-page-modal-f7b31884.js} +1 -1
  25. package/dist/core.cjs +1 -1
  26. package/dist/core.js +1 -1
  27. package/dist/{delete-page-modal-87c48560.cjs → delete-page-modal-8cfafe5d.cjs} +1 -1
  28. package/dist/{delete-page-modal-68a4d71e.js → delete-page-modal-afc5ac26.js} +1 -1
  29. package/dist/{index-6f5cce76.cjs → index-cbeea3bc.cjs} +18 -18
  30. package/dist/{index-c49887fe.js → index-d1a25967.js} +6 -6
  31. package/dist/{page-viewer-47098c44.cjs → page-viewer-9b33c8bb.cjs} +1 -1
  32. package/dist/{page-viewer-d87e5621.js → page-viewer-f651f579.js} +2 -2
  33. package/dist/{project-general-setting-869887d5.cjs → project-general-setting-0ceca7f5.cjs} +1 -1
  34. package/dist/{project-general-setting-91df16a9.js → project-general-setting-15cad783.js} +1 -1
  35. package/dist/render.cjs +1 -1
  36. package/dist/render.d.ts +2 -4
  37. package/dist/render.js +59 -67
  38. package/dist/server.cjs +1 -1
  39. package/dist/server.d.ts +1 -1
  40. package/dist/server.js +36 -36
  41. package/dist/{single-page-detail-4a424725.js → single-page-detail-8d4fb1c8.js} +2 -2
  42. package/dist/{single-page-detail-1b276c4f.cjs → single-page-detail-ae2a5b54.cjs} +1 -1
  43. package/dist/textarea-0750bcd2.js +73 -0
  44. package/dist/textarea-a338ede6.cjs +1 -0
  45. package/dist/ui.cjs +1 -1
  46. package/dist/ui.js +72 -73
  47. package/package.json +4 -4
  48. package/dist/AddBlocks-36adcc50.cjs +0 -3
  49. package/dist/Settings-6cb217af.cjs +0 -1
  50. package/dist/SidePanels-4434d31b.cjs +0 -1
  51. package/dist/SidePanels-78d8de19.js +0 -246
  52. package/dist/card-14e1d020.cjs +0 -1
  53. package/dist/card-f8f4f985.js +0 -33
  54. package/dist/textarea-20b2f6b2.cjs +0 -1
  55. package/dist/textarea-9dfb6a32.js +0 -45
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),c=require("react"),Z=require("@react-hookz/web"),t=require("lodash"),se=require("react-i18next"),u=require("@radix-ui/react-icons"),P=require("./tabs-860e37aa.cjs"),pe=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),R=require("./index-6f5cce76.cjs"),Y=require("@chaibuilder/blocks"),re=require("lucide-react"),oe=require("react-autosuggest"),ce=require("./useChaiExternalData-a90e8aac.cjs"),w=require("./useBuilderProp-5e57d0c8.cjs"),T=require("./accordion-0afd8143.cjs"),W=require("./link-86ac8848.cjs"),xe=require("jotai"),me=require("fuse.js"),$=require("./html-to-json-aadcbf66.cjs"),U=require("./label-167415e5.cjs"),ge=require("./MODIFIERS-4716c669.cjs"),he=require("./input-42acea7e.cjs"),ye=require("./scroll-area-bb343b86.cjs"),k=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-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-accordion");require("react-icons-picker");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-0db5c72f.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-label");require("@radix-ui/react-select");function be(r){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}return n.default=r,Object.freeze(n)}const F=be(c);function fe(r){const n=[],s={};function a(l,i){t.forEach(i,(d,p)=>{const o=l?`${l}.${p}`:p,x=t.isArray(d)?"list":typeof d;n.push(o),s[o]=x==="string"?"text":x==="object"?"model":x,x==="object"&&!t.isArray(d)&&a(o,d)})}return a("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:s}}const je=({data:r})=>{if(!r)return null;const n=typeof r;return e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(n==="object"?JSON.stringify(r):r,{length:40})})},K=({type:r,isDisabled:n=!1,placeholder:s,defaultValue:a="",data:l,onChange:i,dataType:d,appliedBindings:p})=>{const[o,x]=c.useState(a),{paths:m,pathsType:y}=fe(l),g=r==="PROP"?Y.getBlockComponent(l==null?void 0:l._type):{};c.useEffect(()=>{t.isEmpty(o)&&i("")},[o]),c.useEffect(()=>x(a),[a]);const f=()=>m.filter(j=>{const C=t.isEmpty(o)||t.includes(t.toLower(j),t.toLower(o));return r==="PATH"?C&&d===t.get(y,j,""):C&&!t.includes(p,j)&&t.get(g,`props.${t.first(t.split(j,"."))}.binding`)}),[h,v]=c.useState(()=>f());c.useEffect(()=>v(()=>f()),[d]);const H={autoComplete:"off",autoCorrect:"on",autoCapitalize:"off",spellCheck:!1,placeholder:s,value:o,disabled:n,onBlur:()=>{m.includes(o)?i(o):(x(""),i(""))},onChange:(j,{newValue:C})=>x(C),className:`chai-input w-full ${n?"cursor-not-allowed":""}`},I=j=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-md px-1 py-1.5 flex items-center justify-between space-x-2 font-light relative","data-suggest":j,children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 w-full h-full absolute opacity-0 z-20",children:j}),e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx("div",{className:"leading-4 text-xs flex items-center text-gray-800",children:c.Children.toArray(t.map(t.split(j,"."),(C,A)=>e.jsxRuntimeExports.jsxs("span",{className:"flex items-end",children:[A>0&&e.jsxRuntimeExports.jsx(re.ChevronRight,{size:14,className:"h-full text-gray-400"}),t.startCase(C)]})))}),r==="PATH"&&e.jsxRuntimeExports.jsx(je,{data:t.get(l,j)})]}),r==="PROP"&&e.jsxRuntimeExports.jsx("div",{className:"bg-purple-100 text-purple-400 text-[9px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(t.get(y,j,""))})]});return e.jsxRuntimeExports.jsx(oe,{suggestions:h,onSuggestionsFetchRequested:()=>v(()=>f()),onSuggestionsClearRequested:()=>v([]),onSuggestionSelected:j=>{if(j.type==="click"){const C=t.get(j.target,"childNodes[0].data","");m.includes(C)&&i(C)}else i(j.target.value)},getSuggestionValue:j=>j,renderSuggestion:I,shouldRenderSuggestions:()=>!0,inputProps:H,containerProps:{className:"w-full"},theme:{suggestion:"text-gray-500 border-b overflow-hidden text-ellipsis",suggestionHighlighted:"bg-blue-100 text-blue-800 font-normal cursor-pointer",suggestionsContainerOpen:"bg-white border border-gray-300 z-50 max-h-52 left-2 overflow-y-auto w-full rounded-md shadow-2xl text-sm font-light w-full"}})},ve=({item:r,onChange:n,onRemove:s,selectedBlock:a,dataProvider:l,appliedBindings:i})=>{const[d,p]=c.useState("string"),o=(x,m)=>{if(t.isEmpty(x))return"";{const y=t.get(m==="PROP"?a:l,x,"");if(t.isArray(y))return"list";const g=typeof y;return g==="string"?"text":g==="object"?"model":g}};return c.useEffect(()=>p(()=>o(r.key,"PROP")),[r.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border border-gray-200 relative rounded-md p-2",children:[!t.isEmpty(d)&&!t.isEmpty(r.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-2 top-4 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(d)}),e.jsxRuntimeExports.jsx(K,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",defaultValue:r.key,onChange:x=>{const m=o(x,"PROP");n({target:{name:"key",value:x}}),d!==m&&n({target:{name:"value",value:""}}),p(m)},data:a,dataType:d,appliedBindings:i}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-start justify-between gap-x-1.5 w-full relative",children:[e.jsxRuntimeExports.jsx(K,{type:"PATH",isDisabled:t.isEmpty(r.key),placeholder:"Enter data path",defaultValue:r.value,onChange:x=>{const m=o(x,"PATH");n(d!==m?{target:{name:"value",value:""}}:{target:{name:"value",value:x}})},data:l,dataType:d,appliedBindings:i}),e.jsxRuntimeExports.jsx(re.TrashIcon,{onClick:s,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"})]})]})},Re=({bindingData:r,onChange:n})=>{const s=R.useSelectedBlock(),[a]=ce.useChaiExternalData(),l=Y.getChaiDataProviders(),[i,d]=c.useState(t.map(r,(g,f)=>({key:f,value:g})));c.useEffect(()=>{d(t.map(r,(g,f)=>({key:f,value:g})))},[s==null?void 0:s._id]);const p=c.useMemo(()=>{if(t.isEmpty(i))return!1;const g=t.last(i);return t.isEmpty(g==null?void 0:g.key)||t.isEmpty(g==null?void 0:g.value)},[i]),o=()=>{d([...i,{key:"",value:""}])},x=g=>{const f=t.filter(i,(h,v)=>g!==v);y([...f])},m=(g,f)=>{const h=[...i];h[f][g.target.name]=g.target.value,y(h)},y=c.useCallback((g=[])=>{if(d(g),t.isEmpty(g)){n({});return}const f={};t.forEach(g,h=>{!t.isEmpty(h==null?void 0:h.key)&&!t.isEmpty(h==null?void 0:h.value)&&t.set(f,h.key,h.value)}),n(f)},[s]);return t.isEmpty(l)?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(i,(g,f)=>e.jsxRuntimeExports.jsx(ve,{item:g,onChange:h=>m(h,f),onRemove:()=>x(f),selectedBlock:s,dataProvider:a,appliedBindings:t.map(i,"key")},g.key)),e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx("button",{onClick:o,disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${t.isEmpty(i)?"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30 ":""} ${p?"cursor-not-allowed bg-gray-200 text-gray-400":t.isEmpty(i)?"":"bg-gray-700/20 text-gray-800 hover:bg-blue-700/30"}`,children:"+ Add Data Binding"})}),p&&e.jsxRuntimeExports.jsx(w.TooltipContent,{sideOffset:10,className:"text-[11px]",children:"Complete last added data binding to add more"})]})]})},Ee=Re,we=()=>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"}),J=({createHistorySnapshot:r,properties:n,formData:s,onChange:a})=>{const[l]=R.useActiveLanguage(),i={type:"object",properties:{}},d={};return Object.keys(n).forEach(p=>{const o=n[p];if(t.includes(["slot","styles"],o.type))return;const x=t.get(o,"i18n",!1)?`${p}-${l}`:p;i.properties[x]=R.getBlockJSONFromSchemas(o,l),d[x]=R.getBlockJSONFromUISchemas(o,l)}),e.jsxRuntimeExports.jsx(pe,{widgets:{binding:we,richtext:W.RichTextEditorField,icon:W.IconPickerField,image:W.ImagePickerField},fields:{link:W.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:de,uiSchema:d,onBlur:r,schema:i,formData:s,onChange:a})};function Ce(){const r=R.useSelectedBlock(),{createSnapshot:n}=R.useCanvasHistory(),s=R.useUpdateBlocksPropsRealtime(),a=Y.getBlockComponent(r._type),l={...r},i=()=>n(),d=({formData:m},y)=>{if(y){const g=y.replace("root.","");s([r._id],{[g]:t.get(m,g)})}},p={_name:Y.SingleLineText({title:"Name",default:t.get(r,"_name",r._type)})},o=t.keys(t.get(l,"_bindings",{})),x=c.useMemo(()=>{const m=t.cloneDeep(t.get(a,"props",{}));return t.each(o,y=>{delete m[y]}),m},[a,o]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:i,formData:l,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(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Ee,{bindingData:t.get(l,"_bindings",{}),onChange:m=>{d({formData:{...l,_bindings:m}},"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(o)?"":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(o,t.capitalize).join(", ")})," ",o.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:i,formData:l,properties:x})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const Q=new me($.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function ke(){var I;const[r]=R.useSelectedStylingBlocks(),n=R.useSelectedBlock(),s=R.useAddClassesToBlocks(),a=R.useRemoveClassesFromBlocks(),[l]=R.useSelectedBlockIds(),[i,d]=c.useState(""),p=(I=t.first(r))==null?void 0:I.prop,o=t.reject((t.get(n,p,"").replace(ge.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),x=()=>{const j=i.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");s(l,j,!0),d("")},[m,y]=c.useState([]),g=({value:j})=>{const C=j.trim().toLowerCase(),A=C.match(/.+:/g);let S=[];if(A&&A.length>0){const[V]=A,L=C.replace(V,"");S=Q.search(L).map(b=>({...b,item:{...b.item,name:V+b.item.name}}))}else S=Q.search(C);y(t.map(S,"item"))},f=()=>{y([])},h=j=>j.name,v=j=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:j.name}),H={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:i,onKeyDown:j=>{j.key==="Enter"&&i.trim()!==""&&x()},onChange:(j,{newValue:C})=>d(C),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 ${m.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(U.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(oe,{suggestions:m,onSuggestionsFetchRequested:g,onSuggestionsClearRequested:f,getSuggestionValue:h,renderSuggestion:v,inputProps:H,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(w.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:x,disabled:i.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(o)&&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"}),F.Children.toArray(o.map(j=>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:[j,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>a(l,[j]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},j)))]})]})}const B=["px","%","em","rem","ch","vh","vw"],Se={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:B,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"}]},Ne={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"}]},Te=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:B},{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:B},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...B,"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:B.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:B.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:B.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:B.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:B.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:B.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:B},{type:"arbitrary",property:"lineHeight",label:"Height",units:B.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:ke}]}],ne={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible: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},O=c.createContext({canReset:!1,canChange:!0}),Ie=({children:r,canReset:n=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:n,canChange:s},children:r}),le=({label:r,property:n,onChange:s})=>{const a=c.useMemo(()=>t.get($.CLASSES_LIST,`${n}.classes`,[""]),[n]),l=q(n),i=c.useMemo(()=>t.get(l,"cls",""),[l]),{canChange:d}=c.useContext(O),p=/\[.*\]/g.test(i);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(he.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:i}),e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.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(w.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(z,{rounded:r,onChange:o=>s(o,n),selected:i,options:a,disabled:!d})})};function z({selected:r,onChange:n,rounded:s=!1,options:a,disabled:l=!1}){const i=r.replace(/.*:/g,"").trim(),{undo:d,redo:p}=R.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!a.length||l,className:`${s?"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:o=>n(o.target.value),onKeyDown:o=>{o.ctrlKey&&(o.key==="z"&&d(),o.key==="y"&&p())},value:i,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(a.map(o=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:o,children:o})))]})}const Ae=({property:r,onChange:n})=>{const{canReset:s,canChange:a}=c.useContext(O),l=q(r),i=c.useMemo(()=>t.get(l,"cls",""),[l]),d=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),p=d.indexOf(i)>-1?d.indexOf(i):0,o=/\[.*\]/g.test(i);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:o?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:i}):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:!a&&(!s||p-1<0),onClick:()=>n(t.nth(d,p-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!a&&(!s||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(le,{label:!1,property:r,onChange:n})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!s||p+1>=d.length),onClick:()=>n(t.nth(d,p+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!a&&(!s||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},Be=({property:r,onChange:n})=>{const s=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:a}=c.useContext(O),l=q(r),i=c.useMemo(()=>t.get(l,"cls",""),[l]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,d=>e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>n(d,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${i===d?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:c.createElement(t.get(ne,d,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},He={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ve=({property:r,onChange:n})=>{const s=q(r),a=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:l}=c.useContext(O),[i,d]=c.useState([]),[p,o]=c.useState({color:"",shade:""}),x=a.split("-"),m=t.get(x,"1",""),y=t.get(x,"2",""),g=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),o({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),o(v=>({...v,color:h,shade:v.shade?v.shade:"500"})))},[d,o]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(m))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[m]);const f=c.useCallback(h=>{o({color:m,shade:h})},[m]);return c.useEffect(()=>{o({color:"",shade:""})},[s]),c.useEffect(()=>{const v=`${t.get(He,r,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;v.match(new RegExp(t.get($.CLASSES_LIST,`${r}.regExp`,"")))&&n(v,r)},[p,n,r]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(z,{disabled:!l,rounded:!0,selected:m,onChange:g,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(z,{rounded:!0,selected:y,disabled:!m||!l,onChange:f,options:i})})]})},ee=(r,n)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&n.includes(s))return{value:"",unit:s};const a=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;s=s.replace(a,"");const l=r.match(a),i=l&&l.length>1,d=!t.isEmpty(s)&&Number.isNaN(Number(s));return i||d?{error:"Invalid value"}:l&&(l[0]==="auto"||l[0]==="none")?{value:l[0],unit:""}:{value:s,unit:l?l[0]:""}},De=r=>{const n=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${n}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${n}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${n}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${n}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const a=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[a,l]=t.map(s.split("/"),i=>parseInt(i,10));return{value:n+(a/l*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${n+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}},Le=r=>{if(t.isEmpty(r))return{value:"",unit:""};const n=r.match(/\[.*\]/g);if(n===null)return Pe(r);const s=t.get(n,"0","").replace(/\[|\]/g,""),a=r.startsWith("-")?"-":"",l=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${a}${l}`,unit:s.replace(l,"")}},Pe=r=>t.isEmpty(r)?{value:"",unit:""}:De(r),ie=c.createContext({setDragData:()=>{}}),$e=({unit:r,currentValue:n,onDrag:s,onDragEnd:a,onDragStart:l,negative:i,cssProperty:d})=>{const{setDragData:p}=c.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:o=>{const x={onDrag:s,onDragEnd:a,dragging:!0,dragStartY:o.pageY,dragStartValue:`${n}`,dragUnit:r,negative:i,cssProperty:d};l(x),p(x)},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,{})})},Me=({onSelect:r,current:n,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(a=>e.jsxRuntimeExports.jsx(w.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===a?"primary":void 0,size:"sm",onClick:l=>{l.stopPropagation(),r(a)},children:a},a))}),Oe=r=>{const[n,s]=c.useState(!1),[a,l]=c.useState(""),{currentClass:i,onChange:d,classPrefix:p,cssProperty:o,units:x,negative:m}=r,[y,g]=c.useState(o!=null&&o.toLowerCase().includes("width")?"%":x[0]),[f,h]=c.useState(!1),[v,H]=c.useState(""),[I,j]=c.useState(!1),[C,A]=c.useState(!1);c.useEffect(()=>{const{value:b,unit:E}=Le(i);if(E===""){l(b),g(o!=null&&o.toLowerCase().includes("width")?"%":x[0]);return}g(E),l(E==="class"||t.isEmpty(b)?"":b)},[i,o,x]);const S=Z.useThrottledCallback(b=>{d(b)},[d],200),V=Z.useThrottledCallback(b=>{d(b,!1)},[d],200),L=c.useCallback((b=!1)=>{const E=ee(`${a}`,x);if(t.get(E,"error",!1)){h(!0);return}const N=t.get(E,"unit")!==""?t.get(E,"unit"):y;if(N==="auto"||N==="none"){S(`${p}${N}`);return}if(t.get(E,"value")==="")return;const M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${N==="-"?"":N}]`;b?V(M):S(M)},[S,V,a,y,p,x]),_=c.useCallback(b=>{const E=ee(`${a}`,x);if(t.get(E,"error",!1)){h(!0);return}if(b==="auto"||b==="none"){S(`${p}${b}`);return}if(t.get(E,"value")==="")return;const N=t.get(E,"unit")!==""?t.get(E,"unit"):b,M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${N==="-"?"":N}]`;S(M)},[S,a,p,x]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:y==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:i}),e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.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(w.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${I?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(y)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:y==="class",onKeyPress:b=>{b.key==="Enter"&&L()},onKeyDown:b=>{if(b.keyCode!==38&&b.keyCode!==40)return;b.preventDefault(),A(!0);const E=t.parseInt(b.target.value);let N=t.isNaN(E)?0:E;b.keyCode===38&&(N+=1),b.keyCode===40&&(N-=1);const D=`${N}`,ue=`${D.startsWith("-")?"-":""}${p}[${D.replace("-","")}${y==="-"?"":y}]`;V(ue)},onKeyUp:b=>{C&&(b.preventDefault(),A(!1))},onBlur:()=>L(),onChange:b=>{h(!1),l(b.target.value)},onClick:b=>{var E;(E=b==null?void 0:b.target)==null||E.select(),s(!1)},value:I?v:a,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",f?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(w.Tooltip,{open:n,delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!n),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${x.length===1?"px-2 font-semibold":""}`,children:y}),x.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(w.TooltipPortal,{children:e.jsxRuntimeExports.jsx(w.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Me,{units:x,current:y,onSelect:b=>{s(!1),g(b),_(b)}})})})]})]}),["none","auto"].indexOf(y)!==-1||I?null:e.jsxRuntimeExports.jsx($e,{onDragStart:()=>j(!0),onDragEnd:b=>{if(H(()=>""),j(!1),t.isEmpty(b))return;const E=`${b}`,D=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;S(D)},onDrag:b=>{if(t.isEmpty(b))return;H(b);const E=`${b}`,D=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;V(D)},currentValue:a,unit:y,negative:m,cssProperty:o})]})})})},q=r=>{const n=R.useSelectedBlockCurrentClasses();return t.findLast(n,{property:r})},qe=(r,n)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[n]},_e={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},te={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},We=r=>`${r.toUpperCase()} ${te[r]?`(${te[r]} & up)`:""}`,G=r=>{const{type:n="icons",label:s,property:a,onEmitChange:l=()=>{},units:i,negative:d=!1}=r,[p]=R.useDarkMode(),[o]=R.useStylingState(),[,x]=R.useCanvasWidth(),m=q(a),y=R.useAddClassesToBlocks(),g=R.useRemoveClassesFromBlocks(),[f]=R.useSelectedBlockIds(),h=c.useMemo(()=>t.get(m,"fullCls",""),[m]),v=c.useCallback((S,V=!0)=>{const L={dark:p,mq:x,mod:o,cls:S,property:a,fullCls:""};(p||o!=="")&&(L.mq="xs");const _=$.generateFullClsName(L);y(f,[_],V)},[f,p,x,o,a,y]),H=c.useCallback(()=>{g(f,[h])},[f,h,g]),I=c.useMemo(()=>qe(m,x),[m,x]);c.useEffect(()=>{l(I,m)},[I,l,m]);const[,,j]=R.useCanvasWidth(),C=c.useCallback(S=>{j({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[S])},[j]),A=t.get(m,"dark",null)===p&&t.get(m,"mod",null)===o&&t.get(m,"mq",null)===x;return e.jsxRuntimeExports.jsx(Ie,{canChange:I,canReset:m&&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] ${m&&!A?"text-foreground":""}`,children:s})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[n==="arbitrary"?e.jsxRuntimeExports.jsx(Oe,{currentClass:t.get(m,"cls",""),classPrefix:t.get(_e,a,""),units:i||[],onChange:v,negative:d,cssProperty:a}):null,n==="icons"&&e.jsxRuntimeExports.jsx(Be,{property:a,onChange:v}),n==="range"&&e.jsxRuntimeExports.jsx(Ae,{property:a,onChange:v}),n==="color"&&e.jsxRuntimeExports.jsx(Ve,{property:a,onChange:v}),n==="dropdown"&&e.jsxRuntimeExports.jsx(le,{label:s,property:a,onChange:v})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>H(),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"})}):I&&m?e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.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(w.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at  ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold ",children:[We(t.get(m,"mq")),p&&!m.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>C(t.get(m,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(m,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Fe=["px","%","em","rem","ch","vh","vw"],ae=({label:r,options:n,borderB:s=!1,borderT:a=!1,type:l="arbitrary",units:i=Fe,negative:d=!1})=>{const[p,o]=c.useState(n[0].key),x=R.useSelectedBlockCurrentClasses(),m=c.useCallback(y=>t.map(x,"property").includes(y),[x]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${a?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:r}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:c.Children.toArray(n.map(({label:y,key:g})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>o(g),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${g===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[c.createElement("div",{className:m(g)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),c.createElement(t.get(ne,g,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:t.startCase(t.toLower(y))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(G,{type:l,units:[...i],label:"",property:p,negative:d})})]})},Ye=({heading:r,items:n})=>{const s=R.useSelectedBlockCurrentClasses(),a=c.useMemo(()=>{const l=p=>t.flatten(p.map(o=>o.styleType==="multiple"?t.map(o.options,"key"):o.property)),i=t.flatten(n.map(p=>p.styleType==="accordion"?l(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(s,"property");return t.intersection(i,d).length>0},[s,n]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[r,a?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${a?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(l=>l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...l},l.label):e.jsxRuntimeExports.jsx(G,{...l},l.label))})]})},Xe=c.createContext({}),X=({section:r})=>{const n=R.useSelectedBlockCurrentClasses(),s=c.useCallback((i=[])=>{const d={};for(let o=0;o<n.length;o++)d[n[o].property]=n[o].cls;let p=!0;for(const o in i)if(!t.has(d,o)||d[o]!==i[o]){p=!1;break}return p},[n]),a=c.useMemo(()=>{if(n.length>0&&r.heading==="Classes")return!0;const i=o=>t.flatten(o.map(x=>x.styleType==="multiple"?t.flatten(t.map(x.options,"key")):x.property)),d=t.flatten(r.items.map(o=>o.styleType==="accordion"?i(o.items):o.styleType==="multiple"?t.flatten(t.map(o.options,"key")):o.property)),p=t.map(n,"property");return t.intersection(d,p).length>0},[n,r.heading,r.items]),l=c.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Xe.Provider,{value:l,children:e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:r.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 ${a?"bg-blue-500":"bg-gray-300"}`}),r.heading]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(i=>t.has(i,"component")?c.createElement(i.component,{key:i.label}):t.has(i,"styleType")?i.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...i},i.label):i.styleType==="accordion"&&s(i==null?void 0:i.conditions)?e.jsxRuntimeExports.jsx(Ye,{...i},i.label):null:e.jsxRuntimeExports.jsx(G,{...i},i.label)))})]})})},Ze=({item:r,index:n,canDelete:s,onChange:a,onRemove:l})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${s?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:i=>a(i,n),value:r.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:i=>t.isEmpty(r.key)?{}:a(i,n),value:r.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:l,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),ze=({section:r})=>{var g;const{setSyncState:n}=R.useSavePage(),s=R.useSelectedBlock(),[a,l]=c.useState([]),[i]=R.useSelectedStylingBlocks(),d=R.useUpdateBlocksPropsRealtime(),p=`${t.get(i,"0.prop")}_attrs`;F.useEffect(()=>{const f=t.map(t.get(s,p),(h,v)=>({key:v,value:h}));t.isEmpty(f)?l([]):l(f)},[t.get(s,p)]);const o=()=>l([...a,{key:"",value:""}]),x=f=>{const h=t.filter(a,(v,H)=>f!==H);y(h)},m=(f,h)=>{const v=[...a];v[h][f.target.name]=f.target.value,y(v)},y=F.useCallback((f=[])=>{const h={};t.forEach(f,v=>{t.isEmpty(v.key)||t.set(h,v.key,v.value)}),d([t.get(s,"_id")],{[p]:h}),n("UNSAVED")},[s,n,d,p]);return e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:r.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(s,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(U.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(a)&&t.isEmpty((g=t.last(a))==null?void 0:g.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 f;!t.isEmpty(a)&&t.isEmpty((f=t.last(a))==null?void 0:f.key)||o()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(a)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),F.Children.toArray(t.map(a,(f,h)=>{const v=a.length>0&&h<a.length-1;return e.jsxRuntimeExports.jsx(Ze,{item:f,index:h,canDelete:v,onChange:m,onRemove:()=>x(h)})}))]})]})})]})};function Ue(){const[r,n]=R.useStylingState(),{flexChild:s,gridChild:a}=R.useSelectedBlocksDisplayChild(),[,l]=xe.useAtom(R.advanceStylingOpenAtom),{t:i}=se.useTranslation(),[d]=R.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:i("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:()=>l(!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(U.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(k.Select,{defaultValue:r,onValueChange:p=>n(p),children:[e.jsxRuntimeExports.jsx(k.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(k.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(k.SelectContent,{children:[e.jsxRuntimeExports.jsx(k.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(ye.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:[s&&e.jsxRuntimeExports.jsx(X,{section:Se}),a?e.jsxRuntimeExports.jsx(X,{section:Ne}):null,Te.map(p=>e.jsxRuntimeExports.jsx(X,{section:p},p.heading)),e.jsxRuntimeExports.jsx(ze,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const Ge={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ke=()=>{const r=R.useSelectedBlock(),{t:n}=se.useTranslation(),[s,a]=c.useState(""),[l,i]=c.useState({onDrag:o=>o,onDragEnd:o=>o,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=Z.useThrottledCallback(o=>{const x=!t.get(l,"negative",!1),m=t.get(l,"cssProperty","");let y=parseFloat(l.dragStartValue);y=t.isNaN(y)?0:y;let g=Ge[l.dragUnit];(t.startsWith(m,"scale")||m==="opacity")&&(g=10);let h=(l.dragStartY-o.pageY)/g+y;x&&h<0&&(h=0),m==="opacity"&&h>1&&(h=1),l.onDrag(`${h}`),a(`${h}`)},[l],50),p=c.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${s}`),100),i({onDrag:o=>o,onDragEnd:o=>o,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,s,i]);return t.isNull(r)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:i},children:[l.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(P.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(P.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(P.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(P.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(P.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ce,{})}),e.jsxRuntimeExports.jsx(P.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ue,{})})]})]})};exports.default=Ke;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),S=require("@radix-ui/react-icons"),t=require("react"),C=require("jotai"),n=require("lodash"),l=require("./useBuilderProp-5e57d0c8.cjs"),j=require("./tabs-860e37aa.cjs"),y=require("./index-6f5cce76.cjs");require("react-i18next");const T=require("./utils-3c452dd0.cjs"),N=require("lucide-react"),D=require("@chaibuilder/blocks"),E=require("./dialog-170eaad9.cjs"),g=require("./card-14e1d020.cjs"),p=require("./select-0e32300c.cjs"),A=require("react-json-view");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 z=({provider:r,onClose:h})=>{const[i,c]=t.useState(null);return t.useEffect(()=>{r&&(r.mockFn?r.mockFn:r.dataFn)().then(d=>c(d))},[r]),r?e.jsxRuntimeExports.jsx(E.Dialog,{onOpenChange:o=>o?"":h(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(E.DialogContent,{children:[e.jsxRuntimeExports.jsxs(E.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(E.DialogTitle,{children:["Data Provider: ",r.name]}),e.jsxRuntimeExports.jsx(E.DialogDescription,{children:r.description})]}),e.jsxRuntimeExports.jsx(A,{name:r.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:i})]})}):null},B=()=>{const r=t.useMemo(()=>D.getChaiDataProviders(),[]),[h,i]=y.usePageDataProviders(),[,c]=C.useAtom(y.pageSyncStateAtom),[o,d]=t.useState(n.filter(r,s=>n.map(h,"providerKey").includes(s.providerKey))),[x,R]=t.useState(""),[f,u]=t.useState(null),b=n.filter(r.map(s=>n.map(o,"providerKey").includes(s.providerKey)?null:{value:s.providerKey,label:s.name}),s=>!n.isNull(s)),a=()=>{const s=n.find(r,{providerKey:x});d(m=>[...m,s]),i(m=>[...m,{providerKey:s.providerKey,args:{}}]),R(""),c("UNSAVED")},v=s=>{d(m=>n.filter(m,q=>q.providerKey!==s.providerKey)),i(m=>n.filter(m,q=>q.providerKey!==s.providerKey)),c("UNSAVED")},k=s=>u(s);return n.isEmpty(r)?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.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsxs(p.Select,{value:x,onValueChange:s=>R(s),children:[e.jsxRuntimeExports.jsx(p.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(p.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(p.SelectContent,{children:[e.jsxRuntimeExports.jsx(p.SelectItem,{value:"",children:"Choose"}),b.map(s=>e.jsxRuntimeExports.jsx(p.SelectItem,{value:s.value,children:s.label},s.value))]})]}),e.jsxRuntimeExports.jsx(l.Button,{onClick:a,disabled:n.isEmpty(x),variant:"destructive",children:"+"})]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:o.length?"block":"hidden",children:[e.jsxRuntimeExports.jsx("hr",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Page data providers:"}),o.map(s=>e.jsxRuntimeExports.jsx(g.Card,{className:"mt-2 rounded-md",children:e.jsxRuntimeExports.jsxs(g.CardHeader,{className:"p-2",children:[e.jsxRuntimeExports.jsx(g.CardTitle,{children:s.name}),e.jsxRuntimeExports.jsx(g.CardDescription,{children:s.description}),e.jsxRuntimeExports.jsx("button",{onClick:()=>k(s),className:"text-left text-xs text-blue-500",children:"view data"}),e.jsxRuntimeExports.jsx("button",{onClick:()=>v(s),className:"text-left text-xs text-red-500",children:"remove"})]})})),e.jsxRuntimeExports.jsx(z,{onClose:()=>u(null),provider:f})]})]})},P=t.lazy(()=>Promise.resolve().then(()=>require("./Layers-94aeb9f0.cjs"))),K=t.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-e659a7bf.cjs"))),I=t.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-0db5c72f.cjs")));let w=null;const L=()=>{const r=l.useBuilderProp("sideBarComponents.top",[]),h=l.useBuilderProp("sideBarComponents.bottom",[]),[i,c]=C.useAtom(y.activePanelAtom),[o,d]=t.useState(i),[x,R]=t.useState(null),f={layers:P,"branding-options":K,images:I};n.each(r,({name:a,panel:v})=>{f[a]=v});const u=a=>{clearTimeout(w),b(!1),i!=="layers"&&a==="layers"?w=setTimeout(()=>d("layers"),500):d(a),c(a)},[,b]=C.useAtom(y.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(l.Button,{onClick:()=>{b(!0),c("layers")},size:"sm",variant:i==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(S.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(l.Button,{onClick:()=>u("layers"),size:"sm",variant:i==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(N.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(l.Button,{onClick:()=>u("branding-options"),size:"sm",variant:i==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(S.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),t.Children.toArray(r.map(({name:a,icon:v})=>e.jsxRuntimeExports.jsx(t.Suspense,{fallback:e.jsxRuntimeExports.jsx(l.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(l.Button,{onClick:()=>u(a),size:"sm",className:"w-10",variant:i===a?"default":"outline",children:e.jsxRuntimeExports.jsx(v,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-2",children:t.Children.toArray(h.map(a=>e.jsxRuntimeExports.jsx(t.Suspense,{fallback:e.jsxRuntimeExports.jsx(l.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(a,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{u("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(i==="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 ${i!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(t.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:T.cn("relative h-full max-h-[93%] bg-background p-1",i==="layers"?"":"z-[100]"),onMouseEnter:()=>{x&&clearTimeout(x)},onMouseLeave:()=>{const a=setTimeout(()=>{x&&(u("layers"),clearTimeout(x))},1e3);R(a)},children:t.createElement(n.get(f,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(t.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(j.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(j.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(j.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(N.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(j.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(N.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(j.TabsContent,{value:"layers",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:t.createElement(P)}),e.jsxRuntimeExports.jsx(j.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(B,{})})]})})})]})};exports.default=L;
@@ -1,246 +0,0 @@
1
- import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import { PlusIcon as L, Half2Icon as V } from "@radix-ui/react-icons";
3
- import v, { useMemo as I, useState as m, useEffect as _, lazy as C, Suspense as b } from "react";
4
- import { useAtom as N } from "jotai";
5
- import { filter as g, map as w, isNull as H, isEmpty as k, find as M, each as O, get as F } from "lodash";
6
- import { B as u, u as P, S as D } from "./useBuilderProp-81a14920.js";
7
- import { T as R, a as J, b as S, c as T } from "./tabs-85caa1e8.js";
8
- import { u as U, p as Y, a as $, b as q } from "./index-c49887fe.js";
9
- import "react-i18next";
10
- import { c as G } from "./utils-ac68b2c8.js";
11
- import { ListTreeIcon as K, DatabaseIcon as Q } from "lucide-react";
12
- import { getChaiDataProviders as W } from "@chaibuilder/blocks";
13
- import { D as X, a as Z, c as ee, e as se, f as ae } from "./dialog-3d4e82ed.js";
14
- import { C as re, a as le, c as te, d as ie } from "./card-f8f4f985.js";
15
- import { S as oe, c as ne, b as ce, d as de, f as A } from "./select-7fddd7c3.js";
16
- import me from "react-json-view";
17
- import "@radix-ui/react-slot";
18
- import "class-variance-authority";
19
- import "@radix-ui/react-tooltip";
20
- import "@radix-ui/react-toast";
21
- import "@radix-ui/react-tabs";
22
- import "./MODIFIERS-2f19c314.js";
23
- import "clsx";
24
- import "@radix-ui/react-scroll-area";
25
- import "react-dom";
26
- import "@floating-ui/react-dom";
27
- import "i18next";
28
- import "flagged";
29
- import "react-dnd";
30
- import "@minoru/react-dnd-treeview";
31
- import "react-hotkeys-hook";
32
- import "flat-to-nested";
33
- import "./html-to-json-45e0e3b5.js";
34
- import "himalaya";
35
- import "redux-undo";
36
- import "@react-hookz/web";
37
- import "sonner";
38
- import "tailwind-merge";
39
- import "@radix-ui/react-dialog";
40
- import "@radix-ui/react-select";
41
- const xe = ({ provider: a, onClose: x }) => {
42
- const [r, n] = m(null);
43
- return _(() => {
44
- a && (a.mockFn ? a.mockFn : a.dataFn)().then((c) => n(c));
45
- }, [a]), a ? /* @__PURE__ */ e.jsx(X, { onOpenChange: (t) => t ? "" : x(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(Z, { children: [
46
- /* @__PURE__ */ e.jsxs(ee, { children: [
47
- /* @__PURE__ */ e.jsxs(se, { children: [
48
- "Data Provider: ",
49
- a.name
50
- ] }),
51
- /* @__PURE__ */ e.jsx(ae, { children: a.description })
52
- ] }),
53
- /* @__PURE__ */ e.jsx(
54
- me,
55
- {
56
- name: a.providerKey,
57
- enableClipboard: !1,
58
- displayObjectSize: !1,
59
- displayDataTypes: !1,
60
- src: r
61
- }
62
- )
63
- ] }) }) : null;
64
- }, pe = () => {
65
- const a = I(() => W(), []), [x, r] = U(), [, n] = N(Y), [t, c] = m(
66
- g(a, (s) => w(x, "providerKey").includes(s.providerKey))
67
- ), [i, h] = m(""), [f, o] = m(null), j = g(
68
- a.map((s) => w(t, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
69
- (s) => !H(s)
70
- ), l = () => {
71
- const s = M(a, { providerKey: i });
72
- c((d) => [...d, s]), r((d) => [...d, { providerKey: s.providerKey, args: {} }]), h(""), n("UNSAVED");
73
- }, p = (s) => {
74
- c((d) => g(d, (y) => y.providerKey !== s.providerKey)), r((d) => g(d, (y) => y.providerKey !== s.providerKey)), n("UNSAVED");
75
- }, E = (s) => o(s);
76
- return k(a) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "text-gray-500 mb-1.5 text-xs p-4", children: [
77
- "You have no data providers registered. Please add a data provider to your project. ",
78
- /* @__PURE__ */ e.jsx("br", {}),
79
- /* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
80
- ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
81
- /* @__PURE__ */ e.jsx("br", {}),
82
- /* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 mb-1.5 text-xs", children: "Add data providers:" }) }),
83
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-1", children: [
84
- /* @__PURE__ */ e.jsxs(oe, { value: i, onValueChange: (s) => h(s), children: [
85
- /* @__PURE__ */ e.jsx(ne, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: "Select a provider" }) }),
86
- /* @__PURE__ */ e.jsxs(de, { children: [
87
- /* @__PURE__ */ e.jsx(A, { value: "", children: "Choose" }),
88
- j.map((s) => /* @__PURE__ */ e.jsx(A, { value: s.value, children: s.label }, s.value))
89
- ] })
90
- ] }),
91
- /* @__PURE__ */ e.jsx(u, { onClick: l, disabled: k(i), variant: "destructive", children: "+" })
92
- ] }),
93
- /* @__PURE__ */ e.jsx("br", {}),
94
- /* @__PURE__ */ e.jsxs("div", { className: t.length ? "block" : "hidden", children: [
95
- /* @__PURE__ */ e.jsx("hr", {}),
96
- /* @__PURE__ */ e.jsx("br", {}),
97
- /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 mb-1.5 text-xs", children: "Page data providers:" }),
98
- t.map((s) => /* @__PURE__ */ e.jsx(re, { className: "mt-2 rounded-md", children: /* @__PURE__ */ e.jsxs(le, { className: "p-2", children: [
99
- /* @__PURE__ */ e.jsx(te, { children: s.name }),
100
- /* @__PURE__ */ e.jsx(ie, { children: s.description }),
101
- /* @__PURE__ */ e.jsx("button", { onClick: () => E(s), className: "text-left text-xs text-blue-500", children: "view data" }),
102
- /* @__PURE__ */ e.jsx("button", { onClick: () => p(s), className: "text-left text-xs text-red-500", children: "remove" })
103
- ] }) })),
104
- /* @__PURE__ */ e.jsx(xe, { onClose: () => o(null), provider: f })
105
- ] })
106
- ] });
107
- }, z = C(() => import("./Layers-c08aa961.js")), ue = C(() => import("./BrandingOptions-c01e08fc.js")), he = C(() => import("./ImagesPanel-38c44785.js"));
108
- let B = null;
109
- const as = () => {
110
- const a = P("sideBarComponents.top", []), x = P("sideBarComponents.bottom", []), [r, n] = N($), [t, c] = m(r), [i, h] = m(null), f = {
111
- layers: z,
112
- "branding-options": ue,
113
- images: he
114
- };
115
- O(a, ({ name: l, panel: p }) => {
116
- f[l] = p;
117
- });
118
- const o = (l) => {
119
- clearTimeout(B), j(!1), r !== "layers" && l === "layers" ? B = setTimeout(() => c("layers"), 500) : c(l), n(l);
120
- }, [, j] = N(q);
121
- return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
122
- /* @__PURE__ */ e.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: [
123
- /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: [
124
- /* @__PURE__ */ e.jsx(
125
- u,
126
- {
127
- onClick: () => {
128
- j(!0), n("layers");
129
- },
130
- size: "sm",
131
- variant: r === "add-blocks" ? "default" : "outline",
132
- children: /* @__PURE__ */ e.jsx(L, { className: "text-xl" })
133
- }
134
- ),
135
- /* @__PURE__ */ e.jsx(
136
- u,
137
- {
138
- onClick: () => o("layers"),
139
- size: "sm",
140
- variant: r === "layers" ? "default" : "outline",
141
- children: /* @__PURE__ */ e.jsx(K, { className: "w-4" })
142
- }
143
- ),
144
- /* @__PURE__ */ e.jsx(
145
- u,
146
- {
147
- onClick: () => o("branding-options"),
148
- size: "sm",
149
- variant: r === "branding-options" ? "default" : "outline",
150
- children: /* @__PURE__ */ e.jsx(V, { className: "w-4 max-w-[40px] text-xs" })
151
- }
152
- ),
153
- v.Children.toArray(
154
- a.map(({ name: l, icon: p }) => /* @__PURE__ */ e.jsx(b, { fallback: /* @__PURE__ */ e.jsx(D, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
155
- u,
156
- {
157
- onClick: () => o(l),
158
- size: "sm",
159
- className: "w-10",
160
- variant: r === l ? "default" : "outline",
161
- children: /* @__PURE__ */ e.jsx(p, {})
162
- }
163
- ) }))
164
- )
165
- ] }),
166
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center space-y-2", children: v.Children.toArray(
167
- x.map((l) => /* @__PURE__ */ e.jsx(b, { fallback: /* @__PURE__ */ e.jsx(D, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(l, {}) }))
168
- ) })
169
- ] }),
170
- /* @__PURE__ */ e.jsx(
171
- "div",
172
- {
173
- onClick: () => {
174
- o("layers");
175
- },
176
- className: "absolute inset-0 right-0 z-50 w-screen bg-black/20" + (r === "layers" ? " hidden" : "")
177
- }
178
- ),
179
- /* @__PURE__ */ e.jsx(
180
- "div",
181
- {
182
- 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"}`,
183
- children: /* @__PURE__ */ e.jsx(
184
- b,
185
- {
186
- fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
187
- /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
188
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
189
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
190
- ] }),
191
- children: /* @__PURE__ */ e.jsx(
192
- "div",
193
- {
194
- className: G("relative h-full max-h-[93%] bg-background p-1", r === "layers" ? "" : "z-[100]"),
195
- onMouseEnter: () => {
196
- i && clearTimeout(i);
197
- },
198
- onMouseLeave: () => {
199
- const l = setTimeout(() => {
200
- i && (o("layers"), clearTimeout(i));
201
- }, 1e3);
202
- h(l);
203
- },
204
- children: v.createElement(F(f, t, () => /* @__PURE__ */ e.jsx("div", {})))
205
- }
206
- )
207
- }
208
- )
209
- }
210
- ),
211
- /* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
212
- b,
213
- {
214
- fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
215
- /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
216
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
217
- /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
218
- ] }),
219
- children: /* @__PURE__ */ e.jsxs(R, { defaultValue: "layers", className: "flex h-full w-full flex-col py-1", children: [
220
- /* @__PURE__ */ e.jsxs(J, { className: "mx-1 h-10 grid grid-cols-2", children: [
221
- /* @__PURE__ */ e.jsxs(S, { value: "layers", children: [
222
- /* @__PURE__ */ e.jsx(K, { className: "h-3 mr-2" }),
223
- " Layers"
224
- ] }),
225
- /* @__PURE__ */ e.jsxs(S, { value: "data-provider", children: [
226
- /* @__PURE__ */ e.jsx(Q, { className: "w-3 mr-2" }),
227
- "Data"
228
- ] })
229
- ] }),
230
- /* @__PURE__ */ e.jsx(
231
- T,
232
- {
233
- value: "layers",
234
- className: "no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",
235
- children: v.createElement(z)
236
- }
237
- ),
238
- /* @__PURE__ */ e.jsx(T, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(pe, {}) })
239
- ] })
240
- }
241
- ) })
242
- ] });
243
- };
244
- export {
245
- as as default
246
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("./jsx-runtime-5c3ac4f7.cjs"),m=require("react"),s=require("./utils-3c452dd0.cjs");function u(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const o=u(m),d=o.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("div",{ref:t,className:s.cn("rounded-xl border bg-card text-card-foreground shadow",e),...r}));d.displayName="Card";const c=o.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("div",{ref:t,className:s.cn("flex flex-col space-y-1.5 p-6",e),...r}));c.displayName="CardHeader";const i=o.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("h3",{ref:t,className:s.cn("font-semibold leading-none tracking-tight",e),...r}));i.displayName="CardTitle";const l=o.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("p",{ref:t,className:s.cn("text-sm text-muted-foreground",e),...r}));l.displayName="CardDescription";const p=o.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("div",{ref:t,className:s.cn("p-6 pt-0",e),...r}));p.displayName="CardContent";const f=o.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("div",{ref:t,className:s.cn(" flex items-center p-6 pt-0",e),...r}));f.displayName="CardFooter";exports.Card=d;exports.CardContent=p;exports.CardDescription=l;exports.CardFooter=f;exports.CardHeader=c;exports.CardTitle=i;
@@ -1,33 +0,0 @@
1
- import { j as s } from "./jsx-runtime-944c88e2.js";
2
- import * as d from "react";
3
- import { c as o } from "./utils-ac68b2c8.js";
4
- const t = d.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ s.jsx("div", { ref: r, className: o("rounded-xl border bg-card text-card-foreground shadow", a), ...e }));
5
- t.displayName = "Card";
6
- const i = d.forwardRef(
7
- ({ className: a, ...e }, r) => /* @__PURE__ */ s.jsx("div", { ref: r, className: o("flex flex-col space-y-1.5 p-6", a), ...e })
8
- );
9
- i.displayName = "CardHeader";
10
- const c = d.forwardRef(
11
- ({ className: a, ...e }, r) => /* @__PURE__ */ s.jsx("h3", { ref: r, className: o("font-semibold leading-none tracking-tight", a), ...e })
12
- );
13
- c.displayName = "CardTitle";
14
- const m = d.forwardRef(
15
- ({ className: a, ...e }, r) => /* @__PURE__ */ s.jsx("p", { ref: r, className: o("text-sm text-muted-foreground", a), ...e })
16
- );
17
- m.displayName = "CardDescription";
18
- const n = d.forwardRef(
19
- ({ className: a, ...e }, r) => /* @__PURE__ */ s.jsx("div", { ref: r, className: o("p-6 pt-0", a), ...e })
20
- );
21
- n.displayName = "CardContent";
22
- const f = d.forwardRef(
23
- ({ className: a, ...e }, r) => /* @__PURE__ */ s.jsx("div", { ref: r, className: o(" flex items-center p-6 pt-0", a), ...e })
24
- );
25
- f.displayName = "CardFooter";
26
- export {
27
- t as C,
28
- i as a,
29
- f as b,
30
- c,
31
- m as d,
32
- n as e
33
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("./jsx-runtime-5c3ac4f7.cjs"),u=require("react"),f=require("class-variance-authority"),i=require("./utils-3c452dd0.cjs");function x(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=x(u),p=f.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),o=n.forwardRef(({className:e,variant:r,...t},s)=>a.jsxRuntimeExports.jsx("div",{ref:s,role:"alert",className:i.cn(p({variant:r}),e),...t}));o.displayName="Alert";const l=n.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("h5",{ref:t,className:i.cn("mb-1 font-medium leading-none tracking-tight",e),...r}));l.displayName="AlertTitle";const c=n.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("div",{ref:t,className:i.cn("text-sm [&_p]:leading-relaxed",e),...r}));c.displayName="AlertDescription";const d=n.forwardRef(({className:e,...r},t)=>a.jsxRuntimeExports.jsx("textarea",{className:i.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:t,...r}));d.displayName="Textarea";exports.Alert=o;exports.AlertDescription=c;exports.AlertTitle=l;exports.Textarea=d;
@@ -1,45 +0,0 @@
1
- import { j as a } from "./jsx-runtime-944c88e2.js";
2
- import * as s from "react";
3
- import { cva as d } from "class-variance-authority";
4
- import { c as o } from "./utils-ac68b2c8.js";
5
- const l = d(
6
- "relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
7
- {
8
- variants: {
9
- variant: {
10
- default: "bg-background text-foreground",
11
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
12
- }
13
- },
14
- defaultVariants: {
15
- variant: "default"
16
- }
17
- }
18
- ), n = s.forwardRef(({ className: e, variant: t, ...r }, i) => /* @__PURE__ */ a.jsx("div", { ref: i, role: "alert", className: o(l({ variant: t }), e), ...r }));
19
- n.displayName = "Alert";
20
- const c = s.forwardRef(
21
- ({ className: e, ...t }, r) => /* @__PURE__ */ a.jsx("h5", { ref: r, className: o("mb-1 font-medium leading-none tracking-tight", e), ...t })
22
- );
23
- c.displayName = "AlertTitle";
24
- const m = s.forwardRef(
25
- ({ className: e, ...t }, r) => /* @__PURE__ */ a.jsx("div", { ref: r, className: o("text-sm [&_p]:leading-relaxed", e), ...t })
26
- );
27
- m.displayName = "AlertDescription";
28
- const f = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ a.jsx(
29
- "textarea",
30
- {
31
- className: o(
32
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
33
- e
34
- ),
35
- ref: r,
36
- ...t
37
- }
38
- ));
39
- f.displayName = "Textarea";
40
- export {
41
- n as A,
42
- f as T,
43
- c as a,
44
- m as b
45
- };