@chaibuilder/sdk 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-bbcb5ca6.js → AddBlocks-4f2c5dc4.js} +1 -1
- package/dist/{AddBlocks-820d5f44.cjs → AddBlocks-5ca17264.cjs} +1 -1
- package/dist/{BrandingOptions-75df38ad.cjs → BrandingOptions-0773c5fd.cjs} +1 -1
- package/dist/{BrandingOptions-18750c84.js → BrandingOptions-2044d3cb.js} +1 -1
- package/dist/{CanvasArea-d46040a6.js → CanvasArea-575f601e.js} +2 -2
- package/dist/{CanvasArea-50585c2d.cjs → CanvasArea-71355900.cjs} +2 -2
- package/dist/{CurrentPage-090cccbd.cjs → CurrentPage-09c74e35.cjs} +1 -1
- package/dist/{CurrentPage-48c7ccf6.js → CurrentPage-e6f23078.js} +1 -1
- package/dist/{Layers-0f94a98b.cjs → Layers-975fed10.cjs} +1 -1
- package/dist/{Layers-a8c07158.js → Layers-a7dc3c09.js} +2 -2
- package/dist/{MarkAsGlobalBlock-f09bd13a.js → MarkAsGlobalBlock-39df9332.js} +1 -1
- package/dist/{MarkAsGlobalBlock-9c2699f7.cjs → MarkAsGlobalBlock-b988f89e.cjs} +1 -1
- package/dist/{PagesPanel-9e6a3bf4.js → PagesPanel-9de2d25b.js} +2 -2
- package/dist/{PagesPanel-0e56e377.cjs → PagesPanel-ba746cd1.cjs} +1 -1
- package/dist/{ProjectPanel-d4e185f2.js → ProjectPanel-862243ef.js} +2 -2
- package/dist/{ProjectPanel-78bd2dc0.cjs → ProjectPanel-eef9f5d4.cjs} +1 -1
- package/dist/{Settings-0cdedad3.cjs → Settings-8796249e.cjs} +1 -1
- package/dist/{Settings-10d559de.js → Settings-8b2a5a12.js} +1 -1
- package/dist/{SidePanels-d327f06f.cjs → SidePanels-41116ddd.cjs} +1 -1
- package/dist/{SidePanels-e25a09d1.js → SidePanels-c1abd140.js} +2 -2
- package/dist/{Topbar-2b6bc301.js → Topbar-3f8ee9ec.js} +1 -1
- package/dist/{Topbar-98e1c63c.cjs → Topbar-f622beef.cjs} +1 -1
- package/dist/{add-page-modal-578e0d51.js → add-page-modal-3be04ab6.js} +1 -1
- package/dist/{add-page-modal-0fc70761.cjs → add-page-modal-7c2eea7f.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-d7f4c4b1.cjs → delete-page-modal-13bf57f1.cjs} +1 -1
- package/dist/{delete-page-modal-f55919d6.js → delete-page-modal-e6d85612.js} +1 -1
- package/dist/{index-67c27660.js → index-91c0470a.js} +4 -4
- package/dist/{index-f63910c9.cjs → index-a954d733.cjs} +2 -2
- package/dist/{page-viewer-bd76f56d.js → page-viewer-18a13862.js} +2 -2
- package/dist/{page-viewer-57db008a.cjs → page-viewer-e0508ce9.cjs} +1 -1
- package/dist/{project-general-setting-830532c0.js → project-general-setting-4c7172c1.js} +1 -1
- package/dist/{project-general-setting-f6ee7aa1.cjs → project-general-setting-66ba78e9.cjs} +1 -1
- package/dist/{single-page-detail-c536bca9.cjs → single-page-detail-6872bd4d.cjs} +1 -1
- package/dist/{single-page-detail-3e6e1e58.js → single-page-detail-6ece84b9.js} +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
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-f63910c9.cjs"),Y=require("@chaibuilder/blocks"),re=require("lucide-react"),oe=require("react-autosuggest"),ce=require("./useChaiExternalData-a90e8aac.cjs"),C=require("./useBuilderProp-5e57d0c8.cjs"),I=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"),S=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 o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const F=be(c);function fe(r){const o=[],s={};function i(n,l){t.forEach(l,(d,p)=>{const a=n?`${n}.${p}`:p,m=t.isArray(d)?"list":typeof d;o.push(a),s[a]=m==="string"?"text":m==="object"?"model":m,m==="object"&&!t.isArray(d)&&i(a,d)})}return i("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:s}}const je=({data:r})=>{if(!r)return null;const o=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(o==="object"?JSON.stringify(r):r,{length:40})})},K=({type:r,isDisabled:o=!1,placeholder:s,defaultValue:i="",data:n,onChange:l,dataType:d,appliedBindings:p})=>{const[a,m]=c.useState(!1),[x,y]=c.useState(i),{paths:g,pathsType:f}=fe(n),h=r==="PROP"?Y.getBlockComponent(n==null?void 0:n._type):{};c.useEffect(()=>{t.isEmpty(x)&&l("")},[x]),c.useEffect(()=>y(i),[i]);const j=()=>g.filter(v=>{const k=t.isEmpty(x)||t.includes(t.toLower(v),t.toLower(x));return r==="PATH"?k&&d===t.get(f,v,""):k&&!t.includes(p,v)&&t.get(h,`props.${t.first(t.split(v,"."))}.binding`)}),[B,N]=c.useState(()=>j());c.useEffect(()=>N(()=>j()),[d]);const w=r==="PATH"&&t.isEmpty(B)&&a&&!t.isEmpty(d),V={autoComplete:"off",autoCorrect:"on",autoCapitalize:"off",spellCheck:!1,placeholder:w?"No available options":s,value:x,disabled:o,onFocus:()=>m(r==="PATH"),onBlur:()=>{m(!1),g.includes(x)?l(x):(y(""),l(""))},onChange:(v,{newValue:k})=>y(w?"":k),className:`chai-input w-full ${o?"cursor-not-allowed":""} ${w?"placeholder-red-400":""}`},A=v=>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":v,children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 w-full h-full absolute opacity-0 z-20",children:v}),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(v,"."),(k,D)=>e.jsxRuntimeExports.jsxs("span",{className:"flex items-end",children:[D>0&&e.jsxRuntimeExports.jsx(re.ChevronRight,{size:14,className:"h-full text-gray-400"}),t.startCase(k)]})))}),r==="PATH"&&e.jsxRuntimeExports.jsx(je,{data:t.get(n,v)})]}),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(f,v,""))})]});return e.jsxRuntimeExports.jsx(oe,{suggestions:B,onSuggestionsFetchRequested:()=>N(()=>j()),onSuggestionsClearRequested:()=>N([]),onSuggestionSelected:v=>{if(v.type==="click"){const k=t.get(v.target,"childNodes[0].data","");g.includes(k)&&l(k)}else l(v.target.value)},getSuggestionValue:v=>v,renderSuggestion:A,shouldRenderSuggestions:()=>!0,inputProps:V,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:o,onRemove:s,selectedBlock:i,dataProvider:n,appliedBindings:l})=>{const[d,p]=c.useState("string"),a=(m,x)=>{if(t.isEmpty(m))return"";{const y=t.get(x==="PROP"?i:n,m,"");if(t.isArray(y))return"list";const g=typeof y;return g==="string"?"text":g==="object"?"model":g}};return c.useEffect(()=>p(()=>a(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:m=>{const x=a(m,"PROP");o({target:{name:"key",value:m}}),d!==x&&o({target:{name:"value",value:""}}),p(x)},data:i,dataType:d,appliedBindings:l}),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:m=>{const x=a(m,"PATH");o(d!==x?{target:{name:"value",value:""}}:{target:{name:"value",value:m}})},data:n,dataType:d,appliedBindings:l}),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:o})=>{const s=R.useSelectedBlock(),[i]=ce.useChaiExternalData(),n=Y.getChaiDataProviders(),[l,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(l))return!1;const g=t.last(l);return t.isEmpty(g==null?void 0:g.key)||t.isEmpty(g==null?void 0:g.value)},[l]),a=()=>{d([...l,{key:"",value:""}])},m=g=>{const f=t.filter(l,(h,j)=>g!==j);y([...f])},x=(g,f)=>{const h=[...l];h[f][g.target.name]=g.target.value,y(h)},y=c.useCallback((g=[])=>{if(d(g),t.isEmpty(g)){o({});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)}),o(f)},[s]);return t.isEmpty(n)?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(l,(g,f)=>e.jsxRuntimeExports.jsx(ve,{item:g,onChange:h=>x(h,f),onRemove:()=>m(f),selectedBlock:s,dataProvider:i,appliedBindings:t.map(l,"key")},g.key)),e.jsxRuntimeExports.jsxs(C.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx("button",{onClick:a,disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${t.isEmpty(l)?"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30 ":""} ${p?"cursor-not-allowed bg-gray-200 text-gray-400":t.isEmpty(l)?"":"bg-gray-700/20 text-gray-800 hover:bg-blue-700/30"}`,children:"+ Add Data Binding"})}),p&&e.jsxRuntimeExports.jsx(C.TooltipContent,{sideOffset:-55,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:o,formData:s,onChange:i})=>{const[n]=R.useActiveLanguage(),l={type:"object",properties:{}},d={};return Object.keys(o).forEach(p=>{const a=o[p];if(t.includes(["slot","styles"],a.type))return;const m=t.get(a,"i18n",!1)?`${p}-${n}`:p;l.properties[m]=R.getBlockJSONFromSchemas(a,n),d[m]=R.getBlockJSONFromUISchemas(a,n)}),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:l,formData:s,onChange:i})};function Ce(){const r=R.useSelectedBlock(),{createSnapshot:o}=R.useCanvasHistory(),s=R.useUpdateBlocksPropsRealtime(),i=Y.getBlockComponent(r._type),n={...r},l=()=>o(),d=({formData:x},y)=>{if(y){const g=y.replace("root.","");s([r._id],{[g]:t.get(x,g)})}},p={_name:Y.SingleLineText({title:"Name",default:t.get(r,"_name",r._type)})},a=t.keys(t.get(n,"_bindings",{})),m=c.useMemo(()=>{const x=t.cloneDeep(t.get(i,"props",{}));return t.each(a,y=>{delete x[y]}),x},[i,a]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:l,formData:n,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(I.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(I.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(I.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Ee,{bindingData:t.get(n,"_bindings",{}),onChange:x=>{d({formData:{...n,_bindings:x}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(I.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(I.AccordionContent,{className:"pt-4",children:[t.isEmpty(a)?"":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(a,t.capitalize).join(", ")})," ",a.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:l,formData:n,properties:m})]})]})]}),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 N;const[r]=R.useSelectedStylingBlocks(),o=R.useSelectedBlock(),s=R.useAddClassesToBlocks(),i=R.useRemoveClassesFromBlocks(),[n]=R.useSelectedBlockIds(),[l,d]=c.useState(""),p=(N=t.first(r))==null?void 0:N.prop,a=t.reject((t.get(o,p,"").replace(ge.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),m=()=>{const w=l.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");s(n,w,!0),d("")},[x,y]=c.useState([]),g=({value:w})=>{const V=w.trim().toLowerCase(),A=V.match(/.+:/g);let v=[];if(A&&A.length>0){const[k]=A,D=V.replace(k,"");v=Q.search(D).map(b=>({...b,item:{...b.item,name:k+b.item.name}}))}else v=Q.search(V);y(t.map(v,"item"))},f=()=>{y([])},h=w=>w.name,j=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),B={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:l,onKeyDown:w=>{w.key==="Enter"&&l.trim()!==""&&m()},onChange:(w,{newValue:V})=>d(V),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${x.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:x,onSuggestionsFetchRequested:g,onSuggestionsClearRequested:f,getSuggestionValue:h,renderSuggestion:j,inputProps:B,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(C.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:m,disabled:l.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(a)&&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(a.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>i(n,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const H=["px","%","em","rem","ch","vh","vw"],Se={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:H,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:H},{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:H},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...H,"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:H.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:H.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:H.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:H.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:H.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:H.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:H},{type:"arbitrary",property:"lineHeight",label:"Height",units:H.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:o=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:o,canChange:s},children:r}),le=({label:r,property:o,onChange:s})=>{const i=c.useMemo(()=>t.get($.CLASSES_LIST,`${o}.classes`,[""]),[o]),n=q(o),l=c.useMemo(()=>t.get(n,"cls",""),[n]),{canChange:d}=c.useContext(O),p=/\[.*\]/g.test(l);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:l}),e.jsxRuntimeExports.jsxs(C.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(C.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(C.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(z,{rounded:r,onChange:a=>s(a,o),selected:l,options:i,disabled:!d})})};function z({selected:r,onChange:o,rounded:s=!1,options:i,disabled:n=!1}){const l=r.replace(/.*:/g,"").trim(),{undo:d,redo:p}=R.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!i.length||n,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:a=>o(a.target.value),onKeyDown:a=>{a.ctrlKey&&(a.key==="z"&&d(),a.key==="y"&&p())},value:l,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(i.map(a=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:a,children:a})))]})}const Ae=({property:r,onChange:o})=>{const{canReset:s,canChange:i}=c.useContext(O),n=q(r),l=c.useMemo(()=>t.get(n,"cls",""),[n]),d=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),p=d.indexOf(l)>-1?d.indexOf(l):0,a=/\[.*\]/g.test(l);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:a?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:l}):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:!i&&(!s||p-1<0),onClick:()=>o(t.nth(d,p-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!i&&(!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:o})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!i&&(!s||p+1>=d.length),onClick:()=>o(t.nth(d,p+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!i&&(!s||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},He=({property:r,onChange:o})=>{const s=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:i}=c.useContext(O),n=q(r),l=c.useMemo(()=>t.get(n,"cls",""),[n]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,d=>e.jsxRuntimeExports.jsxs(C.Tooltip,{children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!i,onClick:()=>o(d,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${l===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(C.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},Be={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:o})=>{const s=q(r),i=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:n}=c.useContext(O),[l,d]=c.useState([]),[p,a]=c.useState({color:"",shade:""}),m=i.split("-"),x=t.get(m,"1",""),y=t.get(m,"2",""),g=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),a({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),a(j=>({...j,color:h,shade:j.shade?j.shade:"500"})))},[d,a]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(x))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[x]);const f=c.useCallback(h=>{a({color:x,shade:h})},[x]);return c.useEffect(()=>{a({color:"",shade:""})},[s]),c.useEffect(()=>{const j=`${t.get(Be,r,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;j.match(new RegExp(t.get($.CLASSES_LIST,`${r}.regExp`,"")))&&o(j,r)},[p,o,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:!n,rounded:!0,selected:x,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:!x||!n,onChange:f,options:l})})]})},ee=(r,o)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&o.includes(s))return{value:"",unit:s};const i=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;s=s.replace(i,"");const n=r.match(i),l=n&&n.length>1,d=!t.isEmpty(s)&&Number.isNaN(Number(s));return l||d?{error:"Invalid value"}:n&&(n[0]==="auto"||n[0]==="none")?{value:n[0],unit:""}:{value:s,unit:n?n[0]:""}},De=r=>{const o=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:`${o}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${o}${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:`${o}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${o}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const i=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(i)return{value:i[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[i,n]=t.map(s.split("/"),l=>parseInt(l,10));return{value:o+(i/n*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${o+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}},Le=r=>{if(t.isEmpty(r))return{value:"",unit:""};const o=r.match(/\[.*\]/g);if(o===null)return Pe(r);const s=t.get(o,"0","").replace(/\[|\]/g,""),i=r.startsWith("-")?"-":"",n=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${i}${n}`,unit:s.replace(n,"")}},Pe=r=>t.isEmpty(r)?{value:"",unit:""}:De(r),ie=c.createContext({setDragData:()=>{}}),$e=({unit:r,currentValue:o,onDrag:s,onDragEnd:i,onDragStart:n,negative:l,cssProperty:d})=>{const{setDragData:p}=c.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:a=>{const m={onDrag:s,onDragEnd:i,dragging:!0,dragStartY:a.pageY,dragStartValue:`${o}`,dragUnit:r,negative:l,cssProperty:d};n(m),p(m)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(u.RowSpacingIcon,{})})},Me=({onSelect:r,current:o,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(i=>e.jsxRuntimeExports.jsx(C.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===i?"primary":void 0,size:"sm",onClick:n=>{n.stopPropagation(),r(i)},children:i},i))}),Oe=r=>{const[o,s]=c.useState(!1),[i,n]=c.useState(""),{currentClass:l,onChange:d,classPrefix:p,cssProperty:a,units:m,negative:x}=r,[y,g]=c.useState(a!=null&&a.toLowerCase().includes("width")?"%":m[0]),[f,h]=c.useState(!1),[j,B]=c.useState(""),[N,w]=c.useState(!1),[V,A]=c.useState(!1);c.useEffect(()=>{const{value:b,unit:E}=Le(l);if(E===""){n(b),g(a!=null&&a.toLowerCase().includes("width")?"%":m[0]);return}g(E),n(E==="class"||t.isEmpty(b)?"":b)},[l,a,m]);const v=Z.useThrottledCallback(b=>{d(b)},[d],200),k=Z.useThrottledCallback(b=>{d(b,!1)},[d],200),D=c.useCallback((b=!1)=>{const E=ee(`${i}`,m);if(t.get(E,"error",!1)){h(!0);return}const T=t.get(E,"unit")!==""?t.get(E,"unit"):y;if(T==="auto"||T==="none"){v(`${p}${T}`);return}if(t.get(E,"value")==="")return;const M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${T==="-"?"":T}]`;b?k(M):v(M)},[v,k,i,y,p,m]),_=c.useCallback(b=>{const E=ee(`${i}`,m);if(t.get(E,"error",!1)){h(!0);return}if(b==="auto"||b==="none"){v(`${p}${b}`);return}if(t.get(E,"value")==="")return;const T=t.get(E,"unit")!==""?t.get(E,"unit"):b,M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${T==="-"?"":T}]`;v(M)},[v,i,p,m]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:y==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:l}),e.jsxRuntimeExports.jsxs(C.Tooltip,{children:[e.jsxRuntimeExports.jsx(C.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(C.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${N?"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"&&D()},onKeyDown:b=>{if(b.keyCode!==38&&b.keyCode!==40)return;b.preventDefault(),A(!0);const E=t.parseInt(b.target.value);let T=t.isNaN(E)?0:E;b.keyCode===38&&(T+=1),b.keyCode===40&&(T-=1);const L=`${T}`,ue=`${L.startsWith("-")?"-":""}${p}[${L.replace("-","")}${y==="-"?"":y}]`;k(ue)},onKeyUp:b=>{V&&(b.preventDefault(),A(!1))},onBlur:()=>D(),onChange:b=>{h(!1),n(b.target.value)},onClick:b=>{var E;(E=b==null?void 0:b.target)==null||E.select(),s(!1)},value:N?j:i,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(C.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!o),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${m.length===1?"px-2 font-semibold":""}`,children:y}),m.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(C.TooltipPortal,{children:e.jsxRuntimeExports.jsx(C.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Me,{units:m,current:y,onSelect:b=>{s(!1),g(b),_(b)}})})})]})]}),["none","auto"].indexOf(y)!==-1||N?null:e.jsxRuntimeExports.jsx($e,{onDragStart:()=>w(!0),onDragEnd:b=>{if(B(()=>""),w(!1),t.isEmpty(b))return;const E=`${b}`,L=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;v(L)},onDrag:b=>{if(t.isEmpty(b))return;B(b);const E=`${b}`,L=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;k(L)},currentValue:i,unit:y,negative:x,cssProperty:a})]})})})},q=r=>{const o=R.useSelectedBlockCurrentClasses();return t.findLast(o,{property:r})},qe=(r,o)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[o]},_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:o="icons",label:s,property:i,onEmitChange:n=()=>{},units:l,negative:d=!1}=r,[p]=R.useDarkMode(),[a]=R.useStylingState(),[,m]=R.useCanvasWidth(),x=q(i),y=R.useAddClassesToBlocks(),g=R.useRemoveClassesFromBlocks(),[f]=R.useSelectedBlockIds(),h=c.useMemo(()=>t.get(x,"fullCls",""),[x]),j=c.useCallback((v,k=!0)=>{const D={dark:p,mq:m,mod:a,cls:v,property:i,fullCls:""};(p||a!=="")&&(D.mq="xs");const _=$.generateFullClsName(D);y(f,[_],k)},[f,p,m,a,i,y]),B=c.useCallback(()=>{g(f,[h])},[f,h,g]),N=c.useMemo(()=>qe(x,m),[x,m]);c.useEffect(()=>{n(N,x)},[N,n,x]);const[,,w]=R.useCanvasWidth(),V=c.useCallback(v=>{w({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[v])},[w]),A=t.get(x,"dark",null)===p&&t.get(x,"mod",null)===a&&t.get(x,"mq",null)===m;return e.jsxRuntimeExports.jsx(Ie,{canChange:N,canReset:x&&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] ${x&&!A?"text-foreground":""}`,children:s})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?e.jsxRuntimeExports.jsx(Oe,{currentClass:t.get(x,"cls",""),classPrefix:t.get(_e,i,""),units:l||[],onChange:j,negative:d,cssProperty:i}):null,o==="icons"&&e.jsxRuntimeExports.jsx(He,{property:i,onChange:j}),o==="range"&&e.jsxRuntimeExports.jsx(Ae,{property:i,onChange:j}),o==="color"&&e.jsxRuntimeExports.jsx(Ve,{property:i,onChange:j}),o==="dropdown"&&e.jsxRuntimeExports.jsx(le,{label:s,property:i,onChange:j})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>B(),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"})}):N&&x?e.jsxRuntimeExports.jsxs(C.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(C.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(C.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(x,"mq")),p&&!x.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>V(t.get(x,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(x,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Fe=["px","%","em","rem","ch","vh","vw"],ae=({label:r,options:o,borderB:s=!1,borderT:i=!1,type:n="arbitrary",units:l=Fe,negative:d=!1})=>{const[p,a]=c.useState(o[0].key),m=R.useSelectedBlockCurrentClasses(),x=c.useCallback(y=>t.map(m,"property").includes(y),[m]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${i?"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(o.map(({label:y,key:g})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(C.Tooltip,{children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>a(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:x(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(C.TooltipContent,{children:t.startCase(t.toLower(y))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(G,{type:n,units:[...l],label:"",property:p,negative:d})})]})},Ye=({heading:r,items:o})=>{const s=R.useSelectedBlockCurrentClasses(),i=c.useMemo(()=>{const n=p=>t.flatten(p.map(a=>a.styleType==="multiple"?t.map(a.options,"key"):a.property)),l=t.flatten(o.map(p=>p.styleType==="accordion"?n(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(s,"property");return t.intersection(l,d).length>0},[s,o]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[r,i?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:o.map(n=>n.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...n},n.label):e.jsxRuntimeExports.jsx(G,{...n},n.label))})]})},Xe=c.createContext({}),X=({section:r})=>{const o=R.useSelectedBlockCurrentClasses(),s=c.useCallback((l=[])=>{const d={};for(let a=0;a<o.length;a++)d[o[a].property]=o[a].cls;let p=!0;for(const a in l)if(!t.has(d,a)||d[a]!==l[a]){p=!1;break}return p},[o]),i=c.useMemo(()=>{if(o.length>0&&r.heading==="Classes")return!0;const l=a=>t.flatten(a.map(m=>m.styleType==="multiple"?t.flatten(t.map(m.options,"key")):m.property)),d=t.flatten(r.items.map(a=>a.styleType==="accordion"?l(a.items):a.styleType==="multiple"?t.flatten(t.map(a.options,"key")):a.property)),p=t.map(o,"property");return t.intersection(d,p).length>0},[o,r.heading,r.items]),n=c.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Xe.Provider,{value:n,children:e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(I.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}),r.heading]})}),e.jsxRuntimeExports.jsx(I.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(l=>t.has(l,"component")?c.createElement(l.component,{key:l.label}):t.has(l,"styleType")?l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...l},l.label):l.styleType==="accordion"&&s(l==null?void 0:l.conditions)?e.jsxRuntimeExports.jsx(Ye,{...l},l.label):null:e.jsxRuntimeExports.jsx(G,{...l},l.label)))})]})})},Ze=({item:r,index:o,canDelete:s,onChange:i,onRemove:n})=>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:l=>i(l,o),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:l=>t.isEmpty(r.key)?{}:i(l,o),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:n,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:o}=R.useSavePage(),s=R.useSelectedBlock(),[i,n]=c.useState([]),[l]=R.useSelectedStylingBlocks(),d=R.useUpdateBlocksPropsRealtime(),p=`${t.get(l,"0.prop")}_attrs`;F.useEffect(()=>{const f=t.map(t.get(s,p),(h,j)=>({key:j,value:h}));t.isEmpty(f)?n([]):n(f)},[t.get(s,p)]);const a=()=>n([...i,{key:"",value:""}]),m=f=>{const h=t.filter(i,(j,B)=>f!==B);y(h)},x=(f,h)=>{const j=[...i];j[h][f.target.name]=f.target.value,y(j)},y=F.useCallback((f=[])=>{const h={};t.forEach(f,j=>{t.isEmpty(j.key)||t.set(h,j.key,j.value)}),d([t.get(s,"_id")],{[p]:h}),o("UNSAVED")},[s,o,d,p]);return e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(I.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(I.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(i)&&t.isEmpty((g=t.last(i))==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(i)&&t.isEmpty((f=t.last(i))==null?void 0:f.key)||a()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(i)&&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(i,(f,h)=>{const j=i.length>0&&h<i.length-1;return e.jsxRuntimeExports.jsx(Ze,{item:f,index:h,canDelete:j,onChange:x,onRemove:()=>m(h)})}))]})]})})]})};function Ue(){const[r,o]=R.useStylingState(),{flexChild:s,gridChild:i}=R.useSelectedBlocksDisplayChild(),[,n]=xe.useAtom(R.advanceStylingOpenAtom),{t:l}=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:l("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:()=>n(!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(S.Select,{defaultValue:r,onValueChange:p=>o(p),children:[e.jsxRuntimeExports.jsx(S.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(S.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(S.SelectContent,{children:[e.jsxRuntimeExports.jsx(S.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(ye.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(I.Accordion,{type:"multiple",className:"h-full w-full",children:[s&&e.jsxRuntimeExports.jsx(X,{section:Se}),i?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:o}=se.useTranslation(),[s,i]=c.useState(""),[n,l]=c.useState({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=Z.useThrottledCallback(a=>{const m=!t.get(n,"negative",!1),x=t.get(n,"cssProperty","");let y=parseFloat(n.dragStartValue);y=t.isNaN(y)?0:y;let g=Ge[n.dragUnit];(t.startsWith(x,"scale")||x==="opacity")&&(g=10);let h=(n.dragStartY-a.pageY)/g+y;m&&h<0&&(h=0),x==="opacity"&&h>1&&(h=1),n.onDrag(`${h}`),i(`${h}`)},[n],50),p=c.useCallback(()=>{setTimeout(()=>n.onDragEnd(`${s}`),100),l({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[n,s,l]);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:o("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:l},children:[n.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
|
+
"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-a954d733.cjs"),Y=require("@chaibuilder/blocks"),re=require("lucide-react"),oe=require("react-autosuggest"),ce=require("./useChaiExternalData-a90e8aac.cjs"),C=require("./useBuilderProp-5e57d0c8.cjs"),I=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"),S=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 o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const F=be(c);function fe(r){const o=[],s={};function i(n,l){t.forEach(l,(d,p)=>{const a=n?`${n}.${p}`:p,m=t.isArray(d)?"list":typeof d;o.push(a),s[a]=m==="string"?"text":m==="object"?"model":m,m==="object"&&!t.isArray(d)&&i(a,d)})}return i("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:s}}const je=({data:r})=>{if(!r)return null;const o=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(o==="object"?JSON.stringify(r):r,{length:40})})},K=({type:r,isDisabled:o=!1,placeholder:s,defaultValue:i="",data:n,onChange:l,dataType:d,appliedBindings:p})=>{const[a,m]=c.useState(!1),[x,y]=c.useState(i),{paths:g,pathsType:f}=fe(n),h=r==="PROP"?Y.getBlockComponent(n==null?void 0:n._type):{};c.useEffect(()=>{t.isEmpty(x)&&l("")},[x]),c.useEffect(()=>y(i),[i]);const j=()=>g.filter(v=>{const k=t.isEmpty(x)||t.includes(t.toLower(v),t.toLower(x));return r==="PATH"?k&&d===t.get(f,v,""):k&&!t.includes(p,v)&&t.get(h,`props.${t.first(t.split(v,"."))}.binding`)}),[B,N]=c.useState(()=>j());c.useEffect(()=>N(()=>j()),[d]);const w=r==="PATH"&&t.isEmpty(B)&&a&&!t.isEmpty(d),V={autoComplete:"off",autoCorrect:"on",autoCapitalize:"off",spellCheck:!1,placeholder:w?"No available options":s,value:x,disabled:o,onFocus:()=>m(r==="PATH"),onBlur:()=>{m(!1),g.includes(x)?l(x):(y(""),l(""))},onChange:(v,{newValue:k})=>y(w?"":k),className:`chai-input w-full ${o?"cursor-not-allowed":""} ${w?"placeholder-red-400":""}`},A=v=>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":v,children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 w-full h-full absolute opacity-0 z-20",children:v}),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(v,"."),(k,D)=>e.jsxRuntimeExports.jsxs("span",{className:"flex items-end",children:[D>0&&e.jsxRuntimeExports.jsx(re.ChevronRight,{size:14,className:"h-full text-gray-400"}),t.startCase(k)]})))}),r==="PATH"&&e.jsxRuntimeExports.jsx(je,{data:t.get(n,v)})]}),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(f,v,""))})]});return e.jsxRuntimeExports.jsx(oe,{suggestions:B,onSuggestionsFetchRequested:()=>N(()=>j()),onSuggestionsClearRequested:()=>N([]),onSuggestionSelected:v=>{if(v.type==="click"){const k=t.get(v.target,"childNodes[0].data","");g.includes(k)&&l(k)}else l(v.target.value)},getSuggestionValue:v=>v,renderSuggestion:A,shouldRenderSuggestions:()=>!0,inputProps:V,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:o,onRemove:s,selectedBlock:i,dataProvider:n,appliedBindings:l})=>{const[d,p]=c.useState("string"),a=(m,x)=>{if(t.isEmpty(m))return"";{const y=t.get(x==="PROP"?i:n,m,"");if(t.isArray(y))return"list";const g=typeof y;return g==="string"?"text":g==="object"?"model":g}};return c.useEffect(()=>p(()=>a(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:m=>{const x=a(m,"PROP");o({target:{name:"key",value:m}}),d!==x&&o({target:{name:"value",value:""}}),p(x)},data:i,dataType:d,appliedBindings:l}),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:m=>{const x=a(m,"PATH");o(d!==x?{target:{name:"value",value:""}}:{target:{name:"value",value:m}})},data:n,dataType:d,appliedBindings:l}),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:o})=>{const s=R.useSelectedBlock(),[i]=ce.useChaiExternalData(),n=Y.getChaiDataProviders(),[l,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(l))return!1;const g=t.last(l);return t.isEmpty(g==null?void 0:g.key)||t.isEmpty(g==null?void 0:g.value)},[l]),a=()=>{d([...l,{key:"",value:""}])},m=g=>{const f=t.filter(l,(h,j)=>g!==j);y([...f])},x=(g,f)=>{const h=[...l];h[f][g.target.name]=g.target.value,y(h)},y=c.useCallback((g=[])=>{if(d(g),t.isEmpty(g)){o({});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)}),o(f)},[s]);return t.isEmpty(n)?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(l,(g,f)=>e.jsxRuntimeExports.jsx(ve,{item:g,onChange:h=>x(h,f),onRemove:()=>m(f),selectedBlock:s,dataProvider:i,appliedBindings:t.map(l,"key")},g.key)),e.jsxRuntimeExports.jsxs(C.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx("button",{onClick:a,disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${t.isEmpty(l)?"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30 ":""} ${p?"cursor-not-allowed bg-gray-200 text-gray-400":t.isEmpty(l)?"":"bg-gray-700/20 text-gray-800 hover:bg-blue-700/30"}`,children:"+ Add Data Binding"})}),p&&e.jsxRuntimeExports.jsx(C.TooltipContent,{sideOffset:-55,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:o,formData:s,onChange:i})=>{const[n]=R.useActiveLanguage(),l={type:"object",properties:{}},d={};return Object.keys(o).forEach(p=>{const a=o[p];if(t.includes(["slot","styles"],a.type))return;const m=t.get(a,"i18n",!1)?`${p}-${n}`:p;l.properties[m]=R.getBlockJSONFromSchemas(a,n),d[m]=R.getBlockJSONFromUISchemas(a,n)}),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:l,formData:s,onChange:i})};function Ce(){const r=R.useSelectedBlock(),{createSnapshot:o}=R.useCanvasHistory(),s=R.useUpdateBlocksPropsRealtime(),i=Y.getBlockComponent(r._type),n={...r},l=()=>o(),d=({formData:x},y)=>{if(y){const g=y.replace("root.","");s([r._id],{[g]:t.get(x,g)})}},p={_name:Y.SingleLineText({title:"Name",default:t.get(r,"_name",r._type)})},a=t.keys(t.get(n,"_bindings",{})),m=c.useMemo(()=>{const x=t.cloneDeep(t.get(i,"props",{}));return t.each(a,y=>{delete x[y]}),x},[i,a]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:l,formData:n,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(I.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(I.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(I.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Ee,{bindingData:t.get(n,"_bindings",{}),onChange:x=>{d({formData:{...n,_bindings:x}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(I.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(I.AccordionContent,{className:"pt-4",children:[t.isEmpty(a)?"":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(a,t.capitalize).join(", ")})," ",a.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:l,formData:n,properties:m})]})]})]}),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 N;const[r]=R.useSelectedStylingBlocks(),o=R.useSelectedBlock(),s=R.useAddClassesToBlocks(),i=R.useRemoveClassesFromBlocks(),[n]=R.useSelectedBlockIds(),[l,d]=c.useState(""),p=(N=t.first(r))==null?void 0:N.prop,a=t.reject((t.get(o,p,"").replace(ge.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),m=()=>{const w=l.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");s(n,w,!0),d("")},[x,y]=c.useState([]),g=({value:w})=>{const V=w.trim().toLowerCase(),A=V.match(/.+:/g);let v=[];if(A&&A.length>0){const[k]=A,D=V.replace(k,"");v=Q.search(D).map(b=>({...b,item:{...b.item,name:k+b.item.name}}))}else v=Q.search(V);y(t.map(v,"item"))},f=()=>{y([])},h=w=>w.name,j=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),B={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:l,onKeyDown:w=>{w.key==="Enter"&&l.trim()!==""&&m()},onChange:(w,{newValue:V})=>d(V),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${x.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:x,onSuggestionsFetchRequested:g,onSuggestionsClearRequested:f,getSuggestionValue:h,renderSuggestion:j,inputProps:B,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(C.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:m,disabled:l.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(a)&&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(a.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>i(n,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const H=["px","%","em","rem","ch","vh","vw"],Se={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:H,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:H},{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:H},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...H,"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:H.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:H.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:H.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:H.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:H.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:H.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:H},{type:"arbitrary",property:"lineHeight",label:"Height",units:H.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:o=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:o,canChange:s},children:r}),le=({label:r,property:o,onChange:s})=>{const i=c.useMemo(()=>t.get($.CLASSES_LIST,`${o}.classes`,[""]),[o]),n=q(o),l=c.useMemo(()=>t.get(n,"cls",""),[n]),{canChange:d}=c.useContext(O),p=/\[.*\]/g.test(l);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:l}),e.jsxRuntimeExports.jsxs(C.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(C.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(C.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(z,{rounded:r,onChange:a=>s(a,o),selected:l,options:i,disabled:!d})})};function z({selected:r,onChange:o,rounded:s=!1,options:i,disabled:n=!1}){const l=r.replace(/.*:/g,"").trim(),{undo:d,redo:p}=R.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!i.length||n,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:a=>o(a.target.value),onKeyDown:a=>{a.ctrlKey&&(a.key==="z"&&d(),a.key==="y"&&p())},value:l,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(i.map(a=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:a,children:a})))]})}const Ae=({property:r,onChange:o})=>{const{canReset:s,canChange:i}=c.useContext(O),n=q(r),l=c.useMemo(()=>t.get(n,"cls",""),[n]),d=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),p=d.indexOf(l)>-1?d.indexOf(l):0,a=/\[.*\]/g.test(l);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:a?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:l}):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:!i&&(!s||p-1<0),onClick:()=>o(t.nth(d,p-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!i&&(!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:o})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!i&&(!s||p+1>=d.length),onClick:()=>o(t.nth(d,p+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!i&&(!s||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},He=({property:r,onChange:o})=>{const s=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:i}=c.useContext(O),n=q(r),l=c.useMemo(()=>t.get(n,"cls",""),[n]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,d=>e.jsxRuntimeExports.jsxs(C.Tooltip,{children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!i,onClick:()=>o(d,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${l===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(C.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},Be={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:o})=>{const s=q(r),i=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:n}=c.useContext(O),[l,d]=c.useState([]),[p,a]=c.useState({color:"",shade:""}),m=i.split("-"),x=t.get(m,"1",""),y=t.get(m,"2",""),g=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),a({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),a(j=>({...j,color:h,shade:j.shade?j.shade:"500"})))},[d,a]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(x))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[x]);const f=c.useCallback(h=>{a({color:x,shade:h})},[x]);return c.useEffect(()=>{a({color:"",shade:""})},[s]),c.useEffect(()=>{const j=`${t.get(Be,r,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;j.match(new RegExp(t.get($.CLASSES_LIST,`${r}.regExp`,"")))&&o(j,r)},[p,o,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:!n,rounded:!0,selected:x,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:!x||!n,onChange:f,options:l})})]})},ee=(r,o)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&o.includes(s))return{value:"",unit:s};const i=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;s=s.replace(i,"");const n=r.match(i),l=n&&n.length>1,d=!t.isEmpty(s)&&Number.isNaN(Number(s));return l||d?{error:"Invalid value"}:n&&(n[0]==="auto"||n[0]==="none")?{value:n[0],unit:""}:{value:s,unit:n?n[0]:""}},De=r=>{const o=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:`${o}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${o}${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:`${o}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${o}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const i=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(i)return{value:i[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[i,n]=t.map(s.split("/"),l=>parseInt(l,10));return{value:o+(i/n*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${o+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}},Le=r=>{if(t.isEmpty(r))return{value:"",unit:""};const o=r.match(/\[.*\]/g);if(o===null)return Pe(r);const s=t.get(o,"0","").replace(/\[|\]/g,""),i=r.startsWith("-")?"-":"",n=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${i}${n}`,unit:s.replace(n,"")}},Pe=r=>t.isEmpty(r)?{value:"",unit:""}:De(r),ie=c.createContext({setDragData:()=>{}}),$e=({unit:r,currentValue:o,onDrag:s,onDragEnd:i,onDragStart:n,negative:l,cssProperty:d})=>{const{setDragData:p}=c.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:a=>{const m={onDrag:s,onDragEnd:i,dragging:!0,dragStartY:a.pageY,dragStartValue:`${o}`,dragUnit:r,negative:l,cssProperty:d};n(m),p(m)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(u.RowSpacingIcon,{})})},Me=({onSelect:r,current:o,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(i=>e.jsxRuntimeExports.jsx(C.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===i?"primary":void 0,size:"sm",onClick:n=>{n.stopPropagation(),r(i)},children:i},i))}),Oe=r=>{const[o,s]=c.useState(!1),[i,n]=c.useState(""),{currentClass:l,onChange:d,classPrefix:p,cssProperty:a,units:m,negative:x}=r,[y,g]=c.useState(a!=null&&a.toLowerCase().includes("width")?"%":m[0]),[f,h]=c.useState(!1),[j,B]=c.useState(""),[N,w]=c.useState(!1),[V,A]=c.useState(!1);c.useEffect(()=>{const{value:b,unit:E}=Le(l);if(E===""){n(b),g(a!=null&&a.toLowerCase().includes("width")?"%":m[0]);return}g(E),n(E==="class"||t.isEmpty(b)?"":b)},[l,a,m]);const v=Z.useThrottledCallback(b=>{d(b)},[d],200),k=Z.useThrottledCallback(b=>{d(b,!1)},[d],200),D=c.useCallback((b=!1)=>{const E=ee(`${i}`,m);if(t.get(E,"error",!1)){h(!0);return}const T=t.get(E,"unit")!==""?t.get(E,"unit"):y;if(T==="auto"||T==="none"){v(`${p}${T}`);return}if(t.get(E,"value")==="")return;const M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${T==="-"?"":T}]`;b?k(M):v(M)},[v,k,i,y,p,m]),_=c.useCallback(b=>{const E=ee(`${i}`,m);if(t.get(E,"error",!1)){h(!0);return}if(b==="auto"||b==="none"){v(`${p}${b}`);return}if(t.get(E,"value")==="")return;const T=t.get(E,"unit")!==""?t.get(E,"unit"):b,M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${T==="-"?"":T}]`;v(M)},[v,i,p,m]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:y==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:l}),e.jsxRuntimeExports.jsxs(C.Tooltip,{children:[e.jsxRuntimeExports.jsx(C.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(C.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${N?"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"&&D()},onKeyDown:b=>{if(b.keyCode!==38&&b.keyCode!==40)return;b.preventDefault(),A(!0);const E=t.parseInt(b.target.value);let T=t.isNaN(E)?0:E;b.keyCode===38&&(T+=1),b.keyCode===40&&(T-=1);const L=`${T}`,ue=`${L.startsWith("-")?"-":""}${p}[${L.replace("-","")}${y==="-"?"":y}]`;k(ue)},onKeyUp:b=>{V&&(b.preventDefault(),A(!1))},onBlur:()=>D(),onChange:b=>{h(!1),n(b.target.value)},onClick:b=>{var E;(E=b==null?void 0:b.target)==null||E.select(),s(!1)},value:N?j:i,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(C.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!o),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${m.length===1?"px-2 font-semibold":""}`,children:y}),m.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(C.TooltipPortal,{children:e.jsxRuntimeExports.jsx(C.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Me,{units:m,current:y,onSelect:b=>{s(!1),g(b),_(b)}})})})]})]}),["none","auto"].indexOf(y)!==-1||N?null:e.jsxRuntimeExports.jsx($e,{onDragStart:()=>w(!0),onDragEnd:b=>{if(B(()=>""),w(!1),t.isEmpty(b))return;const E=`${b}`,L=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;v(L)},onDrag:b=>{if(t.isEmpty(b))return;B(b);const E=`${b}`,L=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;k(L)},currentValue:i,unit:y,negative:x,cssProperty:a})]})})})},q=r=>{const o=R.useSelectedBlockCurrentClasses();return t.findLast(o,{property:r})},qe=(r,o)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[o]},_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:o="icons",label:s,property:i,onEmitChange:n=()=>{},units:l,negative:d=!1}=r,[p]=R.useDarkMode(),[a]=R.useStylingState(),[,m]=R.useCanvasWidth(),x=q(i),y=R.useAddClassesToBlocks(),g=R.useRemoveClassesFromBlocks(),[f]=R.useSelectedBlockIds(),h=c.useMemo(()=>t.get(x,"fullCls",""),[x]),j=c.useCallback((v,k=!0)=>{const D={dark:p,mq:m,mod:a,cls:v,property:i,fullCls:""};(p||a!=="")&&(D.mq="xs");const _=$.generateFullClsName(D);y(f,[_],k)},[f,p,m,a,i,y]),B=c.useCallback(()=>{g(f,[h])},[f,h,g]),N=c.useMemo(()=>qe(x,m),[x,m]);c.useEffect(()=>{n(N,x)},[N,n,x]);const[,,w]=R.useCanvasWidth(),V=c.useCallback(v=>{w({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[v])},[w]),A=t.get(x,"dark",null)===p&&t.get(x,"mod",null)===a&&t.get(x,"mq",null)===m;return e.jsxRuntimeExports.jsx(Ie,{canChange:N,canReset:x&&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] ${x&&!A?"text-foreground":""}`,children:s})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?e.jsxRuntimeExports.jsx(Oe,{currentClass:t.get(x,"cls",""),classPrefix:t.get(_e,i,""),units:l||[],onChange:j,negative:d,cssProperty:i}):null,o==="icons"&&e.jsxRuntimeExports.jsx(He,{property:i,onChange:j}),o==="range"&&e.jsxRuntimeExports.jsx(Ae,{property:i,onChange:j}),o==="color"&&e.jsxRuntimeExports.jsx(Ve,{property:i,onChange:j}),o==="dropdown"&&e.jsxRuntimeExports.jsx(le,{label:s,property:i,onChange:j})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>B(),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"})}):N&&x?e.jsxRuntimeExports.jsxs(C.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(C.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(C.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(x,"mq")),p&&!x.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>V(t.get(x,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(x,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Fe=["px","%","em","rem","ch","vh","vw"],ae=({label:r,options:o,borderB:s=!1,borderT:i=!1,type:n="arbitrary",units:l=Fe,negative:d=!1})=>{const[p,a]=c.useState(o[0].key),m=R.useSelectedBlockCurrentClasses(),x=c.useCallback(y=>t.map(m,"property").includes(y),[m]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${i?"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(o.map(({label:y,key:g})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(C.Tooltip,{children:[e.jsxRuntimeExports.jsx(C.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>a(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:x(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(C.TooltipContent,{children:t.startCase(t.toLower(y))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(G,{type:n,units:[...l],label:"",property:p,negative:d})})]})},Ye=({heading:r,items:o})=>{const s=R.useSelectedBlockCurrentClasses(),i=c.useMemo(()=>{const n=p=>t.flatten(p.map(a=>a.styleType==="multiple"?t.map(a.options,"key"):a.property)),l=t.flatten(o.map(p=>p.styleType==="accordion"?n(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(s,"property");return t.intersection(l,d).length>0},[s,o]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[r,i?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:o.map(n=>n.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...n},n.label):e.jsxRuntimeExports.jsx(G,{...n},n.label))})]})},Xe=c.createContext({}),X=({section:r})=>{const o=R.useSelectedBlockCurrentClasses(),s=c.useCallback((l=[])=>{const d={};for(let a=0;a<o.length;a++)d[o[a].property]=o[a].cls;let p=!0;for(const a in l)if(!t.has(d,a)||d[a]!==l[a]){p=!1;break}return p},[o]),i=c.useMemo(()=>{if(o.length>0&&r.heading==="Classes")return!0;const l=a=>t.flatten(a.map(m=>m.styleType==="multiple"?t.flatten(t.map(m.options,"key")):m.property)),d=t.flatten(r.items.map(a=>a.styleType==="accordion"?l(a.items):a.styleType==="multiple"?t.flatten(t.map(a.options,"key")):a.property)),p=t.map(o,"property");return t.intersection(d,p).length>0},[o,r.heading,r.items]),n=c.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Xe.Provider,{value:n,children:e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(I.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}),r.heading]})}),e.jsxRuntimeExports.jsx(I.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(l=>t.has(l,"component")?c.createElement(l.component,{key:l.label}):t.has(l,"styleType")?l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...l},l.label):l.styleType==="accordion"&&s(l==null?void 0:l.conditions)?e.jsxRuntimeExports.jsx(Ye,{...l},l.label):null:e.jsxRuntimeExports.jsx(G,{...l},l.label)))})]})})},Ze=({item:r,index:o,canDelete:s,onChange:i,onRemove:n})=>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:l=>i(l,o),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:l=>t.isEmpty(r.key)?{}:i(l,o),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:n,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:o}=R.useSavePage(),s=R.useSelectedBlock(),[i,n]=c.useState([]),[l]=R.useSelectedStylingBlocks(),d=R.useUpdateBlocksPropsRealtime(),p=`${t.get(l,"0.prop")}_attrs`;F.useEffect(()=>{const f=t.map(t.get(s,p),(h,j)=>({key:j,value:h}));t.isEmpty(f)?n([]):n(f)},[t.get(s,p)]);const a=()=>n([...i,{key:"",value:""}]),m=f=>{const h=t.filter(i,(j,B)=>f!==B);y(h)},x=(f,h)=>{const j=[...i];j[h][f.target.name]=f.target.value,y(j)},y=F.useCallback((f=[])=>{const h={};t.forEach(f,j=>{t.isEmpty(j.key)||t.set(h,j.key,j.value)}),d([t.get(s,"_id")],{[p]:h}),o("UNSAVED")},[s,o,d,p]);return e.jsxRuntimeExports.jsxs(I.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(I.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(I.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(i)&&t.isEmpty((g=t.last(i))==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(i)&&t.isEmpty((f=t.last(i))==null?void 0:f.key)||a()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(i)&&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(i,(f,h)=>{const j=i.length>0&&h<i.length-1;return e.jsxRuntimeExports.jsx(Ze,{item:f,index:h,canDelete:j,onChange:x,onRemove:()=>m(h)})}))]})]})})]})};function Ue(){const[r,o]=R.useStylingState(),{flexChild:s,gridChild:i}=R.useSelectedBlocksDisplayChild(),[,n]=xe.useAtom(R.advanceStylingOpenAtom),{t:l}=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:l("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:()=>n(!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(S.Select,{defaultValue:r,onValueChange:p=>o(p),children:[e.jsxRuntimeExports.jsx(S.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(S.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(S.SelectContent,{children:[e.jsxRuntimeExports.jsx(S.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(S.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(ye.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(I.Accordion,{type:"multiple",className:"h-full w-full",children:[s&&e.jsxRuntimeExports.jsx(X,{section:Se}),i?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:o}=se.useTranslation(),[s,i]=c.useState(""),[n,l]=c.useState({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=Z.useThrottledCallback(a=>{const m=!t.get(n,"negative",!1),x=t.get(n,"cssProperty","");let y=parseFloat(n.dragStartValue);y=t.isNaN(y)?0:y;let g=Ge[n.dragUnit];(t.startsWith(x,"scale")||x==="opacity")&&(g=10);let h=(n.dragStartY-a.pageY)/g+y;m&&h<0&&(h=0),x==="opacity"&&h>1&&(h=1),n.onDrag(`${h}`),i(`${h}`)},[n],50),p=c.useCallback(()=>{setTimeout(()=>n.onDragEnd(`${s}`),100),l({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[n,s,l]);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:o("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:l},children:[n.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;
|
|
@@ -8,7 +8,7 @@ import { PlusIcon as ve, Cross2Icon as Fe, EyeOpenIcon as bt, EyeClosedIcon as T
|
|
|
8
8
|
import { T as It, a as Pt, b as Re, c as He } from "./tabs-85caa1e8.js";
|
|
9
9
|
import Lt from "@rjsf/core";
|
|
10
10
|
import Ot from "@rjsf/validator-ajv8";
|
|
11
|
-
import { D as te, d as Ze, G as ze, H as Mt, I as _t, J as Et, j as je, K as Ue, L as Ge, i as Ke, e as Ft, M as qe, f as Ve, N as ce, c as Yt, O as Xt, P as Wt } from "./index-
|
|
11
|
+
import { D as te, d as Ze, G as ze, H as Mt, I as _t, J as Et, j as je, K as Ue, L as Ge, i as Ke, e as Ft, M as qe, f as Ve, N as ce, c as Yt, O as Xt, P as Wt } from "./index-91c0470a.js";
|
|
12
12
|
import { getChaiDataProviders as Zt, getBlockComponent as Je, SingleLineText as zt } from "@chaibuilder/blocks";
|
|
13
13
|
import { TrashIcon as Ut, ChevronRight as Gt } from "lucide-react";
|
|
14
14
|
import Qe from "react-autosuggest";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var A=Object.create;var k=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var V=(s,n,r,x)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of z(n))!K.call(s,o)&&o!==r&&k(s,o,{get:()=>n[o],enumerable:!(x=T(n,o))||x.enumerable});return s};var I=(s,n,r)=>(r=s!=null?A(B(s)):{},V(n||!s||!s.__esModule?k(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),C=require("@radix-ui/react-icons"),i=require("react"),q=require("jotai"),a=require("lodash"),d=require("./useBuilderProp-5e57d0c8.cjs"),v=require("./tabs-860e37aa.cjs"),R=require("./index-f63910c9.cjs");require("react-i18next");const L=require("./utils-3c452dd0.cjs"),N=require("lucide-react"),M=require("@chaibuilder/blocks"),u=require("./alert-dialog-4ce6ed22.cjs"),E=require("./dialog-170eaad9.cjs"),f=require("./select-0e32300c.cjs");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-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-select");const H=i.lazy(()=>import("react-json-view")),O=({provider:s,onClose:n})=>{const[r,x]=i.useState(null);return i.useEffect(()=>{s&&(s.mockFn?s.mockFn:s.dataFn)().then(m=>x(m))},[s]),s?e.jsxRuntimeExports.jsx(E.Dialog,{onOpenChange:o=>o?"":n(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(E.DialogContent,{children:[e.jsxRuntimeExports.jsxs(E.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(E.DialogTitle,{children:["Data Provider: ",s.name]}),e.jsxRuntimeExports.jsx(E.DialogDescription,{children:s.description})]}),e.jsxRuntimeExports.jsx(R.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(H,{style:{maxHeight:"80vh",overflowY:"auto"},name:s.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:r})})]})}):null};function F({children:s,name:n,onRemove:r}){return e.jsxRuntimeExports.jsxs(u.AlertDialog,{children:[e.jsxRuntimeExports.jsx(u.AlertDialogTrigger,{asChild:!0,children:s}),e.jsxRuntimeExports.jsxs(u.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(u.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsxs(u.AlertDialogTitle,{children:["Are you sure, you want to remove ",e.jsxRuntimeExports.jsx("span",{className:"text-blue-500",children:n})," provider?"]}),e.jsxRuntimeExports.jsx(u.AlertDialogDescription,{children:"Your data provider will be removed from this page and all added data binding will be not visible on blocks."})]}),e.jsxRuntimeExports.jsxs(u.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(u.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(u.AlertDialogAction,{onClick:r,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})}const Y=()=>{const s=i.useMemo(()=>M.getChaiDataProviders(),[]),[n,r]=R.usePageDataProviders(),[,x]=q.useAtom(R.pageSyncStateAtom),[o,m]=i.useState(a.filter(s,t=>a.map(n,"providerKey").includes(t.providerKey))),[p,w]=i.useState(""),[b,c]=i.useState(null),y=a.filter(s.map(t=>a.map(o,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!a.isNull(t)),l=t=>{const h=a.find(s,{providerKey:t});m(j=>[...j,h]),r(j=>[...j,{providerKey:h.providerKey,args:{}}]),w(""),x("UNSAVED")},g=t=>{m(h=>a.filter(h,j=>j.providerKey!==t.providerKey)),r(h=>a.filter(h,j=>j.providerKey!==t.providerKey)),x("UNSAVED")},P=t=>c(t);return a.isEmpty(s)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Add data providers:"})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(f.Select,{value:p,onValueChange:t=>l(t),children:[e.jsxRuntimeExports.jsx(f.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(f.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(f.SelectContent,{children:[e.jsxRuntimeExports.jsx(f.SelectItem,{value:"",children:"Choose"}),y.map(t=>e.jsxRuntimeExports.jsx(f.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${o.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:"Page data providers:"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:o.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>P(t),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Data"]}),e.jsxRuntimeExports.jsx(F,{onRemove:()=>g(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),"Remove"]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(O,{onClose:()=>c(null),provider:b})]})]})},D=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-0f94a98b.cjs"))),_=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-75df38ad.cjs"))),U=i.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-0db5c72f.cjs")));let S=null;const $=()=>{const s=d.useBuilderProp("sideBarComponents.top",[]),n=d.useBuilderProp("sideBarComponents.bottom",[]),[r,x]=q.useAtom(R.activePanelAtom),[o,m]=i.useState(r),[p,w]=i.useState(null),b={layers:D,"branding-options":_,images:U};a.each(s,({name:l,panel:g})=>{b[l]=g});const c=l=>{clearTimeout(S),y(!1),r!=="layers"&&l==="layers"?S=setTimeout(()=>m("layers"),500):m(l),x(l)},[,y]=q.useAtom(R.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(d.Button,{onClick:()=>{y(!0),x("layers")},size:"sm",variant:r==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(C.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(d.Button,{onClick:()=>c("layers"),size:"sm",variant:r==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(N.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(d.Button,{onClick:()=>c("branding-options"),size:"sm",variant:r==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(C.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(s.map(({name:l,icon:g})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(d.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(d.Button,{onClick:()=>c(l),size:"sm",className:"w-10",variant:r===l?"default":"outline",children:e.jsxRuntimeExports.jsx(g,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-2",children:i.Children.toArray(n.map(l=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(d.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(l,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{c("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(r==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${r!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:L.cn("relative h-full max-h-[93%] bg-background p-1",r==="layers"?"":"z-[100]"),onMouseEnter:()=>{p&&clearTimeout(p)},onMouseLeave:()=>{const l=setTimeout(()=>{p&&(c("layers"),clearTimeout(p))},1e3);w(l)},children:i.createElement(a.get(b,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsxs(v.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(v.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(v.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(N.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(v.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(N.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(v.TabsContent,{value:"layers",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(D)}),e.jsxRuntimeExports.jsx(v.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Y,{})})]})})})]})};exports.default=$;
|
|
1
|
+
"use strict";var A=Object.create;var k=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var V=(s,n,r,x)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of z(n))!K.call(s,o)&&o!==r&&k(s,o,{get:()=>n[o],enumerable:!(x=T(n,o))||x.enumerable});return s};var I=(s,n,r)=>(r=s!=null?A(B(s)):{},V(n||!s||!s.__esModule?k(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),C=require("@radix-ui/react-icons"),i=require("react"),q=require("jotai"),a=require("lodash"),d=require("./useBuilderProp-5e57d0c8.cjs"),v=require("./tabs-860e37aa.cjs"),R=require("./index-a954d733.cjs");require("react-i18next");const L=require("./utils-3c452dd0.cjs"),N=require("lucide-react"),M=require("@chaibuilder/blocks"),u=require("./alert-dialog-4ce6ed22.cjs"),E=require("./dialog-170eaad9.cjs"),f=require("./select-0e32300c.cjs");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-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-select");const H=i.lazy(()=>import("react-json-view")),O=({provider:s,onClose:n})=>{const[r,x]=i.useState(null);return i.useEffect(()=>{s&&(s.mockFn?s.mockFn:s.dataFn)().then(m=>x(m))},[s]),s?e.jsxRuntimeExports.jsx(E.Dialog,{onOpenChange:o=>o?"":n(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(E.DialogContent,{children:[e.jsxRuntimeExports.jsxs(E.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(E.DialogTitle,{children:["Data Provider: ",s.name]}),e.jsxRuntimeExports.jsx(E.DialogDescription,{children:s.description})]}),e.jsxRuntimeExports.jsx(R.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(H,{style:{maxHeight:"80vh",overflowY:"auto"},name:s.providerKey,enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:r})})]})}):null};function F({children:s,name:n,onRemove:r}){return e.jsxRuntimeExports.jsxs(u.AlertDialog,{children:[e.jsxRuntimeExports.jsx(u.AlertDialogTrigger,{asChild:!0,children:s}),e.jsxRuntimeExports.jsxs(u.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(u.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsxs(u.AlertDialogTitle,{children:["Are you sure, you want to remove ",e.jsxRuntimeExports.jsx("span",{className:"text-blue-500",children:n})," provider?"]}),e.jsxRuntimeExports.jsx(u.AlertDialogDescription,{children:"Your data provider will be removed from this page and all added data binding will be not visible on blocks."})]}),e.jsxRuntimeExports.jsxs(u.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(u.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(u.AlertDialogAction,{onClick:r,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})}const Y=()=>{const s=i.useMemo(()=>M.getChaiDataProviders(),[]),[n,r]=R.usePageDataProviders(),[,x]=q.useAtom(R.pageSyncStateAtom),[o,m]=i.useState(a.filter(s,t=>a.map(n,"providerKey").includes(t.providerKey))),[p,w]=i.useState(""),[b,c]=i.useState(null),y=a.filter(s.map(t=>a.map(o,"providerKey").includes(t.providerKey)?null:{value:t.providerKey,label:t.name}),t=>!a.isNull(t)),l=t=>{const h=a.find(s,{providerKey:t});m(j=>[...j,h]),r(j=>[...j,{providerKey:h.providerKey,args:{}}]),w(""),x("UNSAVED")},g=t=>{m(h=>a.filter(h,j=>j.providerKey!==t.providerKey)),r(h=>a.filter(h,j=>j.providerKey!==t.providerKey)),x("UNSAVED")},P=t=>c(t);return a.isEmpty(s)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs p-4",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 mb-1.5 text-xs",children:"Add data providers:"})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(f.Select,{value:p,onValueChange:t=>l(t),children:[e.jsxRuntimeExports.jsx(f.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(f.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(f.SelectContent,{children:[e.jsxRuntimeExports.jsx(f.SelectItem,{value:"",children:"Choose"}),y.map(t=>e.jsxRuntimeExports.jsx(f.SelectItem,{value:t.value,children:t.label},t.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${o.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsx("p",{className:"text-gray-500 pt-4 pb-1.5 text-xs flex-1 font-medium",children:"Page data providers:"}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:o.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm w-full","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between items-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:t.name}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-400 pt-1",children:t.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"items-center p-2 py-2 flex justify-between",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>P(t),className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-blue-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"View Data"]}),e.jsxRuntimeExports.jsx(F,{onRemove:()=>g(t),name:t.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 underline-offset-4 hover:underline h-9 rounded-md px-3 text-red-500",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"w-4 h-4 mr-2",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),"Remove"]})})]})]},t.providerKey))}),e.jsxRuntimeExports.jsx(O,{onClose:()=>c(null),provider:b})]})]})},D=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-975fed10.cjs"))),_=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-0773c5fd.cjs"))),U=i.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-0db5c72f.cjs")));let S=null;const $=()=>{const s=d.useBuilderProp("sideBarComponents.top",[]),n=d.useBuilderProp("sideBarComponents.bottom",[]),[r,x]=q.useAtom(R.activePanelAtom),[o,m]=i.useState(r),[p,w]=i.useState(null),b={layers:D,"branding-options":_,images:U};a.each(s,({name:l,panel:g})=>{b[l]=g});const c=l=>{clearTimeout(S),y(!1),r!=="layers"&&l==="layers"?S=setTimeout(()=>m("layers"),500):m(l),x(l)},[,y]=q.useAtom(R.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(d.Button,{onClick:()=>{y(!0),x("layers")},size:"sm",variant:r==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(C.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(d.Button,{onClick:()=>c("layers"),size:"sm",variant:r==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(N.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(d.Button,{onClick:()=>c("branding-options"),size:"sm",variant:r==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(C.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(s.map(({name:l,icon:g})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(d.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(d.Button,{onClick:()=>c(l),size:"sm",className:"w-10",variant:r===l?"default":"outline",children:e.jsxRuntimeExports.jsx(g,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-2",children:i.Children.toArray(n.map(l=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(d.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(l,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{c("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(r==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${r!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:L.cn("relative h-full max-h-[93%] bg-background p-1",r==="layers"?"":"z-[100]"),onMouseEnter:()=>{p&&clearTimeout(p)},onMouseLeave:()=>{const l=setTimeout(()=>{p&&(c("layers"),clearTimeout(p))},1e3);w(l)},children:i.createElement(a.get(b,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsxs(v.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(v.TabsList,{className:"mx-1 h-10 grid grid-cols-2",children:[e.jsxRuntimeExports.jsxs(v.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(N.ListTreeIcon,{className:"h-3 mr-2"})," Layers"]}),e.jsxRuntimeExports.jsxs(v.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(N.DatabaseIcon,{className:"w-3 mr-2"}),"Data"]})]}),e.jsxRuntimeExports.jsx(v.TabsContent,{value:"layers",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(D)}),e.jsxRuntimeExports.jsx(v.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Y,{})})]})})})]})};exports.default=$;
|
|
@@ -5,7 +5,7 @@ import { useAtom as w } from "jotai";
|
|
|
5
5
|
import { filter as g, map as k, isNull as H, isEmpty as I, find as R, each as _, get as F } from "lodash";
|
|
6
6
|
import { u as C, B as b, S as D } from "./useBuilderProp-81a14920.js";
|
|
7
7
|
import { T as O, a as Y, b as A, c as P } from "./tabs-85caa1e8.js";
|
|
8
|
-
import { u as U, p as $, E as J, a as Z, b as q } from "./index-
|
|
8
|
+
import { u as U, p as $, E as J, a as Z, b as q } from "./index-91c0470a.js";
|
|
9
9
|
import "react-i18next";
|
|
10
10
|
import { c as G } from "./utils-ac68b2c8.js";
|
|
11
11
|
import { ListTreeIcon as S, DatabaseIcon as Q } from "lucide-react";
|
|
@@ -186,7 +186,7 @@ const be = () => {
|
|
|
186
186
|
/* @__PURE__ */ e.jsx(je, { onClose: () => t(null), provider: f })
|
|
187
187
|
] })
|
|
188
188
|
] });
|
|
189
|
-
}, K = N(() => import("./Layers-
|
|
189
|
+
}, K = N(() => import("./Layers-a7dc3c09.js")), ye = N(() => import("./BrandingOptions-2044d3cb.js")), we = N(() => import("./ImagesPanel-38c44785.js"));
|
|
190
190
|
let z = null;
|
|
191
191
|
const cs = () => {
|
|
192
192
|
const r = C("sideBarComponents.top", []), o = C("sideBarComponents.bottom", []), [a, n] = w(Z), [i, c] = u(a), [m, y] = u(null), f = {
|
|
@@ -5,7 +5,7 @@ import { S as x, c as d, b as h, d as u, a as g, e as j, f as t } from "./select
|
|
|
5
5
|
import { u as i, d as f, e as v, f as S, S as c } from "./useBuilderProp-81a14920.js";
|
|
6
6
|
import { S as b } from "./separator-a80d065b.js";
|
|
7
7
|
import { T as N } from "./toggle-00c9d11e.js";
|
|
8
|
-
import { c as C } from "./index-
|
|
8
|
+
import { c as C } from "./index-91c0470a.js";
|
|
9
9
|
import { useTranslation as w } from "react-i18next";
|
|
10
10
|
import "@radix-ui/react-select";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),l=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),o=require("./separator-a597dba7.cjs"),a=require("./toggle-b90fed97.cjs"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),l=require("@radix-ui/react-icons"),r=require("./select-0e32300c.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),o=require("./separator-a597dba7.cjs"),a=require("./toggle-b90fed97.cjs"),c=require("./index-a954d733.cjs"),p=require("react-i18next");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-separator");require("@radix-ui/react-toggle");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=()=>s.useBuilderProp("languages",["en"]),j=()=>m().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(l.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),d=()=>{const{savePage:x,syncState:t}=c.useSavePage(),{t:u}=p.useTranslation(),n=i.useMemo(()=>{switch(t){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(a.Toggle,{onClick:()=>x(),className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),t==="SAVING"?"Saving...":t==="SAVED"?u("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t==="SAVING"?"Saving...":t==="SAVED"?"Saved":"Save changes"})})]})})},h=()=>{const x=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),u=s.useBuilderProp("topBarComponents.right",[]);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(t.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(j,{}),e.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(d,{}),i.Children.toArray(u.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=h;
|
|
@@ -5,7 +5,7 @@ import { B as c } from "./useBuilderProp-81a14920.js";
|
|
|
5
5
|
import { D as b, b as C, a as A } from "./dialog-3d4e82ed.js";
|
|
6
6
|
import { SingleLineText as d } from "@chaibuilder/blocks";
|
|
7
7
|
import { F as D } from "./form-725e3191.js";
|
|
8
|
-
import { a0 as N } from "./index-
|
|
8
|
+
import { a0 as N } from "./index-91c0470a.js";
|
|
9
9
|
import "@radix-ui/react-slot";
|
|
10
10
|
import "class-variance-authority";
|
|
11
11
|
import "./utils-ac68b2c8.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-5e57d0c8.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-99b51245.cjs"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),R=require("lodash"),x=require("./useBuilderProp-5e57d0c8.cjs"),a=require("./dialog-170eaad9.cjs"),q=require("@chaibuilder/blocks"),b=require("./form-99b51245.cjs"),f=require("./index-a954d733.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-dialog");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-86ac8848.cjs");require("react-icons-picker");require("react-dom");require("./ImagesPanel-0db5c72f.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("lucide-react");require("sonner");const E=({closeModal:i})=>{var l,o;const s=f.useAddPage(),[r,m]=g.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{}}),p=()=>{s.mutate(r,{onSuccess:()=>i()})},j=({formData:u},t)=>{m(h=>{var d,c;const n={[t]:u[t]};return t==="name"?n.slug=R.kebabCase((d=u[t])==null?void 0:d.replace(/\d/g,"")):t==="slug"&&(n.slug=(c=u[t])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...h,...n}})},P={name:q.SingleLineText({title:"Page Name",default:r.name}),slug:q.SingleLineText({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(a.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(b.Form,{formData:r,properties:P,onChange:j,disabled:s.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(x.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((o=r.slug)==null?void 0:o.length)<2||s.isPending,onClick:p,children:"Add Page"})})]})},S=()=>{const[i,s]=g.useState(!1);return e.jsxRuntimeExports.jsxs(a.Dialog,{open:i,onOpenChange:()=>s(!i),children:[e.jsxRuntimeExports.jsx(a.DialogTrigger,{children:e.jsxRuntimeExports.jsx(x.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>s(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(E,{closeModal:()=>s(!i)})]})};exports.default=S;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-a954d733.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),u=require("react-i18next");require("./jsx-runtime-5c3ac4f7.cjs");require("react");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiBuilderStudio=e.ChaiBuilderStudio;exports.useActiveLanguage=e.useActiveLanguage;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlockContentByLanguage=e.useBlockContentByLanguage;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderReset=e.useBuilderReset;exports.useBuildingBlocks=e.useBuildingBlocks;exports.useCanvasHistory=e.useCanvasHistory;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCurrentPage=e.useCurrentPage$1;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDeveloperPreviewMode=e.useDeveloperPreviewMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useFeatureSupport=e.useFeatureSupport;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useMarkAsGlobalBlock=e.useMarkAsGlobalBlock;exports.useMoveBlocks=e.useMoveBlocks;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.usePrimaryLanguage=e.usePrimaryLanguage;exports.useProject=e.useProject$1;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSetAllBlocks=e.useSetAllBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTranslations=e.useTranslations;exports.useTreeData=e.useTreeData;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useBuilderProp=s.useBuilderProp;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a5 as T, ap as b, H as j, a8 as x, ak as G, W as O, al as U, K as w, B as F, ao as W, z as Z, a6 as q, a9 as z, d as E, f as K, l as N, o as V, aa as J, n as Q, e as X, ab as Y, m as _, k as $, ac as ss, V as es, A as as, an as os, a1 as ts, ad as us, q as rs, s as is, am as ls, ae as ps, a7 as cs, t as ds, L as ms, c as Bs, D as ks, ag as ns, N as gs, i as Cs, O as Ss, g as vs, j as Ps, h as As, ah as ys, M as hs, af as Ms, ai as Ds, Z as Is, aj as Ls, G as fs } from "./index-
|
|
1
|
+
import { a5 as T, ap as b, H as j, a8 as x, ak as G, W as O, al as U, K as w, B as F, ao as W, z as Z, a6 as q, a9 as z, d as E, f as K, l as N, o as V, aa as J, n as Q, e as X, ab as Y, m as _, k as $, ac as ss, V as es, A as as, an as os, a1 as ts, ad as us, q as rs, s as is, am as ls, ae as ps, a7 as cs, t as ds, L as ms, c as Bs, D as ks, ag as ns, N as gs, i as Cs, O as Ss, g as vs, j as Ps, h as As, ah as ys, M as hs, af as Ms, ai as Ds, Z as Is, aj as Ls, G as fs } from "./index-91c0470a.js";
|
|
2
2
|
import { u as Hs } from "./useBuilderProp-81a14920.js";
|
|
3
3
|
import { useTranslation as bs } from "react-i18next";
|
|
4
4
|
import "./jsx-runtime-944c88e2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-a954d733.cjs"),c=require("@radix-ui/react-icons");require("react");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-alert-dialog");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=({pageData:i,projectData:s})=>{const n={},t=d.useDeletePage(),u=i.uuid===s.homepage,o=()=>{t.mutate(i,{onSuccess:()=>{n({uuid:s.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:u,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${u?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(c.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(l.Button,{variant:"destructive",onClick:o,disabled:t.isPending,children:"Yes, Delete"})]})]})]})};exports.default=x;
|