@chaibuilder/sdk 1.2.22 → 1.2.24

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 (107) hide show
  1. package/dist/AddBlocks-l1JENNvq.js +206 -0
  2. package/dist/AddBlocks-zPPKkeKs.cjs +1 -0
  3. package/dist/BrandingOptions-DkpqGARR.cjs +1 -0
  4. package/dist/{BrandingOptions-4961TxX2.js → BrandingOptions-udtH5yJs.js} +11 -10
  5. package/dist/CanvasArea-IqeMbtOf.js +951 -0
  6. package/dist/CanvasArea-plZTWifU.cjs +55 -0
  7. package/dist/{Class-MmCxz2Ay.cjs → Class-PoYusiA5.cjs} +1 -1
  8. package/dist/{Class-3k8xjeiM.js → Class-lGzsNBOK.js} +1 -1
  9. package/dist/CurrentPage-7_s9LtEJ.cjs +1 -0
  10. package/dist/{CurrentPage-oPZN6Gwj.js → CurrentPage-AA0XHYMU.js} +23 -24
  11. package/dist/ListTree-LAN7QmHQ.cjs +1 -0
  12. package/dist/ListTree-ZNEtds1d.js +309 -0
  13. package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
  14. package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-dytZ-osO.js} +4 -8
  15. package/dist/PagesPanel-5qMZBatP.cjs +1 -0
  16. package/dist/{PagesPanel-pRKHw-AZ.js → PagesPanel-883P3_su.js} +9 -10
  17. package/dist/{ProjectPanel-iU6DY-Yp.js → ProjectPanel-Y8Qcmsn0.js} +11 -12
  18. package/dist/ProjectPanel-otQb9ceP.cjs +1 -0
  19. package/dist/STRINGS--j49GZJP.js +7 -0
  20. package/dist/STRINGS-gPz7CUOk.cjs +1 -0
  21. package/dist/Settings-Rt342VJ3.cjs +1 -0
  22. package/dist/{Settings-BhSrj-cE.js → Settings-pIePR1Id.js} +862 -865
  23. package/dist/{SidePanels-OLOUpKn4.js → SidePanels-NznSn5RN.js} +121 -125
  24. package/dist/SidePanels-PaQkgjLa.cjs +1 -0
  25. package/dist/Topbar-CqW7G360.cjs +1 -0
  26. package/dist/{Topbar-Ny9T-7Zb.js → Topbar-pWzBEOed.js} +39 -35
  27. package/dist/UnsplashImages-NGskB93R.cjs +1 -0
  28. package/dist/{UnsplashImages-Y8RGFVSh.js → UnsplashImages-qvwFbV-E.js} +17 -16
  29. package/dist/{UploadImages-dd8LfyFr.js → UploadImages-9NapgXBq.js} +12 -11
  30. package/dist/UploadImages-Oh7Glr9A.cjs +1 -0
  31. package/dist/{add-page-modal-Jni6CY1x.js → add-page-modal-4PiRJgX5.js} +11 -12
  32. package/dist/add-page-modal-4o2L_7T7.cjs +1 -0
  33. package/dist/confirm-alert-C4M9eF-o.cjs +1 -0
  34. package/dist/{confirm-alert-sc8RaWvD.js → confirm-alert-GUhZ_G8w.js} +7 -6
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +5 -3
  37. package/dist/core.js +48 -49
  38. package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
  39. package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
  40. package/dist/{delete-page-modal-0WiMZFxr.js → delete-page-modal-4l5-RhQB.js} +10 -11
  41. package/dist/delete-page-modal-Bek5bCf-.cjs +1 -0
  42. package/dist/email.cjs +1 -1
  43. package/dist/email.d.ts +3 -1
  44. package/dist/email.js +16 -16
  45. package/dist/{form-Nj6Kdn3g.js → form-STUz-6nE.js} +1 -1
  46. package/dist/{form-n1Q6u16z.cjs → form-lBQ_76Uw.cjs} +1 -1
  47. package/dist/html-to-json-efmv1pCj.cjs +1 -0
  48. package/dist/{html-to-json-C5sExaSD.js → html-to-json-ngX9ef2u.js} +31 -29
  49. package/dist/{index-IPJAbzzO.js → index-Gk6sASBd.js} +1242 -1213
  50. package/dist/{index-0bwkNnA0.cjs → index-dgm-fd8U.cjs} +42 -42
  51. package/dist/{index-UP_4awU9.js → index-gS-3liKK.js} +4479 -4484
  52. package/dist/index-h-hd6EvN.cjs +1 -0
  53. package/dist/index-oCYKBYyT.cjs +1 -0
  54. package/dist/{index-_VPpjzJu.js → index-xZWaF8AW.js} +118 -119
  55. package/dist/lib.cjs +3 -3
  56. package/dist/lib.js +17 -16
  57. package/dist/page-viewer-JlKEwACu.cjs +1 -0
  58. package/dist/{page-viewer-L1Dmgj-c.js → page-viewer-rCXavxpd.js} +15 -16
  59. package/dist/project-general-setting-2FGoUZ-z.cjs +1 -0
  60. package/dist/{project-general-setting-sUP7JqWK.js → project-general-setting-rmAVpDu9.js} +11 -12
  61. package/dist/project-seo-setting-mlxL_e2_.cjs +1 -0
  62. package/dist/{project-seo-setting-NNvAGt4T.js → project-seo-setting-pX34Qsym.js} +8 -7
  63. package/dist/render.cjs +1 -1
  64. package/dist/render.js +14 -13
  65. package/dist/single-page-detail-c6-wRWyN.cjs +1 -0
  66. package/dist/{single-page-detail-FXg_NebW.js → single-page-detail-rSQomrY5.js} +12 -13
  67. package/dist/studio.cjs +1 -1
  68. package/dist/studio.d.ts +3 -1
  69. package/dist/studio.js +8 -9
  70. package/dist/ui.cjs +1 -1
  71. package/dist/ui.js +139 -138
  72. package/dist/web-blocks.cjs +6 -1
  73. package/dist/web-blocks.js +462 -354
  74. package/package.json +3 -5
  75. package/dist/AddBlocks-157fSrJX.cjs +0 -1
  76. package/dist/AddBlocks-WgpssWmQ.js +0 -223
  77. package/dist/BrandingOptions-nwXR9TMl.cjs +0 -1
  78. package/dist/CanvasArea-MajWGr9z.js +0 -908
  79. package/dist/CanvasArea-MmTlc5Vb.cjs +0 -55
  80. package/dist/CurrentPage-LpLr0lDI.cjs +0 -1
  81. package/dist/ListTree-dvxHTXs4.js +0 -167
  82. package/dist/ListTree-gTmusfso.cjs +0 -1
  83. package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
  84. package/dist/Outline-2OxsXs1-.js +0 -294
  85. package/dist/Outline-7CCnnzmK.cjs +0 -1
  86. package/dist/PagesPanel-8536oBWB.cjs +0 -1
  87. package/dist/ProjectPanel-oILsUWOH.cjs +0 -1
  88. package/dist/Settings-jHiYmt0y.cjs +0 -1
  89. package/dist/SidePanels-bcJJocSq.cjs +0 -1
  90. package/dist/Topbar-NMvzqQHW.cjs +0 -1
  91. package/dist/TypeIcon-ElNNPazl.cjs +0 -1
  92. package/dist/TypeIcon-qO96rNbV.js +0 -69
  93. package/dist/UnsplashImages-6tZv1q2_.cjs +0 -1
  94. package/dist/UploadImages-VLlVg9Ur.cjs +0 -1
  95. package/dist/add-page-modal-IsqDdK7X.cjs +0 -1
  96. package/dist/confirm-alert-f26zJ7Js.cjs +0 -1
  97. package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
  98. package/dist/delete-page-modal-c3b-GCap.cjs +0 -1
  99. package/dist/html-to-json-FGufPv9R.cjs +0 -1
  100. package/dist/index-9PHdn80L.cjs +0 -1
  101. package/dist/index-nwAgi0aD.cjs +0 -1
  102. package/dist/page-viewer-TnxHhq7S.cjs +0 -1
  103. package/dist/project-general-setting-1Ot1RU43.cjs +0 -1
  104. package/dist/project-seo-setting-3-vBkx2v.cjs +0 -1
  105. package/dist/single-page-detail-btEKYXjE.cjs +0 -1
  106. package/dist/useAddBlockByDrop-V8xo-PNQ.js +0 -20
  107. package/dist/useAddBlockByDrop-qRHgy8_0.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";const k=require("react"),i=require("lodash-es"),ne=require("./Functions-N3yhPYKY.cjs"),Se=require("@chaibuilder/runtime"),p=require("jotai"),Y=require("./MODIFIERS-9EwxLM8V.cjs"),on=require("./_commonjsHelpers-wDK0ZLPo.cjs"),nn=require("@react-hookz/web"),r=require("./jsx-runtime-Z_BpKhVy.cjs"),rn=require("@radix-ui/react-toggle"),le=require("class-variance-authority"),u=require("./Class-MmCxz2Ay.cjs"),an=require("@radix-ui/react-switch"),ln=require("@radix-ui/react-slot"),cn=require("@radix-ui/react-accordion"),G=require("@radix-ui/react-icons"),dn=require("@radix-ui/react-alert-dialog"),un=require("@radix-ui/react-dialog"),mn=require("@radix-ui/react-label"),pn=require("@radix-ui/react-scroll-area"),fn=require("@radix-ui/react-tabs"),xn=require("@radix-ui/react-tooltip"),gn=require("@radix-ui/react-popover"),hn=require("@radix-ui/react-menubar"),bn=require("@radix-ui/react-hover-card"),vn=require("@radix-ui/react-select"),yn=require("@radix-ui/react-dropdown-menu"),jn=require("@radix-ui/react-separator"),wn=require("@radix-ui/react-toast"),J=require("cmdk"),Rn=require("@radix-ui/react-context-menu"),yt=require("react-icons-picker"),kn=require("react-dom"),Nn=require("react-quill");require("react-i18next");function U(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=U(k),jt=U(rn),De=U(an),ie=U(cn),W=U(dn),P=U(un),wt=U(mn),ae=U(pn),ce=U(fn),pe=U(xn),he=U(gn),B=U(hn),Ce=U(bn),F=U(vn),I=U(yn),Rt=U(jn),Q=U(wn),M=U(Rn);var $={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let Sn=0;function Z(e,t){const s=`atom${++Sn}`,o={toString:()=>s};return typeof e=="function"?o.read=e:(o.init=e,o.read=n=>n(o),o.write=(n,l,a)=>l(o,typeof a=="function"?a(n(o)):a)),t&&(o.write=t),o}const Be=e=>"init"in e,Te=e=>!!e.write,Re=new WeakMap,Cn=(e,t)=>{Re.set(e,t),e.catch(()=>{}).finally(()=>Re.delete(e))},lt=(e,t)=>{const s=Re.get(e);s&&(Re.delete(e),s(t))},ct=(e,t)=>{e.status="fulfilled",e.value=t},dt=(e,t)=>{e.status="rejected",e.reason=t},En=e=>typeof(e==null?void 0:e.then)=="function",xe=(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),ue=e=>"v"in e&&e.v instanceof Promise,An=(e,t)=>"v"in e&&"v"in t&&e.v.orig&&e.v.orig===t.v.orig,ye=e=>{if("e"in e)throw e.e;return e.v},kt=()=>{const e=new WeakMap,t=new WeakMap,s=new Map;let o,n,l;($?"production":void 0)!=="production"&&(o=new Set,n=new Set,l=new Set);const a=m=>e.get(m),d=(m,h)=>{($?"production":void 0)!=="production"&&Object.freeze(h);const y=e.get(m);if(e.set(m,h),s.has(m)||s.set(m,y),y&&ue(y)){const b="v"in h?h.v instanceof Promise?h.v:Promise.resolve(h.v):Promise.reject(h.e);lt(y.v,b)}},g=(m,h,y)=>{const b=new Map;let w=!1;y.forEach((v,N)=>{!v&&N===m&&(v=h),v?(b.set(N,v),h.d.get(N)!==v&&(w=!0)):($?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(w||h.d.size!==b.size)&&(h.d=b)},c=(m,h,y)=>{const b=a(m),w={d:(b==null?void 0:b.d)||new Map,v:h};if(y&&g(m,w,y),b&&xe(b,w)&&b.d===w.d)return b;if(b&&ue(b)&&ue(w)&&An(b,w)){if(b.d===w.d)return b;w.v=b.v}return d(m,w),w},x=(m,h,y,b)=>{if(En(h)){let w;const v=new Promise((N,D)=>{let E=!1;h.then(T=>{if(!E){E=!0;const _=a(m),X=c(m,v,y);ct(v,T),N(T),(_==null?void 0:_.d)!==X.d&&z(m,X,_==null?void 0:_.d)}},T=>{if(!E){E=!0;const _=a(m),X=c(m,v,y);dt(v,T),D(T),(_==null?void 0:_.d)!==X.d&&z(m,X,_==null?void 0:_.d)}}),w=T=>{E||(E=!0,T.then(_=>ct(v,_),_=>dt(v,_)),N(T))}});return v.orig=h,v.status="pending",Cn(v,N=>{N&&w(N),b==null||b()}),c(m,v,y)}return c(m,h,y)},R=(m,h,y)=>{const b=a(m),w={d:(b==null?void 0:b.d)||new Map,e:h};return y&&g(m,w,y),b&&ut(b,w)&&b.d===w.d?b:(d(m,w),w)},S=m=>{const h=a(m);if(h&&(h.d.forEach((E,T)=>{T!==m&&!t.has(T)&&S(T)}),Array.from(h.d).every(([E,T])=>{const _=a(E);return E===m||_===T||_&&!ue(_)&&xe(_,T)})))return h;const y=new Map;let b=!0;const w=E=>{if(E===m){const _=a(E);if(_)return y.set(E,_),ye(_);if(Be(E))return y.set(E,void 0),E.init;throw new Error("no atom init")}const T=S(E);return y.set(E,T),ye(T)};let v,N;const D={get signal(){return v||(v=new AbortController),v.signal},get setSelf(){return($?"production":void 0)!=="production"&&!Te(m)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&Te(m)&&(N=(...E)=>{if(($?"production":void 0)!=="production"&&b&&console.warn("setSelf function cannot be called in sync"),!b)return V(m,...E)}),N}};try{const E=m.read(w,D);return x(m,E,y,()=>v==null?void 0:v.abort())}catch(E){return R(m,E,y)}finally{b=!1}},j=m=>ye(S(m)),C=m=>{let h=t.get(m);return h||(h=H(m)),h},O=(m,h)=>!h.l.size&&(!h.t.size||h.t.size===1&&h.t.has(m)),q=m=>{const h=t.get(m);h&&O(m,h)&&K(m)},A=m=>{const h=new Map,y=new WeakMap,b=v=>{const N=t.get(v);N==null||N.t.forEach(D=>{D!==v&&(h.set(D,(h.get(D)||new Set).add(v)),y.set(D,(y.get(D)||0)+1),b(D))})};b(m);const w=v=>{const N=t.get(v);N==null||N.t.forEach(D=>{var E;if(D!==v){let T=y.get(D);if(T&&y.set(D,--T),!T){let _=!!((E=h.get(D))!=null&&E.size);if(_){const X=a(D),sn=S(D);_=!X||!xe(X,sn)}_||h.forEach(X=>X.delete(D))}w(D)}})};w(m)},L=(m,...h)=>{let y=!0;const b=N=>ye(S(N)),w=(N,...D)=>{let E;if(N===m){if(!Be(N))throw new Error("atom not writable");const T=a(N),_=x(N,D[0]);(!T||!xe(T,_))&&A(N)}else E=L(N,...D);if(!y){const T=se();($?"production":void 0)!=="production"&&n.forEach(_=>_({type:"async-write",flushed:T}))}return E},v=m.write(b,w,...h);return y=!1,v},V=(m,...h)=>{const y=L(m,...h),b=se();return($?"production":void 0)!=="production"&&n.forEach(w=>w({type:"write",flushed:b})),y},H=(m,h)=>{const y={t:new Set(h&&[h]),l:new Set};if(t.set(m,y),($?"production":void 0)!=="production"&&l.add(m),S(m).d.forEach((b,w)=>{const v=t.get(w);v?v.t.add(m):w!==m&&H(w,m)}),S(m),Te(m)&&m.onMount){const b=m.onMount((...w)=>V(m,...w));b&&(y.u=b)}return y},K=m=>{var h;const y=(h=t.get(m))==null?void 0:h.u;y&&y(),t.delete(m),($?"production":void 0)!=="production"&&l.delete(m);const b=a(m);b?(ue(b)&&lt(b.v),b.d.forEach((w,v)=>{if(v!==m){const N=t.get(v);N&&(N.t.delete(m),O(v,N)&&K(v))}})):($?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",m)},z=(m,h,y)=>{const b=new Set(h.d.keys());y==null||y.forEach((w,v)=>{if(b.has(v)){b.delete(v);return}const N=t.get(v);N&&(N.t.delete(m),O(v,N)&&K(v))}),b.forEach(w=>{const v=t.get(w);v?v.t.add(m):t.has(m)&&H(w,m)})},se=()=>{let m;for(($?"production":void 0)!=="production"&&(m=new Set);s.size;){const h=Array.from(s);s.clear(),h.forEach(([y,b])=>{const w=a(y);if(w){w.d!==(b==null?void 0:b.d)&&z(y,w,b==null?void 0:b.d);const v=t.get(y);v&&!(b&&!ue(b)&&(xe(b,w)||ut(b,w)))&&(v.l.forEach(N=>N()),($?"production":void 0)!=="production"&&m.add(y))}else($?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if(($?"production":void 0)!=="production")return o.forEach(h=>h("state")),m},oe=(m,h)=>{const y=C(m),b=se(),w=y.l;return w.add(h),($?"production":void 0)!=="production"&&(o.forEach(v=>v("sub")),n.forEach(v=>v({type:"sub",flushed:b}))),()=>{w.delete(h),q(m),($?"production":void 0)!=="production"&&(o.forEach(v=>v("unsub")),n.forEach(v=>v({type:"unsub"})))}};return($?"production":void 0)!=="production"?{get:j,set:V,sub:oe,dev_subscribe_store:(m,h)=>h!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),o.add(m),()=>{o.delete(m)}):(n.add(m),()=>{n.delete(m)}),dev_get_mounted_atoms:()=>l.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)Be(y)&&(x(y,b),A(y));const h=se();n.forEach(y=>y({type:"restore",flushed:h}))}}:{get:j,set:V,sub:oe}};let Pe;const _n=()=>(Pe||(Pe=kt()),Pe);var Bn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Tn=k.createContext(void 0),Fe=e=>{const t=k.useContext(Tn);return(e==null?void 0:e.store)||t||_n()};const Pn=e=>typeof(e==null?void 0:e.then)=="function",In=k.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 Nt(e,t){const s=Fe(t),[[o,n,l],a]=k.useReducer(c=>{const x=s.get(e);return Object.is(c[0],x)&&c[1]===s&&c[2]===e?c:[x,s,e]},void 0,()=>[s.get(e),s,e]);let d=o;(n!==s||l!==e)&&(a(),d=s.get(e));const g=t==null?void 0:t.delay;return k.useEffect(()=>{const c=s.sub(e,()=>{if(typeof g=="number"){setTimeout(a,g);return}a()});return a(),c},[s,e,g]),k.useDebugValue(d),Pn(d)?In(d):d}function St(e,t){const s=Fe(t);return k.useCallback((...n)=>{if((Bn?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return s.set(e,...n)},[s,e])}function Mn(e,t){return[Nt(e,t),St(e,t)]}var Ue={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Ct=Symbol();const mt=(e,t,s)=>(t.has(s)?t:t.set(s,e())).get(s),Dn=new WeakMap,On=(e,t,s)=>{const o=mt(()=>new WeakMap,Dn,t);return mt(e,o,s)},Ln={},pt=e=>!!e.write,zn=e=>typeof e=="function";function Vn(e,t){return On(()=>{const s=new WeakMap,o=(a,d)=>{let g=s.get(a);if(g)return g;const c=d&&s.get(d),x=[],R=[];return a.forEach((S,j)=>{const C=t?t(S):j;R[j]=C;const O=c&&c.atomList[c.keyList.indexOf(C)];if(O){x[j]=O;return}const q=L=>{const V=L(n),H=L(e),z=o(H,V==null?void 0:V.arr).keyList.indexOf(C);if(z<0||z>=H.length){const se=a[o(a).keyList.indexOf(C)];if(se)return se;throw new Error("splitAtom: index out of bounds for read")}return H[z]},A=(L,V,H)=>{const K=L(n),z=L(e),oe=o(z,K==null?void 0:K.arr).keyList.indexOf(C);if(oe<0||oe>=z.length)throw new Error("splitAtom: index out of bounds for write");const m=zn(H)?H(z[oe]):H;V(e,[...z.slice(0,oe),m,...z.slice(oe+1)])};x[j]=pt(e)?Z(q,A):Z(q)}),c&&c.keyList.length===R.length&&c.keyList.every((S,j)=>S===R[j])?g=c:g={arr:a,atomList:x,keyList:R},s.set(a,g),g},n=Z(a=>{const d=a(n),g=a(e);return o(g,d==null?void 0:d.arr)});(Ue?"production":void 0)!=="production"&&(n.debugPrivate=!0),n.init=void 0;const l=pt(e)?Z(a=>a(n).atomList,(a,d,g)=>{switch(g.type){case"remove":{const c=a(l).indexOf(g.atom);if(c>=0){const x=a(e);d(e,[...x.slice(0,c),...x.slice(c+1)])}break}case"insert":{const c=g.before?a(l).indexOf(g.before):a(l).length;if(c>=0){const x=a(e);d(e,[...x.slice(0,c),g.value,...x.slice(c)])}break}case"move":{const c=a(l).indexOf(g.atom),x=g.before?a(l).indexOf(g.before):a(l).length;if(c>=0&&x>=0){const R=a(e);c<x?d(e,[...R.slice(0,c),...R.slice(c+1,x),R[c],...R.slice(x)]):d(e,[...R.slice(0,x),R[c],...R.slice(x,c),...R.slice(c+1)])}break}}}):Z(a=>a(n).atomList);return l},e,t||Ln)}function Fn(e){const t=Symbol(),s=Z(t);(Ue?"production":void 0)!=="production"&&(s.debugPrivate=!0);const o=Z((n,l)=>{const a=n(s);return a!==t?a:e(n,l)},(n,l,a)=>{if(a===Ct)l(s,t);else if(typeof a=="function"){const d=n(o);l(s,a(d))}else l(s,a)});return o}const Un=e=>typeof(e==null?void 0:e.then)=="function";function qn(e){let t,s;const o={getItem:(n,l)=>{var a,d;const g=x=>{if(x=x||"",t!==x){try{s=JSON.parse(x)}catch{return l}t=x}return s},c=(d=(a=e())==null?void 0:a.getItem(n))!=null?d:null;return Un(c)?c.then(g):g(c)},setItem:(n,l)=>{var a;return(a=e())==null?void 0:a.setItem(n,JSON.stringify(l))},removeItem:n=>{var l;return(l=e())==null?void 0:l.removeItem(n)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(o.subscribe=(n,l,a)=>{if(!(e()instanceof window.Storage))return()=>{};const d=g=>{if(g.storageArea===e()&&g.key===n){let c;try{c=JSON.parse(g.newValue||"")}catch{c=a}l(c)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),o}const $n=qn(()=>typeof window<"u"?window.localStorage:void 0);function fe(e,t,s=$n,o){const n=o==null?void 0:o.unstable_getOnInit,l=Z(n?s.getItem(e,t):t);return(Ue?"production":void 0)!=="production"&&(l.debugPrivate=!0),l.onMount=d=>{n||d(s.getItem(e,t));let g;return s.subscribe&&(g=s.subscribe(e,d,t)),g},Z(d=>d(l),(d,g,c)=>{const x=typeof c=="function"?c(d(l)):c;return x===Ct?(g(l,t),s.removeItem(e)):x instanceof Promise?x.then(R=>(g(l,R),s.setItem(e,R))):(g(l,x),s.setItem(e,x))})}const qe=p.atom(null);qe.debugLabel="chaiBuilderPropsAtom";const Et=p.atom({});Et.debugLabel="chaiExternalDataAtom";const Gn=()=>!1,Wn=e=>{const t=e.replace(Y.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Oe=(e,t)=>{if(!e)return!0;const s=Se.getBlockComponent(e);return s&&i.has(s,"canAcceptBlock")?s.canAcceptBlock(t):!1},Hn=(e,t)=>{const s=Se.getBlockComponent(t);return s&&i.has(s,"canBeNested")?s.canBeNested(e):!0},Yn=e=>{const t=Se.getBlockComponent(e);return t&&i.has(t,"canDuplicate")?t.canDuplicate():!0},Kn=e=>{const t=Se.getBlockComponent(e);return t&&i.has(t,"canDelete")?t.canDelete():!0},Jn=(e,{dragSource:t,dropTarget:s})=>{const o=i.get(t,"data._type",""),n=i.get(s,"data._type","");return Oe(n,o)};function At(e,t,s){const o=i.filter(e,l=>l._parent===t),n=[];for(let l=0;l<o.length;l++){const a=Bt(o[l]);if(Object.keys(a).length>0&&Object.keys(a).forEach(d=>{o[l][d]=`slot:${ne.generateUUID()}`}),i.filter(e,{_parent:o[l]._id}).length>0){const d=ne.generateUUID();n.push({...o[l],oldId:o[l]._id,_id:d,_parent:s}),n.push(i.flatten(At(e,o[l]._id,d)))}else n.push({...o[l],oldId:o[l]._id,_id:ne.generateUUID(),_parent:s})}return i.flatten(n)}function _t(e){const t={};e.forEach(o=>{t[o._id]={...o,children:[]}});const s=[];return e.forEach(o=>{if(o._parent){const n=t[o._parent];n&&n.children.push(t[o._id])}else s.push(t[o._id])}),s}const Bt=e=>{const t={};return Object.keys(e).forEach(s=>{i.isString(e[s])&&e[s].startsWith("slot")&&(t[s]=e[s].replace("slot:",""))}),t},Qn=(e,t,s=null)=>{let o=i.find(e,{_id:t});o={...o,oldId:o._id,_id:ne.generateUUID()},s&&(o={...o,_parent:s});const n=[o];i.filter(e,{_parent:t}).length>0&&n.push(i.flatten(At(e,t,o._id)));const l=i.flatten(n);return i.map(l,a=>{const d=a,g=Bt(d);return Object.keys(g).length>0&&Object.keys(g).forEach(c=>{const x=i.find(l,{oldId:g[c].replace("slot:","")});d[c]=`slot:${x._id}`}),i.omit(d,["global","oldId"])})};const ee=p.atom([]);ee.debugLabel="presentBlocksAtom";const Tt=p.atom(e=>{const t=e(ee);return _t([...t])});Tt.debugLabel="treeDSBlocks";ee.debugLabel="presentBlocksAtom";const $e=Vn(ee);$e.debugLabel="pageBlocksAtomsAtom";const Xn=p.atom("");Xn.debugLabel="builderActivePageAtom";const Zn=p.atom(-1);Zn.debugLabel="destinationDropIndexAtom";const Pt=p.atom([]);Pt.debugLabel="buildingBlocksAtom";const er=p.atom(e=>{const t=e(Pt);return i.filter(t,s=>i.has(s,"blockId"))});er.debugLabel="globalBlocksAtom";const Ge=p.atom([]);Ge.debugLabel="selectedBlockIdsAtom";const We=p.atom(e=>{const t=e(ee),s=e(Ge);return i.map(i.filter(t,({_id:o})=>i.includes(s,o)),o=>({...o}))});We.debugLabel="selectedBlocksAtom";const He=p.atom(e=>{const t=e(We);return t.length===0?null:t.length===1?t[0]:{type:"Multiple",id:i.map(t,"id")}});He.debugLabel="selectedBlockAtom";const tr=e=>i.get(e,"parent",null),sr=p.atom(e=>{const t=e(We),s=i.map(t,tr);return i.filter(e(ee),o=>i.includes(s,o._id))});sr.debugLabel="selectedBlocksParentsAtom";const It=p.atom(()=>!1);It.debugLabel="selectedBlockFlexChildAtom";const Mt=p.atom(()=>!1);Mt.debugLabel="selectedBlockGridChildAtom";const Ye=p.atom("");Ye.debugLabel="styleStateAtom";const Dt=fe("styleBreakpoint","xs");Dt.debugLabel="styleBreakpointAtom";const or=()=>({flexChild:p.useAtomValue(It),gridChild:p.useAtomValue(Mt)}),nr=()=>p.useAtomValue(He);const be=()=>{const[e,t]=p.useAtom(Ge),s=k.useCallback(o=>{t(n=>i.includes(n,o)?i.without(n,o):[...n,o])},[t]);return[e,t,s]},Le=e=>{switch(e.type){case"singular":return e.uiSchema;case"model":const{properties:t}=e,s={};return Object.keys(t).forEach(l=>{const a=t[l];if(i.includes(["slot","styles"],a.type))return;const d=l;s[d]=Le(a)}),s;case"list":const{itemProperties:o}=e,n={items:{}};return Object.keys(o).forEach(l=>{const a=o[l];if(i.includes(["slot","styles"],a.type))return;const d=l;n.items[d]=Le(a)}),n;default:return{}}},ze=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(d=>{const g=t[d];if(i.includes(["slot","styles"],g.type))return;const c=d;o.properties[c]=ze(g)}),o;case"list":const{itemProperties:n,title:l}=e,a={title:l,type:"array",items:{type:"object",properties:{}}};return Object.keys(n).forEach(d=>{const g=n[d];if(i.includes(["slot","styles"],g.type))return;const c=d;a.items.properties[c]=ze(g),i.set(a.items,"title",i.get(g,"itemTitle",`${l} item`))}),a;default:return{}}},Ot=e=>{if(!e)return{};const t={};return Object.keys(e).forEach(s=>{t[s]=ar(e[s])}),t},rr=e=>{if(i.isEmpty(e.default))return[];const{itemProperties:t}=e;return i.map(e.default,s=>{const o={...s};return i.forIn(s,(n,l)=>{i.has(t,l)&&i.get(t[l],"i18n",!1)&&(o[l]=Y.I18N_KEY)}),o})},ar=e=>{switch(e.type){case"styles":return e.default;case"slot":return`${Y.SLOT_KEY}${ne.generateUUID()}`;case"singular":const{i18n:t,schema:s}=e;return t?Y.I18N_KEY:i.get(s,"default","");case"model":return Ot(e.properties);case"list":return rr(e);default:return""}};var Ke={exports:{}},mi=Ke.exports;(function(e){(function(){"use strict";function t(o,n,l){return o.splice(n,!l||1+l-n+(!(l<0^n>=0)&&(l<0||-1)*o.length)),o.length}let s=function(){let o=[],n=-1,l=0,a=!1,d;function g(c,x){return!c||typeof c[x]!="function"?this:(a=!0,c[x](),a=!1,this)}return{add:function(c){return a?this:(o.splice(n+1,o.length-n),o.push(c),l&&o.length>l&&t(o,0,-(l+1)),n=o.length-1,d&&d(),this)},setCallback:function(c){d=c},undo:function(){let c=o[n];if(!c)return this;const x=c.groupId;for(;c.groupId===x&&(g(c,"undo"),n-=1,c=o[n],!(!c||!c.groupId)););return d&&d(),this},redo:function(){let c=o[n+1];if(!c)return this;const x=c.groupId;for(;c.groupId===x&&(g(c,"redo"),n+=1,c=o[n+1],!(!c||!c.groupId)););return d&&d(),this},clear:function(){let c=o.length;o=[],n=-1,d&&c>0&&d()},hasUndo:function(){return n!==-1},hasRedo:function(){return n<o.length-1},getCommands:function(c){return c?o.filter(x=>x.groupId===c):o},getIndex:function(){return n},setLimit:function(c){l=c}}};e.exports?e.exports=s:window.UndoManager=s})()})(Ke);var ir=Ke.exports;const lr=on.getDefaultExportFromCjs(ir),cr=p.atom(Y.BRANDING_OPTIONS_DEFAULTS),dr=p.atom(null),Je=()=>{const[e,t]=p.useAtom(cr);return[i.isObject(e)?{...Y.BRANDING_OPTIONS_DEFAULTS,...e}:Y.BRANDING_OPTIONS_DEFAULTS,t]},ur=()=>p.useAtom(dr),mr=p.atom(null),Lt=()=>({currentPage:p.useAtomValue(mr)});function pr(e){return _t(e)}const Qe=(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,...Qe(o,s._id)])}return s}));function Xe(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&&Xe(o.children)}}function zt(e){let t=[],s=i.filter(e,{type:"GlobalBlock"});return s.length>0&&(s=i.map(s,Vt),i.each(s,o=>{t=[...t,...fr(o)]})),t}function fr(e){let t=[];const s=i.get(i.first(e),"parent",null);i.set(i.first(e),"parent",null);const o=[flatToNestedInstance.convert(Ft(e))];Xe(o,!0);let n=Qe(o,e[0]._id);return n=i.set(n,"0.parent",s),t=[...t,n,...zt(n)],t}function Vt(e){const t=i.find(Ve,{_id:e._id});if(!t)return[];const s=[t],o=i.filter(Ve,{_parent:e._id});return o.length?i.flatten([...s,...i.flatten(i.map(o,Vt))]):i.flatten(s)}const Ft=e=>JSON.parse(JSON.stringify(e));let Ve=[];function xr(e){Ve=e;const t=pr(Ft(e));Xe(t);const s=Qe(t,null),o=zt(s),n={};return i.each(o,l=>i.set(n,i.first(l).blockId,l)),[s,n]}const Ut=()=>{const[e]=Je(),{currentPage:t}=Lt(),[s]=de();return k.useCallback(()=>{const o=i.map(s,l=>i.omit(l,["expanded","order","title","siblings","tempClasses"])),[n=[]]=xr(o);return{currentPage:t,blocks:n}},[e,t,s])},me=(e,t=void 0)=>{const s=p.useAtomValue(qe);return i.get(s,e,t)},Ze=p.atom([]);Ze.debugLabel="dataProvidersAtom";const qt=()=>p.useAtom(Ze),Ee=p.atom("SAVED");Ee.debugLabel="pageSyncStateAtom";const gr=()=>{const[e,t]=p.useAtom(Ee),s=me("onSavePage",async c=>{}),o=me("onSave",async c=>{}),n=me("onSyncStatusChange",c=>{}),l=Ut(),[a]=qt(),[d]=Je();return{savePage:nn.useThrottledCallback(async()=>{t("SAVING"),n("SAVING");const c=l();return await s({blocks:c.blocks,providers:a}),await o({blocks:c.blocks,providers:a,brandingOptions:d}),setTimeout(()=>{t("SAVED"),n("SAVED")},100),!0},[l,t,d,o,n],5e3),syncState:e,setSyncState:t}},te=new lr;te.setLimit(50);const et=()=>{const[,e]=p.useAtom(Ee);return k.useEffect(()=>(te.setCallback(()=>e("UNSAVED")),()=>{te.setCallback(i.noop)}),[]),{add:te.add,undo:te.undo,redo:te.redo,hasRedo:te.hasRedo,hasUndo:te.hasUndo,clear:te.clear}},tt=(e,t)=>{const s=[],o=i.filter(e,n=>i.includes(t,n._id)||i.includes(t,n._parent)?(s.push(n._id),!1):!0);return i.isEmpty(s)?o:tt(o,s)},hr=()=>{const[e]=de(),[t,s]=be(),{setNewBlocks:o}=re();return k.useCallback(n=>{var a;const l=((a=i.find(e,{_id:n[0]}))==null?void 0:a._parent)||null;o(tt(e,n)),setTimeout(()=>s(l?[l]:[]),200)},[e,s,t])};function br(e,t,s,o){let n=e.filter(d=>!d._parent);s&&(n=e.filter(d=>d._parent===s));const l=o!==void 0?o:n.length;let a=e.length;for(let d=0,g=0;d<e.length;d++)if(e[d]._parent===s){if(g===l){a=d;break}g++}return!s&&o!==void 0&&o>=n.length&&(a=e.length),[...e.slice(0,a),...t,...e.slice(a)]}const vr=(e,t,s,o)=>{function n(d,g){const c=d.filter(R=>R._parent===g);let x=[...c];return c.forEach(R=>{x=x.concat(n(d,R._id))}),x}const l=t.reduce((d,g)=>{const c=e.find(x=>x._id===g);if(c){const x=n(e,g);d.push(c,...x)}return d},[]);e=e.filter(d=>!l.includes(d)),l.forEach(d=>{t.includes(d._id)&&(d._parent=s)});let a;return s===void 0?a=o:a=e.findIndex(g=>g._id===s)+1+o,e.splice(a,0,...l),e},yr=()=>{const[,e]=de();return{setNewBlocks:t=>{e(t)},addBlocks:(t,s,o)=>{e(n=>br(n,t,s,o))},removeBlocks:t=>{e(s=>tt(s,t))},moveBlocks:(t,s,o)=>{e(n=>vr(n,t,s,o))},updateBlocksProps:t=>{e(s=>{const o=t.map(n=>n._id);return s.map(n=>{if(o.includes(n._id)){const l=i.find(t,{_id:n._id});return{...n,...i.omit(l,"_id")}}return n})})}}},de=()=>p.useAtom(ee),re=()=>{const{add:e}=et(),[t]=de(),{setNewBlocks:s,addBlocks:o,removeBlocks:n,moveBlocks:l,updateBlocksProps:a}=yr();return{moveBlocks:(j,C,O)=>{const q=i.map(j,A=>{const V=t.find(z=>z._id===A)._parent||void 0,K=t.filter(z=>V?z._parent===V:!z._parent).map(z=>z._id).indexOf(A);return{_id:A,oldParent:V,oldPosition:K}});l(j,C,O),e({undo:()=>i.each(q,({_id:A,oldParent:L,oldPosition:V})=>{l([A],L,V)}),redo:()=>l(j,C,O)})},addBlocks:(j,C,O)=>{o(j,C,O),e({undo:()=>n(i.map(j,"_id")),redo:()=>o(j,C,O)})},removeBlocks:j=>{var A;const C=(A=i.first(j))==null?void 0:A._parent,q=t.filter(L=>C?L._parent===C:!L._parent).indexOf(i.first(j));n(i.map(j,"_id")),e({undo:()=>o(j,C,q),redo:()=>n(i.map(j,"_id"))})},updateBlocks:(j,C,O)=>{let q=[];if(O)q=i.map(j,A=>({_id:A,...O}));else{const A=i.keys(C);q=i.map(j,L=>{const V=t.find(K=>K._id===L),H={_id:L};return i.each(A,K=>H[K]=V[K]),H})}a(i.map(j,A=>({_id:A,...C}))),e({undo:()=>a(q),redo:()=>a(i.map(j,A=>({_id:A,...C})))})},updateBlocksRuntime:(j,C)=>{a(i.map(j,O=>({_id:O,...C})))},setNewBlocks:j=>{s(j),e({undo:()=>s(t),redo:()=>s(j)})}}},$t=le.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"}}),Gt=f.forwardRef(({className:e,variant:t,size:s,...o},n)=>r.jsxRuntimeExports.jsx(jt.Root,{ref:n,className:u.cn($t({variant:t,size:s,className:e})),...o}));Gt.displayName=jt.Root.displayName;const Wt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(De.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:r.jsxRuntimeExports.jsx(De.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")})}));Wt.displayName=De.Root.displayName;const Ae=le.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"}}),Ht=f.forwardRef(({className:e,variant:t,size:s,asChild:o=!1,...n},l)=>{const a=o?ln.Slot:"button";return r.jsxRuntimeExports.jsx(a,{className:u.cn(Ae({variant:t,size:s,className:e})),ref:l,...n})});Ht.displayName="Button";const jr=ie.Root,Yt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(ie.Item,{ref:s,className:u.cn("border-b",e),...t}));Yt.displayName="AccordionItem";const Kt=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(ie.Header,{className:"flex",children:r.jsxRuntimeExports.jsxs(ie.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,r.jsxRuntimeExports.jsx(G.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Kt.displayName=ie.Trigger.displayName;const Jt=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(ie.Content,{ref:o,className:u.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...s,children:r.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:t})}));Jt.displayName=ie.Content.displayName;const wr=le.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"}}),Qt=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx("div",{ref:o,role:"alert",className:u.cn(wr({variant:t}),e),...s}));Qt.displayName="Alert";const Xt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h5",{ref:s,className:u.cn("mb-1 font-medium leading-none tracking-tight",e),...t}));Xt.displayName="AlertTitle";const Zt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("text-sm [&_p]:leading-relaxed",e),...t}));Zt.displayName="AlertDescription";const es=le.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"}}),Rr=({className:e,variant:t,...s})=>r.jsxRuntimeExports.jsx("div",{className:u.cn(es({variant:t}),e),...s}),kr=W.Root,Nr=W.Trigger,ts=({className:e,...t})=>r.jsxRuntimeExports.jsx(W.Portal,{className:u.cn(e),...t});ts.displayName=W.Portal.displayName;const ss=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.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}));ss.displayName=W.Overlay.displayName;const os=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs(ts,{children:[r.jsxRuntimeExports.jsx(ss,{}),r.jsxRuntimeExports.jsx(W.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})]}));os.displayName=W.Content.displayName;const ns=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});ns.displayName="AlertDialogHeader";const rs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});rs.displayName="AlertDialogFooter";const as=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Title,{ref:s,className:u.cn("text-lg font-semibold",e),...t}));as.displayName=W.Title.displayName;const is=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));is.displayName=W.Description.displayName;const ls=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Action,{ref:s,className:u.cn(Ae(),e),...t}));ls.displayName=W.Action.displayName;const cs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Cancel,{ref:s,className:u.cn(Ae({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));cs.displayName=W.Cancel.displayName;const st=P.Root,ds=P.Trigger,us=({className:e,...t})=>r.jsxRuntimeExports.jsx(P.Portal,{className:u.cn(e),...t});us.displayName=P.Portal.displayName;const ms=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.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}));ms.displayName=P.Overlay.displayName;const _e=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(us,{children:[r.jsxRuntimeExports.jsx(ms,{}),r.jsxRuntimeExports.jsxs(P.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,r.jsxRuntimeExports.jsxs(P.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:[r.jsxRuntimeExports.jsx(G.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=P.Content.displayName;const ps=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ps.displayName="DialogHeader";const fs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});fs.displayName="DialogFooter";const xs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Title,{ref:s,className:u.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));xs.displayName=P.Title.displayName;const gs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));gs.displayName=P.Description.displayName;const hs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("rounded-xl border bg-card text-card-foreground shadow",e),...t}));hs.displayName="Card";const bs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("flex flex-col space-y-1.5 p-6",e),...t}));bs.displayName="CardHeader";const vs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h3",{ref:s,className:u.cn("font-semibold leading-none tracking-tight",e),...t}));vs.displayName="CardTitle";const ys=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("p",{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));ys.displayName="CardDescription";const js=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("p-6 pt-0",e),...t}));js.displayName="CardContent";const ws=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn(" flex items-center p-6 pt-0",e),...t}));ws.displayName="CardFooter";const Rs=f.forwardRef(({className:e,type:t,...s},o)=>r.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}));Rs.displayName="Input";const Sr=le.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ks=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(wt.Root,{ref:s,className:u.cn(Sr(),e),...t}));ks.displayName=wt.Root.displayName;const Ns=f.forwardRef(({className:e,...t},s)=>r.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}));Ns.displayName="Textarea";const Ss=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(ae.Root,{ref:o,className:u.cn("relative overflow-hidden",e),...s,children:[r.jsxRuntimeExports.jsx(ae.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsxRuntimeExports.jsx(ot,{}),r.jsxRuntimeExports.jsx(ae.Corner,{})]}));Ss.displayName=ae.Root.displayName;const ot=f.forwardRef(({className:e,orientation:t="vertical",...s},o)=>r.jsxRuntimeExports.jsx(ae.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:r.jsxRuntimeExports.jsx(ae.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));ot.displayName=ae.ScrollAreaScrollbar.displayName;const Cs=ce.Root,nt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(ce.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}));nt.displayName=ce.List.displayName;const ke=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(ce.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}));ke.displayName=ce.Trigger.displayName;const Ne=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(ce.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}));Ne.displayName=ce.Content.displayName;const Cr=pe.Portal,Er=pe.Provider,Ar=pe.Root,_r=pe.Trigger,Es=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(pe.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}));Es.displayName=pe.Content.displayName;const Br=he.Root,Tr=he.Trigger,As=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(he.Portal,{children:r.jsxRuntimeExports.jsx(he.Content,{ref:n,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})}));As.displayName=he.Content.displayName;const Pr=B.Menu,Ir=B.Group,Mr=B.Portal,Dr=B.Sub,Or=B.RadioGroup,_s=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.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}));_s.displayName=B.Root.displayName;const Bs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.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}));Bs.displayName=B.Trigger.displayName;const Ts=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(B.SubTrigger,{ref:n,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,r.jsxRuntimeExports.jsx(G.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Ts.displayName=B.SubTrigger.displayName;const Ps=f.forwardRef(({className:e,...t},s)=>r.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}));Ps.displayName=B.SubContent.displayName;const Is=f.forwardRef(({className:e,align:t="start",alignOffset:s=-4,sideOffset:o=8,...n},l)=>r.jsxRuntimeExports.jsx(B.Portal,{children:r.jsxRuntimeExports.jsx(B.Content,{ref:l,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),...n})}));Is.displayName=B.Content.displayName;const Ms=f.forwardRef(({className:e,inset:t,...s},o)=>r.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 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));Ms.displayName=B.Item.displayName;const Ds=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(B.CheckboxItem,{ref:n,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:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(B.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),t]}));Ds.displayName=B.CheckboxItem.displayName;const Os=f.forwardRef(({className:e,children:t,...s},o)=>r.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 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(B.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Os.displayName=B.RadioItem.displayName;const Ls=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(B.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));Ls.displayName=B.Label.displayName;const zs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));zs.displayName=B.Separator.displayName;const Vs=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Vs.displayname="MenubarShortcut";const Lr=Ce.Root,zr=Ce.Trigger,Fs=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(Ce.Content,{ref:n,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}));Fs.displayName=Ce.Content.displayName;const Vr=F.Root,Fr=F.Group,Ur=F.Value,Us=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(F.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,r.jsxRuntimeExports.jsx(F.Icon,{asChild:!0,children:r.jsxRuntimeExports.jsx(G.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));Us.displayName=F.Trigger.displayName;const qs=f.forwardRef(({className:e,children:t,position:s="popper",...o},n)=>r.jsxRuntimeExports.jsx(F.Portal,{children:r.jsxRuntimeExports.jsx(F.Content,{ref:n,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:r.jsxRuntimeExports.jsx(F.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})})}));qs.displayName=F.Content.displayName;const $s=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(F.Label,{ref:s,className:u.cn("px-2 py-1.5 text-sm font-semibold",e),...t}));$s.displayName=F.Label.displayName;const Gs=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(F.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:[r.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(F.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),r.jsxRuntimeExports.jsx(F.ItemText,{children:t})]}));Gs.displayName=F.Item.displayName;const Ws=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(F.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Ws.displayName=F.Separator.displayName;const qr=P.Root,$r=P.Trigger,Gr=P.Close,Hs=({className:e,...t})=>r.jsxRuntimeExports.jsx(P.Portal,{className:u.cn(e),...t});Hs.displayName=P.Portal.displayName;const Ys=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.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}));Ys.displayName=P.Overlay.displayName;const Wr=le.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"}}),Ks=f.forwardRef(({side:e="right",className:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(Hs,{children:[r.jsxRuntimeExports.jsx(Ys,{}),r.jsxRuntimeExports.jsxs(P.Content,{ref:n,className:u.cn(Wr({side:e}),t),...o,children:[s,r.jsxRuntimeExports.jsxs(P.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:[r.jsxRuntimeExports.jsx(G.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ks.displayName=P.Content.displayName;const Js=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Js.displayName="SheetHeader";const Qs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qs.displayName="SheetFooter";const Xs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Title,{ref:s,className:u.cn("text-lg font-semibold text-foreground",e),...t}));Xs.displayName=P.Title.displayName;const Zs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Zs.displayName=P.Description.displayName;const Hr=I.Root,Yr=I.Trigger,Kr=I.Group,Jr=I.Portal,Qr=I.Sub,Xr=I.RadioGroup,eo=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(I.SubTrigger,{ref:n,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,r.jsxRuntimeExports.jsx(G.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));eo.displayName=I.SubTrigger.displayName;const to=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.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=I.SubContent.displayName;const so=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(I.Portal,{children:r.jsxRuntimeExports.jsx(I.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})}));so.displayName=I.Content.displayName;const oo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(I.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}));oo.displayName=I.Item.displayName;const no=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(I.CheckboxItem,{ref:n,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:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(I.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),t]}));no.displayName=I.CheckboxItem.displayName;const ro=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(I.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:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(I.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));ro.displayName=I.RadioItem.displayName;const ao=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(I.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));ao.displayName=I.Label.displayName;const io=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));io.displayName=I.Separator.displayName;const lo=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest opacity-60",e),...t});lo.displayName="DropdownMenuShortcut";const co=f.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...o},n)=>r.jsxRuntimeExports.jsx(Rt.Root,{ref:n,decorative:s,orientation:t,className:u.cn("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));co.displayName=Rt.Root.displayName;const Zr=1,ea=1e6;let Ie=0;function ta(){return Ie=(Ie+1)%Number.MAX_VALUE,Ie.toString()}const Me=new Map,ft=e=>{if(Me.has(e))return;const t=setTimeout(()=>{Me.delete(e),ge({type:"REMOVE_TOAST",toastId:e})},ea);Me.set(e,t)},uo=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Zr)};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?ft(s):e.toasts.forEach(o=>{ft(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)}}},je=[];let we={toasts:[]};function ge(e){we=uo(we,e),je.forEach(t=>{t(we)})}function mo({...e}){const t=ta(),s=n=>ge({type:"UPDATE_TOAST",toast:{...n,id:t}}),o=()=>ge({type:"DISMISS_TOAST",toastId:t});return ge({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:n=>{n||o()}}}),{id:t,dismiss:o,update:s}}function rt(){const[e,t]=f.useState(we);return f.useEffect(()=>(je.push(t),()=>{const s=je.indexOf(t);s>-1&&je.splice(s,1)}),[e]),{...e,toast:mo,dismiss:s=>ge({type:"DISMISS_TOAST",toastId:s})}}const sa=Q.Provider,po=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.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}));po.displayName=Q.Viewport.displayName;const oa=le.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"}}),fo=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx(Q.Root,{ref:o,className:u.cn(oa({variant:t}),e),...s}));fo.displayName=Q.Root.displayName;const na=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.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}));na.displayName=Q.Action.displayName;const xo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.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:r.jsxRuntimeExports.jsx(G.Cross2Icon,{className:"h-4 w-4"})}));xo.displayName=Q.Close.displayName;const go=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Title,{ref:s,className:u.cn("text-sm font-semibold [&+div]:text-xs",e),...t}));go.displayName=Q.Title.displayName;const ho=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Description,{ref:s,className:u.cn("text-sm opacity-90",e),...t}));ho.displayName=Q.Description.displayName;function ra(){const{toasts:e}=rt();return r.jsxRuntimeExports.jsxs(sa,{children:[e.map(({id:t,title:s,description:o,action:n,...l})=>r.jsxRuntimeExports.jsxs(fo,{...l,children:[r.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[s&&r.jsxRuntimeExports.jsx(go,{children:s}),o&&r.jsxRuntimeExports.jsx(ho,{children:o})]}),n,r.jsxRuntimeExports.jsx(xo,{})]},t)),r.jsxRuntimeExports.jsx(po,{})]})}const aa=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("animate-pulse rounded-md bg-primary/10",e),...t}),at=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command,{ref:s,className:u.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));at.displayName=J.Command.displayName;const ia=({children:e,...t})=>r.jsxRuntimeExports.jsx(st,{...t,children:r.jsxRuntimeExports.jsx(_e,{className:"overflow-hidden p-0",children:r.jsxRuntimeExports.jsx(at,{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})})}),bo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsxRuntimeExports.jsx(G.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsxRuntimeExports.jsx(J.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})]}));bo.displayName=J.Command.Input.displayName;const vo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.List,{ref:s,className:u.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));vo.displayName=J.Command.List.displayName;const yo=f.forwardRef((e,t)=>r.jsxRuntimeExports.jsx(J.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));yo.displayName=J.Command.Empty.displayName;const jo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.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}));jo.displayName=J.Command.Group.displayName;const wo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Separator,{ref:s,className:u.cn("-mx-1 h-px bg-border",e),...t}));wo.displayName=J.Command.Separator.displayName;const Ro=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.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}));Ro.displayName=J.Command.Item.displayName;const ko=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});ko.displayName="CommandShortcut";const la=M.Root,ca=M.Trigger,da=M.Group,ua=M.Portal,ma=M.Sub,pa=M.RadioGroup,No=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(M.SubTrigger,{ref:n,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,r.jsxRuntimeExports.jsx(G.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));No.displayName=M.SubTrigger.displayName;const So=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(M.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}));So.displayName=M.SubContent.displayName;const Co=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(M.Portal,{children:r.jsxRuntimeExports.jsx(M.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})}));Co.displayName=M.Content.displayName;const Eo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(M.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}));Eo.displayName=M.Item.displayName;const Ao=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(M.CheckboxItem,{ref:n,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:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(M.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),t]}));Ao.displayName=M.CheckboxItem.displayName;const _o=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(M.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:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(M.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));_o.displayName=M.RadioItem.displayName;const Bo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(M.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...s}));Bo.displayName=M.Label.displayName;const To=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(M.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-border",e),...t}));To.displayName=M.Separator.displayName;const Po=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Po.displayName="ContextMenuShortcut";const fa=e=>{try{const t=document.getElementById("icon-picker-field"),s=document.createElement("div");kn.render(r.jsxRuntimeExports.jsx(yt.IconPickerItem,{value:e}),s),t.appendChild(s),s.hidden=!0;let o=s.innerHTML;setTimeout(()=>t.removeChild(s),100);const l=new DOMParser().parseFromString(o,"image/svg+xml"),a=l.querySelector("svg");return a&&(a.removeAttribute("width"),a.removeAttribute("height")),new XMLSerializer().serializeToString(l)}catch(t){return console.error(t),""}},xa=({value:e,onChange:t})=>{const s=o=>{t("<svg />");const n=fa(o);t(n)};return r.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[r.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[r.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e?e.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"}),r.jsxRuntimeExports.jsx(yt,{value:e?"BiSolidGrid":null,onChange:s,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"}})]}),r.jsxRuntimeExports.jsx("textarea",{value:e,onChange:o=>t(o.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"})]})},ga=k.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-6tZv1q2_.cjs"))),ha=k.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-VLlVg9Ur.cjs"))),Io=({isModalView:e=!1,onSelect:t=()=>{}})=>{const[s,o]=k.useState("upload");return r.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:e?"Select or upload images":"Images"})}),r.jsxRuntimeExports.jsxs(Cs,{value:s,onValueChange:n=>o(n),className:"flex h-full w-full flex-col py-2",children:[r.jsxRuntimeExports.jsxs(nt,{className:"w-full",children:[r.jsxRuntimeExports.jsx(ke,{value:"upload",className:"w-1/2",children:"Upload"}),r.jsxRuntimeExports.jsx(ke,{value:"unsplash",className:"w-1/2",children:"Unsplash"})]}),s==="unsplash"?r.jsxRuntimeExports.jsx(Ne,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(k.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(ga,{isModalView:e,onSelect:t})})}):r.jsxRuntimeExports.jsx(Ne,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(k.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(ha,{isModalView:e,onSelect:t})})})]})]})},ba=Object.freeze(Object.defineProperty({__proto__:null,default:Io},Symbol.toStringTag,{value:"Module"})),xt=({children:e,onSelect:t})=>{const[s,o]=k.useState(!1),n=(...l)=>{t.call(void 0,...l),o(!1)};return r.jsxRuntimeExports.jsxs(st,{open:s,onOpenChange:l=>o(l),children:[r.jsxRuntimeExports.jsx(ds,{asChild:!0,children:e}),r.jsxRuntimeExports.jsx(_e,{className:"flex h-3/4 max-w-5xl",children:r.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:r.jsxRuntimeExports.jsx(Io,{isModalView:!0,onSelect:n})})})]})},va=({value:e,onChange:t,id:s,onBlur:o})=>r.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[e?r.jsxRuntimeExports.jsx("img",{src:e,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):r.jsxRuntimeExports.jsx(xt,{onSelect:t,children:r.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"})}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[r.jsxRuntimeExports.jsx(xt,{onSelect:t,children:r.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"})}),r.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"}),r.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:e,onBlur:({target:{value:n}})=>o(s,n),onChange:n=>t(n.target.value)})]})]}),ya=({id:e,placeholder:t,value:s,onChange:o,onBlur:n})=>{const l={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},a=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:r.jsxRuntimeExports.jsx(Nn,{id:e,value:s,onBlur:d=>n(e,d),onChange:d=>o(d),modules:l,formats:a,placeholder:t,className:"mt-1 rounded-md"})},ja=({schema:e,formData:t,onChange:s})=>{const[o,n]=k.useState([]),l=me("getPages",()=>[]),{type:a="page",href:d="",target:g="self"}=t;return k.useEffect(()=>{(async()=>{const c=await l();n(c||[])})()},[]),r.jsxRuntimeExports.jsxs("div",{children:[r.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(e==null?void 0:e.title)??"Link"}),r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[r.jsxRuntimeExports.jsx("select",{name:"type",value:a,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=>r.jsxRuntimeExports.jsx("option",{value:c.const,children:c.title},c.const))}),a==="page"?r.jsxRuntimeExports.jsxs("select",{name:"href",placeholder:"Choose Page",value:d,onChange:c=>s({...t,href:c.target.value}),children:[r.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),i.map(o,c=>r.jsxRuntimeExports.jsx("option",{value:c.slug,children:c.name},c.uuid))]}):r.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:d,onChange:c=>s({...t,href:c.target.value}),placeholder:a==="page"||a==="url"?"Enter URL":a==="scroll"?"#ElementID":"Enter detail"}),(a==="page"||a==="url")&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:g==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>s({...t,target:g==="_blank"?"_self":"_blank"})}),r.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},wa=()=>{const[e]=de(),[,t]=be(),{addBlocks:s}=re(),{toast:o}=rt(),n=k.useCallback((a,d,g)=>{var j;for(let C=0;C<a.length;C++){const{_id:O}=a[C];a[C]._id=ne.generateUUID();const q=i.filter(a,{_parent:O});for(let A=0;A<q.length;A++)q[A]._parent=a[C]._id}const c=i.first(a);let x,R;return d&&(x=i.find(e,{_id:d}),a[0]._parent=d,R=d),!(x?Oe(x._type,c._type):!0)&&x&&(a[0]._parent=x._parent,R=x._parent),s(a,R,g),t([(j=i.first(a))==null?void 0:j._id]),i.first(a)},[e,t]);return{addCoreBlock:k.useCallback((a,d,g)=>{if(i.has(a,"blocks")){const A=a.blocks;return n(A,d,g)}const c=ne.generateUUID(),x=Ot(a.props),R=[];i.forIn(x,(A,L)=>{if(i.startsWith(A,Y.SLOT_KEY)){const V=A.replace(Y.SLOT_KEY,"");R.push({_id:V,_type:"Slot",_parent:c,_name:a.props[L].name,_styles:a.props[L].styles,_emptyStyles:a.props[L].emptyStyles})}});const S={_type:a.type,_id:c,...x};let j,C;if(d&&(j=i.find(e,{_id:d}),S._parent=d,C=d),!Hn(j==null?void 0:j._type,a.type)){o({variant:"destructive",title:"Error",description:`"${a.type}" cannot be added under "${j?j==null?void 0:j._type:"root"}"`}),t([]);return}!(j?Oe(j._type,a.type):!0)&&j&&(S._parent=j._parent,C=j._parent);const q=[S,...R];return s(q,C,g),t([S._id]),S},[n,e,t]),addPredefinedBlock:n}},gt={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},ht=["xs","sm","md","lg","xl","2xl"];function Ra(e,t){if(t===null)return"baseClasses";const s=t.mq;if(s==="xs"||t.dark||t.mod!=="")return"classes";let o="baseClasses",n=ht.indexOf(s);for(;n>0;){const l=ht[n-1];if(i.find(e,{mq:l,property:t.property})){o="classes";break}n--}return o}const bt=[];function ka(e="",t="",s=[]){e=e.trim().replace(/ +/g,"");let o=i.filter(i.map(e.split(" "),u.constructClassObject),c=>!i.isNull(c)),n=i.filter(i.map(t.split(" "),u.constructClassObject),c=>!i.isNull(c));n=i.filter(n,c=>!i.includes(bt,c.property));const l=[],a=[];i.each(s,c=>{const x=u.constructClassObject(c),R=i.find(o,i.pick(x,["dark","mq","mod","property"]));if(R&&(o=i.filter(o,S=>S.fullCls!==(R==null?void 0:R.fullCls))),l.push(x),x.mq==="xs"&&!x.dark&&x.mod===""&&(n=i.filter(n,S=>S.property!==x.property)),Ra(o,x)==="baseClasses"&&!i.includes(bt,x.property)){const S=i.find(n,i.pick(x,["property"]));R&&(n=i.filter(n,j=>j.fullCls!==(S==null?void 0:S.fullCls))),a.push({...x,fullCls:x.cls,mq:"xs"})}});const d=i.map(i.sortBy([...o,...l],c=>gt[c.mq]),"fullCls").join(" ");return`${i.map(i.sortBy([...n,...a],c=>gt[c.mq]),"fullCls").join(" ").trim()},${d.trim()}`.trim().replace(/ +/g,"")}const ve=p.atom([]);ve.debugLabel="selectedStylingBlocksAtom";const Mo=()=>p.useAtom(ve),Na=e=>{const t=e.replace(Y.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Sa=p.atom(null,(e,t,{blockIds:s,newClasses:o})=>{const n=i.filter(e($e),a=>s.includes(e(a)._id)),l=i.first(e(ve));return i.map(n,a=>{const d=e(a),g=i.get(d,l.prop,`${Y.STYLES_KEY},`),{baseClasses:c,classes:x}=Na(g);return{ids:[d._id],props:{[l.prop]:`${Y.STYLES_KEY}${ka(x,c,o)}`}}})}),Ca=()=>{const e=p.useSetAtom(Sa),{updateBlocks:t,updateBlocksRuntime:s}=re();return k.useCallback((o,n,l=!1)=>{const a=e({blockIds:o,newClasses:n});if(!l){s(o,a[0].props);return}t(o,a[0].props)},[e])},Do=()=>p.useAtom(Dt),Oo=fe("canvasWidth",800),Lo=p.atom(e=>{const t=e(Oo);return ne.getBreakpointValue(t).toLowerCase()}),Ea=()=>{const[e,t]=p.useAtom(Oo),s=p.useAtomValue(Lo),[o,n]=Do();return k.useEffect(()=>{o!=="xs"&&n(s)},[s,o,n]),[e,s,t]},Aa=fe("canvasZoom",100),_a=()=>p.useAtom(Aa),zo=p.atom([]),Vo=()=>{const[e,t]=p.useAtom(zo),s=p.useSetAtom(it),o=k.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},it=p.atom([]),Ba=()=>{const[e,t]=p.useAtom(it),s=p.useSetAtom(zo),o=k.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},Fo=fe("darkMode",!1),Ta=()=>{const[e,t]=p.useAtom(Fo);return[e,t]},Uo=()=>{const[e]=de(),[,t]=be(),{addBlocks:s}=re();return k.useCallback((o,n=null)=>{const l=[];i.each(o,a=>{const d=e.find(S=>S._id===a);n||(n=d._parent);const x=i.filter(e,S=>i.isString(n)?S._parent===n:!d._parent).indexOf(d)+1,R=Qn(e,a,n);s(R,n,x),l.push(i.get(R,"0._id",""))}),t(l)},[e,t])},Pa=p.atom([]),Ia=()=>{const[e,t]=p.useAtom(Pa),s=k.useCallback(o=>{t(n=>i.includes(n,o)?i.without(n,o):[...n,o])},[t]);return[e,t,s]},Ma=p.atom(""),qo=()=>p.useAtom(Ma),Da=()=>{const e=p.useAtomValue(ee);return k.useCallback((t,s)=>{const o=i.map(e,n=>(i.includes(t,i.get(n,"_id"))&&i.set(n,"_parent",s),n));console.log("newBlocks",o)},[e])},Oa=()=>{console.warn("usePasteBlocks is not implemented");const e=p.useAtomValue(it),[t,s]=Vo(),o=Uo(),n=Da();return{canPaste:k.useMemo(()=>t.length>0||e.length>0,[e,t]),pasteBlocks:k.useCallback(a=>{i.isEmpty(e)?n(t,a):o(e,a),s(()=>[])},[t,e,o,n,s])}},La=p.atom(!1),za=()=>{const[e,t]=p.useAtom(La);return[e,t]},Va=p.atom(null,(e,t,{blockIds:s,fullClasses:o})=>{const n=i.first(e(ve)),l=i.filter(e($e),a=>s.includes(e(a)._id));return i.map(l,a=>{const d=e(a),g=o;let{classes:c,baseClasses:x}=Wn(i.get(d,n.prop,"styles:,"));return i.each(g,R=>{const S=new RegExp(`(^| )${R.replace("[","\\[").replace("]","\\]")}($| )`,"g");c=c.replace(S," ").replace(/ +/g," ").trim();const j=i.first(R.split(":"));i.includes(["2xl","xl","lg","md","sm"],j)&&g.push(R.split(":").pop().trim())}),i.each(g,R=>{const S=new RegExp(`(^| )${R.replace("[","\\[").replace("]","\\]")}($| )`,"g");x=x.replace(S," ").replace(/ +/g," ").trim()}),{ids:[d._id],props:{[n.prop]:`${Y.STYLES_KEY}${x},${c}`}}})}),Fa=()=>{const{updateBlocks:e}=re(),t=p.useSetAtom(Va);return k.useCallback((s,o)=>{const n=t({blockIds:s,fullClasses:o});e(s,n[0].props)},[t])},$o=p.atom(e=>{const t=i.first(e(ve)),s=e(He);if(!t||t.blockId!==i.get(s,"_id",null))return[];const n=i.get(s,t.prop,`${Y.STYLES_KEY},`).replace(Y.STYLES_KEY,"").split(",").join(" ");return i.filter(i.map(n.trim().split(" "),u.constructClassObject),l=>!i.isNull(l))}),Ua=()=>p.useAtomValue($o),vt={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},qa=p.atom(e=>{const t=e(Lo),s=e(Ye),o=e(Fo),n=$a(t);let l=i.filter(e($o),{mod:s});return i.startsWith(s,"_")||(l=i.filter(l,a=>n.includes(a.mq))),l=l.sort((a,d)=>vt[a.mq]-vt[d.mq]),o||(l=i.filter(l,{dark:!1})),l}),$a=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},Ga=()=>p.useAtomValue(qa),Wa=()=>p.useAtom(Ye),Ha=()=>{const{updateBlocks:e}=re();return k.useCallback((t,s,o)=>{e(t,s,o)},[e])},Ya=()=>{const{updateBlocksRuntime:e}=re();return k.useCallback((t,s)=>{e(t,s)},[e])},Go={name:"",props:{},modalProps:{},backdropClose:!0},Ka=p.atom(Go),Ja=()=>{const[e,t]=p.useAtom(Ka),s=k.useCallback((n,l={},a={})=>{t({name:n,props:l,modalProps:a})},[t]),o=k.useCallback((...n)=>{i.get(e,"props.onClose",()=>{})(...n),t(Go)},[t,e]);return{activeModal:e,openModal:s,closeModal:o}},Qa=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),p.useAtomValue(ee)),Wo=p.atom(!1);Wo.debugLabel="readOnlyModeAtom";const Ho=p.atom("online");Ho.debugLabel="networkModeAtom";const Xa=p.atom(!1);Xa.debugLabel="codeEditorOpenAtom";const Yo=p.atom(!1);Yo.debugLabel="editLayerNameAtom";const Za=p.atom("");Za.debugLabel="activeLanguageAtom";const ei=p.atom("");ei.debugLabel="primaryLanguageAtom";const Ko=p.atom(null);Ko.debugLabel="canvasIframeAtom";const Jo=p.atom("outline");Jo.debugLabel="activePanelAtom";const Qo=p.atom("");Qo.debugLabel="showPredefinedBlockCategoryAtom";const Xo=p.atom({undoCount:0,redoCount:0});Xo.debugLabel="historyStatesAtom";const Zo=p.atom("");Zo.debugLabel="inlineEditingActiveAtom";const en=p.atom(!1);en.debugLabel="draggingFlagAtom";const tn=p.atom("");tn.debugLabel="draggedBlockIdAtom";const ti=()=>p.useAtomValue(Wo),si=p.atom(""),oi=p.atom(null),ni=()=>p.useAtom(si),ri=()=>p.useAtom(oi),ai=fe("selectedBreakpoints",["XS","MD","XL"]),ii=()=>{const[e,t]=p.useAtom(ai);return[e,t]},li=()=>{const e=p.useSetAtom(Xo),{clear:t}=et(),[,s]=be(),[,o]=qo(),[,n]=Mo();return()=>{s([]),n([]),o(""),t(),e({undoCount:0,redoCount:0})}},ci=p.atom([]),di=()=>{const[e,t]=k.useState(!1),[s,o]=p.useAtom(ci),n=me("getUILibraryBlocks",()=>[]);return k.useEffect(()=>{(async()=>s.length>0||(t(!0),o(await n()),t(!1)))()},[]),{data:s,isLoading:e}},ui=()=>{const[e,t]=k.useState(null),s=k.useCallback(async o=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(o),t(o),!0}catch(n){return console.warn("Copy failed",n),t(null),!1}},[]);return[e,s]};exports.Accordion=jr;exports.AccordionContent=Jt;exports.AccordionItem=Yt;exports.AccordionTrigger=Kt;exports.Alert=Qt;exports.AlertDescription=Zt;exports.AlertDialog=kr;exports.AlertDialogAction=ls;exports.AlertDialogCancel=cs;exports.AlertDialogContent=os;exports.AlertDialogDescription=is;exports.AlertDialogFooter=rs;exports.AlertDialogHeader=ns;exports.AlertDialogTitle=as;exports.AlertDialogTrigger=Nr;exports.AlertTitle=Xt;exports.Badge=Rr;exports.Button=Ht;exports.Card=hs;exports.CardContent=js;exports.CardDescription=ys;exports.CardFooter=ws;exports.CardHeader=bs;exports.CardTitle=vs;exports.Command=at;exports.CommandDialog=ia;exports.CommandEmpty=yo;exports.CommandGroup=jo;exports.CommandInput=bo;exports.CommandItem=Ro;exports.CommandList=vo;exports.CommandSeparator=wo;exports.CommandShortcut=ko;exports.ContextMenu=la;exports.ContextMenuCheckboxItem=Ao;exports.ContextMenuContent=Co;exports.ContextMenuGroup=da;exports.ContextMenuItem=Eo;exports.ContextMenuLabel=Bo;exports.ContextMenuPortal=ua;exports.ContextMenuRadioGroup=pa;exports.ContextMenuRadioItem=_o;exports.ContextMenuSeparator=To;exports.ContextMenuShortcut=Po;exports.ContextMenuSub=ma;exports.ContextMenuSubContent=So;exports.ContextMenuSubTrigger=No;exports.ContextMenuTrigger=ca;exports.Dialog=st;exports.DialogContent=_e;exports.DialogDescription=gs;exports.DialogFooter=fs;exports.DialogHeader=ps;exports.DialogTitle=xs;exports.DialogTrigger=ds;exports.DropdownMenu=Hr;exports.DropdownMenuCheckboxItem=no;exports.DropdownMenuContent=so;exports.DropdownMenuGroup=Kr;exports.DropdownMenuItem=oo;exports.DropdownMenuLabel=ao;exports.DropdownMenuPortal=Jr;exports.DropdownMenuRadioGroup=Xr;exports.DropdownMenuRadioItem=ro;exports.DropdownMenuSeparator=io;exports.DropdownMenuShortcut=lo;exports.DropdownMenuSub=Qr;exports.DropdownMenuSubContent=to;exports.DropdownMenuSubTrigger=eo;exports.DropdownMenuTrigger=Yr;exports.HoverCard=Lr;exports.HoverCardContent=Fs;exports.HoverCardTrigger=zr;exports.IconPickerField=xa;exports.ImagePickerField=va;exports.ImagesPanel=ba;exports.Input=Rs;exports.Label=ks;exports.LinkField=ja;exports.Menubar=_s;exports.MenubarCheckboxItem=Ds;exports.MenubarContent=Is;exports.MenubarGroup=Ir;exports.MenubarItem=Ms;exports.MenubarLabel=Ls;exports.MenubarMenu=Pr;exports.MenubarPortal=Mr;exports.MenubarRadioGroup=Or;exports.MenubarRadioItem=Os;exports.MenubarSeparator=zs;exports.MenubarShortcut=Vs;exports.MenubarSub=Dr;exports.MenubarSubContent=Ps;exports.MenubarSubTrigger=Ts;exports.MenubarTrigger=Bs;exports.Popover=Br;exports.PopoverContent=As;exports.PopoverTrigger=Tr;exports.RichTextEditorField=ya;exports.ScrollArea=Ss;exports.ScrollBar=ot;exports.Select=Vr;exports.SelectContent=qs;exports.SelectGroup=Fr;exports.SelectItem=Gs;exports.SelectLabel=$s;exports.SelectSeparator=Ws;exports.SelectTrigger=Us;exports.SelectValue=Ur;exports.Separator=co;exports.Sheet=qr;exports.SheetClose=Gr;exports.SheetContent=Ks;exports.SheetDescription=Zs;exports.SheetFooter=Qs;exports.SheetHeader=Js;exports.SheetTitle=Xs;exports.SheetTrigger=$r;exports.Skeleton=aa;exports.Switch=Wt;exports.Tabs=Cs;exports.TabsContent=Ne;exports.TabsList=nt;exports.TabsTrigger=ke;exports.Textarea=Ns;exports.Toaster=ra;exports.Toggle=Gt;exports.Tooltip=Ar;exports.TooltipContent=Es;exports.TooltipPortal=Cr;exports.TooltipProvider=Er;exports.TooltipTrigger=_r;exports.activePanelAtom=Jo;exports.atom=Z;exports.atomWithDefault=Fn;exports.atomWithStorage=fe;exports.badgeVariants=es;exports.buttonVariants=Ae;exports.canDeleteBlock=Kn;exports.canDropBlock=Jn;exports.canDuplicateBlock=Yn;exports.canvasIframeAtom=Ko;exports.chaiBuilderPropsAtom=qe;exports.chaiExternalDataAtom=Et;exports.createStore=kt;exports.dataProvidersAtom=Ze;exports.draggedBlockIdAtom=tn;exports.draggingFlagAtom=en;exports.editLayerNameAtom=Yo;exports.getBlockJSONFromSchemas=ze;exports.getBlockJSONFromUISchemas=Le;exports.inlineEditingActiveAtom=Zo;exports.isDevelopment=Gn;exports.networkModeAtom=Ho;exports.pageSyncStateAtom=Ee;exports.presentBlocksAtom=ee;exports.reducer=uo;exports.showPredefinedBlockCategoryAtom=Qo;exports.toast=mo;exports.toggleVariants=$t;exports.treeDSBlocks=Tt;exports.useActiveModal=Ja;exports.useActivePanel=ni;exports.useAddBlock=wa;exports.useAddBlockParent=ri;exports.useAddClassesToBlocks=Ca;exports.useAllBlocks=Qa;exports.useAtom=Mn;exports.useAtomValue=Nt;exports.useBlocksContainer=ur;exports.useBlocksStore=de;exports.useBlocksStoreUndoableActions=re;exports.useBrandingOptions=Je;exports.useBuilderProp=me;exports.useBuilderReset=li;exports.useCanvasWidth=Ea;exports.useCanvasZoom=_a;exports.useCopyBlockIds=Ba;exports.useCopyToClipboard=ui;exports.useCurrentPage=Lt;exports.useCutBlockIds=Vo;exports.useDarkMode=Ta;exports.useDuplicateBlocks=Uo;exports.useGetPageData=Ut;exports.useHiddenBlockIds=Ia;exports.useHighlightBlockId=qo;exports.usePageDataProviders=qt;exports.usePasteBlocks=Oa;exports.usePreviewMode=za;exports.useReadOnlyMode=ti;exports.useRemoveBlocks=hr;exports.useRemoveClassesFromBlocks=Fa;exports.useSavePage=gr;exports.useSelectedBlock=nr;exports.useSelectedBlockAllClasses=Ua;exports.useSelectedBlockCurrentClasses=Ga;exports.useSelectedBlockIds=be;exports.useSelectedBlocksDisplayChild=or;exports.useSelectedBreakpoints=ii;exports.useSelectedStylingBlocks=Mo;exports.useSetAtom=St;exports.useStore=Fe;exports.useStylingBreakpoint=Do;exports.useStylingState=Wa;exports.useToast=rt;exports.useUILibraryBlocks=di;exports.useUndoManager=et;exports.useUpdateBlocksProps=Ha;exports.useUpdateBlocksPropsRealtime=Ya;
