@chaibuilder/sdk 1.2.42 → 1.2.43
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--7JKHvJX.js → AddBlocks-9UM7zj57.js} +41 -41
- package/dist/{AddBlocks-HZaa1NM6.cjs → AddBlocks-_6X3bnJZ.cjs} +1 -1
- package/dist/{CanvasArea-CTmYdaUo.cjs → CanvasArea-HmbcRpgP.cjs} +1 -1
- package/dist/{CanvasArea-myZvxQCj.js → CanvasArea-a3WMBMi3.js} +2 -2
- package/dist/{ChaiBuilderEditor-GronwWg6.cjs → ChaiBuilderEditor--NV-B5az.cjs} +1 -1
- package/dist/{ChaiBuilderEditor-f4SJU7kK.js → ChaiBuilderEditor-yf2LRjL1.js} +2 -2
- package/dist/{CurrentPage-S5EFVi8y.js → CurrentPage-hKtVFDxU.js} +2 -2
- package/dist/{CurrentPage-hq3wJX-B.cjs → CurrentPage-rgu6shCq.cjs} +1 -1
- package/dist/{ListTree-PbmMwEnK.cjs → ListTree-fwN6Y_EA.cjs} +1 -1
- package/dist/{ListTree-un8hNvIi.js → ListTree-ulr_sjdn.js} +1 -1
- package/dist/{PagesPanel-f0XKYnEj.js → PagesPanel-EHLY-cfj.js} +3 -3
- package/dist/{PagesPanel-2zdTxUbm.cjs → PagesPanel-v6Nl5KWy.cjs} +1 -1
- package/dist/{ProjectPanel-RMEd0gwn.cjs → ProjectPanel-ck-mOBEg.cjs} +1 -1
- package/dist/{ProjectPanel-vbBl5OmU.js → ProjectPanel-qiqyRbwH.js} +3 -3
- package/dist/{Settings-UqeNroki.cjs → Settings-Rtk4HDKy.cjs} +1 -1
- package/dist/{Settings-Lsp-FmFS.js → Settings-a7j3ihRx.js} +2 -2
- package/dist/{SidePanels-zU4GsqbI.js → SidePanels-9XdRZ7rz.js} +149 -149
- package/dist/SidePanels-biCoYtzR.cjs +1 -0
- package/dist/{ThemeConfiguration-1rD36g89.js → ThemeConfiguration-MaGPPza1.js} +1 -1
- package/dist/{ThemeConfiguration-76oEQ5z0.cjs → ThemeConfiguration-f6AxqpmO.cjs} +1 -1
- package/dist/{Topbar--M5IjXGt.js → Topbar-OpgHjdWn.js} +1 -1
- package/dist/{Topbar-7bRZS3P8.cjs → Topbar-cDxKWgN6.cjs} +1 -1
- package/dist/{UILibrariesPanel-EaMt1AzV.js → UILibrariesPanel-HVpapacm.js} +53 -54
- package/dist/UILibrariesPanel-d08F5Ri0.cjs +1 -0
- package/dist/{UnsplashImages-o7mUozj7.js → UnsplashImages-Gx7dy6mp.js} +1 -1
- package/dist/{UnsplashImages-eq44FmxF.cjs → UnsplashImages-uyokFuF-.cjs} +1 -1
- package/dist/{UploadImages-s52Hvpts.js → UploadImages-aClrfKqQ.js} +1 -1
- package/dist/{UploadImages-o4teNCqv.cjs → UploadImages-kLPXfW7W.cjs} +1 -1
- package/dist/{add-page-modal-7FLXbRFp.cjs → add-page-modal-H5MTzKBT.cjs} +1 -1
- package/dist/{add-page-modal-eoOwcRKz.js → add-page-modal-kP7x8GYO.js} +3 -3
- package/dist/{confirm-alert-o0OjZdvp.js → confirm-alert-gemzBTIt.js} +1 -1
- package/dist/{confirm-alert-rFmTdGxh.cjs → confirm-alert-zZAmXzx0.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-sG2uFkT0.cjs → delete-page-modal-E8MFNVWF.cjs} +1 -1
- package/dist/{delete-page-modal-OU79XN8M.js → delete-page-modal-ER-TAzRL.js} +2 -2
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form--h34bK4z.js → form-UruaB3s_.js} +1 -1
- package/dist/{form-SuV0Z9nJ.cjs → form-l4PB76nt.cjs} +1 -1
- package/dist/{index-3mF2lq-B.cjs → index-PXyps6Qc.cjs} +1 -1
- package/dist/{index-7hLL3kv4.js → index-rKrjj7Vz.js} +2 -2
- package/dist/{page-viewer-tfXRwkWz.js → page-viewer-bCH5PPSH.js} +3 -3
- package/dist/{page-viewer-9-Dy66-a.cjs → page-viewer-wQq2qD96.cjs} +1 -1
- package/dist/{project-general-setting-ZbNwglNP.cjs → project-general-setting-A5OelyCo.cjs} +1 -1
- package/dist/{project-general-setting-ZjAN2VZX.js → project-general-setting-rdCQBkQZ.js} +3 -3
- package/dist/{project-seo-setting-vqWoo5Ev.cjs → project-seo-setting-Y_q0WJSy.cjs} +1 -1
- package/dist/{project-seo-setting-gAXZ15Wb.js → project-seo-setting-_SGBKl0c.js} +2 -2
- package/dist/{single-page-detail-ISRJ-Ebt.js → single-page-detail-H3Rb5gkJ.js} +4 -4
- package/dist/{single-page-detail-a4nAhK0N.cjs → single-page-detail-xAO7x8a1.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/{useCanvasSettings-EyxD8eas.cjs → useCanvasSettings-IalZcnSd.cjs} +1 -1
- package/dist/{useCanvasSettings-fsSISbZ6.js → useCanvasSettings-tkzd9Qrw.js} +1 -1
- package/package.json +1 -1
- package/dist/SidePanels-DimF3tJV.cjs +0 -1
- package/dist/UILibrariesPanel-1F_Kcnkm.cjs +0 -1
|
@@ -203,4 +203,4 @@ object-assign/index.js:
|
|
|
203
203
|
(c) Sindre Sorhus
|
|
204
204
|
@license MIT
|
|
205
205
|
*)
|
|
206
|
-
*/W();var nu1=process.env.NODE_ENV!=="production"?ru1:()=>null;function ou1(){return new URLSearchParams(window.location.search).has("dnd")}function su1(){return new URLSearchParams(window.location.search).has("outline")}const lu1={dnd:ou1(),arborist:su1()},Yr=l1.atom(null);Yr.debugLabel="chaiBuilderPropsAtom";const aL=l1.atom({});aL.debugLabel="chaiExternalDataAtom";class rL extends h.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?L.jsxRuntimeExports.jsxs("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",id:"errorBoundary",children:[L.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),L.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const iu1=()=>!1,uu1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},ga=T.memoize((t,e)=>{if(!t)return!0;const c=v3.getBlockComponent(t);return c&&T.has(c,"canAcceptBlock")?c.canAcceptBlock(e):!1}),du1=T.memoize((t,e)=>{const c=v3.getBlockComponent(e);return c&&T.has(c,"canBeNested")?c.canBeNested(t):!0}),hu1=T.memoize(t=>{const e=v3.getBlockComponent(t);return e&&T.has(e,"canDuplicate")?e.canDuplicate():!0}),vu1=T.memoize(t=>{const e=v3.getBlockComponent(t);return e&&T.has(e,"canDelete")?e.canDelete():!0});function nL(t,e,c){const a=T.filter(t,n=>n._parent===e),r=[];for(let n=0;n<a.length;n++){const o=sL(a[n]);if(Object.keys(o).length>0&&Object.keys(o).forEach(s=>{a[n][s]=`slot:${U4.generateUUID()}`}),T.filter(t,{_parent:a[n]._id}).length>0){const s=U4.generateUUID();r.push({...a[n],oldId:a[n]._id,_id:s,_parent:c}),r.push(T.flatten(nL(t,a[n]._id,s)))}else r.push({...a[n],oldId:a[n]._id,_id:U4.generateUUID(),_parent:c})}return T.flatten(r)}function oL(t){const e={};t.forEach(a=>{e[a._id]={...a,children:[]}});const c=[];return t.forEach(a=>{if(a._parent){const r=e[a._parent];r&&r.children.push(e[a._id])}else c.push(e[a._id])}),c}const sL=t=>{const e={};return Object.keys(t).forEach(c=>{T.isString(t[c])&&t[c].startsWith("slot")&&(e[c]=t[c].replace("slot:",""))}),e},fu1=(t,e,c=null)=>{let a=T.find(t,{_id:e});a={...a,oldId:a._id,_id:U4.generateUUID()},c&&(a={...a,_parent:c});const r=[a];T.filter(t,{_parent:e}).length>0&&r.push(T.flatten(nL(t,e,a._id)));const n=T.flatten(r);return T.map(n,o=>{const s=o,l=sL(s);return Object.keys(l).length>0&&Object.keys(l).forEach(u=>{const i=T.find(n,{oldId:l[u].replace("slot:","")});s[u]=`slot:${i._id}`}),T.omit(s,["global","oldId"])})};const S4=l1.atom([]);S4.debugLabel="presentBlocksAtom";const lL=l1.atom(t=>{const e=t(S4);return oL([...e])});lL.debugLabel="treeDSBlocks";S4.debugLabel="presentBlocksAtom";const Xr=re1(S4);Xr.debugLabel="pageBlocksAtomsAtom";const gu1=l1.atom("");gu1.debugLabel="builderActivePageAtom";const pu1=l1.atom(-1);pu1.debugLabel="destinationDropIndexAtom";const iL=l1.atom([]);iL.debugLabel="buildingBlocksAtom";const mu1=l1.atom(t=>{const e=t(iL);return T.filter(e,c=>T.has(c,"blockId"))});mu1.debugLabel="globalBlocksAtom";const Qr=l1.atom([]);Qr.debugLabel="selectedBlockIdsAtom";const _r=l1.atom(t=>{const e=t(S4),c=t(Qr);return T.map(T.filter(e,({_id:a})=>T.includes(c,a)),a=>({...a}))});_r.debugLabel="selectedBlocksAtom";const he=l1.atom(t=>{const e=t(_r);if(e.length===0)return null;if(e.length===1)return e[0]});he.debugLabel="selectedBlockAtom";const zu1=t=>T.get(t,"_parent",null),bu1=l1.atom(t=>{const e=t(_r),c=T.map(e,zu1);return T.filter(t(S4),a=>T.includes(c,a._id))});bu1.debugLabel="selectedBlocksParentsAtom";const uL=l1.atom(()=>!1);uL.debugLabel="selectedBlockFlexChildAtom";const dL=l1.atom(()=>!1);dL.debugLabel="selectedBlockGridChildAtom";const $r=l1.atom("");$r.debugLabel="styleStateAtom";const hL=g4("styleBreakpoint","xs");hL.debugLabel="styleBreakpointAtom";const Mu1=()=>({flexChild:l1.useAtomValue(uL),gridChild:l1.useAtomValue(dL)}),wu1=()=>l1.useAtomValue(he),Cu1=l1.atom(t=>{const e=t(he),c=t(S4);let a=e;const r=[e];do{const n=c.find(({_id:o})=>o===(a==null?void 0:a._parent));a=n,n&&r.push(n)}while(a!=null&&a._parent);return r}),vL=()=>l1.useAtomValue(Cu1),Vu1=()=>{const t=vL();return h.useMemo(()=>{for(let e=0;e<t.length;e++){const c=v3.getBlockComponent(t[e]._type),a=T.cloneDeep(T.get(c,"blockState",{}));if(!T.isEmpty(a))return{settings:a,block:t[e]}}return{}},[t])},Hu1=()=>{const t=vL();return h.useMemo(()=>{let e={};for(let c=0;c<t.length;c++){const a=v3.getBlockComponent(t[c]._type),r=T.get(a,"customStylingStates",{});e={...e,...r}}return e},[t])},p3=()=>{const[t,e]=l1.useAtom(Qr),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},pa=t=>{switch(t.type){case"singular":return t.uiSchema;case"model":const{properties:e}=t,c={};return Object.keys(e).forEach(n=>{const o=e[n];if(T.includes(["slot","styles"],o.type))return;const s=n;c[s]=pa(o)}),c;case"list":const{itemProperties:a}=t,r={items:{}};return Object.keys(a).forEach(n=>{const o=a[n];if(T.includes(["slot","styles"],o.type))return;const s=n;r.items[s]=pa(o)}),r;default:return{}}},ma=t=>{switch(t.type){case"singular":return t.schema;case"model":const{properties:e,title:c}=t,a={title:c,type:"object",properties:{}};return Object.keys(e).forEach(s=>{const l=e[s];if(T.includes(["slot","styles"],l.type))return;const u=s;a.properties[u]=ma(l)}),a;case"list":const{itemProperties:r,title:n}=t,o={title:n,type:"array",items:{type:"object",properties:{}}};return Object.keys(r).forEach(s=>{const l=r[s];if(T.includes(["slot","styles"],l.type))return;const u=s;o.items.properties[u]=ma(l),T.set(o.items,"title",T.get(l,"itemTitle",`${n} item`))}),o;default:return{}}},fL=t=>{if(!t)return{};const e={};return Object.keys(t).forEach(c=>{e[c]=xu1(t[c])}),e},yu1=t=>{if(T.isEmpty(t.default))return[];const{itemProperties:e}=t;return T.map(t.default,c=>{const a={...c};return T.forIn(c,(r,n)=>{T.has(e,n)&&T.get(e[n],"i18n",!1)&&(a[n]=x4.I18N_KEY)}),a})},xu1=t=>{switch(t.type){case"styles":return t.default;case"slot":return`${x4.SLOT_KEY}${U4.generateUUID()}`;case"singular":const{schema:e}=t;return T.get(e,"default","");case"model":return fL(t.properties);case"list":return yu1(t);default:return""}};const Lu1=(t,e)=>{const c={};return T.set(c,t,e),c};var tn={exports:{}},wv1=tn.exports;(function(t){(function(){"use strict";function e(a,r,n){return a.splice(r,!n||1+n-r+(!(n<0^r>=0)&&(n<0||-1)*a.length)),a.length}let c=function(){let a=[],r=-1,n=0,o=!1,s;function l(u,i){return!u||typeof u[i]!="function"?this:(o=!0,u[i](),o=!1,this)}return{add:function(u){return o?this:(a.splice(r+1,a.length-r),a.push(u),n&&a.length>n&&e(a,0,-(n+1)),r=a.length-1,s&&s(),this)},setCallback:function(u){s=u},undo:function(){let u=a[r];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"undo"),r-=1,u=a[r],!(!u||!u.groupId)););return s&&s(),this},redo:function(){let u=a[r+1];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"redo"),r+=1,u=a[r+1],!(!u||!u.groupId)););return s&&s(),this},clear:function(){let u=a.length;a=[],r=-1,s&&u>0&&s()},hasUndo:function(){return r!==-1},hasRedo:function(){return r<a.length-1},getCommands:function(u){return u?a.filter(i=>i.groupId===u):a},getIndex:function(){return r},setLimit:function(u){n=u}}};t.exports?t.exports=c:window.UndoManager=c})()})(tn);var Su1=tn.exports;const Au1=V4.getDefaultExportFromCjs(Su1),Fu1=l1.atom(Ec.BRANDING_OPTIONS_DEFAULTS),Bu1=l1.atom(null),ve=()=>{const[t,e]=l1.useAtom(Fu1);return[T.isObject(t)?{...Ec.BRANDING_OPTIONS_DEFAULTS,...t}:Ec.BRANDING_OPTIONS_DEFAULTS,e]},Eu1=()=>l1.useAtom(Bu1),Ou1=l1.atom(null),gL=()=>({currentPage:l1.useAtomValue(Ou1)});function Pu1(t){return oL(t)}const en=(t,e)=>T.flatten(t.map(c=>{if(c=e?{...c,_parent:e}:{...c},c.children){const a=[...c.children];return delete c.children,T.flatten([c,...en(a,c._id)])}return c}));function cn(t,e=!1){for(let c=0;c<t.length;c++){const a=t[c];a.global&&!e?t[c]={type:"GlobalBlock",blockId:a.blockId,_parent:T.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&cn(a.children)}}function pL(t){let e=[],c=T.filter(t,{type:"GlobalBlock"});return c.length>0&&(c=T.map(c,mL),T.each(c,a=>{e=[...e,...ku1(a)]})),e}function ku1(t){let e=[];const c=T.get(T.first(t),"_parent",null);T.set(T.first(t),"_parent",null);const a=[flatToNestedInstance.convert(zL(t))];cn(a,!0);let r=en(a,t[0]._id);return r=T.set(r,"0._parent",c),e=[...e,r,...pL(r)],e}function mL(t){const e=T.find(za,{_id:t._id});if(!e)return[];const c=[e],a=T.filter(za,{_parent:t._id});return a.length?T.flatten([...c,...T.flatten(T.map(a,mL))]):T.flatten(c)}const zL=t=>JSON.parse(JSON.stringify(t));let za=[];function Ru1(t){za=t;const e=Pu1(zL(t));cn(e);const c=en(e,null),a=pL(c),r={};return T.each(a,n=>T.set(r,T.first(n).blockId,n)),[c,r]}const bL=()=>{const[t]=ve(),{currentPage:e}=gL(),[c]=Q4();return h.useCallback(()=>{const a=T.map(c,n=>T.omit(n,["expanded","order","title","siblings","tempClasses"])),[r=[]]=Ru1(a);return{currentPage:e,blocks:r}},[t,e,c])},M2=(t,e=void 0)=>{const c=l1.useAtomValue(Yr);return T.get(c,t,e)},an=l1.atom([]);an.debugLabel="dataProvidersAtom";const rn=()=>l1.useAtom(an),I0=l1.atom("SAVED");I0.debugLabel="builderSaveStateAtom";const ML=()=>{const[t,e]=l1.useAtom(I0),c=M2("onSavePage",async u=>{}),a=M2("onSave",async u=>{}),r=M2("onSaveStateChange",T.noop),n=bL(),[o]=rn(),[s]=ve();return{savePage:ig.useThrottledCallback(async()=>{e("SAVING"),r("SAVING");const u=n();return await c({blocks:u.blocks,providers:o}),await a({blocks:u.blocks,providers:o,brandingOptions:s,themeConfiguration:s}),setTimeout(()=>{e("SAVED"),r("SAVED")},100),!0},[n,e,s,a,r],3e3),saveState:t,setSaveState:e}},q4=new Au1;q4.setLimit(50);const fe=()=>{const[,t]=l1.useAtom(I0),e=M2("onSaveStateChange",T.noop);return h.useEffect(()=>(q4.setCallback(()=>{t("UNSAVED"),e("UNSAVED")}),()=>{q4.setCallback(T.noop)}),[]),{add:q4.add,undo:q4.undo,redo:q4.redo,hasRedo:q4.hasRedo,hasUndo:q4.hasUndo,clear:q4.clear}},nn=(t,e)=>{const c=[],a=T.filter(t,r=>T.includes(e,r._id)||T.includes(e,r._parent)?(c.push(r._id),!1):!0);return T.isEmpty(c)?a:nn(a,c)},wL=()=>{const[t]=Q4(),[e,c]=p3(),{setNewBlocks:a}=N4();return h.useCallback(r=>{var o;const n=((o=T.find(t,{_id:r[0]}))==null?void 0:o._parent)||null;a(nn(t,r)),setTimeout(()=>c(n?[n]:[]),200)},[t,c,e])};function Iu1(t,e,c,a){let r=t.filter(s=>!s._parent);c&&(r=t.filter(s=>s._parent===c));const n=a!==void 0?a:r.length;let o=t.length;for(let s=0,l=0;s<t.length;s++)if(t[s]._parent===c){if(l===n){o=s;break}l++}return!c&&a!==void 0&&a>=r.length&&(o=t.length),[...t.slice(0,o),...e,...t.slice(o)]}function _f(t){const e=[],c=new Map;t.forEach(r=>{c.set(r._id,r)});function a(r){const n=c.get(r);e.includes(n)||(e.push(n),t.forEach(o=>{o._parent===r&&a(o._id)}))}return t.forEach(r=>{r._parent||a(r._id)}),e}const Nu1=(t,e,c,a)=>{if(T.isEmpty(e))return _f(t);function r(s,l){const u=s.filter(d=>d._parent===l);let i=[...u];return u.forEach(d=>{i=i.concat(r(s,d._id))}),i}const n=e.reduce((s,l)=>{const u=t.find(i=>i._id===l);if(u){const i=r(t,l);s.push(u,...i)}return s},[]);t=t.filter(s=>!n.includes(s)),n.forEach(s=>{e.includes(s._id)&&(s._parent=c)});let o;if(!c)o=a;else{const s=t.findIndex(l=>l._id===c);if(s===-1)o=a;else{o=s+1;let l=0;for(;l<a&&o<t.length;)t[o]._parent===c&&l++,o++}}return t.splice(o,0,...n),_f(t)},ju1=()=>{const[,t]=Q4();return{setNewBlocks:e=>{t(e)},addBlocks:(e,c,a)=>{t(r=>Iu1(r,e,c,a))},removeBlocks:e=>{t(c=>nn(c,e))},moveBlocks:(e,c,a)=>{t(r=>Nu1(r,e,c,a))},updateBlocksProps:e=>{t(c=>{const a=e.map(r=>r._id);return c.map(r=>{if(a.includes(r._id)){const n=T.find(e,{_id:r._id});return{...r,...T.omit(n,"_id")}}return r})})}}},Q4=()=>l1.useAtom(S4),N4=()=>{const{add:t}=fe(),[e]=Q4(),{setNewBlocks:c,addBlocks:a,removeBlocks:r,moveBlocks:n,updateBlocksProps:o}=ju1();return{moveBlocks:(p,g,m)=>{const z=T.map(p,w=>{const C=e.find(F=>F._id===w)._parent||null,S=e.filter(F=>C?F._parent===C:!F._parent).map(F=>F._id).indexOf(w);return{_id:w,oldParent:C,oldPosition:S}}),b=z.find(({_id:w})=>w===p[0]);b&&b.oldParent===g&&b.oldPosition===m||(n(p,g,m),t({undo:()=>T.each(z,({_id:w,oldParent:V,oldPosition:C})=>{n([w],V,C)}),redo:()=>n(p,g,m)}))},addBlocks:(p,g,m)=>{a(p,g,m),t({undo:()=>r(T.map(p,"_id")),redo:()=>a(p,g,m)})},removeBlocks:p=>{var b;const g=(b=T.first(p))==null?void 0:b._parent,z=e.filter(w=>g?w._parent===g:!w._parent).indexOf(T.first(p));r(T.map(p,"_id")),t({undo:()=>a(p,g,z),redo:()=>r(T.map(p,"_id"))})},updateBlocks:(p,g,m)=>{let z=[];if(m)z=T.map(p,b=>({_id:b,...m}));else{const b=T.keys(g);z=T.map(p,w=>{const V=e.find(H=>H._id===w),C={_id:w};return T.each(b,H=>C[H]=V[H]),C})}o(T.map(p,b=>({_id:b,...g}))),t({undo:()=>o(z),redo:()=>o(T.map(p,b=>({_id:b,...g})))})},updateBlocksRuntime:(p,g)=>{o(T.map(p,m=>({_id:m,...g})))},setNewBlocks:p=>{c(p),t({undo:()=>c(e),redo:()=>c(p)})},updateMultipleBlocksProps:p=>{let g=[];g=T.map(p,m=>{const z=T.keys(m),b=e.find(V=>V._id===m._id),w={};return T.each(z,V=>w[V]=b[V]),w}),o(p),t({undo:()=>o(g),redo:()=>o(p)})}}},CL=N3.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),VL=x.forwardRef(({className:t,variant:e,size:c,...a},r)=>L.jsxRuntimeExports.jsx(dg.Root,{ref:r,className:s1.cn(CL({variant:e,size:c,className:t})),...a}));VL.displayName=dg.Root.displayName;const HL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Oc.Root,{className:s1.cn("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",t),...e,ref:c,children:L.jsxRuntimeExports.jsx(Oc.Thumb,{className:s1.cn("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));HL.displayName=Oc.Root.displayName;const ge=N3.cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),i3=x.forwardRef(({className:t,variant:e,size:c,asChild:a=!1,...r},n)=>{const o=a?RA.Slot:"button";return L.jsxRuntimeExports.jsx(o,{className:s1.cn(ge({variant:e,size:c,className:t})),ref:n,...r})});i3.displayName="Button";const yL=E3.Root,on=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(E3.Item,{ref:c,className:s1.cn("border-b",t),...e}));on.displayName="AccordionItem";const sn=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(E3.Header,{className:"flex",children:L.jsxRuntimeExports.jsxs(E3.Trigger,{ref:a,className:s1.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...c,children:[e,c.hideArrow?null:L.jsxRuntimeExports.jsx(s2.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));sn.displayName=E3.Trigger.displayName;const ln=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(E3.Content,{ref:a,className:s1.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...c,children:L.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:e})}));ln.displayName=E3.Content.displayName;const Tu1=N3.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),xL=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx("div",{ref:a,role:"alert",className:s1.cn(Tu1({variant:e}),t),...c}));xL.displayName="Alert";const LL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h5",{ref:c,className:s1.cn("mb-1 font-medium leading-none tracking-tight",t),...e}));LL.displayName="AlertTitle";const SL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("text-sm [&_p]:leading-relaxed",t),...e}));SL.displayName="AlertDescription";const AL=N3.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),Du1=({className:t,variant:e,...c})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn(AL({variant:e}),t),...c}),FL=j2.Root,BL=j2.Trigger,EL=({className:t,...e})=>L.jsxRuntimeExports.jsx(j2.Portal,{className:s1.cn(t),...e});EL.displayName=j2.Portal.displayName;const OL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Overlay,{className:s1.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:c}));OL.displayName=j2.Overlay.displayName;const un=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs(EL,{children:[L.jsxRuntimeExports.jsx(OL,{}),L.jsxRuntimeExports.jsx(j2.Content,{ref:c,className:s1.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...e})]}));un.displayName=j2.Content.displayName;const dn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});dn.displayName="AlertDialogHeader";const hn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});hn.displayName="AlertDialogFooter";const vn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Title,{ref:c,className:s1.cn("text-lg font-semibold",t),...e}));vn.displayName=j2.Title.displayName;const fn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));fn.displayName=j2.Description.displayName;const gn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Action,{ref:c,className:s1.cn(ge(),t),...e}));gn.displayName=j2.Action.displayName;const pn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Cancel,{ref:c,className:s1.cn(ge({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));pn.displayName=j2.Cancel.displayName;const mn=J1.Root,PL=J1.Trigger,kL=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});kL.displayName=J1.Portal.displayName;const RL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{ref:c,className:s1.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));RL.displayName=J1.Overlay.displayName;const pe=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(kL,{children:[L.jsxRuntimeExports.jsx(RL,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:a,className:s1.cn("fixed left-[50%] top-[50%] z-[999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...c,children:[e,L.jsxRuntimeExports.jsxs(J1.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pe.displayName=J1.Content.displayName;const IL=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});IL.displayName="DialogHeader";const NL=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});NL.displayName="DialogFooter";const jL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold leading-none tracking-tight",t),...e}));jL.displayName=J1.Title.displayName;const TL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));TL.displayName=J1.Description.displayName;const DL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("rounded-xl border bg-card text-card-foreground shadow",t),...e}));DL.displayName="Card";const qL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("flex flex-col space-y-1.5 p-6",t),...e}));qL.displayName="CardHeader";const ZL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h3",{ref:c,className:s1.cn("font-semibold leading-none tracking-tight",t),...e}));ZL.displayName="CardTitle";const WL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("p",{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));WL.displayName="CardDescription";const UL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("p-6 pt-0",t),...e}));UL.displayName="CardContent";const KL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn(" flex items-center p-6 pt-0",t),...e}));KL.displayName="CardFooter";const GL=x.forwardRef(({className:t,type:e,...c},a)=>L.jsxRuntimeExports.jsx("input",{type:e,className:s1.cn("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...c}));GL.displayName="Input";const qu1=N3.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),JL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(hg.Root,{ref:c,className:s1.cn(qu1(),t),...e}));JL.displayName=hg.Root.displayName;const me=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("textarea",{className:s1.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:c,...e}));me.displayName="Textarea";const YL=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K2.Root,{ref:a,className:s1.cn("relative overflow-hidden",t),...c,children:[L.jsxRuntimeExports.jsx(K2.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),L.jsxRuntimeExports.jsx(zn,{}),L.jsxRuntimeExports.jsx(K2.Corner,{})]}));YL.displayName=K2.Root.displayName;const zn=x.forwardRef(({className:t,orientation:e="vertical",...c},a)=>L.jsxRuntimeExports.jsx(K2.ScrollAreaScrollbar,{ref:a,orientation:e,className:s1.cn("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",t),...c,children:L.jsxRuntimeExports.jsx(K2.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));zn.displayName=K2.ScrollAreaScrollbar.displayName;const XL=j3.Root,bn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.List,{ref:c,className:s1.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));bn.displayName=j3.List.displayName;const yt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Trigger,{ref:c,className:s1.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));yt.displayName=j3.Trigger.displayName;const xt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Content,{ref:c,className:s1.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));xt.displayName=j3.Content.displayName;const Zu1=y6.Portal,QL=y6.Provider,Wu1=y6.Root,Uu1=y6.Trigger,_L=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(y6.Content,{ref:a,sideOffset:e,className:s1.cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...c}));_L.displayName=y6.Content.displayName;const Ku1=u0.Root,Gu1=u0.Trigger,$L=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(u0.Portal,{children:L.jsxRuntimeExports.jsx(u0.Content,{ref:r,align:e,sideOffset:c,className:s1.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));$L.displayName=u0.Content.displayName;const Ju1=K1.Menu,Yu1=K1.Group,Xu1=K1.Portal,Qu1=K1.Sub,_u1=K1.RadioGroup,tS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Root,{ref:c,className:s1.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",t),...e}));tS.displayName=K1.Root.displayName;const eS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Trigger,{ref:c,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t),...e}));eS.displayName=K1.Trigger.displayName;const cS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.SubTrigger,{ref:r,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));cS.displayName=K1.SubTrigger.displayName;const aS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.SubContent,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));aS.displayName=K1.SubContent.displayName;const rS=x.forwardRef(({className:t,align:e="start",alignOffset:c=-4,sideOffset:a=8,...r},n)=>L.jsxRuntimeExports.jsx(K1.Portal,{children:L.jsxRuntimeExports.jsx(K1.Content,{ref:n,align:e,alignOffset:c,sideOffset:a,className:s1.cn("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));rS.displayName=K1.Content.displayName;const nS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Item,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...c}));nS.displayName=K1.Item.displayName;const oS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.CheckboxItem,{ref:r,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));oS.displayName=K1.CheckboxItem.displayName;const sS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K1.RadioItem,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));sS.displayName=K1.RadioItem.displayName;const lS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));lS.displayName=K1.Label.displayName;const iS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));iS.displayName=K1.Separator.displayName;const uS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});uS.displayname="MenubarShortcut";const $u1=St.Root,td1=St.Trigger,dS=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(St.Content,{ref:r,align:e,sideOffset:c,className:s1.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));dS.displayName=St.Content.displayName;const ed1=x2.Root,cd1=x2.Group,ad1=x2.Value,hS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Trigger,{ref:a,className:s1.cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...c,children:[e,L.jsxRuntimeExports.jsx(x2.Icon,{asChild:!0,children:L.jsxRuntimeExports.jsx(s2.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));hS.displayName=x2.Trigger.displayName;const vS=x.forwardRef(({className:t,children:e,position:c="popper",...a},r)=>L.jsxRuntimeExports.jsx(x2.Portal,{children:L.jsxRuntimeExports.jsx(x2.Content,{ref:r,className:s1.cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",c==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:c,...a,children:L.jsxRuntimeExports.jsx(x2.Viewport,{className:s1.cn("p-1",c==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));vS.displayName=x2.Content.displayName;const fS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Label,{ref:c,className:s1.cn("px-2 py-1.5 text-sm font-semibold",t),...e}));fS.displayName=x2.Label.displayName;const gS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Item,{ref:a,className:s1.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(x2.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),L.jsxRuntimeExports.jsx(x2.ItemText,{children:e})]}));gS.displayName=x2.Item.displayName;const pS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));pS.displayName=x2.Separator.displayName;const rd1=J1.Root,nd1=J1.Trigger,od1=J1.Close,mS=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});mS.displayName=J1.Portal.displayName;const zS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{className:s1.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:c}));zS.displayName=J1.Overlay.displayName;const sd1=N3.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),bS=x.forwardRef(({side:t="right",className:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(mS,{children:[L.jsxRuntimeExports.jsx(zS,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:r,className:s1.cn(sd1({side:t}),e),...a,children:[c,L.jsxRuntimeExports.jsxs(J1.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bS.displayName=J1.Content.displayName;const MS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});MS.displayName="SheetHeader";const wS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});wS.displayName="SheetFooter";const CS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold text-foreground",t),...e}));CS.displayName=J1.Title.displayName;const VS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));VS.displayName=J1.Description.displayName;const HS=_1.Root,yS=_1.Trigger,ld1=_1.Group,id1=_1.Portal,ud1=_1.Sub,dd1=_1.RadioGroup,xS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.SubTrigger,{ref:r,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));xS.displayName=_1.SubTrigger.displayName;const LS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.SubContent,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));LS.displayName=_1.SubContent.displayName;const Mn=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(_1.Portal,{children:L.jsxRuntimeExports.jsx(_1.Content,{ref:a,sideOffset:e,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...c})}));Mn.displayName=_1.Content.displayName;const f6=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Item,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...c}));f6.displayName=_1.Item.displayName;const SS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.CheckboxItem,{ref:r,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));SS.displayName=_1.CheckboxItem.displayName;const AS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(_1.RadioItem,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));AS.displayName=_1.RadioItem.displayName;const wn=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));wn.displayName=_1.Label.displayName;const Cn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));Cn.displayName=_1.Separator.displayName;const FS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest opacity-60",t),...e});FS.displayName="DropdownMenuShortcut";const BS=x.forwardRef(({className:t,orientation:e="horizontal",decorative:c=!0,...a},r)=>L.jsxRuntimeExports.jsx(vg.Root,{ref:r,decorative:c,orientation:e,className:s1.cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));BS.displayName=vg.Root.displayName;const hd1=1,vd1=1e6;let Fc=0;function fd1(){return Fc=(Fc+1)%Number.MAX_VALUE,Fc.toString()}const Bc=new Map,$f=t=>{if(Bc.has(t))return;const e=setTimeout(()=>{Bc.delete(t),i0({type:"REMOVE_TOAST",toastId:t})},vd1);Bc.set(t,e)},ES=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,hd1)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(c=>c.id===e.toast.id?{...c,...e.toast}:c)};case"DISMISS_TOAST":{const{toastId:c}=e;return c?$f(c):t.toasts.forEach(a=>{$f(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===c||c===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(c=>c.id!==e.toastId)}}},Z8=[];let W8={toasts:[]};function i0(t){W8=ES(W8,t),Z8.forEach(e=>{e(W8)})}function OS({...t}){const e=fd1(),c=r=>i0({type:"UPDATE_TOAST",toast:{...r,id:e}}),a=()=>i0({type:"DISMISS_TOAST",toastId:e});return i0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||a()}}}),{id:e,dismiss:a,update:c}}function ze(){const[t,e]=x.useState(W8);return x.useEffect(()=>(Z8.push(e),()=>{const c=Z8.indexOf(e);c>-1&&Z8.splice(c,1)}),[t]),{...t,toast:OS,dismiss:c=>i0({type:"DISMISS_TOAST",toastId:c})}}const gd1=l4.Provider,PS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Viewport,{ref:c,className:s1.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));PS.displayName=l4.Viewport.displayName;const pd1=N3.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),kS=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx(l4.Root,{ref:a,className:s1.cn(pd1({variant:e}),t),...c}));kS.displayName=l4.Root.displayName;const md1=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Action,{ref:c,className:s1.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));md1.displayName=l4.Action.displayName;const RS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Close,{ref:c,className:s1.cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"})}));RS.displayName=l4.Close.displayName;const IS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Title,{ref:c,className:s1.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));IS.displayName=l4.Title.displayName;const NS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Description,{ref:c,className:s1.cn("text-sm opacity-90",t),...e}));NS.displayName=l4.Description.displayName;function jS(){const{toasts:t}=ze();return L.jsxRuntimeExports.jsxs(gd1,{children:[t.map(({id:e,title:c,description:a,action:r,...n})=>L.jsxRuntimeExports.jsxs(kS,{...n,children:[L.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[c&&L.jsxRuntimeExports.jsx(IS,{children:c}),a&&L.jsxRuntimeExports.jsx(NS,{children:a})]}),r,L.jsxRuntimeExports.jsx(RS,{})]},e)),L.jsxRuntimeExports.jsx(PS,{})]})}const Vn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("animate-pulse rounded-md bg-primary/10",t),...e}),Hn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command,{ref:c,className:s1.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Hn.displayName=X2.Command.displayName;const zd1=({children:t,...e})=>L.jsxRuntimeExports.jsx(mn,{...e,children:L.jsxRuntimeExports.jsx(pe,{className:"overflow-hidden p-0",children:L.jsxRuntimeExports.jsx(Hn,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),TS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[L.jsxRuntimeExports.jsx(s2.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),L.jsxRuntimeExports.jsx(X2.Command.Input,{ref:c,className:s1.cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));TS.displayName=X2.Command.Input.displayName;const DS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.List,{ref:c,className:s1.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));DS.displayName=X2.Command.List.displayName;const qS=x.forwardRef((t,e)=>L.jsxRuntimeExports.jsx(X2.Command.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));qS.displayName=X2.Command.Empty.displayName;const ZS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Group,{ref:c,className:s1.cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));ZS.displayName=X2.Command.Group.displayName;const WS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Separator,{ref:c,className:s1.cn("-mx-1 h-px bg-border",t),...e}));WS.displayName=X2.Command.Separator.displayName;const US=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Item,{ref:c,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...e}));US.displayName=X2.Command.Item.displayName;const KS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});KS.displayName="CommandShortcut";const bd1=$1.Root,Md1=$1.Trigger,wd1=$1.Group,Cd1=$1.Portal,Vd1=$1.Sub,Hd1=$1.RadioGroup,GS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.SubTrigger,{ref:r,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));GS.displayName=$1.SubTrigger.displayName;const JS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.SubContent,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));JS.displayName=$1.SubContent.displayName;const YS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Portal,{children:L.jsxRuntimeExports.jsx($1.Content,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e})}));YS.displayName=$1.Content.displayName;const XS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Item,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...c}));XS.displayName=$1.Item.displayName;const QS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.CheckboxItem,{ref:r,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));QS.displayName=$1.CheckboxItem.displayName;const _S=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs($1.RadioItem,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));_S.displayName=$1.RadioItem.displayName;const $S=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...c}));$S.displayName=$1.Label.displayName;const tA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-border",t),...e}));tA.displayName=$1.Separator.displayName;const eA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});eA.displayName="ContextMenuShortcut";const yd1=t=>{try{const e=document.getElementById("icon-picker-field"),c=document.createElement("div");ba.render(L.jsxRuntimeExports.jsx(ug.IconPickerItem,{value:t}),c),e.appendChild(c),c.hidden=!0;let a=c.innerHTML;setTimeout(()=>e.removeChild(c),100);const n=new DOMParser().parseFromString(a,"image/svg+xml"),o=n.querySelector("svg");return o&&(o.removeAttribute("width"),o.removeAttribute("height")),new XMLSerializer().serializeToString(n)}catch(e){return console.error(e),""}},xd1=({value:t,onChange:e})=>{const c=a=>{e("<svg />");const r=yd1(a);e(r)};return L.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[L.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[L.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t?t.replace("<svg",'<svg class="h-5 w-5"'):"<svg class='h-5 w-5' />"},className:"absolute left-1/2 top-1/2 z-0 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white"}),L.jsxRuntimeExports.jsx(ug,{value:t?"BiSolidGrid":null,onChange:c,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),L.jsxRuntimeExports.jsx("textarea",{value:t,onChange:a=>e(a.target.value),className:"h-full w-full rounded-sm border border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},Ld1=h.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-eq44FmxF.cjs"))),Sd1=h.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-o4teNCqv.cjs"))),cA=({isModalView:t=!1,onSelect:e=()=>{}})=>{const c=M2("uploadMediaCallback"),a=M2("unsplashAccessKey"),r=c===void 0,n=a===void 0,[o,s]=h.useState(n?"upload":r?"unsplash":"upload");return L.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[L.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:L.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:t&&r?"Unsplash images":t?"Select or upload images":"Images"})}),L.jsxRuntimeExports.jsxs(XL,{value:o,onValueChange:l=>s(l),className:"flex h-full w-full flex-col py-2",children:[!(r||n)&&L.jsxRuntimeExports.jsxs(bn,{className:"w-full",children:[L.jsxRuntimeExports.jsx(yt,{value:"upload",className:"w-full",children:"Upload"}),L.jsxRuntimeExports.jsx(yt,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),o==="unsplash"?L.jsxRuntimeExports.jsx(xt,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(Ld1,{isModalView:t,onSelect:e})})}):L.jsxRuntimeExports.jsx(xt,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(Sd1,{isModalView:t,onSelect:e})})})]})]})},Ad1=Object.freeze(Object.defineProperty({__proto__:null,default:cA},Symbol.toStringTag,{value:"Module"})),tg=({children:t,onSelect:e})=>{const[c,a]=h.useState(!1),r=(...n)=>{e.call(void 0,...n),a(!1)};return L.jsxRuntimeExports.jsxs(mn,{open:c,onOpenChange:n=>a(n),children:[L.jsxRuntimeExports.jsx(PL,{asChild:!0,children:t}),L.jsxRuntimeExports.jsx(pe,{className:"flex h-3/4 max-w-5xl",children:L.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:L.jsxRuntimeExports.jsx(cA,{isModalView:!0,onSelect:r})})})]})},Fd1=({value:t,onChange:e,id:c,onBlur:a})=>{const r=M2("uploadMediaCallback"),n=M2("unsplashAccessKey"),o=r===void 0,s=n===void 0;return L.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?L.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):L.jsxRuntimeExports.jsx(tg,{onSelect:e,children:L.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),L.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(o&&s)&&L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(tg,{onSelect:e,children:L.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:t||!T.isEmpty(t)?"Replace Image":"Choose Image"})}),L.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),L.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:l}})=>a(c,l),onChange:l=>e(l.target.value)})]})]})},Bd1=({id:t,placeholder:e,value:c,onChange:a,onBlur:r})=>{const n={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},o=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:L.jsxRuntimeExports.jsx(QA,{id:t,value:c,onBlur:s=>r(t,s),onChange:s=>a(s),modules:n,formats:o,placeholder:e,className:"mt-1 rounded-md"})},Ed1=({schema:t,formData:e,onChange:c})=>{const[a,r]=h.useState([]),n=M2("getPages",()=>[]),{type:o="page",href:s="",target:l="self"}=e;return h.useEffect(()=>{(async()=>{const u=await n();r(u||[])})()},[]),L.jsxRuntimeExports.jsxs("div",{children:[L.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[L.jsxRuntimeExports.jsx("select",{name:"type",value:o,onChange:u=>c({...e,type:u.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(u=>L.jsxRuntimeExports.jsx("option",{value:u.const,children:u.title},u.const))}),o==="page"?L.jsxRuntimeExports.jsxs("select",{name:"href",value:s,onChange:u=>c({...e,href:u.target.value}),children:[L.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),T.map(a,u=>L.jsxRuntimeExports.jsx("option",{value:u.slug,children:u.name},u.uuid))]}):L.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:s,onChange:u=>c({...e,href:u.target.value}),placeholder:o==="page"||o==="url"?"Enter URL":o==="scroll"?"#ElementID":"Enter detail"}),(o==="page"||o==="url")&&L.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[L.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:l==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>c({...e,target:l==="_blank"?"_self":"_blank"})}),L.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},Od1=()=>{const[t]=Q4(),[,e]=p3(),{addBlocks:c}=N4(),{toast:a}=ze(),r=h.useCallback((o,s,l)=>{var f;for(let p=0;p<o.length;p++){const{_id:g}=o[p];o[p]._id=U4.generateUUID();const m=T.filter(o,{_parent:g});for(let z=0;z<m.length;z++)m[z]._parent=o[p]._id}const u=T.first(o);let i,d;return s&&(i=T.find(t,{_id:s}),o[0]._parent=s,d=s),!(i?ga(i._type,u._type):!0)&&i&&(o[0]._parent=i._parent,d=i._parent),c(o,d,l),e([(f=T.first(o))==null?void 0:f._id]),T.first(o)},[t,e]);return{addCoreBlock:h.useCallback((o,s,l)=>{if(T.has(o,"blocks")){const z=o.blocks;return r(z,s,l)}const u=U4.generateUUID(),i=fL(o.props),d=[];T.forIn(i,(z,b)=>{if(T.startsWith(z,x4.SLOT_KEY)){const w=z.replace(x4.SLOT_KEY,"");d.push({_id:w,_type:"Slot",_parent:u,_name:o.props[b].name,_styles:o.props[b].styles,_emptyStyles:o.props[b].emptyStyles})}});const v={_type:o.type,_id:u,...i};let f,p;if(s&&(f=T.find(t,{_id:s}),v._parent=s,p=s),!du1(f==null?void 0:f._type,o.type)){a({variant:"destructive",title:"Error",description:`"${o.type}" cannot be added under "${f?f==null?void 0:f._type:"root"}"`}),e([]);return}!(f?ga(f._type,o.type):!0)&&f&&(v._parent=f._parent,p=f._parent);const m=[v,...d];return c(m,p,l),e([v._id]),v},[r,t,e]),addPredefinedBlock:r}},eg={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},cg=["xs","sm","md","lg","xl","2xl"];function Pd1(t,e){if(e===null)return"baseClasses";const c=e.mq;if(c==="xs"||e.dark||e.mod!=="")return"classes";let a="baseClasses",r=cg.indexOf(c);for(;r>0;){const n=cg[r-1];if(T.find(t,{mq:n,property:e.property})){a="classes";break}r--}return a}const ag=[];function kd1(t="",e="",c=[]){t=t.trim().replace(/ +/g,"");let a=T.filter(T.map(t.split(" "),s1.constructClassObject),u=>!T.isNull(u)),r=T.filter(T.map(e.split(" "),s1.constructClassObject),u=>!T.isNull(u));r=T.filter(r,u=>!T.includes(ag,u.property));const n=[],o=[];T.each(c,u=>{const i=s1.constructClassObject(u),d=T.find(a,T.pick(i,["dark","mq","mod","property"]));if(d&&(a=T.filter(a,v=>v.fullCls!==(d==null?void 0:d.fullCls))),n.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(r=T.filter(r,v=>v.property!==i.property)),Pd1(a,i)==="baseClasses"&&!T.includes(ag,i.property)){const v=T.find(r,T.pick(i,["property"]));d&&(r=T.filter(r,f=>f.fullCls!==(v==null?void 0:v.fullCls))),o.push({...i,fullCls:i.cls,mq:"xs"})}});const s=T.map(T.sortBy([...a,...n],u=>eg[u.mq]),"fullCls").join(" ");return`${T.map(T.sortBy([...r,...o],u=>eg[u.mq]),"fullCls").join(" ").trim()},${s.trim()}`.trim().replace(/ +/g,"")}const N0=l1.atom([]);N0.debugLabel="selectedStylingBlocksAtom";const aA=()=>l1.useAtom(N0),Rd1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},Id1=l1.atom(null,(t,e,{blockIds:c,newClasses:a})=>{const r=T.filter(t(Xr),o=>c.includes(t(o)._id)),n=T.first(t(N0));return T.map(r,o=>{const s=t(o),l=T.get(s,n.prop,`${x4.STYLES_KEY},`),{baseClasses:u,classes:i}=Rd1(l);return{ids:[s._id],props:{[n.prop]:`${x4.STYLES_KEY}${kd1(i,u,a)}`}}})}),Nd1=()=>{const t=l1.useSetAtom(Id1),{updateBlocks:e,updateBlocksRuntime:c}=N4();return h.useCallback((a,r,n=!1)=>{const o=t({blockIds:a,newClasses:r});if(!n){c(a,o[0].props);return}e(a,o[0].props)},[t])},rA=()=>l1.useAtom(hL),nA=g4("canvasWidth",800),oA=l1.atom(t=>{const e=t(nA);return U4.getBreakpointValue(e).toLowerCase()}),jd1=()=>{const[t,e]=l1.useAtom(nA),c=l1.useAtomValue(oA),[a,r]=rA();return h.useEffect(()=>{a!=="xs"&&r(c)},[c,a,r]),[t,c,e]},Td1=g4("canvasZoom",100),Dd1=()=>l1.useAtom(Td1),sA=l1.atom([]),lA=()=>{const[t,e]=l1.useAtom(sA),c=l1.useSetAtom(yn),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},yn=l1.atom([]),qd1=()=>{const[t,e]=l1.useAtom(yn),c=l1.useSetAtom(sA),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},iA=g4("darkMode",!1),Zd1=()=>{const[t,e]=l1.useAtom(iA);return[t,e]},xn=()=>{const[t]=Q4(),[,e]=p3(),{addBlocks:c}=N4();return h.useCallback((a,r=null)=>{const n=[];T.each(a,o=>{const s=t.find(v=>v._id===o);r||(r=s._parent);const i=T.filter(t,v=>T.isString(r)?v._parent===r:!s._parent).indexOf(s)+1,d=fu1(t,o,r);c(d,r,i),n.push(T.get(d,"0._id",""))}),e(n)},[t,e])},Wd1=l1.atom([]),Ud1=()=>{const[t,e]=l1.useAtom(Wd1),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},Kd1=l1.atom(""),uA=()=>l1.useAtom(Kd1),Gd1=()=>{const t=l1.useAtomValue(S4);return h.useCallback((e,c)=>{const a=T.map(t,r=>(T.includes(e,T.get(r,"_id"))&&T.set(r,"_parent",c),r));console.log("newBlocks",a)},[t])},Jd1=()=>{console.warn("usePasteBlocks is not implemented");const t=l1.useAtomValue(yn),[e,c]=lA(),a=xn(),r=Gd1();return{canPaste:h.useMemo(()=>e.length>0||t.length>0,[t,e]),pasteBlocks:h.useCallback(o=>{T.isEmpty(t)?r(e,o):a(t,o),c(()=>[])},[e,t,a,r,c])}},Yd1=l1.atom(!1),dA=()=>{const[t,e]=l1.useAtom(Yd1);return[t,e]},Xd1=l1.atom(null,(t,e,{blockIds:c,fullClasses:a})=>{const r=T.first(t(N0)),n=T.filter(t(Xr),o=>c.includes(t(o)._id));return T.map(n,o=>{const s=t(o),l=a;let{classes:u,baseClasses:i}=uu1(T.get(s,r.prop,"styles:,"));return T.each(l,d=>{const v=d.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),f=new RegExp(`(^| )${v}($| )`,"g");u=u.replace(f," ").replace(/ +/g," ").trim();const p=T.first(d.split(":"));T.includes(["2xl","xl","lg","md","sm"],p)&&l.push(d.split(":").pop().trim())}),T.each(l,d=>{const v=new RegExp(`(^| )${d.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(v," ").replace(/ +/g," ").trim()}),{ids:[s._id],props:{[r.prop]:`${x4.STYLES_KEY}${i},${u}`}}})}),Qd1=()=>{const{updateBlocks:t}=N4(),e=l1.useSetAtom(Xd1);return h.useCallback((c,a)=>{const r=e({blockIds:c,fullClasses:a});t(c,r[0].props)},[e])},hA=l1.atom(t=>{const e=T.first(t(N0)),c=t(he);if(!e||e.blockId!==T.get(c,"_id",null))return[];const r=T.get(c,e.prop,`${x4.STYLES_KEY},`).replace(x4.STYLES_KEY,"").split(",").join(" ");return T.filter(T.map(r.trim().split(" "),s1.constructClassObject),n=>!T.isNull(n))}),_d1=()=>l1.useAtomValue(hA),rg={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},$d1=l1.atom(t=>{const e=t(oA),c=t($r),a=t(iA),r=th1(e);let n=T.filter(t(hA),{mod:c});return T.startsWith(c,"_")||(n=T.filter(n,o=>r.includes(o.mq))),n=n.sort((o,s)=>rg[o.mq]-rg[s.mq]),a||(n=T.filter(n,{dark:!1})),n}),th1=t=>{let e=[];switch(t){case"xs":e=["xs"];break;case"sm":e=["xs","sm"];break;case"md":e=["xs","sm","md"];break;case"lg":e=["xs","sm","md","lg"];break;case"xl":e=["xs","sm","md","lg","xl"];break;case"2xl":e=["xs","sm","md","lg","xl","2xl"];break;default:e=["xs"];break}return e},eh1=()=>l1.useAtomValue($d1),ch1=()=>l1.useAtom($r),ah1=()=>{const{updateBlocks:t}=N4();return h.useCallback((e,c,a)=>{t(e,c,a)},[t])};const rh1=()=>{const{updateBlocksRuntime:t}=N4();return h.useCallback(async(e,c,a=30)=>{const r=T.keys(T.omit(c,["_id"]));for(const n of r){const o=c[n];if(T.isString(o)){const s=T.chunk(o.split(""),12);let l="";t([e],{[n]:""});for(let u=0;u<s.length;u++)l+=s[u].join(""),t([e],{[n]:l}),await new Promise(i=>setTimeout(i,a))}}},[t])},nh1=()=>{const{updateMultipleBlocksProps:t}=N4(),e=rh1();return h.useCallback(async c=>{for(const a of c)await e(a._id,a);t(c)},[t])},oh1=()=>{const{updateBlocksRuntime:t}=N4();return h.useCallback((e,c)=>{t(e,c)},[t])},vA={name:"",props:{},modalProps:{},backdropClose:!0},sh1=l1.atom(vA),lh1=()=>{const[t,e]=l1.useAtom(sh1),c=h.useCallback((r,n={},o={})=>{e({name:r,props:n,modalProps:o})},[e]),a=h.useCallback((...r)=>{T.get(t,"props.onClose",()=>{})(...r),e(vA)},[e,t]);return{activeModal:t,openModal:c,closeModal:a}},ih1=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),l1.useAtomValue(S4)),fA=l1.atom(!1);fA.debugLabel="readOnlyModeAtom";const gA=l1.atom("online");gA.debugLabel="networkModeAtom";const uh1=l1.atom(!1);uh1.debugLabel="codeEditorOpenAtom";const pA=l1.atom(!1);pA.debugLabel="editLayerNameAtom";const dh1=l1.atom("");dh1.debugLabel="activeLanguageAtom";const hh1=l1.atom("");hh1.debugLabel="primaryLanguageAtom";const mA=l1.atom(null);mA.debugLabel="canvasIframeAtom";const zA=l1.atom("outline");zA.debugLabel="activePanelAtom";const bA=l1.atom("");bA.debugLabel="showPredefinedBlockCategoryAtom";const MA=l1.atom({undoCount:0,redoCount:0});MA.debugLabel="historyStatesAtom";const wA=l1.atom("");wA.debugLabel="inlineEditingActiveAtom";const CA=l1.atom(!1);CA.debugLabel="draggingFlagAtom";const VA=l1.atom("");VA.debugLabel="draggedBlockIdAtom";const HA=l1.atom(null);HA.debugLabel="treeRefAtom";const yA=l1.atom({});yA.debugLabel="canvasSettingsAtom";const be=l1.atom(!1);be.debugLabel="askAiActiveBlockAtom";const vh1=()=>l1.useAtomValue(fA),fh1=l1.atom(""),gh1=l1.atom(null),ph1=()=>l1.useAtom(fh1),mh1=()=>l1.useAtom(gh1),zh1=g4("selectedBreakpoints",["XS","MD","XL"]),bh1=()=>{const[t,e]=l1.useAtom(zh1);return[t,e]},xA=()=>{const t=l1.useSetAtom(MA),{clear:e}=fe(),[,c]=p3(),[,a]=uA(),[,r]=aA(),[,n]=_2(be);return()=>{c([]),r([]),a(""),e(),n(!1),t({undoCount:0,redoCount:0})}},Mh1=()=>({data:M2("uiLibraries",[]),isLoading:!1}),wh1=()=>{const[t,e]=h.useState(null),c=h.useCallback(async a=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),e(a),!0}catch(r){return console.warn("Copy failed",r),e(null),!1}},[]);return[t,c]},Ch1=()=>{const[t,e]=dA(),{t:c}=Lt.useTranslation(),a=M2("previewComponent",null);return t?L.jsxRuntimeExports.jsxs("div",{className:U4.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[L.jsxRuntimeExports.jsxs(i3,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>e(!1),children:[L.jsxRuntimeExports.jsx(s2.EyeClosedIcon,{}),L.jsxRuntimeExports.jsx("span",{children:c("Close Preview")})]}),L.jsxRuntimeExports.jsx("div",{children:a?L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx(Vn,{className:"h-96 w-full"}),children:h.createElement(a)}):null})]}):null},Vh1=()=>{const[t,e]=p3(),c=wL(),a=xn(),{undo:r,redo:n}=fe();P6.useHotkeys("esc",()=>e([]),{},[e]),P6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),P6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),P6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),P6.useHotkeys("del, backspace",o=>{o.preventDefault(),c(t)},{},[t,c])},Hh1=(t,e)=>{const c=[];let a=T.find(t,{_id:e}),r=T.get(a,"_parent","");for(;T.isString(r)&&!T.isEmpty(r);)c.push(a==null?void 0:a._parent),a=T.find(t,{_id:r}),r=a==null?void 0:a._parent;return T.flatten(c)},yh1=l1.atom([]),xh1=()=>{const[t]=p3(),e=l1.useAtomValue(S4),[,c]=l1.useAtom(yh1);h.useEffect(()=>{let a=[];const r=T.first(t);T.isString(r)&&(a=[r,...Hh1(e,r)]),c(a)},[t,e,c])};const LA=()=>l1.useAtom(aL),Lh1=()=>h.useMemo(()=>v3.getChaiDataProviders(),[]),Sh1=({children:t})=>{const[,e]=LA(),[c]=rn(),a=Lh1();return h.useEffect(()=>(e({}),T.each(c,r=>{const n=T.find(a,{providerKey:r.providerKey});if(n){const o=(n==null?void 0:n.mockFn)||(n==null?void 0:n.dataFn);o&&o(r.args).then(s=>e(l=>({...l,[r.providerKey]:s})))}}),()=>{T.each(c,r=>{e(n=>(delete n[r.providerKey],n))})}),[a,c,e]),L.jsxRuntimeExports.jsx(L.jsxRuntimeExports.Fragment,{children:t})};function Ah1(t,e,c){c.push(T.find(t,{_id:e}));const a=T.filter(t,{_parent:e});for(const r of a)c.push(...SA(r._id,t));return c}const SA=(t,e)=>{let c=[];return c=T.flattenDeep([...c,...Ah1(e,t,c)]),c},Fh1=l1.atom(!1),AA=()=>{const[t,e]=l1.useAtom(Fh1),[c,a]=h.useState(null),r=M2("askAiCallBack",null),n=nh1(),[o]=Q4();return{askAi:h.useCallback(async(s,l,u)=>{if(r){e(!0),a(null);try{const i=T.cloneDeep(SA(s,o));T.set(i,"0._parent",null);const{blocks:d,error:v}=await r(l,i);if(v){a(v);return}n(d)}catch(i){a(i)}finally{e(!1),u&&u()}}},[r,o]),loading:t,error:c}};var FA={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ng=h.createContext&&h.createContext(FA),u3=function(){return u3=Object.assign||function(t){for(var e,c=1,a=arguments.length;c<a;c++){e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},u3.apply(this,arguments)},Bh1=function(t,e){var c={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(c[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(t);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(t,a[r])&&(c[a[r]]=t[a[r]]);return c};function BA(t){return t&&t.map(function(e,c){return h.createElement(e.tag,u3({key:c},e.attr),BA(e.child))})}function j0(t){return function(e){return h.createElement(Eh1,u3({attr:u3({},t.attr)},e),BA(t.child))}}function Eh1(t){var e=function(c){var a=t.attr,r=t.size,n=t.title,o=Bh1(t,["attr","size","title"]),s=r||c.size||"1em",l;return c.className&&(l=c.className),t.className&&(l=(l?l+" ":"")+t.className),h.createElement("svg",u3({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},c.attr,a,o,{className:l,style:u3(u3({color:t.color||c.color},c.style),t.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),n&&h.createElement("title",null,n),t.children)};return ng!==void 0?h.createElement(ng.Consumer,null,function(c){return e(c)}):e(FA)}function Oh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(t)}function Ph1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(t)}function kh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(t)}function Rh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V285.7l-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"}}]})(t)}const Ih1=[{name:"Improve writing",icon:Rh1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:Oh1,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:s2.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:s2.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:s2.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:A3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:A3.ShuffleIcon,prompt:"Randomize all text elements."}];function Nh1({onClick:t}){const{loading:e}=AA();return L.jsxRuntimeExports.jsx("div",{className:e?"pointer-events-none opacity-50":"",children:L.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:Ih1.map(({name:c,icon:a,subMenus:r,prompt:n})=>r?L.jsxRuntimeExports.jsxs(HS,{children:[L.jsxRuntimeExports.jsx(yS,{asChild:!0,children:L.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c)}),L.jsxRuntimeExports.jsxs(Mn,{children:[L.jsxRuntimeExports.jsx(wn,{children:"My Account"}),L.jsxRuntimeExports.jsx(Cn,{}),L.jsxRuntimeExports.jsx(f6,{children:"Profile"}),L.jsxRuntimeExports.jsx(f6,{children:"Billing"}),L.jsxRuntimeExports.jsx(f6,{children:"Team"}),L.jsxRuntimeExports.jsx(f6,{children:"Subscription"})]})]}):L.jsxRuntimeExports.jsxs("li",{onClick:()=>t(n),className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c))})})}const jh1=({blockId:t})=>{const{t:e}=Lt.useTranslation(),{askAi:c,loading:a,error:r}=AA(),[n,o]=h.useState(""),s=h.useRef(null);h.useEffect(()=>{var u;(u=s.current)==null||u.focus()},[]);const l=()=>{r||o("")};return t?L.jsxRuntimeExports.jsxs("div",{className:"mt-4",children:[L.jsxRuntimeExports.jsxs("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:[e("Ask AI")," (GPT-4o mini)"]}),L.jsxRuntimeExports.jsx(me,{ref:s,value:n,onChange:u=>o(u.target.value),placeholder:e("Ask AI to edit content"),className:"w-full border border-gray-400 focus:border",rows:3,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c(t,n,l))}}),L.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:L.jsxRuntimeExports.jsx(i3,{disabled:n.trim().length<5||a,onClick:()=>c(t,n,l),variant:"default",className:"w-fit",size:"sm",children:a?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(A3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Edit with AI")}),a?L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[L.jsxRuntimeExports.jsxs(Vn,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[L.jsxRuntimeExports.jsx(Ph1,{className:"h-4 w-4 animate-spin text-gray-500"}),L.jsxRuntimeExports.jsx("p",{className:"text-xs",children:e("Generating... Please wait")})]}),L.jsxRuntimeExports.jsx(i3,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:e("Stop")})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:r.message})}),L.jsxRuntimeExports.jsx(Nh1,{onClick:u=>c(t,u,l)})]}):L.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:L.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[L.jsxRuntimeExports.jsx(A3.SparklesIcon,{className:"mx-auto text-3xl"}),L.jsxRuntimeExports.jsx("h1",{children:e("no_block_selected_for_ask_ai")})]})})},Th1=({onOpen:t})=>{const{t:e}=Lt.useTranslation(),c=M2("aiContext",""),[a,r]=h.useState(c),n=h.useRef(null),o=M2("saveAiContextCallback",T.noop),[s,l]=h.useState(!1),[u,i]=h.useState(null),[d,v]=h.useState(!1),{toast:f}=ze(),p=h.useRef(null);h.useEffect(()=>{c&&r(c)},[c]);const g=async()=>{try{l(!0),i(null),await o(a),f({title:e("AI Context updated"),description:e("You can now ask AI to edit your content"),variant:"default"}),p.current.click()}catch(m){i(m)}finally{l(!1)}};return L.jsxRuntimeExports.jsx(yL,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"-mx-2 -mt-2 bg-gray-100 px-2",children:L.jsxRuntimeExports.jsxs(on,{value:"set-context",children:[L.jsxRuntimeExports.jsx(sn,{ref:p,hideArrow:!0,className:"py-2 hover:no-underline",children:L.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between",children:[L.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:e("Set Context For AI")}),L.jsxRuntimeExports.jsxs(i3,{variant:"default",size:"sm",children:[L.jsxRuntimeExports.jsx("span",{children:e(d?"Cancel":"Edit")})," ",d?L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}):L.jsxRuntimeExports.jsx(A3.EditIcon,{className:"h-4 w-4"})]})]})}),L.jsxRuntimeExports.jsxs(ln,{children:[L.jsxRuntimeExports.jsx(me,{ref:n,value:a,onChange:m=>r(m.target.value),placeholder:e("Tell about this page. Eg: This page is about ..."),className:"w-full border border-gray-400 bg-background focus:border",rows:10,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),g())}}),c.trim().length===0?L.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:e("Eg: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.")}):null,L.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[L.jsxRuntimeExports.jsx(i3,{disabled:a.trim().length<5,onClick:()=>g(),variant:"default",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(A3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Save")}),c.trim().length>0?L.jsxRuntimeExports.jsxs(FL,{children:[L.jsxRuntimeExports.jsx(BL,{asChild:!0,children:L.jsxRuntimeExports.jsx(i3,{disabled:c.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(A3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Delete")})}),L.jsxRuntimeExports.jsxs(un,{children:[L.jsxRuntimeExports.jsxs(dn,{children:[L.jsxRuntimeExports.jsx(vn,{children:e("Remove context?")}),L.jsxRuntimeExports.jsx(fn,{})]}),L.jsxRuntimeExports.jsxs(hn,{children:[L.jsxRuntimeExports.jsx(pn,{children:e("Cancel")}),L.jsxRuntimeExports.jsx(gn,{onClick:()=>{r(""),g()},children:"Yes, Delete"})]})]})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:u&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:u.message})})]})]})})},Dh1=()=>{const[t]=p3(),[e,c]=h.useState(!1);return L.jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 z-50 h-full w-full bg-background p-2",children:[L.jsxRuntimeExports.jsx(Th1,{onOpen:a=>c(a)}),e?null:L.jsxRuntimeExports.jsx(jh1,{blockId:T.first(t)})]})},qh1=h.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-DimF3tJV.cjs"))),Zh1=h.lazy(()=>Promise.resolve().then(()=>require("./Topbar-7bRZS3P8.cjs"))),Wh1=h.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-CTmYdaUo.cjs"))),Uh1=h.lazy(()=>Promise.resolve().then(()=>require("./Settings-UqeNroki.cjs"))),Kh1=()=>{const{savePage:t}=ML(),e=M2("autoSaveSupport",!0),c=M2("autoSaveInterval",60);ig.useIntervalEffect(()=>{e&&t()},c*1e3)},Gh1=()=>{const[t]=l1.useAtom(I0),[e]=l1.useAtom(be),c=n=>{iu1()||n.preventDefault()};Vh1(),xh1(),Kh1(),h.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=M2("editable",!0),r=M2("nonEditableComponent",null);return L.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:L.jsxRuntimeExports.jsxs(QL,{children:[L.jsxRuntimeExports.jsxs("div",{onContextMenu:c,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[L.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Zh1,{})})}),L.jsxRuntimeExports.jsxs("main",{className:"relative flex h-full flex-1 flex-row",children:[a?null:L.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-[500] flex h-full w-full items-center justify-center backdrop-blur-[2px]",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(r)})}),L.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-fit border-border",style:{maxHeight:"calc(100vh - 56px)"},children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(qh1,{})})}),L.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Wh1,{})})}),L.jsxRuntimeExports.jsxs("div",{className:"relative flex h-[100%] w-[280px] min-w-[280px] border-l border-border pb-10",children:[L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Uh1,{})}),e?L.jsxRuntimeExports.jsx(Dh1,{}):null]})]})]}),L.jsxRuntimeExports.jsx(Ch1,{})]})})},og=l1.getDefaultStore(),Jh1=()=>L.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:L.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:L.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[L.jsxRuntimeExports.jsx("img",{src:"https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",alt:"Chai Builder",className:"mx-auto w-14 rounded-full"}),L.jsxRuntimeExports.jsx("br",{}),L.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),L.jsxRuntimeExports.jsx("p",{className:"mt-6 text-sm font-medium leading-6 text-white text-opacity-70",children:"Please view this page on greater than 1280px screen width."})]})})});let Yh1=!1;const Xh1=t=>{Yh1=t};const Qh1=t=>{const[,e]=Q4(),[,c]=ve(),a=xA();return h.useEffect(()=>{og.set(Yr,T.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),h.useEffect(()=>{og.set(an,t.dataProviders||[])},[t.dataProviders]),h.useEffect(()=>{e(v3.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),h.useEffect(()=>{lg.changeLanguage(t.locale||"en")},[t.locale]),h.useEffect(()=>{Xh1(t.showDebugLogs)},[t.showDebugLogs]),h.useEffect(()=>{c(t.brandingOptions)},[t.brandingOptions,c]),L.jsxRuntimeExports.jsx(Gh1,{})},_h1=t=>{const e=t._flags||{};return L.jsxRuntimeExports.jsxs(rL,{children:[L.jsxRuntimeExports.jsxs(OA.FlagsProvider,{features:{...lu1,...e},children:[L.jsxRuntimeExports.jsx(nu1,{}),L.jsxRuntimeExports.jsx(Jh1,{}),L.jsxRuntimeExports.jsx(Qh1,{...t})]}),L.jsxRuntimeExports.jsx(jS,{})]})};exports.Accordion=yL;exports.AccordionContent=ln;exports.AccordionItem=on;exports.AccordionTrigger=sn;exports.Alert=xL;exports.AlertDescription=SL;exports.AlertDialog=FL;exports.AlertDialogAction=gn;exports.AlertDialogCancel=pn;exports.AlertDialogContent=un;exports.AlertDialogDescription=fn;exports.AlertDialogFooter=hn;exports.AlertDialogHeader=dn;exports.AlertDialogTitle=vn;exports.AlertDialogTrigger=BL;exports.AlertTitle=LL;exports.Badge=Du1;exports.BlocksExternalDataProvider=Sh1;exports.Button=i3;exports.Card=DL;exports.CardContent=UL;exports.CardDescription=WL;exports.CardFooter=KL;exports.CardHeader=qL;exports.CardTitle=ZL;exports.ChaiBuilderEditor=_h1;exports.Command=Hn;exports.CommandDialog=zd1;exports.CommandEmpty=qS;exports.CommandGroup=ZS;exports.CommandInput=TS;exports.CommandItem=US;exports.CommandList=DS;exports.CommandSeparator=WS;exports.CommandShortcut=KS;exports.ContextMenu=bd1;exports.ContextMenuCheckboxItem=QS;exports.ContextMenuContent=YS;exports.ContextMenuGroup=wd1;exports.ContextMenuItem=XS;exports.ContextMenuLabel=$S;exports.ContextMenuPortal=Cd1;exports.ContextMenuRadioGroup=Hd1;exports.ContextMenuRadioItem=_S;exports.ContextMenuSeparator=tA;exports.ContextMenuShortcut=eA;exports.ContextMenuSub=Vd1;exports.ContextMenuSubContent=JS;exports.ContextMenuSubTrigger=GS;exports.ContextMenuTrigger=Md1;exports.Dialog=mn;exports.DialogContent=pe;exports.DialogDescription=TL;exports.DialogFooter=NL;exports.DialogHeader=IL;exports.DialogTitle=jL;exports.DialogTrigger=PL;exports.DropdownMenu=HS;exports.DropdownMenuCheckboxItem=SS;exports.DropdownMenuContent=Mn;exports.DropdownMenuGroup=ld1;exports.DropdownMenuItem=f6;exports.DropdownMenuLabel=wn;exports.DropdownMenuPortal=id1;exports.DropdownMenuRadioGroup=dd1;exports.DropdownMenuRadioItem=AS;exports.DropdownMenuSeparator=Cn;exports.DropdownMenuShortcut=FS;exports.DropdownMenuSub=ud1;exports.DropdownMenuSubContent=LS;exports.DropdownMenuSubTrigger=xS;exports.DropdownMenuTrigger=yS;exports.ErrorBoundary=rL;exports.FaCircleCheck=kh1;exports.GenIcon=j0;exports.HoverCard=$u1;exports.HoverCardContent=dS;exports.HoverCardTrigger=td1;exports.IconPickerField=xd1;exports.ImagePickerField=Fd1;exports.ImagesPanel=Ad1;exports.Input=GL;exports.Label=JL;exports.LinkField=Ed1;exports.Menubar=tS;exports.MenubarCheckboxItem=oS;exports.MenubarContent=rS;exports.MenubarGroup=Yu1;exports.MenubarItem=nS;exports.MenubarLabel=lS;exports.MenubarMenu=Ju1;exports.MenubarPortal=Xu1;exports.MenubarRadioGroup=_u1;exports.MenubarRadioItem=sS;exports.MenubarSeparator=iS;exports.MenubarShortcut=uS;exports.MenubarSub=Qu1;exports.MenubarSubContent=aS;exports.MenubarSubTrigger=cS;exports.MenubarTrigger=eS;exports.Popover=Ku1;exports.PopoverContent=$L;exports.PopoverTrigger=Gu1;exports.RichTextEditorField=Bd1;exports.ScrollArea=YL;exports.ScrollBar=zn;exports.Select=ed1;exports.SelectContent=vS;exports.SelectGroup=cd1;exports.SelectItem=gS;exports.SelectLabel=fS;exports.SelectSeparator=pS;exports.SelectTrigger=hS;exports.SelectValue=ad1;exports.Separator=BS;exports.Sheet=rd1;exports.SheetClose=od1;exports.SheetContent=bS;exports.SheetDescription=VS;exports.SheetFooter=wS;exports.SheetHeader=MS;exports.SheetTitle=CS;exports.SheetTrigger=nd1;exports.Skeleton=Vn;exports.Switch=HL;exports.Tabs=XL;exports.TabsContent=xt;exports.TabsList=bn;exports.TabsTrigger=yt;exports.Textarea=me;exports.Toaster=jS;exports.Toggle=VL;exports.Tooltip=Wu1;exports.TooltipContent=_L;exports.TooltipPortal=Zu1;exports.TooltipProvider=QL;exports.TooltipTrigger=Uu1;exports.activePanelAtom=zA;exports.aiAssistantActiveAtom=be;exports.badgeVariants=AL;exports.builderSaveStateAtom=I0;exports.buttonVariants=ge;exports.canAcceptChildBlock=ga;exports.canDeleteBlock=vu1;exports.canDuplicateBlock=hu1;exports.canvasIframeAtom=mA;exports.canvasSettingsAtom=yA;exports.convertDotNotationToObject=Lu1;exports.draggedBlockIdAtom=VA;exports.draggingFlagAtom=CA;exports.editLayerNameAtom=pA;exports.getBlockJSONFromSchemas=ma;exports.getBlockJSONFromUISchemas=pa;exports.inlineEditingActiveAtom=wA;exports.networkModeAtom=gA;exports.reducer=ES;exports.showPredefinedBlockCategoryAtom=bA;exports.toast=OS;exports.toggleVariants=CL;exports.treeDSBlocks=lL;exports.treeRefAtom=HA;exports.useActiveModal=lh1;exports.useActivePanel=ph1;exports.useAddBlock=Od1;exports.useAddBlockParent=mh1;exports.useAddClassesToBlocks=Nd1;exports.useAllBlocks=ih1;exports.useBlocksContainer=Eu1;exports.useBlocksStore=Q4;exports.useBlocksStoreUndoableActions=N4;exports.useBrandingOptions=ve;exports.useBuilderProp=M2;exports.useBuilderReset=xA;exports.useCanvasWidth=jd1;exports.useCanvasZoom=Dd1;exports.useChaiExternalData=LA;exports.useCopyBlockIds=qd1;exports.useCopyToClipboard=wh1;exports.useCurrentPage=gL;exports.useCutBlockIds=lA;exports.useDarkMode=Zd1;exports.useDuplicateBlocks=xn;exports.useGetPageData=bL;exports.useHiddenBlockIds=Ud1;exports.useHighlightBlockId=uA;exports.usePageDataProviders=rn;exports.usePasteBlocks=Jd1;exports.usePreviewMode=dA;exports.useReadOnlyMode=vh1;exports.useRemoveBlocks=wL;exports.useRemoveClassesFromBlocks=Qd1;exports.useSavePage=ML;exports.useSelectedBlock=wu1;exports.useSelectedBlockAllClasses=_d1;exports.useSelectedBlockCanvasSetting=Vu1;exports.useSelectedBlockCurrentClasses=eh1;exports.useSelectedBlockCustomStylingStates=Hu1;exports.useSelectedBlockIds=p3;exports.useSelectedBlocksDisplayChild=Mu1;exports.useSelectedBreakpoints=bh1;exports.useSelectedStylingBlocks=aA;exports.useStylingBreakpoint=rA;exports.useStylingState=ch1;exports.useToast=ze;exports.useUILibraryBlocks=Mh1;exports.useUndoManager=fe;exports.useUpdateBlocksProps=ah1;exports.useUpdateBlocksPropsRealtime=oh1;
|
|
206
|
+
*/W();var nu1=process.env.NODE_ENV!=="production"?ru1:()=>null;function ou1(){return new URLSearchParams(window.location.search).has("dnd")}function su1(){return new URLSearchParams(window.location.search).has("outline")}const lu1={dnd:ou1(),arborist:su1()},Yr=l1.atom(null);Yr.debugLabel="chaiBuilderPropsAtom";const aL=l1.atom({});aL.debugLabel="chaiExternalDataAtom";class rL extends h.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?L.jsxRuntimeExports.jsxs("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",id:"errorBoundary",children:[L.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),L.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const iu1=()=>!1,uu1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},ga=T.memoize((t,e)=>{if(!t)return!0;const c=v3.getBlockComponent(t);return c&&T.has(c,"canAcceptBlock")?c.canAcceptBlock(e):!1}),du1=T.memoize((t,e)=>{const c=v3.getBlockComponent(e);return c&&T.has(c,"canBeNested")?c.canBeNested(t):!0}),hu1=T.memoize(t=>{const e=v3.getBlockComponent(t);return e&&T.has(e,"canDuplicate")?e.canDuplicate():!0}),vu1=T.memoize(t=>{const e=v3.getBlockComponent(t);return e&&T.has(e,"canDelete")?e.canDelete():!0});function nL(t,e,c){const a=T.filter(t,n=>n._parent===e),r=[];for(let n=0;n<a.length;n++){const o=sL(a[n]);if(Object.keys(o).length>0&&Object.keys(o).forEach(s=>{a[n][s]=`slot:${U4.generateUUID()}`}),T.filter(t,{_parent:a[n]._id}).length>0){const s=U4.generateUUID();r.push({...a[n],oldId:a[n]._id,_id:s,_parent:c}),r.push(T.flatten(nL(t,a[n]._id,s)))}else r.push({...a[n],oldId:a[n]._id,_id:U4.generateUUID(),_parent:c})}return T.flatten(r)}function oL(t){const e={};t.forEach(a=>{e[a._id]={...a,children:[]}});const c=[];return t.forEach(a=>{if(a._parent){const r=e[a._parent];r&&r.children.push(e[a._id])}else c.push(e[a._id])}),c}const sL=t=>{const e={};return Object.keys(t).forEach(c=>{T.isString(t[c])&&t[c].startsWith("slot")&&(e[c]=t[c].replace("slot:",""))}),e},fu1=(t,e,c=null)=>{let a=T.find(t,{_id:e});a={...a,oldId:a._id,_id:U4.generateUUID()},c&&(a={...a,_parent:c});const r=[a];T.filter(t,{_parent:e}).length>0&&r.push(T.flatten(nL(t,e,a._id)));const n=T.flatten(r);return T.map(n,o=>{const s=o,l=sL(s);return Object.keys(l).length>0&&Object.keys(l).forEach(u=>{const i=T.find(n,{oldId:l[u].replace("slot:","")});s[u]=`slot:${i._id}`}),T.omit(s,["global","oldId"])})};const S4=l1.atom([]);S4.debugLabel="presentBlocksAtom";const lL=l1.atom(t=>{const e=t(S4);return oL([...e])});lL.debugLabel="treeDSBlocks";S4.debugLabel="presentBlocksAtom";const Xr=re1(S4);Xr.debugLabel="pageBlocksAtomsAtom";const gu1=l1.atom("");gu1.debugLabel="builderActivePageAtom";const pu1=l1.atom(-1);pu1.debugLabel="destinationDropIndexAtom";const iL=l1.atom([]);iL.debugLabel="buildingBlocksAtom";const mu1=l1.atom(t=>{const e=t(iL);return T.filter(e,c=>T.has(c,"blockId"))});mu1.debugLabel="globalBlocksAtom";const Qr=l1.atom([]);Qr.debugLabel="selectedBlockIdsAtom";const _r=l1.atom(t=>{const e=t(S4),c=t(Qr);return T.map(T.filter(e,({_id:a})=>T.includes(c,a)),a=>({...a}))});_r.debugLabel="selectedBlocksAtom";const he=l1.atom(t=>{const e=t(_r);if(e.length===0)return null;if(e.length===1)return e[0]});he.debugLabel="selectedBlockAtom";const zu1=t=>T.get(t,"_parent",null),bu1=l1.atom(t=>{const e=t(_r),c=T.map(e,zu1);return T.filter(t(S4),a=>T.includes(c,a._id))});bu1.debugLabel="selectedBlocksParentsAtom";const uL=l1.atom(()=>!1);uL.debugLabel="selectedBlockFlexChildAtom";const dL=l1.atom(()=>!1);dL.debugLabel="selectedBlockGridChildAtom";const $r=l1.atom("");$r.debugLabel="styleStateAtom";const hL=g4("styleBreakpoint","xs");hL.debugLabel="styleBreakpointAtom";const Mu1=()=>({flexChild:l1.useAtomValue(uL),gridChild:l1.useAtomValue(dL)}),wu1=()=>l1.useAtomValue(he),Cu1=l1.atom(t=>{const e=t(he),c=t(S4);let a=e;const r=[e];do{const n=c.find(({_id:o})=>o===(a==null?void 0:a._parent));a=n,n&&r.push(n)}while(a!=null&&a._parent);return r}),vL=()=>l1.useAtomValue(Cu1),Vu1=()=>{const t=vL();return h.useMemo(()=>{for(let e=0;e<t.length;e++){const c=v3.getBlockComponent(t[e]._type),a=T.cloneDeep(T.get(c,"blockState",{}));if(!T.isEmpty(a))return{settings:a,block:t[e]}}return{}},[t])},Hu1=()=>{const t=vL();return h.useMemo(()=>{let e={};for(let c=0;c<t.length;c++){const a=v3.getBlockComponent(t[c]._type),r=T.get(a,"customStylingStates",{});e={...e,...r}}return e},[t])},p3=()=>{const[t,e]=l1.useAtom(Qr),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},pa=t=>{switch(t.type){case"singular":return t.uiSchema;case"model":const{properties:e}=t,c={};return Object.keys(e).forEach(n=>{const o=e[n];if(T.includes(["slot","styles"],o.type))return;const s=n;c[s]=pa(o)}),c;case"list":const{itemProperties:a}=t,r={items:{}};return Object.keys(a).forEach(n=>{const o=a[n];if(T.includes(["slot","styles"],o.type))return;const s=n;r.items[s]=pa(o)}),r;default:return{}}},ma=t=>{switch(t.type){case"singular":return t.schema;case"model":const{properties:e,title:c}=t,a={title:c,type:"object",properties:{}};return Object.keys(e).forEach(s=>{const l=e[s];if(T.includes(["slot","styles"],l.type))return;const u=s;a.properties[u]=ma(l)}),a;case"list":const{itemProperties:r,title:n}=t,o={title:n,type:"array",items:{type:"object",properties:{}}};return Object.keys(r).forEach(s=>{const l=r[s];if(T.includes(["slot","styles"],l.type))return;const u=s;o.items.properties[u]=ma(l),T.set(o.items,"title",T.get(l,"itemTitle",`${n} item`))}),o;default:return{}}},fL=t=>{if(!t)return{};const e={};return Object.keys(t).forEach(c=>{e[c]=xu1(t[c])}),e},yu1=t=>{if(T.isEmpty(t.default))return[];const{itemProperties:e}=t;return T.map(t.default,c=>{const a={...c};return T.forIn(c,(r,n)=>{T.has(e,n)&&T.get(e[n],"i18n",!1)&&(a[n]=x4.I18N_KEY)}),a})},xu1=t=>{switch(t.type){case"styles":return t.default;case"slot":return`${x4.SLOT_KEY}${U4.generateUUID()}`;case"singular":const{schema:e}=t;return T.get(e,"default","");case"model":return fL(t.properties);case"list":return yu1(t);default:return""}};const Lu1=(t,e)=>{const c={};return T.set(c,t,e),c};var tn={exports:{}},wv1=tn.exports;(function(t){(function(){"use strict";function e(a,r,n){return a.splice(r,!n||1+n-r+(!(n<0^r>=0)&&(n<0||-1)*a.length)),a.length}let c=function(){let a=[],r=-1,n=0,o=!1,s;function l(u,i){return!u||typeof u[i]!="function"?this:(o=!0,u[i](),o=!1,this)}return{add:function(u){return o?this:(a.splice(r+1,a.length-r),a.push(u),n&&a.length>n&&e(a,0,-(n+1)),r=a.length-1,s&&s(),this)},setCallback:function(u){s=u},undo:function(){let u=a[r];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"undo"),r-=1,u=a[r],!(!u||!u.groupId)););return s&&s(),this},redo:function(){let u=a[r+1];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"redo"),r+=1,u=a[r+1],!(!u||!u.groupId)););return s&&s(),this},clear:function(){let u=a.length;a=[],r=-1,s&&u>0&&s()},hasUndo:function(){return r!==-1},hasRedo:function(){return r<a.length-1},getCommands:function(u){return u?a.filter(i=>i.groupId===u):a},getIndex:function(){return r},setLimit:function(u){n=u}}};t.exports?t.exports=c:window.UndoManager=c})()})(tn);var Su1=tn.exports;const Au1=V4.getDefaultExportFromCjs(Su1),Fu1=l1.atom(Ec.BRANDING_OPTIONS_DEFAULTS),Bu1=l1.atom(null),ve=()=>{const[t,e]=l1.useAtom(Fu1);return[T.isObject(t)?{...Ec.BRANDING_OPTIONS_DEFAULTS,...t}:Ec.BRANDING_OPTIONS_DEFAULTS,e]},Eu1=()=>l1.useAtom(Bu1),Ou1=l1.atom(null),gL=()=>({currentPage:l1.useAtomValue(Ou1)});function Pu1(t){return oL(t)}const en=(t,e)=>T.flatten(t.map(c=>{if(c=e?{...c,_parent:e}:{...c},c.children){const a=[...c.children];return delete c.children,T.flatten([c,...en(a,c._id)])}return c}));function cn(t,e=!1){for(let c=0;c<t.length;c++){const a=t[c];a.global&&!e?t[c]={type:"GlobalBlock",blockId:a.blockId,_parent:T.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&cn(a.children)}}function pL(t){let e=[],c=T.filter(t,{type:"GlobalBlock"});return c.length>0&&(c=T.map(c,mL),T.each(c,a=>{e=[...e,...ku1(a)]})),e}function ku1(t){let e=[];const c=T.get(T.first(t),"_parent",null);T.set(T.first(t),"_parent",null);const a=[flatToNestedInstance.convert(zL(t))];cn(a,!0);let r=en(a,t[0]._id);return r=T.set(r,"0._parent",c),e=[...e,r,...pL(r)],e}function mL(t){const e=T.find(za,{_id:t._id});if(!e)return[];const c=[e],a=T.filter(za,{_parent:t._id});return a.length?T.flatten([...c,...T.flatten(T.map(a,mL))]):T.flatten(c)}const zL=t=>JSON.parse(JSON.stringify(t));let za=[];function Ru1(t){za=t;const e=Pu1(zL(t));cn(e);const c=en(e,null),a=pL(c),r={};return T.each(a,n=>T.set(r,T.first(n).blockId,n)),[c,r]}const bL=()=>{const[t]=ve(),{currentPage:e}=gL(),[c]=Q4();return h.useCallback(()=>{const a=T.map(c,n=>T.omit(n,["expanded","order","title","siblings","tempClasses"])),[r=[]]=Ru1(a);return{currentPage:e,blocks:r}},[t,e,c])},M2=(t,e=void 0)=>{const c=l1.useAtomValue(Yr);return T.get(c,t,e)},an=l1.atom([]);an.debugLabel="dataProvidersAtom";const rn=()=>l1.useAtom(an),I0=l1.atom("SAVED");I0.debugLabel="builderSaveStateAtom";const ML=()=>{const[t,e]=l1.useAtom(I0),c=M2("onSavePage",async u=>{}),a=M2("onSave",async u=>{}),r=M2("onSaveStateChange",T.noop),n=bL(),[o]=rn(),[s]=ve();return{savePage:ig.useThrottledCallback(async()=>{e("SAVING"),r("SAVING");const u=n();return await c({blocks:u.blocks,providers:o}),await a({blocks:u.blocks,providers:o,brandingOptions:s,themeConfiguration:s}),setTimeout(()=>{e("SAVED"),r("SAVED")},100),!0},[n,e,s,a,r],3e3),saveState:t,setSaveState:e}},q4=new Au1;q4.setLimit(50);const fe=()=>{const[,t]=l1.useAtom(I0),e=M2("onSaveStateChange",T.noop);return h.useEffect(()=>(q4.setCallback(()=>{t("UNSAVED"),e("UNSAVED")}),()=>{q4.setCallback(T.noop)}),[]),{add:q4.add,undo:q4.undo,redo:q4.redo,hasRedo:q4.hasRedo,hasUndo:q4.hasUndo,clear:q4.clear}},nn=(t,e)=>{const c=[],a=T.filter(t,r=>T.includes(e,r._id)||T.includes(e,r._parent)?(c.push(r._id),!1):!0);return T.isEmpty(c)?a:nn(a,c)},wL=()=>{const[t]=Q4(),[e,c]=p3(),{setNewBlocks:a}=N4();return h.useCallback(r=>{var o;const n=((o=T.find(t,{_id:r[0]}))==null?void 0:o._parent)||null;a(nn(t,r)),setTimeout(()=>c(n?[n]:[]),200)},[t,c,e])};function Iu1(t,e,c,a){let r=t.filter(s=>!s._parent);c&&(r=t.filter(s=>s._parent===c));const n=a!==void 0?a:r.length;let o=t.length;for(let s=0,l=0;s<t.length;s++)if(t[s]._parent===c){if(l===n){o=s;break}l++}return!c&&a!==void 0&&a>=r.length&&(o=t.length),[...t.slice(0,o),...e,...t.slice(o)]}function _f(t){const e=[],c=new Map;t.forEach(r=>{c.set(r._id,r)});function a(r){const n=c.get(r);e.includes(n)||(e.push(n),t.forEach(o=>{o._parent===r&&a(o._id)}))}return t.forEach(r=>{r._parent||a(r._id)}),e}const Nu1=(t,e,c,a)=>{if(T.isEmpty(e))return _f(t);function r(s,l){const u=s.filter(d=>d._parent===l);let i=[...u];return u.forEach(d=>{i=i.concat(r(s,d._id))}),i}const n=e.reduce((s,l)=>{const u=t.find(i=>i._id===l);if(u){const i=r(t,l);s.push(u,...i)}return s},[]);t=t.filter(s=>!n.includes(s)),n.forEach(s=>{e.includes(s._id)&&(s._parent=c)});let o;if(!c)o=a;else{const s=t.findIndex(l=>l._id===c);if(s===-1)o=a;else{o=s+1;let l=0;for(;l<a&&o<t.length;)t[o]._parent===c&&l++,o++}}return t.splice(o,0,...n),_f(t)},ju1=()=>{const[,t]=Q4();return{setNewBlocks:e=>{t(e)},addBlocks:(e,c,a)=>{t(r=>Iu1(r,e,c,a))},removeBlocks:e=>{t(c=>nn(c,e))},moveBlocks:(e,c,a)=>{t(r=>Nu1(r,e,c,a))},updateBlocksProps:e=>{t(c=>{const a=e.map(r=>r._id);return c.map(r=>{if(a.includes(r._id)){const n=T.find(e,{_id:r._id});return{...r,...T.omit(n,"_id")}}return r})})}}},Q4=()=>l1.useAtom(S4),N4=()=>{const{add:t}=fe(),[e]=Q4(),{setNewBlocks:c,addBlocks:a,removeBlocks:r,moveBlocks:n,updateBlocksProps:o}=ju1();return{moveBlocks:(p,g,m)=>{const z=T.map(p,w=>{const C=e.find(F=>F._id===w)._parent||null,S=e.filter(F=>C?F._parent===C:!F._parent).map(F=>F._id).indexOf(w);return{_id:w,oldParent:C,oldPosition:S}}),b=z.find(({_id:w})=>w===p[0]);b&&b.oldParent===g&&b.oldPosition===m||(n(p,g,m),t({undo:()=>T.each(z,({_id:w,oldParent:V,oldPosition:C})=>{n([w],V,C)}),redo:()=>n(p,g,m)}))},addBlocks:(p,g,m)=>{a(p,g,m),t({undo:()=>r(T.map(p,"_id")),redo:()=>a(p,g,m)})},removeBlocks:p=>{var b;const g=(b=T.first(p))==null?void 0:b._parent,z=e.filter(w=>g?w._parent===g:!w._parent).indexOf(T.first(p));r(T.map(p,"_id")),t({undo:()=>a(p,g,z),redo:()=>r(T.map(p,"_id"))})},updateBlocks:(p,g,m)=>{let z=[];if(m)z=T.map(p,b=>({_id:b,...m}));else{const b=T.keys(g);z=T.map(p,w=>{const V=e.find(H=>H._id===w),C={_id:w};return T.each(b,H=>C[H]=V[H]),C})}o(T.map(p,b=>({_id:b,...g}))),t({undo:()=>o(z),redo:()=>o(T.map(p,b=>({_id:b,...g})))})},updateBlocksRuntime:(p,g)=>{o(T.map(p,m=>({_id:m,...g})))},setNewBlocks:p=>{c(p),t({undo:()=>c(e),redo:()=>c(p)})},updateMultipleBlocksProps:p=>{let g=[];g=T.map(p,m=>{const z=T.keys(m),b=e.find(V=>V._id===m._id),w={};return T.each(z,V=>w[V]=b[V]),w}),o(p),t({undo:()=>o(g),redo:()=>o(p)})}}},CL=N3.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),VL=x.forwardRef(({className:t,variant:e,size:c,...a},r)=>L.jsxRuntimeExports.jsx(dg.Root,{ref:r,className:s1.cn(CL({variant:e,size:c,className:t})),...a}));VL.displayName=dg.Root.displayName;const HL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Oc.Root,{className:s1.cn("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",t),...e,ref:c,children:L.jsxRuntimeExports.jsx(Oc.Thumb,{className:s1.cn("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));HL.displayName=Oc.Root.displayName;const ge=N3.cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),i3=x.forwardRef(({className:t,variant:e,size:c,asChild:a=!1,...r},n)=>{const o=a?RA.Slot:"button";return L.jsxRuntimeExports.jsx(o,{className:s1.cn(ge({variant:e,size:c,className:t})),ref:n,...r})});i3.displayName="Button";const yL=E3.Root,on=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(E3.Item,{ref:c,className:s1.cn("border-b",t),...e}));on.displayName="AccordionItem";const sn=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(E3.Header,{className:"flex",children:L.jsxRuntimeExports.jsxs(E3.Trigger,{ref:a,className:s1.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...c,children:[e,c.hideArrow?null:L.jsxRuntimeExports.jsx(s2.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));sn.displayName=E3.Trigger.displayName;const ln=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(E3.Content,{ref:a,className:s1.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...c,children:L.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:e})}));ln.displayName=E3.Content.displayName;const Tu1=N3.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),xL=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx("div",{ref:a,role:"alert",className:s1.cn(Tu1({variant:e}),t),...c}));xL.displayName="Alert";const LL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h5",{ref:c,className:s1.cn("mb-1 font-medium leading-none tracking-tight",t),...e}));LL.displayName="AlertTitle";const SL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("text-sm [&_p]:leading-relaxed",t),...e}));SL.displayName="AlertDescription";const AL=N3.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),Du1=({className:t,variant:e,...c})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn(AL({variant:e}),t),...c}),FL=j2.Root,BL=j2.Trigger,EL=({className:t,...e})=>L.jsxRuntimeExports.jsx(j2.Portal,{className:s1.cn(t),...e});EL.displayName=j2.Portal.displayName;const OL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Overlay,{className:s1.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:c}));OL.displayName=j2.Overlay.displayName;const un=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs(EL,{children:[L.jsxRuntimeExports.jsx(OL,{}),L.jsxRuntimeExports.jsx(j2.Content,{ref:c,className:s1.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...e})]}));un.displayName=j2.Content.displayName;const dn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});dn.displayName="AlertDialogHeader";const hn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});hn.displayName="AlertDialogFooter";const vn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Title,{ref:c,className:s1.cn("text-lg font-semibold",t),...e}));vn.displayName=j2.Title.displayName;const fn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));fn.displayName=j2.Description.displayName;const gn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Action,{ref:c,className:s1.cn(ge(),t),...e}));gn.displayName=j2.Action.displayName;const pn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Cancel,{ref:c,className:s1.cn(ge({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));pn.displayName=j2.Cancel.displayName;const mn=J1.Root,PL=J1.Trigger,kL=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});kL.displayName=J1.Portal.displayName;const RL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{ref:c,className:s1.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));RL.displayName=J1.Overlay.displayName;const pe=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(kL,{children:[L.jsxRuntimeExports.jsx(RL,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:a,className:s1.cn("fixed left-[50%] top-[50%] z-[999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...c,children:[e,L.jsxRuntimeExports.jsxs(J1.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pe.displayName=J1.Content.displayName;const IL=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});IL.displayName="DialogHeader";const NL=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});NL.displayName="DialogFooter";const jL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold leading-none tracking-tight",t),...e}));jL.displayName=J1.Title.displayName;const TL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));TL.displayName=J1.Description.displayName;const DL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("rounded-xl border bg-card text-card-foreground shadow",t),...e}));DL.displayName="Card";const qL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("flex flex-col space-y-1.5 p-6",t),...e}));qL.displayName="CardHeader";const ZL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h3",{ref:c,className:s1.cn("font-semibold leading-none tracking-tight",t),...e}));ZL.displayName="CardTitle";const WL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("p",{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));WL.displayName="CardDescription";const UL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("p-6 pt-0",t),...e}));UL.displayName="CardContent";const KL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn(" flex items-center p-6 pt-0",t),...e}));KL.displayName="CardFooter";const GL=x.forwardRef(({className:t,type:e,...c},a)=>L.jsxRuntimeExports.jsx("input",{type:e,className:s1.cn("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...c}));GL.displayName="Input";const qu1=N3.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),JL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(hg.Root,{ref:c,className:s1.cn(qu1(),t),...e}));JL.displayName=hg.Root.displayName;const me=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("textarea",{className:s1.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:c,...e}));me.displayName="Textarea";const YL=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K2.Root,{ref:a,className:s1.cn("relative overflow-hidden",t),...c,children:[L.jsxRuntimeExports.jsx(K2.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),L.jsxRuntimeExports.jsx(zn,{}),L.jsxRuntimeExports.jsx(K2.Corner,{})]}));YL.displayName=K2.Root.displayName;const zn=x.forwardRef(({className:t,orientation:e="vertical",...c},a)=>L.jsxRuntimeExports.jsx(K2.ScrollAreaScrollbar,{ref:a,orientation:e,className:s1.cn("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",t),...c,children:L.jsxRuntimeExports.jsx(K2.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));zn.displayName=K2.ScrollAreaScrollbar.displayName;const XL=j3.Root,bn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.List,{ref:c,className:s1.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));bn.displayName=j3.List.displayName;const yt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Trigger,{ref:c,className:s1.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));yt.displayName=j3.Trigger.displayName;const xt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Content,{ref:c,className:s1.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));xt.displayName=j3.Content.displayName;const Zu1=y6.Portal,QL=y6.Provider,Wu1=y6.Root,Uu1=y6.Trigger,_L=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(y6.Content,{ref:a,sideOffset:e,className:s1.cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...c}));_L.displayName=y6.Content.displayName;const Ku1=u0.Root,Gu1=u0.Trigger,$L=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(u0.Portal,{children:L.jsxRuntimeExports.jsx(u0.Content,{ref:r,align:e,sideOffset:c,className:s1.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));$L.displayName=u0.Content.displayName;const Ju1=K1.Menu,Yu1=K1.Group,Xu1=K1.Portal,Qu1=K1.Sub,_u1=K1.RadioGroup,tS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Root,{ref:c,className:s1.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",t),...e}));tS.displayName=K1.Root.displayName;const eS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Trigger,{ref:c,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t),...e}));eS.displayName=K1.Trigger.displayName;const cS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.SubTrigger,{ref:r,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));cS.displayName=K1.SubTrigger.displayName;const aS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.SubContent,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));aS.displayName=K1.SubContent.displayName;const rS=x.forwardRef(({className:t,align:e="start",alignOffset:c=-4,sideOffset:a=8,...r},n)=>L.jsxRuntimeExports.jsx(K1.Portal,{children:L.jsxRuntimeExports.jsx(K1.Content,{ref:n,align:e,alignOffset:c,sideOffset:a,className:s1.cn("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));rS.displayName=K1.Content.displayName;const nS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Item,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...c}));nS.displayName=K1.Item.displayName;const oS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.CheckboxItem,{ref:r,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));oS.displayName=K1.CheckboxItem.displayName;const sS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K1.RadioItem,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));sS.displayName=K1.RadioItem.displayName;const lS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));lS.displayName=K1.Label.displayName;const iS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));iS.displayName=K1.Separator.displayName;const uS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});uS.displayname="MenubarShortcut";const $u1=St.Root,td1=St.Trigger,dS=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(St.Content,{ref:r,align:e,sideOffset:c,className:s1.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));dS.displayName=St.Content.displayName;const ed1=x2.Root,cd1=x2.Group,ad1=x2.Value,hS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Trigger,{ref:a,className:s1.cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...c,children:[e,L.jsxRuntimeExports.jsx(x2.Icon,{asChild:!0,children:L.jsxRuntimeExports.jsx(s2.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));hS.displayName=x2.Trigger.displayName;const vS=x.forwardRef(({className:t,children:e,position:c="popper",...a},r)=>L.jsxRuntimeExports.jsx(x2.Portal,{children:L.jsxRuntimeExports.jsx(x2.Content,{ref:r,className:s1.cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",c==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:c,...a,children:L.jsxRuntimeExports.jsx(x2.Viewport,{className:s1.cn("p-1",c==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));vS.displayName=x2.Content.displayName;const fS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Label,{ref:c,className:s1.cn("px-2 py-1.5 text-sm font-semibold",t),...e}));fS.displayName=x2.Label.displayName;const gS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Item,{ref:a,className:s1.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(x2.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),L.jsxRuntimeExports.jsx(x2.ItemText,{children:e})]}));gS.displayName=x2.Item.displayName;const pS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));pS.displayName=x2.Separator.displayName;const rd1=J1.Root,nd1=J1.Trigger,od1=J1.Close,mS=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});mS.displayName=J1.Portal.displayName;const zS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{className:s1.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:c}));zS.displayName=J1.Overlay.displayName;const sd1=N3.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),bS=x.forwardRef(({side:t="right",className:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(mS,{children:[L.jsxRuntimeExports.jsx(zS,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:r,className:s1.cn(sd1({side:t}),e),...a,children:[c,L.jsxRuntimeExports.jsxs(J1.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bS.displayName=J1.Content.displayName;const MS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});MS.displayName="SheetHeader";const wS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});wS.displayName="SheetFooter";const CS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold text-foreground",t),...e}));CS.displayName=J1.Title.displayName;const VS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));VS.displayName=J1.Description.displayName;const HS=_1.Root,yS=_1.Trigger,ld1=_1.Group,id1=_1.Portal,ud1=_1.Sub,dd1=_1.RadioGroup,xS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.SubTrigger,{ref:r,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));xS.displayName=_1.SubTrigger.displayName;const LS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.SubContent,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));LS.displayName=_1.SubContent.displayName;const Mn=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(_1.Portal,{children:L.jsxRuntimeExports.jsx(_1.Content,{ref:a,sideOffset:e,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...c})}));Mn.displayName=_1.Content.displayName;const f6=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Item,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...c}));f6.displayName=_1.Item.displayName;const SS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.CheckboxItem,{ref:r,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));SS.displayName=_1.CheckboxItem.displayName;const AS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(_1.RadioItem,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));AS.displayName=_1.RadioItem.displayName;const wn=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));wn.displayName=_1.Label.displayName;const Cn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));Cn.displayName=_1.Separator.displayName;const FS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest opacity-60",t),...e});FS.displayName="DropdownMenuShortcut";const BS=x.forwardRef(({className:t,orientation:e="horizontal",decorative:c=!0,...a},r)=>L.jsxRuntimeExports.jsx(vg.Root,{ref:r,decorative:c,orientation:e,className:s1.cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));BS.displayName=vg.Root.displayName;const hd1=1,vd1=1e6;let Fc=0;function fd1(){return Fc=(Fc+1)%Number.MAX_VALUE,Fc.toString()}const Bc=new Map,$f=t=>{if(Bc.has(t))return;const e=setTimeout(()=>{Bc.delete(t),i0({type:"REMOVE_TOAST",toastId:t})},vd1);Bc.set(t,e)},ES=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,hd1)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(c=>c.id===e.toast.id?{...c,...e.toast}:c)};case"DISMISS_TOAST":{const{toastId:c}=e;return c?$f(c):t.toasts.forEach(a=>{$f(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===c||c===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(c=>c.id!==e.toastId)}}},Z8=[];let W8={toasts:[]};function i0(t){W8=ES(W8,t),Z8.forEach(e=>{e(W8)})}function OS({...t}){const e=fd1(),c=r=>i0({type:"UPDATE_TOAST",toast:{...r,id:e}}),a=()=>i0({type:"DISMISS_TOAST",toastId:e});return i0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||a()}}}),{id:e,dismiss:a,update:c}}function ze(){const[t,e]=x.useState(W8);return x.useEffect(()=>(Z8.push(e),()=>{const c=Z8.indexOf(e);c>-1&&Z8.splice(c,1)}),[t]),{...t,toast:OS,dismiss:c=>i0({type:"DISMISS_TOAST",toastId:c})}}const gd1=l4.Provider,PS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Viewport,{ref:c,className:s1.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));PS.displayName=l4.Viewport.displayName;const pd1=N3.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),kS=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx(l4.Root,{ref:a,className:s1.cn(pd1({variant:e}),t),...c}));kS.displayName=l4.Root.displayName;const md1=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Action,{ref:c,className:s1.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));md1.displayName=l4.Action.displayName;const RS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Close,{ref:c,className:s1.cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"})}));RS.displayName=l4.Close.displayName;const IS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Title,{ref:c,className:s1.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));IS.displayName=l4.Title.displayName;const NS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Description,{ref:c,className:s1.cn("text-sm opacity-90",t),...e}));NS.displayName=l4.Description.displayName;function jS(){const{toasts:t}=ze();return L.jsxRuntimeExports.jsxs(gd1,{children:[t.map(({id:e,title:c,description:a,action:r,...n})=>L.jsxRuntimeExports.jsxs(kS,{...n,children:[L.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[c&&L.jsxRuntimeExports.jsx(IS,{children:c}),a&&L.jsxRuntimeExports.jsx(NS,{children:a})]}),r,L.jsxRuntimeExports.jsx(RS,{})]},e)),L.jsxRuntimeExports.jsx(PS,{})]})}const Vn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("animate-pulse rounded-md bg-primary/10",t),...e}),Hn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command,{ref:c,className:s1.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Hn.displayName=X2.Command.displayName;const zd1=({children:t,...e})=>L.jsxRuntimeExports.jsx(mn,{...e,children:L.jsxRuntimeExports.jsx(pe,{className:"overflow-hidden p-0",children:L.jsxRuntimeExports.jsx(Hn,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),TS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[L.jsxRuntimeExports.jsx(s2.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),L.jsxRuntimeExports.jsx(X2.Command.Input,{ref:c,className:s1.cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));TS.displayName=X2.Command.Input.displayName;const DS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.List,{ref:c,className:s1.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));DS.displayName=X2.Command.List.displayName;const qS=x.forwardRef((t,e)=>L.jsxRuntimeExports.jsx(X2.Command.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));qS.displayName=X2.Command.Empty.displayName;const ZS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Group,{ref:c,className:s1.cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));ZS.displayName=X2.Command.Group.displayName;const WS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Separator,{ref:c,className:s1.cn("-mx-1 h-px bg-border",t),...e}));WS.displayName=X2.Command.Separator.displayName;const US=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Item,{ref:c,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...e}));US.displayName=X2.Command.Item.displayName;const KS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});KS.displayName="CommandShortcut";const bd1=$1.Root,Md1=$1.Trigger,wd1=$1.Group,Cd1=$1.Portal,Vd1=$1.Sub,Hd1=$1.RadioGroup,GS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.SubTrigger,{ref:r,className:s1.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));GS.displayName=$1.SubTrigger.displayName;const JS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.SubContent,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));JS.displayName=$1.SubContent.displayName;const YS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Portal,{children:L.jsxRuntimeExports.jsx($1.Content,{ref:c,className:s1.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e})}));YS.displayName=$1.Content.displayName;const XS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Item,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...c}));XS.displayName=$1.Item.displayName;const QS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.CheckboxItem,{ref:r,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));QS.displayName=$1.CheckboxItem.displayName;const _S=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs($1.RadioItem,{ref:a,className:s1.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));_S.displayName=$1.RadioItem.displayName;const $S=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...c}));$S.displayName=$1.Label.displayName;const tA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-border",t),...e}));tA.displayName=$1.Separator.displayName;const eA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});eA.displayName="ContextMenuShortcut";const yd1=t=>{try{const e=document.getElementById("icon-picker-field"),c=document.createElement("div");ba.render(L.jsxRuntimeExports.jsx(ug.IconPickerItem,{value:t}),c),e.appendChild(c),c.hidden=!0;let a=c.innerHTML;setTimeout(()=>e.removeChild(c),100);const n=new DOMParser().parseFromString(a,"image/svg+xml"),o=n.querySelector("svg");return o&&(o.removeAttribute("width"),o.removeAttribute("height")),new XMLSerializer().serializeToString(n)}catch(e){return console.error(e),""}},xd1=({value:t,onChange:e})=>{const c=a=>{e("<svg />");const r=yd1(a);e(r)};return L.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[L.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[L.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t?t.replace("<svg",'<svg class="h-5 w-5"'):"<svg class='h-5 w-5' />"},className:"absolute left-1/2 top-1/2 z-0 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white"}),L.jsxRuntimeExports.jsx(ug,{value:t?"BiSolidGrid":null,onChange:c,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),L.jsxRuntimeExports.jsx("textarea",{value:t,onChange:a=>e(a.target.value),className:"h-full w-full rounded-sm border border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},Ld1=h.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-uyokFuF-.cjs"))),Sd1=h.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-kLPXfW7W.cjs"))),cA=({isModalView:t=!1,onSelect:e=()=>{}})=>{const c=M2("uploadMediaCallback"),a=M2("unsplashAccessKey"),r=c===void 0,n=a===void 0,[o,s]=h.useState(n?"upload":r?"unsplash":"upload");return L.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[L.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:L.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:t&&r?"Unsplash images":t?"Select or upload images":"Images"})}),L.jsxRuntimeExports.jsxs(XL,{value:o,onValueChange:l=>s(l),className:"flex h-full w-full flex-col py-2",children:[!(r||n)&&L.jsxRuntimeExports.jsxs(bn,{className:"w-full",children:[L.jsxRuntimeExports.jsx(yt,{value:"upload",className:"w-full",children:"Upload"}),L.jsxRuntimeExports.jsx(yt,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),o==="unsplash"?L.jsxRuntimeExports.jsx(xt,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(Ld1,{isModalView:t,onSelect:e})})}):L.jsxRuntimeExports.jsx(xt,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(Sd1,{isModalView:t,onSelect:e})})})]})]})},Ad1=Object.freeze(Object.defineProperty({__proto__:null,default:cA},Symbol.toStringTag,{value:"Module"})),tg=({children:t,onSelect:e})=>{const[c,a]=h.useState(!1),r=(...n)=>{e.call(void 0,...n),a(!1)};return L.jsxRuntimeExports.jsxs(mn,{open:c,onOpenChange:n=>a(n),children:[L.jsxRuntimeExports.jsx(PL,{asChild:!0,children:t}),L.jsxRuntimeExports.jsx(pe,{className:"flex h-3/4 max-w-5xl",children:L.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:L.jsxRuntimeExports.jsx(cA,{isModalView:!0,onSelect:r})})})]})},Fd1=({value:t,onChange:e,id:c,onBlur:a})=>{const r=M2("uploadMediaCallback"),n=M2("unsplashAccessKey"),o=r===void 0,s=n===void 0;return L.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?L.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):L.jsxRuntimeExports.jsx(tg,{onSelect:e,children:L.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),L.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(o&&s)&&L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(tg,{onSelect:e,children:L.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:t||!T.isEmpty(t)?"Replace Image":"Choose Image"})}),L.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),L.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:l}})=>a(c,l),onChange:l=>e(l.target.value)})]})]})},Bd1=({id:t,placeholder:e,value:c,onChange:a,onBlur:r})=>{const n={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},o=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:L.jsxRuntimeExports.jsx(QA,{id:t,value:c,onBlur:s=>r(t,s),onChange:s=>a(s),modules:n,formats:o,placeholder:e,className:"mt-1 rounded-md"})},Ed1=({schema:t,formData:e,onChange:c})=>{const[a,r]=h.useState([]),n=M2("getPages",()=>[]),{type:o="page",href:s="",target:l="self"}=e;return h.useEffect(()=>{(async()=>{const u=await n();r(u||[])})()},[]),L.jsxRuntimeExports.jsxs("div",{children:[L.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[L.jsxRuntimeExports.jsx("select",{name:"type",value:o,onChange:u=>c({...e,type:u.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(u=>L.jsxRuntimeExports.jsx("option",{value:u.const,children:u.title},u.const))}),o==="page"?L.jsxRuntimeExports.jsxs("select",{name:"href",value:s,onChange:u=>c({...e,href:u.target.value}),children:[L.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),T.map(a,u=>L.jsxRuntimeExports.jsx("option",{value:u.slug,children:u.name},u.uuid))]}):L.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:s,onChange:u=>c({...e,href:u.target.value}),placeholder:o==="page"||o==="url"?"Enter URL":o==="scroll"?"#ElementID":"Enter detail"}),(o==="page"||o==="url")&&L.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[L.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:l==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>c({...e,target:l==="_blank"?"_self":"_blank"})}),L.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},Od1=()=>{const[t]=Q4(),[,e]=p3(),{addBlocks:c}=N4(),{toast:a}=ze(),r=h.useCallback((o,s,l)=>{var f;for(let p=0;p<o.length;p++){const{_id:g}=o[p];o[p]._id=U4.generateUUID();const m=T.filter(o,{_parent:g});for(let z=0;z<m.length;z++)m[z]._parent=o[p]._id}const u=T.first(o);let i,d;return s&&(i=T.find(t,{_id:s}),o[0]._parent=s,d=s),!(i?ga(i._type,u._type):!0)&&i&&(o[0]._parent=i._parent,d=i._parent),c(o,d,l),e([(f=T.first(o))==null?void 0:f._id]),T.first(o)},[t,e]);return{addCoreBlock:h.useCallback((o,s,l)=>{if(T.has(o,"blocks")){const z=o.blocks;return r(z,s,l)}const u=U4.generateUUID(),i=fL(o.props),d=[];T.forIn(i,(z,b)=>{if(T.startsWith(z,x4.SLOT_KEY)){const w=z.replace(x4.SLOT_KEY,"");d.push({_id:w,_type:"Slot",_parent:u,_name:o.props[b].name,_styles:o.props[b].styles,_emptyStyles:o.props[b].emptyStyles})}});const v={_type:o.type,_id:u,...i};let f,p;if(s&&(f=T.find(t,{_id:s}),v._parent=s,p=s),!du1(f==null?void 0:f._type,o.type)){a({variant:"destructive",title:"Error",description:`"${o.type}" cannot be added under "${f?f==null?void 0:f._type:"root"}"`}),e([]);return}!(f?ga(f._type,o.type):!0)&&f&&(v._parent=f._parent,p=f._parent);const m=[v,...d];return c(m,p,l),e([v._id]),v},[r,t,e]),addPredefinedBlock:r}},eg={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},cg=["xs","sm","md","lg","xl","2xl"];function Pd1(t,e){if(e===null)return"baseClasses";const c=e.mq;if(c==="xs"||e.dark||e.mod!=="")return"classes";let a="baseClasses",r=cg.indexOf(c);for(;r>0;){const n=cg[r-1];if(T.find(t,{mq:n,property:e.property})){a="classes";break}r--}return a}const ag=[];function kd1(t="",e="",c=[]){t=t.trim().replace(/ +/g,"");let a=T.filter(T.map(t.split(" "),s1.constructClassObject),u=>!T.isNull(u)),r=T.filter(T.map(e.split(" "),s1.constructClassObject),u=>!T.isNull(u));r=T.filter(r,u=>!T.includes(ag,u.property));const n=[],o=[];T.each(c,u=>{const i=s1.constructClassObject(u),d=T.find(a,T.pick(i,["dark","mq","mod","property"]));if(d&&(a=T.filter(a,v=>v.fullCls!==(d==null?void 0:d.fullCls))),n.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(r=T.filter(r,v=>v.property!==i.property)),Pd1(a,i)==="baseClasses"&&!T.includes(ag,i.property)){const v=T.find(r,T.pick(i,["property"]));d&&(r=T.filter(r,f=>f.fullCls!==(v==null?void 0:v.fullCls))),o.push({...i,fullCls:i.cls,mq:"xs"})}});const s=T.map(T.sortBy([...a,...n],u=>eg[u.mq]),"fullCls").join(" ");return`${T.map(T.sortBy([...r,...o],u=>eg[u.mq]),"fullCls").join(" ").trim()},${s.trim()}`.trim().replace(/ +/g,"")}const N0=l1.atom([]);N0.debugLabel="selectedStylingBlocksAtom";const aA=()=>l1.useAtom(N0),Rd1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},Id1=l1.atom(null,(t,e,{blockIds:c,newClasses:a})=>{const r=T.filter(t(Xr),o=>c.includes(t(o)._id)),n=T.first(t(N0));return T.map(r,o=>{const s=t(o),l=T.get(s,n.prop,`${x4.STYLES_KEY},`),{baseClasses:u,classes:i}=Rd1(l);return{ids:[s._id],props:{[n.prop]:`${x4.STYLES_KEY}${kd1(i,u,a)}`}}})}),Nd1=()=>{const t=l1.useSetAtom(Id1),{updateBlocks:e,updateBlocksRuntime:c}=N4();return h.useCallback((a,r,n=!1)=>{const o=t({blockIds:a,newClasses:r});if(!n){c(a,o[0].props);return}e(a,o[0].props)},[t])},rA=()=>l1.useAtom(hL),nA=g4("canvasWidth",800),oA=l1.atom(t=>{const e=t(nA);return U4.getBreakpointValue(e).toLowerCase()}),jd1=()=>{const[t,e]=l1.useAtom(nA),c=l1.useAtomValue(oA),[a,r]=rA();return h.useEffect(()=>{a!=="xs"&&r(c)},[c,a,r]),[t,c,e]},Td1=g4("canvasZoom",100),Dd1=()=>l1.useAtom(Td1),sA=l1.atom([]),lA=()=>{const[t,e]=l1.useAtom(sA),c=l1.useSetAtom(yn),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},yn=l1.atom([]),qd1=()=>{const[t,e]=l1.useAtom(yn),c=l1.useSetAtom(sA),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},iA=g4("darkMode",!1),Zd1=()=>{const[t,e]=l1.useAtom(iA);return[t,e]},xn=()=>{const[t]=Q4(),[,e]=p3(),{addBlocks:c}=N4();return h.useCallback((a,r=null)=>{const n=[];T.each(a,o=>{const s=t.find(v=>v._id===o);r||(r=s._parent);const i=T.filter(t,v=>T.isString(r)?v._parent===r:!s._parent).indexOf(s)+1,d=fu1(t,o,r);c(d,r,i),n.push(T.get(d,"0._id",""))}),e(n)},[t,e])},Wd1=l1.atom([]),Ud1=()=>{const[t,e]=l1.useAtom(Wd1),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},Kd1=l1.atom(""),uA=()=>l1.useAtom(Kd1),Gd1=()=>{const t=l1.useAtomValue(S4);return h.useCallback((e,c)=>{const a=T.map(t,r=>(T.includes(e,T.get(r,"_id"))&&T.set(r,"_parent",c),r));console.log("newBlocks",a)},[t])},Jd1=()=>{console.warn("usePasteBlocks is not implemented");const t=l1.useAtomValue(yn),[e,c]=lA(),a=xn(),r=Gd1();return{canPaste:h.useMemo(()=>e.length>0||t.length>0,[t,e]),pasteBlocks:h.useCallback(o=>{T.isEmpty(t)?r(e,o):a(t,o),c(()=>[])},[e,t,a,r,c])}},Yd1=l1.atom(!1),dA=()=>{const[t,e]=l1.useAtom(Yd1);return[t,e]},Xd1=l1.atom(null,(t,e,{blockIds:c,fullClasses:a})=>{const r=T.first(t(N0)),n=T.filter(t(Xr),o=>c.includes(t(o)._id));return T.map(n,o=>{const s=t(o),l=a;let{classes:u,baseClasses:i}=uu1(T.get(s,r.prop,"styles:,"));return T.each(l,d=>{const v=d.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),f=new RegExp(`(^| )${v}($| )`,"g");u=u.replace(f," ").replace(/ +/g," ").trim();const p=T.first(d.split(":"));T.includes(["2xl","xl","lg","md","sm"],p)&&l.push(d.split(":").pop().trim())}),T.each(l,d=>{const v=new RegExp(`(^| )${d.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(v," ").replace(/ +/g," ").trim()}),{ids:[s._id],props:{[r.prop]:`${x4.STYLES_KEY}${i},${u}`}}})}),Qd1=()=>{const{updateBlocks:t}=N4(),e=l1.useSetAtom(Xd1);return h.useCallback((c,a)=>{const r=e({blockIds:c,fullClasses:a});t(c,r[0].props)},[e])},hA=l1.atom(t=>{const e=T.first(t(N0)),c=t(he);if(!e||e.blockId!==T.get(c,"_id",null))return[];const r=T.get(c,e.prop,`${x4.STYLES_KEY},`).replace(x4.STYLES_KEY,"").split(",").join(" ");return T.filter(T.map(r.trim().split(" "),s1.constructClassObject),n=>!T.isNull(n))}),_d1=()=>l1.useAtomValue(hA),rg={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},$d1=l1.atom(t=>{const e=t(oA),c=t($r),a=t(iA),r=th1(e);let n=T.filter(t(hA),{mod:c});return T.startsWith(c,"_")||(n=T.filter(n,o=>r.includes(o.mq))),n=n.sort((o,s)=>rg[o.mq]-rg[s.mq]),a||(n=T.filter(n,{dark:!1})),n}),th1=t=>{let e=[];switch(t){case"xs":e=["xs"];break;case"sm":e=["xs","sm"];break;case"md":e=["xs","sm","md"];break;case"lg":e=["xs","sm","md","lg"];break;case"xl":e=["xs","sm","md","lg","xl"];break;case"2xl":e=["xs","sm","md","lg","xl","2xl"];break;default:e=["xs"];break}return e},eh1=()=>l1.useAtomValue($d1),ch1=()=>l1.useAtom($r),ah1=()=>{const{updateBlocks:t}=N4();return h.useCallback((e,c,a)=>{t(e,c,a)},[t])};const rh1=()=>{const{updateBlocksRuntime:t}=N4();return h.useCallback(async(e,c,a=30)=>{const r=T.keys(T.omit(c,["_id"]));for(const n of r){const o=c[n];if(T.isString(o)){const s=T.chunk(o.split(""),12);let l="";t([e],{[n]:""});for(let u=0;u<s.length;u++)l+=s[u].join(""),t([e],{[n]:l}),await new Promise(i=>setTimeout(i,a))}}},[t])},nh1=()=>{const{updateMultipleBlocksProps:t}=N4(),e=rh1();return h.useCallback(async c=>{for(const a of c)await e(a._id,a);t(c)},[t])},oh1=()=>{const{updateBlocksRuntime:t}=N4();return h.useCallback((e,c)=>{t(e,c)},[t])},vA={name:"",props:{},modalProps:{},backdropClose:!0},sh1=l1.atom(vA),lh1=()=>{const[t,e]=l1.useAtom(sh1),c=h.useCallback((r,n={},o={})=>{e({name:r,props:n,modalProps:o})},[e]),a=h.useCallback((...r)=>{T.get(t,"props.onClose",()=>{})(...r),e(vA)},[e,t]);return{activeModal:t,openModal:c,closeModal:a}},ih1=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),l1.useAtomValue(S4)),fA=l1.atom(!1);fA.debugLabel="readOnlyModeAtom";const gA=l1.atom("online");gA.debugLabel="networkModeAtom";const uh1=l1.atom(!1);uh1.debugLabel="codeEditorOpenAtom";const pA=l1.atom(!1);pA.debugLabel="editLayerNameAtom";const dh1=l1.atom("");dh1.debugLabel="activeLanguageAtom";const hh1=l1.atom("");hh1.debugLabel="primaryLanguageAtom";const mA=l1.atom(null);mA.debugLabel="canvasIframeAtom";const zA=l1.atom("outline");zA.debugLabel="activePanelAtom";const bA=l1.atom("");bA.debugLabel="showPredefinedBlockCategoryAtom";const MA=l1.atom({undoCount:0,redoCount:0});MA.debugLabel="historyStatesAtom";const wA=l1.atom("");wA.debugLabel="inlineEditingActiveAtom";const CA=l1.atom(!1);CA.debugLabel="draggingFlagAtom";const VA=l1.atom("");VA.debugLabel="draggedBlockIdAtom";const HA=l1.atom(null);HA.debugLabel="treeRefAtom";const yA=l1.atom({});yA.debugLabel="canvasSettingsAtom";const be=l1.atom(!1);be.debugLabel="askAiActiveBlockAtom";const vh1=()=>l1.useAtomValue(fA),fh1=l1.atom(""),gh1=l1.atom(null),ph1=()=>l1.useAtom(fh1),mh1=()=>l1.useAtom(gh1),zh1=g4("selectedBreakpoints",["XS","MD","XL"]),bh1=()=>{const[t,e]=l1.useAtom(zh1);return[t,e]},xA=()=>{const t=l1.useSetAtom(MA),{clear:e}=fe(),[,c]=p3(),[,a]=uA(),[,r]=aA(),[,n]=_2(be);return()=>{c([]),r([]),a(""),e(),n(!1),t({undoCount:0,redoCount:0})}},Mh1=()=>({data:M2("uiLibraries",[]),isLoading:!1}),wh1=()=>{const[t,e]=h.useState(null),c=h.useCallback(async a=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),e(a),!0}catch(r){return console.warn("Copy failed",r),e(null),!1}},[]);return[t,c]},Ch1=()=>{const[t,e]=dA(),{t:c}=Lt.useTranslation(),a=M2("previewComponent",null);return t?L.jsxRuntimeExports.jsxs("div",{className:U4.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[L.jsxRuntimeExports.jsxs(i3,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>e(!1),children:[L.jsxRuntimeExports.jsx(s2.EyeClosedIcon,{}),L.jsxRuntimeExports.jsx("span",{children:c("Close Preview")})]}),L.jsxRuntimeExports.jsx("div",{children:a?L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx(Vn,{className:"h-96 w-full"}),children:h.createElement(a)}):null})]}):null},Vh1=()=>{const[t,e]=p3(),c=wL(),a=xn(),{undo:r,redo:n}=fe();P6.useHotkeys("esc",()=>e([]),{},[e]),P6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),P6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),P6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),P6.useHotkeys("del, backspace",o=>{o.preventDefault(),c(t)},{},[t,c])},Hh1=(t,e)=>{const c=[];let a=T.find(t,{_id:e}),r=T.get(a,"_parent","");for(;T.isString(r)&&!T.isEmpty(r);)c.push(a==null?void 0:a._parent),a=T.find(t,{_id:r}),r=a==null?void 0:a._parent;return T.flatten(c)},yh1=l1.atom([]),xh1=()=>{const[t]=p3(),e=l1.useAtomValue(S4),[,c]=l1.useAtom(yh1);h.useEffect(()=>{let a=[];const r=T.first(t);T.isString(r)&&(a=[r,...Hh1(e,r)]),c(a)},[t,e,c])};const LA=()=>l1.useAtom(aL),Lh1=()=>h.useMemo(()=>v3.getChaiDataProviders(),[]),Sh1=({children:t})=>{const[,e]=LA(),[c]=rn(),a=Lh1();return h.useEffect(()=>(e({}),T.each(c,r=>{const n=T.find(a,{providerKey:r.providerKey});if(n){const o=(n==null?void 0:n.mockFn)||(n==null?void 0:n.dataFn);o&&o(r.args).then(s=>e(l=>({...l,[r.providerKey]:s})))}}),()=>{T.each(c,r=>{e(n=>(delete n[r.providerKey],n))})}),[a,c,e]),L.jsxRuntimeExports.jsx(L.jsxRuntimeExports.Fragment,{children:t})};function Ah1(t,e,c){c.push(T.find(t,{_id:e}));const a=T.filter(t,{_parent:e});for(const r of a)c.push(...SA(r._id,t));return c}const SA=(t,e)=>{let c=[];return c=T.flattenDeep([...c,...Ah1(e,t,c)]),c},Fh1=l1.atom(!1),AA=()=>{const[t,e]=l1.useAtom(Fh1),[c,a]=h.useState(null),r=M2("askAiCallBack",null),n=nh1(),[o]=Q4();return{askAi:h.useCallback(async(s,l,u)=>{if(r){e(!0),a(null);try{const i=T.cloneDeep(SA(s,o));T.set(i,"0._parent",null);const{blocks:d,error:v}=await r(l,i);if(v){a(v);return}n(d)}catch(i){a(i)}finally{e(!1),u&&u()}}},[r,o]),loading:t,error:c}};var FA={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ng=h.createContext&&h.createContext(FA),u3=function(){return u3=Object.assign||function(t){for(var e,c=1,a=arguments.length;c<a;c++){e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},u3.apply(this,arguments)},Bh1=function(t,e){var c={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(c[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(t);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(t,a[r])&&(c[a[r]]=t[a[r]]);return c};function BA(t){return t&&t.map(function(e,c){return h.createElement(e.tag,u3({key:c},e.attr),BA(e.child))})}function j0(t){return function(e){return h.createElement(Eh1,u3({attr:u3({},t.attr)},e),BA(t.child))}}function Eh1(t){var e=function(c){var a=t.attr,r=t.size,n=t.title,o=Bh1(t,["attr","size","title"]),s=r||c.size||"1em",l;return c.className&&(l=c.className),t.className&&(l=(l?l+" ":"")+t.className),h.createElement("svg",u3({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},c.attr,a,o,{className:l,style:u3(u3({color:t.color||c.color},c.style),t.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),n&&h.createElement("title",null,n),t.children)};return ng!==void 0?h.createElement(ng.Consumer,null,function(c){return e(c)}):e(FA)}function Oh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(t)}function Ph1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(t)}function kh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(t)}function Rh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V285.7l-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"}}]})(t)}const Ih1=[{name:"Improve writing",icon:Rh1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:Oh1,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:s2.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:s2.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:s2.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:A3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:A3.ShuffleIcon,prompt:"Randomize all text elements."}];function Nh1({onClick:t}){const{loading:e}=AA();return L.jsxRuntimeExports.jsx("div",{className:e?"pointer-events-none opacity-50":"",children:L.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:Ih1.map(({name:c,icon:a,subMenus:r,prompt:n})=>r?L.jsxRuntimeExports.jsxs(HS,{children:[L.jsxRuntimeExports.jsx(yS,{asChild:!0,children:L.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c)}),L.jsxRuntimeExports.jsxs(Mn,{children:[L.jsxRuntimeExports.jsx(wn,{children:"My Account"}),L.jsxRuntimeExports.jsx(Cn,{}),L.jsxRuntimeExports.jsx(f6,{children:"Profile"}),L.jsxRuntimeExports.jsx(f6,{children:"Billing"}),L.jsxRuntimeExports.jsx(f6,{children:"Team"}),L.jsxRuntimeExports.jsx(f6,{children:"Subscription"})]})]}):L.jsxRuntimeExports.jsxs("li",{onClick:()=>t(n),className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c))})})}const jh1=({blockId:t})=>{const{t:e}=Lt.useTranslation(),{askAi:c,loading:a,error:r}=AA(),[n,o]=h.useState(""),s=h.useRef(null);h.useEffect(()=>{var u;(u=s.current)==null||u.focus()},[]);const l=()=>{r||o("")};return t?L.jsxRuntimeExports.jsxs("div",{className:"mt-4",children:[L.jsxRuntimeExports.jsxs("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:[e("Ask AI")," (GPT-4o mini)"]}),L.jsxRuntimeExports.jsx(me,{ref:s,value:n,onChange:u=>o(u.target.value),placeholder:e("Ask AI to edit content"),className:"w-full border border-gray-400 focus:border",rows:3,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c(t,n,l))}}),L.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:L.jsxRuntimeExports.jsx(i3,{disabled:n.trim().length<5||a,onClick:()=>c(t,n,l),variant:"default",className:"w-fit",size:"sm",children:a?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(A3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Edit with AI")}),a?L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[L.jsxRuntimeExports.jsxs(Vn,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[L.jsxRuntimeExports.jsx(Ph1,{className:"h-4 w-4 animate-spin text-gray-500"}),L.jsxRuntimeExports.jsx("p",{className:"text-xs",children:e("Generating... Please wait")})]}),L.jsxRuntimeExports.jsx(i3,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:e("Stop")})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:r.message})}),L.jsxRuntimeExports.jsx(Nh1,{onClick:u=>c(t,u,l)})]}):L.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:L.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[L.jsxRuntimeExports.jsx(A3.SparklesIcon,{className:"mx-auto text-3xl"}),L.jsxRuntimeExports.jsx("h1",{children:e("no_block_selected_for_ask_ai")})]})})},Th1=({onOpen:t})=>{const{t:e}=Lt.useTranslation(),c=M2("aiContext",""),[a,r]=h.useState(c),n=h.useRef(null),o=M2("saveAiContextCallback",T.noop),[s,l]=h.useState(!1),[u,i]=h.useState(null),[d,v]=h.useState(!1),{toast:f}=ze(),p=h.useRef(null);h.useEffect(()=>{c&&r(c)},[c]);const g=async()=>{try{l(!0),i(null),await o(a),f({title:e("AI Context updated"),description:e("You can now ask AI to edit your content"),variant:"default"}),p.current.click()}catch(m){i(m)}finally{l(!1)}};return L.jsxRuntimeExports.jsx(yL,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"-mx-2 -mt-2 bg-gray-100 px-2",children:L.jsxRuntimeExports.jsxs(on,{value:"set-context",children:[L.jsxRuntimeExports.jsx(sn,{ref:p,hideArrow:!0,className:"py-2 hover:no-underline",children:L.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between",children:[L.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:e("Set Context For AI")}),L.jsxRuntimeExports.jsxs(i3,{variant:"default",size:"sm",children:[L.jsxRuntimeExports.jsx("span",{children:e(d?"Cancel":"Edit")})," ",d?L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}):L.jsxRuntimeExports.jsx(A3.EditIcon,{className:"h-4 w-4"})]})]})}),L.jsxRuntimeExports.jsxs(ln,{children:[L.jsxRuntimeExports.jsx(me,{ref:n,value:a,onChange:m=>r(m.target.value),placeholder:e("Tell about this page. Eg: This page is about ..."),className:"w-full border border-gray-400 bg-background focus:border",rows:10,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),g())}}),c.trim().length===0?L.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:e("Eg: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.")}):null,L.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[L.jsxRuntimeExports.jsx(i3,{disabled:a.trim().length<5,onClick:()=>g(),variant:"default",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(A3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Save")}),c.trim().length>0?L.jsxRuntimeExports.jsxs(FL,{children:[L.jsxRuntimeExports.jsx(BL,{asChild:!0,children:L.jsxRuntimeExports.jsx(i3,{disabled:c.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(A3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Delete")})}),L.jsxRuntimeExports.jsxs(un,{children:[L.jsxRuntimeExports.jsxs(dn,{children:[L.jsxRuntimeExports.jsx(vn,{children:e("Remove context?")}),L.jsxRuntimeExports.jsx(fn,{})]}),L.jsxRuntimeExports.jsxs(hn,{children:[L.jsxRuntimeExports.jsx(pn,{children:e("Cancel")}),L.jsxRuntimeExports.jsx(gn,{onClick:()=>{r(""),g()},children:"Yes, Delete"})]})]})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:u&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:u.message})})]})]})})},Dh1=()=>{const[t]=p3(),[e,c]=h.useState(!1);return L.jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 z-50 h-full w-full bg-background p-2",children:[L.jsxRuntimeExports.jsx(Th1,{onOpen:a=>c(a)}),e?null:L.jsxRuntimeExports.jsx(jh1,{blockId:T.first(t)})]})},qh1=h.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-biCoYtzR.cjs"))),Zh1=h.lazy(()=>Promise.resolve().then(()=>require("./Topbar-cDxKWgN6.cjs"))),Wh1=h.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-HmbcRpgP.cjs"))),Uh1=h.lazy(()=>Promise.resolve().then(()=>require("./Settings-Rtk4HDKy.cjs"))),Kh1=()=>{const{savePage:t}=ML(),e=M2("autoSaveSupport",!0),c=M2("autoSaveInterval",60);ig.useIntervalEffect(()=>{e&&t()},c*1e3)},Gh1=()=>{const[t]=l1.useAtom(I0),[e]=l1.useAtom(be),c=n=>{iu1()||n.preventDefault()};Vh1(),xh1(),Kh1(),h.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=M2("editable",!0),r=M2("nonEditableComponent",null);return L.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:L.jsxRuntimeExports.jsxs(QL,{children:[L.jsxRuntimeExports.jsxs("div",{onContextMenu:c,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[L.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Zh1,{})})}),L.jsxRuntimeExports.jsxs("main",{className:"relative flex h-full flex-1 flex-row",children:[a?null:L.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-[500] flex h-full w-full items-center justify-center backdrop-blur-[2px]",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(r)})}),L.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-fit border-border",style:{maxHeight:"calc(100vh - 56px)"},children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(qh1,{})})}),L.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Wh1,{})})}),L.jsxRuntimeExports.jsxs("div",{className:"relative flex h-[100%] w-[280px] min-w-[280px] border-l border-border pb-10",children:[L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Uh1,{})}),e?L.jsxRuntimeExports.jsx(Dh1,{}):null]})]})]}),L.jsxRuntimeExports.jsx(Ch1,{})]})})},og=l1.getDefaultStore(),Jh1=()=>L.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:L.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:L.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[L.jsxRuntimeExports.jsx("img",{src:"https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",alt:"Chai Builder",className:"mx-auto w-14 rounded-full"}),L.jsxRuntimeExports.jsx("br",{}),L.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),L.jsxRuntimeExports.jsx("p",{className:"mt-6 text-sm font-medium leading-6 text-white text-opacity-70",children:"Please view this page on greater than 1280px screen width."})]})})});let Yh1=!1;const Xh1=t=>{Yh1=t};const Qh1=t=>{const[,e]=Q4(),[,c]=ve(),a=xA();return h.useEffect(()=>{og.set(Yr,T.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),h.useEffect(()=>{og.set(an,t.dataProviders||[])},[t.dataProviders]),h.useEffect(()=>{e(v3.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),h.useEffect(()=>{lg.changeLanguage(t.locale||"en")},[t.locale]),h.useEffect(()=>{Xh1(t.showDebugLogs)},[t.showDebugLogs]),h.useEffect(()=>{c(t.brandingOptions)},[t.brandingOptions,c]),L.jsxRuntimeExports.jsx(Gh1,{})},_h1=t=>{const e=t._flags||{};return L.jsxRuntimeExports.jsxs(rL,{children:[L.jsxRuntimeExports.jsxs(OA.FlagsProvider,{features:{...lu1,...e},children:[L.jsxRuntimeExports.jsx(nu1,{}),L.jsxRuntimeExports.jsx(Jh1,{}),L.jsxRuntimeExports.jsx(Qh1,{...t})]}),L.jsxRuntimeExports.jsx(jS,{})]})};exports.Accordion=yL;exports.AccordionContent=ln;exports.AccordionItem=on;exports.AccordionTrigger=sn;exports.Alert=xL;exports.AlertDescription=SL;exports.AlertDialog=FL;exports.AlertDialogAction=gn;exports.AlertDialogCancel=pn;exports.AlertDialogContent=un;exports.AlertDialogDescription=fn;exports.AlertDialogFooter=hn;exports.AlertDialogHeader=dn;exports.AlertDialogTitle=vn;exports.AlertDialogTrigger=BL;exports.AlertTitle=LL;exports.Badge=Du1;exports.BlocksExternalDataProvider=Sh1;exports.Button=i3;exports.Card=DL;exports.CardContent=UL;exports.CardDescription=WL;exports.CardFooter=KL;exports.CardHeader=qL;exports.CardTitle=ZL;exports.ChaiBuilderEditor=_h1;exports.Command=Hn;exports.CommandDialog=zd1;exports.CommandEmpty=qS;exports.CommandGroup=ZS;exports.CommandInput=TS;exports.CommandItem=US;exports.CommandList=DS;exports.CommandSeparator=WS;exports.CommandShortcut=KS;exports.ContextMenu=bd1;exports.ContextMenuCheckboxItem=QS;exports.ContextMenuContent=YS;exports.ContextMenuGroup=wd1;exports.ContextMenuItem=XS;exports.ContextMenuLabel=$S;exports.ContextMenuPortal=Cd1;exports.ContextMenuRadioGroup=Hd1;exports.ContextMenuRadioItem=_S;exports.ContextMenuSeparator=tA;exports.ContextMenuShortcut=eA;exports.ContextMenuSub=Vd1;exports.ContextMenuSubContent=JS;exports.ContextMenuSubTrigger=GS;exports.ContextMenuTrigger=Md1;exports.Dialog=mn;exports.DialogContent=pe;exports.DialogDescription=TL;exports.DialogFooter=NL;exports.DialogHeader=IL;exports.DialogTitle=jL;exports.DialogTrigger=PL;exports.DropdownMenu=HS;exports.DropdownMenuCheckboxItem=SS;exports.DropdownMenuContent=Mn;exports.DropdownMenuGroup=ld1;exports.DropdownMenuItem=f6;exports.DropdownMenuLabel=wn;exports.DropdownMenuPortal=id1;exports.DropdownMenuRadioGroup=dd1;exports.DropdownMenuRadioItem=AS;exports.DropdownMenuSeparator=Cn;exports.DropdownMenuShortcut=FS;exports.DropdownMenuSub=ud1;exports.DropdownMenuSubContent=LS;exports.DropdownMenuSubTrigger=xS;exports.DropdownMenuTrigger=yS;exports.ErrorBoundary=rL;exports.FaCircleCheck=kh1;exports.GenIcon=j0;exports.HoverCard=$u1;exports.HoverCardContent=dS;exports.HoverCardTrigger=td1;exports.IconPickerField=xd1;exports.ImagePickerField=Fd1;exports.ImagesPanel=Ad1;exports.Input=GL;exports.Label=JL;exports.LinkField=Ed1;exports.Menubar=tS;exports.MenubarCheckboxItem=oS;exports.MenubarContent=rS;exports.MenubarGroup=Yu1;exports.MenubarItem=nS;exports.MenubarLabel=lS;exports.MenubarMenu=Ju1;exports.MenubarPortal=Xu1;exports.MenubarRadioGroup=_u1;exports.MenubarRadioItem=sS;exports.MenubarSeparator=iS;exports.MenubarShortcut=uS;exports.MenubarSub=Qu1;exports.MenubarSubContent=aS;exports.MenubarSubTrigger=cS;exports.MenubarTrigger=eS;exports.Popover=Ku1;exports.PopoverContent=$L;exports.PopoverTrigger=Gu1;exports.RichTextEditorField=Bd1;exports.ScrollArea=YL;exports.ScrollBar=zn;exports.Select=ed1;exports.SelectContent=vS;exports.SelectGroup=cd1;exports.SelectItem=gS;exports.SelectLabel=fS;exports.SelectSeparator=pS;exports.SelectTrigger=hS;exports.SelectValue=ad1;exports.Separator=BS;exports.Sheet=rd1;exports.SheetClose=od1;exports.SheetContent=bS;exports.SheetDescription=VS;exports.SheetFooter=wS;exports.SheetHeader=MS;exports.SheetTitle=CS;exports.SheetTrigger=nd1;exports.Skeleton=Vn;exports.Switch=HL;exports.Tabs=XL;exports.TabsContent=xt;exports.TabsList=bn;exports.TabsTrigger=yt;exports.Textarea=me;exports.Toaster=jS;exports.Toggle=VL;exports.Tooltip=Wu1;exports.TooltipContent=_L;exports.TooltipPortal=Zu1;exports.TooltipProvider=QL;exports.TooltipTrigger=Uu1;exports.activePanelAtom=zA;exports.aiAssistantActiveAtom=be;exports.badgeVariants=AL;exports.builderSaveStateAtom=I0;exports.buttonVariants=ge;exports.canAcceptChildBlock=ga;exports.canDeleteBlock=vu1;exports.canDuplicateBlock=hu1;exports.canvasIframeAtom=mA;exports.canvasSettingsAtom=yA;exports.convertDotNotationToObject=Lu1;exports.draggedBlockIdAtom=VA;exports.draggingFlagAtom=CA;exports.editLayerNameAtom=pA;exports.getBlockJSONFromSchemas=ma;exports.getBlockJSONFromUISchemas=pa;exports.inlineEditingActiveAtom=wA;exports.networkModeAtom=gA;exports.reducer=ES;exports.showPredefinedBlockCategoryAtom=bA;exports.toast=OS;exports.toggleVariants=CL;exports.treeDSBlocks=lL;exports.treeRefAtom=HA;exports.useActiveModal=lh1;exports.useActivePanel=ph1;exports.useAddBlock=Od1;exports.useAddBlockParent=mh1;exports.useAddClassesToBlocks=Nd1;exports.useAllBlocks=ih1;exports.useBlocksContainer=Eu1;exports.useBlocksStore=Q4;exports.useBlocksStoreUndoableActions=N4;exports.useBrandingOptions=ve;exports.useBuilderProp=M2;exports.useBuilderReset=xA;exports.useCanvasWidth=jd1;exports.useCanvasZoom=Dd1;exports.useChaiExternalData=LA;exports.useCopyBlockIds=qd1;exports.useCopyToClipboard=wh1;exports.useCurrentPage=gL;exports.useCutBlockIds=lA;exports.useDarkMode=Zd1;exports.useDuplicateBlocks=xn;exports.useGetPageData=bL;exports.useHiddenBlockIds=Ud1;exports.useHighlightBlockId=uA;exports.usePageDataProviders=rn;exports.usePasteBlocks=Jd1;exports.usePreviewMode=dA;exports.useReadOnlyMode=vh1;exports.useRemoveBlocks=wL;exports.useRemoveClassesFromBlocks=Qd1;exports.useSavePage=ML;exports.useSelectedBlock=wu1;exports.useSelectedBlockAllClasses=_d1;exports.useSelectedBlockCanvasSetting=Vu1;exports.useSelectedBlockCurrentClasses=eh1;exports.useSelectedBlockCustomStylingStates=Hu1;exports.useSelectedBlockIds=p3;exports.useSelectedBlocksDisplayChild=Mu1;exports.useSelectedBreakpoints=bh1;exports.useSelectedStylingBlocks=aA;exports.useStylingBreakpoint=rA;exports.useStylingState=ch1;exports.useToast=ze;exports.useUILibraryBlocks=Mh1;exports.useUndoManager=fe;exports.useUpdateBlocksProps=ah1;exports.useUpdateBlocksPropsRealtime=oh1;
|
|
@@ -41737,7 +41737,7 @@ const Id1 = (t) => {
|
|
|
41737
41737
|
}
|
|
41738
41738
|
)
|
|
41739
41739
|
] });
|
|
41740
|
-
}, Rd1 = p.lazy(() => import("./UnsplashImages-
|
|
41740
|
+
}, Rd1 = p.lazy(() => import("./UnsplashImages-Gx7dy6mp.js")), Nd1 = p.lazy(() => import("./UploadImages-aClrfKqQ.js")), MS = ({
|
|
41741
41741
|
isModalView: t = !1,
|
|
41742
41742
|
onSelect: e = () => {
|
|
41743
41743
|
}
|
|
@@ -42701,7 +42701,7 @@ const Nh1 = ({ blockId: t }) => {
|
|
|
42701
42701
|
/* @__PURE__ */ L.jsx(Th1, { onOpen: (a) => c(a) }),
|
|
42702
42702
|
e ? null : /* @__PURE__ */ L.jsx(Nh1, { blockId: e4(t) })
|
|
42703
42703
|
] });
|
|
42704
|
-
}, Dh1 = _t(() => import("./SidePanels-
|
|
42704
|
+
}, Dh1 = _t(() => import("./SidePanels-9XdRZ7rz.js")), qh1 = _t(() => import("./Topbar-OpgHjdWn.js")), Zh1 = _t(() => import("./CanvasArea-a3WMBMi3.js")), Wh1 = _t(() => import("./Settings-a7j3ihRx.js")), Uh1 = () => {
|
|
42705
42705
|
const { savePage: t } = $i1(), e = B2("autoSaveSupport", !0), c = B2("autoSaveInterval", 60);
|
|
42706
42706
|
aF(() => {
|
|
42707
42707
|
e && t();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { V as h, a6 as f, a7 as j, a8 as y, a9 as v, aa as P } from "./ChaiBuilderEditor-
|
|
2
|
+
import { V as h, a6 as f, a7 as j, a8 as y, a9 as v, aa as P } from "./ChaiBuilderEditor-yf2LRjL1.js";
|
|
3
3
|
import { sortBy as b, filter as w, get as C, isEmpty as m, find as n, capitalize as N, map as S } from "lodash-es";
|
|
4
4
|
import { toast as k } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { a as B, u as E, c as T, d as V } from "./index-
|
|
6
|
+
import { a as B, u as E, c as T, d as V } from "./index-rKrjj7Vz.js";
|
|
7
7
|
import { BriefcaseIcon as I } from "lucide-react";
|
|
8
8
|
import { useTranslation as L } from "react-i18next";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./ChaiBuilderEditor--NV-B5az.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-PXyps6Qc.cjs"),p=require("lucide-react"),f=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./core.cjs");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
|