@chaibuilder/sdk 1.3.2 → 1.3.3

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.
@@ -3,7 +3,7 @@ import C from "@monaco-editor/react";
3
3
  import { B as x } from "./context-menu-BtcwqA6V.js";
4
4
  import { useTranslation as v } from "react-i18next";
5
5
  import { useState as r, useCallback as g, useEffect as y } from "react";
6
- import { u as N, a as T, b as w, c as B } from "./index-Coh4Y4tF.js";
6
+ import { u as N, a as T, b as w, c as B } from "./index-Bs0YXRE3.js";
7
7
  import { Cross2Icon as E } from "@radix-ui/react-icons";
8
8
  import { useThrottledCallback as I } from "@react-hookz/web";
9
9
  const d = (l) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("@monaco-editor/react"),j=require("./context-menu-CYk-Ms8j.cjs"),g=require("react-i18next"),l=require("react"),c=require("./index-MwShWj1c.cjs"),v=require("@radix-ui/react-icons"),y=require("@react-hookz/web"),d=o=>{const n=document.createElement("div");return n.innerHTML=o,n.innerHTML};function T(){const{t:o}=g.useTranslation(),[n,u]=l.useState(!1),[r,m]=l.useState(""),[t,i]=c.useCodeEditor(),[a]=c.useSelectedBlockIds(),x=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),h=y.useThrottledCallback(s=>{const k=d(s);f([t.blockId],{[t.blockProp]:k})},[],300),b=l.useCallback(()=>{if(n){const s=d(r);x([t.blockId],{[t.blockProp]:s})}},[n,r]);l.useEffect(()=>{a.includes(t==null?void 0:t.blockId)||(b(),i(null))},[a]);const p=()=>{i(null)};return e.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsx("button",{onClick:p,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:o("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsx("div",{className:"flex gap-x-2",children:e.jsx(j.Button,{onClick:()=>i(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsx(v.Cross2Icon,{})})})]}),e.jsx(C,{onMount:s=>{s.setValue(t.initialCode)},onChange:s=>{u(!0),m(s),h(s)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("@monaco-editor/react"),j=require("./context-menu-CYk-Ms8j.cjs"),g=require("react-i18next"),l=require("react"),c=require("./index-DCfhFFGx.cjs"),v=require("@radix-ui/react-icons"),y=require("@react-hookz/web"),d=o=>{const n=document.createElement("div");return n.innerHTML=o,n.innerHTML};function T(){const{t:o}=g.useTranslation(),[n,u]=l.useState(!1),[r,m]=l.useState(""),[t,i]=c.useCodeEditor(),[a]=c.useSelectedBlockIds(),x=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),h=y.useThrottledCallback(s=>{const k=d(s);f([t.blockId],{[t.blockProp]:k})},[],300),b=l.useCallback(()=>{if(n){const s=d(r);x([t.blockId],{[t.blockProp]:s})}},[n,r]);l.useEffect(()=>{a.includes(t==null?void 0:t.blockId)||(b(),i(null))},[a]);const p=()=>{i(null)};return e.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsx("button",{onClick:p,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:o("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsx("div",{className:"flex gap-x-2",children:e.jsx(j.Button,{onClick:()=>i(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsx(v.Cross2Icon,{})})})]}),e.jsx(C,{onMount:s=>{s.setValue(t.initialCode)},onChange:s=>{u(!0),m(s),h(s)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=T;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
2
  import m, { useMemo as S, Suspense as d } from "react";
3
3
  import { B as x, a6 as y, a7 as k, a8 as A, a9 as D, aq as u, al as f } from "./context-menu-BtcwqA6V.js";
4
- import { e as P, F as B, d as o, f as L, g as M, L as h, h as v, i as E } from "./index-Coh4Y4tF.js";
4
+ import { e as P, F as B, d as o, f as L, g as M, L as h, h as v, i as E } from "./index-Bs0YXRE3.js";
5
5
  import { useTranslation as b } from "react-i18next";
6
6
  import { c as w } from "./iconBase-DHfFLkem.js";
7
7
  import { EyeOpenIcon as I, ChevronDownIcon as G } from "@radix-ui/react-icons";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),a=require("./context-menu-CYk-Ms8j.cjs"),s=require("./index-MwShWj1c.cjs"),m=require("react-i18next"),h=require("./iconBase-Cn2BsTrq.cjs"),p=require("@radix-ui/react-icons"),c=require("lodash-es");require("@chaibuilder/runtime");const j=()=>{const{savePage:l,saveState:n}=s.useSavePage(),{t:r}=m.useTranslation(),i=e.jsxs(a.Button,{disabled:n==="SAVING",onClick:t=>{t.preventDefault(),l()},className:h.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":n==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":n==="SAVED"}),size:"sm",variant:"outline",children:[e.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsx("span",{className:"text-sm",children:r(n==="SAVING"?"Saving":n==="SAVED"?"Saved":"Unsaved")})]});return e.jsx("div",{className:"flex items-center",children:i})},v=function(){const n=s.useBuilderProp("previewComponent"),[,r]=s.usePreviewMode(),{t:i}=m.useTranslation();return n?e.jsxs(a.Button,{onClick:t=>{t.preventDefault(),r(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsx(p.EyeOpenIcon,{className:"text-xs"}),e.jsx("span",{className:"text-sm",children:i("Preview")})]}):null},f=()=>{const{fallbackLang:l,languages:n,selectedLang:r,setSelectedLang:i}=s.useLanguages(),t=(r==null?void 0:r.length)>0?r:l,g=x.useMemo(()=>{const o=[];return c.forEach(c.uniq([l,...n]),u=>{const d=c.get(s.LANGUAGES,u);d&&o.push({key:u,value:d,default:u===l})}),o},[l,n]);return c.isEmpty(n)&&t==="en"?null:c.isEmpty(n)&&t!=="en"?e.jsxs("div",{className:"flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600",children:[e.jsx(s.FaLanguage,{className:"h-4 w-4"}),c.get(s.LANGUAGES,t)]}):e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(a.Button,{size:"sm",variant:"outline",className:"flex items-center gap-x-1 text-blue-500 hover:text-blue-600",children:[e.jsx(s.FaLanguage,{className:"h-4 w-4"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{children:[" ",c.get(s.LANGUAGES,t)]}),e.jsx(p.ChevronDownIcon,{className:"h-4 w-4"})]})]})}),e.jsx(a.DropdownMenuContent,{className:"border-border",children:c.map(g,o=>e.jsxs(a.DropdownMenuItem,{className:h.cn("flex cursor-pointer items-center text-sm",o.key===t&&"!bg-blue-500 text-white hover:!text-white"),onClick:()=>i(o.key),children:[e.jsx("div",{children:o.value}),o.key===l?e.jsx(s.FaStar,{className:"ml-2 h-4 w-4 text-yellow-400"}):null]}))})]})},N=()=>{const l=s.useBuilderProp("topBarComponents.left",[]),n=s.useBuilderProp("topBarComponents.center",[]),r=s.useBuilderProp("topBarComponents.right",[]),i=s.useBuilderProp("editable",!0);return e.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("div",{className:"flex items-center space-x-2 font-bold",children:x.Children.toArray(l.map(t=>e.jsx(x.Suspense,{fallback:e.jsx(a.Skeleton,{className:"h-10"}),children:e.jsx(t,{})})))})}),e.jsx("div",{className:"flex items-center space-x-2",children:x.Children.toArray(n.map(t=>e.jsx(x.Suspense,{fallback:e.jsx(a.Skeleton,{className:"h-10"}),children:e.jsx(t,{})})))}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(f,{}),e.jsx(a.Separator,{orientation:"vertical"}),e.jsx(v,{}),e.jsx(a.Separator,{orientation:"vertical"}),i?e.jsx(j,{}):null,x.Children.toArray(r.map(t=>e.jsx(x.Suspense,{fallback:e.jsx(a.Skeleton,{className:"h-10"}),children:e.jsx(t,{})})))]})]})};exports.default=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),a=require("./context-menu-CYk-Ms8j.cjs"),s=require("./index-DCfhFFGx.cjs"),m=require("react-i18next"),h=require("./iconBase-Cn2BsTrq.cjs"),p=require("@radix-ui/react-icons"),c=require("lodash-es");require("@chaibuilder/runtime");const j=()=>{const{savePage:l,saveState:n}=s.useSavePage(),{t:r}=m.useTranslation(),i=e.jsxs(a.Button,{disabled:n==="SAVING",onClick:t=>{t.preventDefault(),l()},className:h.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":n==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":n==="SAVED"}),size:"sm",variant:"outline",children:[e.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsx("span",{className:"text-sm",children:r(n==="SAVING"?"Saving":n==="SAVED"?"Saved":"Unsaved")})]});return e.jsx("div",{className:"flex items-center",children:i})},v=function(){const n=s.useBuilderProp("previewComponent"),[,r]=s.usePreviewMode(),{t:i}=m.useTranslation();return n?e.jsxs(a.Button,{onClick:t=>{t.preventDefault(),r(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsx(p.EyeOpenIcon,{className:"text-xs"}),e.jsx("span",{className:"text-sm",children:i("Preview")})]}):null},f=()=>{const{fallbackLang:l,languages:n,selectedLang:r,setSelectedLang:i}=s.useLanguages(),t=(r==null?void 0:r.length)>0?r:l,g=x.useMemo(()=>{const o=[];return c.forEach(c.uniq([l,...n]),u=>{const d=c.get(s.LANGUAGES,u);d&&o.push({key:u,value:d,default:u===l})}),o},[l,n]);return c.isEmpty(n)&&t==="en"?null:c.isEmpty(n)&&t!=="en"?e.jsxs("div",{className:"flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600",children:[e.jsx(s.FaLanguage,{className:"h-4 w-4"}),c.get(s.LANGUAGES,t)]}):e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(a.Button,{size:"sm",variant:"outline",className:"flex items-center gap-x-1 text-blue-500 hover:text-blue-600",children:[e.jsx(s.FaLanguage,{className:"h-4 w-4"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{children:[" ",c.get(s.LANGUAGES,t)]}),e.jsx(p.ChevronDownIcon,{className:"h-4 w-4"})]})]})}),e.jsx(a.DropdownMenuContent,{className:"border-border",children:c.map(g,o=>e.jsxs(a.DropdownMenuItem,{className:h.cn("flex cursor-pointer items-center text-sm",o.key===t&&"!bg-blue-500 text-white hover:!text-white"),onClick:()=>i(o.key),children:[e.jsx("div",{children:o.value}),o.key===l?e.jsx(s.FaStar,{className:"ml-2 h-4 w-4 text-yellow-400"}):null]}))})]})},N=()=>{const l=s.useBuilderProp("topBarComponents.left",[]),n=s.useBuilderProp("topBarComponents.center",[]),r=s.useBuilderProp("topBarComponents.right",[]),i=s.useBuilderProp("editable",!0);return e.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("div",{className:"flex items-center space-x-2 font-bold",children:x.Children.toArray(l.map(t=>e.jsx(x.Suspense,{fallback:e.jsx(a.Skeleton,{className:"h-10"}),children:e.jsx(t,{})})))})}),e.jsx("div",{className:"flex items-center space-x-2",children:x.Children.toArray(n.map(t=>e.jsx(x.Suspense,{fallback:e.jsx(a.Skeleton,{className:"h-10"}),children:e.jsx(t,{})})))}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(f,{}),e.jsx(a.Separator,{orientation:"vertical"}),e.jsx(v,{}),e.jsx(a.Separator,{orientation:"vertical"}),i?e.jsx(j,{}):null,x.Children.toArray(r.map(t=>e.jsx(x.Suspense,{fallback:e.jsx(a.Skeleton,{className:"h-10"}),children:e.jsx(t,{})})))]})]})};exports.default=N;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),h=require("lodash-es"),_=require("unsplash-js"),v=require("./context-menu-CYk-Ms8j.cjs"),T=require("react-i18next"),b=require("./index-MwShWj1c.cjs"),B=require("@react-hookz/web"),L=require("lucide-react"),y=async(x,g)=>new Promise((n,l)=>{_.createApi({accessKey:g}).search.getPhotos(x).then(o=>{n(o)}).catch(o=>l(o))}),D=({isModalView:x,onSelect:g})=>{const n=b.useBuilderProp("unsplashAccessKey",""),[l,f]=r.useState([]),[o,j]=r.useState(0),[c,C]=r.useState(),[i,P]=r.useState(),[E,N]=r.useState(0),[p,I]=B.useDebouncedState("",1e3),[m,d]=r.useState(!1),{t:q}=T.useTranslation(),A=async a=>{if(h.isEmpty(p))return;let t=o+1;d(!0),j(t);const u={query:p,page:t};c&&(u.orientation=c),i&&(u.color=i),y(u,n).then(s=>{var S,w,k;f(t===1?((S=s==null?void 0:s.response)==null?void 0:S.results)||[]:[...l,...((w=s==null?void 0:s.response)==null?void 0:w.results)||[]]),N((k=s==null?void 0:s.response)==null?void 0:k.total_pages),d(!1)}).catch(()=>{d(!1)})};return r.useEffect(()=>{if(!h.isEmpty(p)&&n){d(!0);const a={query:p,page:1};c&&(a.orientation=c),i&&(a.color=i),j(1),y(a,n).then(t=>{var u,s;f(((u=t==null?void 0:t.response)==null?void 0:u.results)||[]),N((s=t==null?void 0:t.response)==null?void 0:s.total_pages),d(!1)}).catch(()=>{d(!1)})}},[c,i,p,n]),h.isEmpty(n)?e.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:e.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"px-1 underline hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("form",{className:"flex items-center gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsx(v.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:a=>I(a.target.value)}),e.jsx("div",{children:e.jsx(b.ChaiSelect,{className:"w-40",placeholder:q("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:c,onValueChange:a=>C(a)})}),e.jsx("div",{children:e.jsx(b.ChaiSelect,{placeholder:q("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:i,onValueChange:a=>P(a)})})]}),e.jsxs(v.ScrollArea,{className:`h-full ${x&&!h.isEmpty(l)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[h.isEmpty(l)&&!m&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsx("div",{className:"font-medium",children:"No Data"}),e.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),x?e.jsx("div",{className:"h-full columns-5 py-2",children:l.map(a=>e.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>g(a.urls.regular),children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:a.alt_description,src:a.urls.small})})},a.id))}):l.map(a=>e.jsx("div",{className:"w-full px-2 py-1",children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:a.alt_description,src:a.urls.small})})},a.id)),m&&e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(L.Loader,{className:"h-6 w-6 animate-spin"}),"  Loading..."]}),!h.isEmpty(l)&&o<E&&!m&&e.jsx(v.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>A(),disabled:m,children:m?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),h=require("lodash-es"),_=require("unsplash-js"),v=require("./context-menu-CYk-Ms8j.cjs"),T=require("react-i18next"),b=require("./index-DCfhFFGx.cjs"),B=require("@react-hookz/web"),L=require("lucide-react"),y=async(x,g)=>new Promise((n,l)=>{_.createApi({accessKey:g}).search.getPhotos(x).then(o=>{n(o)}).catch(o=>l(o))}),D=({isModalView:x,onSelect:g})=>{const n=b.useBuilderProp("unsplashAccessKey",""),[l,f]=r.useState([]),[o,j]=r.useState(0),[c,C]=r.useState(),[i,P]=r.useState(),[E,N]=r.useState(0),[p,I]=B.useDebouncedState("",1e3),[m,d]=r.useState(!1),{t:q}=T.useTranslation(),A=async a=>{if(h.isEmpty(p))return;let t=o+1;d(!0),j(t);const u={query:p,page:t};c&&(u.orientation=c),i&&(u.color=i),y(u,n).then(s=>{var S,w,k;f(t===1?((S=s==null?void 0:s.response)==null?void 0:S.results)||[]:[...l,...((w=s==null?void 0:s.response)==null?void 0:w.results)||[]]),N((k=s==null?void 0:s.response)==null?void 0:k.total_pages),d(!1)}).catch(()=>{d(!1)})};return r.useEffect(()=>{if(!h.isEmpty(p)&&n){d(!0);const a={query:p,page:1};c&&(a.orientation=c),i&&(a.color=i),j(1),y(a,n).then(t=>{var u,s;f(((u=t==null?void 0:t.response)==null?void 0:u.results)||[]),N((s=t==null?void 0:t.response)==null?void 0:s.total_pages),d(!1)}).catch(()=>{d(!1)})}},[c,i,p,n]),h.isEmpty(n)?e.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:e.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"px-1 underline hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("form",{className:"flex items-center gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsx(v.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:a=>I(a.target.value)}),e.jsx("div",{children:e.jsx(b.ChaiSelect,{className:"w-40",placeholder:q("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:c,onValueChange:a=>C(a)})}),e.jsx("div",{children:e.jsx(b.ChaiSelect,{placeholder:q("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:i,onValueChange:a=>P(a)})})]}),e.jsxs(v.ScrollArea,{className:`h-full ${x&&!h.isEmpty(l)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[h.isEmpty(l)&&!m&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsx("div",{className:"font-medium",children:"No Data"}),e.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),x?e.jsx("div",{className:"h-full columns-5 py-2",children:l.map(a=>e.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>g(a.urls.regular),children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:a.alt_description,src:a.urls.small})})},a.id))}):l.map(a=>e.jsx("div",{className:"w-full px-2 py-1",children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:a.alt_description,src:a.urls.small})})},a.id)),m&&e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(L.Loader,{className:"h-6 w-6 animate-spin"}),"  Loading..."]}),!h.isEmpty(l)&&o<E&&!m&&e.jsx(v.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>A(),disabled:m,children:m?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=y;
@@ -4,7 +4,7 @@ import { isEmpty as h } from "lodash-es";
4
4
  import { createApi as T } from "unsplash-js";
5
5
  import { I as D, S as E, B as F } from "./context-menu-BtcwqA6V.js";
6
6
  import { useTranslation as K } from "react-i18next";
7
- import { d as U, C as P } from "./index-Coh4Y4tF.js";
7
+ import { d as U, C as P } from "./index-Bs0YXRE3.js";
8
8
  import { useDebouncedState as V } from "@react-hookz/web";
9
9
  import { Loader as W } from "lucide-react";
10
10
  const A = async (g, b) => new Promise((t, o) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),i=require("lodash-es"),N=require("jotai"),S=require("./context-menu-CYk-Ms8j.cjs"),q=require("react-i18next"),b=require("./index-MwShWj1c.cjs"),y=require("lucide-react"),F=N.atom([]),U=({isModalView:r,onSelect:c})=>{const{t}=q.useTranslation(),x=b.useBuilderProp("uploadMediaCallback"),d=b.useBuilderProp("fetchMediaCallback"),[n,m]=N.useAtom(F),[v,h]=l.useState(!1),[f,p]=l.useState(!1),[,I]=l.useState(),[g,u]=l.useState("");l.useEffect(()=>{(async()=>{if(!d)return;p(!0);const s=await d();m(s||[]),p(!1)})()},[]);const w=s=>{var a,o;if(u(""),s&&((o=(a=s==null?void 0:s.target)==null?void 0:a.files)==null?void 0:o.length)>0){const j=s.target.files[0];j.type.startsWith("image")?k(j):u(t("Please select an image"))}},k=async s=>{if(x){h(!0);try{const{url:a}=await x(s);c(a),I(void 0);const o=await d();m(o)}catch(a){m([]),u((a==null?void 0:a.message)||"Something went wrong.")}h(!1)}};return e.jsxs("div",{children:[e.jsxs("label",{htmlFor:r?"upload-in-modal":"upload-in-panel",children:[e.jsx("div",{className:"flex flex-col items-center rounded-lg",children:e.jsxs("label",{htmlFor:"image-upload",className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsx(y.Upload,{className:"mb-3 h-10 w-10 text-gray-400"}),e.jsx("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:e.jsx("span",{className:"font-semibold",children:t("Click to upload")})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("SVG, PNG, JPG or GIF (Max. 2mb)")})]}),v?e.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsx(y.Loader,{className:"h-6 w-6 animate-spin"}),e.jsx("span",{className:"ml-2 text-sm text-gray-500",children:t("Uploading...")})]}):null,g&&e.jsx("p",{className:"pb-2 text-xs text-red-500",children:g||t("Something went wrong")})]})}),e.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:w})]}),e.jsxs(S.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[i.isEmpty(n)&&f&&e.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsx("div",{className:"animate-pulse font-medium",children:t("Fetching...")})}),i.isEmpty(n)&&!f&&e.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsx("h3",{className:"mb-2 text-sm font-semibold",children:t("No images found")}),e.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:t("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),r?e.jsx("div",{className:"h-full columns-5 py-2",children:i.map(n,s=>e.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>c(s.url),children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):i.map(n,s=>e.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>c(s.url),children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),i=require("lodash-es"),N=require("jotai"),S=require("./context-menu-CYk-Ms8j.cjs"),q=require("react-i18next"),b=require("./index-DCfhFFGx.cjs"),y=require("lucide-react"),F=N.atom([]),U=({isModalView:r,onSelect:c})=>{const{t}=q.useTranslation(),x=b.useBuilderProp("uploadMediaCallback"),d=b.useBuilderProp("fetchMediaCallback"),[n,m]=N.useAtom(F),[v,h]=l.useState(!1),[f,p]=l.useState(!1),[,I]=l.useState(),[g,u]=l.useState("");l.useEffect(()=>{(async()=>{if(!d)return;p(!0);const s=await d();m(s||[]),p(!1)})()},[]);const w=s=>{var a,o;if(u(""),s&&((o=(a=s==null?void 0:s.target)==null?void 0:a.files)==null?void 0:o.length)>0){const j=s.target.files[0];j.type.startsWith("image")?k(j):u(t("Please select an image"))}},k=async s=>{if(x){h(!0);try{const{url:a}=await x(s);c(a),I(void 0);const o=await d();m(o)}catch(a){m([]),u((a==null?void 0:a.message)||"Something went wrong.")}h(!1)}};return e.jsxs("div",{children:[e.jsxs("label",{htmlFor:r?"upload-in-modal":"upload-in-panel",children:[e.jsx("div",{className:"flex flex-col items-center rounded-lg",children:e.jsxs("label",{htmlFor:"image-upload",className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsx(y.Upload,{className:"mb-3 h-10 w-10 text-gray-400"}),e.jsx("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:e.jsx("span",{className:"font-semibold",children:t("Click to upload")})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("SVG, PNG, JPG or GIF (Max. 2mb)")})]}),v?e.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsx(y.Loader,{className:"h-6 w-6 animate-spin"}),e.jsx("span",{className:"ml-2 text-sm text-gray-500",children:t("Uploading...")})]}):null,g&&e.jsx("p",{className:"pb-2 text-xs text-red-500",children:g||t("Something went wrong")})]})}),e.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:w})]}),e.jsxs(S.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[i.isEmpty(n)&&f&&e.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsx("div",{className:"animate-pulse font-medium",children:t("Fetching...")})}),i.isEmpty(n)&&!f&&e.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsx("h3",{className:"mb-2 text-sm font-semibold",children:t("No images found")}),e.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:t("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),r?e.jsx("div",{className:"h-full columns-5 py-2",children:i.map(n,s=>e.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>c(s.url),children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):i.map(n,s=>e.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>c(s.url),children:e.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=U;
@@ -4,7 +4,7 @@ import { isEmpty as N, map as y } from "lodash-es";
4
4
  import { atom as U, useAtom as C } from "jotai";
5
5
  import { S } from "./context-menu-BtcwqA6V.js";
6
6
  import { useTranslation as G } from "react-i18next";
7
- import { d as v } from "./index-Coh4Y4tF.js";
7
+ import { d as v } from "./index-Bs0YXRE3.js";
8
8
  import { Upload as P, Loader as A } from "lucide-react";
9
9
  const E = U([]), z = ({ isModalView: r, onSelect: d }) => {
10
10
  const { t: a } = G(), f = v("uploadMediaCallback"), c = v("fetchMediaCallback"), [o, m] = C(E), [w, p] = i(!1), [h, g] = i(!1), [, I] = i(), [x, u] = i("");
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-MwShWj1c.cjs"),s=require("./iconBase-Cn2BsTrq.cjs"),o=require("@chaibuilder/runtime"),l=require("react-i18next"),t=require("i18next");exports.AISetContext=e.AISetContext;exports.AIUserPrompt=e.AIUserPrompt;exports.AddBlocksDialog=e.AddBlocksDialog;exports.AddBlocksPanel=e.AddBlocksPanel;exports.BlockAttributesEditor=e.BlockAttributesEditor;exports.BlockPropsEditor=e.BlockSettings;exports.BlockStyleEditor=e.BlockStyling;exports.CHAI_BUILDER_EVENTS=e.CHAI_BUILDER_EVENTS;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.DarkModeSwitcher=e.DarkMode;exports.DefaultChaiBlocks=e.DefaultChaiBlocks;exports.ImportHTML=e.ImportHTML;exports.Outline=e.ListTree;exports.ScreenSizes=e.Breakpoints;exports.ThemeOptions=e.ThemeConfigPanel;exports.UILibraries=e.UILibrariesPanel;exports.UndoRedo=e.UndoRedo;exports.emitChaiBuilderMsg=e.emitChaiBuilderMsg;exports.getBlocksFromHTML=e.getBlocksFromHTML;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiBuilderMsgListener=e.useChaiBuilderMsgListener;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useGlobalBlocksList=e.useGlobalBlocksList;exports.useGlobalBlocksStore=e.useGlobalBlocksStore;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useLayoutVariant=e.useLayoutVariant;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;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.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;Object.defineProperty(exports,"registerChaiBlock",{enumerable:!0,get:()=>o.registerChaiBlock});Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>l.useTranslation});exports.i18n=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DCfhFFGx.cjs"),s=require("./iconBase-Cn2BsTrq.cjs"),o=require("@chaibuilder/runtime"),l=require("react-i18next"),t=require("i18next");exports.AISetContext=e.AISetContext;exports.AIUserPrompt=e.AIUserPrompt;exports.AddBlocksDialog=e.AddBlocksDialog;exports.AddBlocksPanel=e.AddBlocksPanel;exports.BlockAttributesEditor=e.BlockAttributesEditor;exports.BlockPropsEditor=e.BlockSettings;exports.BlockStyleEditor=e.BlockStyling;exports.CHAI_BUILDER_EVENTS=e.CHAI_BUILDER_EVENTS;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.DarkModeSwitcher=e.DarkMode;exports.DefaultChaiBlocks=e.DefaultChaiBlocks;exports.ImportHTML=e.ImportHTML;exports.Outline=e.ListTree;exports.ScreenSizes=e.Breakpoints;exports.ThemeOptions=e.ThemeConfigPanel;exports.UILibraries=e.UILibrariesPanel;exports.UndoRedo=e.UndoRedo;exports.emitChaiBuilderMsg=e.emitChaiBuilderMsg;exports.getBlocksFromHTML=e.getBlocksFromHTML;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiBuilderMsgListener=e.useChaiBuilderMsgListener;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useGlobalBlocksList=e.useGlobalBlocksList;exports.useGlobalBlocksStore=e.useGlobalBlocksStore;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useLayoutVariant=e.useLayoutVariant;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;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.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;Object.defineProperty(exports,"registerChaiBlock",{enumerable:!0,get:()=>o.registerChaiBlock});Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>l.useTranslation});exports.i18n=t;
package/dist/core.d.ts CHANGED
@@ -551,7 +551,7 @@ export declare const usePreviewMode: () => [boolean, Function];
551
551
 
552
552
  export declare const useRemoveBlocks: () => (blockIds: Array<string>) => void;
553
553
 
554
- export declare const useRemoveClassesFromBlocks: () => Function;
554
+ export declare const useRemoveClassesFromBlocks: () => (blockIds: Array<string>, fullClasses: Array<string>) => void;
555
555
 
556
556
  export declare const useSavePage: () => {
557
557
  savePage: ThrottledFunction<(autoSave?: boolean) => Promise<boolean>>;
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as a, s as o, n as l, A as t, t as r, B as u, l as i, q as d, j as c, v as B, m as k, w as n, D as C, I as g, k as p, x as S, T as m, U as h, y as I, o as A, E as P, z as U, N as b, O as y, $ as D, J as E, ae as L, a1 as M, d as f, M as v, P as T, Q as x, p as H, u as R, R as O, S as V, V as w, W as G, X as _, Y as z, G as F, H as N, Z as W, _ as Z, g as j, ad as q, a0 as J, f as K, a2 as Q, a3 as X, e as Y, a6 as $, a5 as ss, a4 as es, a as as, aa as os, ab as ls, ac as ts, a7 as rs, a9 as us, a8 as is, K as ds, b as cs, c as Bs } from "./index-Coh4Y4tF.js";
1
+ import { r as a, s as o, n as l, A as t, t as r, B as u, l as i, q as d, j as c, v as B, m as k, w as n, D as C, I as g, k as p, x as S, T as m, U as h, y as I, o as A, E as P, z as U, N as b, O as y, $ as D, J as E, ae as L, a1 as M, d as f, M as v, P as T, Q as x, p as H, u as R, R as O, S as V, V as w, W as G, X as _, Y as z, G as F, H as N, Z as W, _ as Z, g as j, ad as q, a0 as J, f as K, a2 as Q, a3 as X, e as Y, a6 as $, a5 as ss, a4 as es, a as as, aa as os, ab as ls, ac as ts, a7 as rs, a9 as us, a8 as is, K as ds, b as cs, c as Bs } from "./index-Bs0YXRE3.js";
2
2
  import { g as ns, c as Cs } from "./iconBase-DHfFLkem.js";
3
3
  import { registerChaiBlock as ps } from "@chaibuilder/runtime";
4
4
  import { useTranslation as ms } from "react-i18next";
@@ -5,7 +5,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
5
  import * as React from "react";
6
6
  import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useMemo, useState, Component, Children, Suspense, createElement, useRef, memo, lazy } from "react";
7
7
  import { a6 as DropdownMenu, a7 as DropdownMenuTrigger, a8 as DropdownMenuContent, a9 as DropdownMenuItem, aq as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, N as Tooltip, O as TooltipTrigger, P as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, L as Label, T as Textarea, y as CardFooter, D as Dialog, r as DialogTrigger, s as DialogContent, t as DialogHeader, v as DialogTitle, w as DialogDescription, u as DialogFooter, U as Popover, V as PopoverTrigger, W as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, H as Tabs, J as TabsList, K as TabsTrigger, M as TabsContent, a as Switch, A as Accordion, d as AccordionItem, e as AccordionTrigger, f as AccordionContent, an as useToast, I as Input$1, R as TooltipPortal, S as ScrollArea, ac as DropdownMenuLabel, ad as DropdownMenuSeparator, af as DropdownMenuGroup, ae as DropdownMenuShortcut, i as AlertDialog, k as AlertDialogContent, l as AlertDialogHeader, n as AlertDialogTitle, j as AlertDialogTrigger, o as AlertDialogDescription, m as AlertDialogFooter, q as AlertDialogCancel, p as AlertDialogAction, aa as DropdownMenuCheckboxItem, X as HoverCard, Y as HoverCardTrigger, Z as HoverCardContent, al as Separator, g as Badge, _ as Select$1, a1 as SelectTrigger, a0 as SelectValue, a2 as SelectContent, a4 as SelectItem, Q as TooltipProvider, ap as Toaster } from "./context-menu-BtcwqA6V.js";
8
- import { has, find, filter, flatten, map, omit, isString as isString$1, uniq, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, memoize, forEach, unset, chunk, throttle, findIndex, pick, cloneDeep, isFunction as isFunction$1, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, sortBy, toUpper, round } from "lodash-es";
8
+ import { has, find, filter, flatten, map, omit, isString as isString$1, uniq, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, memoize, forEach, unset, chunk, throttle, findIndex, pick, cloneDeep, isFunction as isFunction$1, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, sortBy, reject, toUpper, round } from "lodash-es";
9
9
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
10
10
  import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-DHfFLkem.js";
11
11
  import { getBlockComponent, getChaiDataProviders, useChaiBlocks, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
@@ -1290,9 +1290,7 @@ const useBlocksStoreManager = () => {
1290
1290
  },
1291
1291
  [a, o, r]
1292
1292
  ), addPredefinedBlock: a };
1293
- }, selectedStylingBlocksAtom = atom$1([]);
1294
- selectedStylingBlocksAtom.debugLabel = "selectedStylingBlocksAtom";
1295
- const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), STANDARD = [
1293
+ }, STANDARD = [
1296
1294
  0,
1297
1295
  1,
1298
1296
  2,
@@ -2353,9 +2351,11 @@ function generateFullClsName(o) {
2353
2351
  let r = "";
2354
2352
  return o.dark && (r += "dark:"), o.mq.toLowerCase() !== "xs" && (r += `${o.mq}:`), o.mod && (r += `${o.mod}:`), r += o.cls, r;
2355
2353
  }
2356
- const getSplitChaiClasses$1 = (o) => {
2354
+ const selectedStylingBlocksAtom = atom$1([]);
2355
+ selectedStylingBlocksAtom.debugLabel = "selectedStylingBlocksAtom";
2356
+ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), getSplitChaiClasses$1 = (o) => {
2357
2357
  if (o = o.replace(STYLES_KEY, ""), !o) return { baseClasses: "", classes: "" };
2358
- const r = o.split(/,(?![^[]*\])/);
2358
+ const r = o.split(/,(?![^\\[]*\])/);
2359
2359
  if (r.length === 1)
2360
2360
  return { baseClasses: "", classes: r[0].trim() };
2361
2361
  const [n, ...a] = r;
@@ -2512,9 +2512,6 @@ const addClassesToBlocksAtom = atom$1(null, (o, r, { blockIds: n, newClasses: a
2512
2512
  }, previewModeAtom = atom$1(!1), usePreviewMode = () => {
2513
2513
  const [o, r] = useAtom$1(previewModeAtom);
2514
2514
  return [o, r];
2515
- }, getSplitClasses = (o) => {
2516
- const r = o.replace(STYLES_KEY, "").split(",");
2517
- return { baseClasses: r[0], classes: r[1] };
2518
2515
  }, removeClassFromBlocksAtom = atom$1(null, (o, r, { blockIds: n, fullClasses: a }) => {
2519
2516
  const l = first(o(selectedStylingBlocksAtom)), i = filter(
2520
2517
  o(pageBlocksAtomsAtom),
@@ -2525,7 +2522,7 @@ const addClassesToBlocksAtom = atom$1(null, (o, r, { blockIds: n, newClasses: a
2525
2522
  );
2526
2523
  return map(i, (c) => {
2527
2524
  const d = o(c), u = a;
2528
- let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2525
+ let { classes: p, baseClasses: g } = getSplitChaiClasses$1(get(d, l.prop, `${STYLES_KEY},`));
2529
2526
  return each(u, (m) => {
2530
2527
  const f = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), b = new RegExp(`(^|\\s)${f}(?=\\s|$)`, "g");
2531
2528
  p = p.replace(b, " ").replace(/\s+/g, " ").trim();
@@ -2548,13 +2545,13 @@ const addClassesToBlocksAtom = atom$1(null, (o, r, { blockIds: n, newClasses: a
2548
2545
  const l = r({ blockIds: n, fullClasses: a });
2549
2546
  o(n, l[0].props);
2550
2547
  },
2551
- [r]
2548
+ [r, o]
2552
2549
  );
2553
2550
  }, selectedBlockAllClassesAtom = atom$1((o) => {
2554
2551
  const r = first(o(selectedStylingBlocksAtom)), n = o(selectedBlockAtom);
2555
2552
  if (!r || r.blockId !== get(n, "_id", null)) return [];
2556
- const l = get(n, r.prop, `${STYLES_KEY},`).replace(STYLES_KEY, "").split(",").join(" ");
2557
- return filter(map(l.trim().split(" "), constructClassObject), (i) => !isNull(i));
2553
+ const a = get(n, r.prop, `${STYLES_KEY},`), { classes: l } = getSplitChaiClasses$1(a);
2554
+ return console.log(l), filter(map(l.trim().split(" "), constructClassObject), (i) => !isNull(i));
2558
2555
  }), useSelectedBlockAllClasses = () => useAtomValue$1(selectedBlockAllClassesAtom), MQ = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, selectedBlockCurrentClassesAtom = atom$1((o) => {
2559
2556
  const r = o(canvasBreakpointAtom), n = o(styleStateAtom), a = o(darkModeAtom), l = getQueries(r);
2560
2557
  let i = filter(o(selectedBlockAllClassesAtom), { mod: n });
@@ -3682,7 +3679,7 @@ const getBlockRuntimeProps = memoize((o) => {
3682
3679
  l !== o.length - 1 && /* @__PURE__ */ jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3683
3680
  ] }, l))
3684
3681
  ] }) });
3685
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-4DqYRbd_.js")), CanvasArea = () => {
3682
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-BHPJY4Lq.js")), CanvasArea = () => {
3686
3683
  const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
3687
3684
  return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3688
3685
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -5198,7 +5195,7 @@ const ViewData = ({ data: o, fullView: r }) => {
5198
5195
  }
5199
5196
  )
5200
5197
  ] });
5201
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-4CFuSaLJ.js")), UploadImages = React__default.lazy(() => import("./UploadImages-C6ta5Prd.js")), ImagesPanel = ({
5198
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Q_lCXRbn.js")), UploadImages = React__default.lazy(() => import("./UploadImages-DzVE0gBu.js")), ImagesPanel = ({
5202
5199
  isModalView: o = !1,
5203
5200
  onSelect: r = () => {
5204
5201
  }
@@ -5883,7 +5880,7 @@ const AskAIStyles = ({ blockId: o }) => {
5883
5880
  });
5884
5881
  function ManualClasses() {
5885
5882
  var L;
5886
- const { t: o } = useTranslation(), [r] = useSelectedStylingBlocks(), n = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (L = first(r)) == null ? void 0 : L.prop, m = reject((get(n, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), f = () => {
5883
+ const { t: o } = useTranslation(), [r] = useSelectedStylingBlocks(), n = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (L = first(r)) == null ? void 0 : L.prop, { classes: m } = getSplitChaiClasses$1(get(n, g, "")), f = () => {
5887
5884
  const v = d.trim().replace(/ +(?= )/g, "").split(" ");
5888
5885
  a(i, v, !0), u("");
5889
5886
  }, [b, x] = useState([]), k = ({ value: v }) => {
@@ -5921,7 +5918,7 @@ function ManualClasses() {
5921
5918
  });
5922
5919
  return;
5923
5920
  }
5924
- navigator.clipboard.writeText(m.join(" ")), p({
5921
+ navigator.clipboard.writeText(m), p({
5925
5922
  title: o("Copied"),
5926
5923
  description: o("Classes copied to clipboard")
5927
5924
  });
@@ -5980,7 +5977,7 @@ function ManualClasses() {
5980
5977
  )
5981
5978
  ] }),
5982
5979
  /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5983
- m.map((v) => /* @__PURE__ */ jsxs(
5980
+ compact(m.split(" ")).map((v) => /* @__PURE__ */ jsxs(
5984
5981
  "div",
5985
5982
  {
5986
5983
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
@@ -9009,7 +9006,7 @@ const PageDataProviders = () => {
9009
9006
  function AiFillDatabase(o) {
9010
9007
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
9011
9008
  }
9012
- const TopBar = lazy(() => import("./Topbar-CF2ruRG5.js"));
9009
+ const TopBar = lazy(() => import("./Topbar-DcK6U-Nf.js"));
9013
9010
  function useSidebarMenuItems(o) {
9014
9011
  const r = o === "SINGLE_SIDE_PANEL", { t: n } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
9015
9012
  return useMemo(() => {