@chaibuilder/sdk 1.2.9 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +10 -12
  2. package/dist/AddBlocks-TSt8uJY4.js +218 -0
  3. package/dist/AddBlocks-k2p8Hy1n.cjs +1 -0
  4. package/dist/BrandingOptions-WyVWfFVz.cjs +1 -0
  5. package/dist/{BrandingOptions-QJJ1y5ez.js → BrandingOptions-uFTyYJZj.js} +18 -22
  6. package/dist/CanvasArea-5erOZYLy.cjs +60 -0
  7. package/dist/{CanvasArea-mlNKmCOh.js → CanvasArea-iRQqpOak.js} +465 -481
  8. package/dist/{utils-AvyFzbPC.js → Class-17XFhL48.js} +15 -16
  9. package/dist/Class-5ARpH_Tu.cjs +1 -0
  10. package/dist/CurrentPage-NzmJloN7.cjs +1 -0
  11. package/dist/{CurrentPage-lBy25sZn.js → CurrentPage-RCxTz9Mc.js} +24 -26
  12. package/dist/{Layers-3Xs4A5i8.js → Layers-tXB5Pwid.js} +124 -158
  13. package/dist/Layers-xDG7oltg.cjs +1 -0
  14. package/dist/PagesPanel-72nzYB1k.cjs +1 -0
  15. package/dist/{PagesPanel--BZhafnt.js → PagesPanel-Jaz9jvye.js} +14 -16
  16. package/dist/{ProjectPanel-YcLkM-DW.js → ProjectPanel--S014Xx3.js} +22 -24
  17. package/dist/ProjectPanel-RU0QvH6e.cjs +1 -0
  18. package/dist/Settings-5EuwaVb3.cjs +1 -0
  19. package/dist/{Settings-TAgX4hov.js → Settings-gjvl5V1k.js} +556 -579
  20. package/dist/{SidePanels-btVQQkVK.js → SidePanels-Fq3kRwR0.js} +54 -51
  21. package/dist/SidePanels-uNCxnGte.cjs +1 -0
  22. package/dist/Topbar-JqW89xI5.cjs +1 -0
  23. package/dist/{Topbar-j4t4AgCq.js → Topbar-m5dbbI1f.js} +15 -17
  24. package/dist/{UnsplashImages-41Y3q5_Q.js → UnsplashImages-GhBD6owT.js} +24 -26
  25. package/dist/UnsplashImages-vACw5hbK.cjs +1 -0
  26. package/dist/UploadImages-PzHdEKHT.cjs +1 -0
  27. package/dist/{UploadImages-xBg-kbKv.js → UploadImages-S1HgxeGb.js} +23 -25
  28. package/dist/{add-page-modal-cm8damU2.js → add-page-modal-2P5hGXOQ.js} +15 -17
  29. package/dist/add-page-modal-GAizM2Jw.cjs +1 -0
  30. package/dist/{confirm-alert-i4pM3mOt.js → confirm-alert-57Xq5foA.js} +12 -14
  31. package/dist/confirm-alert-Uf84DpdR.cjs +1 -0
  32. package/dist/core.cjs +1 -1
  33. package/dist/core.d.ts +13 -58
  34. package/dist/core.js +47 -58
  35. package/dist/defaultTheme-IH19g4fv.cjs +1 -0
  36. package/dist/defaultTheme-YY8mlQS3.js +1055 -0
  37. package/dist/delete-page-modal-MG42FdnU.cjs +1 -0
  38. package/dist/{delete-page-modal-YrIBvfFA.js → delete-page-modal-ix5IjaFW.js} +27 -29
  39. package/dist/email-blocks.cjs +1 -1
  40. package/dist/email-blocks.js +100 -81
  41. package/dist/email.cjs +1 -0
  42. package/dist/email.d.ts +116 -0
  43. package/dist/email.js +79 -0
  44. package/dist/{controls-XPXGHKht.js → empty-slot-MWycClTb.js} +61 -50
  45. package/dist/empty-slot-TF2kd-0X.cjs +1 -0
  46. package/dist/{form-VbouZlAW.cjs → form-KBb3kA8g.cjs} +1 -1
  47. package/dist/{form-OVmsLOrc.js → form-SYcFyACJ.js} +18 -18
  48. package/dist/{index-pZhGT8uT.js → index-Fj3ead-J.js} +4886 -4884
  49. package/dist/index-aiHDvS5v.cjs +1 -0
  50. package/dist/{index-N50dZnlC.cjs → index-cM3eKmlx.cjs} +25 -25
  51. package/dist/index-pNYv0oAF.js +2994 -0
  52. package/dist/lib.cjs +3 -3
  53. package/dist/lib.js +95 -1125
  54. package/dist/page-viewer-Sh99FGYk.cjs +1 -0
  55. package/dist/{page-viewer-feqJr1QI.js → page-viewer-VxqOevr4.js} +15 -17
  56. package/dist/project-general-setting-VTLHa-Ik.cjs +1 -0
  57. package/dist/{project-general-setting-SgagORzW.js → project-general-setting-nWOjPiin.js} +15 -17
  58. package/dist/{project-seo-setting-wxAGEkd_.js → project-seo-setting-70bWTwsB.js} +17 -19
  59. package/dist/project-seo-setting-ENAKc2Dl.cjs +1 -0
  60. package/dist/render.cjs +1 -1
  61. package/dist/render.d.ts +2 -0
  62. package/dist/render.js +111 -70
  63. package/dist/{single-page-detail-dnWMyg6P.js → single-page-detail-3z7TF-Yy.js} +44 -46
  64. package/dist/single-page-detail-6L38HJC4.cjs +1 -0
  65. package/dist/studio.cjs +1 -1
  66. package/dist/studio.js +13 -15
  67. package/dist/ui.cjs +1 -1
  68. package/dist/ui.d.ts +4 -4
  69. package/dist/ui.js +149 -151
  70. package/dist/{useAddBlockByDrop-inkD7Lck.cjs → useAddBlockByDrop-7mUMwNSG.cjs} +1 -1
  71. package/dist/{useAddBlockByDrop-_nwI4W3q.js → useAddBlockByDrop-tjQ5DgiO.js} +1 -1
  72. package/dist/web-blocks.cjs +1 -9
  73. package/dist/web-blocks.js +431 -442
  74. package/package.json +8 -2
  75. package/dist/AddBlocks-tMxKPoen.js +0 -225
  76. package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
  77. package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
  78. package/dist/CanvasArea-xs4wM64L.cjs +0 -60
  79. package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
  80. package/dist/Layers-eaHy5PK9.cjs +0 -1
  81. package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
  82. package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
  83. package/dist/PagesPanel-gGKCV394.cjs +0 -1
  84. package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
  85. package/dist/Settings-7wlLcvoh.cjs +0 -1
  86. package/dist/SidePanels-5H4j0mIs.cjs +0 -1
  87. package/dist/Topbar-V8xCetWF.cjs +0 -1
  88. package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
  89. package/dist/UploadImages-DnQ95_NW.cjs +0 -1
  90. package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
  91. package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
  92. package/dist/controls-Dy1qa8Dc.cjs +0 -1
  93. package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
  94. package/dist/functions-Ox_svtKm.cjs +0 -1
  95. package/dist/functions-xIebp8Aw.js +0 -23
  96. package/dist/index-H6vIwGfD.cjs +0 -1
  97. package/dist/index-niHREMmR.js +0 -2938
  98. package/dist/page-viewer-SLt8XgYv.cjs +0 -1
  99. package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
  100. package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
  101. package/dist/single-page-detail-IPod1o5P.cjs +0 -1
  102. package/dist/utils-PTxFk6qT.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";const n=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("react"),fn=require("@radix-ui/react-toggle"),ie=require("class-variance-authority"),u=require("./utils-PTxFk6qT.cjs"),xn=require("@radix-ui/react-switch"),gn=require("@radix-ui/react-slot"),bn=require("@radix-ui/react-accordion"),L=require("@radix-ui/react-icons"),hn=require("@radix-ui/react-alert-dialog"),vn=require("@radix-ui/react-dialog"),yn=require("@radix-ui/react-label"),jn=require("@radix-ui/react-scroll-area"),wn=require("@radix-ui/react-tabs"),Rn=require("@radix-ui/react-tooltip"),kn=require("@radix-ui/react-popover"),Nn=require("@radix-ui/react-menubar"),Sn=require("@radix-ui/react-hover-card"),An=require("@radix-ui/react-select"),Cn=require("@radix-ui/react-dropdown-menu"),En=require("@radix-ui/react-separator"),_n=require("@radix-ui/react-toast"),U=require("cmdk"),Bn=require("@radix-ui/react-context-menu"),wt=require("react-icons-picker"),Tn=require("react-dom"),i=require("lodash-es"),Pn=require("react-quill"),d=require("jotai"),Rt=require("flat-to-nested"),X=require("./Functions-N3yhPYKY.cjs"),xe=require("redux-undo"),Ne=require("@chaibuilder/runtime"),$e=require("lodash"),F=require("./MODIFIERS-2FeVfZQ9.cjs"),In=require("@react-hookz/web");require("react-i18next");function D(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const f=D(w),kt=D(fn),Ve=D(xn),ae=D(bn),V=D(hn),_=D(vn),Nt=D(yn),ne=D(jn),le=D(wn),ue=D(Rn),be=D(kn),C=D(Nn),Se=D(Sn),M=D(An),B=D(Cn),St=D(En),G=D(_n),T=D(Bn);var O={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let Mn=0;function K(e,t){const s=`atom${++Mn}`,o={toString:()=>s};return typeof e=="function"?o.read=e:(o.init=e,o.read=r=>r(o),o.write=(r,a,l)=>a(o,typeof l=="function"?l(r(o)):l)),t&&(o.write=t),o}const Ie=e=>"init"in e,Me=e=>!!e.write,we=new WeakMap,Dn=(e,t)=>{we.set(e,t),e.catch(()=>{}).finally(()=>we.delete(e))},lt=(e,t)=>{const s=we.get(e);s&&(we.delete(e),s(t))},ct=(e,t)=>{e.status="fulfilled",e.value=t},dt=(e,t)=>{e.status="rejected",e.reason=t},On=e=>typeof(e==null?void 0:e.then)=="function",fe=(e,t)=>"v"in e&&"v"in t&&Object.is(e.v,t.v),ut=(e,t)=>"e"in e&&"e"in t&&Object.is(e.e,t.e),de=e=>"v"in e&&e.v instanceof Promise,Ln=(e,t)=>"v"in e&&"v"in t&&e.v.orig&&e.v.orig===t.v.orig,ve=e=>{if("e"in e)throw e.e;return e.v},At=()=>{const e=new WeakMap,t=new WeakMap,s=new Map;let o,r,a;(O?"production":void 0)!=="production"&&(o=new Set,r=new Set,a=new Set);const l=m=>e.get(m),p=(m,g)=>{(O?"production":void 0)!=="production"&&Object.freeze(g);const y=e.get(m);if(e.set(m,g),s.has(m)||s.set(m,y),y&&de(y)){const b="v"in g?g.v instanceof Promise?g.v:Promise.resolve(g.v):Promise.reject(g.e);lt(y.v,b)}},x=(m,g,y)=>{const b=new Map;let j=!1;y.forEach((v,k)=>{!v&&k===m&&(v=g),v?(b.set(k,v),g.d.get(k)!==v&&(j=!0)):(O?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(j||g.d.size!==b.size)&&(g.d=b)},c=(m,g,y)=>{const b=l(m),j={d:(b==null?void 0:b.d)||new Map,v:g};if(y&&x(m,j,y),b&&fe(b,j)&&b.d===j.d)return b;if(b&&de(b)&&de(j)&&Ln(b,j)){if(b.d===j.d)return b;j.v=b.v}return p(m,j),j},h=(m,g,y,b)=>{if(On(g)){let j;const v=new Promise((k,P)=>{let S=!1;g.then(E=>{if(!S){S=!0;const A=l(m),J=c(m,v,y);ct(v,E),k(E),(A==null?void 0:A.d)!==J.d&&$(m,J,A==null?void 0:A.d)}},E=>{if(!S){S=!0;const A=l(m),J=c(m,v,y);dt(v,E),P(E),(A==null?void 0:A.d)!==J.d&&$(m,J,A==null?void 0:A.d)}}),j=E=>{S||(S=!0,E.then(A=>ct(v,A),A=>dt(v,A)),k(E))}});return v.orig=g,v.status="pending",Dn(v,k=>{k&&j(k),b==null||b()}),c(m,v,y)}return c(m,g,y)},R=(m,g,y)=>{const b=l(m),j={d:(b==null?void 0:b.d)||new Map,e:g};return y&&x(m,j,y),b&&ut(b,j)&&b.d===j.d?b:(p(m,j),j)},N=m=>{const g=l(m);if(g&&(g.d.forEach((S,E)=>{E!==m&&!t.has(E)&&N(E)}),Array.from(g.d).every(([S,E])=>{const A=l(S);return S===m||A===E||A&&!de(A)&&fe(A,E)})))return g;const y=new Map;let b=!0;const j=S=>{if(S===m){const A=l(S);if(A)return y.set(S,A),ve(A);if(Ie(S))return y.set(S,void 0),S.init;throw new Error("no atom init")}const E=N(S);return y.set(S,E),ve(E)};let v,k;const P={get signal(){return v||(v=new AbortController),v.signal},get setSelf(){return(O?"production":void 0)!=="production"&&!Me(m)&&console.warn("setSelf function cannot be used with read-only atom"),!k&&Me(m)&&(k=(...S)=>{if((O?"production":void 0)!=="production"&&b&&console.warn("setSelf function cannot be called in sync"),!b)return Q(m,...S)}),k}};try{const S=m.read(j,P);return h(m,S,y,()=>v==null?void 0:v.abort())}catch(S){return R(m,S,y)}finally{b=!1}},I=m=>ve(N(m)),q=m=>{let g=t.get(m);return g||(g=Y(m)),g},z=(m,g)=>!g.l.size&&(!g.t.size||g.t.size===1&&g.t.has(m)),Z=m=>{const g=t.get(m);g&&z(m,g)&&oe(m)},ce=m=>{const g=new Map,y=new WeakMap,b=v=>{const k=t.get(v);k==null||k.t.forEach(P=>{P!==v&&(g.set(P,(g.get(P)||new Set).add(v)),y.set(P,(y.get(P)||0)+1),b(P))})};b(m);const j=v=>{const k=t.get(v);k==null||k.t.forEach(P=>{var S;if(P!==v){let E=y.get(P);if(E&&y.set(P,--E),!E){let A=!!((S=g.get(P))!=null&&S.size);if(A){const J=l(P),pn=N(P);A=!J||!fe(J,pn)}A||g.forEach(J=>J.delete(P))}j(P)}})};j(m)},ee=(m,...g)=>{let y=!0;const b=k=>ve(N(k)),j=(k,...P)=>{let S;if(k===m){if(!Ie(k))throw new Error("atom not writable");const E=l(k),A=h(k,P[0]);(!E||!fe(E,A))&&ce(k)}else S=ee(k,...P);if(!y){const E=te();(O?"production":void 0)!=="production"&&r.forEach(A=>A({type:"async-write",flushed:E}))}return S},v=m.write(b,j,...g);return y=!1,v},Q=(m,...g)=>{const y=ee(m,...g),b=te();return(O?"production":void 0)!=="production"&&r.forEach(j=>j({type:"write",flushed:b})),y},Y=(m,g)=>{const y={t:new Set(g&&[g]),l:new Set};if(t.set(m,y),(O?"production":void 0)!=="production"&&a.add(m),N(m).d.forEach((b,j)=>{const v=t.get(j);v?v.t.add(m):j!==m&&Y(j,m)}),N(m),Me(m)&&m.onMount){const b=m.onMount((...j)=>Q(m,...j));b&&(y.u=b)}return y},oe=m=>{var g;const y=(g=t.get(m))==null?void 0:g.u;y&&y(),t.delete(m),(O?"production":void 0)!=="production"&&a.delete(m);const b=l(m);b?(de(b)&&lt(b.v),b.d.forEach((j,v)=>{if(v!==m){const k=t.get(v);k&&(k.t.delete(m),z(v,k)&&oe(v))}})):(O?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",m)},$=(m,g,y)=>{const b=new Set(g.d.keys());y==null||y.forEach((j,v)=>{if(b.has(v)){b.delete(v);return}const k=t.get(v);k&&(k.t.delete(m),z(v,k)&&oe(v))}),b.forEach(j=>{const v=t.get(j);v?v.t.add(m):t.has(m)&&Y(j,m)})},te=()=>{let m;for((O?"production":void 0)!=="production"&&(m=new Set);s.size;){const g=Array.from(s);s.clear(),g.forEach(([y,b])=>{const j=l(y);if(j){j.d!==(b==null?void 0:b.d)&&$(y,j,b==null?void 0:b.d);const v=t.get(y);v&&!(b&&!de(b)&&(fe(b,j)||ut(b,j)))&&(v.l.forEach(k=>k()),(O?"production":void 0)!=="production"&&m.add(y))}else(O?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((O?"production":void 0)!=="production")return o.forEach(g=>g("state")),m},se=(m,g)=>{const y=q(m),b=te(),j=y.l;return j.add(g),(O?"production":void 0)!=="production"&&(o.forEach(v=>v("sub")),r.forEach(v=>v({type:"sub",flushed:b}))),()=>{j.delete(g),Z(m),(O?"production":void 0)!=="production"&&(o.forEach(v=>v("unsub")),r.forEach(v=>v({type:"unsub"})))}};return(O?"production":void 0)!=="production"?{get:I,set:Q,sub:se,dev_subscribe_store:(m,g)=>g!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),o.add(m),()=>{o.delete(m)}):(r.add(m),()=>{r.delete(m)}),dev_get_mounted_atoms:()=>a.values(),dev_get_atom_state:m=>e.get(m),dev_get_mounted:m=>t.get(m),dev_restore_atoms:m=>{for(const[y,b]of m)Ie(y)&&(h(y,b),ce(y));const g=te();r.forEach(y=>y({type:"restore",flushed:g}))}}:{get:I,set:Q,sub:se}};let De;const Vn=()=>(De||(De=At()),De);var zn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Fn=w.createContext(void 0),Ge=e=>{const t=w.useContext(Fn);return(e==null?void 0:e.store)||t||Vn()};const qn=e=>typeof(e==null?void 0:e.then)=="function",Un=w.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)});function Ct(e,t){const s=Ge(t),[[o,r,a],l]=w.useReducer(c=>{const h=s.get(e);return Object.is(c[0],h)&&c[1]===s&&c[2]===e?c:[h,s,e]},void 0,()=>[s.get(e),s,e]);let p=o;(r!==s||a!==e)&&(l(),p=s.get(e));const x=t==null?void 0:t.delay;return w.useEffect(()=>{const c=s.sub(e,()=>{if(typeof x=="number"){setTimeout(l,x);return}l()});return l(),c},[s,e,x]),w.useDebugValue(p),qn(p)?Un(p):p}function Et(e,t){const s=Ge(t);return w.useCallback((...r)=>{if((zn?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return s.set(e,...r)},[s,e])}function $n(e,t){return[Ct(e,t),Et(e,t)]}var He={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const _t=Symbol();function Gn(e,t){const s=K(e,(o,r,a)=>r(s,t(o(s),a)));return s}const mt=(e,t,s)=>(t.has(s)?t:t.set(s,e())).get(s),Hn=new WeakMap,Wn=(e,t,s)=>{const o=mt(()=>new WeakMap,Hn,t);return mt(e,o,s)},Yn={},pt=e=>!!e.write,Kn=e=>typeof e=="function";function Jn(e,t){return Wn(()=>{const s=new WeakMap,o=(l,p)=>{let x=s.get(l);if(x)return x;const c=p&&s.get(p),h=[],R=[];return l.forEach((N,I)=>{const q=t?t(N):I;R[I]=q;const z=c&&c.atomList[c.keyList.indexOf(q)];if(z){h[I]=z;return}const Z=ee=>{const Q=ee(r),Y=ee(e),$=o(Y,Q==null?void 0:Q.arr).keyList.indexOf(q);if($<0||$>=Y.length){const te=l[o(l).keyList.indexOf(q)];if(te)return te;throw new Error("splitAtom: index out of bounds for read")}return Y[$]},ce=(ee,Q,Y)=>{const oe=ee(r),$=ee(e),se=o($,oe==null?void 0:oe.arr).keyList.indexOf(q);if(se<0||se>=$.length)throw new Error("splitAtom: index out of bounds for write");const m=Kn(Y)?Y($[se]):Y;Q(e,[...$.slice(0,se),m,...$.slice(se+1)])};h[I]=pt(e)?K(Z,ce):K(Z)}),c&&c.keyList.length===R.length&&c.keyList.every((N,I)=>N===R[I])?x=c:x={arr:l,atomList:h,keyList:R},s.set(l,x),x},r=K(l=>{const p=l(r),x=l(e);return o(x,p==null?void 0:p.arr)});(He?"production":void 0)!=="production"&&(r.debugPrivate=!0),r.init=void 0;const a=pt(e)?K(l=>l(r).atomList,(l,p,x)=>{switch(x.type){case"remove":{const c=l(a).indexOf(x.atom);if(c>=0){const h=l(e);p(e,[...h.slice(0,c),...h.slice(c+1)])}break}case"insert":{const c=x.before?l(a).indexOf(x.before):l(a).length;if(c>=0){const h=l(e);p(e,[...h.slice(0,c),x.value,...h.slice(c)])}break}case"move":{const c=l(a).indexOf(x.atom),h=x.before?l(a).indexOf(x.before):l(a).length;if(c>=0&&h>=0){const R=l(e);c<h?p(e,[...R.slice(0,c),...R.slice(c+1,h),R[c],...R.slice(h)]):p(e,[...R.slice(0,h),R[c],...R.slice(h,c),...R.slice(c+1)])}break}}}):K(l=>l(r).atomList);return a},e,t||Yn)}function Qn(e){const t=Symbol(),s=K(t);(He?"production":void 0)!=="production"&&(s.debugPrivate=!0);const o=K((r,a)=>{const l=r(s);return l!==t?l:e(r,a)},(r,a,l)=>{if(l===_t)a(s,t);else if(typeof l=="function"){const p=r(o);a(s,l(p))}else a(s,l)});return o}const Xn=e=>typeof(e==null?void 0:e.then)=="function";function Zn(e){let t,s;const o={getItem:(r,a)=>{var l,p;const x=h=>{if(h=h||"",t!==h){try{s=JSON.parse(h)}catch{return a}t=h}return s},c=(p=(l=e())==null?void 0:l.getItem(r))!=null?p:null;return Xn(c)?c.then(x):x(c)},setItem:(r,a)=>{var l;return(l=e())==null?void 0:l.setItem(r,JSON.stringify(a))},removeItem:r=>{var a;return(a=e())==null?void 0:a.removeItem(r)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(o.subscribe=(r,a,l)=>{if(!(e()instanceof window.Storage))return()=>{};const p=x=>{if(x.storageArea===e()&&x.key===r){let c;try{c=JSON.parse(x.newValue||"")}catch{c=l}a(c)}};return window.addEventListener("storage",p),()=>{window.removeEventListener("storage",p)}}),o}const er=Zn(()=>typeof window<"u"?window.localStorage:void 0);function me(e,t,s=er,o){const r=o==null?void 0:o.unstable_getOnInit,a=K(r?s.getItem(e,t):t);return(He?"production":void 0)!=="production"&&(a.debugPrivate=!0),a.onMount=p=>{r||p(s.getItem(e,t));let x;return s.subscribe&&(x=s.subscribe(e,p,t)),x},K(p=>p(a),(p,x,c)=>{const h=typeof c=="function"?c(p(a)):c;return h===_t?(x(a,t),s.removeItem(e)):h instanceof Promise?h.then(R=>(x(a,R),s.setItem(e,R))):(x(a,h),s.setItem(e,h))})}const Ae=d.atom(null);Ae.debugLabel="chaiBuilderPropsAtom";const Bt=d.atom({});Bt.debugLabel="chaiExternalDataAtom";const tr=()=>!1,sr=e=>{const t=e.replace(F.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}};const or=new Rt({children:"blockNodes"}),Tt=(e,t=null)=>i.flatten(e.map(s=>{if(s=t!==null?{...s,parent:t}:s,s.children&&s.children.length){const o=[...s.children];return delete s.children,i.flatten([s,...Tt(o,s._id)])}return s}));function Pt(e,t,s){const o=i.filter(e,a=>a._parent===t),r=[];for(let a=0;a<o.length;a++){const l=It(o[a]);if(Object.keys(l).length>0&&Object.keys(l).forEach(p=>{o[a][p]=`slot:${X.generateUUID()}`}),i.filter(e,{_parent:o[a]._id}).length>0){const p=X.generateUUID();r.push({...o[a],oldId:o[a]._id,_id:p,_parent:s}),r.push(i.flatten(Pt(e,o[a]._id,p)))}else r.push({...o[a],oldId:o[a]._id,_id:X.generateUUID(),_parent:s})}return i.flatten(r)}function nr(e){let t=or.convert(e.map(s=>i.omit(s,["settings"])));return t=!t.type&&t.blockNodes?t.blockNodes:i.isEmpty(t)?[]:[t],t}const It=e=>{const t={};return Object.keys(e).forEach(s=>{i.isString(e[s])&&e[s].startsWith("slot")&&(t[s]=e[s].replace("slot:",""))}),t},rr=(e,t,s=null)=>{let o=i.find(e,{_id:t});o={...o,oldId:o._id,_id:X.generateUUID()},s&&(o={...o,_parent:s});const r=[o];i.filter(e,{_parent:t}).length>0&&r.push(i.flatten(Pt(e,t,o._id)));const a=i.flatten(r);return i.map(a,l=>{const p=l,x=It(p);return Object.keys(x).length>0&&Object.keys(x).forEach(c=>{const h=i.find(a,{oldId:x[c].replace("slot:","")});p[c]=`slot:${h._id}`}),i.omit(p,["global","oldId"])})};const ar=xe((e=[],t)=>{switch(t.type){case"add_new_blocks":case"add_duplicate_blocks":return[...e,...t.payload];case"create_snapshot":return[...e];case"set_blocks":case"set_page_blocks":return[...t.payload];case"update_props":case"update_props_realtime":const{payload:s}=t;return e.map(o=>(s.ids.includes(o._id)&&!i.isEmpty(t.payload.props)&&Object.keys(t.payload.props).forEach(r=>{i.set(o,r,t.payload.props[r])}),o));default:return e}},{debug:!1,ignoreInitialState:!1,limit:30,filter:xe.excludeAction(["update_props_realtime","add_duplicate_blocks","set_page_blocks"])}),Ce=Gn({past:[],present:[],future:[]},ar);Ce.debugLabel="pageBlocksAtom";const H=d.atom(e=>{var t;return(t=e(Ce))==null?void 0:t.present});H.debugLabel="presentBlocksAtom";const We=Jn(H);We.debugLabel="pageBlocksAtomsAtom";const Mt=d.atom(e=>nr(e(H)));Mt.debugLabel="pageBlocksTreeAtom";const ir=d.atom("");ir.debugLabel="builderActivePageAtom";const lr=d.atom(-1);lr.debugLabel="destinationDropIndexAtom";const Dt=d.atom([]);Dt.debugLabel="buildingBlocksAtom";const Ot=d.atom(e=>{const t=e(Dt);return i.filter(t,s=>i.has(s,"blockId"))});Ot.debugLabel="globalBlocksAtom";const W=()=>{const[,e]=d.useAtom(Ce);return e},cr=()=>{const e=W(),t=d.useAtomValue(Mt),s=w.useCallback(o=>{const r=Tt(o);e({type:"set_page_blocks",payload:r})},[e]);return[t,s]},dr=()=>{const e=W();return[w.useCallback(s=>{e({type:"set_page_blocks",payload:s})},[e])]},ze=(e,t)=>{if(!e)return!0;const s=Ne.getBlockComponent(e);return s&&$e.has(s,"canAcceptBlock")?s.canAcceptBlock(t):!1},ur=e=>{const t=Ne.getBlockComponent(e);return t&&$e.has(t,"canDuplicate")?t.canDuplicate():!0},mr=e=>{const t=Ne.getBlockComponent(e);return t&&$e.has(t,"canDelete")?t.canDelete():!0},pr=(e,{dragSource:t,dropTarget:s})=>{const o=i.get(t,"data._type",""),r=i.get(s,"data._type","");return ze(r,o)},Ye=d.atom([]);Ye.debugLabel="selectedBlockIdsAtom";const Ke=d.atom(e=>{const t=e(H),s=e(Ye);return i.map(i.filter(t,({_id:o})=>i.includes(s,o)),o=>({...o}))});Ke.debugLabel="selectedBlocksAtom";const Je=d.atom(e=>{const t=e(Ke);return t.length===0?null:t.length===1?t[0]:{type:"Multiple",id:i.map(t,"id")}});Je.debugLabel="selectedBlockAtom";const fr=e=>i.get(e,"parent",null),xr=d.atom(e=>{const t=e(Ke),s=i.map(t,fr);return i.filter(e(H),o=>i.includes(s,o._id))});xr.debugLabel="selectedBlocksParentsAtom";const Lt=d.atom(()=>!1);Lt.debugLabel="selectedBlockFlexChildAtom";const Vt=d.atom(()=>!1);Vt.debugLabel="selectedBlockGridChildAtom";const Qe=d.atom("");Qe.debugLabel="styleStateAtom";const zt=me("styleBreakpoint","xs");zt.debugLabel="styleBreakpointAtom";const gr=()=>({flexChild:d.useAtomValue(Lt),gridChild:d.useAtomValue(Vt)}),br=()=>d.useAtomValue(Je);const pe=()=>{const[e,t]=d.useAtom(Ye),s=w.useCallback(o=>{t(r=>i.includes(r,o)?i.without(r,o):[...r,o])},[t]);return[e,t,s]},Fe=e=>{switch(e.type){case"singular":return e.uiSchema;case"model":const{properties:t}=e,s={};return Object.keys(t).forEach(a=>{const l=t[a];if(i.includes(["slot","styles"],l.type))return;const p=a;s[p]=Fe(l)}),s;case"list":const{itemProperties:o}=e,r={items:{}};return Object.keys(o).forEach(a=>{const l=o[a];if(i.includes(["slot","styles"],l.type))return;const p=a;r.items[p]=Fe(l)}),r;default:return{}}},qe=e=>{switch(e.type){case"singular":return e.schema;case"model":const{properties:t,title:s}=e,o={title:s,type:"object",properties:{}};return Object.keys(t).forEach(p=>{const x=t[p];if(i.includes(["slot","styles"],x.type))return;const c=p;o.properties[c]=qe(x)}),o;case"list":const{itemProperties:r,title:a}=e,l={title:a,type:"array",items:{type:"object",properties:{}}};return Object.keys(r).forEach(p=>{const x=r[p];if(i.includes(["slot","styles"],x.type))return;const c=p;l.items.properties[c]=qe(x),i.set(l.items,"title",i.get(x,"itemTitle",`${a} item`))}),l;default:return{}}},Ft=e=>{const t={};return Object.keys(e).forEach(s=>{t[s]=vr(e[s])}),t},hr=e=>{if(i.isEmpty(e.default))return[];const{itemProperties:t}=e;return i.map(e.default,s=>{const o={...s};return i.forIn(s,(r,a)=>{i.has(t,a)&&i.get(t[a],"i18n",!1)&&(o[a]=F.I18N_KEY)}),o})},vr=e=>{switch(e.type){case"styles":return e.default;case"slot":return`${F.SLOT_KEY}${X.generateUUID()}`;case"singular":const{i18n:t,schema:s}=e;return t?F.I18N_KEY:i.get(s,"default","");case"model":return Ft(e.properties);case"list":return hr(e);default:return""}};const qt=()=>d.useAtomValue(H);function ft(e,t,s,o,r){if(s!==null){const x=i.findIndex(e,{_parent:t}),c=(x===-1?0:x)+s;return e.splice(c,0,...o),e}if(!r){const c=i.findIndex(e,{_id:t})+1;return e.splice(c,0,...o),e}let a=i.findIndex(e,{_id:t});const l=i.filter(e,{_parent:t});i.isEmpty(l)||(a=i.findIndex(e,{_id:i.last(l)._id}));const p=a+1;return e.splice(p,0,...o),e}const yr=()=>{const e=W(),t=qt(),[,s]=pe(),o=w.useCallback((a,l,p)=>{var R;for(let N=0;N<a.length;N++){const{_id:I}=a[N];a[N]._id=X.generateUUID();const q=i.filter(a,{_parent:I});for(let z=0;z<q.length;z++)q[z]._parent=a[N]._id}const x=i.first(a);let c;l&&(c=i.find(t,{_id:l}),a[0]._parent=l);const h=c?ze(c._type,x._type):!0;return!h&&c&&(a[0]._parent=c._parent),e({type:"set_blocks",payload:ft(t,l||null,p||null,a,h)}),s([(R=i.first(a))==null?void 0:R._id]),i.first(a)},[t,e,s]);return{addCoreBlock:w.useCallback((a,l,p)=>{if(i.has(a,"blocks")){const z=a.blocks;return o(z,l,p)}const x=X.generateUUID(),c=Ft(a.props),h=[];i.forIn(c,(z,Z)=>{if(i.startsWith(z,F.SLOT_KEY)){const ce=z.replace(F.SLOT_KEY,"");h.push({_id:ce,_type:"Slot",_parent:x,_name:a.props[Z].name,_styles:a.props[Z].styles,_emptyStyles:a.props[Z].emptyStyles})}});const R={_type:a.type,_id:x,...c};let N;l&&(N=i.find(t,{_id:l}),R._parent=l);const I=N?ze(N._type,a.type):!0;!I&&N&&(R._parent=N._parent);const q=[R,...h];return e({type:"set_blocks",payload:ft(t,l||null,p||null,q,I)}),s([R._id]),R},[o,t,e,s]),addPredefinedBlock:o}},xt={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},gt=["xs","sm","md","lg","xl","2xl"];function jr(e,t){if(t===null)return"baseClasses";const s=t.mq;if(s==="xs"||t.dark||t.mod!=="")return"classes";let o="baseClasses",r=gt.indexOf(s);for(;r>0;){const a=gt[r-1];if(i.find(e,{mq:a,property:t.property})){o="classes";break}r--}return o}const bt=[];function wr(e="",t="",s=[]){e=e.trim().replace(/ +/g,"");let o=i.filter(i.map(e.split(" "),u.constructClassObject),c=>!i.isNull(c)),r=i.filter(i.map(t.split(" "),u.constructClassObject),c=>!i.isNull(c));r=i.filter(r,c=>!i.includes(bt,c.property));const a=[],l=[];i.each(s,c=>{const h=u.constructClassObject(c),R=i.find(o,i.pick(h,["dark","mq","mod","property"]));if(R&&(o=i.filter(o,N=>N.fullCls!==(R==null?void 0:R.fullCls))),a.push(h),h.mq==="xs"&&!h.dark&&h.mod===""&&(r=i.filter(r,N=>N.property!==h.property)),jr(o,h)==="baseClasses"&&!i.includes(bt,h.property)){const N=i.find(r,i.pick(h,["property"]));R&&(r=i.filter(r,I=>I.fullCls!==(N==null?void 0:N.fullCls))),l.push({...h,fullCls:h.cls,mq:"xs"})}});const p=i.map(i.sortBy([...o,...a],c=>xt[c.mq]),"fullCls").join(" ");return`${i.map(i.sortBy([...r,...l],c=>xt[c.mq]),"fullCls").join(" ").trim()},${p.trim()}`.trim().replace(/ +/g,"")}const he=d.atom([]);he.debugLabel="selectedStylingBlocksAtom";const Xe=()=>d.useAtom(he),Rr=e=>{const t=e.replace(F.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},kr=d.atom(null,(e,t,{blockIds:s,newClasses:o,dispatch:r})=>{const a=i.filter(e(We),p=>s.includes(e(p)._id)),l=i.first(e(he));i.each(a,p=>{const x=e(p),c=i.get(x,l.prop,`${F.STYLES_KEY},`),{baseClasses:h,classes:R}=Rr(c);r({type:"update_props_realtime",payload:{ids:[x._id],props:{[l.prop]:`${F.STYLES_KEY}${wr(R,h,o)}`}}})})}),Nr=()=>{const e=W(),t=d.useSetAtom(kr);return w.useCallback((s,o,r)=>{t({blockIds:s,newClasses:o,dispatch:e}),r&&setTimeout(()=>e({type:"create_snapshot"}),500)},[e,t])},ht=()=>{},Ut=()=>{const e=Ne.useChaiBlocks(),t=d.useAtomValue(Ot),s=()=>{ht()},o=w.useCallback(()=>ht(),[]);return[e,t,s,o]},Sr=d.atom(!1),$t=()=>{const[e,t]=d.useAtom(Sr);return[e,t]},Ar=d.atom(F.BRANDING_OPTIONS_DEFAULTS),Cr=d.atom(null),Gt=()=>{const[e,t]=d.useAtom(Ar);return[i.isObject(e)?{...F.BRANDING_OPTIONS_DEFAULTS,...e}:F.BRANDING_OPTIONS_DEFAULTS,t]},Er=()=>d.useAtom(Cr),_r=d.atom(null),Ht=()=>({currentPage:d.useAtomValue(_r)}),Wt=new Rt({});function Br(e){let t=Wt.convert(e);return t=!t.type&&t.children&&t.children.length?t.children:i.isEmpty(t)?[]:[t],t}const Ze=(e,t)=>i.flatten(e.map(s=>{if(s=t?{...s,parent:t}:{...s},s.children){const o=[...s.children];return delete s.children,i.flatten([s,...Ze(o,s._id)])}return s}));function et(e,t=!1){for(let s=0;s<e.length;s++){const o=e[s];o.global&&!t?e[s]={type:"GlobalBlock",blockId:o.blockId,_parent:i.get(o,"parent",null),_id:o._id}:o.children&&o.children.length&&et(o.children)}}function Yt(e){let t=[],s=i.filter(e,{type:"GlobalBlock"});return s.length>0&&(s=i.map(s,Kt),i.each(s,o=>{t=[...t,...Tr(o)]})),t}function Tr(e){let t=[];const s=i.get(i.first(e),"parent",null);i.set(i.first(e),"parent",null);const o=[Wt.convert(Jt(e))];et(o,!0);let r=Ze(o,e[0]._id);return r=i.set(r,"0.parent",s),t=[...t,r,...Yt(r)],t}function Kt(e){const t=i.find(Ue,{_id:e._id});if(!t)return[];const s=[t],o=i.filter(Ue,{_parent:e._id});return o.length?i.flatten([...s,...i.flatten(i.map(o,Kt))]):i.flatten(s)}const Jt=e=>JSON.parse(JSON.stringify(e));let Ue=[];function Pr(e){Ue=e;const t=Br(Jt(e));et(t);const s=Ze(t,null),o=Yt(s),r={};return i.each(o,a=>i.set(r,i.first(a).blockId,a)),[s,r]}const tt=()=>{const[e]=Gt(),{currentPage:t}=Ht(),s=d.useAtomValue(H);return w.useCallback(()=>{const o=i.map(s,l=>i.omit(l,["expanded","order","title","siblings","tempClasses"])),[r=[],a=[]]=Pr(o);return{currentPage:t,blocks:r,globalBlocks:a}},[e,t,s])},re=(e,t=void 0)=>{const s=d.useAtomValue(Ae);return i.get(s,e,t)},Qt=d.atom(!1);Qt.debugLabel="readOnlyModeAtom";const Xt=d.atom(!1);Xt.debugLabel="advanceStylingOpenAtom";const Zt=d.atom("online");Zt.debugLabel="networkModeAtom";const Ir=d.atom(!1);Ir.debugLabel="codeEditorOpenAtom";const es=d.atom(!1);es.debugLabel="editLayerNameAtom";const Mr=d.atom("");Mr.debugLabel="activeLanguageAtom";const Dr=d.atom("");Dr.debugLabel="primaryLanguageAtom";const ts=d.atom(null);ts.debugLabel="canvasIframeAtom";const ss=d.atom("layers");ss.debugLabel="activePanelAtom";const os=d.atom("");os.debugLabel="showPredefinedBlockCategoryAtom";const Ee=d.atom({undoCount:0,redoCount:0});Ee.debugLabel="historyStatesAtom";const ns=d.atom("");ns.debugLabel="inlineEditingActiveAtom";const rs=d.atom(!1);rs.debugLabel="draggingFlagAtom";const as=d.atom("");as.debugLabel="draggedBlockIdAtom";const st=d.atom([]);st.debugLabel="dataProvidersAtom";const is=()=>d.useAtom(st),_e=d.atom("SAVED");_e.debugLabel="pageSyncStateAtom";const Or=()=>{const[e,t]=d.useAtom(_e),s=re("onSaveBlocks",async()=>{}),o=re("onSavePage",async()=>{}),r=re("onSyncStatusChange",()=>{}),a=tt(),l=d.useSetAtom(Ee),{undoCount:p,redoCount:x}=Be(),[c]=is();return{savePage:In.useThrottledCallback(async()=>{t("SAVING"),r("SAVING");const R=a();return await o({blocks:R.blocks,providers:c}),setTimeout(()=>{l({undoCount:p,redoCount:x}),t("SAVED"),r("SAVED")},100),!0},[a,t,r,s],5e3),syncState:e,setSyncState:t}},Be=()=>{const e=d.useAtomValue(Ce),[{undoCount:t,redoCount:s}]=d.useAtom(Ee),o=W(),[r]=$t(),[,a]=pe(),[,l]=Xe(),[p,x]=d.useAtom(_e),c=re("onSyncStatusChange",()=>{}),h=w.useCallback(()=>{o({type:"create_snapshot"})},[o]);return w.useEffect(()=>{(p==="SAVED"&&t!==(e==null?void 0:e.past.length)||s!==(e==null?void 0:e.future.length))&&(x("UNSAVED"),c("UNSAVED"))},[e==null?void 0:e.past.length,e==null?void 0:e.future.length,t,s,c,x,p]),{undoCount:e==null?void 0:e.past.length,redoCount:e==null?void 0:e.future.length,undo:w.useCallback(()=>{r||(o(xe.ActionCreators.undo()),setTimeout(()=>{l([]),a([])},200))},[o,r,a,l]),redo:w.useCallback(()=>{r||(o(xe.ActionCreators.redo()),setTimeout(()=>{l([]),a([])},200))},[r,o,l,a]),clear:()=>{o(xe.ActionCreators.clearHistory())},createSnapshot:h}},ls=()=>d.useAtom(zt),cs=me("canvasWidth",800),ds=d.atom(e=>{const t=e(cs);return X.getBreakpointValue(t).toLowerCase()}),Lr=()=>{const[e,t]=d.useAtom(cs),s=d.useAtomValue(ds),[o,r]=ls();return w.useEffect(()=>{o!=="xs"&&r(s)},[s,o,r]),[e,s,t]},Vr=me("canvasZoom",100),zr=()=>d.useAtom(Vr),us=d.atom([]),ms=()=>{const[e,t]=d.useAtom(us),s=d.useSetAtom(ot),o=w.useCallback(r=>{t(r),s([])},[t,s]);return[e,o]},ot=d.atom([]),Fr=()=>{const[e,t]=d.useAtom(ot),s=d.useSetAtom(us),o=w.useCallback(r=>{t(r),s([])},[t,s]);return[e,o]},ps=me("darkMode",!1),qr=()=>{const[e,t]=d.useAtom(ps);return[e,t]},Ur=d.atom(!1),$r=()=>{const[e,t]=d.useAtom(Ur);return[e,t]},fs=()=>{const e=W(),t=d.useAtomValue(H),[,s]=pe();return w.useCallback((o,r=null)=>{const a=[];i.each(o,l=>{const x=rr(t,l,r===l?null:r);a.push(i.get(x,"0._id","")),e({type:"add_duplicate_blocks",payload:x})}),s(a),e({type:"create_snapshot"})},[t,s,e])},Gr=d.atom([]),Hr=()=>{const[e,t]=d.useAtom(Gr),s=w.useCallback(o=>{t(r=>i.includes(r,o)?i.without(r,o):[...r,o])},[t]);return[e,t,s]},Wr=d.atom(""),xs=()=>d.useAtom(Wr),Yr=()=>{const e=d.useAtomValue(H),t=W(),s=tt(),[,,o]=Ut();return w.useCallback(async(r,a)=>{const l=X.generateUUID(16),p=i.map(e,x=>(x._id===r&&(x._globalBlockId=l,x._name=a),x));t({type:"set_page_blocks",payload:p}),o()},[e,t,s,o])},Kr=()=>({}),Jr=()=>{const e=d.useAtomValue(H),t=W();return w.useCallback((s,o)=>{const r=i.map(e,a=>(i.includes(s,i.get(a,"_id"))&&i.set(a,"_parent",o),a));t({type:"set_blocks",payload:r})},[e,t])},Qr=()=>{const e=d.useAtomValue(ot),[t,s]=ms(),o=fs(),r=Jr();return{canPaste:w.useMemo(()=>t.length>0||e.length>0,[e,t]),pasteBlocks:w.useCallback(l=>{i.isEmpty(e)?r(t,l):o(e,l),s(()=>[])},[t,e,o,r,s])}},Xr=d.atom(""),Zr=()=>{const e=d.useAtomValue(Xr),t=w.useCallback(()=>{},[]),s=w.useCallback(()=>{},[]),o=w.useCallback(()=>{},[]);return{currentProject:e,createProject:o,deleteProject:t,updateProject:s}},gs=(e,t)=>{const s=[],o=i.filter(e,r=>i.includes(t,r._id)||i.includes(t,r._parent)?(s.push(r._id),!1):!0);return i.isEmpty(s)?o:gs(o,s)},ea=()=>{const e=W(),t=d.useAtomValue(H),[s,o]=pe();return w.useCallback(r=>{var p;const a=((p=i.find(t,{_id:r[0]}))==null?void 0:p._parent)||null,l=gs(t,r);e({type:"set_blocks",payload:l}),setTimeout(()=>o(a?[a]:[]),200)},[t,o,e,s])},ta=d.atom(null,(e,t,{blockIds:s,fullClasses:o,dispatch:r})=>{const a=i.first(e(he)),l=i.filter(e(We),p=>s.includes(e(p)._id));i.each(l,p=>{const x=e(p),c=o;let{classes:h,baseClasses:R}=sr(i.get(x,a.prop,"styles:,"));i.each(c,N=>{const I=new RegExp(`(^| )${N.replace("[","\\[").replace("]","\\]")}($| )`,"g");h=h.replace(I," ").replace(/ +/g," ").trim();const q=i.first(N.split(":"));i.includes(["2xl","xl","lg","md","sm"],q)&&c.push(N.split(":").pop().trim())}),i.each(c,N=>{const I=new RegExp(`(^| )${N.replace("[","\\[").replace("]","\\]")}($| )`,"g");R=R.replace(I," ").replace(/ +/g," ").trim()}),r({type:"update_props_realtime",payload:{ids:[x._id],props:{[a.prop]:`${F.STYLES_KEY}${R},${h}`}}})})}),sa=()=>{const e=W(),t=d.useSetAtom(ta);return w.useCallback((s,o)=>{t({blockIds:s,fullClasses:o,dispatch:e}),setTimeout(()=>e({type:"create_snapshot"}))},[e,t])},bs=d.atom(e=>{const t=i.first(e(he)),s=e(Je);if(!t||t.blockId!==i.get(s,"_id",null))return[];const r=i.get(s,t.prop,`${F.STYLES_KEY},`).replace(F.STYLES_KEY,"").split(",").join(" ");return i.filter(i.map(r.trim().split(" "),u.constructClassObject),a=>!i.isNull(a))}),oa=()=>d.useAtomValue(bs),vt={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},na=d.atom(e=>{const t=e(ds),s=e(Qe),o=e(ps),r=ra(t);let a=i.filter(e(bs),{mod:s});return i.startsWith(s,"_")||(a=i.filter(a,l=>r.includes(l.mq))),a=a.sort((l,p)=>vt[l.mq]-vt[p.mq]),o||(a=i.filter(a,{dark:!1})),a}),ra=e=>{let t=[];switch(e){case"xs":t=["xs"];break;case"sm":t=["xs","sm"];break;case"md":t=["xs","sm","md"];break;case"lg":t=["xs","sm","md","lg"];break;case"xl":t=["xs","sm","md","lg","xl"];break;case"2xl":t=["xs","sm","md","lg","xl","2xl"];break;default:t=["xs"];break}return t},aa=()=>d.useAtomValue(na),ia=()=>d.useAtom(Qe),hs=d.atom(null,(e,t,{blockIds:s,props:o,dispatch:r})=>{r({type:"update_props_realtime",payload:{ids:s,props:o}})}),la=()=>{const{createSnapshot:e}=Be(),t=W(),s=d.useSetAtom(hs);return w.useCallback((o,r)=>{s({blockIds:o,props:r,dispatch:t}),e()},[e,t,s])},ca=()=>{const e=W(),t=d.useSetAtom(hs);return w.useCallback((s,o)=>{t({blockIds:s,props:o,dispatch:e})},[e,t])},vs={name:"",props:{},modalProps:{},backdropClose:!0},da=d.atom(vs),ua=()=>{const[e,t]=d.useAtom(da),s=w.useCallback((r,a={},l={})=>{t({name:r,props:a,modalProps:l})},[t]),o=w.useCallback((...r)=>{i.get(e,"props.onClose",()=>{})(...r),t(vs)},[t,e]);return{activeModal:e,openModal:s,closeModal:o}},ma=()=>d.useAtomValue(Qt),pa=d.atom(""),fa=d.atom(null),xa=()=>d.useAtom(pa),ga=()=>d.useAtom(fa),ba=me("selectedBreakpoints",["XS","MD","XL"]),ha=()=>{const[e,t]=d.useAtom(ba);return[e,t]},va=()=>{const e=d.useSetAtom(Ee),{clear:t}=Be(),[,s]=pe(),[,o]=xs(),[,r]=Xe();return()=>{s([]),r([]),o(""),t(),e({undoCount:0,redoCount:0})}},ya=d.atom({en:{}}),ja=()=>{const[e,t]=d.useAtom(ya),s=w.useCallback((o,r,a)=>{i.set(e,`${o}.${r}`,a),t(e)},[e,t]);return[e,s]},wa=(e,t)=>{const[s]=d.useAtom(Ae);return i.get(s,e,t)},Ra=d.atom([]),ka=()=>{const[e,t]=w.useState(!1),[s,o]=d.useAtom(Ra),r=re("getUILibraryBlocks",()=>[]);return w.useEffect(()=>{(async()=>s.length>0||(t(!0),o(await r()),t(!1)))()},[]),{data:s,isLoading:e}},ys=ie.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"}}),js=f.forwardRef(({className:e,variant:t,size:s,...o},r)=>n.jsxRuntimeExports.jsx(kt.Root,{ref:r,className:u.cn(ys({variant:t,size:s,className:e})),...o}));js.displayName=kt.Root.displayName;const ws=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(Ve.Root,{className:u.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",e),...t,ref:s,children:n.jsxRuntimeExports.jsx(Ve.Thumb,{className:u.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")})}));ws.displayName=Ve.Root.displayName;const Te=ie.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"}}),Rs=f.forwardRef(({className:e,variant:t,size:s,asChild:o=!1,...r},a)=>{const l=o?gn.Slot:"button";return n.jsxRuntimeExports.jsx(l,{className:u.cn(Te({variant:t,size:s,className:e})),ref:a,...r})});Rs.displayName="Button";const Na=ae.Root,ks=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(ae.Item,{ref:s,className:u.cn("border-b",e),...t}));ks.displayName="AccordionItem";const Ns=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsx(ae.Header,{className:"flex",children:n.jsxRuntimeExports.jsxs(ae.Trigger,{ref:o,className:u.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,n.jsxRuntimeExports.jsx(L.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Ns.displayName=ae.Trigger.displayName;const Ss=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsx(ae.Content,{ref:o,className:u.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...s,children:n.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:t})}));Ss.displayName=ae.Content.displayName;const Sa=ie.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"}}),As=f.forwardRef(({className:e,variant:t,...s},o)=>n.jsxRuntimeExports.jsx("div",{ref:o,role:"alert",className:u.cn(Sa({variant:t}),e),...s}));As.displayName="Alert";const Cs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("h5",{ref:s,className:u.cn("mb-1 font-medium leading-none tracking-tight",e),...t}));Cs.displayName="AlertTitle";const Es=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("text-sm [&_p]:leading-relaxed",e),...t}));Es.displayName="AlertDescription";const _s=ie.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"}}),Aa=({className:e,variant:t,...s})=>n.jsxRuntimeExports.jsx("div",{className:u.cn(_s({variant:t}),e),...s}),Ca=V.Root,Ea=V.Trigger,Bs=({className:e,...t})=>n.jsxRuntimeExports.jsx(V.Portal,{className:u.cn(e),...t});Bs.displayName=V.Portal.displayName;const Ts=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(V.Overlay,{className:u.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",e),...t,ref:s}));Ts.displayName=V.Overlay.displayName;const Ps=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsxs(Bs,{children:[n.jsxRuntimeExports.jsx(Ts,{}),n.jsxRuntimeExports.jsx(V.Content,{ref:s,className:u.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",e),...t})]}));Ps.displayName=V.Content.displayName;const Is=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Is.displayName="AlertDialogHeader";const Ms=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ms.displayName="AlertDialogFooter";const Ds=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(V.Title,{ref:s,className:u.cn("text-lg font-semibold",e),...t}));Ds.displayName=V.Title.displayName;const Os=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(V.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Os.displayName=V.Description.displayName;const Ls=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(V.Action,{ref:s,className:u.cn(Te(),e),...t}));Ls.displayName=V.Action.displayName;const Vs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(V.Cancel,{ref:s,className:u.cn(Te({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Vs.displayName=V.Cancel.displayName;const nt=_.Root,zs=_.Trigger,Fs=({className:e,...t})=>n.jsxRuntimeExports.jsx(_.Portal,{className:u.cn(e),...t});Fs.displayName=_.Portal.displayName;const qs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(_.Overlay,{ref:s,className:u.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",e),...t}));qs.displayName=_.Overlay.displayName;const Pe=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(Fs,{children:[n.jsxRuntimeExports.jsx(qs,{}),n.jsxRuntimeExports.jsxs(_.Content,{ref:o,className:u.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",e),...s,children:[t,n.jsxRuntimeExports.jsxs(_.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:[n.jsxRuntimeExports.jsx(L.Cross2Icon,{className:"h-4 w-4"}),n.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Pe.displayName=_.Content.displayName;const Us=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Us.displayName="DialogHeader";const $s=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$s.displayName="DialogFooter";const Gs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(_.Title,{ref:s,className:u.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));Gs.displayName=_.Title.displayName;const Hs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(_.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Hs.displayName=_.Description.displayName;const Ws=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Ws.displayName="Card";const Ys=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("flex flex-col space-y-1.5 p-6",e),...t}));Ys.displayName="CardHeader";const Ks=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("h3",{ref:s,className:u.cn("font-semibold leading-none tracking-tight",e),...t}));Ks.displayName="CardTitle";const Js=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("p",{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Js.displayName="CardDescription";const Qs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("p-6 pt-0",e),...t}));Qs.displayName="CardContent";const Xs=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn(" flex items-center p-6 pt-0",e),...t}));Xs.displayName="CardFooter";const Zs=f.forwardRef(({className:e,type:t,...s},o)=>n.jsxRuntimeExports.jsx("input",{type:t,className:u.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",e),ref:o,...s}));Zs.displayName="Input";const _a=ie.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),eo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(Nt.Root,{ref:s,className:u.cn(_a(),e),...t}));eo.displayName=Nt.Root.displayName;const to=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx("textarea",{className:u.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...t}));to.displayName="Textarea";const so=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(ne.Root,{ref:o,className:u.cn("relative overflow-hidden",e),...s,children:[n.jsxRuntimeExports.jsx(ne.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),n.jsxRuntimeExports.jsx(rt,{}),n.jsxRuntimeExports.jsx(ne.Corner,{})]}));so.displayName=ne.Root.displayName;const rt=f.forwardRef(({className:e,orientation:t="vertical",...s},o)=>n.jsxRuntimeExports.jsx(ne.ScrollAreaScrollbar,{ref:o,orientation:t,className:u.cn("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",e),...s,children:n.jsxRuntimeExports.jsx(ne.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));rt.displayName=ne.ScrollAreaScrollbar.displayName;const oo=le.Root,at=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(le.List,{ref:s,className:u.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));at.displayName=le.List.displayName;const Re=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(le.Trigger,{ref:s,className:u.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",e),...t}));Re.displayName=le.Trigger.displayName;const ke=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(le.Content,{ref:s,className:u.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));ke.displayName=le.Content.displayName;const Ba=ue.Portal,Ta=ue.Provider,Pa=ue.Root,Ia=ue.Trigger,no=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>n.jsxRuntimeExports.jsx(ue.Content,{ref:o,sideOffset:t,className:u.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",e),...s}));no.displayName=ue.Content.displayName;const Ma=be.Root,Da=be.Trigger,ro=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},r)=>n.jsxRuntimeExports.jsx(be.Portal,{children:n.jsxRuntimeExports.jsx(be.Content,{ref:r,align:t,sideOffset:s,className:u.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",e),...o})}));ro.displayName=be.Content.displayName;const Oa=C.Menu,La=C.Group,Va=C.Portal,za=C.Sub,Fa=C.RadioGroup,ao=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(C.Root,{ref:s,className:u.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",e),...t}));ao.displayName=C.Root.displayName;const io=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(C.Trigger,{ref:s,className:u.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",e),...t}));io.displayName=C.Trigger.displayName;const lo=f.forwardRef(({className:e,inset:t,children:s,...o},r)=>n.jsxRuntimeExports.jsxs(C.SubTrigger,{ref:r,className:u.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",t&&"pl-8",e),...o,children:[s,n.jsxRuntimeExports.jsx(L.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));lo.displayName=C.SubTrigger.displayName;const co=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(C.SubContent,{ref:s,className:u.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",e),...t}));co.displayName=C.SubContent.displayName;const uo=f.forwardRef(({className:e,align:t="start",alignOffset:s=-4,sideOffset:o=8,...r},a)=>n.jsxRuntimeExports.jsx(C.Portal,{children:n.jsxRuntimeExports.jsx(C.Content,{ref:a,align:t,alignOffset:s,sideOffset:o,className:u.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",e),...r})}));uo.displayName=C.Content.displayName;const mo=f.forwardRef(({className:e,inset:t,...s},o)=>n.jsxRuntimeExports.jsx(C.Item,{ref:o,className:u.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",t&&"pl-8",e),...s}));mo.displayName=C.Item.displayName;const po=f.forwardRef(({className:e,children:t,checked:s,...o},r)=>n.jsxRuntimeExports.jsxs(C.CheckboxItem,{ref:r,className:u.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",e),checked:s,...o,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(C.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.CheckIcon,{className:"h-4 w-4"})})}),t]}));po.displayName=C.CheckboxItem.displayName;const fo=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(C.RadioItem,{ref:o,className:u.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",e),...s,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(C.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));fo.displayName=C.RadioItem.displayName;const xo=f.forwardRef(({className:e,inset:t,...s},o)=>n.jsxRuntimeExports.jsx(C.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));xo.displayName=C.Label.displayName;const go=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(C.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));go.displayName=C.Separator.displayName;const bo=({className:e,...t})=>n.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});bo.displayname="MenubarShortcut";const qa=Se.Root,Ua=Se.Trigger,ho=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},r)=>n.jsxRuntimeExports.jsx(Se.Content,{ref:r,align:t,sideOffset:s,className:u.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",e),...o}));ho.displayName=Se.Content.displayName;const $a=M.Root,Ga=M.Group,Ha=M.Value,vo=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(M.Trigger,{ref:o,className:u.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",e),...s,children:[t,n.jsxRuntimeExports.jsx(M.Icon,{asChild:!0,children:n.jsxRuntimeExports.jsx(L.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));vo.displayName=M.Trigger.displayName;const yo=f.forwardRef(({className:e,children:t,position:s="popper",...o},r)=>n.jsxRuntimeExports.jsx(M.Portal,{children:n.jsxRuntimeExports.jsx(M.Content,{ref:r,className:u.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",s==="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",e),position:s,...o,children:n.jsxRuntimeExports.jsx(M.Viewport,{className:u.cn("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));yo.displayName=M.Content.displayName;const jo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(M.Label,{ref:s,className:u.cn("px-2 py-1.5 text-sm font-semibold",e),...t}));jo.displayName=M.Label.displayName;const wo=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(M.Item,{ref:o,className:u.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",e),...s,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(M.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.CheckIcon,{className:"h-4 w-4"})})}),n.jsxRuntimeExports.jsx(M.ItemText,{children:t})]}));wo.displayName=M.Item.displayName;const Ro=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(M.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Ro.displayName=M.Separator.displayName;const Wa=_.Root,Ya=_.Trigger,Ka=_.Close,ko=({className:e,...t})=>n.jsxRuntimeExports.jsx(_.Portal,{className:u.cn(e),...t});ko.displayName=_.Portal.displayName;const No=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(_.Overlay,{className:u.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",e),...t,ref:s}));No.displayName=_.Overlay.displayName;const Ja=ie.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"}}),So=f.forwardRef(({side:e="right",className:t,children:s,...o},r)=>n.jsxRuntimeExports.jsxs(ko,{children:[n.jsxRuntimeExports.jsx(No,{}),n.jsxRuntimeExports.jsxs(_.Content,{ref:r,className:u.cn(Ja({side:e}),t),...o,children:[s,n.jsxRuntimeExports.jsxs(_.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:[n.jsxRuntimeExports.jsx(L.Cross2Icon,{className:"h-4 w-4"}),n.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));So.displayName=_.Content.displayName;const Ao=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ao.displayName="SheetHeader";const Co=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Co.displayName="SheetFooter";const Eo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(_.Title,{ref:s,className:u.cn("text-lg font-semibold text-foreground",e),...t}));Eo.displayName=_.Title.displayName;const _o=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(_.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));_o.displayName=_.Description.displayName;const Qa=B.Root,Xa=B.Trigger,Za=B.Group,ei=B.Portal,ti=B.Sub,si=B.RadioGroup,Bo=f.forwardRef(({className:e,inset:t,children:s,...o},r)=>n.jsxRuntimeExports.jsxs(B.SubTrigger,{ref:r,className:u.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",t&&"pl-8",e),...o,children:[s,n.jsxRuntimeExports.jsx(L.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Bo.displayName=B.SubTrigger.displayName;const To=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(B.SubContent,{ref:s,className:u.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",e),...t}));To.displayName=B.SubContent.displayName;const Po=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>n.jsxRuntimeExports.jsx(B.Portal,{children:n.jsxRuntimeExports.jsx(B.Content,{ref:o,sideOffset:t,className:u.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",e),...s})}));Po.displayName=B.Content.displayName;const Io=f.forwardRef(({className:e,inset:t,...s},o)=>n.jsxRuntimeExports.jsx(B.Item,{ref:o,className:u.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",t&&"pl-8",e),...s}));Io.displayName=B.Item.displayName;const Mo=f.forwardRef(({className:e,children:t,checked:s,...o},r)=>n.jsxRuntimeExports.jsxs(B.CheckboxItem,{ref:r,className:u.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",e),checked:s,...o,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(B.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.CheckIcon,{className:"h-4 w-4"})})}),t]}));Mo.displayName=B.CheckboxItem.displayName;const Do=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(B.RadioItem,{ref:o,className:u.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",e),...s,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(B.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Do.displayName=B.RadioItem.displayName;const Oo=f.forwardRef(({className:e,inset:t,...s},o)=>n.jsxRuntimeExports.jsx(B.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));Oo.displayName=B.Label.displayName;const Lo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(B.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Lo.displayName=B.Separator.displayName;const Vo=({className:e,...t})=>n.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest opacity-60",e),...t});Vo.displayName="DropdownMenuShortcut";const zo=f.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...o},r)=>n.jsxRuntimeExports.jsx(St.Root,{ref:r,decorative:s,orientation:t,className:u.cn("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));zo.displayName=St.Root.displayName;const oi=1,ni=1e6;let Oe=0;function ri(){return Oe=(Oe+1)%Number.MAX_VALUE,Oe.toString()}const Le=new Map,yt=e=>{if(Le.has(e))return;const t=setTimeout(()=>{Le.delete(e),ge({type:"REMOVE_TOAST",toastId:e})},ni);Le.set(e,t)},Fo=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,oi)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;return s?yt(s):e.toasts.forEach(o=>{yt(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==t.toastId)}}},ye=[];let je={toasts:[]};function ge(e){je=Fo(je,e),ye.forEach(t=>{t(je)})}function qo({...e}){const t=ri(),s=r=>ge({type:"UPDATE_TOAST",toast:{...r,id:t}}),o=()=>ge({type:"DISMISS_TOAST",toastId:t});return ge({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:r=>{r||o()}}}),{id:t,dismiss:o,update:s}}function Uo(){const[e,t]=f.useState(je);return f.useEffect(()=>(ye.push(t),()=>{const s=ye.indexOf(t);s>-1&&ye.splice(s,1)}),[e]),{...e,toast:qo,dismiss:s=>ge({type:"DISMISS_TOAST",toastId:s})}}const ai=G.Provider,$o=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(G.Viewport,{ref:s,className:u.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]",e),...t}));$o.displayName=G.Viewport.displayName;const ii=ie.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"}}),Go=f.forwardRef(({className:e,variant:t,...s},o)=>n.jsxRuntimeExports.jsx(G.Root,{ref:o,className:u.cn(ii({variant:t}),e),...s}));Go.displayName=G.Root.displayName;const li=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(G.Action,{ref:s,className:u.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",e),...t}));li.displayName=G.Action.displayName;const Ho=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(G.Close,{ref:s,className:u.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",e),"toast-close":"",...t,children:n.jsxRuntimeExports.jsx(L.Cross2Icon,{className:"h-4 w-4"})}));Ho.displayName=G.Close.displayName;const Wo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(G.Title,{ref:s,className:u.cn("text-sm font-semibold [&+div]:text-xs",e),...t}));Wo.displayName=G.Title.displayName;const Yo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(G.Description,{ref:s,className:u.cn("text-sm opacity-90",e),...t}));Yo.displayName=G.Description.displayName;function ci(){const{toasts:e}=Uo();return n.jsxRuntimeExports.jsxs(ai,{children:[e.map(({id:t,title:s,description:o,action:r,...a})=>n.jsxRuntimeExports.jsxs(Go,{...a,children:[n.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[s&&n.jsxRuntimeExports.jsx(Wo,{children:s}),o&&n.jsxRuntimeExports.jsx(Yo,{children:o})]}),r,n.jsxRuntimeExports.jsx(Ho,{})]},t)),n.jsxRuntimeExports.jsx($o,{})]})}const di=({className:e,...t})=>n.jsxRuntimeExports.jsx("div",{className:u.cn("animate-pulse rounded-md bg-primary/10",e),...t}),it=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(U.Command,{ref:s,className:u.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));it.displayName=U.Command.displayName;const ui=({children:e,...t})=>n.jsxRuntimeExports.jsx(nt,{...t,children:n.jsxRuntimeExports.jsx(Pe,{className:"overflow-hidden p-0",children:n.jsxRuntimeExports.jsx(it,{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:e})})}),Ko=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[n.jsxRuntimeExports.jsx(L.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),n.jsxRuntimeExports.jsx(U.Command.Input,{ref:s,className:u.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",e),...t})]}));Ko.displayName=U.Command.Input.displayName;const Jo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(U.Command.List,{ref:s,className:u.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Jo.displayName=U.Command.List.displayName;const Qo=f.forwardRef((e,t)=>n.jsxRuntimeExports.jsx(U.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Qo.displayName=U.Command.Empty.displayName;const Xo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(U.Command.Group,{ref:s,className:u.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",e),...t}));Xo.displayName=U.Command.Group.displayName;const Zo=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(U.Command.Separator,{ref:s,className:u.cn("-mx-1 h-px bg-border",e),...t}));Zo.displayName=U.Command.Separator.displayName;const en=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(U.Command.Item,{ref:s,className:u.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",e),...t}));en.displayName=U.Command.Item.displayName;const tn=({className:e,...t})=>n.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});tn.displayName="CommandShortcut";const mi=T.Root,pi=T.Trigger,fi=T.Group,xi=T.Portal,gi=T.Sub,bi=T.RadioGroup,sn=f.forwardRef(({className:e,inset:t,children:s,...o},r)=>n.jsxRuntimeExports.jsxs(T.SubTrigger,{ref:r,className:u.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",t&&"pl-8",e),...o,children:[s,n.jsxRuntimeExports.jsx(L.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));sn.displayName=T.SubTrigger.displayName;const on=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(T.SubContent,{ref:s,className:u.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",e),...t}));on.displayName=T.SubContent.displayName;const nn=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(T.Portal,{children:n.jsxRuntimeExports.jsx(T.Content,{ref:s,className:u.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",e),...t})}));nn.displayName=T.Content.displayName;const rn=f.forwardRef(({className:e,inset:t,...s},o)=>n.jsxRuntimeExports.jsx(T.Item,{ref:o,className:u.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",t&&"pl-8",e),...s}));rn.displayName=T.Item.displayName;const an=f.forwardRef(({className:e,children:t,checked:s,...o},r)=>n.jsxRuntimeExports.jsxs(T.CheckboxItem,{ref:r,className:u.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",e),checked:s,...o,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(T.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.CheckIcon,{className:"h-4 w-4"})})}),t]}));an.displayName=T.CheckboxItem.displayName;const ln=f.forwardRef(({className:e,children:t,...s},o)=>n.jsxRuntimeExports.jsxs(T.RadioItem,{ref:o,className:u.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",e),...s,children:[n.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsxRuntimeExports.jsx(T.ItemIndicator,{children:n.jsxRuntimeExports.jsx(L.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));ln.displayName=T.RadioItem.displayName;const cn=f.forwardRef(({className:e,inset:t,...s},o)=>n.jsxRuntimeExports.jsx(T.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...s}));cn.displayName=T.Label.displayName;const dn=f.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(T.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-border",e),...t}));dn.displayName=T.Separator.displayName;const un=({className:e,...t})=>n.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});un.displayName="ContextMenuShortcut";const hi=e=>{try{const t=document.getElementById("icon-picker-field"),s=document.createElement("div");Tn.render(n.jsxRuntimeExports.jsx(wt.IconPickerItem,{value:e}),s),t.appendChild(s),s.hidden=!0;let o=s.innerHTML;setTimeout(()=>t.removeChild(s),1e3);const a=new DOMParser().parseFromString(o,"image/svg+xml"),l=a.querySelector("svg");return l&&(l.removeAttribute("width"),l.removeAttribute("height")),new XMLSerializer().serializeToString(a)}catch{return""}},vi=({value:e,onChange:t,onBlur:s,id:o})=>{const r=a=>{t("<svg />");const l=hi(a);t(l),s(o,l)};return n.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[n.jsxRuntimeExports.jsxs("div",{className:"relative h-12 w-12 group",children:[n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e==null?void 0:e.replace("<svg",'<svg class="h-5 w-5"')},className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white z-0"}),n.jsxRuntimeExports.jsx(wt,{value:e?"BiSolidGrid":null,onChange:r,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"}})]}),n.jsxRuntimeExports.jsx("textarea",{value:e,onChange:a=>t(a.target.value),className:"h-full border w-full rounded-sm 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"})]})},yi=w.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-DbHky6cj.cjs"))),ji=w.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-DnQ95_NW.cjs"))),mn=({isModalView:e=!1,onSelect:t=()=>{}})=>{const[s,o]=w.useState("upload");return n.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:n.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:e?"Select or upload images":"Images"})}),n.jsxRuntimeExports.jsxs(oo,{value:s,onValueChange:r=>o(r),className:"flex h-full w-full flex-col py-2",children:[n.jsxRuntimeExports.jsxs(at,{className:"w-full",children:[n.jsxRuntimeExports.jsx(Re,{value:"upload",className:"w-1/2",children:"Upload"}),n.jsxRuntimeExports.jsx(Re,{value:"unsplash",className:"w-1/2",children:"Unsplash"})]}),s==="unsplash"?n.jsxRuntimeExports.jsx(ke,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:n.jsxRuntimeExports.jsx(w.Suspense,{fallback:n.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:n.jsxRuntimeExports.jsx(yi,{isModalView:e,onSelect:t})})}):n.jsxRuntimeExports.jsx(ke,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:n.jsxRuntimeExports.jsx(w.Suspense,{fallback:n.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:n.jsxRuntimeExports.jsx(ji,{isModalView:e,onSelect:t})})})]})]})},wi=Object.freeze(Object.defineProperty({__proto__:null,default:mn},Symbol.toStringTag,{value:"Module"})),jt=({children:e,onSelect:t})=>{const[s,o]=w.useState(!1),r=(...a)=>{t.call(void 0,...a),o(!1)};return n.jsxRuntimeExports.jsxs(nt,{open:s,onOpenChange:a=>o(a),children:[n.jsxRuntimeExports.jsx(zs,{asChild:!0,children:e}),n.jsxRuntimeExports.jsx(Pe,{className:"flex h-3/4 max-w-5xl",children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:n.jsxRuntimeExports.jsx(mn,{isModalView:!0,onSelect:r})})})]})},Ri=({value:e,onChange:t,id:s,onBlur:o})=>n.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[e?n.jsxRuntimeExports.jsx("img",{src:e,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):n.jsxRuntimeExports.jsx(jt,{onSelect:t,children:n.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"})}),n.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[n.jsxRuntimeExports.jsx(jt,{onSelect:t,children:n.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:e||!i.isEmpty(e)?"Replace Image":"Choose Image"})}),n.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"}),n.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:e,onBlur:({target:{value:r}})=>o(s,r),onChange:r=>t(r.target.value)})]})]}),ki=({id:e,placeholder:t,value:s,onChange:o,onBlur:r})=>{const a={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},l=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:n.jsxRuntimeExports.jsx(Pn,{id:e,value:s,onBlur:p=>r(e,p),onChange:p=>o(p),modules:a,formats:l,placeholder:t,className:"mt-1 rounded-md"})},Ni=({schema:e,formData:t,onChange:s})=>{const[o,r]=w.useState([]),a=re("getPages",()=>[]),{type:l="page",href:p="",target:x="self"}=t;return w.useEffect(()=>{(async()=>{const c=await a();r(c||[])})()},[]),n.jsxRuntimeExports.jsxs("div",{children:[n.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(e==null?void 0:e.title)??"Link"}),n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[n.jsxRuntimeExports.jsx("select",{name:"type",value:l,onChange:c=>s({...t,type:c.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(c=>n.jsxRuntimeExports.jsx("option",{value:c.const,children:c.title},c.const))}),l==="page"?n.jsxRuntimeExports.jsxs("select",{name:"href",placeholder:"Choose Page",value:p,onChange:c=>s({...t,href:c.target.value}),children:[n.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),i.map(o,c=>n.jsxRuntimeExports.jsx("option",{value:c.slug,children:c.name},c.uuid))]}):n.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:p,onChange:c=>s({...t,href:c.target.value}),placeholder:l==="page"||l==="url"?"Enter URL":l==="scroll"?"#ElementID":"Enter detail"}),(l==="page"||l==="url")&&n.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[n.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:x==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>s({...t,target:x==="_blank"?"_self":"_blank"})}),n.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})};exports.Accordion=Na;exports.AccordionContent=Ss;exports.AccordionItem=ks;exports.AccordionTrigger=Ns;exports.Alert=As;exports.AlertDescription=Es;exports.AlertDialog=Ca;exports.AlertDialogAction=Ls;exports.AlertDialogCancel=Vs;exports.AlertDialogContent=Ps;exports.AlertDialogDescription=Os;exports.AlertDialogFooter=Ms;exports.AlertDialogHeader=Is;exports.AlertDialogTitle=Ds;exports.AlertDialogTrigger=Ea;exports.AlertTitle=Cs;exports.Badge=Aa;exports.Button=Rs;exports.Card=Ws;exports.CardContent=Qs;exports.CardDescription=Js;exports.CardFooter=Xs;exports.CardHeader=Ys;exports.CardTitle=Ks;exports.Command=it;exports.CommandDialog=ui;exports.CommandEmpty=Qo;exports.CommandGroup=Xo;exports.CommandInput=Ko;exports.CommandItem=en;exports.CommandList=Jo;exports.CommandSeparator=Zo;exports.CommandShortcut=tn;exports.ContextMenu=mi;exports.ContextMenuCheckboxItem=an;exports.ContextMenuContent=nn;exports.ContextMenuGroup=fi;exports.ContextMenuItem=rn;exports.ContextMenuLabel=cn;exports.ContextMenuPortal=xi;exports.ContextMenuRadioGroup=bi;exports.ContextMenuRadioItem=ln;exports.ContextMenuSeparator=dn;exports.ContextMenuShortcut=un;exports.ContextMenuSub=gi;exports.ContextMenuSubContent=on;exports.ContextMenuSubTrigger=sn;exports.ContextMenuTrigger=pi;exports.Dialog=nt;exports.DialogContent=Pe;exports.DialogDescription=Hs;exports.DialogFooter=$s;exports.DialogHeader=Us;exports.DialogTitle=Gs;exports.DialogTrigger=zs;exports.DropdownMenu=Qa;exports.DropdownMenuCheckboxItem=Mo;exports.DropdownMenuContent=Po;exports.DropdownMenuGroup=Za;exports.DropdownMenuItem=Io;exports.DropdownMenuLabel=Oo;exports.DropdownMenuPortal=ei;exports.DropdownMenuRadioGroup=si;exports.DropdownMenuRadioItem=Do;exports.DropdownMenuSeparator=Lo;exports.DropdownMenuShortcut=Vo;exports.DropdownMenuSub=ti;exports.DropdownMenuSubContent=To;exports.DropdownMenuSubTrigger=Bo;exports.DropdownMenuTrigger=Xa;exports.HoverCard=qa;exports.HoverCardContent=ho;exports.HoverCardTrigger=Ua;exports.IconPickerField=vi;exports.ImagePickerField=Ri;exports.ImagesPanel=wi;exports.Input=Zs;exports.Label=eo;exports.LinkField=Ni;exports.Menubar=ao;exports.MenubarCheckboxItem=po;exports.MenubarContent=uo;exports.MenubarGroup=La;exports.MenubarItem=mo;exports.MenubarLabel=xo;exports.MenubarMenu=Oa;exports.MenubarPortal=Va;exports.MenubarRadioGroup=Fa;exports.MenubarRadioItem=fo;exports.MenubarSeparator=go;exports.MenubarShortcut=bo;exports.MenubarSub=za;exports.MenubarSubContent=co;exports.MenubarSubTrigger=lo;exports.MenubarTrigger=io;exports.Popover=Ma;exports.PopoverContent=ro;exports.PopoverTrigger=Da;exports.RichTextEditorField=ki;exports.ScrollArea=so;exports.ScrollBar=rt;exports.Select=$a;exports.SelectContent=yo;exports.SelectGroup=Ga;exports.SelectItem=wo;exports.SelectLabel=jo;exports.SelectSeparator=Ro;exports.SelectTrigger=vo;exports.SelectValue=Ha;exports.Separator=zo;exports.Sheet=Wa;exports.SheetClose=Ka;exports.SheetContent=So;exports.SheetDescription=_o;exports.SheetFooter=Co;exports.SheetHeader=Ao;exports.SheetTitle=Eo;exports.SheetTrigger=Ya;exports.Skeleton=di;exports.Switch=ws;exports.Tabs=oo;exports.TabsContent=ke;exports.TabsList=at;exports.TabsTrigger=Re;exports.Textarea=to;exports.Toaster=ci;exports.Toggle=js;exports.Tooltip=Pa;exports.TooltipContent=no;exports.TooltipPortal=Ba;exports.TooltipProvider=Ta;exports.TooltipTrigger=Ia;exports.activePanelAtom=ss;exports.advanceStylingOpenAtom=Xt;exports.atom=K;exports.atomWithDefault=Qn;exports.atomWithStorage=me;exports.badgeVariants=_s;exports.buttonVariants=Te;exports.canDeleteBlock=mr;exports.canDropBlock=pr;exports.canDuplicateBlock=ur;exports.canvasIframeAtom=ts;exports.chaiBuilderPropsAtom=Ae;exports.chaiExternalDataAtom=Bt;exports.createStore=At;exports.dataProvidersAtom=st;exports.draggedBlockIdAtom=as;exports.draggingFlagAtom=rs;exports.editLayerNameAtom=es;exports.getBlockJSONFromSchemas=qe;exports.getBlockJSONFromUISchemas=Fe;exports.inlineEditingActiveAtom=ns;exports.isDevelopment=tr;exports.networkModeAtom=Zt;exports.pageSyncStateAtom=_e;exports.presentBlocksAtom=H;exports.reducer=Fo;exports.showPredefinedBlockCategoryAtom=os;exports.toast=qo;exports.toggleVariants=ys;exports.useActiveModal=ua;exports.useActivePanel=xa;exports.useAddBlock=yr;exports.useAddBlockParent=ga;exports.useAddClassesToBlocks=Nr;exports.useAllBlocks=qt;exports.useAtom=$n;exports.useAtomValue=Ct;exports.useBlocksContainer=Er;exports.useBrandingOptions=Gt;exports.useBuilderProp=re;exports.useBuilderReset=va;exports.useBuildingBlocks=Ut;exports.useCanvasHistory=Be;exports.useCanvasWidth=Lr;exports.useCanvasZoom=zr;exports.useCopyBlockIds=Fr;exports.useCurrentPage=Ht;exports.useCutBlockIds=ms;exports.useDarkMode=qr;exports.useDeveloperPreviewMode=$r;exports.useDuplicateBlocks=fs;exports.useFeatureSupport=wa;exports.useGetPageData=tt;exports.useHiddenBlockIds=Hr;exports.useHighlightBlockId=xs;exports.useMarkAsGlobalBlock=Yr;exports.useMoveBlocks=Kr;exports.usePageDataProviders=is;exports.usePasteBlocks=Qr;exports.usePreviewMode=$t;exports.useProject=Zr;exports.useReadOnlyMode=ma;exports.useRemoveBlocks=ea;exports.useRemoveClassesFromBlocks=sa;exports.useSavePage=Or;exports.useSelectedBlock=br;exports.useSelectedBlockAllClasses=oa;exports.useSelectedBlockCurrentClasses=aa;exports.useSelectedBlockIds=pe;exports.useSelectedBlocksDisplayChild=gr;exports.useSelectedBreakpoints=ha;exports.useSelectedStylingBlocks=Xe;exports.useSetAllBlocks=dr;exports.useSetAtom=Et;exports.useStore=Ge;exports.useStylingBreakpoint=ls;exports.useStylingState=ia;exports.useToast=Uo;exports.useTranslations=ja;exports.useTreeData=cr;exports.useUILibraryBlocks=ka;exports.useUpdateBlocksProps=la;exports.useUpdateBlocksPropsRealtime=ca;