@@ -1 +0,0 @@
1
- "use strict";var H2=(a,t,h)=>{if(!t.has(a))throw TypeError("Cannot "+h)};var c=(a,t,h)=>(H2(a,t,"read from private field"),h?h.call(a):t.get(a)),o=(a,t,h)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,h)},e=(a,t,h,n)=>(H2(a,t,"write to private field"),n?n.call(a,h):t.set(a,h),h);var r2=(a,t,h,n)=>({set _(v){e(a,t,v,h)},get _(){return c(a,t,n)}}),M=(a,t,h)=>(H2(a,t,"access private method"),h);const l=require("./jsx-runtime-Z_BpKhVy.cjs"),T=require("react"),s0=require("./index-0bwkNnA0.cjs"),i2=require("@radix-ui/react-icons"),q=require("./index-9PHdn80L.cjs"),a1=require("sonner"),h1=require("lodash-es"),p0=require("./html-to-json-FGufPv9R.cjs"),S2=require("lucide-react"),t0=require("./index-ecnGWzh9.cjs");function V0(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const h in a)if(h!=="default"){const n=Object.getOwnPropertyDescriptor(a,h);Object.defineProperty(t,h,n.get?n:{enumerable:!0,get:()=>a[h]})}}return t.default=a,Object.freeze(t)}const A=V0(T);var W1=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N1=typeof window>"u"||"Deno"in window;function _(){}function f0(a,t){return typeof a=="function"?a(t):a}function s2(a){return typeof a=="number"&&a>=0&&a!==1/0}function a0(a,t){return Math.max(a+(t||0)-Date.now(),0)}function R2(a,t){const{type:h="all",exact:n,fetchStatus:v,predicate:r,queryKey:i,stale:z}=a;if(i){if(n){if(t.queryHash!==A2(i,t.options))return!1}else if(!Q1(t.queryKey,i))return!1}if(h!=="all"){const s=t.isActive();if(h==="active"&&!s||h==="inactive"&&s)return!1}return!(typeof z=="boolean"&&t.isStale()!==z||typeof v<"u"&&v!==t.state.fetchStatus||r&&!r(t))}function F2(a,t){const{exact:h,status:n,predicate:v,mutationKey:r}=a;if(r){if(!t.options.mutationKey)return!1;if(h){if(U1(t.options.mutationKey)!==U1(r))return!1}else if(!Q1(t.options.mutationKey,r))return!1}return!(n&&t.state.status!==n||v&&!v(t))}function A2(a,t){return((t==null?void 0:t.queryKeyHashFn)||U1)(a)}function U1(a){return JSON.stringify(a,(t,h)=>p2(h)?Object.keys(h).sort().reduce((n,v)=>(n[v]=h[v],n),{}):h)}function Q1(a,t){return a===t?!0:typeof a!=typeof t?!1:a&&t&&typeof a=="object"&&typeof t=="object"?!Object.keys(t).some(h=>!Q1(a[h],t[h])):!1}function h0(a,t){if(a===t)return a;const h=D2(a)&&D2(t);if(h||p2(a)&&p2(t)){const n=h?a.length:Object.keys(a).length,v=h?t:Object.keys(t),r=v.length,i=h?[]:{};let z=0;for(let s=0;s<r;s++){const p=h?s:v[s];i[p]=h0(a[p],t[p]),i[p]===a[p]&&z++}return n===r&&z===n?a:i}return t}function o2(a,t){if(a&&!t||t&&!a)return!1;for(const h in a)if(a[h]!==t[h])return!1;return!0}function D2(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function p2(a){if(!k2(a))return!1;const t=a.constructor;if(typeof t>"u")return!0;const h=t.prototype;return!(!k2(h)||!h.hasOwnProperty("isPrototypeOf"))}function k2(a){return Object.prototype.toString.call(a)==="[object Object]"}function n0(a){return new Promise(t=>{setTimeout(t,a)})}function E2(a){n0(0).then(a)}function V2(a,t,h){return typeof h.structuralSharing=="function"?h.structuralSharing(a,t):h.structuralSharing!==!1?h0(a,t):t}function m0(a,t,h=0){const n=[...a,t];return h&&n.length>h?n.slice(1):n}function L0(a,t,h=0){const n=[t,...a];return h&&n.length>h?n.slice(0,-1):n}var u1,e1,B1,U2,x0=(U2=class extends W1{constructor(){super();o(this,u1,void 0);o(this,e1,void 0);o(this,B1,void 0);e(this,B1,t=>{if(!N1&&window.addEventListener){const h=()=>t();return window.addEventListener("visibilitychange",h,!1),()=>{window.removeEventListener("visibilitychange",h)}}})}onSubscribe(){c(this,e1)||this.setEventListener(c(this,B1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,e1))==null||t.call(this),e(this,e1,void 0))}setEventListener(t){var h;e(this,B1,t),(h=c(this,e1))==null||h.call(this),e(this,e1,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){c(this,u1)!==t&&(e(this,u1,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof c(this,u1)=="boolean"?c(this,u1):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},u1=new WeakMap,e1=new WeakMap,B1=new WeakMap,U2),d2=new x0,I1,l1,G1,Q2,w0=(Q2=class extends W1{constructor(){super();o(this,I1,!0);o(this,l1,void 0);o(this,G1,void 0);e(this,G1,t=>{if(!N1&&window.addEventListener){const h=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",h,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",h),window.removeEventListener("offline",n)}}})}onSubscribe(){c(this,l1)||this.setEventListener(c(this,G1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,l1))==null||t.call(this),e(this,l1,void 0))}setEventListener(t){var h;e(this,G1,t),(h=c(this,l1))==null||h.call(this),e(this,l1,t(this.setOnline.bind(this)))}setOnline(t){c(this,I1)!==t&&(e(this,I1,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return c(this,I1)}},I1=new WeakMap,l1=new WeakMap,G1=new WeakMap,Q2),z2=new w0;function B0(a){return Math.min(1e3*2**a,3e4)}function M2(a){return(a??"online")==="online"?z2.isOnline():!0}var c0=class{constructor(a){this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function u2(a){return a instanceof c0}function v0(a){let t=!1,h=0,n=!1,v,r,i;const z=new Promise((g,u)=>{r=g,i=u}),s=g=>{var u;n||(H(new c0(g)),(u=a.abort)==null||u.call(a))},p=()=>{t=!0},d=()=>{t=!1},x=()=>!d2.isFocused()||a.networkMode!=="always"&&!z2.isOnline(),b=g=>{var u;n||(n=!0,(u=a.onSuccess)==null||u.call(a,g),v==null||v(),r(g))},H=g=>{var u;n||(n=!0,(u=a.onError)==null||u.call(a,g),v==null||v(),i(g))},V=()=>new Promise(g=>{var u;v=G=>{const f=n||!x();return f&&g(G),f},(u=a.onPause)==null||u.call(a)}).then(()=>{var g;v=void 0,n||(g=a.onContinue)==null||g.call(a)}),B=()=>{if(n)return;let g;try{g=a.fn()}catch(u){g=Promise.reject(u)}Promise.resolve(g).then(b).catch(u=>{var F;if(n)return;const G=a.retry??(N1?0:3),f=a.retryDelay??B0,m=typeof f=="function"?f(h,u):f,y=G===!0||typeof G=="number"&&h<G||typeof G=="function"&&G(h,u);if(t||!y){H(u);return}h++,(F=a.onFail)==null||F.call(a,h,u),n0(m).then(()=>{if(x())return V()}).then(()=>{t?H(u):B()})})};return M2(a.networkMode)?B():V().then(B),{promise:z,cancel:s,continue:()=>(v==null?void 0:v())?z:Promise.resolve(),cancelRetry:p,continueRetry:d}}function I0(){let a=[],t=0,h=d=>{d()},n=d=>{d()};const v=d=>{let x;t++;try{x=d()}finally{t--,t||z()}return x},r=d=>{t?a.push(d):E2(()=>{h(d)})},i=d=>(...x)=>{r(()=>{d(...x)})},z=()=>{const d=a;a=[],d.length&&E2(()=>{n(()=>{d.forEach(x=>{h(x)})})})};return{batch:v,batchCalls:i,schedule:r,setNotifyFunction:d=>{h=d},setBatchNotifyFunction:d=>{n=d}}}var O=I0(),s1,K2,r0=(K2=class{constructor(){o(this,s1,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),s2(this.gcTime)&&e(this,s1,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(N1?1/0:5*60*1e3))}clearGcTimeout(){c(this,s1)&&(clearTimeout(c(this,s1)),e(this,s1,void 0))}},s1=new WeakMap,K2),C1,O1,j,i1,U,S,K1,p1,S1,e2,$,c1,q2,G0=(q2=class extends r0{constructor(t){super();o(this,S1);o(this,$);o(this,C1,void 0);o(this,O1,void 0);o(this,j,void 0);o(this,i1,void 0);o(this,U,void 0);o(this,S,void 0);o(this,K1,void 0);o(this,p1,void 0);e(this,p1,!1),e(this,K1,t.defaultOptions),M(this,S1,e2).call(this,t.options),e(this,S,[]),e(this,j,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,e(this,C1,t.state||C0(this.options)),this.state=c(this,C1),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!c(this,S).length&&this.state.fetchStatus==="idle"&&c(this,j).remove(this)}setData(t,h){const n=V2(this.state.data,t,this.options);return M(this,$,c1).call(this,{data:n,type:"success",dataUpdatedAt:h==null?void 0:h.updatedAt,manual:h==null?void 0:h.manual}),n}setState(t,h){M(this,$,c1).call(this,{type:"setState",state:t,setStateOptions:h})}cancel(t){var n;const h=c(this,i1);return(n=c(this,U))==null||n.cancel(t),h?h.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(c(this,C1))}isActive(){return c(this,S).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||c(this,S).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!a0(this.state.dataUpdatedAt,t)}onFocus(){var h;const t=c(this,S).find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,U))==null||h.continue()}onOnline(){var h;const t=c(this,S).find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,U))==null||h.continue()}addObserver(t){c(this,S).includes(t)||(c(this,S).push(t),this.clearGcTimeout(),c(this,j).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){c(this,S).includes(t)&&(e(this,S,c(this,S).filter(h=>h!==t)),c(this,S).length||(c(this,U)&&(c(this,p1)?c(this,U).cancel({revert:!0}):c(this,U).cancelRetry()),this.scheduleGc()),c(this,j).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return c(this,S).length}invalidate(){this.state.isInvalidated||M(this,$,c1).call(this,{type:"invalidate"})}fetch(t,h){var p,d,x,b;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(h!=null&&h.cancelRefetch))this.cancel({silent:!0});else if(c(this,i1))return(p=c(this,U))==null||p.continueRetry(),c(this,i1)}if(t&&M(this,S1,e2).call(this,t),!this.options.queryFn){const H=c(this,S).find(V=>V.options.queryFn);H&&M(this,S1,e2).call(this,H.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,v={queryKey:this.queryKey,meta:this.meta},r=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(e(this,p1,!0),n.signal)})};r(v);const i=()=>this.options.queryFn?(e(this,p1,!1),this.options.persister?this.options.persister(this.options.queryFn,v,this):this.options.queryFn(v)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),z={fetchOptions:h,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};r(z),(d=this.options.behavior)==null||d.onFetch(z,this),e(this,O1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=z.fetchOptions)==null?void 0:x.meta))&&M(this,$,c1).call(this,{type:"fetch",meta:(b=z.fetchOptions)==null?void 0:b.meta});const s=H=>{var V,B,g,u;u2(H)&&H.silent||M(this,$,c1).call(this,{type:"error",error:H}),u2(H)||((B=(V=c(this,j).config).onError)==null||B.call(V,H,this),(u=(g=c(this,j).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return e(this,U,v0({fn:z.fetchFn,abort:n.abort.bind(n),onSuccess:H=>{var V,B,g,u;if(typeof H>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}this.setData(H),(B=(V=c(this,j).config).onSuccess)==null||B.call(V,H,this),(u=(g=c(this,j).config).onSettled)==null||u.call(g,H,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(H,V)=>{M(this,$,c1).call(this,{type:"failed",failureCount:H,error:V})},onPause:()=>{M(this,$,c1).call(this,{type:"pause"})},onContinue:()=>{M(this,$,c1).call(this,{type:"continue"})},retry:z.options.retry,retryDelay:z.options.retryDelay,networkMode:z.options.networkMode})),e(this,i1,c(this,U).promise),c(this,i1)}},C1=new WeakMap,O1=new WeakMap,j=new WeakMap,i1=new WeakMap,U=new WeakMap,S=new WeakMap,K1=new WeakMap,p1=new WeakMap,S1=new WeakSet,e2=function(t){this.options={...c(this,K1),...t},this.updateGcTime(this.options.gcTime)},$=new WeakSet,c1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:M2(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const v=t.error;return u2(v)&&v.revert&&c(this,O1)?{...c(this,O1),fetchStatus:"idle"}:{...n,error:v,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:v,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=h(this.state),O.batch(()=>{c(this,S).forEach(n=>{n.onQueryUpdate()}),c(this,j).notify({query:this,type:"updated",action:t})})},q2);function C0(a){const t=typeof a.initialData=="function"?a.initialData():a.initialData,h=typeof t<"u",n=h?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:h?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:h?"success":"pending",fetchStatus:"idle"}}var Z,_2,O0=(_2=class extends W1{constructor(t={}){super();o(this,Z,void 0);this.config=t,e(this,Z,new Map)}build(t,h,n){const v=h.queryKey,r=h.queryHash??A2(v,h);let i=this.get(r);return i||(i=new G0({cache:this,queryKey:v,queryHash:r,options:t.defaultQueryOptions(h),state:n,defaultOptions:t.getQueryDefaults(v)}),this.add(i)),i}add(t){c(this,Z).has(t.queryHash)||(c(this,Z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const h=c(this,Z).get(t.queryHash);h&&(t.destroy(),h===t&&c(this,Z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return c(this,Z).get(t)}getAll(){return[...c(this,Z).values()]}find(t){const h={exact:!0,...t};return this.getAll().find(n=>R2(h,n))}findAll(t={}){const h=this.getAll();return Object.keys(t).length>0?h.filter(n=>R2(t,n)):h}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Z=new WeakMap,_2),Y,q1,E,A1,X,r1,$2,S0=($2=class extends r0{constructor(t){super();o(this,X);o(this,Y,void 0);o(this,q1,void 0);o(this,E,void 0);o(this,A1,void 0);this.mutationId=t.mutationId,e(this,q1,t.defaultOptions),e(this,E,t.mutationCache),e(this,Y,[]),this.state=t.state||e0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...c(this,q1),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){c(this,Y).includes(t)||(c(this,Y).push(t),this.clearGcTimeout(),c(this,E).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){e(this,Y,c(this,Y).filter(h=>h!==t)),this.scheduleGc(),c(this,E).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){c(this,Y).length||(this.state.status==="pending"?this.scheduleGc():c(this,E).remove(this))}continue(){var t;return((t=c(this,A1))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var v,r,i,z,s,p,d,x,b,H,V,B,g,u,G,f,m,y,F,I;const h=()=>(e(this,A1,v0({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,n1)=>{M(this,X,r1).call(this,{type:"failed",failureCount:w,error:n1})},onPause:()=>{M(this,X,r1).call(this,{type:"pause"})},onContinue:()=>{M(this,X,r1).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),c(this,A1).promise),n=this.state.status==="pending";try{if(!n){M(this,X,r1).call(this,{type:"pending",variables:t}),await((r=(v=c(this,E).config).onMutate)==null?void 0:r.call(v,t,this));const n1=await((z=(i=this.options).onMutate)==null?void 0:z.call(i,t));n1!==this.state.context&&M(this,X,r1).call(this,{type:"pending",context:n1,variables:t})}const w=await h();return await((p=(s=c(this,E).config).onSuccess)==null?void 0:p.call(s,w,t,this.state.context,this)),await((x=(d=this.options).onSuccess)==null?void 0:x.call(d,w,t,this.state.context)),await((H=(b=c(this,E).config).onSettled)==null?void 0:H.call(b,w,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,w,null,t,this.state.context)),M(this,X,r1).call(this,{type:"success",data:w}),w}catch(w){try{throw await((u=(g=c(this,E).config).onError)==null?void 0:u.call(g,w,t,this.state.context,this)),await((f=(G=this.options).onError)==null?void 0:f.call(G,w,t,this.state.context)),await((y=(m=c(this,E).config).onSettled)==null?void 0:y.call(m,void 0,w,this.state.variables,this.state.context,this)),await((I=(F=this.options).onSettled)==null?void 0:I.call(F,void 0,w,t,this.state.context)),w}finally{M(this,X,r1).call(this,{type:"error",error:w})}}}},Y=new WeakMap,q1=new WeakMap,E=new WeakMap,A1=new WeakMap,X=new WeakSet,r1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!M2(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=h(this.state),O.batch(()=>{c(this,Y).forEach(n=>{n.onMutationUpdate(t)}),c(this,E).notify({mutation:this,type:"updated",action:t})})},$2);function e0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Q,_1,V1,J2,A0=(J2=class extends W1{constructor(t={}){super();o(this,Q,void 0);o(this,_1,void 0);o(this,V1,void 0);this.config=t,e(this,Q,[]),e(this,_1,0)}build(t,h,n){const v=new S0({mutationCache:this,mutationId:++r2(this,_1)._,options:t.defaultMutationOptions(h),state:n});return this.add(v),v}add(t){c(this,Q).push(t),this.notify({type:"added",mutation:t})}remove(t){e(this,Q,c(this,Q).filter(h=>h!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{c(this,Q).forEach(t=>{this.remove(t)})})}getAll(){return c(this,Q)}find(t){const h={exact:!0,...t};return c(this,Q).find(n=>F2(h,n))}findAll(t={}){return c(this,Q).filter(h=>F2(t,h))}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}resumePausedMutations(){return e(this,V1,(c(this,V1)??Promise.resolve()).then(()=>{const t=c(this,Q).filter(h=>h.state.isPaused);return O.batch(()=>t.reduce((h,n)=>h.then(()=>n.continue().catch(_)),Promise.resolve()))}).then(()=>{e(this,V1,void 0)})),c(this,V1)}},Q=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function y0(a){return{onFetch:(t,h)=>{const n=async()=>{var V,B,g,u,G;const v=t.options,r=(g=(B=(V=t.fetchOptions)==null?void 0:V.meta)==null?void 0:B.fetchMore)==null?void 0:g.direction,i=((u=t.state.data)==null?void 0:u.pages)||[],z=((G=t.state.data)==null?void 0:G.pageParams)||[],s={pages:[],pageParams:[]};let p=!1;const d=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},x=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),b=async(f,m,y)=>{if(p)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const F={queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};d(F);const I=await x(F),{maxPages:w}=t.options,n1=y?L0:m0;return{pages:n1(f.pages,I,w),pageParams:n1(f.pageParams,m,w)}};let H;if(r&&i.length){const f=r==="backward",m=f?b0:T2,y={pages:i,pageParams:z},F=m(v,y);H=await b(y,F,f)}else{H=await b(s,z[0]??v.initialPageParam);const f=a??i.length;for(let m=1;m<f;m++){const y=T2(v,H);H=await b(H,y)}}return H};t.options.persister?t.fetchFn=()=>{var v,r;return(r=(v=t.options).persister)==null?void 0:r.call(v,n,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},h)}:t.fetchFn=n}}}function T2(a,{pages:t,pageParams:h}){const n=t.length-1;return a.getNextPageParam(t[n],t,h[n],h)}function b0(a,{pages:t,pageParams:h}){var n;return(n=a.getPreviousPageParam)==null?void 0:n.call(a,t[0],t,h[0],h)}var C,o1,d1,y1,b1,z1,P1,R1,Z2,P0=(Z2=class{constructor(a={}){o(this,C,void 0);o(this,o1,void 0);o(this,d1,void 0);o(this,y1,void 0);o(this,b1,void 0);o(this,z1,void 0);o(this,P1,void 0);o(this,R1,void 0);e(this,C,a.queryCache||new O0),e(this,o1,a.mutationCache||new A0),e(this,d1,a.defaultOptions||{}),e(this,y1,new Map),e(this,b1,new Map),e(this,z1,0)}mount(){r2(this,z1)._++,c(this,z1)===1&&(e(this,P1,d2.subscribe(()=>{d2.isFocused()&&(this.resumePausedMutations(),c(this,C).onFocus())})),e(this,R1,z2.subscribe(()=>{z2.isOnline()&&(this.resumePausedMutations(),c(this,C).onOnline())})))}unmount(){var a,t;r2(this,z1)._--,c(this,z1)===0&&((a=c(this,P1))==null||a.call(this),e(this,P1,void 0),(t=c(this,R1))==null||t.call(this),e(this,R1,void 0))}isFetching(a){return c(this,C).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return c(this,o1).findAll({...a,status:"pending"}).length}getQueryData(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state.data}ensureQueryData(a){const t=this.getQueryData(a.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(a)}getQueriesData(a){return this.getQueryCache().findAll(a).map(({queryKey:t,state:h})=>{const n=h.data;return[t,n]})}setQueryData(a,t,h){const n=c(this,C).find({queryKey:a}),v=n==null?void 0:n.state.data,r=f0(t,v);if(typeof r>"u")return;const i=this.defaultQueryOptions({queryKey:a});return c(this,C).build(this,i).setData(r,{...h,manual:!0})}setQueriesData(a,t,h){return O.batch(()=>this.getQueryCache().findAll(a).map(({queryKey:n})=>[n,this.setQueryData(n,t,h)]))}getQueryState(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state}removeQueries(a){const t=c(this,C);O.batch(()=>{t.findAll(a).forEach(h=>{t.remove(h)})})}resetQueries(a,t){const h=c(this,C),n={type:"active",...a};return O.batch(()=>(h.findAll(a).forEach(v=>{v.reset()}),this.refetchQueries(n,t)))}cancelQueries(a={},t={}){const h={revert:!0,...t},n=O.batch(()=>c(this,C).findAll(a).map(v=>v.cancel(h)));return Promise.all(n).then(_).catch(_)}invalidateQueries(a={},t={}){return O.batch(()=>{if(c(this,C).findAll(a).forEach(n=>{n.invalidate()}),a.refetchType==="none")return Promise.resolve();const h={...a,type:a.refetchType??a.type??"active"};return this.refetchQueries(h,t)})}refetchQueries(a={},t){const h={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},n=O.batch(()=>c(this,C).findAll(a).filter(v=>!v.isDisabled()).map(v=>{let r=v.fetch(void 0,h);return h.throwOnError||(r=r.catch(_)),v.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(n).then(_)}fetchQuery(a){const t=this.defaultQueryOptions(a);typeof t.retry>"u"&&(t.retry=!1);const h=c(this,C).build(this,t);return h.isStaleByTime(t.staleTime)?h.fetch(t):Promise.resolve(h.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(_).catch(_)}fetchInfiniteQuery(a){return a.behavior=y0(a.pages),this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(_).catch(_)}resumePausedMutations(){return c(this,o1).resumePausedMutations()}getQueryCache(){return c(this,C)}getMutationCache(){return c(this,o1)}getDefaultOptions(){return c(this,d1)}setDefaultOptions(a){e(this,d1,a)}setQueryDefaults(a,t){c(this,y1).set(U1(a),{queryKey:a,defaultOptions:t})}getQueryDefaults(a){const t=[...c(this,y1).values()];let h={};return t.forEach(n=>{Q1(a,n.queryKey)&&(h={...h,...n.defaultOptions})}),h}setMutationDefaults(a,t){c(this,b1).set(U1(a),{mutationKey:a,defaultOptions:t})}getMutationDefaults(a){const t=[...c(this,b1).values()];let h={};return t.forEach(n=>{Q1(a,n.mutationKey)&&(h={...h,...n.defaultOptions})}),h}defaultQueryOptions(a){if(a!=null&&a._defaulted)return a;const t={...c(this,d1).queries,...(a==null?void 0:a.queryKey)&&this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return t.queryHash||(t.queryHash=A2(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...c(this,d1).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){c(this,C).clear(),c(this,o1).clear()}},C=new WeakMap,o1=new WeakMap,d1=new WeakMap,y1=new WeakMap,b1=new WeakMap,z1=new WeakMap,P1=new WeakMap,R1=new WeakMap,Z2),k,L,F1,P,f1,D1,t1,$1,k1,E1,m1,L1,g1,x1,w1,j1,J1,f2,Z1,m2,Y1,L2,X1,x2,t2,w2,a2,B2,h2,I2,g2,l0,Y2,R0=(Y2=class extends W1{constructor(t,h){super();o(this,w1);o(this,J1);o(this,Z1);o(this,Y1);o(this,X1);o(this,t2);o(this,a2);o(this,h2);o(this,g2);o(this,k,void 0);o(this,L,void 0);o(this,F1,void 0);o(this,P,void 0);o(this,f1,void 0);o(this,D1,void 0);o(this,t1,void 0);o(this,$1,void 0);o(this,k1,void 0);o(this,E1,void 0);o(this,m1,void 0);o(this,L1,void 0);o(this,g1,void 0);o(this,x1,void 0);e(this,L,void 0),e(this,F1,void 0),e(this,P,void 0),e(this,x1,new Set),e(this,k,t),this.options=h,e(this,t1,null),this.bindMethods(),this.setOptions(h)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,L).addObserver(this),N2(c(this,L),this.options)?M(this,w1,j1).call(this):this.updateResult(),M(this,X1,x2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G2(c(this,L),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G2(c(this,L),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,M(this,t2,w2).call(this),M(this,a2,B2).call(this),c(this,L).removeObserver(this)}setOptions(t,h){const n=this.options,v=c(this,L);if(this.options=c(this,k).defaultQueryOptions(t),o2(n,this.options)||c(this,k).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,L),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),M(this,h2,I2).call(this);const r=this.hasListeners();r&&W2(c(this,L),v,this.options,n)&&M(this,w1,j1).call(this),this.updateResult(h),r&&(c(this,L)!==v||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&M(this,J1,f2).call(this);const i=M(this,Z1,m2).call(this);r&&(c(this,L)!==v||this.options.enabled!==n.enabled||i!==c(this,g1))&&M(this,Y1,L2).call(this,i)}getOptimisticResult(t){const h=c(this,k).getQueryCache().build(c(this,k),t),n=this.createResult(h,t);return D0(this,n)&&(e(this,P,n),e(this,D1,this.options),e(this,f1,c(this,L).state)),n}getCurrentResult(){return c(this,P)}trackResult(t){const h={};return Object.keys(t).forEach(n=>{Object.defineProperty(h,n,{configurable:!1,enumerable:!0,get:()=>(c(this,x1).add(n),t[n])})}),h}getCurrentQuery(){return c(this,L)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const h=c(this,k).defaultQueryOptions(t),n=c(this,k).getQueryCache().build(c(this,k),h);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,h))}fetch(t){return M(this,w1,j1).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,P)))}createResult(t,h){var F;const n=c(this,L),v=this.options,r=c(this,P),i=c(this,f1),z=c(this,D1),p=t!==n?t.state:c(this,F1),{state:d}=t;let{error:x,errorUpdatedAt:b,fetchStatus:H,status:V}=d,B=!1,g;if(h._optimisticResults){const I=this.hasListeners(),w=!I&&N2(t,h),n1=I&&W2(t,n,h,v);(w||n1)&&(H=M2(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(V="pending")),h._optimisticResults==="isRestoring"&&(H="idle")}if(h.select&&typeof d.data<"u")if(r&&d.data===(i==null?void 0:i.data)&&h.select===c(this,$1))g=c(this,k1);else try{e(this,$1,h.select),g=h.select(d.data),g=V2(r==null?void 0:r.data,g,h),e(this,k1,g),e(this,t1,null)}catch(I){e(this,t1,I)}else g=d.data;if(typeof h.placeholderData<"u"&&typeof g>"u"&&V==="pending"){let I;if(r!=null&&r.isPlaceholderData&&h.placeholderData===(z==null?void 0:z.placeholderData))I=r.data;else if(I=typeof h.placeholderData=="function"?h.placeholderData((F=c(this,E1))==null?void 0:F.state.data,c(this,E1)):h.placeholderData,h.select&&typeof I<"u")try{I=h.select(I),e(this,t1,null)}catch(w){e(this,t1,w)}typeof I<"u"&&(V="success",g=V2(r==null?void 0:r.data,I,h),B=!0)}c(this,t1)&&(x=c(this,t1),g=c(this,k1),b=Date.now(),V="error");const u=H==="fetching",G=V==="pending",f=V==="error",m=G&&u;return{status:V,fetchStatus:H,isPending:G,isSuccess:V==="success",isError:f,isInitialLoading:m,isLoading:m,data:g,dataUpdatedAt:d.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:u,isRefetching:u&&!G,isLoadingError:f&&d.dataUpdatedAt===0,isPaused:H==="paused",isPlaceholderData:B,isRefetchError:f&&d.dataUpdatedAt!==0,isStale:y2(t,h),refetch:this.refetch}}updateResult(t){const h=c(this,P),n=this.createResult(c(this,L),this.options);if(e(this,f1,c(this,L).state),e(this,D1,this.options),c(this,f1).data!==void 0&&e(this,E1,c(this,L)),o2(n,h))return;e(this,P,n);const v={},r=()=>{if(!h)return!0;const{notifyOnChangeProps:i}=this.options,z=typeof i=="function"?i():i;if(z==="all"||!z&&!c(this,x1).size)return!0;const s=new Set(z??c(this,x1));return this.options.throwOnError&&s.add("error"),Object.keys(c(this,P)).some(p=>{const d=p;return c(this,P)[d]!==h[d]&&s.has(d)})};(t==null?void 0:t.listeners)!==!1&&r()&&(v.listeners=!0),M(this,g2,l0).call(this,{...v,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,x2).call(this)}},k=new WeakMap,L=new WeakMap,F1=new WeakMap,P=new WeakMap,f1=new WeakMap,D1=new WeakMap,t1=new WeakMap,$1=new WeakMap,k1=new WeakMap,E1=new WeakMap,m1=new WeakMap,L1=new WeakMap,g1=new WeakMap,x1=new WeakMap,w1=new WeakSet,j1=function(t){M(this,h2,I2).call(this);let h=c(this,L).fetch(this.options,t);return t!=null&&t.throwOnError||(h=h.catch(_)),h},J1=new WeakSet,f2=function(){if(M(this,t2,w2).call(this),N1||c(this,P).isStale||!s2(this.options.staleTime))return;const h=a0(c(this,P).dataUpdatedAt,this.options.staleTime)+1;e(this,m1,setTimeout(()=>{c(this,P).isStale||this.updateResult()},h))},Z1=new WeakSet,m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,L)):this.options.refetchInterval)??!1},Y1=new WeakSet,L2=function(t){M(this,a2,B2).call(this),e(this,g1,t),!(N1||this.options.enabled===!1||!s2(c(this,g1))||c(this,g1)===0)&&e(this,L1,setInterval(()=>{(this.options.refetchIntervalInBackground||d2.isFocused())&&M(this,w1,j1).call(this)},c(this,g1)))},X1=new WeakSet,x2=function(){M(this,J1,f2).call(this),M(this,Y1,L2).call(this,M(this,Z1,m2).call(this))},t2=new WeakSet,w2=function(){c(this,m1)&&(clearTimeout(c(this,m1)),e(this,m1,void 0))},a2=new WeakSet,B2=function(){c(this,L1)&&(clearInterval(c(this,L1)),e(this,L1,void 0))},h2=new WeakSet,I2=function(){const t=c(this,k).getQueryCache().build(c(this,k),this.options);if(t===c(this,L))return;const h=c(this,L);e(this,L,t),e(this,F1,t.state),this.hasListeners()&&(h==null||h.removeObserver(this),t.addObserver(this))},g2=new WeakSet,l0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(h=>{h(c(this,P))}),c(this,k).getQueryCache().notify({query:c(this,L),type:"observerResultsUpdated"})})},Y2);function F0(a,t){return t.enabled!==!1&&!a.state.dataUpdatedAt&&!(a.state.status==="error"&&t.retryOnMount===!1)}function N2(a,t){return F0(a,t)||a.state.dataUpdatedAt>0&&G2(a,t,t.refetchOnMount)}function G2(a,t,h){if(t.enabled!==!1){const n=typeof h=="function"?h(a):h;return n==="always"||n!==!1&&y2(a,t)}return!1}function W2(a,t,h,n){return h.enabled!==!1&&(a!==t||n.enabled===!1)&&(!h.suspense||a.state.status!=="error")&&y2(a,h)}function y2(a,t){return a.isStaleByTime(t.staleTime)}function D0(a,t){return!o2(a.getCurrentResult(),t)}var M1,D,K,v1,T1,l2,n2,C2,X2,k0=(X2=class extends W1{constructor(t,h){super();o(this,T1);o(this,n2);o(this,M1,void 0);o(this,D,void 0);o(this,K,void 0);o(this,v1,void 0);e(this,D,void 0),e(this,M1,t),this.setOptions(h),this.bindMethods(),M(this,T1,l2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const h=this.options;this.options=c(this,M1).defaultMutationOptions(t),o2(h,this.options)||c(this,M1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,K),observer:this}),(n=c(this,K))==null||n.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,K))==null||t.removeObserver(this)}onMutationUpdate(t){M(this,T1,l2).call(this),M(this,n2,C2).call(this,t)}getCurrentResult(){return c(this,D)}reset(){e(this,K,void 0),M(this,T1,l2).call(this),M(this,n2,C2).call(this)}mutate(t,h){var n;return e(this,v1,h),(n=c(this,K))==null||n.removeObserver(this),e(this,K,c(this,M1).getMutationCache().build(c(this,M1),this.options)),c(this,K).addObserver(this),c(this,K).execute(t)}},M1=new WeakMap,D=new WeakMap,K=new WeakMap,v1=new WeakMap,T1=new WeakSet,l2=function(){var h;const t=((h=c(this,K))==null?void 0:h.state)??e0();e(this,D,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},n2=new WeakSet,C2=function(t){O.batch(()=>{var h,n,v,r,i,z,s,p;c(this,v1)&&this.hasListeners()&&((t==null?void 0:t.type)==="success"?((n=(h=c(this,v1)).onSuccess)==null||n.call(h,t.data,c(this,D).variables,c(this,D).context),(r=(v=c(this,v1)).onSettled)==null||r.call(v,t.data,null,c(this,D).variables,c(this,D).context)):(t==null?void 0:t.type)==="error"&&((z=(i=c(this,v1)).onError)==null||z.call(i,t.error,c(this,D).variables,c(this,D).context),(p=(s=c(this,v1)).onSettled)==null||p.call(s,void 0,t.error,c(this,D).variables,c(this,D).context))),this.listeners.forEach(d=>{d(c(this,D))})})},X2);var i0=A.createContext(void 0),N=a=>{const t=A.useContext(i0);if(a)return a;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},E0=({client:a,children:t})=>(A.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),A.createElement(i0.Provider,{value:a},t)),o0=A.createContext(!1),T0=()=>A.useContext(o0),G4=o0.Provider;function N0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var W0=A.createContext(N0()),j0=()=>A.useContext(W0);function d0(a,t){return typeof a=="function"?a(...t):!!a}var U0=(a,t)=>{(a.suspense||a.throwOnError)&&(t.isReset()||(a.retryOnMount=!1))},Q0=a=>{A.useEffect(()=>{a.clearReset()},[a])},K0=({result:a,errorResetBoundary:t,throwOnError:h,query:n})=>a.isError&&!t.isReset()&&!a.isFetching&&d0(h,[a.error,n]);var q0=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)};var _0=(a,t)=>(a==null?void 0:a.suspense)&&t.isPending,$0=(a,t,h)=>t.fetchOptimistic(a).catch(()=>{h.clearReset()});function J0(a,t,h){if(process.env.NODE_ENV!=="production"&&(typeof a!="object"||Array.isArray(a)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=N(h),v=T0(),r=j0(),i=n.defaultQueryOptions(a);i._optimisticResults=v?"isRestoring":"optimistic",q0(i),U0(i,r),Q0(r);const[z]=A.useState(()=>new t(n,i)),s=z.getOptimisticResult(i);if(A.useSyncExternalStore(A.useCallback(p=>{const d=v?()=>{}:z.subscribe(O.batchCalls(p));return z.updateResult(),d},[z,v]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),A.useEffect(()=>{z.setOptions(i,{listeners:!1})},[i,z]),_0(i,s))throw $0(i,z,r);if(K0({result:s,errorResetBoundary:r,throwOnError:i.throwOnError,query:z.getCurrentQuery()}))throw s.error;return i.notifyOnChangeProps?s:z.trackResult(s)}function c2(a,t){return J0(a,R0,t)}function J(a,t){const h=N(t),[n]=A.useState(()=>new k0(h,a));A.useEffect(()=>{n.setOptions(a)},[n,a]);const v=A.useSyncExternalStore(A.useCallback(i=>n.subscribe(O.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),r=A.useCallback((i,z)=>{n.mutate(i,z).catch(Z0)},[n]);if(v.error&&d0(n.options.throwOnError,[v.error]))throw v.error;return{...v,mutate:r,mutateAsync:v.mutate}}function Z0(){}function R(){return N().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const H1=()=>{const{data:a,refetch:t}=c2({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[a,h=>{h&&(localStorage.setItem("currentPage",h||""),t())}]};let j2="";const v2=()=>(j2=localStorage.getItem("__chai_at"),j2);function Y0(a){const t={method:"GET",headers:{"x-chai-access-token":v2()}};return fetch(a,t)}function X0(a,t){const h={method:"POST",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function t4(a,t){const h={method:"PUT",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function a4(a,t){const h={method:"DELETE",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}const W={get:Y0,post:X0,put:t4,delete:a4},b2=()=>{const[a,t]=H1(),h=R();return c2({queryKey:["project"],queryFn:async()=>{const{data:n}=await W.get(`${h}/project`).then(v=>v.json());if(!a&&n){const v=localStorage.getItem("currentPage");t(v||(n==null?void 0:n.homepage))}return n}})},P2=()=>{const a=R();return c2({queryKey:["pages"],queryFn:async()=>{const{data:t}=await W.get(`${a}/pages`).then(h=>h.json());return t||[]}})},z0=()=>{const[a]=H1(),t=R();return c2({queryKey:["page_data",a],queryFn:async()=>{const{data:h}=await W.get(`${t}/page?uuid=${a}`).then(n=>n.json());return h},enabled:!!a,staleTime:3e3})},O2=()=>l.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:l.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),l.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),g0=(a="Project updated successfully.")=>{const t=N(),h=R();return J({mutationFn:async n=>await W.put(`${h}/project`,n).then(v=>v.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),a1.toast.success(a)}})},M0=()=>{const[a]=["SAVED"],[t,h]=H1(),n=q.useBuilderReset();return v=>a!=="SAVED"?(a1.toast.error("You have unsaved changes. Please save before changing the page."),!1):t===v.uuid?!1:(n(),setTimeout(()=>{h(v.uuid)},100),!0)},h4=()=>{const a=N(),t=M0(),h=R();return J({mutationFn:async n=>W.post(`${h}/pages`,n).then(v=>v.json()),onSuccess:n=>{a.invalidateQueries({queryKey:["pages"]}),t({uuid:n.uuid,slug:n.slug}),a1.toast.success("Page added successfully.")}})},H0=()=>{const a=R(),[t]=H1(),h=N();return J({mutationFn:async n=>W.put(`${a}/page`,n).then(v=>v.json()),onSuccess:async n=>{var v;if(n.result==="error"&&((v=n.error)==null?void 0:v.code)=="PAGE_LOCKED"){h.invalidateQueries({queryKey:["page_data",t]});return}a1.toast.success("Page saved successfully.")}})},n4=()=>{const a=R(),{data:t}=P2(),[h]=H1(),{data:n}=b2(),v=N();return J({mutationFn:async()=>{const r=t.find(i=>i.uuid===h).slug;return await W.post(`${a}/publish`,{slug:r,uuid:h,isHomepage:(n==null?void 0:n.homepage)===h}).then(i=>i.json())},onSuccess:async r=>{var i;if(r.result==="error"&&((i=r.error)==null?void 0:i.code)=="PAGE_LOCKED"){v.invalidateQueries({queryKey:["page_data",h]});return}a1.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},c4=()=>{const a=N(),t=R();return J({mutationFn:async h=>W.delete(`${t}/page`,h).then(n=>n.json()),onSuccess:()=>{a1.toast.success("Page deleted successfully."),a.invalidateQueries({queryKey:["pages"]})}})},v4=()=>{const a=N(),t=R();return J({mutationFn:async h=>W.post(`${t}/take-control`,{uuid:h}).then(n=>n.json()),onSuccess:(h,n)=>{a.invalidateQueries({queryKey:["page_data",n]})}})},r4=()=>{const a=R();return J({mutationFn:async()=>{const{data:t}=await W.get(`${a}/library`).then(h=>h.json());return h1.sortBy(h1.filter(t,h=>!h1.has(h,"hidden")),"group")}})},e4=()=>{const a=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:h}=await W.get(`${a}/block?uuid=${t.uuid}&format=${t.format}`).then(async n=>t.format==="html"?p0.getBlocksFromHTML(await n.text()):await n.json());return h1.set(h,"0._name",h1.capitalize(t.group)),h||[]}catch{return[]}}})},l4=()=>{const a=R();return J({mutationFn:async t=>{const h=new FormData;h.append("file",t);const{data:n}=await fetch(`${a}/upload`,{method:"POST",headers:{"x-chai-access-token":v2()},body:h}).then(v=>v.json());return n}})};function u0(a){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"}}]})(a)}function i4(a){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}}]})(a)}const o4=()=>{const{mutate:a,isPending:t}=v4(),[h]=H1(),{data:n}=z0(),v=h1.get(n,"lockedBy.name",""),r=h1.get(n,"lockedBy.email","");return l.jsxRuntimeExports.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg drop-shadow-2xl mx-auto p-10 space-y-4 text-center max-w-xl",children:[l.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),l.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",l.jsxRuntimeExports.jsx("br",{}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[l.jsxRuntimeExports.jsx(i4,{className:"w-4 h-4 text-gray-500"})," ",v]}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[l.jsxRuntimeExports.jsx(u0,{className:"w-4 h-4 text-gray-500"})," ",r]})]}),l.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",v," will be ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),l.jsxRuntimeExports.jsx(q.Button,{disabled:t,onClick:()=>a(h),className:`w-36 ${t?"bg-transparent shadow-none hover:bg-transparent":""}`,children:t?l.jsxRuntimeExports.jsx(S2.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},d4=()=>{const a=R(),t=N();return J({mutationFn:async h=>{const n=await fetch(`${a}/login`,{method:"POST",body:JSON.stringify(h)});if(n.ok)return await n.json();throw n.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:h=>{const{data:n}=h;if(!n.accessToken){a1.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",n.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(h1.omit(n,["accessToken"]))),t.invalidateQueries({queryKey:["verify"]}),a1.toast.success("Logged in successfully.")},onError:()=>{a1.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},z4=()=>{const a=R();return c2({queryKey:["verify"],queryFn:async()=>{const t=await W.get(`${a}/verify`);return t.ok?(await t.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},g4=()=>{const a=R(),t=N();return J({mutationFn:async()=>{const{result:h}=await W.post(`${a}/logout`).then(n=>n.json());if(h==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},M4=({children:a})=>{const t=g4();return l.jsxRuntimeExports.jsxs(q.AlertDialog,{children:[l.jsxRuntimeExports.jsx(q.AlertDialogTrigger,{asChild:!0,children:a}),l.jsxRuntimeExports.jsxs(q.AlertDialogContent,{children:[l.jsxRuntimeExports.jsxs(q.AlertDialogHeader,{children:[l.jsxRuntimeExports.jsxs(q.AlertDialogTitle,{children:["Are you sure, you want to ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),l.jsxRuntimeExports.jsx(q.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),l.jsxRuntimeExports.jsxs(q.AlertDialogFooter,{children:[l.jsxRuntimeExports.jsx(q.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),l.jsxRuntimeExports.jsxs("button",{disabled:t.isPending,onClick:()=>t.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[t.isPending&&l.jsxRuntimeExports.jsx(S2.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},H4=()=>l.jsxRuntimeExports.jsx(M4,{children:l.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:l.jsxRuntimeExports.jsx(S2.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),u4=T.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-8536oBWB.cjs"))),s4=T.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-oILsUWOH.cjs"))),p4=T.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-LpLr0lDI.cjs"))),V4=()=>l.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),f4=()=>{const{mutate:a}=n4();return q.useBuilderProp("editable",!0)?l.jsxRuntimeExports.jsx(q.Button,{onClick:a,className:"bg-blue-600 text-white",children:"Publish"}):null},m4=a=>{var f;const{data:t,isLoading:h}=b2(),{data:n,isLoading:v}=P2(),{data:r}=z0(),{mutate:i}=g0(),{mutate:z}=H0(),[s]=H1(),p=l4(),d=r4(),x=e4(),b=R(),H=T.useCallback(async m=>await p.mutateAsync(m),[p]),V=T.useCallback(async()=>await d.mutateAsync(),[d]),B=T.useCallback(async m=>await x.mutateAsync(m),[x]),g=async(m=20,y=0)=>{const F=`limit=${m}&offset=${y}`,I=await fetch(`${b}/assets?${F}`).then(w=>w.json());return I.result==="success"?I.data:[]},{logo:u=V4}=a;if(h||!t)return l.jsxRuntimeExports.jsx(O2,{});if(v||!n)return l.jsxRuntimeExports.jsx(O2,{});const G={...a,editable:r!=null&&r.lockedBy?r==null?void 0:r.lockedBy.self:!0,nonEditableComponent:o4,blocks:(r==null?void 0:r.blocks)||[],brandingOptions:t.brandingOptions,darkMode:a.darkMode||!1,dataProviders:(r==null?void 0:r.providers)||[],onSavePage:async({blocks:m,providers:y})=>(await z({blocks:m,providers:y,uuid:s}),!0),onSaveBrandingOptions:async m=>(await i({brandingOptions:m}),!0),topBarComponents:{left:[u],center:[p4],right:[f4]},sideBarComponents:{top:[{icon:i2.FileTextIcon,name:"pages",panel:u4},{icon:i2.GearIcon,name:"settings",panel:s4},...((f=a.sideBarComponents)==null?void 0:f.top)||[]],bottom:[H4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>n};return l.jsxRuntimeExports.jsx(s0.ChaiBuilderEditor,{...G})},L4=({logo:a})=>{const[t,h]=T.useState(!1),[n,v]=T.useState(""),[r,i]=T.useState(""),{mutate:z,isPending:s}=d4(),p=d=>{d.preventDefault(),z({email:n,password:r})};return l.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen flex items-center justify-center bg-[radial-gradient(#AAA,transparent_0.5px)] duration-300 [background-size:6px_6px]",children:l.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:l.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[l.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[l.jsxRuntimeExports.jsx(T.Suspense,{children:a?T.createElement(a):""}),l.jsxRuntimeExports.jsx("p",{className:"max-w-xl mx-auto text-base leading-relaxed text-gray-700 font-thin",children:"Enter your login credential to continue"})]}),l.jsxRuntimeExports.jsx("div",{className:"mt-8",children:l.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:p,className:"space-y-5",children:[l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx(u0,{})}),l.jsxRuntimeExports.jsx("input",{value:n,onChange:d=>v(d.target.value),type:"email",id:"email",placeholder:"Enter email",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"})})}),l.jsxRuntimeExports.jsx("input",{value:r,onChange:d=>i(d.target.value),type:t?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),l.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>h(!t),children:t?l.jsxRuntimeExports.jsx(i2.EyeClosedIcon,{}):l.jsxRuntimeExports.jsx(i2.EyeOpenIcon,{})})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsx("button",{disabled:s||h1.size(n)<2||h1.size(r)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:s?"Signing in...":"Login"})})]})}),l.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:l.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},x4=a=>{const{data:t,isLoading:h}=z4(),n=N();return T.useEffect(()=>{n.setQueryData(["apiBaseUrl"],a.apiBaseUrl||"/api/chaibuilder")},[a.apiBaseUrl,n]),h?l.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?l.jsxRuntimeExports.jsx(m4,{...a}):l.jsxRuntimeExports.jsx(L4,{logo:a.logo})},w4=new P0,B4=a=>l.jsxRuntimeExports.jsxs(E0,{client:w4,children:[l.jsxRuntimeExports.jsx(a1.Toaster,{richColors:!0}),l.jsxRuntimeExports.jsx(x4,{...a})]});exports.ChaiBuilderStudio=B4;exports.useAddPage=h4;exports.useChangePage=M0;exports.useCurrentPage=H1;exports.useDeletePage=c4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=N;exports.useUpdatePage=H0;exports.useUpdateProject=g0;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-9PHdn80L.cjs"),x=require("./index-nwAgi0aD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-dom");require("react-quill");require("react-i18next");require("./index-0bwkNnA0.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-FGufPv9R.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-btEKYXjE.cjs"))),j=({pageData:s})=>{const[r,i]=u.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:t=>{i(r==="PENDING"?"ALERT":t?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:t=>{t.stopPropagation(),i("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(n.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(n.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(m,{pageData:s,open:r,setOpen:i})})})]})},q=s=>{const[r]=x.useCurrentPage(),{data:i}=x.useProject(),t=x.useChangePage(),l=(i==null?void 0:i.homepage)===s.uuid,a=r===s.uuid,c=()=>t(s);return i?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${a?"bg-blue-200 ":""}`,onClick:c,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex text-sm items-center gap-x-1.5",children:[l?e.jsxRuntimeExports.jsx(n.HomeIcon,{}):e.jsxRuntimeExports.jsx(n.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(j,{pageData:s})]}):null},p=({pages:s,isLoading:r})=>r?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):s.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:u.Children.toArray(s.map(i=>e.jsxRuntimeExports.jsx(q,{...i})))});exports.default=p;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./jsx-runtime-Z_BpKhVy.cjs"),a=require("react"),f=require("./index-9PHdn80L.cjs"),o=require("./controls-KK2oLIa8.cjs"),d=require("./form-n1Q6u16z.cjs"),m=require("./index-nwAgi0aD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.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-scroll-area");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-dom");require("react-quill");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-0bwkNnA0.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-FGufPv9R.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");function j(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const u=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,u.get?u:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const g=j(a),b=({_projectData:r,seany:i})=>{const{data:e,isLoading:u}=m.useProject();g.useEffect(()=>{e&&i(e)},[e,i]);const n=({formData:s},t)=>{i(l=>({...l,[t]:s[t]}))},c={name:o.u({title:"Project Name",default:e==null?void 0:e.name}),favicon:o.o({title:"Favicon",default:e==null?void 0:e.favicon})};return q.jsxRuntimeExports.jsx(f.ScrollArea,{className:"flex h-full select-none flex-col",children:q.jsxRuntimeExports.jsx(d.Form,{properties:c,disabled:u,formData:r,onChange:n})})};exports.default=b;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-Z_BpKhVy.cjs"),i=require("./controls-KK2oLIa8.cjs"),g=require("./form-n1Q6u16z.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("lodash-es");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-9PHdn80L.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.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-scroll-area");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-dom");require("react-quill");require("react-i18next");const D=({_projectData:e,seany:n})=>{var t,u,o,s,q,a;const d=({formData:f})=>{const r={...f};r.seoData.title===void 0&&(r.seoData.title=""),r.seoData.description===void 0&&(r.seoData.description=""),r.seoData.image===void 0&&(r.seoData.image=""),n(m=>({...m,...r}))},c={seoData:i.b({title:"",default:{title:((t=e.seoData)==null?void 0:t.title)||"",description:((u=e.seoData)==null?void 0:u.description)||"",image:((o=e.seoData)==null?void 0:o.image)||""},properties:{title:i.u({title:"Default Title",default:((s=e.seoData)==null?void 0:s.title)||""}),description:i.g({title:"Default Description",default:((q=e.seoData)==null?void 0:q.description)||""}),image:i.o({title:"Social Media Image",default:((a=e.seoData)==null?void 0:a.image)||""})}})};return l.jsxRuntimeExports.jsx("div",{className:"flex h-full select-none flex-col",children:l.jsxRuntimeExports.jsx(g.Form,{properties:c,formData:e,onChange:d})})};exports.default=D;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),f=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./index-9PHdn80L.cjs"),d=require("./controls-KK2oLIa8.cjs"),w=require("sonner"),p=require("./form-n1Q6u16z.cjs"),P=require("./index-nwAgi0aD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-dom");require("react-quill");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-0bwkNnA0.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-FGufPv9R.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const z=f.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-c3b-GCap.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-f26zJ7Js.cjs"))),E=u=>{if(!c.isString(u)||!(u.includes("/[")&&u.includes("]")))return!1;const s=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,q=/^[a-zA-Z0-9_-]+$/;let e=!0;return u.split("/").forEach(n=>{e&&(n.includes("[[")&&n.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(n):n.includes("[")&&n.includes("]")?e=s.test(n):e=q.test(n))}),e},h=u=>u&&c.isEmpty(u.seoData)?{...u,seoData:{title:"",description:"",image:""}}:u,G=(u,o)=>{const s=!c.isEqual(c.omit(u,["seoData"]),c.omit(o,["seoData"])),q=!c.isEqual(h(o).seoData,h(u).seoData);return s||q},Y=({open:u,setOpen:o,pageData:s})=>{const q=P.useQueryClient(),{data:e}=P.useProject(),n=P.useUpdatePage(),m=P.useUpdateProject("Homepage updated successfully."),[i,b]=f.useState(h(s)),[a,A]=f.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=G(i,s);f.useEffect(()=>{const l=!c.isEqual(h(s),i),t=(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage;o(l||t?"PENDING":"OPEN")},[e,s,i,a,o]);const C=()=>{if(j){if(s.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")){u==="ALERT"&&o("PENDING");return}n.mutate(i,{onSuccess:()=>{q.invalidateQueries({refetchType:"active",queryKey:["pages",e==null?void 0:e.uuid]}),o("CLOSE"),w.toast.success("Page updated successfully.")}})}a.isHomePage&&(e==null?void 0:e.homepage)!==s.uuid&&m.mutate({...e,homepage:s==null?void 0:s.uuid},{onSuccess:()=>o("CLOSE")})},R=({formData:l},t)=>{b(g=>{var S,N;if(!t)return g;const x={[t]:l[t]};return t==="name"?x.slug=c.kebabCase((S=l[t])==null?void 0:S.replace(/\d/g,"")):t==="slug"?x.slug=(N=l[t])==null?void 0:N.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):t==="seoData"&&(x.seoData={title:l[t].title||"",description:l[t].description||"",image:l[t].image||""}),{...g,...x}})},I=({formData:l},t)=>{A(g=>{const x={[t]:l[t]};return{...g,...x}})},v={name:d.u({title:"Page Name",default:i.name}),slug:d.u({title:"Page Slug",default:i.slug})},T={seoData:d.b({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.u({title:"Meta Title",default:i.name}),description:d.g({title:"Meta Description",default:i.slug}),image:d.o({title:"Social Media Image",default:""})}})},M={isHomePage:d.r({title:"Set as homepage",default:a.isHomePage})};return r.jsxRuntimeExports.jsxs(y.ScrollArea,{className:"flex h-full select-none flex-col",children:[r.jsxRuntimeExports.jsx(L,{open:u==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:C,disabled:m.isPending||n.isPending}),r.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),r.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[r.jsxRuntimeExports.jsx(p.Form,{title:"Basic Details",formData:i,properties:v,onChange:R,disabled:n.isPending||m.isPending}),r.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),r.jsxRuntimeExports.jsx(p.Form,{title:"SEO Details",formData:i,properties:T,onChange:R,disabled:n.isPending||m.isPending}),(e==null?void 0:e.homepage)!==s.uuid&&s.type==="STATIC"?r.jsxRuntimeExports.jsx(p.Form,{formData:a,properties:M,onChange:I,disabled:n.isPending||m.isPending}):s.type==="STATIC"&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[r.jsxRuntimeExports.jsx(H.HomeIcon,{})," This is homepage"," "]}),i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")&&r.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",r.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),r.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[r.jsxRuntimeExports.jsx(y.Button,{className:"w-full",type:"submit",onClick:C,disabled:(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage?!1:c.isEmpty(i.name)||c.isEmpty(i.slug)||!j||n.isPending||m.isPending||i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||""),children:"Save"}),r.jsxRuntimeExports.jsx(z,{pageData:s,projectData:e})]})]})})]})};exports.default=Y;
@@ -1,20 +0,0 @@
1
- import { useCallback as d } from "react";
2
- import { noop as s, has as a } from "lodash-es";
3
- import { L as u, h as i } from "./index-IPJAbzzO.js";
4
- const f = () => {
5
- const { addCoreBlock: r } = u(), l = i("getExternalPredefinedBlock", s);
6
- return d(
7
- async (n) => {
8
- const { block: e, dropTargetId: o, relativeIndex: t } = n;
9
- if (a(e, "format")) {
10
- const c = await l(e);
11
- return r({ blocks: c }, o === 0 ? null : o, t);
12
- }
13
- return r(e, o === 0 ? null : o, t);
14
- },
15
- [r]
16
- );
17
- };
18
- export {
19
- f as u
20
- };
@@ -1 +0,0 @@
1
- "use strict";const u=require("react"),t=require("lodash-es"),l=require("./index-9PHdn80L.cjs"),a=()=>{const{addCoreBlock:o}=l.useAddBlock(),s=l.useBuilderProp("getExternalPredefinedBlock",t.noop);return u.useCallback(async n=>{const{block:r,dropTargetId:e,relativeIndex:c}=n;if(t.has(r,"format")){const d=await s(r);return o({blocks:d},e===0?null:e,c)}return o(r,e===0?null:e,c)},[o])};exports.useAddBlockByDrop=a;